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
bf9f79b1
Commit
bf9f79b1
authored
Jun 30, 2010
by
Mark Dickinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for Python 3.1's treatment of negated imaginary literals.
parent
ce5b6c43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
Lib/test/test_complex.py
Lib/test/test_complex.py
+19
-0
No files found.
Lib/test/test_complex.py
View file @
bf9f79b1
...
...
@@ -407,6 +407,25 @@ class ComplexTest(unittest.TestCase):
self
.
assertEquals
(
atan2
(
z1
.
imag
,
-
1.
),
atan2
(
0.
,
-
1.
))
self
.
assertEquals
(
atan2
(
z2
.
imag
,
-
1.
),
atan2
(
-
0.
,
-
1.
))
@
unittest
.
skipUnless
(
float
.
__getformat__
(
"double"
).
startswith
(
"IEEE"
),
"test requires IEEE 754 doubles"
)
def
test_negated_imaginary_literal
(
self
):
z0
=
-
0j
z1
=
-
7j
z2
=
-
1e1000j
# This behaviour is actually incorrect: the real part of a negated
# imaginary literal should be -0.0, not 0.0. It's fixed in Python 3.2.
# However, the behaviour is already out in the wild in Python 2.x and
# Python <= 3.1.2, and it would be too disruptive to change it in a
# bugfix release, so we call it a 'feature' of Python 3.1, and test to
# ensure that the behaviour remains consistent across 3.1.x releases.
self
.
assertFloatsAreIdentical
(
z0
.
real
,
0.0
)
self
.
assertFloatsAreIdentical
(
z0
.
imag
,
-
0.0
)
self
.
assertFloatsAreIdentical
(
z1
.
real
,
0.0
)
self
.
assertFloatsAreIdentical
(
z1
.
imag
,
-
7.0
)
self
.
assertFloatsAreIdentical
(
z2
.
real
,
0.0
)
self
.
assertFloatsAreIdentical
(
z2
.
imag
,
-
INF
)
@
unittest
.
skipUnless
(
float
.
__getformat__
(
"double"
).
startswith
(
"IEEE"
),
"test requires IEEE 754 doubles"
)
def
test_overflow
(
self
):
...
...
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