mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Added tests for dict.clear(), dict.update(), dict.copy().
This commit is contained in:
parent
77e1db3b34
commit
ce1fa263e6
1 changed files with 9 additions and 0 deletions
|
|
@ -180,3 +180,12 @@ d['a'] = 4
|
||||||
if d['c'] <> 3 or d['a'] <> 4: raise TestFailed, 'dict item assignment'
|
if d['c'] <> 3 or d['a'] <> 4: raise TestFailed, 'dict item assignment'
|
||||||
del d['b']
|
del d['b']
|
||||||
if d <> {'a': 4, 'c': 3}: raise TestFailed, 'dict item deletion'
|
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'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue