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
Gwenaël Samain
cython
Commits
3164f42f
Commit
3164f42f
authored
Apr 21, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extended test case for unicode characters in switch statement
parent
2183cbca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
tests/run/inop.pyx
tests/run/inop.pyx
+7
-0
tests/run/notinop.pyx
tests/run/notinop.pyx
+17
-3
No files found.
tests/run/inop.pyx
View file @
3164f42f
...
...
@@ -136,6 +136,8 @@ def m_unicode(Py_UNICODE a, unicode unicode_string):
1
>>> m_unicode(ord('X'), py_unicode_string)
0
>>> m_unicode(ord(py_klingon_character), py_unicode_string)
1
>>> 'f' in None
Traceback (most recent call last):
TypeError: argument of type 'NoneType' is not iterable
...
...
@@ -146,6 +148,9 @@ def m_unicode(Py_UNICODE a, unicode unicode_string):
cdef
int
result
=
a
in
unicode_string
return
result
cdef
unicode
klingon_character
=
u'
\
uF8D2
'
py_klingon_character
=
klingon_character
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//BoolBinopNode"
,
"//PrimaryCmpNode"
)
def
m_unicode_literal
(
Py_UNICODE
a
):
...
...
@@ -154,6 +159,8 @@ def m_unicode_literal(Py_UNICODE a):
1
>>> m_unicode_literal(ord('X'))
0
>>> m_unicode_literal(ord(py_klingon_character))
1
"""
cdef
int
result
=
a
in
u'abcdefg
\
u1234
\
uF8D2
'
return
result
...
...
tests/run/notinop.pyx
View file @
3164f42f
...
...
@@ -121,15 +121,27 @@ def m_bytes_literal(char a):
return
result
cdef
unicode
unicode_string
=
u'abcdefg
\
u1234
\
uF8D2
'
py_unicode_string
=
unicode_string
cdef
unicode
klingon_character
=
u'
\
uF8D2
'
py_klingon_character
=
klingon_character
@
cython
.
test_assert_path_exists
(
"//PrimaryCmpNode"
)
@
cython
.
test_fail_if_path_exists
(
"//SwitchStatNode"
,
"//BoolBinopNode"
)
def
m_unicode
(
Py_UNICODE
a
):
def
m_unicode
(
Py_UNICODE
a
,
unicode
unicode_string
):
"""
>>> m_unicode(ord('f'))
>>> m_unicode(ord('f')
, py_unicode_string
)
0
>>> m_unicode(ord('X'))
>>> m_unicode(ord('X')
, py_unicode_string
)
1
>>> m_unicode(ord(py_klingon_character), py_unicode_string)
0
>>> 'f' in None
Traceback (most recent call last):
TypeError: argument of type 'NoneType' is not iterable
>>> m_unicode(ord('f'), None)
Traceback (most recent call last):
TypeError: argument of type 'NoneType' is not iterable
"""
cdef
int
result
=
a
not
in
unicode_string
return
result
...
...
@@ -142,6 +154,8 @@ def m_unicode_literal(Py_UNICODE a):
0
>>> m_unicode_literal(ord('X'))
1
>>> m_unicode_literal(ord(py_klingon_character))
0
"""
cdef
int
result
=
a
not
in
u'abcdefg
\
u1234
\
uF8D2
'
return
result
...
...
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