Skip to content

First attempt#2

Open
OdintsovTim wants to merge 8 commits into
python-testing-sandbox:masterfrom
OdintsovTim:master
Open

First attempt#2
OdintsovTim wants to merge 8 commits into
python-testing-sandbox:masterfrom
OdintsovTim:master

Conversation

@OdintsovTim
Copy link
Copy Markdown

No description provided.

Comment thread test_code.py
if module_name == '_pytest':
sys_modules[module_name].outcomes.Skipped = sys_modules[module_name].SkipTest

assert skip_exceptions_to_reraise() == (sys_modules[module_name].SkipTest,)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (non-blocking): Думаю, можно еще добавить случай, когда в sys.modules несколько ключей

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Решили пока не добавлять этот тест, все ломается и ничего не работает, записал себе и попробую еще на днях

Comment thread test_code.py Outdated
with pytest.raises(ColumnError):
assert processor._get_datetime_from_string('18 9 2018') == expected
else:
assert processor._get_datetime_from_string('18 9 2018') == expected
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nitpick: Ты же задаешь в параметрах value, в функцию тоже его можешь передавать

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Comment thread test_code.py
processor = DateTimeProcessor(timezone=timezone)
if expected:
mocker.patch('main.DateTimeProcessor._get_datetime_from_string', return_value=expected)
assert processor.process_value(value) == expected
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (non-blocking): Кажется, что здесь везде можно задавать expected, ведь случай с exception ты рассматриваешь в тесте ниже

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Там проверяются разные ошибки в разных методах, я бы не стал их смешивать)

Comment thread test_code.py
'value, timezone, exception',
[
(123, None, ColumnError),
(123, 'UBC', ValueError),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

question: А разве в методе process_value возникает ValueError?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ValueError вызывается в init :) Но я отдельно решил не писать тест для init

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