summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_datastructures.py
diff options
context:
space:
mode:
authorHasan <hasan.r67@gmail.com>2016-01-04 12:20:08 +0330
committerTim Graham <timograham@gmail.com>2016-01-29 13:03:39 -0500
commit253adc2b8a52982139d40c4f55b3fd446e1cb8f3 (patch)
treec508d48636f5b37e97c8078737d398d7475ff8cc /tests/utils_tests/test_datastructures.py
parent3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5 (diff)
Refs #26022 -- Used context manager version of assertRaisesMessage in tests.
Diffstat (limited to 'tests/utils_tests/test_datastructures.py')
-rw-r--r--tests/utils_tests/test_datastructures.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py
index d151f12bb5..c90ef470bb 100644
--- a/tests/utils_tests/test_datastructures.py
+++ b/tests/utils_tests/test_datastructures.py
@@ -108,8 +108,8 @@ class ImmutableListTests(SimpleTestCase):
d = ImmutableList(range(10))
# AttributeError: ImmutableList object is immutable.
- self.assertRaisesMessage(AttributeError,
- 'ImmutableList object is immutable.', d.sort)
+ with self.assertRaisesMessage(AttributeError, 'ImmutableList object is immutable.'):
+ d.sort()
self.assertEqual(repr(d), '(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)')
@@ -119,8 +119,8 @@ class ImmutableListTests(SimpleTestCase):
self.assertEqual(d[1], 1)
# AttributeError: Object is immutable!
- self.assertRaisesMessage(AttributeError,
- 'Object is immutable!', d.__setitem__, 1, 'test')
+ with self.assertRaisesMessage(AttributeError, 'Object is immutable!'):
+ d.__setitem__(1, 'test')
class DictWrapperTests(SimpleTestCase):