File: extpropertyref.pyx

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (47 lines) | stat: -rw-r--r-- 959 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# cython: autotestdict=True

cdef class Spam:

    property eggs:

        def __get__(self):
            """
            This is the docstring for Spam.eggs.__get__

            >>> True
            True
            """
            return 42

def tomato():
    """
    >>> tomato()
    42

    >>> lines = __test__.keys()
    >>> len(lines)
    3
    >>> 'Spam.eggs.__get__ (line 7)' in lines or lines
    True
    >>> 'tomato (line 16)' in lines or lines
    True
    """
    cdef Spam spam
    cdef object lettuce
    spam = Spam()
    lettuce = spam.eggs
    return lettuce

cdef class Bacon(object):
    cdef object number_of_slices
    cdef public object is_a_vegetable

def breakfast():
    """
    >>> breakfast()
    """
    cdef Bacon myslices = Bacon()
    myslices.is_a_vegetable = True
    assert myslices.is_a_vegetable, myslices.is_a_vegetable
    del myslices.is_a_vegetable
    assert myslices.is_a_vegetable is None, myslices.is_a_vegetable