MCPcopy Index your code
hub / github.com/RustPython/RustPython / FakeBytes

Class FakeBytes

Lib/test/test_format.py:334–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332 # %b will insert a series of bytes, either from a type that supports
333 # the Py_buffer protocol, or something that has a __bytes__ method
334 class FakeBytes(object):
335 def __bytes__(self):
336 return b'123'
337 fb = FakeBytes()
338 testcommon(b"%b", b"abc", b"abc")
339 testcommon(b"%b", bytearray(b"def"), b"def")

Callers 1

Calls

no outgoing calls

Tested by 1