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

Method test_rfind

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

Source from the content-addressed store, hash-verified

378
379
380 def test_rfind(self):
381 # test the new 'end' parameter works as expected
382 with open(TESTFN, 'wb+') as f:
383 data = b'one two ones'
384 n = len(data)
385 f.write(data)
386 f.flush()
387 m = mmap.mmap(f.fileno(), n)
388
389 self.assertEqual(m.rfind(b'one'), 8)
390 self.assertEqual(m.rfind(b'one '), 0)
391 self.assertEqual(m.rfind(b'one', 0, -1), 8)
392 self.assertEqual(m.rfind(b'one', 0, -2), 0)
393 self.assertEqual(m.rfind(b'one', 1, -1), 8)
394 self.assertEqual(m.rfind(b'one', 1, -2), -1)
395 self.assertEqual(m.rfind(bytearray(b'one')), 8)
396
397
398 def test_double_close(self):

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected