File tree Expand file tree Collapse file tree 5 files changed +12
-12
lines changed
tests/unit/strictdoc/backend/sdoc_source_code/readers Expand file tree Collapse file tree 5 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 1
- # mypy: disable-error-code="no-untyped-call,no-untyped-def"
2
1
from typing import Any
3
2
4
3
from strictdoc .helpers .auto_described import auto_described
Original file line number Diff line number Diff line change @@ -312,8 +312,9 @@ def read(
312
312
function_name
313
313
] = new_function
314
314
elif node_ .type == "comment" :
315
- if node_ .text is None :
316
- raise NotImplementedError ("Comment without a text" )
315
+ assert node_ .text is not None , (
316
+ f"Comment without a text: { node_ } "
317
+ )
317
318
318
319
node_text_string = node_ .text .decode ("utf8" )
319
320
@@ -335,7 +336,7 @@ def read(
335
336
):
336
337
line_marker_processor (line_marker_ , parse_context )
337
338
else :
338
- continue
339
+ pass
339
340
else :
340
341
pass
341
342
Original file line number Diff line number Diff line change @@ -216,8 +216,9 @@ def read(
216
216
function_markers
217
217
)
218
218
elif node_ .type == "comment" :
219
- if node_ .text is None :
220
- raise NotImplementedError ("Comment without a text" )
219
+ assert node_ .text is not None , (
220
+ f"Comment without a text: { node_ } "
221
+ )
221
222
222
223
node_text_string = node_ .text .decode ("utf8" )
223
224
@@ -240,7 +241,7 @@ def read(
240
241
):
241
242
line_marker_processor (line_marker , parse_context )
242
243
else :
243
- continue
244
+ pass
244
245
else :
245
246
pass
246
247
Original file line number Diff line number Diff line change 3
3
# for simplicity.
4
4
__version__ = "0.0.1"
5
5
6
+ from typing import Any , Optional
7
+
6
8
7
9
# Maybe there is a better way to generate __str__ and __repr__.
8
10
# But for now, this solution works good enough:
9
11
# https://stackoverflow.com/a/33800620/598057
10
12
# https://stackoverflow.com/a/24617244/598057
11
- def auto_described (cls = None , str_and_repr = True ):
13
+ def auto_described (cls : Optional [ Any ] = None , str_and_repr : bool = True ):
12
14
def configure_class (clz ):
13
15
def __str__ (self ):
14
16
return auto_str (self )
Original file line number Diff line number Diff line change 8
8
from strictdoc .backend .sdoc_source_code .reader_c import (
9
9
SourceFileTraceabilityReader_C ,
10
10
)
11
- from strictdoc .backend .sdoc_source_code .reader_python import (
12
- SourceFileTraceabilityReader_Python ,
13
- )
14
11
15
12
pytestmark = pytest .mark .skipif (
16
13
sys .version_info < (3 , 9 ), reason = "Requires Python 3.9 or higher"
20
17
def test_00_empty_file ():
21
18
input_string = b""""""
22
19
23
- reader = SourceFileTraceabilityReader_Python ()
20
+ reader = SourceFileTraceabilityReader_C ()
24
21
25
22
info = reader .read (input_string )
26
23
You can’t perform that action at this time.
0 commit comments