예제 #1
0
 def test_remove_emp(self):
     emp_1 = oop_refresh.Employee("John", "Solly", 100000)
     mgr_1 = oop_refresh.Manager("Chris", "Happy", 100000, employees=[emp_1])
     mgr_1.remove_employee(emp_1)
     self.assertFalse(emp_1 in mgr_1.employees)
예제 #2
0
 def test_apply_raise(self):
     emp_1 = oop_refresh.Employee("john", "Solly", 100000)
     emp_1.apply_raise()
     self.assertTrue(emp_1.pay, 104000)
예제 #3
0
 def test_fullname(self):
     emp_1 = oop_refresh.Employee("john", "Solly", 100000)
     self.assertTrue(emp_1.fullname, "John Solly")
예제 #4
0
 def test_add_emp(self):
     mgr_1 = oop_refresh.Manager("Chris", "Happy", 100000)
     emp_1 = oop_refresh.Employee("John", "Solly", 100000)
     mgr_1.add_emp(emp_1)
     self.assertTrue(emp_1 in mgr_1.employees)
예제 #5
0
 def test_fullname_deleter(self):
     emp_1 = oop_refresh.Employee("John", "Solly", 100000)
     del emp_1.fullname
     self.assertEqual(emp_1.fullname, "None None")
예제 #6
0
 def test_len(self):
     emp_1 = oop_refresh.Employee("John", "Solly", 100000)
     self.assertTrue((len(emp_1), 9))
예제 #7
0
 def test_fullname_setter(self):
     emp_1 = oop_refresh.Employee("John", "Solly", 100000)
     emp_1.fullname = "Richard Solly"
     self.assertEqual(emp_1.fullname, "Richard Solly")
예제 #8
0
 def test_add(self):
     emp_1 = oop_refresh.Employee("John", "Solly", 100000)
     emp_2 = oop_refresh.Employee("Martha", "Goldsmith", 90000)
     self.assertEqual(emp_1 + emp_2, 190000)
예제 #9
0
 def test_repr(self):
     emp_1 = oop_refresh.Employee("John", "Solly", 100000)
     self.assertEqual(
         repr(emp_1), f"Employee('{emp_1.first}, {emp_1.last}, {emp_1.pay})"
     )
예제 #10
0
 def test_str(self):
     emp_1 = oop_refresh.Employee("John", "Solly", 100000)
     self.assertEqual(str(emp_1), f"{emp_1.fullname}, {emp_1.email}")
예제 #11
0
 def test_email(self):
     emp_1 = oop_refresh.Employee("John", "Solly", 100000)
     self.assertEqual(emp_1.email, "*****@*****.**")