summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-03-29 11:30:50 (GMT)
committerGuido van Rossum <guido@python.org>1993-03-29 11:30:50 (GMT)
commite7113b6b3dd99b4d05fc81c18e1c2a94fa8e1ebb (patch)
treed779bf09fa3a7df8bd5876f398f353348f13f9de /Lib
parent04321d1e472ac2ffd06776f117a5ec14e76b7bb7 (diff)
downloadcpython-e7113b6b3dd99b4d05fc81c18e1c2a94fa8e1ebb.zip
cpython-e7113b6b3dd99b4d05fc81c18e1c2a94fa8e1ebb.tar.gz
cpython-e7113b6b3dd99b4d05fc81c18e1c2a94fa8e1ebb.tar.bz2
* 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!]
Diffstat (limited to 'Lib')
-rw-r--r--Lib/lib-stdwin/rect.py7
-rwxr-xr-xLib/stdwin/rect.py7
-rw-r--r--Lib/string.py4
-rw-r--r--Lib/stringold.py4
-rw-r--r--Lib/test/test_b2.py35
-rw-r--r--Lib/test/testall.out1
-rw-r--r--Lib/tzparse.py2
7 files changed, 51 insertions, 9 deletions
diff --git a/Lib/lib-stdwin/rect.py b/Lib/lib-stdwin/rect.py
index aa5ff44..9bc6342 100644
--- a/Lib/lib-stdwin/rect.py
+++ b/Lib/lib-stdwin/rect.py
@@ -17,7 +17,8 @@ empty = (0, 0), (0, 0)
# Check if a rectangle is empty.
#
-def is_empty((left, top), (right, bottom)):
+def is_empty(r):
+ (left, top), (right, bottom) = r
return left >= right or top >= bottom
@@ -36,7 +37,7 @@ def intersect(list):
if top < t: top = t
if right > r: right = r
if bottom > b: bottom = b
- if is_empty((left, top), (right, bottom)):
+ if is_empty(((left, top), (right, bottom))):
return empty
return (left, top), (right, bottom)
@@ -47,7 +48,7 @@ def intersect(list):
def union(list):
(left, top), (right, bottom) = empty
for (l, t), (r, b) in list[1:]:
- if not is_empty((l, t), (r, b)):
+ if not is_empty(((l, t), (r, b))):
if l < left: left = l
if t < top: top = t
if r > right: right = r
diff --git a/Lib/stdwin/rect.py b/Lib/stdwin/rect.py
index aa5ff44..9bc6342 100755
--- a/Lib/stdwin/rect.py
+++ b/Lib/stdwin/rect.py
@@ -17,7 +17,8 @@ empty = (0, 0), (0, 0)
# Check if a rectangle is empty.
#
-def is_empty((left, top), (right, bottom)):
+def is_empty(r):
+ (left, top), (right, bottom) = r
return left >= right or top >= bottom
@@ -36,7 +37,7 @@ def intersect(list):
if top < t: top = t
if right > r: right = r
if bottom > b: bottom = b
- if is_empty((left, top), (right, bottom)):
+ if is_empty(((left, top), (right, bottom))):
return empty
return (left, top), (right, bottom)
@@ -47,7 +48,7 @@ def intersect(list):
def union(list):
(left, top), (right, bottom) = empty
for (l, t), (r, b) in list[1:]:
- if not is_empty((l, t), (r, b)):
+ if not is_empty(((l, t), (r, b))):
if l < left: left = l
if t < top: top = t
if r > right: right = r
diff --git a/Lib/string.py b/Lib/string.py
index aed3eaf..e5dc194 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -1,6 +1,8 @@
# module 'string' -- A collection of string operations
-# XXX Some of these operations are incredibly slow and should be built in
+# Warning: most of the code you see here isn't normally used nowadays.
+# At the end of this file most functions are replaced by built-in
+# functions imported from built-in module "strop".
# Some strings for ctype-style character classification
whitespace = ' \t\n'
diff --git a/Lib/stringold.py b/Lib/stringold.py
index aed3eaf..e5dc194 100644
--- a/Lib/stringold.py
+++ b/Lib/stringold.py
@@ -1,6 +1,8 @@
# module 'string' -- A collection of string operations
-# XXX Some of these operations are incredibly slow and should be built in
+# Warning: most of the code you see here isn't normally used nowadays.
+# At the end of this file most functions are replaced by built-in
+# functions imported from built-in module "strop".
# Some strings for ctype-style character classification
whitespace = ' \t\n'
diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py
index f376f46..ca06049 100644
--- a/Lib/test/test_b2.py
+++ b/Lib/test/test_b2.py
@@ -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)
diff --git a/Lib/test/testall.out b/Lib/test/testall.out
index f81849b..a711ba2 100644
--- a/Lib/test/testall.out
+++ b/Lib/test/testall.out
@@ -92,6 +92,7 @@ testing
testing
reload
repr
+round
setattr
str
type
diff --git a/Lib/tzparse.py b/Lib/tzparse.py
index 67c94de..6cb0899 100644
--- a/Lib/tzparse.py
+++ b/Lib/tzparse.py
@@ -40,7 +40,7 @@ def tzset():
tzstr = os.environ['TZ']
tzparams = tzparse(tzstr)
timezone = tzparams[1] * 3600
- altzone = timezone + 3600
+ altzone = timezone - 3600
daylight = 1
tzname = tzparams[0], tzparams[2]