def test_utf8(self): d = SchemaDataBag() d.name = 'test' d.number = 4 d.float = 2.0 d.char = 'è' d.full_clean() d.save() d = SchemaDataBag.objects.get(pk=d.id) self.assertEqual(d.char, u'è') d.char = u'è' d.full_clean() d.save() d = SchemaDataBag.objects.get(pk=d.id) self.assertEqual(d.char, u'è')
def test_schemadatabag_validation_error(self): d = SchemaDataBag() d.name = 'test' d.number = 'WRONG' d.float = 2.0 with self.assertRaises(ValidationError): d.full_clean() d.number = 9 d.float = 'WRONG' with self.assertRaises(ValidationError): d.full_clean() d.float = 2.0 d.char = 'test' d.choice = 'choice1' d.full_clean() d.save()