Esempio n. 1
0
 def test_should_return_empty_dict_for_empty_integer_constraint(self):
     constraint = NumericConstraint()
     actual_dict = constraint._to_json()
     self.assertTrue(is_empty(actual_dict))
Esempio n. 2
0
 def test_should_return_max_as_dictionary(self):
     expected_dict = {"max": 20}
     constraint = NumericConstraint(min=None, max=20)
     actual_dict = constraint._to_json()
     self.assertEqual(expected_dict, actual_dict)
Esempio n. 3
0
 def test_should_return_min_as_dictionary(self):
     expected_dict = {"min": 1}
     constraint = NumericConstraint(min=1)
     actual_dict = constraint._to_json()
     self.assertEqual(expected_dict, actual_dict)
Esempio n. 4
0
 def test_should_return_min_max_as_dictionary_for_integer(self):
     expected_dict = {"min": 10, "max": 20}
     constraint = NumericConstraint(min=10, max=20)
     actual_dict = constraint._to_json()
     self.assertEqual(expected_dict, actual_dict)
Esempio n. 5
0
 def test_should_return_empty_dict_for_empty_integer_constraint(self):
     constraint = NumericConstraint()
     actual_dict = constraint._to_json()
     self.assertTrue(is_empty(actual_dict))
Esempio n. 6
0
 def test_should_return_min_as_dictionary(self):
     expected_dict = {"min": 1}
     constraint = NumericConstraint(min=1)
     actual_dict = constraint._to_json()
     self.assertEqual(expected_dict, actual_dict)
Esempio n. 7
0
 def test_should_return_max_as_dictionary(self):
     expected_dict = {"max": 20}
     constraint = NumericConstraint(min=None, max=20)
     actual_dict = constraint._to_json()
     self.assertEqual(expected_dict, actual_dict)
Esempio n. 8
0
 def test_should_return_min_max_as_dictionary_for_integer(self):
     expected_dict = {"min": 10, "max": 20}
     constraint = NumericConstraint(min=10, max=20)
     actual_dict = constraint._to_json()
     self.assertEqual(expected_dict, actual_dict)