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

Class FakeBytes

Lib/test/test_format.py:442–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440 # %b will insert a series of bytes, either from a type that supports
441 # the Py_buffer protocol, or something that has a __bytes__ method
442 class FakeBytes(object):
443 def __bytes__(self):
444 return b'123'
445 fb = FakeBytes()
446 testcommon(b"%b", b"abc", b"abc")
447 testcommon(b"%b", bytearray(b"def"), b"def")

Callers 1

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…