From 09f1f0387b7f29b1a378a6d87e00ffbbadddd7d5 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Mon, 16 Apr 2018 12:47:06 -0400 Subject: [PATCH] Updated decorators test to use subTest(). --- tests/decorators/tests.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py index 3afab467a1..5a7fa88044 100644 --- a/tests/decorators/tests.py +++ b/tests/decorators/tests.py @@ -244,15 +244,15 @@ class MethodDecoratorTests(SimpleTestCase): "A method" pass - for Test in (TestPlain, TestMethodAndClass, TestIterable): - self.assertIs(getattr(Test().method, 'myattr', False), True) - self.assertIs(getattr(Test().method, 'myattr2', False), True) - - self.assertIs(getattr(Test.method, 'myattr', False), True) - self.assertIs(getattr(Test.method, 'myattr2', False), True) - - self.assertEqual(Test.method.__doc__, 'A method') - self.assertEqual(Test.method.__name__, 'method') + tests = (TestPlain, TestMethodAndClass, TestIterable) + for Test in tests: + with self.subTest(Test=Test): + self.assertIs(getattr(Test().method, 'myattr', False), True) + self.assertIs(getattr(Test().method, 'myattr2', False), True) + self.assertIs(getattr(Test.method, 'myattr', False), True) + self.assertIs(getattr(Test.method, 'myattr2', False), True) + self.assertEqual(Test.method.__doc__, 'A method') + self.assertEqual(Test.method.__name__, 'method') def test_bad_iterable(self): decorators = {myattr_dec_m, myattr2_dec_m}