Exemple #1
0
def test_remove_subordinate_id() -> None:
    e1 = Employee(1, "Emma Ployee", "Worker", 10000, 50)
    e2 = Employee(2, "Sue Perior", "Manager", 20000, 30)
    e1.become_subordinate(e2)
    assert e2.get_direct_subordinates()[0].eid == 1
    e2.remove_subordinate_id(1)
    assert e2.get_direct_subordinates() == []
    assert e1.get_superior() is e2
def test_remove_sub() -> None:
    e1 = Employee(5, "Emma Ployee", "Worker", 10000, 50)
    e2 = Employee(7, "Sue Perior", "Manager", 20000, 30)
    e3 = Employee(8, "Cowor Ker", "Worker", 10000, 50)
    e3.become_subordinate(e2)
    e1.become_subordinate(e2)
    assert len(e2.get_direct_subordinates()) == 2
    e2.remove_subordinate_id(5)
    assert e1.get_superior() == e2
    assert len(e2.get_direct_subordinates()) == 1
    e1.become_subordinate(e3)
    assert len(e2.get_all_subordinates()) == 2
    e2.remove_subordinate_id(5)
    assert len(e2.get_direct_subordinates()) == 1
    assert e1.get_superior() == e3
    e1.become_subordinate(e3)
    assert len(e2.get_all_subordinates()) == 2
    e2.remove_subordinate_id(8)
    assert len(e2.get_all_subordinates()) == 0
    assert e1.get_superior() == e3