Conversation
| __pycache__/ | ||
| .coverage | ||
| .pytest_cache/ | ||
| .vscode |
There was a problem hiding this comment.
❗ папку с настройками проекта .vscode не нужно игнорить - как раз удобно шарить между командой общий сетап проекта. При этом пользовательские же настройки хранятся в другом месте.
| [pytest] | ||
| addopts = --cov=. --cov-branch --testdox -vv | ||
| ; addopts = --cov=. --cov-branch --testdox --cov-fail-under=60 -vv | ||
| addopts = --testdox -vv |
There was a problem hiding this comment.
💡 лучше вернуть покрытие и если нужно, то по требованию его можно отключить при запуске команды: pytest --no-cov
| @@ -1,19 +1,30 @@ | |||
| asarPy==1.0.1 | |||
There was a problem hiding this comment.
💡 давай как нибудь попробуем использовать pip-tools, или более современный его аналог - uv. Хотя начать лучше с кого-либо из poetry, pdm, pipenv.
Нам нужно разделять основные зависимости проекта от прочих зависимостей времени разработки (dev, lint, test, docs), а также от различать их от дочерних зависимостей.
При этом нам все еще нужен общий лок файл зависимостей с конкретными версиями для воспроизводимости окружения (независимости его от времени установки)
| def test__parse_ineco_expense__return_correct_spent_at( | ||
| sms, expected_spent_at, make_sms, cards | ||
| ): | ||
| def test__parse_ineco_expense__return_correct_spent_at(sms, expected_spent_at, make_sms, cards): |
There was a problem hiding this comment.
💡 хороший пример почему автоформат на прекоммит хуке не здорово - эти изменения казалось бы не должны были попасить в этот пулл-риквест - но попали... Лучше все-таки оставлять линтер для подсвечивания по ошибкам, но не включать автофикс
| assert ( | ||
| replace_word("some words to replace", "some", "any") == "any words to replace" | ||
| ) | ||
| assert replace_word("some words to replace", "some", "any") == "any words to replace" |
There was a problem hiding this comment.
👍 а вот за это спасибо - этот вариант со скобками был крайне ужасным
| def test__calculate_average_daily_expenses__correct_average_when_spent_in_different_days( | ||
| make_expense, | ||
| @pytest.mark.parametrize("amount", [1, 1000, 100000]) | ||
| def test__calculate_average_daily_expenses__return_correct_average_when_spent_in_different_days( |
There was a problem hiding this comment.
👍 такое название теста читается как по маслу
|
|
||
| def test__calculate_average_daily_expenses__correct_average_when_spent_in_different_days( | ||
| make_expense, | ||
| @pytest.mark.parametrize("amount", [1, 1000, 100000]) |
There was a problem hiding this comment.
👍 отличный, крайне уместный параметрайз
| def test__is_subscription__return_true_for_three_months_purchases(make_expense, make_spent_in): | ||
| first_expense = make_expense( | ||
| spent_in="chinar", | ||
| spent_in=make_spent_in, |
There was a problem hiding this comment.
💡 судя по использованию - это не фикстура-фабрика - тогда переименуй ее в spent_in
| first_expense = make_expense(spent_in="chinar") | ||
| second_expense = make_expense(spent_in="chinar") | ||
| assert is_subscription(first_expense, [first_expense, second_expense]) is False | ||
| first_expense = make_expense( |
There was a problem hiding this comment.
👍 хорошее использование фабрики
💡 если позволяет место по ширине - объединяй в одну строку
expenses = [
make_expense(spent_in=..., spent_at=...),
make_expense(spent_in=..., spent_at=...),
make_expense(spent_in=..., spent_at=...),
]| assert is_subscription(first_expense, [first_expense, second_expense, third_expense]) is False | ||
|
|
||
|
|
||
| def test__is_subscription__return_false_when_payment_in_different_places(make_expense): |
There was a problem hiding this comment.
👍 отличный тест, название, тело теста максимально понятное благодаря удобной фикстуре-фабрике
No description provided.