def process(): data = json.load(open("./raw.json")) ratios = get_ratios(data) allkeys = get_all_keys(ratios) out = {} for benchmark in ratios: ic = ratios[benchmark] out[benchmark] = {} for key in allkeys: if key not in ic: out[benchmark][key] = 0 else: out[benchmark][key] = ic[key] io.pprint(out)
def test_pprint(): out = StringIO() io.pprint({"foo": 1, "bar": "baz"}, file=out) assert '{\n "bar": "baz",\n "foo": 1\n}' == out.getvalue().strip()
def test_pprint(self): out = StringIO() io.pprint({"foo": 1, "bar": "baz"}, file=out) self._test('{\n "bar": "baz",\n "foo": 1\n}', out.getvalue().strip())