MCPcopy Index your code
hub / github.com/python/cpython / test_pyobject_dump

Method test_pyobject_dump

Lib/test/test_capi/test_object.py:286–306  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

284 os_helper.unlink(filename)
285
286 def test_pyobject_dump(self):
287 # test string object
288 str_obj = 'test string'
289 output = self.pyobject_dump(str_obj)
290 hex_regex = r'(0x)?[0-9a-fA-F]+'
291 regex = (
292 fr"object address : {hex_regex}\n"
293 r"object refcount : [0-9]+\n"
294 fr"object type : {hex_regex}\n"
295 r"object type name: str\n"
296 r"object repr : 'test string'"
297 )
298 self.assertRegex(output, regex)
299
300 # release the GIL
301 output = self.pyobject_dump(str_obj, release_gil=True)
302 self.assertRegex(output, regex)
303
304 # test NULL object
305 output = self.pyobject_dump(NULL)
306 self.assertRegex(output, r'<object at .* is freed>')
307
308
309if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

pyobject_dumpMethod · 0.95
assertRegexMethod · 0.80

Tested by

no test coverage detected