##// END OF EJS Templates
Fix/mpl integration (#14128)...
Fix/mpl integration (#14128) - Closes https://github.com/matplotlib/matplotlib/issues/17454 - fixes qt5/qt6 confusion

File last commit:

r28326:1098b2c1
r28375:175d52c8 merge
Show More
test_pycolorize.py
70 lines | 1.7 KiB | text/x-python | PythonLexer
Matthias Bussonnier
Test more edge cases of the highlighting parser
r21801 # coding: utf-8
MinRK
always use StringIO, never cStringIO...
r4794 """Test suite for our color utilities.
Authors
-------
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.txt, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# our own
Lysandros Nikolaou
Fix issues due to breaking tokenize changes in 3.12
r28326 import sys
MinRK
always use StringIO, never cStringIO...
r4794 from IPython.utils.PyColorize import Parser
Matthias Bussonnier
Test more edge cases of the highlighting parser
r21801 import io
Matthias Bussonnier
Remove yield test that are not support by pytest anymore...
r26183 import pytest
@pytest.fixture(scope="module", params=("Linux", "NoColor", "LightBG", "Neutral"))
def style(request):
yield request.param
MinRK
always use StringIO, never cStringIO...
r4794
#-----------------------------------------------------------------------------
# Test functions
#-----------------------------------------------------------------------------
Matthias Bussonnier
Remove yield test that are not support by pytest anymore...
r26183 sample = """
Matthias Bussonnier
Test more edge cases of the highlighting parser
r21801 def function(arg, *args, kwarg=True, **kwargs):
'''
this is docs
'''
pass is True
False == None
MinRK
always use StringIO, never cStringIO...
r4794
gousaiyang
Fix EncodingWarning on Python 3.10
r27494 with io.open(ru'unicode', encoding='utf-8'):
Lysandros Nikolaou
Fix issues due to breaking tokenize changes in 3.12
r28326 raise ValueError("escape \r sequence")
Matthias Bussonnier
Test more edge cases of the highlighting parser
r21801
print("wěird ünicoðe")
class Bar(Super):
def __init__(self):
super(Bar, self).__init__(1**2, 3^4, 5 or 6)
"""
Matthias Bussonnier
Remove yield test that are not support by pytest anymore...
r26183 def test_parse_sample(style):
"""and test writing to a buffer"""
buf = io.StringIO()
p = Parser(style=style)
p.format(sample, buf)
buf.seek(0)
f1 = buf.read()
Matthias Bussonnier
Test more edge cases of the highlighting parser
r21801
Samuel Gaist
[utils][tests][pycolorize] Remove nose
r26925 assert "ERROR" not in f1
Matthias Bussonnier
Test more edge cases of the highlighting parser
r21801
Matthias Bussonnier
Remove yield test that are not support by pytest anymore...
r26183 def test_parse_error(style):
p = Parser(style=style)
Lysandros Nikolaou
Fix issues due to breaking tokenize changes in 3.12
r28326 f1 = p.format(r"\ " if sys.version_info >= (3, 12) else ")", "str")
Matthias Bussonnier
Remove yield test that are not support by pytest anymore...
r26183 if style != "NoColor":
Samuel Gaist
[utils][tests][pycolorize] Remove nose
r26925 assert "ERROR" in f1