Example #1
0
 def test_prepare_value(self):
     field = JSONField()
     assert field.prepare_value({'a': 'b'}) == '{"a": "b"}'
     assert field.prepare_value(['a', 'b']) == '["a", "b"]'
     assert field.prepare_value(True) == 'true'
     assert field.prepare_value(False) == 'false'
     assert field.prepare_value(3.14) == '3.14'
     assert field.prepare_value(None) == 'null'
     assert field.prepare_value('foo') == '"foo"'
Example #2
0
 def test_prepare_value(self):
     field = JSONField()
     assert field.prepare_value({"a": "b"}) == '{"a": "b"}'
     assert field.prepare_value(["a", "b"]) == '["a", "b"]'
     assert field.prepare_value(True) == "true"
     assert field.prepare_value(False) == "false"
     assert field.prepare_value(3.14) == "3.14"
     assert field.prepare_value(None) == "null"
     assert field.prepare_value("foo") == '"foo"'
Example #3
0
 def test_prepare_value(self):
     field = JSONField()
     assert field.prepare_value({'a': 'b'}) == '{"a": "b"}'
     assert field.prepare_value(None) == 'null'
 def test_prepare_value(self):
     field = JSONField()
     assert field.prepare_value({'a': 'b'}) == '{"a": "b"}'
     assert field.prepare_value(None) == 'null'