def test_get_highest_rated_subordinate_simple() -> None: e1 = Employee(1, "Emma Ployee", "Worker", 10000, 50) assert e1.get_position_in_hierarchy() == 'Worker' e2 = Leader(2, "Sue Perior", "Manager", 20000, 30, "Department") e3 = Leader(3, "Bigg Boss", "CEO", 50000, 60, "Company") e1.become_subordinate(e2) e2.become_subordinate(e3) assert e3.get_highest_rated_subordinate().name == 'Sue Perior' e1.become_subordinate(e3) assert e3.get_highest_rated_subordinate().name == 'Emma Ployee'
def test_get_position_in_hierarchy() -> None: e1 = Employee(1, "Emma Ployee", "Worker", 10000, 50) e2 = Leader(2, "Sue Perior", "Manager", 20000, 30, "Dept E") e3 = Leader(3, "Robocop", "Worker", 20000, 30, "Dept D") e4 = Leader(4, "Sarah", "Worker", 20000, 30, "Dept C") e5 = Leader(5, "Sofia", "Secretary", 20000, 30, "Dept B") e6 = Employee(6, "Terry", "COO", 20000, 30) e7 = Leader(7, "Sarah", "CEO", 20000, 30, "Dept A") e1.become_subordinate(e2) e2.become_subordinate(e3) e3.become_subordinate(e4) e4.become_subordinate(e5) e5.become_subordinate(e6) e6.become_subordinate(e7) assert e1.get_position_in_hierarchy() == "Worker, Dept E, Dept D, Dept C," \ " Dept B, Dept A" assert e5.get_position_in_hierarchy() == "Secretary, Dept B, Dept A" assert e7.get_position_in_hierarchy() == "CEO, Dept A"