test/unittest_entity.py
changeset 4023 eae23c40627a
parent 4015 4f8235204dda
child 4031 56f4d4f7f86f
equal deleted inserted replaced
4022:934e758a73ef 4023:eae23c40627a
     9 
     9 
    10 from datetime import datetime
    10 from datetime import datetime
    11 
    11 
    12 from cubicweb import Binary, Unauthorized
    12 from cubicweb import Binary, Unauthorized
    13 from cubicweb.devtools.testlib import CubicWebTC
    13 from cubicweb.devtools.testlib import CubicWebTC
    14 from cubicweb.common.mttransforms import HAS_TAL
    14 from cubicweb.mttransforms import HAS_TAL
    15 from cubicweb.entities import fetch_config
    15 from cubicweb.entities import fetch_config
    16 
    16 
    17 class EntityTC(CubicWebTC):
    17 class EntityTC(CubicWebTC):
    18 
    18 
    19     def test_boolean_value(self):
    19     def test_boolean_value(self):
   325 
   325 
   326 
   326 
   327     def test_printable_value_bytes(self):
   327     def test_printable_value_bytes(self):
   328         e = self.add_entity('File', data=Binary('lambda x: 1'), data_format=u'text/x-python',
   328         e = self.add_entity('File', data=Binary('lambda x: 1'), data_format=u'text/x-python',
   329                             data_encoding=u'ascii', data_name=u'toto.py')
   329                             data_encoding=u'ascii', data_name=u'toto.py')
   330         from cubicweb.common import mttransforms
   330         from cubicweb import mttransforms
   331         if mttransforms.HAS_PYGMENTS_TRANSFORMS:
   331         if mttransforms.HAS_PYGMENTS_TRANSFORMS:
   332             self.assertEquals(e.printable_value('data'),
   332             self.assertEquals(e.printable_value('data'),
   333                               '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mi">1</span>
   333                               '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mi">1</span>
   334 </pre></div>
   334 </pre></div>
   335 ''')
   335 ''')