Re: [Tutor] writing effective unittests

2013-01-11 Thread Prasad, Ramit
Japhy Bartlett wrote: > TDD is a good principle but usually seems a little too pedantic for real > world programming.  Where tests (in my > experience) get really useful is in making sure that a new change hasn't > unexpectedly broken something already > written. > I would argue that TDD is a p

Re: [Tutor] writing effective unittests

2013-01-09 Thread Wayne Werner
On Thu, 3 Jan 2013, Japhy Bartlett wrote: The general idea is to write tests that use your code in realistic ways and check the results.  So if you have a function that takes an input and returns a result, you write a test that passes that function an input checks the result.  If some inputs s

Re: [Tutor] writing effective unittests

2013-01-08 Thread Japhy Bartlett
The general idea is to write tests that use your code in realistic ways and check the results. So if you have a function that takes an input and returns a result, you write a test that passes that function an input checks the result. If some inputs should make it error, you write a test that chec

Re: [Tutor] writing effective unittests

2013-01-04 Thread Brian van den Broek
On 4 January 2013 03:34, Alan Gauld wrote: > On 04/01/13 07:10, Brian van den Broek wrote: > ... > >> confirm that the code works as intended when written, but that it >> continues to work several moths later > > > moths? They'll be the bugs I guess? > > Sorry I couldn't resist :-) :-) I shouldn

Re: [Tutor] writing effective unittests

2013-01-04 Thread Alan Gauld
On 04/01/13 07:10, Brian van den Broek wrote: ... confirm that the code works as intended when written, but that it continues to work several moths later moths? They'll be the bugs I guess? Sorry I couldn't resist :-) -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] writing effective unittests

2013-01-03 Thread Brian van den Broek
On 3 January 2013 14:46, Luke Thomas Mergner wrote: > * Albert-Jan Roskam wrote: > >> >> >> > Hi, >> >> > >> > I am trying to learn a bit of test-driven programming using unittests and >> > nosetests. I am having trouble finding resources that explain how to write >> > effective tests. I am not a

Re: [Tutor] writing effective unittests

2013-01-03 Thread Steven D'Aprano
Hi Luke, My responses inline below. On 04/01/13 06:46, Luke Thomas Mergner wrote: I am on the digest version of the list, so I haven't gotten a copy of any replies. All the more reason not to be on the digest version. But you should have received replies *in the digest*. (By the way, thank

Re: [Tutor] writing effective unittests

2013-01-03 Thread Alan Gauld
On 03/01/13 19:46, Luke Thomas Mergner wrote: What am I missing? The biggest problem is that no one is explaining the rationale behind testing. See my other reply and check out the references to programming by contract, pre/post conditions and invariants. Those are all good things to test. I

Re: [Tutor] writing effective unittests

2013-01-03 Thread Tino Dai
I think what I need is a conceptual shift: how do python programmers use > unittests? > > Here at the Library, we use unit test to test the cases that have many known inputs. For example, some of the data could come in "foo bar baz", and some others could come in as "foo, bar, baz", and others coul

Re: [Tutor] writing effective unittests

2013-01-03 Thread Luke Thomas Mergner
* Albert-Jan Roskam wrote: > > > > Hi, > > > > > I am trying to learn a bit of test-driven programming using unittests and > > nosetests. I am having trouble finding resources that explain how to write > > effective tests. I am not a programmer or a student, so I do not have > > access to

Re: [Tutor] writing effective unittests

2013-01-03 Thread Albert-Jan Roskam
> Hi, > > I am trying to learn a bit of test-driven programming using unittests and > nosetests. I am having trouble finding resources that explain how to write > effective tests. I am not a programmer or a student, so I do not have access > to > collegues or classes. I'm hoping that someon

Re: [Tutor] writing effective unittests

2013-01-03 Thread Peter Otten
Steven D'Aprano wrote: > Notice that tests are not necessarily definitive. I haven't tested that > spam(n) returns a string for every imaginable integer n, because there > are too many. Instead, I just test a small, representative sample. > > Likewise I haven't tested that spam() might succeed wh

Re: [Tutor] writing effective unittests

2013-01-02 Thread Steven D'Aprano
On 03/01/13 07:43, Luke Thomas Mergner wrote: Hi, I am trying to learn a bit of test-driven programming using unittests and nosetests. I am having trouble finding resources that explain how to write effective tests. I am not a programmer or a student, so I do not have access to collegues or clas

Re: [Tutor] writing effective unittests

2013-01-02 Thread Alan Gauld
On 02/01/13 20:43, Luke Thomas Mergner wrote: I am trying to learn a bit of test-driven programming using unittests and nosetests. Well done, thats a good idea. I am having trouble finding resources that explain how to write effective tests. Thee are whole books on the subject of testing.

[Tutor] writing effective unittests

2013-01-02 Thread Luke Thomas Mergner
Hi, I am trying to learn a bit of test-driven programming using unittests and nosetests. I am having trouble finding resources that explain how to write effective tests. I am not a programmer or a student, so I do not have access to collegues or classes. I'm hoping that someone knows of a good