def test_check_one_person_non_string_factor_value(self):
     person1 = OrderedDict([('full_name', 'Anton'), ('salary', '5000')])
     person2 = OrderedDict([('full_name', 'Anton'),
                            ('favorite_color', 'blue')])
     with self.assertRaises(TypeError):
         check_one_person(person1, full_name=123)
     with self.assertRaises(TypeError):
         check_one_person(person2, full_name='Anton', favorite_color=5)
 def test_check_one_person_simple_tests(self):
     person1 = OrderedDict([('full_name', 'Anton')])
     person2 = OrderedDict([('full_name', 'Anton'),
                            ('favorite_color', 'blue'),
                            ('phone_number', '114-116-1124x315')])
     self.assertEqual(check_one_person(person1, full_name='Anton'), person1)
     self.assertEqual(check_one_person(person1, full_name='Vasko'), None)
     self.assertEqual(check_one_person(person2, full_name='Anton',
                      favorite_color='blue'), person2)
     self.assertEqual(check_one_person(person2, full_name='Anton',
                      favorite_color='green'), None)
 def test_check_one_person_tests_with_special_ending(self):
     person1 = OrderedDict([('full_name', 'Anton')])
     person2 = OrderedDict([('full_name', 'Anton'),
                            ('favorite_color', 'blue'),
                            ('phone_number', '114-116-1124x315'),
                            ('salary', '5000')])
     self.assertEqual(check_one_person(person1, full_name__startswith='A'),
                      person1)
     self.assertEqual(check_one_person(person1, full_name__startswith='P'),
                      None)
     self.assertEqual(check_one_person(person2, phone_number__contains='x'),
                      person2)
     self.assertEqual(check_one_person(person2, salary__lt='4000'), None)
     self.assertEqual(check_one_person(person2, salary__gt='4000'), person2)
     self.assertEqual(check_one_person(person2, full_name__contains='nto'),
                      person2)
 def test_check_one_person_with_non_existing_factor_key(self):
     person = OrderedDict([('full_name', 'Anton'), ('salary', '5000')])
     self.assertEqual(check_one_person(person, favorite_color='green'),
                      None)
 def test_check_one_person_non_ordered_dict_person_argument(self):
     with self.assertRaises(TypeError):
         check_one_person('not ordered dict')