From: Guido van Rossum Date: Mon, 2 Jun 1997 23:14:00 +0000 (+0000) Subject: Added tests for dict.clear(), dict.update(), dict.copy(). X-Git-Tag: v1.5a3~374 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce1fa263e61aefdc6649295abac6c40977604325;p=python Added tests for dict.clear(), dict.update(), dict.copy(). --- diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 51c76dc6d9..eedf65aead 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -180,3 +180,12 @@ d['a'] = 4 if d['c'] <> 3 or d['a'] <> 4: raise TestFailed, 'dict item assignment' del d['b'] if d <> {'a': 4, 'c': 3}: raise TestFailed, 'dict item deletion' +d = {1:1, 2:2, 3:3} +d.clear() +if d != {}: raise TestFailed, 'dict clear' +d.update({1:100}) +d.update({2:20}) +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'