Example #1
0
 def test_US31_Existing_text(self):
     # should get the following single individuals on the initial data
     expected_ret = [
         'I9', 'I10', 'I89', 'I14', 'I15', 'I31', 'I19', 'I22', 'I23',
         'I24', 'I25'
     ]
     ret = us31_get_single_individuals(self.indMap, self.famMap)
     self.assertListEqual(expected_ret, ret,
                          "Expected Return does not match")
Example #2
0
    def test_US31_AddAnotherDeath(self):
        # make Manny dead - should decrease the singles by one.
        self.indMap["I9"]["DEAT"] = [28, 12, 2021]
        expected_ret = [
            'I10', 'I89', 'I14', 'I15', 'I31', 'I19', 'I22', 'I23', 'I24',
            'I25'
        ]
        ret = us31_get_single_individuals(self.indMap, self.famMap)

        self.assertEqual(len(ret), 10, "Did not get the expected results")

        self.assertListEqual(expected_ret, ret,
                             "Expected Return does not match")
Example #3
0
    def test_US31_noinputs(self):
        # bad inputs
        with self.assertRaises(Exception):
            us31_get_single_individuals(None, None)

        with self.assertRaises(Exception):
            us31_get_single_individuals(self.famMap)

        with self.assertRaises(Exception):
            us31_get_single_individuals(self.indMap)
Example #4
0
    def test_US31_NoLivingSingles(self):
        # Test no living singles by making them all dead
        LivingSingles = [
            'I9', 'I10', 'I89', 'I14', 'I15', 'I31', 'I19', 'I22', 'I23',
            'I24', 'I25'
        ]

        # Make all the living singles dead
        for id, ind in self.indMap.items():
            if id in LivingSingles:
                self.indMap[id]["DEAT"] = [28, 12, 2021]

        expected_ret = []
        ret = us31_get_single_individuals(self.indMap, self.famMap)
        self.assertEqual(len(ret), 0, "Did not get the expected results")

        self.assertListEqual(expected_ret, ret,
                             "Expected Return does not match")
Example #5
0
    def test_US31_AddAnotherSingle(self):
        # Add another child to family F3, so should have one more single
        self.indMap["I28"] = {
            "NAME": "Don/Harrington/",
            "SEX": "M",
            "BIRT": [28, 12, 2021],
            "FAMC": ["F3"],
            "NOTE": "Add another child to Family 3",
            "AGE": 20,
            "INDI": "I28"
        }
        self.famMap["F2"]["CHIL"] = ["I9", "I28"],

        expected_ret = [
            'I9', 'I10', 'I89', 'I14', 'I15', 'I31', 'I19', 'I22', 'I23',
            'I24', 'I25', 'I28'
        ]
        ret = us31_get_single_individuals(self.indMap, self.famMap)

        self.assertEqual(len(ret), 12, "Did not get the expected results")

        self.assertListEqual(expected_ret, ret,
                             "Expected Return does not match")
Example #6
0
 def test_US31_Existing(self):
     # should return 11 singles on the initial data
     ret = us31_get_single_individuals(self.indMap, self.famMap)
     self.assertEqual(len(ret), 11, "Did not get the expected results")
Example #7
0
 def test_US31_listsswitched(self):
     # If send inputs in the wrong order, will get an assert eventually
     with self.assertRaises(Exception):
         us31_get_single_individuals(self.famMap, self.indMap)