Skip to content

Commit

Permalink
Simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Dec 13, 2024
1 parent af1e6c0 commit 47cd856
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,35 @@ def test_non_existing_artifactory_host(self, non_existing_artifactory_host):
assert "name0" in df.index
assert "name1" in df.index

def test_latest_version(self, additional_version):
"""Test only_latest argument."""
df = audb.available()
assert len(df) == 3
assert "name0" in df.index
assert "name1" in df.index
assert len(df.loc["name0"]) == 2
df = audb.available(only_latest=True)
assert len(df) == 2
assert "name0" in df.index
assert "name1" in df.index
assert df.loc["name0", "version"] == "2.0.0"
assert df.loc["name1", "version"] == "1.0.0"
@pytest.mark.parametrize(
"only_latest, expected_datasets, expected_versions",
[
(True, ["name0", "name1"], ["2.0.0", "1.0.0"]),
(False, ["name0", "name0", "name1"], ["1.0.0", "2.0.0", "1.0.0"]),
],
)
def test_latest_version(
self,
additional_version,
only_latest,
expected_datasets,
expected_versions,
):
"""Test only_latest argument.
Args:
additional_version: additional_version fixture
only_latest: only_latest argument of audb.available()
expected_datasets: expected dataset names
in index of dataframe
expected_versions: expected dataset version
in version column of dataframe
"""
df = audb.available(only_latest=only_latest)
assert len(df) == len(expected_datasets)
assert list(df.index) == expected_datasets
assert list(df["version"]) == expected_versions


def test_versions(tmpdir, repository):
Expand Down

0 comments on commit 47cd856

Please sign in to comment.