Skip to content

Conversation

@leeroymk
Copy link
Owner

@leeroymk leeroymk commented Apr 1, 2024

No description provided.

Copy link

@vppuzakov vppuzakov left a 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

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

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

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):

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"

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(

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])

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,

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(

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):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 отличный тест, название, тело теста максимально понятное благодаря удобной фикстуре-фабрике

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants