-
Notifications
You must be signed in to change notification settings - Fork 0
Level3 fix 3 #6
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
base: main
Are you sure you want to change the base?
Level3 fix 3 #6
Conversation
vppuzakov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 классная работа, вмерживай
| __pycache__/ | ||
| .coverage | ||
| .pytest_cache/ | ||
| .vscode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❗ папку с настройками проекта .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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 лучше вернуть покрытие и если нужно, то по требованию его можно отключить при запуске команды: pytest --no-cov
| @@ -1,19 +1,30 @@ | |||
| asarPy==1.0.1 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 давай как нибудь попробуем использовать 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 хороший пример почему автоформат на прекоммит хуке не здорово - эти изменения казалось бы не должны были попасить в этот пулл-риквест - но попали... Лучше все-таки оставлять линтер для подсвечивания по ошибкам, но не включать автофикс
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 а вот за это спасибо - этот вариант со скобками был крайне ужасным
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 такое название теста читается как по маслу
|
|
||
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 отличный, крайне уместный параметрайз
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 судя по использованию - это не фикстура-фабрика - тогда переименуй ее в 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 хорошее использование фабрики
💡 если позволяет место по ширине - объединяй в одну строку
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 отличный тест, название, тело теста максимально понятное благодаря удобной фикстуре-фабрике
No description provided.