MCPcopy
hub / github.com/pytest-dev/pytest / dumps

Method dumps

doc/en/example/multipython.py:34–46  ·  doc/en/example/multipython.py::Python.dumps
(self, obj)

Source from the content-addressed store, hash-verified

32 self.picklefile = picklefile
33
34 def dumps(self, obj):
35 dumpfile = self.picklefile.with_name(class="st">"dump.py")
36 dumpfile.write_text(
37 textwrap.dedent(
38 rfclass="st">"""
39 import pickle
40 f = open({str(self.picklefile)!r}, &class="cm">#x27;wb')
41 s = pickle.dump({obj!r}, f, protocol=2)
42 f.close()
43 class="st">"""
44 )
45 )
46 subprocess.run((self.pythonpath, str(dumpfile)), check=True)
47
48 def load_and_is_true(self, expression):
49 loadfile = self.picklefile.with_name(class="st">"load.py")

Callers 9

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

Calls 2

write_textMethod · 0.80
runMethod · 0.45

Tested by 6

test_basic_objectsFunction · 0.64
test_cache_errorFunction · 0.64
test_serializationFunction · 0.64
setuptestfsMethod · 0.64
round_tripMethod · 0.64