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

Method drive_one

Lib/test/test_bufio.py:42–54  ·  view source on GitHub ↗
(self, pattern)

Source from the content-addressed store, hash-verified

40 os_helper.unlink(os_helper.TESTFN)
41
42 def drive_one(self, pattern):
43 for length in lengths:
44 # Repeat string 'pattern' as often as needed to reach total length
45 # 'length'. Then call try_one with that string, a string one larger
46 # than that, and a string one smaller than that. Try this with all
47 # small sizes and various powers of 2, so we exercise all likely
48 # stdio buffer sizes, and "off by one" errors on both sides.
49 q, r = divmod(length, len(pattern))
50 teststring = pattern * q + pattern[:r]
51 self.assertEqual(len(teststring), length)
52 self.try_one(teststring)
53 self.try_one(teststring + b"x")
54 self.try_one(teststring[:-1])
55
56 def test_primepat(self):
57 # A pattern with prime length, to avoid simple relationships with

Callers 2

test_primepatMethod · 0.95
test_nullpatMethod · 0.95

Calls 4

try_oneMethod · 0.95
lenFunction · 0.85
divmodFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected