Hello community,

here is the log from the commit of package python-pygments-ansi-color for 
openSUSE:Factory checked in at 2019-09-23 12:02:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pygments-ansi-color (Old)
 and      /work/SRC/openSUSE:Factory/.python-pygments-ansi-color.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pygments-ansi-color"

Mon Sep 23 12:02:51 2019 rev:2 rq:729487 version:0.0.3

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-pygments-ansi-color/python-pygments-ansi-color.changes
    2019-02-17 12:21:03.476205232 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-pygments-ansi-color.new.7948/python-pygments-ansi-color.changes
  2019-09-23 12:02:53.889950072 +0200
@@ -1,0 +2,6 @@
+Mon Sep  9 14:14:19 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.0.3:
+  * minor color tweaks
+
+-------------------------------------------------------------------

Old:
----
  v0.0.2.tar.gz

New:
----
  v0.0.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pygments-ansi-color.spec ++++++
--- /var/tmp/diff_new_pack.aKpwXQ/_old  2019-09-23 12:02:55.645949782 +0200
+++ /var/tmp/diff_new_pack.aKpwXQ/_new  2019-09-23 12:02:55.649949781 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pygments-ansi-color
-Version:        0.0.2
+Version:        0.0.3
 Release:        0
 Summary:        ANSI color-code highlighting for Pygments
 License:        Apache-2.0

++++++ v0.0.2.tar.gz -> v0.0.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygments-ansi-color-0.0.2/README.md 
new/pygments-ansi-color-0.0.3/README.md
--- old/pygments-ansi-color-0.0.2/README.md     2018-02-01 20:04:03.000000000 
+0100
+++ new/pygments-ansi-color-0.0.3/README.md     2019-07-24 23:23:57.000000000 
+0200
@@ -48,11 +48,11 @@
 
    ```python
    import pygments
-   import pygments.formatter
+   import pygments.formatters
    import pygments.lexers
 
    lexer = pygments.lexers.get_lexer_by_name('ansi-color')
-   formatter = pygments.formatter.HtmlFormatter(style=MyStyle)
+   formatter = pygments.formatters.HtmlFormatter(style=MyStyle)
    print(pygments.highlight('your text', lexer, formatter))
    ```
 
@@ -65,4 +65,60 @@
 The colors are defined as part of your Pygments style and can be changed.
 
 
+### Optional: Enable "256 color" support
+
+This library supports rendering terminal output using [256 color
+(8-bit)][256-color] ANSI color codes. However, because of limitations in
+Pygments tokens, this is an opt-in feature which requires patching the
+formatter you're using.
+
+The reason this requires patching the Pygments formatter is that Pygments does
+not support multiple tokens on a single piece of text, requiring us to
+"compose" a single state (which is a tuple of `(bold enabled, fg color, bg
+color)`) into a single token like `Color.Bold.FGColor.BGColor`. We then need to
+output the styles for this token in the CSS.
+
+In the default mode where we only support the standard 8 colors (plus 1 for no
+color), we need 2 × 9 × 9 - 1 = 161 tokens, which is reasonable to contain in
+one CSS file. With 256 colors (plus the standard 8, plus 1 for no color),
+though, we'd need 2 × 265 × 265 - 1 = 140,449 tokens defined in CSS. This makes
+the CSS too large to be practical.
+
+To make 256-color support realistic, we patch Pygments' HTML formatter so that
+it places a class for each part of the state tuple independently. This means
+you need only 1 + 265 + 265 = 531 CSS classes to support all possibilities.
+
+If you'd like to enable 256-color support, you'll need to do two things:
+
+1. When calling `color_tokens`, pass `enable_256color=True`:
+
+   ```python
+   styles.update(color_tokens(fg_colors, bg_colors, enable_256color=True))
+   ```
+
+   This change is what causes your CSS to have the appropriate classes in it.
+
+2. When constructing your formatter, use the `ExtendedColorHtmlFormatterMixin`
+   mixin, like this:
+
+   ```python
+   from pygments.formatters import HtmlFormatter
+   from pygments_ansi_color import ExtendedColorHtmlFormatterMixin
+
+   ...
+
+   class MyFormatter(ExtendedColorHtmlFormatterMixin, HtmlFormatter):
+       pass
+
+   ...
+
+   formatter = pygments.formatter.HtmlFormatter(style=MyStyle)
+   ```
+
+   This change is what causes the rendered HTML to have the right class names.
+
+Once these two changes have been made, you can use pygments-ansi-color as 
normal.
+
+
 [fluffy-example]: https://i.fluffy.cc/zr9RVt0gcrVtKH06hkqRCJPP1S91z3Mz.html
+[256-color]: https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygments-ansi-color-0.0.2/pygments_ansi_color.py 
new/pygments-ansi-color-0.0.3/pygments_ansi_color.py
--- old/pygments-ansi-color-0.0.2/pygments_ansi_color.py        2018-02-01 
20:04:03.000000000 +0100
+++ new/pygments-ansi-color-0.0.3/pygments_ansi_color.py        2019-07-24 
23:23:57.000000000 +0200
@@ -10,8 +10,10 @@
 import pygments.token
 
 
+C = pygments.token.Token.C
 Color = pygments.token.Token.Color
 
+
 _ansi_code_to_color = {
     0: 'Black',
     1: 'Red',
@@ -23,31 +25,293 @@
     7: 'White',
 }
 
+_256_colors = {
+    0: '#000000',
+    1: '#800000',
+    2: '#008000',
+    3: '#808000',
+    4: '#000080',
+    5: '#800080',
+    6: '#008080',
+    7: '#c0c0c0',
+    8: '#808080',
+    9: '#ff0000',
+    10: '#00ff00',
+    11: '#ffff00',
+    12: '#0000ff',
+    13: '#ff00ff',
+    14: '#00ffff',
+    15: '#ffffff',
+    16: '#000000',
+    17: '#00005f',
+    18: '#000087',
+    19: '#0000af',
+    20: '#0000d7',
+    21: '#0000ff',
+    22: '#005f00',
+    23: '#005f5f',
+    24: '#005f87',
+    25: '#005faf',
+    26: '#005fd7',
+    27: '#005fff',
+    28: '#008700',
+    29: '#00875f',
+    30: '#008787',
+    31: '#0087af',
+    32: '#0087d7',
+    33: '#0087ff',
+    34: '#00af00',
+    35: '#00af5f',
+    36: '#00af87',
+    37: '#00afaf',
+    38: '#00afd7',
+    39: '#00afff',
+    40: '#00d700',
+    41: '#00d75f',
+    42: '#00d787',
+    43: '#00d7af',
+    44: '#00d7d7',
+    45: '#00d7ff',
+    46: '#00ff00',
+    47: '#00ff5f',
+    48: '#00ff87',
+    49: '#00ffaf',
+    50: '#00ffd7',
+    51: '#00ffff',
+    52: '#5f0000',
+    53: '#5f005f',
+    54: '#5f0087',
+    55: '#5f00af',
+    56: '#5f00d7',
+    57: '#5f00ff',
+    58: '#5f5f00',
+    59: '#5f5f5f',
+    60: '#5f5f87',
+    61: '#5f5faf',
+    62: '#5f5fd7',
+    63: '#5f5fff',
+    64: '#5f8700',
+    65: '#5f875f',
+    66: '#5f8787',
+    67: '#5f87af',
+    68: '#5f87d7',
+    69: '#5f87ff',
+    70: '#5faf00',
+    71: '#5faf5f',
+    72: '#5faf87',
+    73: '#5fafaf',
+    74: '#5fafd7',
+    75: '#5fafff',
+    76: '#5fd700',
+    77: '#5fd75f',
+    78: '#5fd787',
+    79: '#5fd7af',
+    80: '#5fd7d7',
+    81: '#5fd7ff',
+    82: '#5fff00',
+    83: '#5fff5f',
+    84: '#5fff87',
+    85: '#5fffaf',
+    86: '#5fffd7',
+    87: '#5fffff',
+    88: '#870000',
+    89: '#87005f',
+    90: '#870087',
+    91: '#8700af',
+    92: '#8700d7',
+    93: '#8700ff',
+    94: '#875f00',
+    95: '#875f5f',
+    96: '#875f87',
+    97: '#875faf',
+    98: '#875fd7',
+    99: '#875fff',
+    100: '#878700',
+    101: '#87875f',
+    102: '#878787',
+    103: '#8787af',
+    104: '#8787d7',
+    105: '#8787ff',
+    106: '#87af00',
+    107: '#87af5f',
+    108: '#87af87',
+    109: '#87afaf',
+    110: '#87afd7',
+    111: '#87afff',
+    112: '#87d700',
+    113: '#87d75f',
+    114: '#87d787',
+    115: '#87d7af',
+    116: '#87d7d7',
+    117: '#87d7ff',
+    118: '#87ff00',
+    119: '#87ff5f',
+    120: '#87ff87',
+    121: '#87ffaf',
+    122: '#87ffd7',
+    123: '#87ffff',
+    124: '#af0000',
+    125: '#af005f',
+    126: '#af0087',
+    127: '#af00af',
+    128: '#af00d7',
+    129: '#af00ff',
+    130: '#af5f00',
+    131: '#af5f5f',
+    132: '#af5f87',
+    133: '#af5faf',
+    134: '#af5fd7',
+    135: '#af5fff',
+    136: '#af8700',
+    137: '#af875f',
+    138: '#af8787',
+    139: '#af87af',
+    140: '#af87d7',
+    141: '#af87ff',
+    142: '#afaf00',
+    143: '#afaf5f',
+    144: '#afaf87',
+    145: '#afafaf',
+    146: '#afafd7',
+    147: '#afafff',
+    148: '#afd700',
+    149: '#afd75f',
+    150: '#afd787',
+    151: '#afd7af',
+    152: '#afd7d7',
+    153: '#afd7ff',
+    154: '#afff00',
+    155: '#afff5f',
+    156: '#afff87',
+    157: '#afffaf',
+    158: '#afffd7',
+    159: '#afffff',
+    160: '#d70000',
+    161: '#d7005f',
+    162: '#d70087',
+    163: '#d700af',
+    164: '#d700d7',
+    165: '#d700ff',
+    166: '#d75f00',
+    167: '#d75f5f',
+    168: '#d75f87',
+    169: '#d75faf',
+    170: '#d75fd7',
+    171: '#d75fff',
+    172: '#d78700',
+    173: '#d7875f',
+    174: '#d78787',
+    175: '#d787af',
+    176: '#d787d7',
+    177: '#d787ff',
+    178: '#d7af00',
+    179: '#d7af5f',
+    180: '#d7af87',
+    181: '#d7afaf',
+    182: '#d7afd7',
+    183: '#d7afff',
+    184: '#d7d700',
+    185: '#d7d75f',
+    186: '#d7d787',
+    187: '#d7d7af',
+    188: '#d7d7d7',
+    189: '#d7d7ff',
+    190: '#d7ff00',
+    191: '#d7ff5f',
+    192: '#d7ff87',
+    193: '#d7ffaf',
+    194: '#d7ffd7',
+    195: '#d7ffff',
+    196: '#ff0000',
+    197: '#ff005f',
+    198: '#ff0087',
+    199: '#ff00af',
+    200: '#ff00d7',
+    201: '#ff00ff',
+    202: '#ff5f00',
+    203: '#ff5f5f',
+    204: '#ff5f87',
+    205: '#ff5faf',
+    206: '#ff5fd7',
+    207: '#ff5fff',
+    208: '#ff8700',
+    209: '#ff875f',
+    210: '#ff8787',
+    211: '#ff87af',
+    212: '#ff87d7',
+    213: '#ff87ff',
+    214: '#ffaf00',
+    215: '#ffaf5f',
+    216: '#ffaf87',
+    217: '#ffafaf',
+    218: '#ffafd7',
+    219: '#ffafff',
+    220: '#ffd700',
+    221: '#ffd75f',
+    222: '#ffd787',
+    223: '#ffd7af',
+    224: '#ffd7d7',
+    225: '#ffd7ff',
+    226: '#ffff00',
+    227: '#ffff5f',
+    228: '#ffff87',
+    229: '#ffffaf',
+    230: '#ffffd7',
+    231: '#ffffff',
+    232: '#080808',
+    233: '#121212',
+    234: '#1c1c1c',
+    235: '#262626',
+    236: '#303030',
+    237: '#3a3a3a',
+    238: '#444444',
+    239: '#4e4e4e',
+    240: '#585858',
+    241: '#626262',
+    242: '#6c6c6c',
+    243: '#767676',
+    244: '#808080',
+    245: '#8a8a8a',
+    246: '#949494',
+    247: '#9e9e9e',
+    248: '#a8a8a8',
+    249: '#b2b2b2',
+    250: '#bcbcbc',
+    251: '#c6c6c6',
+    252: '#d0d0d0',
+    253: '#dadada',
+    254: '#e4e4e4',
+    255: '#eeeeee',
+}
+
 
 def _token_from_lexer_state(bold, fg_color, bg_color):
     """Construct a token given the current lexer state.
 
     We can only emit one token even though we have a multiple-tuple state.
-    To do work around this, we construct tokens like "BoldRed".
+    To do work around this, we construct tokens like "Bold.Red".
     """
-    token_name = ''
+    components = ()
 
     if bold:
-        token_name += 'Bold'
+        components += ('Bold',)
 
     if fg_color:
-        token_name += fg_color
+        components += (fg_color,)
 
     if bg_color:
-        token_name += 'BG' + bg_color
+        components += ('BG' + bg_color,)
 
-    if token_name == '':
+    if len(components) == 0:
         return pygments.token.Text
     else:
-        return getattr(Color, token_name)
+        token = Color
+        for component in components:
+            token = getattr(token, component)
+        return token
 
 
-def color_tokens(fg_colors, bg_colors):
+def color_tokens(fg_colors, bg_colors, enable_256color=False):
     """Return color tokens for a given set of colors.
 
     Pygments doesn't have a generic "color" token; instead everything is
@@ -55,12 +319,19 @@
     where the colors actually *are* what we care about.
 
     This function will register combinations of tokens (things like "Red" or
-    "BoldRedBGGreen") based on the colors passed in.
+    "Bold.Red.BGGreen") based on the colors passed in.
 
     You can also define the tokens yourself, but note that the token names are
     *not* currently guaranteed to be stable between releases as I'm not really
     happy with this approach.
 
+    Optionally, you can enable 256-color support by passing
+    `enable_256color=True`. This will (very slightly) increase the CSS size,
+    but enable the use of 256-color in text. The reason this is optional and
+    non-default is that it requires patching the Pygments formatter you're
+    using, using the ExtendedColorHtmlFormatterMixin provided by this file.
+    For more details on why and how, see the README.
+
     Usage:
 
         fg_colors = bg_colors = {
@@ -79,21 +350,33 @@
     """
     styles = {}
 
-    for bold, fg_color, bg_color in itertools.product(
-            (False, True),
-            {None} | set(fg_colors),
-            {None} | set(bg_colors),
-    ):
-        token = _token_from_lexer_state(bold, fg_color, bg_color)
-        if token is not pygments.token.Text:
-            value = []
-            if bold:
-                value.append('bold')
-            if fg_color:
-                value.append(fg_colors[fg_color])
-            if bg_color:
-                value.append('bg:' + bg_colors[bg_color])
-            styles[token] = ' '.join(value)
+    if enable_256color:
+        styles[pygments.token.Token.C.Bold] = 'bold'
+        for i, color in _256_colors.items():
+            styles[getattr(pygments.token.Token.C, 'C{}'.format(i))] = color
+            styles[getattr(pygments.token.Token.C, 'BGC{}'.format(i))] = 
'bg:{}'.format(color)
+
+        for color, value in fg_colors.items():
+            styles[getattr(C, color)] = value
+
+        for color, value in bg_colors.items():
+            styles[getattr(C, 'BG{}'.format(color))] = 'bg:{}'.format(value)
+    else:
+        for bold, fg_color, bg_color in itertools.product(
+                (False, True),
+                {None} | set(fg_colors),
+                {None} | set(bg_colors),
+        ):
+            token = _token_from_lexer_state(bold, fg_color, bg_color)
+            if token is not pygments.token.Text:
+                value = []
+                if bold:
+                    value.append('bold')
+                if fg_color:
+                    value.append(fg_colors[fg_color])
+                if bg_color:
+                    value.append('bg:' + bg_colors[bg_color])
+                styles[token] = ' '.join(value)
 
     return styles
 
@@ -147,37 +430,51 @@
             text = after_escape
         else:
             value, code, text = parsed.groups()
-
             if code == 'm':  # "m" is "Set Graphics Mode"
                 # Special case \x1b[m is a reset code
                 if value == '':
                     self.reset_state()
                 else:
-                    values = value.split(';')
-                    for value in values:
-                        try:
-                            value = int(value)
-                        except ValueError:
-                            # Shouldn't ever happen, but could with invalid
-                            # ANSI.
-                            continue
-                        else:
-                            fg_color = _ansi_code_to_color.get(value - 30)
-                            bg_color = _ansi_code_to_color.get(value - 40)
-                            if fg_color:
-                                self.fg_color = fg_color
-                            elif bg_color:
-                                self.bg_color = bg_color
-                            elif value == 1:
-                                self.bold = True
-                            elif value == 22:
-                                self.bold = False
-                            elif value == 39:
-                                self.fg_color = None
-                            elif value == 49:
-                                self.bg_color = None
-                            elif value == 0:
-                                self.reset_state()
+                    try:
+                        values = [int(v) for v in value.split(';')]
+                    except ValueError:
+                        # Shouldn't ever happen, but could with invalid ANSI.
+                        values = []
+
+                    while len(values) > 0:
+                        value = values.pop(0)
+                        fg_color = _ansi_code_to_color.get(value - 30)
+                        bg_color = _ansi_code_to_color.get(value - 40)
+                        if fg_color:
+                            self.fg_color = fg_color
+                        elif bg_color:
+                            self.bg_color = bg_color
+                        elif value == 1:
+                            self.bold = True
+                        elif value == 22:
+                            self.bold = False
+                        elif value == 39:
+                            self.fg_color = None
+                        elif value == 49:
+                            self.bg_color = None
+                        elif value == 0:
+                            self.reset_state()
+                        elif value in (38, 48):
+                            try:
+                                five = values.pop(0)
+                                color = values.pop(0)
+                            except IndexError:
+                                continue
+                            else:
+                                if five != 5:
+                                    continue
+                                if not 0 <= color <= 255:
+                                    continue
+                                color = 'C{}'.format(color)
+                                if value == 38:
+                                    self.fg_color = color
+                                else:
+                                    self.bg_color = color
 
         yield match.start(), self.current_token, text
 
@@ -188,3 +485,15 @@
             (r'[^\x1b]+', pygments.token.Text),
         ],
     }
+
+
+class ExtendedColorHtmlFormatterMixin(object):
+
+    def _get_css_classes(self, token):
+        classes = super(ExtendedColorHtmlFormatterMixin, 
self)._get_css_classes(token)
+        if token[0] == 'Color':
+            classes += ' ' + ' '.join(
+                self._get_css_class(getattr(C, part))
+                for part in token[1:]
+            )
+        return classes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygments-ansi-color-0.0.2/setup.py 
new/pygments-ansi-color-0.0.3/setup.py
--- old/pygments-ansi-color-0.0.2/setup.py      2018-02-01 20:04:03.000000000 
+0100
+++ new/pygments-ansi-color-0.0.3/setup.py      2019-07-24 23:23:57.000000000 
+0200
@@ -7,7 +7,7 @@
 
 setup(
     name='pygments-ansi-color',
-    version='0.0.2',
+    version='0.0.3',
     classifiers=[
         'License :: OSI Approved :: Apache Software License',
         'Programming Language :: Python :: 2',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pygments-ansi-color-0.0.2/tests/pygments_ansi_color_test.py 
new/pygments-ansi-color-0.0.3/tests/pygments_ansi_color_test.py
--- old/pygments-ansi-color-0.0.2/tests/pygments_ansi_color_test.py     
2018-02-01 20:04:03.000000000 +0100
+++ new/pygments-ansi-color-0.0.3/tests/pygments_ansi_color_test.py     
2019-07-24 23:23:57.000000000 +0200
@@ -2,10 +2,15 @@
 from __future__ import absolute_import
 from __future__ import unicode_literals
 
+import itertools
+
 import pytest
+from pygments.formatters import HtmlFormatter
 from pygments.token import Text
+from pygments.token import Token
 
 import pygments_ansi_color as main
+from pygments_ansi_color import C
 from pygments_ansi_color import Color
 
 
@@ -14,8 +19,8 @@
     (
         (False, False, False, Text),
         (True, False, False, Color.Bold),
-        (True, 'Red', False, Color.BoldRed),
-        (True, 'Red', 'Blue', Color.BoldRedBGBlue),
+        (True, 'Red', False, Color.Bold.Red),
+        (True, 'Red', 'Blue', Color.Bold.Red.BGBlue),
     ),
 )
 def test_token_from_lexer_state(bold, fg_color, bg_color, expected):
@@ -23,23 +28,39 @@
 
 
 def test_color_tokens():
-    fg_colors = {
-        'Red': '#ff0000',
-    }
-    bg_colors = {
-        'Green': '#00ff00',
-    }
+    fg_colors = {'Red': '#ff0000'}
+    bg_colors = {'Green': '#00ff00'}
     assert main.color_tokens(fg_colors, bg_colors) == {
         Color.BGGreen: 'bg:#00ff00',
         Color.Bold: 'bold',
-        Color.BoldBGGreen: 'bold bg:#00ff00',
-        Color.BoldRed: 'bold #ff0000',
-        Color.BoldRedBGGreen: 'bold #ff0000 bg:#00ff00',
+        Color.Bold.BGGreen: 'bold bg:#00ff00',
+        Color.Bold.Red: 'bold #ff0000',
+        Color.Bold.Red.BGGreen: 'bold #ff0000 bg:#00ff00',
         Color.Red: '#ff0000',
-        Color.RedBGGreen: '#ff0000 bg:#00ff00',
+        Color.Red.BGGreen: '#ff0000 bg:#00ff00',
     }
 
 
+def test_color_tokens_256color():
+    fg_colors = {'Red': '#ff0000'}
+    bg_colors = {'Green': '#00ff00'}
+
+    expected = dict(itertools.chain.from_iterable(
+        (
+            (getattr(C, 'C{}'.format(i)), value),
+            (getattr(C, 'BGC{}'.format(i)), 'bg:{}'.format(value)),
+        )
+        for i, value in main._256_colors.items()
+    ))
+    expected.update({
+        C.Red: '#ff0000',
+        C.BGGreen: 'bg:#00ff00',
+        C.Bold: 'bold',
+    })
+    assert main.color_tokens(fg_colors, bg_colors,
+                             enable_256color=True) == expected
+
+
 def _highlight(text):
     return tuple(main.AnsiColorLexer().get_tokens(text))
 
@@ -64,16 +85,54 @@
     ) == (
         (Text, 'plain text\n'),
         (Color.Red, 'red text\n'),
-        (Color.BoldGreen, 'bold green text\n'),
+        (Color.Bold.Green, 'bold green text\n'),
         (Color.Bold, 'fg color turned off\n'),
         (Text, 'plain text after reset\n'),
         (Color.Bold, 'bold text\n'),
-        (Color.BoldBGYellow, 'bold from previous line with yellow bg\n'),
+        (Color.Bold.BGYellow, 'bold from previous line with yellow bg\n'),
         (Color.Bold, 'bg color turned off\n'),
         (Text, 'bold turned off\n'),
     )
 
 
+def test_256_colors():
+    assert _highlight(
+        'plain text\n'
+        '\x1b[38;5;15mcolor 15\n'
+        '\x1b[1mbold color 15\n'
+        '\x1b[48;5;8mbold color 15 with color 8 bg\n'
+        '\x1b[38;5;11;22mnot bold color 11 with color 8 bg\n'
+        '\x1b[0mplain text after reset\n'
+    ) == (
+        (Text, 'plain text\n'),
+        (Color.C15, 'color 15\n'),
+        (Color.Bold.C15, 'bold color 15\n'),
+        (Color.Bold.C15.BGC8, 'bold color 15 with color 8 bg\n'),
+        (Color.C11.BGC8, 'not bold color 11 with color 8 bg\n'),
+        (Text, 'plain text after reset\n'),
+    )
+
+
+def test_256_colors_invalid_escapes():
+    assert _highlight(
+        'plain text\n'
+        # second value is "4" instead of expected "5"
+        '\x1b[38;4;15mA\n'
+        # too few values
+        '\x1b[38;15mB\n'
+        # invalid values (not integers)
+        '\x1b[38;4=;15mC\n'
+        # invalid values (color larger than 255)
+        '\x1b[38;5;937mD\n'
+    ) == (
+        (Text, 'plain text\n'),
+        (Text, 'A\n'),
+        (Text, 'B\n'),
+        (Text, 'C\n'),
+        (Text, 'D\n'),
+    )
+
+
 def test_highlight_empty_end_specifier():
     ret = _highlight('plain\x1b[31mred\x1b[mplain\n')
     assert ret == ((Text, 'plain'), (Color.Red, 'red'), (Text, 'plain\n'))
@@ -123,3 +182,39 @@
         (Text, 'plain '),
         (Text, '%text\n'),
     )
+
+
[email protected]
+def test_formatter():
+    class TestFormatter(main.ExtendedColorHtmlFormatterMixin, HtmlFormatter):
+        pass
+    return TestFormatter()
+
+
[email protected](
+    ('token', 'expected_classes'),
+    (
+        # Standard Pygments tokens shouldn't be changed.
+        (Text, ''),
+        (Token.Comment, 'c'),
+        (Token.Comment.Multi, 'c c-Multi'),
+        (Token.Operator, 'o'),
+
+        # Non-standard (but non-Color) Pygments tokens also shouldn't be 
changed.
+        (Token.Foo, ' -Foo'),
+        (Token.Foo.Bar.Baz, ' -Foo -Foo-Bar -Foo-Bar-Baz'),
+
+        # Color tokens should be split out into multiple, non-nested classes 
prefixed with "C".
+        (Token.Color.Bold, ' -Color -Color-Bold -C-Bold'),
+        (Token.Color.Red, ' -Color -Color-Red -C-Red'),
+        (Token.Color.Bold.Red, ' -Color -Color-Bold -Color-Bold-Red -C-Bold 
-C-Red'),
+        (
+            Token.Color.Bold.Red.BGGreen,
+            ' -Color -Color-Bold -Color-Bold-Red -Color-Bold-Red-BGGreen 
-C-Bold -C-Red -C-BGGreen',
+        ),
+        (Token.Color.C5, ' -Color -Color-C5 -C-C5'),
+        (Token.Color.C5.BGC18, ' -Color -Color-C5 -Color-C5-BGC18 -C-C5 
-C-BGC18'),
+    ),
+)
+def test_formatter_mixin_get_css_classes(test_formatter, token, 
expected_classes):
+    assert test_formatter._get_css_classes(token) == expected_classes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygments-ansi-color-0.0.2/tox.ini 
new/pygments-ansi-color-0.0.3/tox.ini
--- old/pygments-ansi-color-0.0.2/tox.ini       2018-02-01 20:04:03.000000000 
+0100
+++ new/pygments-ansi-color-0.0.3/tox.ini       2019-07-24 23:23:57.000000000 
+0200
@@ -17,3 +17,10 @@
 basepython = /usr/bin/python3.6
 envdir = venv
 commands =
+
+[flake8]
+max-line-length = 119
+
+[pep8]
+# autopep8 will rewrite lines to be shorter, even though we raised the length
+ignore = E501


Reply via email to