cubicweb/test/unittest_utils.py
changeset 12567 26744ad37953
parent 12308 cbbcfa69a0e7
child 12573 9b883489279f
equal deleted inserted replaced
12566:6b3523f81f42 12567:26744ad37953
    20 import base64
    20 import base64
    21 import datetime
    21 import datetime
    22 import decimal
    22 import decimal
    23 import doctest
    23 import doctest
    24 import re
    24 import re
    25 try:
    25 from unittest import TestCase
    26     from unittest2 import TestCase
       
    27 except ImportError:  # Python3
       
    28     from unittest import TestCase
       
    29 
       
    30 from six import PY2
       
    31 from six.moves import range
       
    32 
    26 
    33 from cubicweb import Binary, Unauthorized
    27 from cubicweb import Binary, Unauthorized
    34 from cubicweb.devtools.testlib import CubicWebTC
    28 from cubicweb.devtools.testlib import CubicWebTC
    35 from cubicweb.utils import (make_uid, UStringIO, RepeatList, HTMLHead,
    29 from cubicweb.utils import (make_uid, UStringIO, RepeatList, HTMLHead,
    36                             QueryCache)
    30                             QueryCache)
   417                          'a b c')
   411                          'a b c')
   418 
   412 
   419     def test_str(self):
   413     def test_str(self):
   420         self._test(str)
   414         self._test(str)
   421 
   415 
   422     if PY2:
       
   423         def test_unicode(self):
       
   424             self._test(unicode)
       
   425 
   416 
   426 
   417 
   427 def load_tests(loader, tests, ignore):
   418 def load_tests(loader, tests, ignore):
   428     import cubicweb.utils
   419     import cubicweb.utils
   429     tests.addTests(doctest.DocTestSuite(cubicweb.utils))
   420     tests.addTests(doctest.DocTestSuite(cubicweb.utils))