mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Added tests of dict.get()
This commit is contained in:
parent
320ac331d1
commit
9b887c7911
1 changed files with 6 additions and 0 deletions
|
|
@ -189,3 +189,9 @@ def revcmp(a, b): return cmp(b, a)
|
|||
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'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue