diff options
author | Barry Warsaw <barry@python.org> | 1997-10-20 17:34:43 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1997-10-20 17:34:43 (GMT) |
commit | 9b887c791154a653dadbfabff4978179698c23eb (patch) | |
tree | 8c443d2e7aba4d1e7e506c4348752b885c7edabf /Lib/test | |
parent | 320ac331d110648cfb6404582e73249089086068 (diff) | |
download | cpython-9b887c791154a653dadbfabff4978179698c23eb.zip cpython-9b887c791154a653dadbfabff4978179698c23eb.tar.gz cpython-9b887c791154a653dadbfabff4978179698c23eb.tar.bz2 |
Added tests of dict.get()
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_types.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index eedf65a..c3d59cb 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -189,3 +189,9 @@ d.update({1:1, 2:2, 3:3}) if d != {1:1, 2:2, 3:3}: raise TestFailed, 'dict update' if d.copy() != {1:1, 2:2, 3:3}: raise TestFailed, 'dict copy' if {}.copy() != {}: raise TestFailed, 'empty dict copy' +# dict.get() +d = {'a' : 1, 'b' : 2} +if d.get('c') != None: raise TestFailed, 'missing dict get, no 2nd arg' +if d.get('c', 3) != 3: raise TestFailed, 'missing dict get, w/ 2nd arg' +if d.get('a') != 1: raise TestFailed, 'present dict get, no 2nd arg' +if d.get('a', 3) != 1: raise TestFailed, 'present dict get, w/ 2nd arg' |