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

« back to all changes in this revision

Viewing changes to tests/run/cdef_setitem_T284.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
>>> no_cdef()
 
3
>>> with_cdef()
 
4
>>> test_list(list(range(11)), -2, None)
 
5
[0, 1, 2, 3, 4, 5, 6, 7, 8, None, 10]
 
6
>>> test_list(list(range(11)), "invalid index", None) #doctest: +ELLIPSIS
 
7
Traceback (most recent call last):
 
8
...
 
9
TypeError: list indices must be integers...
 
10
'''
 
11
def no_cdef():
 
12
    lst = list(range(11))
 
13
    ob = 10L
 
14
    lst[ob] = -10
 
15
    dd = {}
 
16
    dd[ob] = -10
 
17
 
 
18
def with_cdef():
 
19
    cdef list lst = list(range(11))
 
20
    ob = 10L
 
21
    lst[ob] = -10
 
22
    cdef dict dd = {}
 
23
    dd[ob] = -10
 
24
 
 
25
def test_list(list L, object i, object a):
 
26
    L[i] = a
 
27
    return L