Skip to content

Commit 05c684f

Browse files
authored
Merge pull request #117 from ArcanaFramework/error-message-fixup
Fixes issues with vendor formats used as classifiers
2 parents cfac179 + dcefb8e commit 05c684f

File tree

20 files changed

+981
-929
lines changed

20 files changed

+981
-929
lines changed
Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# import sys
2-
# import pytest
3-
from fileformats.application import Json, Yaml
1+
from pathlib import Path
42

3+
from fileformats.application import Json, Yaml
54

65
SAMPLE_JSON = (
76
"""{"a": "string field", "alist": [0, 1, 2, 3, 4, 5], """
@@ -23,27 +22,19 @@
2322
"""
2423

2524

26-
# @pytest.mark.xfail(
27-
# sys.version_info.minor <= 9,
28-
# reason="upstream Pydra issue with type-checking 'type' objects",
29-
# )
30-
def test_json_to_yaml(work_dir):
31-
in_file = work_dir / "test.json"
25+
def test_json_to_yaml(tmp_path: Path):
26+
in_file = tmp_path / "test.json"
3227
with open(in_file, "w") as f:
3328
f.write(SAMPLE_JSON)
3429
jsn = Json(in_file)
35-
yml = Yaml.convert(jsn)
30+
yml = Yaml.convert(jsn, out_dir=tmp_path)
3631
assert yml.raw_contents == SAMPLE_YAML
3732

3833

39-
# @pytest.mark.xfail(
40-
# sys.version_info.minor <= 9,
41-
# reason="upstream Pydra issue with type-checking 'type' objects",
42-
# )
43-
def test_yaml_to_json(work_dir):
44-
in_file = work_dir / "test.yaml"
34+
def test_yaml_to_json(tmp_path: Path):
35+
in_file = tmp_path / "test.yaml"
4536
with open(in_file, "w") as f:
46-
f.write(SAMPLE_JSON)
37+
f.write(SAMPLE_YAML)
4738
yml = Yaml(in_file)
48-
jsn = Json.convert(yml)
39+
jsn = Json.convert(yml, out_dir=tmp_path)
4940
assert jsn.raw_contents == SAMPLE_JSON

extras/fileformats/extras/generic/tests/test_converters.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import pytest
2-
from pathlib import Path
31
import typing as ty
2+
from pathlib import Path
3+
4+
import pytest
5+
46
from fileformats.generic import DirectoryOf, SetOf
57
from fileformats.text import TextFile
68

@@ -24,15 +26,17 @@ def test_files(files_dir: Path, file_names: ty.List[str]) -> ty.List[Path]:
2426
return [files_dir / n for n in file_names]
2527

2628

27-
def test_list_dir_contents(files_dir: Path, test_files: ty.List[Path]) -> None:
29+
def test_list_dir_contents(
30+
files_dir: Path, test_files: ty.List[Path], tmp_path: Path
31+
) -> None:
2832
text_set = SetOf[TextFile].convert(DirectoryOf[TextFile](files_dir)) # type: ignore[misc]
2933
assert sorted(t.name for t in text_set.contents) == sorted(
3034
f.name for f in test_files
3135
)
3236

3337

3438
def test_put_contents_in_dir(
35-
file_names: ty.List[str], test_files: ty.List[Path]
39+
file_names: ty.List[str], test_files: ty.List[Path], tmp_path: Path
3640
) -> None:
3741
text_dir = DirectoryOf[TextFile].convert(SetOf[TextFile](test_files)) # type: ignore[misc]
3842
assert sorted(t.name for t in text_dir.contents) == file_names

0 commit comments

Comments
 (0)