示例#1
0
文件: test_io.py 项目: mabudz/pyam
def test_io_datapackage(test_df, tmpdir):
    # add column to `meta` and write to datapackage
    file = Path(tmpdir) / "foo.zip"
    test_df.set_meta(["a", "b"], "string")
    test_df.to_datapackage(file)

    # read from csv assert that IamDataFrame instances are equal
    import_df = read_datapackage(file)
    assert_iamframe_equal(test_df, import_df)
示例#2
0
def test_io_datapackage(test_df):
    file = 'foo.zip'

    # add column to `meta`
    test_df.set_meta(['a', 'b'], 'string')

    # write to datapackage
    test_df.to_datapackage(file)

    # read from csv
    import_df = read_datapackage(file)

    # assert that IamDataFrame instances are equal and delete file
    assert_iamframe_equal(test_df, import_df)
    os.remove(file)