Conversation
vppuzakov
left a comment
There was a problem hiding this comment.
👍 вмерживай, по комментам в некст ПР поправь в основном по мокам в 4м и 5м тестах
There was a problem hiding this comment.
💡 добавить в .gitignore и удалить из репозитория
| mypy==1.3.0 | ||
| freezegun==1.2.2 No newline at end of file | ||
| freezegun==1.2.2 | ||
| unittest2==1.1.0 |
There was a problem hiding this comment.
💡 эта библиотека лишняя https://pypi.org/project/unittest2/, unittest есть из коробки
| [flake8] | ||
| max-line-length = 134 | ||
| ignore = D100, D103, WPS116, WPS118 | ||
| inline-quotes = '," |
There was a problem hiding this comment.
💡 должна быть какая-то одна либо одинарная либо двойная, лучше
# We also support "double" and "single"
| --testdox | ||
|
|
||
| [flake8] | ||
| max-line-length = 134 |
There was a problem hiding this comment.
💡 максимальная позволительная длина 119, давай сделаем 99 или 89
| return Expense( | ||
| amount=decimal.Decimal(amount), | ||
| currency=Currency.RUB, | ||
| card=card or BankCard(last_digits="1234", owner="Alexandr"), |
There was a problem hiding this comment.
💡 можно еще сделать фикстуру-фабрику (если понадобится потом) и использовать ее make_bankcard
| mock_config_parser.__getitem__.return_value = {'field_name': 'value'} | ||
| result = fetch_app_config_field('config.ini', 'field_name') | ||
| expected_result = 'value' | ||
| assert result == expected_result |
There was a problem hiding this comment.
💡 тут переменные как будто роли не играют - можно сразу написать:
assert fetch_app_config_field('config.ini', 'field_name') == 'value'|
|
||
|
|
||
| def test__fetch_extra_fields_configuration__get_app_config_field_without_value_return_none(mock_config_parser): | ||
| mock_config_parser.__getitem__.return_value = {} |
There was a problem hiding this comment.
💡 сделай мок-фикстуру на метод getitem конфигпарсера и используй ее.
| mock_config_parser.__getitem__.return_value = {} | ||
| result = fetch_app_config_field('config.ini', 'field_name') | ||
| expected_result = None | ||
| assert result == expected_result |
There was a problem hiding this comment.
💡 в таком коротком тесте используй сразу вызов и assert для читаемости
|
|
||
| @pytest.mark.parametrize( | ||
| 'expense, ExpenseCategory', | ||
| 'spent_in, expected_category', |
There was a problem hiding this comment.
👍 вот такая фикстура с простыми типами хорошая
| ExpenseCategory.ONLINE_SUBSCRIPTIONS), | ||
| (make_expenses(spent_in='Wonder pharm'), | ||
| ExpenseCategory.MEDICINE_PHARMACY), | ||
| ('Bastard place', ExpenseCategory.BAR_RESTAURANT), |
There was a problem hiding this comment.
👍 вот такая фикстура с простыми типами хорошая
vppuzakov
left a comment
There was a problem hiding this comment.
👍 вмерживай, по комментам в некст ПР поправь в основном по мокам в 4м и 5м тестах
No description provided.