MCPcopy Create free account
hub / github.com/piccolo-orm/piccolo / test_convert_json

Method test_convert_json

tests/utils/test_sql_values.py:13–29  ·  view source on GitHub ↗

Make sure Python objects are serialised correctly to JSON strings.

(self)

Source from the content-addressed store, hash-verified

11
12class TestConvertToSQLValue(TestCase):
13 def test_convert_json(self):
14 """
15 Make sure Python objects are serialised correctly to JSON strings.
16 """
17 self.assertEqual(
18 convert_to_sql_value(value={"a": 123}, column=JSON()).replace(
19 " ", ""
20 ),
21 '{"a":123}',
22 )
23
24 self.assertEqual(
25 convert_to_sql_value(value={"a": 123}, column=JSONB()).replace(
26 " ", ""
27 ),
28 '{"a":123}',
29 )
30
31 def test_convert_table_instance(self):
32 """

Callers

nothing calls this directly

Calls 5

convert_to_sql_valueFunction · 0.90
JSONClass · 0.90
JSONBClass · 0.90
assertEqualMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected