Skip to content

Conversation

@DianaRatnikova
Copy link

Собрала эрроры в параметрайзы

assert build_url(host_name, relative_url, get_params) == expected_result


def test__build_url_only_host_name_typeerror():
Copy link
Contributor

Choose a reason for hiding this comment

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

В этом файле почти везде потерялись вторые подчёркивания

("2023,12,15", "19:55", datetime.datetime(datetime.date.today().year,
datetime.date.today().month,
datetime.date.today().day,
19, 55)),
Copy link
Contributor

Choose a reason for hiding this comment

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

В фикстурах лучше стараться держать данные постатичнее и попроще. Например, ты можешь тут хранить количество дней, которые добавить к тудей, чай и минуту, а сам объект datetime собирать уже в тесте.

)
def test__compose_datetime_from__error(date_str, time_str, expected_error, need_time_str):
with pytest.raises(expected_error):
if need_time_str == 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

В python для такого используется не 1/0, а True/False

(0, 0, TypeError, 0, 0),
]
)
def test__first__errors(items, default, expected_error, items_need, default_need):
Copy link
Contributor

Choose a reason for hiding this comment

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

В тесте не дожно быть такой вложенности и такого количества условий. В таком случае лучше разбить на несколько простых тестов

]
)
def test__replace_word__errors(text, replace_from, replace_to, expected_error):
with pytest.raises(expected_error):
Copy link
Contributor

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.

2 participants