-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestHarness.py
58 lines (52 loc) · 1.96 KB
/
TestHarness.py
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
# ------------------------------------------------------------------------ #
# Title: Assignment 09
# Description: Working with Modules
# ChangeLog (Who,When,What):
# RRoot,1.1.2030,Created started script
# RRoot,1.1.2030,Added pseudo-code to start assignment 9
# Mercedes Gonzalez Gonzalez,9.6.2020,Modified code to complete assignment 9
# ------------------------------------------------------------------------ #
if __name__ == "__main__":
import DataClasses as DC # data classes
import ProcessingClasses as PC # processing classes
import IOClasses as IO # presentation classes
else:
raise Exception("This file was not created to be imported")
# Test Person Class in data module
print("Test Person Class in data module")
objP1 = DC.Person("Bob", "Smith")
objP2 = DC.Person("Sue", "Jones")
lstTable = [objP1, objP2]
for row in lstTable:
print(row.to_string(), type(row))
# Test processing module
PC.FileProcessor.save_data_to_file("PersonData.txt", lstTable)
lstFileData = PC.FileProcessor.read_data_from_file("PersonData.txt")
lstTable.clear()
for row in lstFileData:
lstTable.append(DC.Person(row[0], row[1].strip()))
for row in lstTable:
print(row.to_string(), type(row))
# Test Employee Class in data module
print()
print("Test Employee Class in data module")
objE1 = DC.Employee(1, "Bob", "Smith")
objE2 = DC.Employee(2, "Sue", "Jones")
lstTable = [objE1, objE2]
for row in lstTable:
print(row.to_string(), type(row))
# Test processing module
PC.FileProcessor.save_data_to_file("EmployeeData.txt", lstTable)
lstFileData = PC.FileProcessor.read_data_from_file("EmployeeData.txt")
lstTable.clear()
for line in lstFileData:
lstTable.append(DC.Employee(line[0], line[1], line[2].strip()))
for row in lstTable:
print(row.to_string(), type(row))
# Test IO classes
print()
print("Test IO class")
IO.EmployeeIO.print_menu_items()
IO.EmployeeIO.print_current_list_items(lstTable)
print(IO.EmployeeIO.input_employee_data())
print(IO.EmployeeIO.input_menu_options())