def test_command_line(self): input_stream = StringIO(u'{"a": {"b": 1}}') output_stream = StringIO() cli(input_stream, output_stream) output = output_stream.getvalue() result = json.loads(output) self.assertEqual(result, dict(a_b=1))