def test_stdin_mode(self):
     # 'format' is a benign Python 2/3 way of ensuring it is a text type rather than binary
     self.input.write('{0}'.format(
         json.dumps({'foo': {
             'baz': 1,
             'bizzle': {
                 'baz': 2
             }
         }})))
     self.input.seek(0)
     main('jsonpath.py', 'foo..baz')
     self.assertEqual(self.output.getvalue(), '1\n2\n')
Example #2
0
 def test_stdin_mode(self):
     # 'format' is a benign Python 2/3 way of ensuring it is a text type rather than binary
     self.input.write('{0}'.format(json.dumps({
         'foo': {
             'baz': 1,
             'bizzle': {
                 'baz': 2
             }
         }
     })))
     self.input.seek(0)
     main('jsonpath.py', 'foo..baz')
     self.assertEqual(self.output.getvalue(), '1\n2\n')
 def test_filename_mode(self):
     test1 = os.path.join(os.path.dirname(__file__), 'test1.json')
     test2 = os.path.join(os.path.dirname(__file__), 'test2.json')
     main('jsonpath.py', 'foo..baz', test1, test2)
     self.assertEqual(self.output.getvalue(), '1\n2\n3\n4\n')
Example #4
0
 def test_filename_mode(self):
     test1 = os.path.join(os.path.dirname(__file__), 'test1.json')
     test2 = os.path.join(os.path.dirname(__file__), 'test2.json')
     main('jsonpath.py', 'foo..baz', test1, test2)
     self.assertEqual(self.output.getvalue(), '1\n2\n3\n4\n')