Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split utilities test file into two to match the source files #127

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
"""
Tests for the clean and parse helper functions located in
the utils_clean and utils_parse modules.

"""
"""Tests for the clean helper functions located in the utils_clean module."""

import pytest

from pyosmeta.utils_clean import clean_date, clean_markdown, clean_name
from pyosmeta.utils_parse import parse_user_names


@pytest.mark.parametrize(
Expand Down Expand Up @@ -60,22 +55,3 @@ def test_clean_markdown(input_string, expected_output):
)
def test_clean_name(input_name, expected_output):
assert clean_name(input_name) == expected_output


@pytest.mark.parametrize(
"name, expected_result",
[
(
"Test User (@test1user)",
{"name": "Test User", "github_username": "test1user"},
),
("(@test2user)", {"name": "", "github_username": "test2user"}),
(
"Test (user) 3 (@test3user)",
{"name": "Test user 3", "github_username": "test3user"},
),
("@test4user", {"name": "", "github_username": "test4user"}),
],
)
def test_parse_user_names(name, expected_result):
assert parse_user_names(name) == expected_result
24 changes: 24 additions & 0 deletions tests/unit/test_utils_parse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Tests for parse helper functions located in utils_parse module."""

import pytest

from pyosmeta.utils_parse import parse_user_names


@pytest.mark.parametrize(
"name, expected_result",
[
(
"Test User (@test1user)",
{"name": "Test User", "github_username": "test1user"},
),
("(@test2user)", {"name": "", "github_username": "test2user"}),
(
"Test (user) 3 (@test3user)",
{"name": "Test user 3", "github_username": "test3user"},
),
("@test4user", {"name": "", "github_username": "test4user"}),
],
)
def test_parse_user_names(name, expected_result):
assert parse_user_names(name) == expected_result