MCPcopy Create free account
hub / github.com/cloudpipe/cloudpickle / test_func_globals

Method test_func_globals

tests/cloudpickle_test.py:192–208  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

190 self.assertEqual(out1, out2)
191
192 def test_func_globals(self):
193 class Unpicklable:
194 def __reduce__(self):
195 raise Exception("not picklable")
196
197 global exit
198 exit = Unpicklable()
199
200 self.assertRaises(
201 Exception, lambda: cloudpickle.dumps(exit, protocol=self.protocol)
202 )
203
204 def foo():
205 sys.exit(0)
206
207 self.assertTrue("exit" in foo.__code__.co_names)
208 cloudpickle.dumps(foo)
209
210 def test_memoryview(self):
211 buffer_obj = memoryview(b"Hello")

Callers

nothing calls this directly

Calls 1

UnpicklableClass · 0.85

Tested by

no test coverage detected