예제 #1
0
 def test_multi_yaml_object_as_json(self):
     res = io.StringIO()
     jinsi_main("-j", "-", _print=capture(res), _open=provide({}), _stdin=io.StringIO("x: 3\n---\ny: 3\n"))
     self.assertEqual("""{"x":3}\n{"y":3}\n""", res.getvalue())
예제 #2
0
 def test_single_yaml_object_as_yaml(self):
     res = io.StringIO()
     jinsi_main("-", _print=capture(res), _open=provide({}), _stdin=io.StringIO("x: 3"))
     self.assertEqual("x: 3\n", res.getvalue())
예제 #3
0
 def test_single_json_object_as_json(self):
     res = io.StringIO()
     jinsi_main("-j", "-", _print=capture(res), _open=provide({}), _stdin=io.StringIO("""{"x":3}"""))
     self.assertEqual("""{"x":3}\n""", res.getvalue())
예제 #4
0
 def test_version(self):
     res = io.StringIO()
     jinsi_main("--version", _print=capture(res), _open=provide({}), _stdin=io.StringIO(""))
     self.assertRegex(res.getvalue(), re.compile(r"0\.[1-9][0-9]*\.[0-9]"))