def test_specifying_defaults_not_frozen(self): """ If someone's matched the default values with their kwarg args, we shouldn't bothering freezing those. """ field = TimeZoneField(max_length=63) name, path, args, kwargs = field.deconstruct() self.assertNotIn('max_length', kwargs) choices = [(pytz.timezone(tz), tz) for tz in pytz.common_timezones] field = TimeZoneField(choices=choices) name, path, args, kwargs = field.deconstruct() self.assertNotIn('choices', kwargs) choices = [(tz, tz) for tz in pytz.common_timezones] field = TimeZoneField(choices=choices) name, path, args, kwargs = field.deconstruct() self.assertNotIn('choices', kwargs)
def test_default_choices_not_frozen(self): """ Ensure the deconstructed representation of the field does not contain kwargs if they match the default. Don't want to bloat everyone's migration files. """ field = TimeZoneField() name, path, args, kwargs = field.deconstruct() self.assertNotIn('choices', kwargs) self.assertNotIn('max_length', kwargs)
def test_default_kwargs_not_frozen(self): """ Ensure the deconstructed representation of the field does not contain kwargs if they match the default. Don't want to bloat everyone's migration files. """ field = TimeZoneField() name, path, args, kwargs = field.deconstruct() self.assertNotIn('choices', kwargs) self.assertNotIn('max_length', kwargs)