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

Method test_expandtabs

Lib/test/string_tests.py:416–444  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

414 self.checkraises(TypeError, 'hello', 'upper', 42)
415
416 def test_expandtabs(self):
417 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
418 'expandtabs')
419 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
420 'expandtabs', 8)
421 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
422 'expandtabs', 4)
423 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi',
424 'expandtabs')
425 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi',
426 'expandtabs', 8)
427 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi',
428 'expandtabs', 4)
429 self.checkequal('abc\r\nab\r\ndef\ng\r\nhi', 'abc\r\nab\r\ndef\ng\r\nhi',
430 'expandtabs', 4)
431 # check keyword args
432 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
433 'expandtabs', tabsize=8)
434 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
435 'expandtabs', tabsize=4)
436
437 self.checkequal(' a\n b', ' \ta\n\tb', 'expandtabs', 1)
438
439 self.checkraises(TypeError, 'hello', 'expandtabs', 42, 42)
440 # This test is only valid when sizeof(int) == sizeof(void*) == 4.
441 # XXX RUSTPYTHON TODO: expandtabs overflow checks
442 if sys.maxsize < (1 << 32) and struct.calcsize('P') == 4 and False:
443 self.checkraises(OverflowError,
444 '\ta\n\tb', 'expandtabs', sys.maxsize)
445
446 def test_split(self):
447 # by a char

Callers

nothing calls this directly

Calls 2

checkequalMethod · 0.95
checkraisesMethod · 0.95

Tested by

no test coverage detected