forked from chetan-plrch/SSW-555-Team-5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_US16.py
More file actions
97 lines (78 loc) · 3.14 KB
/
test_US16.py
File metadata and controls
97 lines (78 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import unittest
import parse
import datetime
class MyTestCase(unittest.TestCase):
def test_US16_1(self):
individuals = {
'I1': [('NAME', 'John /Doe/'), ('SEX', 'M')],
'I4': [('NAME', 'James /Doe/'), ('SEX', 'M')],
}
families = {
'F1': [('HUSB', 'I1'), ('CHIL', 'I4')],
}
self.assertEqual(parse.maleLastNames(families, individuals), True)
print('US16 Test Case 1 Passed: All Males in the family have the same last name')
def test_US16_2(self):
families = {
'F1': [('HUSB', 'I1'), ('CHIL', 'I4')],
}
individuals = {
'I1': [('NAME', 'John /Doe/'), ('SEX', 'M')],
'I4': [('NAME', 'Michael /Smith/'), ('SEX', 'M')],
}
result = parse.maleLastNames(families, individuals)
self.assertFalse(result)
print('US16 Test Case 2 Passed: All Males in the family do not have the same last name')
def test_US16_3(self):
families = {
'F1': [('HUSB', 'I1'), ('CHIL', 'I4')],
'F2': [('HUSB', 'I7'), ('CHIL', 'I10'), ('CHIL', 'I11')],
}
individuals = {
'I1': [('NAME', 'John /Doe/'), ('SEX', 'M')],
'I4': [('NAME', 'James /Doe/'), ('SEX', 'M')],
'I7': [('NAME', 'Michael /Smith/'), ('SEX', 'M')],
'I10': [('NAME', 'David /Smith/'), ('SEX', 'M')],
'I11': [('NAME', 'Robert /Smith/'), ('SEX', 'M')],
}
result = parse.maleLastNames(families, individuals)
self.assertTrue(result)
print('US16 Test Case 3 Passed: All Males in the family have the same last name')
def test_US16_4(self):
families = {
'F1': [('HUSB', 'I1'), ('CHIL', 'I4')],
'F2': [('HUSB', 'I7'), ('CHIL', 'I10'), ('CHIL', 'I11')],
}
individuals = {
'I1': [('NAME', 'John /Doe/'), ('SEX', 'M')],
'I4': [('NAME', 'Michael /Smith/'), ('SEX', 'M')],
'I7': [('NAME', 'Michael /Smith/'), ('SEX', 'M')],
'I10': [('NAME', 'David /Johnson/'), ('SEX', 'M')],
'I11': [('NAME', 'Robert /Brown/'), ('SEX', 'M')],
}
result = parse.maleLastNames(families, individuals)
self.assertFalse(result)
print('US16 Test Case 4 Passed: All Males in the family do not have the same last name')
def test_US16_5(self):
families = {
'F1': [('HUSB', 'I1')],
}
individuals = {
'I1': [('NAME', 'John /Doe/'), ('SEX', 'M')],
}
result = parse.maleLastNames(families, individuals)
self.assertTrue(result)
print('US16 Test Case 5 Passed: No child in the family')
def test_US16_6(self):
families = {
'F1': [('HUSB', 'I1'), ('CHIL', 'I2')],
}
individuals = {
'I1': [('NAME', 'John /Doe/'), ('SEX', 'M')],
'I2': [('NAME', 'Jane /Doe/'), ('SEX', 'F')],
}
result = parse.maleLastNames(families, individuals)
self.assertTrue(result)
print('US16 Test Case 6 Passed: Only female child in the family')
if __name__ == '__main__':
unittest.main()