Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
4307c072
Commit
4307c072
authored
Dec 21, 2015
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for new added complex attributes
parent
fd811164
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
test/tests/complex.py
test/tests/complex.py
+33
-0
No files found.
test/tests/complex.py
View file @
4307c072
...
...
@@ -22,3 +22,36 @@ try:
complex
(
1
,
1.0
).
real
=
1
except
TypeError
,
e
:
print
e
types
=
[
int
,
float
,
long
]
for
_type
in
types
:
try
:
_type
(
1j
)
except
TypeError
as
e
:
print
(
e
.
message
)
data
=
[
"-1j"
,
"0j"
,
"1j"
,
"5+5j"
,
"5-5j"
,
"5"
,
"5L"
,
"5.5"
,
"
\
"
5
\
"
"
,
"None"
,
]
operations
=
[
"__mod__"
,
"__rmod__"
,
"__divmod__"
,
"__rdivmod__"
,
"__truediv__"
,
"__rtruediv__"
,
"__floordiv__"
,
"__rfloordiv__"
,
]
for
x
in
data
:
for
y
in
data
:
for
operation
in
operations
:
try
:
print
(
x
)
print
(
y
)
print
(
operation
)
print
(
eval
(
"complex.{op}({arg1}, {arg2})"
.
format
(
op
=
operation
,
arg1
=
x
,
arg2
=
y
)))
print
(
"========"
)
except
Exception
as
e
:
print
(
e
.
message
)
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