示例#1
0
    def test_to_multiline(self):
        a = BoxList([Box(a=1), Box(b=2), Box(three=5)])

        a.to_json(tmp_json_file, multiline=True)
        count = 0
        with open(tmp_json_file) as f:
            for line in f:
                assert isinstance(json.loads(line), dict)
                count += 1
        assert count == 3
示例#2
0
 def test_box_list_to_json(self):
     bl = BoxList([{"item": 1, "CamelBad": 2}])
     assert json.loads(bl.to_json())[0]["item"] == 1
示例#3
0
 def test_box_list_to_json(self):
     bl = BoxList([{'item': 1, 'CamelBad': 2}])
     assert json.loads(bl.to_json())[0]['item'] == 1