Ejemplo n.º 1
0
    def test_get_siblings(self):
        person = Person(5, "Dummy", "Male")
        mother = Person(9, "Mother", "Female")
        son = Person(7, "Son", "Male")
        daughter = Person(7, "Daughter", "Female")

        self.assertEqual(person.get_siblings(), [])
        person.mother = mother
        self.assertEqual(person.get_siblings(), [])
        mother.children.extend([person, son, daughter])
        person.mother = mother
        siblings = person.get_siblings()
        self.assertEqual(len(siblings), 2)
Ejemplo n.º 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()