Add tests for new Person HasSoundexName, and old HasNameOf rules
This commit is contained in:
parent
ec6343e00c
commit
5ca82248d3
@ -36,7 +36,7 @@ from gramps.gen.filters.rules.person import (
|
|||||||
IsDuplicatedAncestorOf, IsRelatedWith, HasIdOf, IsDefaultPerson, IsFemale,
|
IsDuplicatedAncestorOf, IsRelatedWith, HasIdOf, IsDefaultPerson, IsFemale,
|
||||||
IsMale, MissingParent, MultipleMarriages, NeverMarried, NoBirthdate,
|
IsMale, MissingParent, MultipleMarriages, NeverMarried, NoBirthdate,
|
||||||
NoDeathdate, PeoplePrivate, PeoplePublic, PersonWithIncompleteEvent,
|
NoDeathdate, PeoplePrivate, PeoplePublic, PersonWithIncompleteEvent,
|
||||||
RelationshipPathBetweenBookmarks)
|
RelationshipPathBetweenBookmarks, HasNameOf, HasSoundexName)
|
||||||
|
|
||||||
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
|
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
|
||||||
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
|
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
|
||||||
@ -564,6 +564,22 @@ class BaseTest(unittest.TestCase):
|
|||||||
b'D3WJQCCGV58IP8PNHZ', b'Q8HKQC3VMRM1M6M7ES',
|
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__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user