compat.py
Go to the documentation of this file.
00001 # -*- coding: utf-8 -*-
00002 
00003 try:
00004     # py < 2.7
00005     import unittest2 as unittest
00006 except ImportError:
00007     import unittest  # noqa
00008 
00009 try:
00010     unicode()
00011 except NameError:
00012     b = bytes
00013 
00014     def u(value):
00015         if isinstance(value, bytes):
00016             return value.decode('utf-8')
00017         return value
00018 else:
00019     def b(value):
00020         return str(value)
00021 
00022     def u(value):
00023         if isinstance(value, unicode):
00024             return value
00025         return unicode(value, 'utf-8')


webtest
Author(s): AlexV
autogenerated on Sat Mar 25 2017 03:32:05