]> granicus.if.org Git - python/commitdiff
Added separate tests for {}.get().
authorGuido van Rossum <guido@python.org>
Mon, 20 Oct 1997 20:10:43 +0000 (20:10 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 20 Oct 1997 20:10:43 +0000 (20:10 +0000)
Lib/test/test_types.py

index c3d59cb9412e331ccd2a5761c00fa88c7eb510ba..7cca131c7e2122a6fbc8dfe81948859fa332f85d 100644 (file)
@@ -190,6 +190,9 @@ 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 = {}
+if d.get('c') != None: raise TestFailed, 'missing {} get, no 2nd arg'
+if d.get('c', 3) != 3: raise TestFailed, 'missing {} get, w/ 2nd arg'
 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'