Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
636286bd
Commit
636286bd
authored
Dec 30, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py3 test case fix
parent
bf6946d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
tests/run/isinstance.pyx
tests/run/isinstance.pyx
+11
-4
No files found.
tests/run/isinstance.pyx
View file @
636286bd
...
...
@@ -5,9 +5,17 @@ True
cdef
class
A
:
pass
import
sys
IS_PY3
=
sys
.
version_info
[
0
]
>=
3
def
test_all
():
if
IS_PY3
:
new_type
=
type
(
u'a'
,(),{})
else
:
new_type
=
type
(
'a'
,(),{})
# Optimized tests.
assert
isinstance
(
type
(
'a'
,(),{})
,
type
)
assert
isinstance
(
new_type
,
type
)
assert
isinstance
(
bool
(),
bool
)
assert
isinstance
(
int
(),
int
)
assert
isinstance
(
long
(),
long
)
...
...
@@ -24,12 +32,11 @@ def test_all():
assert
isinstance
(
slice
(
0
),
slice
)
assert
isinstance
(
A
,
type
)
assert
isinstance
(
A
(),
A
)
assert
not
isinstance
(
"foo"
,
int
)
assert
not
isinstance
(
u
"foo"
,
int
)
# Non-optimized
foo
=
A
assert
isinstance
(
A
(),
foo
)
assert
isinstance
(
0
,
(
int
,
long
))
assert
not
isinstance
(
"xyz"
,
(
int
,
long
))
assert
not
isinstance
(
u
"xyz"
,
(
int
,
long
))
return
True
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