mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
SF patch #523169, by Samuele Pedroni.
There were never tests for the fact that list() always returns a *new* list object, even when the argument is a list, while tuple() may return a reference to the argument when it is a tuple. Now there are.
This commit is contained in:
parent
5ae815af99
commit
06ee2531a8
3 changed files with 14 additions and 1 deletions
|
|
@ -253,7 +253,9 @@ if str({}) != '{}': raise TestFailed, 'str({})'
|
|||
|
||||
print 'tuple'
|
||||
if tuple(()) != (): raise TestFailed, 'tuple(())'
|
||||
if tuple((0, 1, 2, 3)) != (0, 1, 2, 3): raise TestFailed, 'tuple((0, 1, 2, 3))'
|
||||
t0_3 = (0, 1, 2, 3)
|
||||
t0_3_bis = tuple(t0_3)
|
||||
if t0_3 is not t0_3_bis: raise TestFailed, 'tuple((0, 1, 2, 3))'
|
||||
if tuple([]) != (): raise TestFailed, 'tuple([])'
|
||||
if tuple([0, 1, 2, 3]) != (0, 1, 2, 3): raise TestFailed, 'tuple([0, 1, 2, 3])'
|
||||
if tuple('') != (): raise TestFailed, 'tuple('')'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue