def test_clean_value_of_non_canonical_str(self) -> None: rut_field = RutField() cleaned_value = rut_field.clean( self.valid_rut_verbose_leading_zero_lowercase) self.assertIsInstance(cleaned_value, Rut) self.assertEqual(cleaned_value.canonical, self.valid_rut_canonical)
def test_clean_value_of_Rut(self) -> None: rut_field = RutField() cleaned_value = rut_field.clean(self.valid_rut_instance) self.assertIsInstance(cleaned_value, Rut) self.assertEqual(cleaned_value.canonical, self.valid_rut_canonical)
def test_clean_value_of_invalid_canonical_str(self) -> None: rut_field = RutField() with self.assertRaises(django.core.exceptions.ValidationError) as cm: rut_field.clean(self.invalid_rut_canonical) self.assertEqual(cm.exception.code, 'invalid')