Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7334afed
Commit
7334afed
authored
Jul 26, 2007
by
Nick Coghlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add explicit test for a misbehaving math.floor
parent
baef2cc2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
Lib/test/test_math.py
Lib/test/test_math.py
+4
-0
Lib/test/test_pow.py
Lib/test/test_pow.py
+3
-6
No files found.
Lib/test/test_math.py
View file @
7334afed
...
...
@@ -92,6 +92,10 @@ class MathTests(unittest.TestCase):
self
.
ftest
(
'floor(-0.5)'
,
math
.
floor
(
-
0.5
),
-
1
)
self
.
ftest
(
'floor(-1.0)'
,
math
.
floor
(
-
1.0
),
-
1
)
self
.
ftest
(
'floor(-1.5)'
,
math
.
floor
(
-
1.5
),
-
2
)
# pow() relies on floor() to check for integers
# This fails on some platforms - so check it here
self
.
ftest
(
'floor(1.23e167)'
,
math
.
floor
(
1.23e167
),
1.23e167
)
self
.
ftest
(
'floor(-1.23e167)'
,
math
.
floor
(
-
1.23e167
),
-
1.23e167
)
def
testFmod
(
self
):
self
.
assertRaises
(
TypeError
,
math
.
fmod
)
...
...
Lib/test/test_pow.py
View file @
7334afed
...
...
@@ -106,12 +106,9 @@ class PowTest(unittest.TestCase):
# platform pow() was buggy, and Python didn't worm around it.
eq
=
self
.
assertEquals
a
=
-
1.0
# XXX Temporary diagnostic for failure on alpha Debian buildbot
from
sys
import
__stdout__
from
math
import
floor
print
>>
__stdout__
,
"*** Number: %r"
%
1.23e167
print
>>
__stdout__
,
"*** Floor: %r"
%
floor
(
1.23e167
)
# XXX End diagnostic message
# The next two tests can still fail if the platform floor()
# function doesn't treat all large inputs as integers
# test_math should also fail if that is happening
eq
(
pow
(
a
,
1.23e167
),
1.0
)
eq
(
pow
(
a
,
-
1.23e167
),
1.0
)
for
b
in
range
(
-
10
,
11
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment