From e94e7977ee7ddfe97ceeb002d2bcb3684e8a9dcf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Tue, 17 Jan 2023 11:23:49 +0100
Subject: [PATCH] MAINT: accept strip of query string; test boolean values

---
 src/caoscrawler/identifiable_adapters.py | 6 +-----
 unittests/test_identifiable_adapters.py  | 6 +++---
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/caoscrawler/identifiable_adapters.py b/src/caoscrawler/identifiable_adapters.py
index 3568978b..f3296105 100644
--- a/src/caoscrawler/identifiable_adapters.py
+++ b/src/caoscrawler/identifiable_adapters.py
@@ -60,11 +60,7 @@ def convert_value(value):
         # replace single quotes, otherwise they may break the queries
         return value.replace("\'", "\\'")
     else:
-        # TODO: check whether this here is needed:
-        # TODO: added strip, because whitespace is ignored by CaosDB anyways at the
-        #       boundaries of the string
-        # return str(value).strip()
-        return f"{value}"
+        return str(value).strip()
 
 
 class IdentifiableAdapter(metaclass=ABCMeta):
diff --git a/unittests/test_identifiable_adapters.py b/unittests/test_identifiable_adapters.py
index 7f1ba9d7..c9c9e86a 100644
--- a/unittests/test_identifiable_adapters.py
+++ b/unittests/test_identifiable_adapters.py
@@ -50,9 +50,9 @@ def test_create_query_for_identifiable():
             "h": db.Record(id=1111),
             "i": db.File(id=1112),
             "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'"
-            " and 'f'='2020-10-10t00:00:00' and 'g'='true' and 'h'='1111' and 'i'='1112' and "
-            "'j'='2222' and 'j'='3333' ")
+    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 "
+            "'j'='2222' AND 'j'='3333' ")
 
     # The name can be the only identifiable
     query = IdentifiableAdapter.create_query_for_identifiable(
-- 
GitLab