Conversation
test_code.py
Outdated
| from code import chunks, flat, has_recursive_calls, parse_iso_datetime, get_image_height_in_pixels | ||
| from code import if_logs_has_any_of_commands, extract_all_constants_from_ast, is_camel_case_word | ||
| from code import split_camel_case_words, is_path_in_exclude_list, get_full_class_name, max_with_default | ||
| from code import is_python_class_name |
There was a problem hiding this comment.
предложение: Мне кажется, что тут можно все объединить from code import (.......)
test_code.py
Outdated
| from code import is_python_class_name | ||
|
|
||
|
|
||
| def test_chunk_iteration(): |
There was a problem hiding this comment.
nitpick : Мы же используем pytest? Почему бы везде для простоты потом добавление вариантов тестов не применять декаратор pytest.mark.parametrize( ' ' ) . Намного проще добавлять потом варианты для тестирования
test_code.py
Outdated
| ('https://via.placeholder.com/140x100', 100), | ||
| ] | ||
| ) | ||
| def test_get_image_height_in_pixels(image_url, expected): |
There was a problem hiding this comment.
А если сайт - перестанет работать, или в нем поменяется принцип работы? Тогда тест провалится.
Советую посмотреть Mocking in pytest. Когда мы подменяем функцию во время тестирования
test_code.py
Outdated
| 'word, expected', | ||
| [ | ||
| ('SuperClass', True), | ||
| ('nonameclass', False) |
There was a problem hiding this comment.
предложение: Я бы в тестах добавлял бы проверку пустых строк. Рассматрел крайние случаи
test_code.py
Outdated
| 'camel_cased_word, expected', | ||
| [ | ||
| ('SuperMegaClass', ['super', 'mega', 'class']), | ||
| ('userName', ['user', 'name']) |
There was a problem hiding this comment.
suggestion: Может проверить на крайние случаи: на пустую строку или строку, где все буквы маленькие
test_code.py
Outdated
|
|
||
|
|
||
| def test_get_full_class_name(): | ||
| class SomeClass(): |
There was a problem hiding this comment.
suggestion: Я бы вынес этот класс в conftest.py а потом бы импортировал бы сюда и использовал бы в декораторе сравнение примерно так... (MyTestClass(), 'tests.conftest.MyTestClass'
| 'items, default, expected', | ||
| [ | ||
| ([], 1, 1), | ||
| ([1, 2], None, 2), |
There was a problem hiding this comment.
suggestion: Можно добавить на проверку букв еще)
test_code.py
Outdated
| [ | ||
| (['move forward'], ['move'], True), | ||
| (['variable set on'], ['set'], True), | ||
| (['put'], ['put'], True) |
There was a problem hiding this comment.
question (non-blocking): А почему не проверяешь какие либо результаты с False? Проверка что и при неправильном будет результат, который мы ожидаем.
test_code.py
Outdated
|
|
||
|
|
||
| def test_parse_iso_datetime(): | ||
| iso_datetime = '2021-05-24T10:34:25.518993Z' |
There was a problem hiding this comment.
suggestion: Для покрытия более полного кода - я бы еще добавил проверку даты без Z
test_code.py
Outdated
|
|
||
|
|
||
| def test_flat(): | ||
| some_list = ['hello' 'world'] |
There was a problem hiding this comment.
suggestion: А если список пустой? или вложенный (Список в списке?) Или с разными типами (str, int)
No description provided.