[test] fix test_printable_value_bytes with current pygments
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 16 Mar 2016 00:42:40 +0100
changeset 11196 74b04a88d28a
parent 11195 5de859b95988
child 11197 9f1c89e7426d
[test] fix test_printable_value_bytes with current pygments An empty span was added in https://bitbucket.org/birkenfeld/pygments-main/commits/164574c13533195a555181a2b9c685fea2470403
cubicweb/test/unittest_entity.py
--- a/cubicweb/test/unittest_entity.py	Thu Jun 12 15:54:44 2014 +0200
+++ b/cubicweb/test/unittest_entity.py	Wed Mar 16 00:42:40 2016 +0100
@@ -640,14 +640,18 @@
             from cubicweb import mttransforms
             if mttransforms.HAS_PYGMENTS_TRANSFORMS:
                 import pygments
+                if tuple(int(i) for i in pygments.__version__.split('.')[:3]) >= (2, 1, 1):
+                    span = '<span/>'
+                else:
+                    span = ''
                 if tuple(int(i) for i in pygments.__version__.split('.')[:2]) >= (1, 3):
-                    self.assertEqual(e.printable_value('data'),
-                                      '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mi">1</span>
-</pre></div>''')
+                    mi = 'mi'
                 else:
-                    self.assertEqual(e.printable_value('data'),
-                                      '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mf">1</span>
-</pre></div>''')
+                    mi = 'mf'
+
+                self.assertEqual(e.printable_value('data'),
+                                 '''<div class="highlight"><pre>%s<span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="%s">1</span>
+</pre></div>''' % (span, mi))
             else:
                 self.assertEqual(e.printable_value('data'),
                                   '''<pre class="python">