Skip to content

Commit 020be10

Browse files
author
Joe Jevnik
committed
add cell manipulation helper unit tests
1 parent 26c319c commit 020be10

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/cloudpickle_test.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from io import BytesIO
3939

4040
import cloudpickle
41-
from cloudpickle.cloudpickle import _find_module
41+
from cloudpickle.cloudpickle import _find_module, _make_empty_cell, cell_set
4242

4343
from .testutils import subprocess_pickle_echo
4444

@@ -494,6 +494,19 @@ def example():
494494
"'))()")
495495
assert not subprocess.call([sys.executable, '-c', command])
496496

497+
def test_cell_manipulation(self):
498+
cell = _make_empty_cell()
499+
500+
with pytest.raises(ValueError):
501+
cell.cell_contents
502+
503+
ob = object()
504+
cell_set(cell, ob)
505+
self.assertEqual(
506+
cell.cell_contents is ob,
507+
msg='cell contents not set correctly',
508+
)
509+
497510

498511
if __name__ == '__main__':
499512
unittest.main()

0 commit comments

Comments
 (0)