summaryrefslogtreecommitdiff
path: root/simplejson/tests
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2016-10-28 17:02:47 +0800
committerBob Ippolito <bob@redivi.com>2016-10-28 17:02:47 +0800
commit392e2e7b51635b060dafdb4a08c130fa26421685 (patch)
treec176f6597a33292b7a281719de4268f1a8eb01d6 /simplejson/tests
parent3233faaf438690d0aa853d131ead4a9c99935485 (diff)
parentda17e3529c4e41173519ea18ff3ee908761ef5d4 (diff)
downloadsimplejson-392e2e7b51635b060dafdb4a08c130fa26421685.tar.gz
Merge branch 'raw_json' of https://github.com/lamflam/simplejson into lamflam-raw_json
Diffstat (limited to 'simplejson/tests')
-rw-r--r--simplejson/tests/test_raw_json.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/simplejson/tests/test_raw_json.py b/simplejson/tests/test_raw_json.py
new file mode 100644
index 0000000..6fa6349
--- /dev/null
+++ b/simplejson/tests/test_raw_json.py
@@ -0,0 +1,30 @@
+import unittest
+import simplejson as json
+
+dct1 = {
+ 'key1': 'value1'
+}
+
+dct2 = {
+ 'key2': 'value2',
+ 'd1': dct1
+}
+
+dct3 = {
+ 'key2': 'value2',
+ 'd1': json.dumps(dct1)
+}
+
+dct4 = {
+ 'key2': 'value2',
+ 'd1': json.RawJSON(json.dumps(dct1))
+}
+
+
+class TestRawJson(unittest.TestCase):
+
+ def test_normal_str(self):
+ self.assertNotEqual(json.dumps(dct2), json.dumps(dct3))
+
+ def test_raw_json_str(self):
+ self.assertEqual(json.dumps(dct2), json.dumps(dct4))