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

Method test_expandtabs

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

Source from the content-addressed store, hash-verified

459 self.checkraises(TypeError, 'hello', 'upper', 42)
460
461 def test_expandtabs(self):
462 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
463 'expandtabs')
464 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
465 'expandtabs', 8)
466 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
467 'expandtabs', 4)
468 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi',
469 'expandtabs')
470 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi',
471 'expandtabs', 8)
472 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi',
473 'expandtabs', 4)
474 self.checkequal('abc\r\nab\r\ndef\ng\r\nhi', 'abc\r\nab\r\ndef\ng\r\nhi',
475 'expandtabs', 4)
476 # check keyword args
477 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
478 'expandtabs', tabsize=8)
479 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
480 'expandtabs', tabsize=4)
481
482 self.checkequal(' a\n b', ' \ta\n\tb', 'expandtabs', 1)
483
484 self.checkraises(TypeError, 'hello', 'expandtabs', 42, 42)
485 # This test is only valid when sizeof(int) == sizeof(void*) == 4.
486 if sys.maxsize < (1 << 32) and struct.calcsize('P') == 4:
487 self.checkraises(OverflowError,
488 '\ta\n\tb', 'expandtabs', sys.maxsize)
489
490 def test_split(self):
491 # by a char

Callers

nothing calls this directly

Calls 2

checkequalMethod · 0.95
checkraisesMethod · 0.95

Tested by

no test coverage detected