-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(python): use uv for all scenario
- Loading branch information
Showing
6 changed files
with
60 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 40 additions & 24 deletions
64
template/py/{{cookiecutter.project_slug}}/tests/test_example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,63 @@ | ||
import pytest | ||
|
||
from {{cookiecutter.package_name}} import add, divide, multiply, subtract | ||
|
||
|
||
@pytest.mark.parametrize("a, b, expected", [ | ||
(1, 2, 3), | ||
(0, 0, 0), | ||
(-1, -1, -2), | ||
]) | ||
@pytest.mark.parametrize( | ||
"a, b, expected", | ||
[ | ||
(1, 2, 3), | ||
(0, 0, 0), | ||
(-1, -1, -2), | ||
], | ||
) | ||
def test_add(a, b, expected): | ||
assert add(a, b) == expected | ||
|
||
|
||
@pytest.mark.parametrize("a, b, expected", [ | ||
(1, 2, -1), | ||
(0, 0, 0), | ||
(-1, -1, 0), | ||
]) | ||
@pytest.mark.parametrize( | ||
"a, b, expected", | ||
[ | ||
(1, 2, -1), | ||
(0, 0, 0), | ||
(-1, -1, 0), | ||
], | ||
) | ||
def test_subtract(a, b, expected): | ||
assert subtract(a, b) == expected | ||
|
||
|
||
@pytest.mark.parametrize("a, b, expected", [ | ||
(1, 2, 2), | ||
(0, 0, 0), | ||
(-1, -1, 1), | ||
]) | ||
@pytest.mark.parametrize( | ||
"a, b, expected", | ||
[ | ||
(1, 2, 2), | ||
(0, 0, 0), | ||
(-1, -1, 1), | ||
], | ||
) | ||
def test_multiply(a, b, expected): | ||
assert multiply(a, b) == expected | ||
|
||
|
||
@pytest.mark.parametrize("a, b, expected", [ | ||
(1, 2, 0.5), | ||
(-1, -1, 1), | ||
]) | ||
@pytest.mark.parametrize( | ||
"a, b, expected", | ||
[ | ||
(1, 2, 0.5), | ||
(-1, -1, 1), | ||
], | ||
) | ||
def test_divide(a, b, expected): | ||
assert divide(a, b) == expected | ||
|
||
|
||
@pytest.mark.parametrize("a, b", [ | ||
(0, 0), | ||
(10, 0), | ||
(-10, 0), | ||
]) | ||
@pytest.mark.parametrize( | ||
"a, b", | ||
[ | ||
(0, 0), | ||
(10, 0), | ||
(-10, 0), | ||
], | ||
) | ||
def test_divide_by_zero(a, b): | ||
with pytest.raises(ValueError, match="Division by zero is not allowed."): | ||
divide(a, b) |