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

Method test_tobytes

Lib/test/test_memoryview.py:185–193  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

183 del m[1:4]
184
185 def test_tobytes(self):
186 for tp in self._types:
187 m = self._view(tp(self._source))
188 b = m.tobytes()
189 # This calls self.getitem_type() on each separate byte of b"abcdef"
190 expected = b"".join(
191 self.getitem_type(bytes([c])) for c in b"abcdef")
192 self.assertEqual(b, expected)
193 self.assertIsInstance(b, bytes)
194
195 def test_tolist(self):
196 for tp in self._types:

Callers

nothing calls this directly

Calls 5

assertIsInstanceMethod · 0.80
_viewMethod · 0.45
tobytesMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected