예제 #1
0
class Skill(models.Model):
    dev = models.ForeignKey(foreign_key="Developer")
    name = models.CharField(max_length=64)
    specialization = models.ArrayField(null=True,
                                       value_type="text",
                                       db_index=True)
    notes = models.TextField(null=True)
예제 #2
0
    async def test_arrayfield_wrong_dimensions_size(self):
        with self.assertRaises(AsyncOrmFieldError) as exc:
            models.ArrayField().validate([["backend", "nodejs"], ["frontend"]])

        self.assertEqual(
            exc.exception.args[0],
            "Multi-dimensional arrays must have items of the same size")
예제 #3
0
    async def test_arrayfield_wrong_dimensions_type(self):
        with self.assertRaises(FieldError) as exc:
            models.ArrayField().validate([['backend', 'nodejs'], 'frontend'])

        self.assertEqual(exc.exception.args[0], 'Array elements are not of the same type')
예제 #4
0
    async def test_arrayfield_wrong_dimensions_size(self):
        with self.assertRaises(FieldError) as exc:
            models.ArrayField().validate([['backend', 'nodejs'], ['frontend']])

        self.assertEqual(exc.exception.args[0], 'Multi-dimensional arrays must have items of the same size')
예제 #5
0
    async def test_arrayfield_wrong_dimensions_type(self):
        with self.assertRaises(AsyncOrmFieldError) as exc:
            models.ArrayField().validate([["backend", "nodejs"], "frontend"])

        self.assertEqual(exc.exception.args[0],
                         "Array elements are not of the same type")