diff options
-rw-r--r-- | argparse.py | 4 | ||||
-rw-r--r-- | test/test_argparse.py | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/argparse.py b/argparse.py index bfd6127..3bdcd33 100644 --- a/argparse.py +++ b/argparse.py @@ -96,6 +96,10 @@ except NameError: # for python < 2.4 compatibility (sets module is there since 2.3): from sets import Set as set +try: + basestring +except NameError: + basestring = str try: sorted diff --git a/test/test_argparse.py b/test/test_argparse.py index 9141cfb..daead61 100644 --- a/test/test_argparse.py +++ b/test/test_argparse.py @@ -10,7 +10,10 @@ import tempfile import unittest import argparse -from StringIO import StringIO +try: + from StringIO import StringIO +except ImportError: + from io import StringIO class StdIOBuffer(StringIO): pass @@ -4364,6 +4367,7 @@ class TestImportStar(TestCase): if not inspect.ismodule(value) ] # this will fail on python 2.3 due to "set" and "sorted": + # this will fail on python 3.1 due to "basestring" self.assertEqual(sorted(items), sorted(argparse.__all__)) |