]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
* Fix bug in tzparse.py for DST timezone
authorGuido van Rossum <guido@python.org>
Mon, 29 Mar 1993 11:30:50 +0000 (11:30 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 29 Mar 1993 11:30:50 +0000 (11:30 +0000)
* 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!]

Lib/lib-stdwin/rect.py
Lib/stdwin/rect.py
Lib/string.py
Lib/stringold.py
Lib/test/test_b2.py
Lib/test/testall.out
Lib/tzparse.py

index aa5ff4449b76a0abdb78bdc9fe18a890eafc4a7c..9bc63421162a42a0c0a4a41bc2efc949d6dd4dfb 100644 (file)
@@ -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
index aa5ff4449b76a0abdb78bdc9fe18a890eafc4a7c..9bc63421162a42a0c0a4a41bc2efc949d6dd4dfb 100755 (executable)
@@ -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
index aed3eafb544ecb6a1b963541b41d1b08e8cb251e..e5dc1946bc05edd45d5f4ead13473d9744b44fa8 100644 (file)
@@ -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'
index aed3eafb544ecb6a1b963541b41d1b08e8cb251e..e5dc1946bc05edd45d5f4ead13473d9744b44fa8 100644 (file)
@@ -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'
index f376f468cd457e24169f599ea1a0fc1a449ee1b0..ca06049c3e7a87c35f4eb38dcdb1c04957063d82 100644 (file)
@@ -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)
index f81849b12d67dd49b5c546de4e4e1b13ffaed333..a711ba2e3e7a8c30dd6a66c49d07d1993d026931 100644 (file)
@@ -92,6 +92,7 @@ testing
 testing
 reload
 repr
+round
 setattr
 str
 type
index 67c94dec6e1278d90b873150caa57ad731f7252c..6cb08995b73519f90b0e2e5745113580d5d8ae41 100644 (file)
@@ -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]