diff options
author | Raymond Hettinger <python@rcn.com> | 2002-12-07 08:10:51 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2002-12-07 08:10:51 (GMT) |
commit | e03e5b1f91452603a4cbd6df99c7c7d4a6bcc2cc (patch) | |
tree | db14be0a74de88bd73272d1fc3ab09a34746ae52 /Lib | |
parent | 4e52ca82aec12f911196ca7c452102d10dda5422 (diff) | |
download | cpython-e03e5b1f91452603a4cbd6df99c7c7d4a6bcc2cc.zip cpython-e03e5b1f91452603a4cbd6df99c7c7d4a6bcc2cc.tar.gz cpython-e03e5b1f91452603a4cbd6df99c7c7d4a6bcc2cc.tar.bz2 |
Remove assumption that cls is a subclass of dict.
Simplifies the code and gets Just van Rossum's example to work.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_types.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 106d0a5..1b6f3ac 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -566,9 +566,9 @@ from UserDict import UserDict class mydict(dict): def __new__(cls, *args, **kwargs): return UserDict(*args, **kwargs) -try: mydict.fromkeys('a b c'.split()) -except TypeError: pass -else: raise TestFailed, 'dict.fromkeys() failed to detect non-dict class.' +ud = mydict.fromkeys('ab') +if ud != {'a':None, 'b':None} or not isinstance(ud,UserDict): + raise TestFailed, 'fromkeys did not instantiate using __new__' # dict.copy() d = {1:1, 2:2, 3:3} if d.copy() != {1:1, 2:2, 3:3}: raise TestFailed, 'dict copy' |