def test_hstore_model_field_validation(self):
        d = SerializedDataBag()
        with self.assertRaises(ValidationError):
            d.full_clean()

        d.data = 'test'
        with self.assertRaises(ValidationError):
            d.full_clean()

        d.data = '["test"]'
        with self.assertRaises(ValidationError):
            d.full_clean()

        d.data = ["test"]
        with self.assertRaises(ValidationError):
            d.full_clean()

        d.data = {
            'a': 1,
            'b': 2.2,
            'c': ['a', 'b'],
            'd': {'test': 'test'}
        }
        with self.assertRaises(ValidationError):
            d.full_clean()
    def test_full_clean(self):
        databag = SerializedDataBag(name='number')
        databag.data['num'] = 1
        self.assertEqual(databag.data['num'], 1)

        databag.full_clean()
        databag.save()
        databag = SerializedDataBag.objects.get(name='number')
        self.assertEqual(databag.data['num'], 1)
    def test_full_clean(self):
        databag = SerializedDataBag(name='number')
        databag.data['num'] = 1
        self.assertEqual(databag.data['num'], 1)

        databag.full_clean()
        databag.save()
        databag = SerializedDataBag.objects.get(name='number')
        self.assertEqual(databag.data['num'], 1)
    def test_hstore_model_field_validation(self):
        d = SerializedDataBag()
        with self.assertRaises(ValidationError):
            d.full_clean()

        d.data = 'test'
        with self.assertRaises(ValidationError):
            d.full_clean()

        d.data = '["test"]'
        with self.assertRaises(ValidationError):
            d.full_clean()

        d.data = ["test"]
        with self.assertRaises(ValidationError):
            d.full_clean()

        d.data = {'a': 1, 'b': 2.2, 'c': ['a', 'b'], 'd': {'test': 'test'}}
        with self.assertRaises(ValidationError):
            d.full_clean()