def test_add_sub() -> None:
    e1 = Employee(5, "Emma Ployee", "Worker", 10000, 50)
    e2 = Employee(7, "Sue Perior", "Manager", 20000, 30)
    assert len(e1.get_all_subordinates()) == 0
    e1.add_subordinate(e2)
    assert len(e1.get_all_subordinates()) == 1
    assert e2.get_superior() is None
示例#2
0
def test_get_emp() -> None:
    org2 = Organization(None)
    assert org2.get_employee(1) is None
    e = Employee(1, 'Boss', 'CEO', 50000, 50)
    org = Organization(e)
    assert org.get_employee(1).name == 'Boss'
    e1 = Employee(2, 'Man', 'Manager', 20000, 50)
    e.add_subordinate(e1)
    assert org.get_employee(2).name == 'Man'
    assert org.get_employee(3) is None
示例#3
0
def test_add_subordinate() -> None:
    e1 = Employee(1, "Emma Ployee", "Worker", 10000, 50)
    e2 = Employee(2, "Sue Perior", "Manager", 20000, 30)
    e2.add_subordinate(e1)
    assert e2.get_direct_subordinates()[0].eid == 1
    assert e1.get_superior() is None