|
| 1 | +import unittest |
| 2 | +import sys |
| 3 | + |
| 4 | +sys.path.append('.') |
| 5 | +from typing import List, Tuple |
| 6 | +from random_profile import RandomProfile |
| 7 | +random_profile = RandomProfile(num=1) |
| 8 | + |
| 9 | + |
| 10 | +class RandomProfileTest(unittest.TestCase): |
| 11 | + # ----------------------------------------------------------------- # |
| 12 | + def test_fname_instance(self): |
| 13 | + self.assertIsInstance(random_profile.first_name(), str) |
| 14 | + |
| 15 | + def test_faname_with_num(self): |
| 16 | + self.assertEqual(len(RandomProfile(num=10).first_name()), 10) |
| 17 | + |
| 18 | + def test_fname_with_num_instance(self): |
| 19 | + self.assertIsInstance(RandomProfile(num=10).first_name(), List) |
| 20 | + |
| 21 | + # ----------------------------------------------------------------- # |
| 22 | + def test_lname_instance(self): |
| 23 | + self.assertIsInstance(random_profile.last_name(), str) |
| 24 | + |
| 25 | + def test_lname_with_num(self): |
| 26 | + self.assertEqual(len(RandomProfile(num=10).last_name()), 10) |
| 27 | + |
| 28 | + def test_lname_with_num_instance(self): |
| 29 | + self.assertIsInstance(RandomProfile(num=10).last_name(), List) |
| 30 | + |
| 31 | + # ----------------------------------------------------------------- # |
| 32 | + def test_full_name_instance(self): |
| 33 | + self.assertIsInstance(random_profile.full_name(), str) |
| 34 | + |
| 35 | + def test_full_name_with_num(self): |
| 36 | + self.assertEqual(len(RandomProfile(num=10).full_name()), 10) |
| 37 | + |
| 38 | + def test_full_name_with_num_instance(self): |
| 39 | + self.assertIsInstance(RandomProfile(num=10).full_name(), List) |
| 40 | + |
| 41 | + # ----------------------------------------------------------------- # |
| 42 | + def test_full_profile_instance(self): |
| 43 | + self.assertIsInstance(random_profile.full_profile(), List) |
| 44 | + |
| 45 | + def test_full_profile_with_num(self): |
| 46 | + self.assertEqual(len(RandomProfile(num=10).full_profile()), 10) |
| 47 | + |
| 48 | + def test_full_profile_with_num_instance(self): |
| 49 | + self.assertIsInstance(RandomProfile(num=10).full_profile(), List) |
| 50 | + |
| 51 | + # ----------------------------------------------------------------- # |
| 52 | + def test_ipv4_instance(self): |
| 53 | + self.assertIsInstance(random_profile.ip_address(), str) |
| 54 | + |
| 55 | + def test_ipv4_with_num(self): |
| 56 | + self.assertEqual(len(RandomProfile(num=10).ip_address()), 10) |
| 57 | + |
| 58 | + def test_ipv4_with_num_instance(self): |
| 59 | + self.assertIsInstance(RandomProfile(num=10).ip_address(), List) |
| 60 | + |
| 61 | + # ----------------------------------------------------------------- # |
| 62 | + def test_job_title_instance(self): |
| 63 | + self.assertIsInstance(random_profile.job_title(), str) |
| 64 | + |
| 65 | + def test_job_title_with_num(self): |
| 66 | + self.assertEqual(len(RandomProfile(num=10).job_title()), 10) |
| 67 | + |
| 68 | + def test_job_title_with_num_instance(self): |
| 69 | + self.assertIsInstance(RandomProfile(num=10).job_title(), List) |
| 70 | + |
| 71 | + # ----------------------------------------------------------------- # |
| 72 | + def test_blood_type_instance(self): |
| 73 | + self.assertIsInstance(random_profile.blood_type(), str) |
| 74 | + |
| 75 | + def test_blood_type_with_num(self): |
| 76 | + self.assertEqual(len(RandomProfile(num=10).blood_type()), 10) |
| 77 | + |
| 78 | + def test_blood_type_with_num_instance(self): |
| 79 | + self.assertIsInstance(RandomProfile(num=10).blood_type(), List) |
| 80 | + |
| 81 | + # ----------------------------------------------------------------- # |
| 82 | + def test_hair_color_instance(self): |
| 83 | + self.assertIsInstance(random_profile.hair_color(), str) |
| 84 | + |
| 85 | + def test_hair_color_with_num(self): |
| 86 | + self.assertEqual(len(RandomProfile(num=10).hair_color()), 10) |
| 87 | + |
| 88 | + def test_hair_color_with_num_instance(self): |
| 89 | + self.assertIsInstance(RandomProfile(num=10).hair_color(), List) |
| 90 | + |
| 91 | + # ----------------------------------------------------------------- # |
| 92 | + def test_dob_age_instance(self): |
| 93 | + self.assertIsInstance(random_profile.dob_age(), Tuple) |
| 94 | + |
| 95 | + def test_dob_age_with_num(self): |
| 96 | + self.assertEqual(len(RandomProfile(num=10).dob_age()), 10) |
| 97 | + |
| 98 | + def test_dob_age_with_num_instance(self): |
| 99 | + self.assertIsInstance(RandomProfile(num=10).dob_age(), List) |
| 100 | + |
| 101 | + # ----------------------------------------------------------------- # |
| 102 | + def test_address_instance(self): |
| 103 | + self.assertIsInstance(random_profile.generate_address(), List) |
| 104 | + |
| 105 | + def test_address_with_num(self): |
| 106 | + self.assertEqual(len(RandomProfile(num=10).generate_address()), 10) |
| 107 | + |
| 108 | + def test_address_with_num_instance(self): |
| 109 | + self.assertIsInstance(RandomProfile(num=10).generate_address(), List) |
| 110 | + |
| 111 | + |
| 112 | +if __name__ == "__main__": |
| 113 | + unittest.main() |
0 commit comments