X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=AppPkg%2FApplications%2FPython%2FPython-2.7.10%2FLib%2Fjson%2Ftests%2Ftest_tool.py;fp=AppPkg%2FApplications%2FPython%2FPython-2.7.10%2FLib%2Fjson%2Ftests%2Ftest_tool.py;h=0000000000000000000000000000000000000000;hp=b45c1e2e44f912ecfc0690120c86290378817eca;hb=964f432b9b0afe103c41c7613fade3e699118afe;hpb=e2d3a25f1a3135221a9c8061e1b8f90245d727eb diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py deleted file mode 100644 index b45c1e2e44..0000000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py +++ /dev/null @@ -1,69 +0,0 @@ -import os -import sys -import textwrap -import unittest -import subprocess -from test import test_support -from test.script_helper import assert_python_ok - -class TestTool(unittest.TestCase): - data = """ - - [["blorpie"],[ "whoops" ] , [ - ],\t"d-shtaeou",\r"d-nthiouh", - "i-vhbjkhnth", {"nifty":87}, {"morefield" :\tfalse,"field" - :"yes"} ] - """ - - expect = textwrap.dedent("""\ - [ - [ - "blorpie" - ], - [ - "whoops" - ], - [], - "d-shtaeou", - "d-nthiouh", - "i-vhbjkhnth", - { - "nifty": 87 - }, - { - "field": "yes", - "morefield": false - } - ] - """) - - def test_stdin_stdout(self): - proc = subprocess.Popen( - (sys.executable, '-m', 'json.tool'), - stdin=subprocess.PIPE, stdout=subprocess.PIPE) - out, err = proc.communicate(self.data.encode()) - self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) - self.assertEqual(err, None) - - def _create_infile(self): - infile = test_support.TESTFN - with open(infile, "w") as fp: - self.addCleanup(os.remove, infile) - fp.write(self.data) - return infile - - def test_infile_stdout(self): - infile = self._create_infile() - rc, out, err = assert_python_ok('-m', 'json.tool', infile) - self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) - self.assertEqual(err, b'') - - def test_infile_outfile(self): - infile = self._create_infile() - outfile = test_support.TESTFN + '.out' - rc, out, err = assert_python_ok('-m', 'json.tool', infile, outfile) - self.addCleanup(os.remove, outfile) - with open(outfile, "r") as fp: - self.assertEqual(fp.read(), self.expect) - self.assertEqual(out, b'') - self.assertEqual(err, b'')