diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py index 98bcb473822d037820b65e1393db52ba72009dea..81fe351f21c172f4650befe516d3833d103e5d3c 100644 --- a/tests/test_issues_server.py +++ b/tests/test_issues_server.py @@ -1254,3 +1254,53 @@ def test_196b(deny): # this should fail because the curator doesn't have TRANSACTION:INSERT:PROPERTY db.Property(name="TestProp2", datatype=db.TEXT).insert() 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"]) +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) + + +def test_144(): + """https://gitlab.com/caosdb/caosdb-server/-/issues/144""" + db.Property(name="scientific_notation", datatype=db.DOUBLE, value="1e23").insert() + + value = db.execute_query("FIND PROPERTY scientific_notation", unique=True).value + assert str(value) == "1e+23" + assert isinstance(value, float) + assert value == 1e23 + assert value == 1e+23 + + +def test_166(): + """https://gitlab.com/caosdb/caosdb-server/-/issues/166""" + db.RecordType(name="exists").insert() + db.Property(name="exists_property", datatype=db.INTEGER).insert() + + db.RecordType(name="RT1").add_parent("exists").insert() + db.RecordType(name="RT2").add_parent("exists").add_property("exists_property", 32453).insert() + + with pytest.raises(TransactionError) as cm: + db.Record(name="RT3").add_parent("notexists").insert() + assert [e.msg for e in cm.value.errors] == ["Entity has unqualified parents."] + + with pytest.raises(TransactionError) as cm: + db.Record(name="RT4").add_parent("exists").add_property("notexists", 234243).insert() + assert [e.msg for e in cm.value.errors] == ["Entity has unqualified properties."] + + with pytest.raises(TransactionError) as cm: + db.Record( + name="RT5").add_parent("notexists").add_property( + "exists_property", + 234243).insert() + assert [e.msg for e in cm.value.errors] == ["Entity has unqualified parents."] \ No newline at end of file