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

Method test_rfind

Lib/test/test_mmap.py:303–318  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

301
302
303 def test_rfind(self):
304 # test the new 'end' parameter works as expected
305 with open(TESTFN, 'wb+') as f:
306 data = b'one two ones'
307 n = len(data)
308 f.write(data)
309 f.flush()
310 m = mmap.mmap(f.fileno(), n)
311
312 self.assertEqual(m.rfind(b'one'), 8)
313 self.assertEqual(m.rfind(b'one '), 0)
314 self.assertEqual(m.rfind(b'one', 0, -1), 8)
315 self.assertEqual(m.rfind(b'one', 0, -2), 0)
316 self.assertEqual(m.rfind(b'one', 1, -1), 8)
317 self.assertEqual(m.rfind(b'one', 1, -2), -1)
318 self.assertEqual(m.rfind(bytearray(b'one')), 8)
319
320
321 def test_double_close(self):

Callers

nothing calls this directly

Calls 7

lenFunction · 0.85
openFunction · 0.50
writeMethod · 0.45
flushMethod · 0.45
filenoMethod · 0.45
assertEqualMethod · 0.45
rfindMethod · 0.45

Tested by

no test coverage detected