Skip to content
Snippets Groups Projects
Commit e94e7977 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: accept strip of query string; test boolean values

parent 06a1c956
No related branches found
No related tags found
1 merge request!77MAINT: refactor converters and structure elements
Pipeline #33316 failed
...@@ -60,11 +60,7 @@ def convert_value(value): ...@@ -60,11 +60,7 @@ def convert_value(value):
# replace single quotes, otherwise they may break the queries # replace single quotes, otherwise they may break the queries
return value.replace("\'", "\\'") return value.replace("\'", "\\'")
else: else:
# TODO: check whether this here is needed: return str(value).strip()
# TODO: added strip, because whitespace is ignored by CaosDB anyways at the
# boundaries of the string
# return str(value).strip()
return f"{value}"
class IdentifiableAdapter(metaclass=ABCMeta): class IdentifiableAdapter(metaclass=ABCMeta):
......
...@@ -50,9 +50,9 @@ def test_create_query_for_identifiable(): ...@@ -50,9 +50,9 @@ def test_create_query_for_identifiable():
"h": db.Record(id=1111), "h": db.Record(id=1111),
"i": db.File(id=1112), "i": db.File(id=1112),
"j": [2222, db.Record(id=3333)]})) "j": [2222, db.Record(id=3333)]}))
assert (query.lower() == "find record b with name='a' and 'c'='c' and 'd'='5' and 'e'='5.5'" assert (query == "FIND RECORD B WITH name='A' AND 'c'='c' AND 'd'='5' AND 'e'='5.5'"
" and 'f'='2020-10-10t00:00:00' and 'g'='true' and 'h'='1111' and 'i'='1112' and " " AND 'f'='2020-10-10T00:00:00' AND 'g'='TRUE' AND 'h'='1111' AND 'i'='1112' AND "
"'j'='2222' and 'j'='3333' ") "'j'='2222' AND 'j'='3333' ")
# The name can be the only identifiable # The name can be the only identifiable
query = IdentifiableAdapter.create_query_for_identifiable( query = IdentifiableAdapter.create_query_for_identifiable(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment