def test_deconstruct_default(): """ Test field deconstruction (when no arguments passed) """ original = FullPhoneDbField() name, path, args, kwargs = original.deconstruct() copy = FullPhoneDbField(*args, **kwargs) assert original.validator_options == copy.validator_options assert original.max_length == copy.max_length
def test_deconstruct(): """ Test field deconstruction """ original = FullPhoneDbField(default='1', max_phone_length=8, min_phone_length=1) name, path, args, kwargs = original.deconstruct() copy = FullPhoneDbField(*args, **kwargs) assert original.validator_options == copy.validator_options assert original.max_length == copy.max_length
class SampleModelUSA(models.Model): phone = FullPhoneDbField(default_code='1')
class SampleModel(models.Model): phone = FullPhoneDbField()
class SampleModelBlank(models.Model): phone = FullPhoneDbField(blank=True)