mirror of
https://github.com/not-kennethreitz/omnijson.git
synced 2026-06-05 23:20:19 +00:00
33 lines
772 B
Python
33 lines
772 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import unittest as unittest
|
|
|
|
import omnijson as json
|
|
|
|
|
|
class OmniSuite(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
self._good_json_string = '{"yo": "dawg"}'
|
|
self._good_json_result = {'yo': 'dawg'}
|
|
self._bad_json_string = '{"yo": dawg"}'
|
|
|
|
def test_load_json(self):
|
|
a = json.loads(self._good_json_string)
|
|
self.assertEqual(a, self._good_json_result)
|
|
|
|
def test_dump_json(self):
|
|
a = json.dumps(self._good_json_result)
|
|
self.assertEqual(a, self._good_json_string)
|
|
|
|
def test_load_bad_json(self):
|
|
self.assertRaises(
|
|
json.JSONError,
|
|
json.loads,
|
|
self._bad_json_string
|
|
)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main() |