Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-12 Thread Edward K. Ream
On Sunday, January 12, 2020 at 8:18:42 AM UTC-5, Edward K. Ream wrote: > > > > On Sat, Jan 11, 2020 at 2:11 PM Brian Theado > wrote: > > > I have doubts about the following entries you are suppressing: assert, > except, raise. > > Imo, they are fine. Assert signal that something is seriously

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-12 Thread Brian Theado
Oops accidentally hit send when I was pasting in the two examples. Here is the other one: else: # Some fields contain ints or strings. assert isinstance(z, (int, str)), z.__class__.__name__ On Sun, Jan 12, 2020 at 9:49 AM Brian Theado

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-12 Thread Brian Theado
On Sun, Jan 12, 2020 at 8:18 AM Edward K. Ream wrote: > > > On Sat, Jan 11, 2020 at 2:11 PM Brian Theado > wrote: > > > I have doubts about the following entries you are suppressing: assert, > except, raise. > > Imo, they are fine. Assert signal that something is seriously wrong with > the

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-12 Thread Edward K. Ream
On Sat, Jan 11, 2020 at 2:11 PM Brian Theado wrote: > I have doubts about the following entries you are suppressing: assert, except, raise. Imo, they are fine. Assert signal that something is seriously wrong with the tool, not the user input. In addition to providing coverage data, pytest is

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-11 Thread Brian Theado
On Fri, Jan 10, 2020 at 8:33 AM Edward K. Ream wrote: > > I still think full line-by-line coverage analysis will be very valuable. >> >> I agree. I have just created #1474 >> for this. >> > > Many thanks for suggesting this. `pytest --cov`

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-10 Thread Edward K. Ream
On Thursday, January 9, 2020 at 6:04:20 AM UTC-5, Edward K. Ream wrote: > > On Tue, Jan 7, 2020 at 1:24 PM Brian Theado > wrote: > > > I still think full line-by-line coverage analysis will be very valuable. > > I agree. I have just created #1474 >

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-09 Thread Brian Theado
On Thu, Jan 9, 2020 at 5:10 AM Edward K. Ream wrote: > On Wed, Jan 8, 2020 at 5:55 AM Brian Theado > wrote: > > > I often read unit tests in source code projects in the hope of finding > simple, concrete usage examples. These examples not only serve to test the > code, but also also

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-09 Thread Edward K. Ream
On Tue, Jan 7, 2020 at 1:24 PM Brian Theado wrote: > I still think full line-by-line coverage analysis will be very valuable. I agree. I have just created #1474 for this. Thanks for the detailed report. Edward -- You received this

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-09 Thread Edward K. Ream
​On Wed, Jan 8, 2020 at 5:55 AM Brian Theado wrote: ​> ​I often read unit tests in source code projects in the hope of finding simple, concrete usage examples. These examples not only serve to test the code, but also also documentation on how to use it. ​> ​But from that I don't see what the

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-09 Thread Edward K. Ream
On Tue, Jan 7, 2020 at 1:32 PM Brian Theado wrote: parse tree. >> The asserts in tog.sync_tokens suffice to create strong unit tests. > Maybe if I really want to understand, I can intentionally break the code in a few places and see how the failures work. Yes, that should work. The assert in

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-08 Thread Brian Theado
I've been thinking about this more and studying the code and reading some of your initial documentation. I often read unit tests in source code projects in the hope of finding simple, concrete usage examples. These examples not only serve to test the code, but also also documentation on how to

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-07 Thread Brian Theado
On Tue, Jan 7, 2020 at 5:01 AM Edward K. Ream wrote: > On Sunday, December 29, 2019 at 7:19:03 PM UTC-5, btheado wrote: > > I was looking at the tests in leoAst.py in the fstringify branch and I >> don't find any asserts in the tests themselves. >> > > The tests in the TestTOG are actually

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-07 Thread Brian Theado
On Sun, Dec 29, 2019 at 5:54 PM Edward K. Ream wrote: > On Sun, Dec 29, 2019 at 5:29 PM Brian Theado > wrote: > [...] > > You might also find the code coverage report useful: > > Yes, that's interesting. The TOG classes remember which visitors have > been visited, so that's probably enough. >

Re: #1467: Use traditional unit test (almost?) everywhere

2020-01-07 Thread Edward K. Ream
On Sunday, December 29, 2019 at 7:19:03 PM UTC-5, btheado wrote: I was looking at the tests in leoAst.py in the fstringify branch and I > don't find any asserts in the tests themselves. > The tests in the TestTOG are actually extremely strong. I have just added the following to the docstring

Re: #1467: Use traditional unit test (almost?) everywhere

2019-12-29 Thread Brian Theado
Edward, On Sun, Dec 29, 2019 at 5:54 PM Edward K. Ream wrote: [...] > > You might need to introduce failed tests in order to experience the > better assert failure reporting? > > Leo's existing unit tests use asserts. It's no big deal. > I was looking at the tests in leoAst.py in the

Re: #1467: Use traditional unit test (almost?) everywhere

2019-12-29 Thread Edward K. Ream
On Sun, Dec 29, 2019 at 5:29 PM Brian Theado wrote: > Your clone should work just as well. From the clone be sure you are on the pytest-experiment branch (git checkout pytest-experiment). That worked. Thanks. >> So I don't understand what difference pytest makes. What am I missing? >

Re: #1467: Use traditional unit test (almost?) everywhere

2019-12-29 Thread Brian Theado
Edward, On Sun, Dec 29, 2019 at 2:03 PM Edward K. Ream wrote: > On Saturday, December 28, 2019 at 10:44:39 AM UTC-5, btheado wrote: > > I've been experimenting lately writing pytest tests for leo. I just >> published my work at >> https://github.com/btheado/leo-editor/tree/pytest-experiment. >>

Re: #1467: Use traditional unit test (almost?) everywhere

2019-12-29 Thread Edward K. Ream
On Saturday, December 28, 2019 at 10:44:39 AM UTC-5, btheado wrote: I've been experimenting lately writing pytest tests for leo. I just > published my work at > https://github.com/btheado/leo-editor/tree/pytest-experiment. > > You should be able try it out with these commands (untested): > >

Re: #1467: Use traditional unit test (almost?) everywhere

2019-12-28 Thread Terry Brown
On Sat, 28 Dec 2019 02:17:06 -0800 (PST) "Edward K. Ream" wrote: > Bob's remarks yesterday about unit testing had me look at Leo's unit > testing framework with new eyes. > > #1467 suggest > using traditional unit tests everywhere, or

Re: #1467: Use traditional unit test (almost?) everywhere

2019-12-28 Thread Brian Theado
I've been experimenting lately writing pytest tests for leo. I just published my work at https://github.com/btheado/leo-editor/tree/pytest-experiment. You should be able try it out with these commands (untested): git origin add btheado https://github.com/btheado/leo-editor.git git checkout

Re: #1467: Use traditional unit test (almost?) everywhere

2019-12-28 Thread Edward K. Ream
On Saturday, December 28, 2019 at 6:07:03 AM UTC-5, vitalije wrote: For a long time I've been feeling that Leo unit tests don't prove anything. > They usually don't exercise real Leo code at all or if they do, they > exercise just a small portion of it. So, the fact that unit tests are >

Re: #1467: Use traditional unit test (almost?) everywhere

2019-12-28 Thread vitalije
This is a good idea. I suppose you don't plan to make a lot of changes in the test cases. But even without changing test cases this would be a big step forward. For a long time I've been feeling that Leo unit tests don't prove anything. They usually don't exercise real Leo code at all or if

#1467: Use traditional unit test (almost?) everywhere

2019-12-28 Thread Edward K. Ream
Bob's remarks yesterday about unit testing had me look at Leo's unit testing framework with new eyes. #1467 suggest using traditional unit tests everywhere, or maybe almost everywhere. Imo, this will be a significant improvement. I'll