From bb74d09fef637b28d0bc0235bf5a81d37f29f4da Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 3 Aug 2024 01:04:32 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/unit/test_file_io.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/unit/test_file_io.py b/tests/unit/test_file_io.py index 6bd49cb..eafd995 100644 --- a/tests/unit/test_file_io.py +++ b/tests/unit/test_file_io.py @@ -1,8 +1,8 @@ import pickle import pytest +from pyosmeta.file_io import _list_to_dict, create_paths, load_pickle -from pyosmeta.file_io import load_pickle, _list_to_dict, create_paths @pytest.fixture def sample_pickle_file(tmp_path): @@ -12,33 +12,37 @@ def sample_pickle_file(tmp_path): pickle.dump(data, f) return file_path + def test_load_pickle(sample_pickle_file): result = load_pickle(sample_pickle_file) assert result == {"key": "value"} + def test_list_to_dict(): sample_list = [ {"gh_username": "User1", "data": "value1"}, - {"gh_username": "User2", "data": "value2"} + {"gh_username": "User2", "data": "value2"}, ] result = _list_to_dict(sample_list, "gh_username") expected = { "user1": {"gh_username": "User1", "data": "value1"}, - "user2": {"gh_username": "User2", "data": "value2"} + "user2": {"gh_username": "User2", "data": "value2"}, } assert result == expected + def test_create_paths_single_repo(): repo = "pyos-repo" result = create_paths(repo) expected = "https://raw.githubusercontent.com/pyOpenSci/pyos-repo/main/.all-contributorsrc" assert result == expected + def test_create_paths_multiple_repos(): repos = ["pyos-repo1", "pyos-repo2"] result = create_paths(repos) expected = [ "https://raw.githubusercontent.com/pyOpenSci/pyos-repo1/main/.all-contributorsrc", - "https://raw.githubusercontent.com/pyOpenSci/pyos-repo2/main/.all-contributorsrc" + "https://raw.githubusercontent.com/pyOpenSci/pyos-repo2/main/.all-contributorsrc", ] - assert result == expected \ No newline at end of file + assert result == expected