Mercurial > kallithea
comparison rhodecode/tests/nose_parametrized.py @ 2556:60c48410996e beta
fixed nose_parametrized for py25 compat
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 06 Jul 2012 00:12:29 +0200 |
parents | 8a8805478312 |
children | 2a7cbc53f65a |
comparison
equal
deleted
inserted
replaced
2555:b5c57e2176dc | 2556:60c48410996e |
---|---|
156 | 156 |
157 | 157 |
158 def assert_raises(func, exc_type, str_contains=None, repr_contains=None): | 158 def assert_raises(func, exc_type, str_contains=None, repr_contains=None): |
159 try: | 159 try: |
160 func() | 160 func() |
161 except exc_type as e: | 161 except exc_type, e: |
162 if str_contains is not None and str_contains not in str(e): | 162 if str_contains is not None and str_contains not in str(e): |
163 raise AssertionError("%s raised, but %r does not contain %r" | 163 raise AssertionError("%s raised, but %r does not contain %r" |
164 % (exc_type, str(e), str_contains)) | 164 % (exc_type, str(e), str_contains)) |
165 if repr_contains is not None and repr_contains not in repr(e): | 165 if repr_contains is not None and repr_contains not in repr(e): |
166 raise AssertionError("%s raised, but %r does not contain %r" | 166 raise AssertionError("%s raised, but %r does not contain %r" |