[issue34445] asyncio support in doctests

2018-08-30 Thread Stefan Tjarks


Stefan Tjarks  added the comment:

Thanks Grant! I expected that I am missing something.

You are right that I could have posted in many places to get help about this. 
Before posting I tried to find a doctest for asyncio but my google magic failed 
me. At the end I just felt that, at the very least, the bug tracker would show 
that the doctest documentation could be updated to cover this.

That doctest emulate a Python shell helps me understand its limitations a bit 
more.

--
resolution:  -> not a bug

___
Python tracker 
<https://bugs.python.org/issue34445>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34445] asyncio support in doctests

2018-08-20 Thread Stefan Tjarks


New submission from Stefan Tjarks :

When writing a docstring for an async function I wrote a doctest for it.

```
async def hello_world():
"""
Will great the world with a friendly hello.

>>> await hello_world()
"hello world"
"""
return "hello world"
```

I kind of expected an error that no event loop is running but actually get a 
SyntaxError.

```
**
File "asyncdoctest.py", line 5, in __main__.hello_world
Failed example:
await hello_world()
Exception raised:
Traceback (most recent call last):
  File "/usr/lib/python3.6/doctest.py", line 1330, in __run
compileflags, 1), test.globs)
  File "", line 1
await hello_world()
^
SyntaxError: invalid syntax
**
1 items had failures:
   1 of   1 in __main__.hello_world
***Test Failed*** 1 failures.
```

Is the SyntaxError intentional or does doctest simply not support asyncio 
syntax?

------
components: Library (Lib), asyncio
files: asyncdoctest.py
messages: 323803
nosy: Stefan Tjarks, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio support in doctests
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file47756/asyncdoctest.py

___
Python tracker 
<https://bugs.python.org/issue34445>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com