From 96a8f1eeec0b9a4c10db20b9989abdb235724e41 Mon Sep 17 00:00:00 2001 From: Satoru SATOH Date: Mon, 6 May 2024 19:18:12 +0900 Subject: [PATCH] change: switch to new test data loader --- tests/api/open/test_basics.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/api/open/test_basics.py b/tests/api/open/test_basics.py index 5f4e5be2..d44d34fe 100644 --- a/tests/api/open/test_basics.py +++ b/tests/api/open/test_basics.py @@ -14,23 +14,21 @@ import anyconfig.api._open as TT import anyconfig.api._load as LD -from ...common import tdc +from ... import common if typing.TYPE_CHECKING: import pathlib -DATASETS: list[tuple[pathlib.Path, typing.Optional[dict], dict]] = [ - pytest.param( - ipath, data.get("e", None), data.get("o", {}), - id=f"{ipath.parent}/{ipath.name}" - ) - for ipath, data - in tdc.collect_for("open", "basics", subdir="api", load=False) -] +NAMES: tuple[str, ...] = ("ipath", "exp", "opts") +DATA: list[ + tuple[pathlib.Path, typing.Optional[dict], dict] +] = common.load_data_for_testfile(__file__, values=(("e", None), ("o", {}))) +DATA_IDS: list[str] = common.get_test_ids(DATA) -@pytest.mark.parametrize(("ipath", "exp", "opts"), DATASETS) + +@pytest.mark.parametrize(NAMES, DATA, ids=DATA_IDS) def test_open_text_io(ipath, exp, opts): with TT.open(ipath, **opts) as inp: assert LD.load(inp, **opts) == exp