diff options
| author | Benjamin Peterson <benjamin@python.org> | 2009-11-29 16:57:42 -0600 |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2009-11-29 16:57:42 -0600 |
| commit | 4d2c8dffadf46cec0babfacec992b2546f7a1016 (patch) | |
| tree | b1425572904f105d814cdc93196f090934899204 /testtools/utils.py | |
| parent | 2745000bd2465c0f35175bf05dbe3bf8bcde4a31 (diff) | |
| download | testtools-4d2c8dffadf46cec0babfacec992b2546f7a1016.tar.gz | |
add a _u function to imitate unicode literals on python3
Diffstat (limited to 'testtools/utils.py')
| -rw-r--r-- | testtools/utils.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testtools/utils.py b/testtools/utils.py index 2f502d0..0d9c3f4 100644 --- a/testtools/utils.py +++ b/testtools/utils.py @@ -2,12 +2,24 @@ """Utilities for dealing with stuff in unittest.""" + +import sys + __metaclass__ = type __all__ = [ 'iterate_tests', ] +if sys.version_info > (3, 0): + def _u(s): + """Replacement for u'some string' in Python 3.""" + return s +else: + def _u(s): + return unicode(s) + + def iterate_tests(test_suite_or_case): """Iterate through all of the test cases in `test_suite_or_case`.""" try: |
