diff options
author | Marc-André Lemburg <mal@egenix.com> | 2001-01-17 19:11:13 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2001-01-17 19:11:13 (GMT) |
commit | 3661908a6ac75026e4504d9f62a6ac2e2fb2ec5e (patch) | |
tree | eea0f44df59aaaf014eb4580f1fad308e31601bf /Lib/test/test_userdict.py | |
parent | 8551dd60781f738e5e5ef4e22b6f071d27e20b50 (diff) | |
download | cpython-3661908a6ac75026e4504d9f62a6ac2e2fb2ec5e.zip cpython-3661908a6ac75026e4504d9f62a6ac2e2fb2ec5e.tar.gz cpython-3661908a6ac75026e4504d9f62a6ac2e2fb2ec5e.tar.bz2 |
This patch removes all uses of "assert" in the regression test suite
and replaces them with a new API verify(). As a result the regression
suite will also perform its tests in optimization mode.
Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
Diffstat (limited to 'Lib/test/test_userdict.py')
-rw-r--r-- | Lib/test/test_userdict.py | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py index 63632f7..08b7a13 100644 --- a/Lib/test/test_userdict.py +++ b/Lib/test/test_userdict.py @@ -1,5 +1,6 @@ # Check every path through every method of UserDict +from test_support import verify, verbose from UserDict import UserDict d0 = {} @@ -20,26 +21,26 @@ uu2 = UserDict(u2) # Test __repr__ -assert str(u0) == str(d0) -assert repr(u1) == repr(d1) -assert `u2` == `d2` +verify(str(u0) == str(d0)) +verify(repr(u1) == repr(d1)) +verify(`u2` == `d2`) # Test __cmp__ and __len__ all = [d0, d1, d2, u, u0, u1, u2, uu, uu0, uu1, uu2] for a in all: for b in all: - assert cmp(a, b) == cmp(len(a), len(b)) + verify(cmp(a, b) == cmp(len(a), len(b))) # Test __getitem__ -assert u2["one"] == 1 +verify(u2["one"] == 1) try: u1["two"] except KeyError: pass else: - assert 0, "u1['two'] shouldn't exist" + verify(0, "u1['two'] shouldn't exist") # Test __setitem__ @@ -55,47 +56,47 @@ try: except KeyError: pass else: - assert 0, "u3['three'] shouldn't exist" + verify(0, "u3['three'] shouldn't exist") # Test clear u3.clear() -assert u3 == {} +verify(u3 == {}) # Test copy() u2a = u2.copy() -assert u2a == u2 +verify(u2a == u2) class MyUserDict(UserDict): def display(self): print self m2 = MyUserDict(u2) m2a = m2.copy() -assert m2a == m2 +verify(m2a == m2) # Test keys, items, values -assert u2.keys() == d2.keys() -assert u2.items() == d2.items() -assert u2.values() == d2.values() +verify(u2.keys() == d2.keys()) +verify(u2.items() == d2.items()) +verify(u2.values() == d2.values()) # Test has_key for i in u2.keys(): - assert u2.has_key(i) == 1 - assert u1.has_key(i) == d1.has_key(i) - assert u0.has_key(i) == d0.has_key(i) + verify(u2.has_key(i) == 1) + verify(u1.has_key(i) == d1.has_key(i)) + verify(u0.has_key(i) == d0.has_key(i)) # Test update t = UserDict() t.update(u2) -assert t == u2 +verify(t == u2) # Test get for i in u2.keys(): - assert u2.get(i) == u2[i] - assert u1.get(i) == d1.get(i) - assert u0.get(i) == d0.get(i) + verify(u2.get(i) == u2[i]) + verify(u1.get(i) == d1.get(i)) + verify(u0.get(i) == d0.get(i)) |