diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-12-06 13:09:39 -0500 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-12-06 13:09:39 -0500 |
| commit | 281c507652e0bcb230101151bf5a09499fb7045d (patch) | |
| tree | d230165632d510db439ac8ee490ba9ed841e20ae | |
| parent | 9a4996c38e1980ac290eceae8ee608ce67b5db0c (diff) | |
| download | passlib-281c507652e0bcb230101151bf5a09499fb7045d.tar.gz | |
added compat.sb_types for testing isinstance(obj,(bytes,unicode))
| -rw-r--r-- | passlib/tests/utils.py | 4 | ||||
| -rw-r--r-- | passlib/utils/compat.py | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/passlib/tests/utils.py b/passlib/tests/utils.py index ff6dea8..06aea3c 100644 --- a/passlib/tests/utils.py +++ b/passlib/tests/utils.py @@ -37,7 +37,7 @@ from passlib import registry, utils from passlib.utils import classproperty, handlers as uh, \ has_rounds_info, has_salt_info, MissingBackendError, \ rounds_cost_values, b, bytes, native_str, NoneType -from passlib.utils.compat import iteritems, irange, callable +from passlib.utils.compat import iteritems, irange, callable, sb_types #local __all__ = [ #util funcs @@ -298,7 +298,7 @@ class TestCase(unittest.TestCase): #added in 2.7/UT2 and 3.1 def assertRegexpMatches(self, text, expected_regex, msg=None): """Fail the test unless the text matches the regular expression.""" - if isinstance(expected_regex, basestring): + if isinstance(expected_regex, sb_types): assert expected_regex, "expected_regex must not be empty." expected_regex = re.compile(expected_regex) if not expected_regex.search(text): diff --git a/passlib/utils/compat.py b/passlib/utils/compat.py index 805f8b9..c98f8d4 100644 --- a/passlib/utils/compat.py +++ b/passlib/utils/compat.py @@ -59,6 +59,8 @@ else: __all__.append("bytes") # string_types = (unicode,str) +sb_types = (unicode, bytes) + #============================================================================= # bytes-specific helpers #============================================================================= |
