diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py index 13e10ac6d7d4777f38bbde14b2ffe0a7ee5e483c..22b2508c3fea2ea894f72bdb0e93d313cecb7882 100644 --- a/tests/test_issues_server.py +++ b/tests/test_issues_server.py @@ -257,3 +257,47 @@ def test_issue_131(): "FIND Entity WITH {} > 100.5 €".format(prop.name))] assert rec.id in result_ids + + +def test_issue_170(): + """update scalar data type to list data type""" + p = db.Property(name="TestProp1", datatype=db.LIST(db.INTEGER)) + p.value = [1, 2] + p.insert() + + p2 = db.execute_query("FIND TestProp1", unique=True) + assert p2.datatype == db.LIST(db.INTEGER) + assert p2.value == [1, 2] + + p.description = "TestDescription" + p.update() # this failed + + p2 = db.execute_query("FIND TestProp1", unique=True) + assert p2.datatype == db.LIST(db.INTEGER) + assert p2.value == [1, 2] + assert p2.description == "TestDescription" + + p = db.Property(name="TestProp2", datatype=db.DOUBLE) + p.insert() + + p.datatype = db.LIST(db.INTEGER) + p.update() # this worked because no value yet + p2 = db.execute_query("FIND TestProp2", unique=True) + assert p2.datatype == db.LIST(db.INTEGER) + p.value = [1, 2] + + p.update() # this failed + p2 = db.execute_query("FIND TestProp2", unique=True) + assert p2.datatype == db.LIST(db.INTEGER) + assert p2.value == [1, 2] + + p = db.Property(name="TestProp3", datatype=db.DOUBLE) + p.insert() + + p.datatype = db.LIST(db.INTEGER) + p.value = [1, 2] + p.update() # this failed + + p2 = db.execute_query("FIND TestProp3", unique=True) + assert p2.datatype == db.LIST(db.INTEGER) + assert p2.value == [1, 2]