mirror of https://github.com/django/django.git
Updated decorators test to use subTest().
This commit is contained in:
parent
93331877c8
commit
09f1f0387b
|
@ -244,15 +244,15 @@ class MethodDecoratorTests(SimpleTestCase):
|
||||||
"A method"
|
"A method"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for Test in (TestPlain, TestMethodAndClass, TestIterable):
|
tests = (TestPlain, TestMethodAndClass, TestIterable)
|
||||||
self.assertIs(getattr(Test().method, 'myattr', False), True)
|
for Test in tests:
|
||||||
self.assertIs(getattr(Test().method, 'myattr2', False), True)
|
with self.subTest(Test=Test):
|
||||||
|
self.assertIs(getattr(Test().method, 'myattr', False), True)
|
||||||
self.assertIs(getattr(Test.method, 'myattr', False), True)
|
self.assertIs(getattr(Test().method, 'myattr2', 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.__doc__, 'A method')
|
||||||
self.assertEqual(Test.method.__name__, 'method')
|
self.assertEqual(Test.method.__name__, 'method')
|
||||||
|
|
||||||
def test_bad_iterable(self):
|
def test_bad_iterable(self):
|
||||||
decorators = {myattr_dec_m, myattr2_dec_m}
|
decorators = {myattr_dec_m, myattr2_dec_m}
|
||||||
|
|
Loading…
Reference in New Issue