8
8
extract_documentation )
9
9
from tests .bearlib .languages .documentation .TestUtils import (
10
10
load_testdata )
11
- from coalib .results .TextRange import TextRange
11
+ from coalib .results .TextPosition import TextPosition
12
12
13
13
14
14
class DocumentationExtractionTest (unittest .TestCase ):
@@ -33,7 +33,7 @@ def test_extract_documentation_C(self):
33
33
' @returns Your favorite number.\n ' ),
34
34
docstyle_C_doxygen , '' ,
35
35
docstyle_C_doxygen .markers [0 ],
36
- TextRange . from_values (3 , 1 , 7 , 4 )),
36
+ TextPosition (3 , 1 )),
37
37
DocumentationComment (
38
38
('\n '
39
39
' Preserves alignment\n '
@@ -42,21 +42,21 @@ def test_extract_documentation_C(self):
42
42
' - sub sub item\n ' ),
43
43
docstyle_C_doxygen , '' ,
44
44
docstyle_C_doxygen .markers [2 ],
45
- TextRange . from_values (15 , 1 , 20 , 4 )),
45
+ TextPosition (15 , 1 )),
46
46
DocumentationComment (
47
47
(' ABC\n '
48
48
' Another type of comment\n '
49
49
'\n '
50
50
' ...' ),
51
51
docstyle_C_doxygen , '' ,
52
52
docstyle_C_doxygen .markers [1 ],
53
- TextRange . from_values (23 , 1 , 26 , 11 )),
53
+ TextPosition (23 , 1 )),
54
54
DocumentationComment (
55
55
(' foobar = barfoo.\n '
56
56
' @param x whatever...\n ' ),
57
57
docstyle_C_doxygen , '' ,
58
58
docstyle_C_doxygen .markers [0 ],
59
- TextRange . from_values (28 , 1 , 30 , 4 )))
59
+ TextPosition (28 , 1 )))
60
60
61
61
self .assertEqual (tuple (
62
62
extract_documentation (data , 'C' , 'doxygen' )),
@@ -72,7 +72,7 @@ def test_extract_documentation_C_2(self):
72
72
[DocumentationComment (' my main description\n continues here' ,
73
73
docstyle_C_doxygen , '' ,
74
74
docstyle_C_doxygen .markers [0 ],
75
- TextRange . from_values (1 , 1 , 2 , 21 ))])
75
+ TextPosition (1 , 1 ))])
76
76
77
77
def test_extract_documentation_CPP (self ):
78
78
data = load_testdata ('data.cpp' )
@@ -91,23 +91,23 @@ def test_extract_documentation_CPP(self):
91
91
' Or any other number.\n ' ),
92
92
docstyle_CPP_doxygen , '' ,
93
93
docstyle_CPP_doxygen .markers [0 ],
94
- TextRange . from_values (4 , 1 , 8 , 4 )),
94
+ TextPosition (4 , 1 )),
95
95
DocumentationComment (
96
96
(' foobar\n '
97
97
' @param xyz\n ' ),
98
98
docstyle_CPP_doxygen , '' ,
99
99
docstyle_CPP_doxygen .markers [0 ],
100
- TextRange . from_values (15 , 1 , 17 , 4 )),
100
+ TextPosition (15 , 1 )),
101
101
DocumentationComment (
102
102
' Some alternate style of documentation\n ' ,
103
103
docstyle_CPP_doxygen , '' ,
104
104
docstyle_CPP_doxygen .markers [4 ],
105
- TextRange . from_values (22 , 1 , 23 , 1 )),
105
+ TextPosition (22 , 1 )),
106
106
DocumentationComment (
107
107
' ends instantly' ,
108
108
docstyle_CPP_doxygen , '\t ' ,
109
109
docstyle_CPP_doxygen .markers [0 ],
110
- TextRange . from_values (26 , 2 , 26 , 23 )),
110
+ TextPosition (26 , 2 )),
111
111
DocumentationComment (
112
112
(' Should work\n '
113
113
'\n '
@@ -116,7 +116,7 @@ def test_extract_documentation_CPP(self):
116
116
' @param foo WHAT PARAM PLEASE!?\n ' ),
117
117
docstyle_CPP_doxygen , '' ,
118
118
docstyle_CPP_doxygen .markers [4 ],
119
- TextRange . from_values (32 , 1 , 37 , 1 ))))
119
+ TextPosition (32 , 1 ))))
120
120
121
121
def test_extract_documentation_CPP_2 (self ):
122
122
data = load_testdata ('data2.cpp' )
@@ -129,7 +129,7 @@ def test_extract_documentation_CPP_2(self):
129
129
' hello world\n ' ),
130
130
docstyle_CPP_doxygen , '' ,
131
131
docstyle_CPP_doxygen .markers [0 ],
132
- TextRange . from_values (1 , 1 , 3 , 4 )),))
132
+ TextPosition (1 , 1 )),))
133
133
134
134
def test_extract_documentation_PYTHON3 (self ):
135
135
data = load_testdata ('data.py' )
@@ -145,19 +145,19 @@ def test_extract_documentation_PYTHON3(self):
145
145
'Some more foobar-like text.\n ' ),
146
146
docstyle_PYTHON3_default , '' ,
147
147
docstyle_PYTHON3_default .markers [0 ],
148
- TextRange . from_values (1 , 1 , 5 , 4 )),
148
+ TextPosition (1 , 1 )),
149
149
DocumentationComment (
150
150
('\n '
151
151
'A nice and neat way of documenting code.\n '
152
152
':param radius: The explosion radius.\n ' ),
153
153
docstyle_PYTHON3_default , ' ' * 4 ,
154
154
docstyle_PYTHON3_default .markers [0 ],
155
- TextRange . from_values (8 , 5 , 11 , 8 )),
155
+ TextPosition (8 , 5 )),
156
156
DocumentationComment (
157
157
'\n A function that returns 55.\n ' ,
158
158
docstyle_PYTHON3_default , ' ' * 8 ,
159
159
docstyle_PYTHON3_default .markers [0 ],
160
- TextRange . from_values (13 , 9 , 15 , 12 )),
160
+ TextPosition (13 , 9 )),
161
161
DocumentationComment (
162
162
('\n '
163
163
'Docstring with layouted text.\n '
@@ -167,28 +167,28 @@ def test_extract_documentation_PYTHON3(self):
167
167
'this is intended.\n ' ),
168
168
docstyle_PYTHON3_default , '' ,
169
169
docstyle_PYTHON3_default .markers [0 ],
170
- TextRange . from_values (19 , 1 , 24 , 4 )),
170
+ TextPosition (19 , 1 )),
171
171
DocumentationComment (
172
172
(' Docstring directly besides triple quotes.\n '
173
173
' Continues here. ' ),
174
174
docstyle_PYTHON3_default , '' ,
175
175
docstyle_PYTHON3_default .markers [0 ],
176
- TextRange . from_values (26 , 1 , 27 , 24 )),
176
+ TextPosition (26 , 1 )),
177
177
DocumentationComment (
178
178
('super\n '
179
179
' nicely\n '
180
180
'short' ),
181
181
docstyle_PYTHON3_default , '' ,
182
182
docstyle_PYTHON3_default .markers [0 ],
183
- TextRange . from_values (40 , 1 , 42 , 9 )),
183
+ TextPosition (40 , 1 )),
184
184
DocumentationComment (
185
185
('\n '
186
186
'A bad indented docstring\n '
187
187
' Improper indentation.\n '
188
188
':param impact: The force of Impact.\n ' ),
189
189
docstyle_PYTHON3_default , ' ' * 4 ,
190
190
docstyle_PYTHON3_default .markers [0 ],
191
- TextRange . from_values (45 , 5 , 49 , 8 )),
191
+ TextPosition (45 , 5 )),
192
192
)
193
193
194
194
self .assertEqual (
@@ -200,7 +200,7 @@ def test_extract_documentation_PYTHON3(self):
200
200
docstyle_PYTHON3_doxygen ,
201
201
r .indent ,
202
202
r .marker ,
203
- r .range )
203
+ r .position )
204
204
for r in expected )
205
205
206
206
expected .insert (5 , DocumentationComment (
@@ -211,7 +211,7 @@ def test_extract_documentation_PYTHON3(self):
211
211
'\n ' ),
212
212
docstyle_PYTHON3_doxygen , '' ,
213
213
docstyle_PYTHON3_doxygen .markers [1 ],
214
- TextRange . from_values (30 , 1 , 35 , 1 )))
214
+ TextPosition (30 , 1 )))
215
215
216
216
self .assertEqual (
217
217
list (extract_documentation (data , 'PYTHON3' , 'doxygen' )),
@@ -228,7 +228,7 @@ def test_extract_documentation_PYTHON3_2(self):
228
228
[DocumentationComment (' documentation in single line ' ,
229
229
docstyle_PYTHON3_default , '' ,
230
230
docstyle_PYTHON3_default .markers [0 ],
231
- TextRange . from_values (2 , 1 , 2 , 38 ))])
231
+ TextPosition (2 , 1 ))])
232
232
233
233
def test_extract_documentation_PYTHON3_3 (self ):
234
234
data = ['## documentation in single line without return at end.' ]
@@ -242,7 +242,7 @@ def test_extract_documentation_PYTHON3_3(self):
242
242
'return at end.' ,
243
243
docstyle_PYTHON3_doxygen , '' ,
244
244
docstyle_PYTHON3_doxygen .markers [1 ],
245
- TextRange . from_values (1 , 1 , 1 , 55 ))])
245
+ TextPosition (1 , 1 ))])
246
246
247
247
def test_extract_documentation_PYTHON3_4 (self ):
248
248
data = ['\n ' , 'triple_quote_string_test = """\n ' ,
0 commit comments