You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/community/tests/unit_tests/vectorstores/test_neo4j.py

46 lines
1.6 KiB
Python

"""Test Neo4j functionality."""
from langchain_community.vectorstores.neo4j_vector import remove_lucene_chars
def test_escaping_lucene() -> None:
"""Test escaping lucene characters"""
assert remove_lucene_chars("Hello+World") == "Hello World"
assert remove_lucene_chars("Hello World\\") == "Hello World"
assert (
remove_lucene_chars("It is the end of the world. Take shelter!")
== "It is the end of the world. Take shelter"
)
assert (
remove_lucene_chars("It is the end of the world. Take shelter&&")
== "It is the end of the world. Take shelter"
)
assert (
remove_lucene_chars("Bill&&Melinda Gates Foundation")
== "Bill Melinda Gates Foundation"
)
assert (
remove_lucene_chars("It is the end of the world. Take shelter(&&)")
== "It is the end of the world. Take shelter"
)
assert (
remove_lucene_chars("It is the end of the world. Take shelter??")
== "It is the end of the world. Take shelter"
)
assert (
remove_lucene_chars("It is the end of the world. Take shelter^")
== "It is the end of the world. Take shelter"
)
assert (
remove_lucene_chars("It is the end of the world. Take shelter+")
== "It is the end of the world. Take shelter"
)
assert (
remove_lucene_chars("It is the end of the world. Take shelter-")
== "It is the end of the world. Take shelter"
)
assert (
remove_lucene_chars("It is the end of the world. Take shelter~")
== "It is the end of the world. Take shelter"
)