def test_derive_without_events(self): with TemporaryDirectory() as output_directory_path: configuration = Configuration( output_directory_path, 'https://example.com') configuration.plugins[Deriver] = {} site = Site(configuration) person = Person('P0') site.ancestry.people[person.id] = person parse(site) self.assertEquals(0, len(person.presences))
def test_post_parse(self) -> None: with TemporaryDirectory() as output_directory_path: configuration = Configuration(output_directory_path, 'https://example.com') configuration.plugins[Cleaner] = {} site = Site(configuration) event = IdentifiableEvent('E0', Event.Type.BIRTH) site.ancestry.events[event.id] = event parse(site) self.assertEquals({}, site.ancestry.events)
def test_derive_with_events_without_dates(self): with TemporaryDirectory() as output_directory_path: configuration = Configuration( output_directory_path, 'https://example.com') configuration.plugins[Deriver] = {} site = Site(configuration) person = Person('P0') Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.MARRIAGE)) site.ancestry.people[person.id] = person parse(site) self.assertEquals(1, len(person.presences))
def test_post_parse(self): with TemporaryDirectory() as output_directory_path: configuration = Configuration( output_directory_path, 'https://example.com') configuration.plugins[Privatizer] = {} site = Site(configuration) person = Person('P0') Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.BIRTH)) site.ancestry.people[person.id] = person parse(site) self.assertTrue(person.private)
def test_post_parse(self) -> None: with TemporaryDirectory() as output_directory_path: configuration = Configuration(output_directory_path, 'https://example.com') configuration.plugins[Anonymizer] = {} site = Site(configuration) person = Person('P0') person.private = True person.names.append(PersonName('Jane', 'Dough')) site.ancestry.people[person.id] = person parse(site) self.assertEquals(0, len(person.names))
def test_post_parse(self): with TemporaryDirectory() as output_directory_path: configuration = Configuration( output_directory_path, 'https://example.com') configuration.plugins[Deriver] = {} site = Site(configuration) person = Person('P0') other_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.MARRIAGE)) other_presence.event.date = Date(1970, 1, 1) site.ancestry.people[person.id] = person parse(site) self.assertEquals(3, len(person.presences)) self.assertEquals(DateRange(None, Date(1970, 1, 1)), person.start.date) self.assertEquals(DateRange(Date(1970, 1, 1)), person.end.date)
def test_parse_event(self): with TemporaryDirectory() as output_directory_path: configuration = Configuration(output_directory_path, 'https://example.com') configuration.plugins[Gramps] = { 'file': join(dirname(abspath(__file__)), 'resources', 'minimal.gpkg') } site = Site(configuration) parse(site) self.assertEquals('Dough', site.ancestry.people['I0000'].name.affiliation) self.assertEquals('Janet', site.ancestry.people['I0000'].name.individual) self.assertEquals('1px', site.ancestry.files['O0000'].description)
def test_derive_birth_with_existing_event(self, other_date: Datey): with TemporaryDirectory() as output_directory_path: configuration = Configuration( output_directory_path, 'https://example.com') configuration.plugins[Deriver] = {} site = Site(configuration) person = Person('P0') other_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.MARRIAGE)) other_presence.event.date = other_date irrelevant_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E1', Event.Type.DIVORCE)) irrelevant_presence.event.date = Date(1972, 1, 1) site.ancestry.people[person.id] = person parse(site) self.assertEquals(4, len(person.presences)) self.assertEquals(DateRange(None, Date(1971, 1, 1)), person.start.date)
def test_derive_birth_with_existing_birth_with_date(self): with TemporaryDirectory() as output_directory_path: configuration = Configuration( output_directory_path, 'https://example.com') configuration.plugins[Deriver] = {} site = Site(configuration) person = Person('P0') birth_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.BIRTH)) birth_presence.event.date = Date(1970, 2, 1) other_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.MARRIAGE)) other_presence.event.date = Date(1970, 1, 1) site.ancestry.people[person.id] = person parse(site) self.assertEquals(3, len(person.presences)) self.assertIsNotNone(birth_presence.event.date) self.assertEquals(Date(1970, 2, 1), birth_presence.event.date)
def test_post_parse(self): with TemporaryDirectory() as output_directory_path: configuration = Configuration(output_directory_path, 'https://example.com') configuration.plugins[Anonymizer] = {} site = Site(configuration) with NamedTemporaryFile() as file_f: person = Person('P0', 'Janet', 'Dough') person.private = True presence = Presence(Presence.Role.SUBJECT) presence.event = Event('E0', Event.Type.BIRTH) person.presences.add(presence) person.files.add(File('D0', file_f.name)) site.ancestry.people[person.id] = person parse(site) self.assert_anonymized(person)
def run(self): parse.parse(self._site) render.render(self._site)