~ubuntu-branches/ubuntu/precise/cython/precise

« back to all changes in this revision

Viewing changes to tests/run/slice_charptr.pyx

  • Committer: Bazaar Package Importer
  • Author(s): Python Applications Packaging Team, Ryan Kavanagh, Jakub Wilk, Piotr Ożarowski
  • Date: 2009-08-10 23:18:51 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090810231851-i6f7mr1ij1h2czkp
Tags: 0.11.2-1
[ Ryan Kavanagh ]
* New upstream release (Closes: #525620, #536213)

[ Jakub Wilk ]
* debian/rules: remove generated files.

[ Piotr Ożarowski ]
* Standards-Version bumped to 3.8.2 (no change needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
__doc__ = u"""
 
2
    >>> do_slice(b'abcdef', 2, 3)
 
3
    (b'c', b'cdef', b'ab', b'abcdef')
 
4
    >>> do_slice(b'abcdef', 0, 5)
 
5
    (b'abcde', b'abcdef', b'', b'abcdef')
 
6
"""
 
7
 
 
8
import sys
 
9
 
 
10
if sys.version_info[0] < 3:
 
11
    __doc__ = __doc__.replace(u"(b'", u"('").replace(u" b'", u" '")
 
12
 
 
13
def do_slice(s, int i, int j):
 
14
    cdef char* ss = s
 
15
    return ss[i:j], ss[i:], ss[:i], ss[:]
 
16