import unittest from dop2 import get_email_server class MyTestCase(unittest.TestCase): def test_dop2(self): self.assertEqual(get_email_server('students.spam@yandex.ru'), 'yandex.ru') self.assertEqual(get_email_server('mail@gmail.com'), 'gmail.com') self.assertEqual(get_email_server('example@example.com'), 'example.com') self.assertEqual(get_email_server('example@example'), 'Fail!') self.assertEqual(get_email_server('example example'), 'Fail!') self.assertEqual(get_email_server('@example.com'), 'Fail!') self.assertEqual(get_email_server('example@example.'), 'Fail!') self.assertEqual(get_email_server('example@.com'), 'Fail!') self.assertEqual(get_email_server(''), 'Fail!') if __name__ == '__main__': unittest.main()