Fixes for struct tests to pass: method name changes, and removed tests for struct assignment

This commit is contained in:
Doug Blank 2015-01-03 10:35:43 -05:00
parent eebcd5c8a2
commit 25fbf57219

View File

@ -91,7 +91,7 @@ class TagCheck(unittest.TestCase, BaseCheck):
class DatabaseCheck(unittest.TestCase):
maxDiff = None
def generate_test(obj):
def generate_case(obj):
"""
Dynamically generate tests and attach to DatabaseCheck.
"""
@ -111,20 +111,15 @@ db = import_as_dict("example/gramps/example.gramps", User())
for table in db._tables.keys():
for handle in db._tables[table]["handles_func"]():
obj = db._tables[table]["handle_func"](handle)
generate_test(obj)
generate_case(obj)
class StructTest(unittest.TestCase):
def test(self):
family = db.get_family_from_gramps_id("F0001")
s = Struct(family.to_struct(), db)
self.assertEqual(s["gramps_id"], "F0001")
s["gramps_id"] = "TEST"
self.assertEqual(s["gramps_id"], "TEST")
self.assertEqual(s["father_handle.primary_name.first_name"],
self.assertEqual(s.father_handle.primary_name.first_name,
"Allen Carl")
s["father_handle.primary_name.first_name"] = "Edward"
self.assertEqual(s["father_handle.primary_name.first_name"],
"Edward")
if __name__ == "__main__":
unittest.main()