Skip to content

Conversation

DmitryTokyo
Copy link

No description provided.

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

Choose a reason for hiding this comment

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

предложение: Мне кажется, что тут можно все объединить from code import (.......)

test_code.py Outdated
from code import is_python_class_name


def test_chunk_iteration():

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

А если сайт - перестанет работать, или в нем поменяется принцип работы? Тогда тест провалится.
Советую посмотреть Mocking in pytest. Когда мы подменяем функцию во время тестирования

test_code.py Outdated
'word, expected',
[
('SuperClass', True),
('nonameclass', False)

Choose a reason for hiding this comment

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

предложение: Я бы в тестах добавлял бы проверку пустых строк. Рассматрел крайние случаи

test_code.py Outdated
'camel_cased_word, expected',
[
('SuperMegaClass', ['super', 'mega', 'class']),
('userName', ['user', 'name'])

Choose a reason for hiding this comment

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

suggestion: Может проверить на крайние случаи: на пустую строку или строку, где все буквы маленькие

test_code.py Outdated


def test_get_full_class_name():
class SomeClass():

Choose a reason for hiding this comment

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

suggestion: Я бы вынес этот класс в conftest.py а потом бы импортировал бы сюда и использовал бы в декораторе сравнение примерно так... (MyTestClass(), 'tests.conftest.MyTestClass'

'items, default, expected',
[
([], 1, 1),
([1, 2], None, 2),

Choose a reason for hiding this comment

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

suggestion: Можно добавить на проверку букв еще)

test_code.py Outdated
[
(['move forward'], ['move'], True),
(['variable set on'], ['set'], True),
(['put'], ['put'], True)

Choose a reason for hiding this comment

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

question (non-blocking): А почему не проверяешь какие либо результаты с False? Проверка что и при неправильном будет результат, который мы ожидаем.

test_code.py Outdated


def test_parse_iso_datetime():
iso_datetime = '2021-05-24T10:34:25.518993Z'

Choose a reason for hiding this comment

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

suggestion: Для покрытия более полного кода - я бы еще добавил проверку даты без Z

test_code.py Outdated


def test_flat():
some_list = ['hello' 'world']

Choose a reason for hiding this comment

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

suggestion: А если список пустой? или вложенный (Список в списке?) Или с разными типами (str, int)

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