Conversation
| @@ -0,0 +1,10 @@ | |||
| from functions.level_1_5.two_square_equation import solve_square_equation | |||
|
|
|||
| def test_solve_square_equation_if_discriminant_is_negatibe(): | |||
There was a problem hiding this comment.
💡 нужно еще потестить вот эту ветку:
| def test_solve_square_equation_if_discriminant_is_negatibe(): | ||
| assert solve_square_equation(1.0, 1.0, 1.0) == (None, None) | ||
|
|
||
| def test_solve_square_equation_if_discriminant_is_positive(): |
There was a problem hiding this comment.
💡 наименования у тестов должны быть test__method__behavior
|
|
||
| def test_get_median_value_with_odd_len_of_items(): | ||
| items = [1, 3, 6, 8, 9, 10] | ||
| assert get_median_value(items) == 9 |
There was a problem hiding this comment.
💡 лучше сделать этот тест ванлайнером, и передать параметры items=[1, 3, ...] как kwargs
| @@ -0,0 +1,13 @@ | |||
| from functions.level_1_5.one_median import get_median_value | |||
|
|
|||
| def test_get_median_value_with_empty_items(): | |||
There was a problem hiding this comment.
👍 тестируем кейс на пустой входной список элементов
| items = [5, 7, 1, 15] | ||
| assert first(items) == 5 | ||
|
|
||
| def test_first_with_empty_items_and_default_is_NOT_SET(): |
|
|
||
| def test_first_with_empty_items_and_default_is_NOT_SET(): | ||
| items = [] | ||
| default = "NOT_SET" |
There was a problem hiding this comment.
🔴 default есть, но не используется, мне кажется тут one liner бы зашел
| with pytest.raises(AttributeError): | ||
| first(items) | ||
|
|
||
| def test_first_with_empty_items_and_default_is_None(): |
| def test_first_with_empty_items_and_default_is_None(): | ||
| items = [] | ||
| default = None | ||
| assert first(items, default) == None |
| def test_first_with_empty_items_and_default_is_int(): | ||
| items = [] | ||
| default = 0 | ||
| assert first(items, default) == 0 |
vppuzakov
left a comment
There was a problem hiding this comment.
👍 в целом сами тесты оформлены отлично, тест кейсы найдены хорошие. Считаю что можно смержить и в следующих ПРах вернутся порефачить.
💡 во всех тестах как будто не хватает глагола в названии описывающего поведение, есть только факты того что передается на вход.
Это уже неплохо, но вот мне чего то не хватило из названий чтобы понять тестируемое поведение. То есть да вот мы тестим функцию когда на входе такие-то значения, а какое поведение ожидаем то - в названии не видно.
Типо функция вернет true, выкинет ошибку, вернет первый элемент из списка, строку без замен, строку с заменненным словом.
| from functions.level_1_5.five_replace_word import replace_word | ||
|
|
||
| def test__replace_word__starts_with_case_irrelevant(): | ||
| assert replace_word('the big black car', 'big', 'Black') == 'the Black black car' |
There was a problem hiding this comment.
💡 если case irrelevant - то это replace_word('the big black car', 'Big', 'Black'), искомое слово ищется без учета регистра букв
| assert replace_word('the big black car', 'big', 'Black') == 'the Black black car' | ||
|
|
||
|
|
||
| def test__replace_word__if_replace_word_not_find_in_text(): |
There was a problem hiding this comment.
💡 Можно еще явнее описать тест в названии, test__replace_word__unchanged_when_replace_word_not_found_in_text
| assert check_tweet_sentiment(text, good_words, bad_words) == None | ||
|
|
||
|
|
||
| def test__check_tweet_sentiment__without_good_and_bad_words(): |
There was a problem hiding this comment.
💡 во всех тестах этого модуля не хватает глагола в названии, описывающего поведение, описывается факт, что на входе, но не поведение
test__check_tweet_sentiment__return_none_when_no_good_and_bad_words_found
|
|
||
|
|
||
| @pytest.mark.xfail(reason='Incorrect calculation') | ||
| def test__get_median_value__with_odd_len_of_items(): |
There was a problem hiding this comment.
💡 не хватает глагола, описывающего поведение
| assert first([], None) == None | ||
|
|
||
|
|
||
| def test__first__with_empty_items_and_default_is_int(): |
There was a problem hiding this comment.
💡 есть то что на входе в названии, но не отражено поведение, что мы ожидаем увидеть
I didn't like the test for two_square_equation. I am sure, that I could do much more, but this didn't work. That is why I wrote just two, because others didn't work properly. Also I spent much time for one_median tests, but it conclude bag in themself.