Esempio n. 1
0
    def test_wrong_value_set(self):
        field = fields.CharField("mother", 10)
        with self.assertRaises(exceptions.ValidationError):
            field.default = object

        with self.assertRaises(exceptions.ValidationError):
            field.default = 'abcdefghijklmnopqrstuvwxyz'
Esempio n. 2
0
 def test_right_value_length(self):
     fields.CharField('mother', max_length=10)
Esempio n. 3
0
 def test_max_length_sql_type(self):
     field = fields.CharField('mother', max_length=128)
     self.assertEquals(field.sql_type, 'Varchar(128)')
Esempio n. 4
0
 def test_correct_max_length_value(self):
     fields.CharField('value', 128)
Esempio n. 5
0
 def test_wrong_value_length(self):
     with self.assertRaises(exceptions.ValidationError):
         fields.CharField('mother', max_length=2)
Esempio n. 6
0
 def test_sql_type(self):
     field = fields.CharField('value')
     self.assertEquals(field.sql_type, 'Varchar(255)')
Esempio n. 7
0
 def test_wrong_max_length_values(self):
     for max_length in (object, -12, "128"):
         with self.assertRaises(exceptions.InitialError):
             fields.CharField('value', max_length=max_length)
Esempio n. 8
0
 def test_correct_value(self):
     fields.CharField('value')
Esempio n. 9
0
 def test_wrong_values(self):
     for value in (1, 12.32, object, True, []):
         with self.assertRaises(exceptions.ValidationError):
             fields.CharField(value)
Esempio n. 10
0
 class Person(table.Table):
     first_name = fields.CharField('John', 20)
     last_name = fields.CharField('Doe', 50)
     age = fields.IntegerField(18)
Esempio n. 11
0
 class Person(table.Table):
     first_name = fields.CharField('John')
     last_name = fields.CharField('Doe')
Esempio n. 12
0
 class Employee(Person):
     job = fields.CharField('Developer')