def test_to_internal_value(self): instance = fields.SmallIntegerField() self.assertEqual(instance.to_internal_value(1), 1)
def test_init_default(self): instance = fields.SmallIntegerField() self.assertEqual(instance.min_value, -instance.MAX_SMALL_INTEGER - 1) self.assertEqual(instance.max_value, instance.MAX_SMALL_INTEGER)
def test_to_internal_value_raises_validate_exception(self): instance = fields.SmallIntegerField() with self.assertRaises(ValidationError): instance.to_internal_value('object')
def test_to_to_representation(self): instance = fields.SmallIntegerField() self.assertEqual(instance.to_representation('1'), 1)
def test_to_internal_value_raises_max_string_length_exception(self): instance = fields.SmallIntegerField() with self.assertRaises(ValidationError): data = 'value' * 250 instance.to_internal_value(data)