diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-03 18:41:46 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-03 18:41:46 +0000 |
commit | 9548b4b951492b3aac175ba351a1dd7e857c017b (patch) | |
tree | f1040cdad80b74f27030d0555fdac62e695f01dd /ipalib/tests | |
parent | 085ea3f62f37539a279f7d4ade51208fcbe868b9 (diff) | |
download | freeipa-9548b4b951492b3aac175ba351a1dd7e857c017b.tar.gz freeipa-9548b4b951492b3aac175ba351a1dd7e857c017b.tar.xz freeipa-9548b4b951492b3aac175ba351a1dd7e857c017b.zip |
240: Small change in tstutil.check_TypeError(), cleaned up use of check_TypeError() in test_Option.test_normalize()
Diffstat (limited to 'ipalib/tests')
-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 |