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:
Guido van Rossum 1992-11-27 22:53:50 +00:00
parent d014ea6b5e
commit 85f1820ee1
6 changed files with 295 additions and 6 deletions

View file

@ -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()'