Skip to content

Commit

Permalink
testing: add test for inline data, see issue #17
Browse files Browse the repository at this point in the history
  • Loading branch information
suvayu committed Apr 18, 2022
1 parent be84c49 commit 255dd53
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion testing/test_dpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import pandas as pd
import pytest

from friendly_data.converters import _schema
from friendly_data.converters import _schema, to_df
from friendly_data.dpkg import _ensure_posix
from friendly_data.dpkg import create_pkg, resource_, set_idxcols
from friendly_data.dpkg import entry_from_res
from friendly_data.dpkg import fullpath
Expand Down Expand Up @@ -42,6 +43,22 @@ def test_ensure_posix(pkg_meta):
assert npathsep == 0


def test_ensure_posix_inline_data(pkg_meta):
pkgdir = Path("testing/files/mini-ex")
inputs = list(pkgdir.glob("inputs/*"))
files = chain(inputs, pkgdir.glob("outputs/*"))
pkg = create_pkg(pkg_meta, relpaths(pkgdir, files), pkgdir)
for i, res in enumerate(pkg.resources):
if "output" in res["path"]:
continue
pkg.resources[i]["data"] = to_df(res).to_dict("records")
pkg.resources[i]["format"] = "json"
pkg.resources[i].pop("path")
pkg.resources[i].pop("mediatype", None)
pkg.resources[i]["scheme"] = ""
assert _ensure_posix(pkg)


@pytest.mark.parametrize(
"update",
[
Expand Down

0 comments on commit 255dd53

Please sign in to comment.