Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(81019)

#15836: unittest assertRaises should verify excClass is actually a BaseException class

Can't Edit
Can't Publish+Mail
Start Review
Created:
7 years, 2 months ago by dawagner
Modified:
4 years, 5 months ago
Reviewers:
rdmurray, pcmanticore, berker.peksag, ezio.melotti, storchaka, vadmium+py
CC:
ezio.melotti, r.david.murray, Michael Foord, Claudiu.Popa, devnull_psf.upfronthosting.co.za, berkerpeksag, Martin Panter, illicitonion, storchaka
Visibility:
Public.

Patch Set 1 #

Total comments: 6

Patch Set 2 #

Total comments: 2

Patch Set 3 #

Total comments: 3

Patch Set 4 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/test/test_importlib/builtin/test_loader.py View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
Lib/unittest/case.py View 1 2 3 4 chunks +13 lines, -0 lines 3 comments Download
Lib/unittest/test/test_case.py View 1 2 3 4 chunks +56 lines, -0 lines 0 comments Download
Misc/ACKS View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 9
r.david.murray
Thanks for the patch. I do have some comments. http://bugs.python.org/review/15836/diff/5911/Lib/unittest/case.py File Lib/unittest/case.py (right): http://bugs.python.org/review/15836/diff/5911/Lib/unittest/case.py#newcode570 Lib/unittest/case.py:570: ...
7 years, 2 months ago #1
illicitonion
I seem to be getting exceptions why trying to upload a new patch to rietveld, ...
7 years, 2 months ago #2
Claudiu.Popa
http://bugs.python.org/review/15836/diff/5916/Lib/unittest/case.py File Lib/unittest/case.py (right): http://bugs.python.org/review/15836/diff/5916/Lib/unittest/case.py#newcode111 Lib/unittest/case.py:111: if type(expected) is tuple: You could use isinstance here.
5 years, 5 months ago #3
berkerpeksag
http://bugs.python.org/review/15836/diff/5915/Lib/unittest/test/test_case.py File Lib/unittest/test/test_case.py (right): http://bugs.python.org/review/15836/diff/5915/Lib/unittest/test/test_case.py#newcode1031 Lib/unittest/test/test_case.py:1031: try: Can this be written like with.assertRaises(TypeError): self.assertRaises(1)
5 years, 5 months ago #4
ezio.melotti
http://bugs.python.org/review/15836/diff/5916/Lib/unittest/case.py File Lib/unittest/case.py (right): http://bugs.python.org/review/15836/diff/5916/Lib/unittest/case.py#newcode99 Lib/unittest/case.py:99: return If this is to support exceptions that are ...
5 years, 4 months ago #5
storchaka_gmail.com
https://bugs.python.org/review/15836/diff/5915/Lib/unittest/test/test_case.py File Lib/unittest/test/test_case.py (right): https://bugs.python.org/review/15836/diff/5915/Lib/unittest/test/test_case.py#newcode1050 Lib/unittest/test/test_case.py:1050: self.assertRaises((object, 1)) Should be something like self.assertRaises((TypeError, object)).
4 years, 7 months ago #6
Martin Panter
http://bugs.python.org/review/15836/diff/14885/Lib/unittest/case.py File Lib/unittest/case.py (right): http://bugs.python.org/review/15836/diff/14885/Lib/unittest/case.py#newcode155 Lib/unittest/case.py:155: if not _is_subtype(self.expected, self._base_type): Why is this check moved ...
4 years, 5 months ago #7
storchaka_gmail.com
http://bugs.python.org/review/15836/diff/14885/Lib/unittest/case.py File Lib/unittest/case.py (right): http://bugs.python.org/review/15836/diff/14885/Lib/unittest/case.py#newcode155 Lib/unittest/case.py:155: if not _is_subtype(self.expected, self._base_type): On 2015/05/19 12:37:58, vadmium wrote: ...
4 years, 5 months ago #8
Martin Panter
4 years, 5 months ago #9
http://bugs.python.org/review/15836/diff/14885/Lib/unittest/case.py
File Lib/unittest/case.py (right):

http://bugs.python.org/review/15836/diff/14885/Lib/unittest/case.py#newcode155
Lib/unittest/case.py:155: if not _is_subtype(self.expected, self._base_type):
On 2015/05/19 12:47:33, storchaka wrote:
> On 2015/05/19 12:37:58, vadmium wrote:
> > Why is this check moved from __init__() to handle()? I would expect the
check
> to
> > be made at the point of setting “self.expected”.
> 
> Only because the name parameter is passed to handle(), not to __init__().

Fair enough, that makes sense
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+