python-benedict/tests/github/test_issue_0034.py

30 lines
668 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
from benedict import benedict
import json
import unittest
class github_issue_0034_test_case(unittest.TestCase):
"""
https://github.com/fabiocaccamo/python-benedict/issues/34
To run this specific test:
- For each method comment @unittest.skip decorator
- Run python -m unittest tests.github.test_issue_0034
"""
def test_json_dumps(self):
b = benedict({
'a': 1,
'b': {
'c': {
'd': 2,
},
},
})
2020-09-22 13:19:39 +00:00
dumped = json.dumps(b, sort_keys=True)
self.assertEqual(dumped, '{"a": 1, "b": {"c": {"d": 2}}}')