MCPcopy Create free account
hub / github.com/pytest-dev/pytest / dumps

Method dumps

doc/en/example/multipython.py:32–46  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

30 self.picklefile = picklefile
31
32 def dumps(self, obj):
33 dumpfile = self.picklefile.with_name("dump.py")
34 dumpfile.write_text(
35 textwrap.dedent(
36 r"""
37 import pickle
38 f = open({!r}, 'wb')
39 s = pickle.dump({!r}, f, protocol=2)
40 f.close()
41 """.format(
42 str(self.picklefile), obj
43 )
44 )
45 )
46 subprocess.check_call((self.pythonpath, str(dumpfile)))
47
48 def load_and_is_true(self, expression):
49 loadfile = self.picklefile.with_name("load.py")

Callers 7

mainFunction · 0.80
setMethod · 0.80
_write_pyc_fpFunction · 0.80
test_basic_objectsFunction · 0.80
setuptestfsMethod · 0.80
round_tripMethod · 0.80

Calls 1

formatMethod · 0.45

Tested by 4

test_basic_objectsFunction · 0.64
setuptestfsMethod · 0.64
round_tripMethod · 0.64