def test_property_table_json():
    tbl = PropertyTable(data=dummy_data, metadata={"baz": "2"})
    s = tbl.dumps()
    parsed = json.loads(s)
    assert parsed["data"] == tbl.data.as_list()
    tmp_dir = scratch_path / "property_table_json"
    tmp_dir.mkdir()
    tbl.dump((tmp_dir / "tbl.json").open("w"))
    parsed = json.load((tmp_dir / "tbl.json").open())
    assert parsed["data"] == tbl.data.as_list()
Beispiel #2
0
def test_property_table_json():
    tbl = PropertyTable(data=dummy_data, metadata={"baz": "2"})
    s = tbl.dumps()
    parsed = json.loads(s)
    assert parsed["data"] == tbl.data.as_list()
    with TempDir() as d:
        fp = open(os.path.join(d, "tbl.json"), "w")
        tbl.dump(fp)
        fp.close()
        fp = open(os.path.join(d, "tbl.json"), "r")
        parsed = json.load(fp)
    assert parsed["data"] == tbl.data.as_list()
Beispiel #3
0
def test_property_table_json():
    tbl = PropertyTable(data=dummy_data, metadata={'baz': '2'})
    s = tbl.dumps()
    parsed = json.loads(s)
    assert parsed['data'] == tbl.data.as_list()
    with TempDir() as d:
        fp = open(os.path.join(d, 'tbl.json'), 'w')
        tbl.dump(fp)
        fp.close()
        fp = open(os.path.join(d, 'tbl.json'), 'r')
        parsed = json.load(fp)
    assert parsed['data'] == tbl.data.as_list()