From 3865b1979b76d4cb8ea353163b1f05a04b53cd54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Sat, 15 Oct 2022 15:59:07 +0200 Subject: [PATCH] up --- unittests/test_tool.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/unittests/test_tool.py b/unittests/test_tool.py index 3747553f..e924a9d6 100755 --- a/unittests/test_tool.py +++ b/unittests/test_tool.py @@ -519,11 +519,11 @@ def test_all_references_are_existing_already2(crawler): assert crawler.all_references_are_existing_already( db.Record().add_parent("C").add_property('a', 123)) - assert crawler.all_references_are_existing_already(db.Record().add_parent("C") + assert crawler.all_references_are_existing_already(db.Record().add_parent("C")) assert crawler.all_references_are_existing_already(db.Record().add_parent("D") .add_property('a', 123) .add_property('b', db.Record(id=123))) - a=db.Record(name="A").add_parent("C").add_property("a", 12311) + a = db.Record(name="A").add_parent("C").add_property("a", 12311) assert not crawler.all_references_are_existing_already(db.Record().add_parent("D") .add_property('a', 123) .add_property('b', a)) @@ -533,10 +533,12 @@ def test_all_references_are_existing_already2(crawler): .add_property('b', a)) # if this ever fails, the mock up may be removed crawler.identifiableAdapter.get_registered_identifiable.assert_called() + + def test_all_references_are_existing_already(crawler): # Simulate remote server content by using the names to identify records # There are only two known Records with name A and B - crawler.identifiableAdapter.get_registered_identifiable=Mock(side_effect=partial( + crawler.identifiableAdapter.get_registered_identifiable = Mock(side_effect=partial( basic_retrieve_by_name_mock_up, known={"A": db.Record(name="A").add_parent("C"), "B": db.Record(name="B").add_parent("C")})) @@ -547,7 +549,7 @@ def test_all_references_are_existing_already(crawler): assert crawler.all_references_are_existing_already(db.Record().add_parent("D") .add_property('a', 123) .add_property('b', db.Record(id=123))) - a=db.Record(name="A").add_parent("C").add_property("a", 12311) + a = db.Record(name="A").add_parent("C").add_property("a", 12311) assert not crawler.all_references_are_existing_already(db.Record().add_parent("D") .add_property('a', 123) .add_property('b', a)) @@ -560,10 +562,10 @@ def test_all_references_are_existing_already(crawler): def test_can_be_checked_externally2(crawler): - registered_identifiables={ + registered_identifiables = { "C": db.Record().add_parent("C").add_property("a"), "D": db.Record().add_parent("D").add_property("a").add_property("b")} - crawler.identifiableAdapter.get_registered_identifiable=Mock(side_effect=partial( + crawler.identifiableAdapter.get_registered_identifiable = Mock(side_effect=partial( basic_ident_lookup, idents=registered_identifiables)) assert crawler.can_be_checked_externally(db.Record().add_parent("C").add_property('a', 123)) assert crawler.can_be_checked_externally(db.Record().add_parent("C") @@ -575,6 +577,8 @@ def test_can_be_checked_externally2(crawler): assert not crawler.can_be_checked_externally(db.Record().add_parent("D") .add_property('a', 123) .add_property('b', db.Record())) + + def test_can_be_checked_externally(crawler): assert crawler.can_be_checked_externally( db.Record().add_property('a', 123)) @@ -590,7 +594,7 @@ def test_can_be_checked_externally(crawler): def test_replace_entities_with_ids(crawler): - a=(db.Record().add_parent("B").add_property("A", 12345) + a = (db.Record().add_parent("B").add_property("A", 12345) .add_property("B", db.Record(id=12345)) .add_property("C", [db.Record(id=12345), 233324])) -- GitLab