mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Refs #26022 -- Used context manager version of assertRaises in tests.
This commit is contained in:
parent
575706331b
commit
3d0dcd7f5a
118 changed files with 1086 additions and 760 deletions
|
@ -34,7 +34,8 @@ class DistanceTest(unittest.TestCase):
|
|||
|
||||
def testInitInvalid(self):
|
||||
"Testing initialization from invalid units"
|
||||
self.assertRaises(AttributeError, D, banana=100)
|
||||
with self.assertRaises(AttributeError):
|
||||
D(banana=100)
|
||||
|
||||
def testAccess(self):
|
||||
"Testing access in different units"
|
||||
|
@ -161,7 +162,8 @@ class AreaTest(unittest.TestCase):
|
|||
|
||||
def testInitInvaliA(self):
|
||||
"Testing initialization from invalid units"
|
||||
self.assertRaises(AttributeError, A, banana=100)
|
||||
with self.assertRaises(AttributeError):
|
||||
A(banana=100)
|
||||
|
||||
def testAccess(self):
|
||||
"Testing access in different units"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue