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

Method test_center

Lib/test/test_bigmem.py:82–90  ·  view source on GitHub ↗
(self, size)

Source from the content-addressed store, hash-verified

80
81 @bigmemtest(size=_2G + 10, memuse=1)
82 def test_center(self, size):
83 SUBSTR = self.from_latin1(' abc def ghi')
84 s = SUBSTR.center(size)
85 self.assertEqual(len(s), size)
86 lpadsize = rpadsize = (len(s) - len(SUBSTR)) // 2
87 if len(s) % 2:
88 lpadsize += 1
89 self.assertEqual(s[lpadsize:-rpadsize], SUBSTR)
90 self.assertEqual(s.strip(), SUBSTR.strip())
91
92 @bigmemtest(size=_2G, memuse=2)
93 def test_count(self, size):

Callers

nothing calls this directly

Calls 5

lenFunction · 0.85
from_latin1Method · 0.45
centerMethod · 0.45
assertEqualMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected