class TestDeveloper(unittest.TestCase): @classmethod def setUpClass(self): print('\nsetupClass') @classmethod def tearDownClass(self): print('\nteardownClass') def setUp(self): self.dev_1 = Developer('Radek', 'Warowny', 5000, 'Python') self.dev_2 = Developer('Tina', 'Reid', 8000, 'Java') def tearDown(self): pass def test_email(self): print('\nemail_test') self.assertEqual(self.dev_1.email, '*****@*****.**') self.dev_1.first = 'Connor' self.assertEqual(self.dev_1.email, '*****@*****.**') def test_info(self): print('\ninfo_test') self.assertEqual( self.dev_1.info(), 'Radek Warowny is using Python programming language.') self.dev_1.prog_lang = 'C#' self.assertEqual(self.dev_1.info(), 'Radek Warowny is using C# programming language.') def test_apply_raise(self): print('\napply_raise_test') self.assertEqual(self.dev_1.pay, 5000) self.dev_1.apply_raise() self.assertEqual(self.dev_1.pay, 5500)
# ============================================================================= print('\n') print('-' * 100) print('Developer Sub Class Example') print('-' * 100) print('\n') # Instantiating instances dev_1 = Developer('Arin', 'Blue', 40000, 'Python') print('---------- Developer 1 ----------') print(dev_1.get_full_name()) print(dev_1.email) print('Developer 1 Pay: ', dev_1.pay) print('Developer 1 Raise Amount: ', dev_1.raise_amount) dev_1.apply_raise() print('Developer 1 New Pay: ', dev_1.pay) print('\n') # ============================================================================= print('\n') print('-' * 100) print('Manager Sub Class Example') print('-' * 100) print('\n') # Instantiating instances man_1 = Manager('Some', 'Manager', 80000, dev_1) print('---------- Manager 1 ----------') print(man_1.get_full_name())