Пример #1
0
    def test_get_daughter(self):
        person = Person(5, "Mother", "Female")
        son = Person(7, "Son", "Male")
        daughter = Person(9, "Daughter", "Female")

        self.assertEqual(person.get_daughter(), [])
        person.children.append(son)
        self.assertEqual(person.get_daughter(), [])
        person.children.append(daughter)
        daughters = person.get_daughter()
        self.assertEqual(len(daughters), 1)
        self.assertEqual(daughters[0].name, "Daughter")
        self.assertTrue(daughters[0].gender in variables.Gender[variables.female])
Пример #2
0
    def test_get_relationship(self, mock_get_paternal_aunt,
                              mock_get_paternal_uncle,
                              mock_get_maternal_aunt, mock_get_maternal_uncle,
                              mock_get_brother_in_law, mock_get_sister_in_law,
                              mock_get_son, mock_get_daughter,
                              mock_get_siblings, mock_get_spouse,
                              mock_get_mother, mock_get_father):
        person = Person(1, "man", "Male")

        self.assertEqual(person.get_paternal_aunt(), ["aunty", "aunt"])
        mock_get_paternal_aunt.assert_called_with()

        self.assertEqual(person.get_paternal_uncle(), ["uncle", "uncles"])
        mock_get_paternal_uncle.assert_called_with()

        self.assertEqual(person.get_maternal_aunt(), ["aunt", "aunty"])
        mock_get_maternal_aunt.assert_called_with()

        self.assertEqual(person.get_maternal_uncle(), ["uncles", "uncle"])
        mock_get_maternal_uncle.assert_called_with()

        self.assertEqual(person.get_brother_in_law(), ["brother", "bro"])
        mock_get_brother_in_law.assert_called_with()

        self.assertEqual(person.get_sister_in_law(), ["sis", "sissy"])
        mock_get_sister_in_law.assert_called_with()

        self.assertEqual(person.get_son(), ["son", "sonny"])
        mock_get_son.assert_called_with()

        self.assertEqual(person.get_daughter(), ["daughter", "daughters"])
        mock_get_daughter.assert_called_with()

        self.assertEqual(person.get_siblings(), ["brother", "sister"])
        mock_get_siblings.assert_called_with()

        self.assertEqual(person.get_spouse(), ["Spouse"])
        mock_get_spouse.assert_called_with()

        self.assertEqual(person.get_mother(), ["Mother"])
        mock_get_mother.assert_called_with()

        self.assertEqual(person.get_father(), ["Father"])
        mock_get_father.assert_called_with()