PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/python/autodoc_runme.py

#
Python | 176 lines | 168 code | 8 blank | 0 comment | 1 complexity | f75ee435ddb3869e8421e5941dfaf73b MD5 | raw file
  1from autodoc import *
  2
  3def check(got, expected):
  4  if expected != got:
  5    raise RuntimeError("\n" + "Expected: [" + expected + "]\n" + "Got     : [" + got + "]")
  6
  7check(A.__doc__, "Proxy of C++ A class")
  8check(A.funk.__doc__, "just a string")
  9check(A.func0.__doc__, "func0(self, arg2, hello) -> int")
 10check(A.func1.__doc__, "func1(A self, short arg2, Tuple hello) -> int")
 11check(A.func2.__doc__,  "\n"
 12"        func2(self, arg2, hello) -> int\n"
 13"\n"
 14"        Parameters:\n"
 15"            arg2: short\n"
 16"            hello: int tuple[2]\n"
 17"\n"
 18"        "
 19)
 20check(A.func3.__doc__,  "\n"
 21"        func3(A self, short arg2, Tuple hello) -> int\n"
 22"\n"
 23"        Parameters:\n"
 24"            arg2: short\n"
 25"            hello: int tuple[2]\n"
 26"\n"
 27"        "
 28)
 29
 30check(A.func0default.__doc__, "\n"
 31"        func0default(self, e, arg3, hello, f=2) -> int\n"
 32"        func0default(self, e, arg3, hello) -> int\n"
 33"        "
 34)
 35check(A.func1default.__doc__, "\n"
 36"        func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
 37"        func1default(A self, A e, short arg3, Tuple hello) -> int\n"
 38"        "
 39)
 40check(A.func2default.__doc__,  "\n"
 41"        func2default(self, e, arg3, hello, f=2) -> int\n"
 42"\n"
 43"        Parameters:\n"
 44"            e: A *\n"
 45"            arg3: short\n"
 46"            hello: int tuple[2]\n"
 47"            f: double\n"
 48"\n"
 49"        func2default(self, e, arg3, hello) -> int\n"
 50"\n"
 51"        Parameters:\n"
 52"            e: A *\n"
 53"            arg3: short\n"
 54"            hello: int tuple[2]\n"
 55"\n"
 56"        "
 57)
 58check(A.func3default.__doc__,  "\n"
 59"        func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
 60"\n"
 61"        Parameters:\n"
 62"            e: A *\n"
 63"            arg3: short\n"
 64"            hello: int tuple[2]\n"
 65"            f: double\n"
 66"\n"
 67"        func3default(A self, A e, short arg3, Tuple hello) -> int\n"
 68"\n"
 69"        Parameters:\n"
 70"            e: A *\n"
 71"            arg3: short\n"
 72"            hello: int tuple[2]\n"
 73"\n"
 74"        "
 75)
 76
 77check(A.func0static.__doc__, "\n"
 78"        func0static(e, arg2, hello, f=2) -> int\n"
 79"        func0static(e, arg2, hello) -> int\n"
 80"        "
 81)
 82check(A.func1static.__doc__, "\n"
 83"        func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
 84"        func1static(A e, short arg2, Tuple hello) -> int\n"
 85"        "
 86)
 87check(A.func2static.__doc__,  "\n"
 88"        func2static(e, arg2, hello, f=2) -> int\n"
 89"\n"
 90"        Parameters:\n"
 91"            e: A *\n"
 92"            arg2: short\n"
 93"            hello: int tuple[2]\n"
 94"            f: double\n"
 95"\n"
 96"        func2static(e, arg2, hello) -> int\n"
 97"\n"
 98"        Parameters:\n"
 99"            e: A *\n"
100"            arg2: short\n"
101"            hello: int tuple[2]\n"
102"\n"
103"        "
104)
105check(A.func3static.__doc__,  "\n"
106"        func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
107"\n"
108"        Parameters:\n"
109"            e: A *\n"
110"            arg2: short\n"
111"            hello: int tuple[2]\n"
112"            f: double\n"
113"\n"
114"        func3static(A e, short arg2, Tuple hello) -> int\n"
115"\n"
116"        Parameters:\n"
117"            e: A *\n"
118"            arg2: short\n"
119"            hello: int tuple[2]\n"
120"\n"
121"        "
122)
123
124check(A.variable_a.__doc__, "A_variable_a_get(self) -> int")
125check(A.variable_b.__doc__, "A_variable_b_get(A self) -> int")
126check(A.variable_c.__doc__, "\n"
127"A_variable_c_get(self) -> int\n"
128"\n"
129"Parameters:\n"
130"    self: A *\n"
131"\n"
132)
133check(A.variable_d.__doc__, "\n"
134"A_variable_d_get(A self) -> int\n"
135"\n"
136"Parameters:\n"
137"    self: A *\n"
138"\n"
139)
140
141check(B.__doc__, "Proxy of C++ B class")
142check(C.__init__.__doc__, "__init__(self, a, b, h) -> C")
143check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D")
144check(E.__init__.__doc__, "\n"
145"        __init__(self, a, b, h) -> E\n"
146"\n"
147"        Parameters:\n"
148"            a: special comment for parameter a\n"
149"            b: another special comment for parameter b\n"
150"            h: enum Hola\n"
151"\n"
152"        "
153)
154check(F.__init__.__doc__, "\n"
155"        __init__(F self, int a, int b, Hola h) -> F\n"
156"\n"
157"        Parameters:\n"
158"            a: special comment for parameter a\n"
159"            b: another special comment for parameter b\n"
160"            h: enum Hola\n"
161"\n"
162"        "
163)
164
165check(B.funk.__doc__, "funk(B self, int c, int d) -> int")
166check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int")
167check(funkdefaults.__doc__, "\n"
168"    funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
169"    funkdefaults(A e, short arg2, int c, int d) -> int\n"
170"    "
171)
172
173check(func_input.__doc__, "func_input(int * INPUT) -> int")
174check(func_output.__doc__, "func_output() -> int")
175check(func_inout.__doc__, "func_inout(int * INOUT) -> int")
176check(banana.__doc__, "banana(S a, S b, int c, Integer d)")