Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and lwasser committed Aug 14, 2024
1 parent 615de06 commit bb74d09
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/unit/test_file_io.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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
assert result == expected

0 comments on commit bb74d09

Please sign in to comment.