[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2019-12-31 Thread Jurjen N.E. Bos


Jurjen N.E. Bos  added the comment:

All is fixed. The PR apparently is correct.
My first dent in the Python universe, however small :-)

--

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2019-12-10 Thread Jurjen N.E. Bos


Jurjen N.E. Bos  added the comment:

I tried to make a pull request, but it fails on the format of news file name.
At least the tests all pass.

--

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2019-12-10 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +17027
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/17553

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2019-01-22 Thread Jurjen N.E. Bos


Jurjen N.E. Bos  added the comment:

Yes. That would make me happy. In the meantime I learned how to use git, so 
maybe I'll do the pull request myself next time. Thanks for the work.

--

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2019-01-22 Thread Nasir Hussain


Nasir Hussain  added the comment:

Hi, Should I convert patch into PR?
Thanks

--
nosy: +nasirhjafri

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2018-11-26 Thread R. David Murray


R. David Murray  added the comment:

Without looking at doctest.py, yes.  I believe the doctests in that file should 
be already plugged in to the unittest framework, so adding new testcase 
containing a non-doctest unit test should work fine.

--

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2018-11-22 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

Hey  R. David Murray,

Where do you think the unit test for `doctest` should be placed? 

Should it be in `test_doctest.py`?

--
assignee:  -> CuriousLearner
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2018-03-26 Thread Sanyam Khurana

Sanyam Khurana  added the comment:

Hey Jurjen,

Do you mind converting your patch in a Pull request please?

--
nosy: +CuriousLearner

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2018-03-13 Thread Jurjen N.E. Bos

Jurjen N.E. Bos  added the comment:

Oh wait, I already posted that so long ago I forgot about it.
Oops.
Sorry about the repetition, folks.
- Jurjen

--

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2018-03-13 Thread Jurjen N.E. Bos

Jurjen N.E. Bos  added the comment:

I always use the following piece of code that can be trivially used to patch 
the source.
It basically looks for a using line in the test string and finds it in the 
source file. If there is a match, we know where we are. Otherwise it falls back 
to the "normal" way.

--
Added file: https://bugs.python.org/file47482/doctestfix.py

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2015-11-03 Thread John Mark Vandenberg

Changes by John Mark Vandenberg :


--
nosy: +John.Mark.Vandenberg

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2015-10-22 Thread Jurjen N.E. Bos

Jurjen N.E. Bos added the comment:

Oops. Lousy editing, I should have used return instead of break.

These 6 lines can be inserted in lib/doctest at line 1100:
+if isinstance(obj, str) and source_lines is not None:
+# This will find __test__ string doctests if and only if the string
+# contains any unique line.
+for offset,line in enumerate(obj.splitlines(keepends=True):
+if source_lines.count(line)==1:
+return source_lines.index(line)-offset

And it works fine for me; the code is quite general and has predictable 
behaviour: any test string with a unique line in it will work.

--

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2015-10-22 Thread Jurjen N.E. Bos

Jurjen N.E. Bos added the comment:

I am not as good in making nice patches, but that code can be improved upon a 
bit as follows:


+if isinstance(obj, str) and source_lines is not None:
+# This will find __test__ string doctests if and only if the string
+# contains any unique line.
+for offset,line in enumerate(obj.splitlines(keepends=True):
+if source_lines.count(line)==1:
+lineno = source_lines.index(line)-offset
+break

 # We couldn't find the line number.
 return None


I thing this will improve legibility and probably also speed under most 
circumstances.

--
nosy: +jneb

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2015-08-24 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


Removed file: http://bugs.python.org/file40241/doctest_find__test__.patch

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2015-08-24 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


Added file: http://bugs.python.org/file40242/doctest_find__test__.patch

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