def test_spec_field(self):
        field = django_fields.SpecField()
        expected = {'max_length': 200}
        if hasattr(sys, 'pypy_version_info'):
            # Django under Pypy adds this extra key.
            expected['help_text'] = u''

        self.assertEqual(field.deconstruct()[3], expected)
Exemplo n.º 2
0
 class PartialVersionModel(models.Model):
     partial = semver_fields.VersionField(partial=True,
                                          verbose_name='partial version')
     optional = semver_fields.VersionField(verbose_name='optional version',
                                           blank=True,
                                           null=True)
     optional_spec = semver_fields.SpecField(verbose_name='optional spec',
                                             blank=True,
                                             null=True)
Exemplo n.º 3
0
 class VersionModel(models.Model):
     version = semver_fields.VersionField(verbose_name='my version')
     spec = semver_fields.SpecField(verbose_name='my spec')
Exemplo n.º 4
0
 def test_nondefault_spec_field(self):
     field = django_fields.SpecField(syntax='npm')
     expected = {'max_length': 200, 'syntax': 'npm'}
     self.assertEqual(field.deconstruct()[3], expected)
Exemplo n.º 5
0
 def test_spec_field(self):
     field = django_fields.SpecField()
     expected = {'max_length': 200}
     self.assertEqual(field.deconstruct()[3], expected)
Exemplo n.º 6
0
 class VersionModel(models.Model):
     version = semver_fields.VersionField(verbose_name='my version')
     spec = semver_fields.SpecField(verbose_name='my spec')
     npm_spec = semver_fields.SpecField(syntax='npm',
                                        blank=True,
                                        verbose_name='npm spec')