diff options
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/tests/test_public.py | 11 | ||||
-rw-r--r-- | ipalib/tests/tstutil.py | 4 |
2 files changed, 5 insertions, 10 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py index 28970af98..c184ac154 100644 --- a/ipalib/tests/test_public.py +++ b/ipalib/tests/test_public.py @@ -185,8 +185,6 @@ class test_Option(ClassChecker): for v in (u'Hello', u'hello'): # Okay assert o.normalize(v) == u'hello' for v in [None, 'hello', (u'Hello',)]: # Not unicode - e = raises(TypeError, o.normalize, v) - assert str(e) == errors.TYPE_FORMAT % ('value', unicode, v) check_TypeError(v, unicode, 'value', o.normalize, v) # Scenario 3: multivalue=True, normalize=None @@ -200,13 +198,10 @@ class test_Option(ClassChecker): for value in [(u'Hello',), (u'hello',)]: # Okay assert o.normalize(value) == (u'hello',) for v in (None, u'Hello', [u'hello']): # Not tuple - e = raises(TypeError, o.normalize, v) - assert str(e) == errors.TYPE_FORMAT % ('value', tuple, v) check_TypeError(v, tuple, 'value', o.normalize, v) - for v in [('Hello',), (u'Hello', 'Hello')]: # Non unicode member - e = raises(TypeError, o.normalize, v) - assert str(e) == errors.TYPE_FORMAT % ('value', unicode, 'Hello') - check_TypeError('Hello', unicode, 'value', o.normalize, v) + fail = 'Hello' # Not unicode + for v in [(fail,), (u'Hello', fail)]: # Non unicode member + check_TypeError(fail, unicode, 'value', o.normalize, v) def test_validate(self): """ diff --git a/ipalib/tests/tstutil.py b/ipalib/tests/tstutil.py index 1bf3eaab3..7586d08c5 100644 --- a/ipalib/tests/tstutil.py +++ b/ipalib/tests/tstutil.py @@ -139,9 +139,9 @@ def check_TypeError(value, type_, name, callback, *args, **kw): Tests a standard TypeError raised with `errors.raise_TypeError`. """ e = raises(TypeError, callback, *args, **kw) - assert e.value == value - assert type(e.value) is type(value) + assert e.value is value assert e.type is type_ assert e.name == name assert type(e.name) is str assert str(e) == errors.TYPE_FORMAT % (name, type_, value) + return e |