diff --git a/pyproject.toml b/pyproject.toml index 84f45a3..17cfb62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,6 @@ warn_unused_configs = true line-length = 120 extend-exclude = ''' ( - tests - | docs + docs ) ''' diff --git a/tests/test_number_functions.py b/tests/test_number_functions.py index 19b3796..f3e9021 100644 --- a/tests/test_number_functions.py +++ b/tests/test_number_functions.py @@ -3,41 +3,50 @@ from my_package.number_functions import add_one, subtract_one, sum_array -@pytest.mark.parametrize("test_input,expected", [ - (1, 2), - (0, 1), - (-4, -3), - (2.5, 3.5), -]) +@pytest.mark.parametrize( + ("test_input", "expected"), + ( + (1, 2), + (0, 1), + (-4, -3), + (2.5, 3.5), + ), +) def test_add_one(test_input, expected): assert add_one(test_input) == expected -@pytest.mark.parametrize("test_input,expected", [ - (1, 0), - (0, -1), - (-4, -5), - (2.5, 1.5), -]) +@pytest.mark.parametrize( + ("test_input", "expected"), + ( + (1, 0), + (0, -1), + (-4, -5), + (2.5, 1.5), + ), +) def test_subtract_one(test_input, expected): assert subtract_one(test_input) == expected def test_add_one_typeerror(): with pytest.raises(TypeError): - add_one('some string') + add_one("some string") def test_subtract_one_typeerror(): with pytest.raises(TypeError): - subtract_one('another string') - - -@pytest.mark.parametrize("test_input,expected", [ - (np.array([1, 2]), 3), - (np.array([]), 0), - (np.ones(3), 3), - (np.zeros(5), 0), -]) + subtract_one("another string") + + +@pytest.mark.parametrize( + ("test_input", "expected"), + ( + (np.array([1, 2]), 3), + (np.array([]), 0), + (np.ones(3), 3), + (np.zeros(5), 0), + ), +) def test_sum_array(test_input, expected): assert sum_array(test_input) == expected diff --git a/tests/test_string_functions.py b/tests/test_string_functions.py index 69ae6c2..8cb7ba8 100644 --- a/tests/test_string_functions.py +++ b/tests/test_string_functions.py @@ -2,29 +2,35 @@ from my_package.string_functions import reverse_string, add_exclamation_mark -@pytest.mark.parametrize("test_input,expected", [ - ('abc', 'cba'), - ('aaa', 'aaa'), - ('', ''), -]) +@pytest.mark.parametrize( + ("test_input", "expected"), + ( + ("abc", "cba"), + ("aaa", "aaa"), + ("", ""), + ), +) def test_reverse_string(test_input, expected): assert reverse_string(test_input) == expected -@pytest.mark.parametrize("test_input,expected", [ - ('Hello world', 'Hello world!'), - ('abc', 'abc!'), - ('', '!'), -]) +@pytest.mark.parametrize( + ("test_input", "expected"), + ( + ("Hello world", "Hello world!"), + ("abc", "abc!"), + ("", "!"), + ), +) def test_add_exclamation_mark(test_input, expected): assert add_exclamation_mark(test_input) == expected -# def test_reverse_string_raises_typeerror(): -# with pytest.raises(TypeError): -# reverse_string(3) +def test_reverse_string_raises_type_error(): + with pytest.raises(TypeError): + reverse_string(3) -def test_add_exclamation_mark_raises_typeerror(): +def test_add_exclamation_mark_raises_type_error(): with pytest.raises(TypeError): add_exclamation_mark(1)