summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_json/test_tool.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_json/test_tool.py')
-rw-r--r--Lib/test/test_json/test_tool.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_json/test_tool.py b/Lib/test/test_json/test_tool.py
index fc2a7a4..d441bb1 100644
--- a/Lib/test/test_json/test_tool.py
+++ b/Lib/test/test_json/test_tool.py
@@ -130,6 +130,15 @@ class TestTool(unittest.TestCase):
self.assertEqual(out, b'')
self.assertEqual(err, b'')
+ def test_writing_in_place(self):
+ infile = self._create_infile()
+ rc, out, err = assert_python_ok('-m', 'json.tool', infile, infile)
+ with open(infile, "r", encoding="utf-8") as fp:
+ self.assertEqual(fp.read(), self.expect)
+ self.assertEqual(rc, 0)
+ self.assertEqual(out, b'')
+ self.assertEqual(err, b'')
+
def test_jsonlines(self):
args = sys.executable, '-m', 'json.tool', '--json-lines'
process = subprocess.run(args, input=self.jsonlines_raw, capture_output=True, text=True, check=True)