Issue recognizing my docstring
See original GitHub issueFor the following docstring I get an error:
def logTraceback(logFunction):
r''' Logs the exception traceback to the specified log function.
>>> try: raise Exception() # doctest: +ELLIPSIS
... except Exception: logTraceback(lambda *a, **b: sys.stdout.write(a[0] + "\n", *a[1:], **b))
Traceback (most recent call last):
...
Exception
...
'''
# here is the code
Error:
running 62 test(s)
====== <exec> ======
* DOCTEST : D:\forks\HACE\autocook\autocook\base.py::logTraceback:0, line 21 <- wrt source file
DOCTEST SOURCE
1 >>> try: raise Exception() # doctest: +ELLIPSIS
2 ... except Exception: logTraceback(lambda *a, **b: sys.stdout.write(a[0] + "\n", *a[1:], **b))
Traceback (most recent call last):
...
Exception
...
DOCTEST STDOUT/STDERR
Traceback (most recent call last):
File "d:\apps\Miniforge3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\apps\Miniforge3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "d:\apps\Miniforge3\lib\site-packages\xdoctest\__main__.py", line 172, in <module>
retcode = main()
File "d:\apps\Miniforge3\lib\site-packages\xdoctest\__main__.py", line 160, in main
run_summary = xdoctest.doctest_module(modname, argv=[command], style=style,
File "d:\apps\Miniforge3\lib\site-packages\xdoctest\runner.py", line 302, in doctest_module
run_summary = _run_examples(enabled_examples, verbose, config,
File "d:\apps\Miniforge3\lib\site-packages\xdoctest\runner.py", line 465, in _run_examples
summary = example.run(verbose=verbose, on_error=on_error)
File "d:\apps\Miniforge3\lib\site-packages\xdoctest\doctest_example.py", line 612, in run
code = compile(
File "<doctest:D:\forks\HACE\autocook\autocook\base.py::logTraceback:0>", line 2
except Exception: logTraceback(lambda *a, **b: sys.stdout.write(a[0] + "\n", *a[1:], **b))
^
SyntaxError: unexpected EOF while parsing
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
python docstrings not working? - Stack Overflow
Python's help() function tries to, in your case, execute the more command. It should look something like this, when more is installed: > ......
Read more >Docparams does not recognize class docstring when placed ...
The documentation states that "Constructor parameters can be documented in either the class docstring or the init docstring, but not both.
Read more >Python Docstrings Tutorial : Examples & Format for Pydoc ...
See Python Docstrings. Learn about the different types of docstrings & various docstring formats like Sphinx, Numpy, and Pydoc with examples now.
Read more >Troubleshooting - mkdocstrings
For Python code, check the supported docstring styles page. Re-run the Mkdocs command with -v , and carefully read any traceback.
Read more >Specify types with docstrings | PyCharm Documentation
To specify the parameter types, follow these general steps · Press Ctrl+Alt+S and go to Editor | General |Smart Keys. · Place the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks, great work! I can finally see
xdoctest
do a full run through all detected doctests, in beautiful color with helpful highlights!This should be fixed in the released 0.15.9. Please let me know if there is still an issue.