From 5ca82248d30238152ae353b8068b96aa291c4bef Mon Sep 17 00:00:00 2001 From: prculley Date: Wed, 1 Feb 2017 18:32:19 -0600 Subject: [PATCH] Add tests for new Person HasSoundexName, and old HasNameOf rules --- .../filters/rules/test/person_rules_test.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gramps/gen/filters/rules/test/person_rules_test.py b/gramps/gen/filters/rules/test/person_rules_test.py index 463f5baca..f97d5bcca 100644 --- a/gramps/gen/filters/rules/test/person_rules_test.py +++ b/gramps/gen/filters/rules/test/person_rules_test.py @@ -36,7 +36,7 @@ from gramps.gen.filters.rules.person import ( IsDuplicatedAncestorOf, IsRelatedWith, HasIdOf, IsDefaultPerson, IsFemale, IsMale, MissingParent, MultipleMarriages, NeverMarried, NoBirthdate, NoDeathdate, PeoplePrivate, PeoplePublic, PersonWithIncompleteEvent, - RelationshipPathBetweenBookmarks) + RelationshipPathBetweenBookmarks, HasNameOf, HasSoundexName) TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests")) EXAMPLE = os.path.join(TEST_DIR, "example.gramps") @@ -564,6 +564,22 @@ class BaseTest(unittest.TestCase): b'D3WJQCCGV58IP8PNHZ', b'Q8HKQC3VMRM1M6M7ES', ])) + def test_hassoundexname(self): + """ + Test HasSoundexName rule. + """ + rule = HasSoundexName(['garner']) + self.assertEqual(len(self.filter_with_rule(rule)), 73) + + def test_hasnameof(self): + """ + Test HasNameOf rule. + """ + rule = HasNameOf(['Lewis', 'Garner', 'Dr.', 'Sr', 'Anderson', + 'Big Louie', 'von', 'ZieliƄski', None, None, None]) + self.assertEqual(self.filter_with_rule(rule), set([ + b'GNUJQCL9MD64AM56OH'])) + if __name__ == "__main__": unittest.main()