def test_if_dict_element_is_not_int_return_list_with_int_type_error_and_key_equals_to_a( self): expected_error = ELEMENT_ERROR_TEMPLATE % ('a', TYPE_ERROR_MSG % INT_TYPE) self.assertIn( expected_error, create_dict_validator(element_validators=dict( a=create_int_validator()))(dict(a='abc')))
def test_if_dict_elements_are_not_valid_return_list_with_errors(self): self.assertIsInstance( create_dict_validator(element_validators=dict( a=create_int_validator()))(dict(a='abc')), list)
def test_if_obj_is_not_dict_return_dict_type_error(self): self.assertEqual(TYPE_ERROR_MSG % DICT_TYPE, create_dict_validator()(str()))
def test_if_dict_elements_are_valid_return_valid(self): self.assertEqual( VALID, create_dict_validator(element_validators=dict( a=create_int_validator()))(dict(a=1)))
def test_if_obj_is_dict_return_valid(self): self.assertEqual(VALID, create_dict_validator()(dict()))