diff options
author | Guido van Rossum <guido@python.org> | 2002-02-26 22:39:23 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-02-26 22:39:23 (GMT) |
commit | 06ee2531a821100859e9c5a245599866ed9af0e6 (patch) | |
tree | 9a2d2a784c6800bff40f47a1244f9eeb6bfae652 /Lib/test/test_b1.py | |
parent | 5ae815af999ce284fac06a0c92f5ef32ed423681 (diff) | |
download | cpython-06ee2531a821100859e9c5a245599866ed9af0e6.zip cpython-06ee2531a821100859e9c5a245599866ed9af0e6.tar.gz cpython-06ee2531a821100859e9c5a245599866ed9af0e6.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_b1.py')
-rw-r--r-- | Lib/test/test_b1.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py index 17f0411..8d47abc 100644 --- a/Lib/test/test_b1.py +++ b/Lib/test/test_b1.py @@ -491,6 +491,16 @@ if len([1, 2, 3, 4]) != 4: raise TestFailed, 'len([1, 2, 3, 4])' if len({}) != 0: raise TestFailed, 'len({})' if len({'a':1, 'b': 2}) != 2: raise TestFailed, 'len({\'a\':1, \'b\': 2})' +print 'list' +if list([]) != []: raise TestFailed, 'list([])' +l0_3 = [0, 1, 2, 3] +l0_3_bis = list(l0_3) +if l0_3 != l0_3_bis or l0_3 is l0_3_bis: raise TestFailed, 'list([0, 1, 2, 3])' +if list(()) != []: raise TestFailed, 'list(())' +if list((0, 1, 2, 3)) != [0, 1, 2, 3]: raise TestFailed, 'list((0, 1, 2, 3))' +if list('') != []: raise TestFailed, 'list('')' +if list('spam') != ['s', 'p', 'a', 'm']: raise TestFailed, "list('spam')" + print 'long' if long(314) != 314L: raise TestFailed, 'long(314)' if long(3.14) != 3L: raise TestFailed, 'long(3.14)' |