コード例 #1
0
def test_file_writer_df():
    datastore = get_ready_ds()
    FileWriter("my_data", store_key="transformed_data",
               apply_func=to_pandas).transform(datastore)
    assert datastore["my_data"] == DATA
    assert datastore["transformed_data"].to_dict() == to_pandas(DATA).to_dict()
コード例 #2
0
def test_file_writer_json_with_kwargument():
    datastore = get_ready_ds()
    FileWriter("my_data", apply_func=to_json, indent=4).transform(datastore)
    assert datastore["my_data"] == to_json(DATA, indent=4)
コード例 #3
0
def test_file_writer_not_a_func():
    datastore = get_ready_ds()
    with pytest.raises(AssertionError):
        FileWriter("my_data", apply_func=dict()).transform(datastore)
コード例 #4
0
def test_file_writer_json():
    datastore = get_ready_ds()
    FileWriter("my_data", apply_func=to_json).transform(datastore)
    assert datastore["my_data"] == to_json(DATA)