Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign uptests: assertNotRaises raises AttributeError: __exit__ #1163
Comments
marmarek
added
bug
C: core
P: minor
labels
Sep 3, 2015
marmarek
assigned
woju
Sep 3, 2015
marmarek
added this to the Release 3.1 milestone
Sep 3, 2015
marmarek
added
C: tests
and removed
C: core
labels
Sep 3, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Which version of python did you use? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Sep 8, 2015
Member
2.7
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
|
2.7 Best Regards, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
woju
Sep 9, 2015
Member
Oh, I see. assertNotRaises does not support multiple exceptions passed to it.
There are two ways to use it. First, as context manager, like that:
with self.assertNotRaises(Exception):
foo(arg1, kwarg=123)
The second one:
self.assertNotRaises(Exception, foo, arg1, kwarg=123)
If you'd like to check two exceptions, nest the context, or reopen as feature request.
|
Oh, I see. There are two ways to use it. First, as context manager, like that:
The second one:
If you'd like to check two exceptions, nest the context, or reopen as feature request. |
woju
closed this
Sep 9, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Sep 30, 2015
Member
It does support multiple exceptions. Just needs to pass them as a tuple.
|
It does support multiple exceptions. Just needs to pass them as a tuple. |
marmarek commentedSep 3, 2015