Add CI pipeline for variant 5
This commit is contained in:
21
tests/test_math_tools.py
Normal file
21
tests/test_math_tools.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import pytest
|
||||
|
||||
from ci_lab.math_tools import average, is_even, median
|
||||
|
||||
|
||||
def test_average_returns_arithmetic_mean() -> None:
|
||||
assert average([2, 4, 6, 8]) == 5
|
||||
|
||||
def test_average_raises_error_for_empty_list() -> None:
|
||||
with pytest.raises(ValueError, match="numbers must not be empty"):
|
||||
average([])
|
||||
|
||||
def test_median_for_odd_count() -> None:
|
||||
assert median([5, 1, 9]) == 5
|
||||
|
||||
def test_median_for_even_count() -> None:
|
||||
assert median([10, 2, 8, 4]) == 6
|
||||
|
||||
def test_is_even() -> None:
|
||||
assert is_even(10) is True
|
||||
assert is_even(7) is False
|
||||
14
tests/test_text_tools.py
Normal file
14
tests/test_text_tools.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from ci_lab.text_tools import normalize_text, unique_words, word_count
|
||||
|
||||
|
||||
def test_normalize_text_removes_extra_spaces_and_lowers_case() -> None:
|
||||
assert normalize_text(" Hello WORLD ") == "hello world"
|
||||
|
||||
def test_word_count_counts_words() -> None:
|
||||
assert word_count("Python CI with GitHub Actions") == 5
|
||||
|
||||
def test_word_count_returns_zero_for_empty_text() -> None:
|
||||
assert word_count(" ") == 0
|
||||
|
||||
def test_unique_words_returns_only_unique_values() -> None:
|
||||
assert unique_words("Python python CI") == {"python", "ci"}
|
||||
Reference in New Issue
Block a user