Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / astroid / tests / testdata / python2 / data / module.py @ 745

History | View | Annotate | Download (1.76 KB)

1
"""test module for astroid
2
"""
3

    
4
__revision__ = '$Id: module.py,v 1.2 2005-11-02 11:56:54 syt Exp $'
5
from astroid.node_classes import Name as NameNode
6
from astroid import modutils
7
from astroid.utils import *
8
import os.path
9
MY_DICT = {}
10

    
11
def global_access(key, val):
12
    """function test"""
13
    local = 1
14
    MY_DICT[key] = val
15
    for i in val:
16
        if i:
17
            del MY_DICT[i]
18
            continue
19
        else:
20
            break
21
    else:
22
        return local
23

    
24

    
25
class YO:
26
    """hehe"""
27
    a = 1
28
    
29
    def __init__(self):
30
        try:
31
            self.yo = 1
32
        except ValueError, ex:
33
            pass
34
        except (NameError, TypeError):
35
            raise XXXError()
36
        except:
37
            raise
38

    
39

    
40

    
41
class YOUPI(YO):
42
    class_attr = None
43
    
44
    def __init__(self):
45
        self.member = None
46
    
47
    def method(self):
48
        """method test"""
49
        global MY_DICT
50
        try:
51
            MY_DICT = {}
52
            local = None
53
            autre = [a for (a, b) in MY_DICT if b]
54
            if b in autre:
55
                return b
56
            else:
57
                if a in autre:
58
                    return a
59
            global_access(local, val=autre)
60
        finally:
61
            return local
62
    
63
    def static_method():
64
        """static method test"""
65
        assert MY_DICT, '???'
66
    static_method = staticmethod(static_method)
67
    
68
    def class_method(cls):
69
        """class method test"""
70
        exec a in b
71
    class_method = classmethod(class_method)
72

    
73

    
74
def four_args(a, b, c, d):
75
    """four arguments (was nested_args)"""
76
    pass
77
    while 1:
78
        if a:
79
            break
80
        a += +1
81
    else:
82
        b += -2
83
    if c:
84
        d = ((a) and (b)) or (c)
85
    else:
86
        c = ((a) and (b)) or (d)
87
    map(lambda x, y: (y, x), a)
88
redirect = four_args
89