def test_should_return_empty_dict_for_empty_text_constraint(self): constraint = TextConstraint() actual_dict = constraint._to_json() self.assertTrue(is_empty(actual_dict))
def test_should_return_max_as_dictionary(self): expected_dict = {"max": 20} constraint = TextConstraint(min=None, max=20) actual_dict = constraint._to_json() self.assertEqual(expected_dict, actual_dict)
def test_should_return_min_as_dictionary(self): expected_dict = {"min": 1} constraint = TextConstraint(min=1) actual_dict = constraint._to_json() self.assertEqual(expected_dict, actual_dict)
def test_should_return_min_max_as_dictionary_for_integer(self): expected_dict = {"min": 10, "max": 20} constraint = TextConstraint(min=10, max=20) actual_dict = constraint._to_json() self.assertEqual(expected_dict, actual_dict)