Skip to content
Snippets Groups Projects
Commit a35e52d8 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

up

parent 63840ef6
No related branches found
No related tags found
1 merge request!8F h5 cfood
......@@ -61,6 +61,7 @@ class structureMappingTest(unittest.TestCase):
collect_existing_structure(recb1, reca1, emap)
# Test if the two dicts of the entity mapping correctly depend on each other
for i in emap.to_existing.keys():
self.assertEqual(i, emap.to_target[emap.to_existing[i].id]._cuid)
......@@ -76,11 +77,11 @@ class structureMappingTest(unittest.TestCase):
(recb1 not in emap.to_target.values()))
# Test the correct assignment of the properties
self.assertTrue(reca2 is emap.to_existing[emap.to_target[200]._cuid])
self.assertTrue(reca3 is emap.to_existing[emap.to_target[300]._cuid])
self.assertTrue(reca2 is emap.to_existing[recb2._cuid])
self.assertTrue(reca3 is emap.to_existing[recb3._cuid])
self.assertTrue(recb2 is emap.to_target[emap.to_existing[recb2._cuid].id])
self.assertTrue(recb3 is emap.to_target[emap.to_existing[recb3._cuid].id])
self.assertTrue(recb2 is emap.to_target[reca2.id])
self.assertTrue(recb3 is emap.to_target[reca3.id])
"""Test with one additional Property and Properties, which are not Records"""
emap2 = EntityMapping()
......@@ -109,17 +110,24 @@ class structureMappingTest(unittest.TestCase):
collect_existing_structure(recd1, recc1, emap2)
# Test the correct assignment of the properties
self.assertTrue(recc2 is emap.to_existing[recd2._cuid])
self.assertTrue(recc3 is emap.to_existing[recd3._cuid])
self.assertTrue(recd2 is emap.to_target[recc2.id])
self.assertTrue(recd3 is emap.to_target[recc3.id])
""" Test, if the Record `Cars` in `target_structure` have one additional Property """
# Test existing structure
self.assertEqual(len(recc2.get_properties()), 1) # only one property
self.assertEqual(len(emap2.to_existing[recd2._cuid].get_properties()), 1)
self.assertEqual(len(recc2.get_properties()), 1) # number of properties stay unchanged
self.assertEqual(len(recd2.get_properties()), 2) # number of properties stay unchanged
for prop_record, prop_em in zip(recc2.get_properties(), emap2.to_existing[recd2._cuid].get_properties()):
self.assertEqual(prop_em, prop_record)
for prop_record, prop_em in zip(recc2.get_properties(), recd2.get_properties()):
self.assertTrue(prop_record is emap.to_existing[prop_em._cuid])
# Test target structure
self.assertEqual(len(recd2.get_properties()), 2) # two propertis
self.assertEqual(len(emap2.to_target[recc2.id].get_properties()), 2)
self.assertEqual(len(recc3.get_properties()), 2) # number of properties stay unchanged
self.assertEqual(len(recd3.get_properties()), 2) # number of properties stay unchanged
for prop_record, prop_em in zip(recd2.get_properties(), emap2.to_target[recc2.id].get_properties()):
self.assertEqual(prop_em, prop_record)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment