diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-01-02 09:24:53 -0600 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-01-02 09:24:53 -0600 |
commit | 753c6af25838fe8f3e357bc058ddad8ced35e620 (patch) | |
tree | 5cfe14baf53a1d48dbff9e27c6ed2b1242db9da4 /six.py | |
parent | d5ca48d0fbfe6e88e432a43dd0ce4e42874a3a30 (diff) | |
parent | 8f481c478b9aac37a907eeb58b5e0804a7f4d1a0 (diff) | |
download | six-git-753c6af25838fe8f3e357bc058ddad8ced35e620.tar.gz |
Merged in timograham/six (pull request #57)
Added unittest aliases.
Diffstat (limited to 'six.py')
-rw-r--r-- | six.py | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -610,6 +610,9 @@ if PY3: import io StringIO = io.StringIO BytesIO = io.BytesIO + _assertCountEqual = "assertCountEqual" + _assertRaisesRegex = "assertRaisesRegex" + _assertRegex = "assertRegex" else: def b(s): return s @@ -625,10 +628,25 @@ else: iterbytes = functools.partial(itertools.imap, ord) import StringIO StringIO = BytesIO = StringIO.StringIO + _assertCountEqual = "assertItemsEqual" + _assertRaisesRegex = "assertRaisesRegexp" + _assertRegex = "assertRegexpMatches" _add_doc(b, """Byte literal""") _add_doc(u, """Text literal""") +def assertCountEqual(self, *args, **kwargs): + return getattr(self, _assertCountEqual)(*args, **kwargs) + + +def assertRaisesRegex(self, *args, **kwargs): + return getattr(self, _assertRaisesRegex)(*args, **kwargs) + + +def assertRegex(self, *args, **kwargs): + return getattr(self, _assertRegex)(*args, **kwargs) + + if PY3: exec_ = getattr(moves.builtins, "exec") |