mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None. https://bugs.python.org/issue38979 Automerge-Triggered-By: @asvetlov
This commit is contained in:
parent
00ada2c1d5
commit
28c91631c2
3 changed files with 9 additions and 6 deletions
|
@ -38,9 +38,6 @@ class ContextTest(unittest.TestCase):
|
|||
|
||||
self.assertNotEqual(hash(c), hash('aaa'))
|
||||
|
||||
def test_context_var_new_2(self):
|
||||
self.assertIsNone(contextvars.ContextVar[int])
|
||||
|
||||
@isolated_context
|
||||
def test_context_var_repr_1(self):
|
||||
c = contextvars.ContextVar('a')
|
||||
|
@ -361,6 +358,10 @@ class ContextTest(unittest.TestCase):
|
|||
tp.shutdown()
|
||||
self.assertEqual(results, list(range(10)))
|
||||
|
||||
def test_contextvar_getitem(self):
|
||||
clss = contextvars.ContextVar
|
||||
self.assertEqual(clss[str], clss)
|
||||
|
||||
|
||||
# HAMT Tests
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue