mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Added some new tests and two new files for testing: test_types.py
(testing operations on built-in types) and autotest.py (automatic regression testing).
This commit is contained in:
parent
d014ea6b5e
commit
85f1820ee1
6 changed files with 295 additions and 6 deletions
|
@ -115,11 +115,27 @@ print 'reload'
|
|||
import string
|
||||
reload(string)
|
||||
|
||||
print 'repr'
|
||||
if repr('') <> '\'\'': raise TestFailed, 'repr(\'\')'
|
||||
if repr(0) <> '0': raise TestFailed, 'repr(0)'
|
||||
if repr(0L) <> '0L': raise TestFailed, 'repr(0L)'
|
||||
if repr(()) <> '()': raise TestFailed, 'repr(())'
|
||||
if repr([]) <> '[]': raise TestFailed, 'repr([])'
|
||||
if repr({}) <> '{}': raise TestFailed, 'repr({})'
|
||||
|
||||
print 'setattr'
|
||||
import sys
|
||||
setattr(sys, 'foobar', 1)
|
||||
if sys.foobar != 1: raise TestFailed, 'setattr(sys, \'foobar\', 1)'
|
||||
|
||||
print 'str'
|
||||
if str('') <> '': raise TestFailed, 'str(\'\')'
|
||||
if str(0) <> '0': raise TestFailed, 'str(0)'
|
||||
if str(0L) <> '0L': raise TestFailed, 'str(0L)'
|
||||
if str(()) <> '()': raise TestFailed, 'str(())'
|
||||
if str([]) <> '[]': raise TestFailed, 'str([])'
|
||||
if str({}) <> '{}': raise TestFailed, 'str({})'
|
||||
|
||||
print 'type'
|
||||
if type('') <> type('123') or type('') == type(()):
|
||||
raise TestFailed, 'type()'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue