Пример #1
0
    def test_date_structure(self):
        '''
        Test creation of geni date structure
        '''
        my_event = event_profile("birth")
        #my_event.setDate(year, month, day, accuracy, year_end, month_end, day_end)
        my_event.setDate(2017, 11, 20, "EXACT")

        output = profile.getDateStructureGeni(my_event)
        assert (output["year"] == 2017)
        assert (output["month"] == 11)
        assert (output["day"] == 20)
        #Testing about
        my_event.setDate(2017, accuracy="ABOUT")
        output2 = profile.getDateStructureGeni(my_event)
        assert (output2["year"] == 2017)
        self.assertFalse("month" in output2.keys())
        self.assertFalse("day" in output2.keys())
        assert (output2["circa"] == True)
        my_event.setDate(2017, accuracy="ABOUT")
        #Testing the data before
        my_event.setDate(2017, accuracy="BEFORE")
        output3 = profile.getDateStructureGeni(my_event)
        assert (output3["range"] == "before")
        #Testing the data before
        my_event.setDate(2017, accuracy="AFTER")
        output4 = profile.getDateStructureGeni(my_event)
        assert (output4["range"] == "after")

        my_other_event = event_profile("birth")
        self.assertFalse(profile.getDateStructureGeni(my_other_event))
    def test_date_structure(self):
        '''
        Test creation of geni date structure
        '''
        test_date = date(2017, 11, 20)

        output = profile.getDateStructureGeni(test_date, "EXACT")
        assert (output["year"] == 2017)
        assert (output["month"] == 11)
        assert (output["day"] == 20)
        output2 = profile.getDateStructureGeni(test_date, "ABOUT")
        assert (output2["year"] == 2017)
        self.assertFalse("month" in output2.keys())
        self.assertFalse("day" in output2.keys())
        assert (output2["circa"] == True)
        output3 = profile.getDateStructureGeni(test_date, "BEFORE")
        assert (output3["range"] == "before")
        output4 = profile.getDateStructureGeni(test_date, "AFTER")
        assert (output4["range"] == "after")

        self.assertFalse(profile.getDateStructureGeni(None, None))