def test_pprint_styles(): with pytest.raises(ValueError): Style.from_style_content('mono color full') with pytest.raises(ValueError): Style.from_style_content('full specs') with mock.patch('sys.stdout') as stdout: s = '{0:full}'.format(pi_info('900092')) assert '\x1b[0m' not in s # ensure default is mono when stdout is not a tty with pytest.raises(ValueError): '{0:foo on bar}'.format(Style())
def test_pprint_styles(): with pytest.raises(ValueError): Style.from_style_content('mono color full') with pytest.raises(ValueError): Style.from_style_content('full specs') with patch('sys.stdout') as stdout: s = '{0:full}'.format(pi_info('900092')) assert '\x1b[0m' not in s # ensure default is mono when stdout is not a tty with pytest.raises(ValueError): '{0:foo on bar}'.format(Style())