From: Guido van Rossum Date: Mon, 20 Oct 1997 20:10:43 +0000 (+0000) Subject: Added separate tests for {}.get(). X-Git-Tag: v1.5b1~190 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb5cef116087058944f209cda38b1f5c56c30d23;p=python Added separate tests for {}.get(). --- diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index c3d59cb941..7cca131c7e 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -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'