mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
* Fix bug in tzparse.py for DST timezone
* Added whatis command to pdb.py * new module GET.py (GL definitions from <gl/get.h>) * rect.py: is_empty takes a rect as argument, not two points. * Added tests for builtin round() [XXX not yet complete!]
This commit is contained in:
parent
04321d1e47
commit
e7113b6b3d
7 changed files with 51 additions and 9 deletions
|
|
@ -123,6 +123,41 @@ if repr(()) <> '()': raise TestFailed, 'repr(())'
|
|||
if repr([]) <> '[]': raise TestFailed, 'repr([])'
|
||||
if repr({}) <> '{}': raise TestFailed, 'repr({})'
|
||||
|
||||
print 'round'
|
||||
if round(0.0) <> 0.0: raise TestFailed, 'round(0.0)'
|
||||
if round(1.0) <> 1.0: raise TestFailed, 'round(1.0)'
|
||||
if round(10.0) <> 10.0: raise TestFailed, 'round(10.0)'
|
||||
if round(1000000000.0) <> 1000000000.0:
|
||||
raise TestFailed, 'round(1000000000.0)'
|
||||
if round(1e20) <> 1e20: raise TestFailed, 'round(1e20)'
|
||||
|
||||
if round(-1.0) <> -1.0: raise TestFailed, 'round(-1.0)'
|
||||
if round(-10.0) <> -10.0: raise TestFailed, 'round(-10.0)'
|
||||
if round(-1000000000.0) <> -1000000000.0:
|
||||
raise TestFailed, 'round(-1000000000.0)'
|
||||
if round(-1e20) <> -1e20: raise TestFailed, 'round(-1e20)'
|
||||
|
||||
if round(0.1) <> 0.0: raise TestFailed, 'round(0.0)'
|
||||
if round(1.1) <> 1.0: raise TestFailed, 'round(1.0)'
|
||||
if round(10.1) <> 10.0: raise TestFailed, 'round(10.0)'
|
||||
if round(1000000000.1) <> 1000000000.0:
|
||||
raise TestFailed, 'round(1000000000.0)'
|
||||
|
||||
if round(-1.1) <> -1.0: raise TestFailed, 'round(-1.0)'
|
||||
if round(-10.1) <> -10.0: raise TestFailed, 'round(-10.0)'
|
||||
if round(-1000000000.1) <> -1000000000.0:
|
||||
raise TestFailed, 'round(-1000000000.0)'
|
||||
|
||||
if round(0.9) <> 1.0: raise TestFailed, 'round(0.9)'
|
||||
if round(9.9) <> 10.0: raise TestFailed, 'round(9.9)'
|
||||
if round(999999999.9) <> 1000000000.0:
|
||||
raise TestFailed, 'round(999999999.9)'
|
||||
|
||||
if round(-0.9) <> -1.0: raise TestFailed, 'round(-0.9)'
|
||||
if round(-9.9) <> -10.0: raise TestFailed, 'round(-9.9)'
|
||||
if round(-999999999.9) <> -1000000000.0:
|
||||
raise TestFailed, 'round(-999999999.9)'
|
||||
|
||||
print 'setattr'
|
||||
import sys
|
||||
setattr(sys, 'foobar', 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue