diff --git a/unittests/test_identifiable.py b/unittests/test_identifiable.py index 25de8fdfa59019df3948a00f92b44fd7b1b39ee7..847438cac752ea91a94adf6fb5dc81e54b87882d 100644 --- a/unittests/test_identifiable.py +++ b/unittests/test_identifiable.py @@ -42,7 +42,8 @@ def test_create_hashable_string(): assert a == b assert ( Identifiable._create_hashable_string( - Identifiable(name="A", record_type="B", properties={'a': db.Record(id=12)}) + Identifiable(name="A", record_type="B", + properties={'a': db.Record(id=12)}) ) == "P<B>N<A>a:12") a = Identifiable._create_hashable_string( Identifiable(name="A", record_type="B", properties={'a': [db.Record(id=12)]})) @@ -51,7 +52,8 @@ def test_create_hashable_string(): Identifiable(name="A", record_type="B", properties={'a': [12]})) == "P<B>N<A>a:[12]") assert ( Identifiable._create_hashable_string( - Identifiable(name="A", record_type="B", properties={'a': [db.Record(id=12), 11]}) + Identifiable(name="A", record_type="B", properties={ + 'a': [db.Record(id=12), 11]}) ) == "P<B>N<A>a:[12, 11]") assert ( Identifiable._create_hashable_string( @@ -68,6 +70,12 @@ def test_name(): def test_repr(): # only test that something meaningful is returned assert 'properties' in str(Identifiable(name="A", record_type="B")) + assert str(Identifiable(name="A", record_type="B", properties={'a': 0})).split( + "properties:\n")[1].split('\n')[0] == '{"a": 0}' + assert str(Identifiable(name="A", record_type="B", properties={'a': 0, 'b': "test"})).split( + "properties:\n")[1].split('\n')[0] == '{"a": 0, "b": "test"}' + + # TODO(henrik): Add a test using backrefs once that's implemented. def test_equality(): @@ -83,5 +91,7 @@ def test_equality(): path="a", properties={"a": 0}) == Identifiable(path="a", properties={"a": 1}) assert Identifiable( path="a", properties={"a": 0}) == Identifiable(properties={"a": 0}) - assert Identifiable(properties={"a": 0}) == Identifiable(properties={"a": 0}) - assert Identifiable(properties={"a": 0}) != Identifiable(properties={"a": 1}) + assert Identifiable(properties={"a": 0}) == Identifiable( + properties={"a": 0}) + assert Identifiable(properties={"a": 0}) != Identifiable( + properties={"a": 1})