summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_funcattrs.py
diff options
context:
space:
mode:
authorPierre Glaser <pierreglaser@msn.com>2019-02-07 19:36:48 (GMT)
committerAntoine Pitrou <pitrou@free.fr>2019-02-07 19:36:48 (GMT)
commitdf8d2cde63c865446468351f8f648e1c7bd45109 (patch)
tree1cc555d57319990602a4987cbf21ee225c4ff2a1 /Lib/test/test_funcattrs.py
parentf289084c83190cc72db4a70c58f007ec62e75247 (diff)
downloadcpython-df8d2cde63c865446468351f8f648e1c7bd45109.zip
cpython-df8d2cde63c865446468351f8f648e1c7bd45109.tar.gz
cpython-df8d2cde63c865446468351f8f648e1c7bd45109.tar.bz2
bpo-35911: add cell constructor (GH-11771)
Add a cell constructor, expose the cell type in the types module.
Diffstat (limited to 'Lib/test/test_funcattrs.py')
-rw-r--r--Lib/test/test_funcattrs.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
index 35fd657..11d68cc 100644
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -83,6 +83,15 @@ class FunctionPropertiesTest(FuncAttrsTest):
self.assertEqual(c[0].__class__.__name__, "cell")
self.cannot_set_attr(f, "__closure__", c, AttributeError)
+ def test_cell_new(self):
+ cell_obj = types.CellType(1)
+ self.assertEqual(cell_obj.cell_contents, 1)
+
+ cell_obj = types.CellType()
+ msg = "shouldn't be able to read an empty cell"
+ with self.assertRaises(ValueError, msg=msg):
+ cell_obj.cell_contents
+
def test_empty_cell(self):
def f(): print(a)
try: