Skip to content

gh-113569: Display calls in Mock.assert_has_calls failure when empty#113573

Merged
serhiy-storchaka merged 5 commits into
python:mainfrom
wookie184:include-actual-in-unittest-failure
Jan 4, 2024
Merged

gh-113569: Display calls in Mock.assert_has_calls failure when empty#113573
serhiy-storchaka merged 5 commits into
python:mainfrom
wookie184:include-actual-in-unittest-failure

Conversation

@wookie184

@wookie184 wookie184 commented Dec 29, 2023

Copy link
Copy Markdown
Contributor

@wookie184

Copy link
Copy Markdown
Contributor Author

News failed the lint, but now i'm thinking this probably doesn't even need news, should I just remove it?

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change needs a NEWS entry :)

Comment thread Lib/test/test_unittest/testmock/testmock.py Outdated
Comment thread Lib/unittest/mock.py Outdated
Comment thread Lib/test/test_unittest/testmock/testmock.py
Comment thread Lib/unittest/mock.py Outdated
Comment thread Lib/unittest/mock.py Outdated
Comment thread Lib/test/test_unittest/testmock/testmock.py
Comment thread Lib/unittest/mock.py
Comment thread Misc/NEWS.d/next/Library/2023-12-29-17-57-45.gh-issue-113569.qcRCEI.rst Outdated

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you think about displaying " Actual: not called" like in assert_called_with()?

Comment thread Lib/test/test_unittest/testmock/testmock.py
Comment thread Lib/test/test_unittest/testmock/testmock.py
@wookie184

Copy link
Copy Markdown
Contributor Author

Thank you everyone for the reviews so far by the way, it's appreciated :)

@cjw296

cjw296 commented Jan 4, 2024

Copy link
Copy Markdown
Contributor

@wookie184 - this looks ready to merge now, is that correct?

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@serhiy-storchaka
serhiy-storchaka merged commit 1600d78 into python:main Jan 4, 2024
@serhiy-storchaka

Copy link
Copy Markdown
Member

Thank you for your contribution @wookie184. It is not only added a useful feature, but made the code tidier in general.

@cjw296

cjw296 commented Jan 4, 2024

Copy link
Copy Markdown
Contributor

Any backports needed @serhiy-storchaka ?

@serhiy-storchaka

Copy link
Copy Markdown
Member

This is a new feature, not a bug fix.

kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
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.

Display actual calls for unittest.assert_has_calls even if empty

4 participants