B VXY% @sddlmZddlZddlZddlZddlZddlZddlZyddlm Z WnJe k ryddl m Z Wn$e k rddl Z ddZ YnXYnXGdddej ZdS))with_statementN)strip_python_stderrcCstdd|S)Nz\[\d+ refs\]\r?\n?$)resubencodestrip)stderrr M/opt/alt/python37/lib64/python3.7/site-packages/simplejson/tests/test_tool.pyrsrc@s<eZdZdZedZd ddZddZdd Z d d Z dS) TestToolz [["blorpie"],[ "whoops" ] , [ ], "d-shtaeou", "d-nthiouh", "i-vhbjkhnth", {"nifty":87}, {"morefield" : false,"field" :"yes"} ] a. [ [ "blorpie" ], [ "whoops" ], [], "d-shtaeou", "d-nthiouh", "i-vhbjkhnth", { "nifty": 87 }, { "field": "yes", "morefield": false } ] NcCsftjddg}|r||tj|tjtjtjd}||\}}|t|d ||j d|S)Nz-mzsimplejson.tool)stdinr stdoutrr) sys executableextend subprocessPopenPIPE communicate assertEqualrr returncode)selfargsdataargvprocouterrr r r runTool7s   zTestTool.runToolcCs$||j|jd|jdS)N)r)rrrrexpect)rr r r test_stdin_stdoutDszTestTool.test_stdin_stdoutc CsNt<}||j|||j|jgd|j WdQRXdS)N)r) tempfileNamedTemporaryFilewriterrflushrrnamer )rinfiler r r test_infile_stdoutIs  zTestTool.test_infile_stdoutc Cst}||j|t}zR||j|j|jgddt |jd}|| |j WdQRXWd| t j|jrt |jXWdQRXdS)N)rrrb)r"r#r$rrr%rrr&openreadr closeospathexistsunlink)rr'outfilefr r r test_infile_outfileQs  $zTestTool.test_infile_outfile)NN) __name__ __module__ __qualname__rtextwrapdedentr rr!r(r3r r r r r s r ) __future__rr-rr7Zunittestrr"Z test.supportr ImportErrorZtest.test_supportrZTestCaser r r r r s