Skip to content

Commit

Permalink
tests, refactor: rename to test_case_1_catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Feb 23, 2023
1 parent c24b2d9 commit f20e2e2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ def item() -> Item:


@pytest.fixture
def label_catalog() -> Catalog:
def test_case_1_catalog() -> Catalog:
return TestCases.case_1()
18 changes: 10 additions & 8 deletions tests/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1463,16 +1463,18 @@ def from_dict(


@pytest.mark.parametrize("add_canonical", (True, False))
def test_remove_hierarchical_links(label_catalog: Catalog, add_canonical: bool) -> None:
label_catalog.remove_hierarchical_links(add_canonical=add_canonical)
for link in label_catalog.links:
def test_remove_hierarchical_links(
test_case_1_catalog: Catalog, add_canonical: bool
) -> None:
test_case_1_catalog.remove_hierarchical_links(add_canonical=add_canonical)
for link in test_case_1_catalog.links:
assert not link.is_hierarchical()
assert bool(label_catalog.get_single_link("canonical")) == add_canonical
assert bool(test_case_1_catalog.get_single_link("canonical")) == add_canonical


def test_fully_resolve(tmp_path: Path, label_catalog: Catalog) -> None:
label_catalog.save(dest_href=str(tmp_path / "before"))
def test_fully_resolve(tmp_path: Path, test_case_1_catalog: Catalog) -> None:
test_case_1_catalog.save(dest_href=str(tmp_path / "before"))
assert len(list((tmp_path / "before").glob("**/*.json"))) == 1
label_catalog.fully_resolve()
label_catalog.save(dest_href=str(tmp_path / "after"))
test_case_1_catalog.fully_resolve()
test_case_1_catalog.save(dest_href=str(tmp_path / "after"))
assert len(list((tmp_path / "after").glob("**/*.json"))) == 15
6 changes: 4 additions & 2 deletions tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,10 @@ def from_dict(


@pytest.mark.parametrize("add_canonical", (True, False))
def test_remove_hierarchical_links(label_catalog: Catalog, add_canonical: bool) -> None:
collection = list(label_catalog.get_all_collections())[0]
def test_remove_hierarchical_links(
test_case_1_catalog: Catalog, add_canonical: bool
) -> None:
collection = list(test_case_1_catalog.get_all_collections())[0]
collection.remove_hierarchical_links(add_canonical=add_canonical)
for link in collection.links:
assert not link.is_hierarchical()
Expand Down
6 changes: 4 additions & 2 deletions tests/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,10 @@ def test_item_from_dict_with_missing_type_raises_useful_error() -> None:


@pytest.mark.parametrize("add_canonical", (True, False))
def test_remove_hierarchical_links(label_catalog: Catalog, add_canonical: bool) -> None:
item = list(label_catalog.get_all_items())[0]
def test_remove_hierarchical_links(
test_case_1_catalog: Catalog, add_canonical: bool
) -> None:
item = list(test_case_1_catalog.get_all_items())[0]
item.remove_hierarchical_links(add_canonical=add_canonical)
for link in item.links:
assert not link.is_hierarchical()
Expand Down

0 comments on commit f20e2e2

Please sign in to comment.