def test_employee_general() -> None: e1 = Employee(1, "e1", "a", 1, 50) e2 = Employee(2, "e2", "a", 1, 50) e3 = Employee(3, "e3", "a", 1, 50) e4 = Employee(4, "e4", "a", 1, 50) e5 = Employee(5, "e5", "a", 1, 50) e6 = Employee(6, "e6", "a", 1, 50) e7 = Employee(7, "e7", "a", 1, 50) e7.become_subordinate(e5) e5.become_subordinate(e2) e4.become_subordinate(e2) e2.become_subordinate(e1) e3.become_subordinate(e1) e6.become_subordinate(e3) assert e6.get_all_subordinates() == [] assert e2.get_all_subordinates() == [e4, e5, e7] assert e2.get_direct_subordinates() == [e4, e5] assert e7.get_organization_head() == e1 assert e1.get_organization_head() == e1 assert e7.get_closest_common_superior(4) == e2 assert e2.get_closest_common_superior(4) == e2 assert e2.get_closest_common_superior(7) == e2 # assert e7.become_leader("seven") == e1 assert len(e5.get_direct_subordinates()) == 1 e7 = e5.get_direct_subordinates()[0] # assert isinstance(e7, Leader) assert e1.get_highest_rated_subordinate() == e2 assert e5.get_highest_rated_subordinate().eid == 7 # assert e7.get_department_leader() == e7 # assert e2.become_leader('two') == e1 e2 = e1.get_direct_subordinates()[0] assert e2.eid == 2 assert e1.become_leader('one').eid == 1 e1 = e2.become_leader(3)
def test_get_highest_rated_subordinate_advanced() -> None: e1 = Employee(1, "Emma Ployee", "Worker", 52000, 50) e2 = Employee(2, "Sue Perior", "Manager", 50000, 30) e3 = Employee(3, "Robocop", "Worker", 20000, 80) e4 = Leader(4, "Sarah", "CEO", 500000, 99, "Some Corp.") e5 = Employee(5, "Sofia", "Worker", 10000, 69) e6 = Employee(6, "Terry", "Worker", 5000, 79) e7 = Employee(7, "Odysseus", "Worker", 62000, 88) e8 = Employee(8, "Sparrow", "Contract Worker", 60000, 12) e9 = Employee(9, "Nick", "Contract Worker", 70000, 25) e10 = Employee(10, "Theseus", "Contract Worker", 80000, 87) e1.become_subordinate(e2) e3.become_subordinate(e2) e2.become_subordinate(e4) e5.become_subordinate(e2) e6.become_subordinate(e4) e7.become_subordinate(e4) e8.become_subordinate(e1) e9.become_subordinate(e1) e10.become_subordinate(e1) assert e2.get_highest_rated_subordinate() == e3 assert e4.get_highest_rated_subordinate() == e7 assert e1.get_highest_rated_subordinate() == e10