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
Kirill Smelkov
cython
Commits
d1cc779e
Commit
d1cc779e
authored
Feb 23, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add constant folding test for sliced unicode and bytes literals
parent
97503e02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
tests/run/constant_folding_cy.pyx
tests/run/constant_folding_cy.pyx
+55
-0
No files found.
tests/run/constant_folding_cy.pyx
0 → 100644
View file @
d1cc779e
# coding=utf8
# mode: run
# tag: constant_folding
cimport
cython
bstring
=
b'abc
\
xE9
def'
ustring
=
u'abc
\
xE9
def'
@
cython
.
test_fail_if_path_exists
(
"//SliceIndexNode"
,
)
def
bytes_slicing2
():
"""
>>> a,b,c,d = bytes_slicing2()
>>> a == bstring[:]
True
>>> b == bstring[2:]
True
>>> c == bstring[:4]
True
>>> d == bstring[2:4]
True
"""
str0
=
b'abc
\
xE9
def'
[:]
str1
=
b'abc
\
xE9
def'
[
2
:]
str2
=
b'abc
\
xE9
def'
[:
4
]
str3
=
b'abc
\
xE9
def'
[
2
:
4
]
return
str0
,
str1
,
str2
,
str3
@
cython
.
test_fail_if_path_exists
(
"//SliceIndexNode"
,
)
def
unicode_slicing2
():
"""
>>> a,b,c,d = unicode_slicing2()
>>> a == ustring[:]
True
>>> b == ustring[2:]
True
>>> c == ustring[:4]
True
>>> d == ustring[2:4]
True
"""
str0
=
u'abc
\
xE9
def'
[:]
str1
=
u'abc
\
xE9
def'
[
2
:]
str2
=
u'abc
\
xE9
def'
[:
4
]
str3
=
u'abc
\
xE9
def'
[
2
:
4
]
return
str0
,
str1
,
str2
,
str3
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