[issue21740] doctest doesn't allow duck-typing callables

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue21740] doctest doesn't allow duck-typing callables

2014-12-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 12ef799a9a51 by Zachary Ware in branch 'default':
Issue #21740: Fix module name in NEWS entry.
https://hg.python.org/cpython/rev/12ef799a9a51

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d22ca7496c54 by Yury Selivanov in branch 'default':
Issue #21740: Support wrapped callables in pydoc. Patch by Claudiu Popa.
https://hg.python.org/cpython/rev/d22ca7496c54

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-12-08 Thread Yury Selivanov

Yury Selivanov added the comment:

Thank you for the patch, Claudiu!

--
nosy: +yselivanov
resolution:  - fixed
stage: patch review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-08-25 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage: needs patch - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-07-28 Thread Yoann Aubineau

Changes by Yoann Aubineau yoann.aubin...@gmail.com:


--
nosy: +yaubi

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-07-03 Thread Claudiu Popa

Claudiu Popa added the comment:

Here's a test patch which uses inspect.unwrap. Unfortunately, I can't test with 
numba, so I don't know if it works for that, but any decorated function which 
uses `functools.update_wrapper` or `wraps` should be detected by doctest.

--
keywords: +patch
Added file: http://bugs.python.org/file35838/issue21740.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-06-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I'm not sure, because it would also select classes.

 Is there any reason to preclude classes?  They could reasonably have 
 docstrings that contain doctests.

I don't know. I just didn't want to change doctest behaviour too much, 
but if people more knowledgeable than me about it feel it's ok, then all 
the better.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-06-29 Thread Guido van Rossum

Guido van Rossum added the comment:

Class doctests are already supported separately, see 
https://docs.python.org/3/library/doctest.html#which-docstrings-are-examined

--
nosy: +Guido.van.Rossum

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-06-20 Thread Claudiu Popa

Claudiu Popa added the comment:

How about using this?

diff -r 1e74350dd056 Lib/doctest.py
--- a/Lib/doctest.pyTue Jun 17 22:27:46 2014 -0500
+++ b/Lib/doctest.pyFri Jun 20 11:08:00 2014 +0300
@@ -984,7 +984,8 @@
 for valname, val in obj.__dict__.items():
 valname = '%s.%s' % (name, valname)
 # Recurse to functions  classes.
-if ((inspect.isroutine(val) or inspect.isclass(val)) and
+
+if ((inspect.isroutine(inspect.unwrap(val)) or 
inspect.isclass(val)) and
 self._from_module(module, val)):
 self._find(tests, val, valname, module, source_lines,
globs, seen)

This seems to work for the given example and if the decorator uses 
update_wrapper or @wraps.

--
nosy: +Claudiu.Popa

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-06-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 I'm not sure, because it would also select classes. 

Is there any reason to preclude classes?  They could reasonably have docstrings 
that contain doctests.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-06-19 Thread Ezio Melotti

Ezio Melotti added the comment:

Would using callable() instead of inspect.isfunction() be ok?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-06-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Ezio Melotti added the comment:

 Would using callable() instead of inspect.isfunction() be ok?

I'm not sure, because it would also select classes. I guess we need 
something a bit smarter.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21740] doctest doesn't allow duck-typing callables

2014-06-12 Thread Antoine Pitrou

New submission from Antoine Pitrou:

doctest uses inspect.isfunction() to detect callable objects on which to detect 
docstrings. Unfortunately, this prevents running doctests on functions which 
have been decorated to return other types of callables (for example numba's 
@jit decorator). In the attached example file, the wrapped bar function does 
not have its doctest executed.

It would be useful for doctest to be more flexible here, although I'm not sure 
what the exact criterion should be.

--
components: Library (Lib)
files: ducktest.py
messages: 220384
nosy: ezio.melotti, gvanrossum, michael.foord, pitrou, r.david.murray, 
rhettinger, tim.peters
priority: normal
severity: normal
stage: needs patch
status: open
title: doctest doesn't allow duck-typing callables
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file35601/ducktest.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21740
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com