diff options
author | Yury Selivanov <yury@magic.io> | 2018-06-28 13:20:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-28 13:20:29 -0400 |
commit | 41cb0baea96a80360971908a0bd79d9d40dd5e44 (patch) | |
tree | daae24f132152e040a3d40aa66922b90155da8ec /Lib | |
parent | bpo-31546: Fix input hook integration (GH-7978) (diff) | |
download | cpython-41cb0baea96a80360971908a0bd79d9d40dd5e44.tar.gz cpython-41cb0baea96a80360971908a0bd79d9d40dd5e44.tar.bz2 cpython-41cb0baea96a80360971908a0bd79d9d40dd5e44.zip |
bpo-33985: Implement ContextVar.name attribute. (GH-7980)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_context.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_context.py b/Lib/test/test_context.py index 74d05fc5c41..efd7319a23a 100644 --- a/Lib/test/test_context.py +++ b/Lib/test/test_context.py @@ -30,8 +30,13 @@ class ContextTest(unittest.TestCase): with self.assertRaisesRegex(TypeError, 'must be a str'): contextvars.ContextVar(1) - c = contextvars.ContextVar('a') - self.assertNotEqual(hash(c), hash('a')) + c = contextvars.ContextVar('aaa') + self.assertEqual(c.name, 'aaa') + + with self.assertRaises(AttributeError): + c.name = 'bbb' + + self.assertNotEqual(hash(c), hash('aaa')) def test_context_var_new_2(self): self.assertIsNone(contextvars.ContextVar[int]) |