Reproduced on 1.7.0 and 5f9b88a65a8c1e506885352bbd9b2a47900f5014, using Python 3.11.1. The test passes with termcolor < 2.1 but fails with 2.1.0 and 2.1.1.
________________________________________________________ test_pretty_formatter ________________________________________________________
def test_pretty_formatter():
f = cmdline.PrettyFormatter()
f.title('A Title')
f.hr()
f.p('A Paragraph', 'red')
> assert f.buffer == [
'\x1b[1m\x1b[34m A Title\x1b[0m',
'\x1b[1m\x1b[34m--------------------------------------------------------------------------------\x1b[0m',
'\x1b[31mA Paragraph\x1b[0m'
]
E AssertionError: assert [' A Title', '--------------------------------------------------------------------------------', 'A Paragraph'] == ['\x1b[1m\x1b[34m A Title\x1b[0m', '\x1b[1m\x1b[34m--------------------------------------------------------------------------------\x1b[0m', '\x1b[31mA Paragraph\x1b[0m']
E At index 0 diff: ' A Title' != '\x1b[1m\x1b[34m A Title\x1b[0m'
E Full diff:
E [
E - '\x1b[1m\x1b[34m A Title\x1b[0m',
E + ' A Title',
E - '\x1b[1m\x1b[34m--------------------------------------------------------------------------------\x1b[0m',
E ? --------------- -------
E + '--------------------------------------------------------------------------------',
E - '\x1b[31mA Paragraph\x1b[0m',
E + 'A Paragraph',
E ]
/tmp/pytest-plugins/pytest-shutil/tests/unit/test_cmdline.py:18: AssertionError
Reproduced on 1.7.0 and 5f9b88a65a8c1e506885352bbd9b2a47900f5014, using Python 3.11.1. The test passes with
termcolor < 2.1
but fails with 2.1.0 and 2.1.1.