Skip to content
Snippets Groups Projects

TST: Test for issue server#143.

Merged Timm Fitschen requested to merge f-server-144 into dev
All threads resolved!
Files
4
@@ -1256,19 +1256,39 @@ def test_196b(deny):
assert cm.value.errors[0].msg == "You are not allowed to do this."
@pytest.mark.xfail(reason="fix needed")
@pytest.mark.parametrize("num", ["1e+23", "5e22", "2e-323"])
@pytest.mark.parametrize("num", ["1e+23", "5e22", "2e-323", "2E-323", "5E22", "1E+23", "+1E+23"])
def test_143(num):
"""https://gitlab.com/caosdb/caosdb-server/-/issues/144"""
db.Property(name="scientific_notation", datatype=db.DOUBLE).insert()
db.RecordType(name="RT1").add_property("scientific_notation", value=num).insert()
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation={num}", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation='{num}'", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation=\"{num}\"", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation = {num}", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation = '{num}'", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation = \"{num}\"", unique=True)
for query in [
f"FIND RECORDTYPE RT1 WITH scientific_notation={num}",
f"FIND RECORDTYPE RT1 WITH scientific_notation='{num}'",
f"FIND RECORDTYPE RT1 WITH scientific_notation=\"{num}\"",
f"FIND RECORDTYPE RT1 WITH scientific_notation = {num}",
f"FIND RECORDTYPE RT1 WITH scientific_notation = '{num}'",
f"FIND RECORDTYPE RT1 WITH scientific_notation = \"{num}\""
]:
db.execute_query(query, unique=True)
@pytest.mark.parametrize("num", ["1 e+23", "- 5e22", "2e -323",
"2E- 323", "5 E 22", "1 E+ 23", "+ 1"])
def test_143_white_space(num):
"""https://gitlab.com/caosdb/caosdb-server/-/issues/144"""
for query in [
f"FIND RECORDTYPE RT1 WITH scientific_notation={num}",
f"FIND RECORDTYPE RT1 WITH scientific_notation='{num}'",
f"FIND RECORDTYPE RT1 WITH scientific_notation=\"{num}\"",
f"FIND RECORDTYPE RT1 WITH scientific_notation = {num}",
f"FIND RECORDTYPE RT1 WITH scientific_notation = '{num}'",
f"FIND RECORDTYPE RT1 WITH scientific_notation = \"{num}\""
]:
with pytest.raises(TransactionError) as cm:
db.execute_query(query)
assert cm.value.msg == f'You typed "{num}". Empty spaces are not allowed in numbers. Did you mean "{num.replace(" ", "")}"?'
def test_144():
Loading