def test_to_dict(metadata_version):
    df = pd.DataFrame({"A": [1]})
    schema = make_meta(df, origin="test")
    mp = MetaPartition(
        label="label_1",
        file="file",
        data=df,
        indices={"test": [1, 2, 3]},
        metadata_version=metadata_version,
        schema=schema,
    )
    mp_dct = mp.to_dict()
    assert mp_dct == {
        "label": "label_1",
        "data": df,
        "file": "file",
        "indices": {
            "test": [1, 2, 3]
        },
        "metadata_version": metadata_version,
        "schema": schema,
        "partition_keys": [],
        "logical_conjunction": None,
        "table_name": SINGLE_TABLE,
    }
示例#2
0
def test_to_dict(metadata_version):
    mp = MetaPartition(
        label="label_1",
        files={"core": "file"},
        data={"core": "placeholder"},
        indices={"test": [1, 2, 3]},
        metadata_version=metadata_version,
        table_meta={"core": {
            "test": "int8"
        }},
    )
    mp_dct = mp.to_dict()

    assert mp_dct == {
        "label": "label_1",
        "data": {
            "core": "placeholder"
        },
        "files": {
            "core": "file"
        },
        "indices": {
            "test": [1, 2, 3]
        },
        "dataset_metadata": {},
        "metadata_version": metadata_version,
        "table_meta": {
            "core": {
                "test": "int8"
            }
        },
        "partition_keys": [],
    }