Re: [Tutor] More on unit testing - tests for external data...

2009-12-11 Thread Kent Johnson
On Thu, Dec 10, 2009 at 11:19 PM, Modulok wrote: > It seems like there are a lot of people on this list interested in > getting more familiar with unit testing, but not a whole lot of > non-trivial, python-specific examples being passed around. > Case studies/tutorials anyone? Unit testing has

Re: [Tutor] More on unit testing - tests for external data...

2009-12-10 Thread Modulok
So, this, 'test environment', this is just like a directory where I place my code and associated files to test for the existence (and non-existence) of various stuff, right? Any real-world examples/case studies to point to? It seems like there are a lot of people on this list interested in getting

Re: [Tutor] More on unit testing - tests for external data...

2009-12-10 Thread spir
Wayne Werner dixit: > On Wed, Dec 9, 2009 at 6:15 PM, Alan Gauld wrote: > > > > > Remember, in testing you are not trying to prove it works but rather to > > demonstrate that it doesn't! > > > > So in that way it's a bit like the the scientific method (or exactly like)? > You create a hypothesi

Re: [Tutor] More on unit testing - tests for external data...

2009-12-10 Thread Kent Johnson
On Thu, Dec 10, 2009 at 11:20 AM, Wayne Werner wrote: > On Wed, Dec 9, 2009 at 6:15 PM, Alan Gauld > wrote: >> >> Remember, in testing you are not trying to prove it works but rather to >> demonstrate that it doesn't! > > So in that way it's a bit like the the scientific method (or exactly like)

Re: [Tutor] More on unit testing - tests for external data...

2009-12-10 Thread Wayne Werner
On Wed, Dec 9, 2009 at 6:15 PM, Alan Gauld wrote: > > Remember, in testing you are not trying to prove it works but rather to > demonstrate that it doesn't! > So in that way it's a bit like the the scientific method (or exactly like)? You create a hypothesis and design tests to invalidate your hy

Re: [Tutor] More on unit testing - tests for external data...

2009-12-09 Thread Alan Gauld
"Modulok" wrote Unit testing functions and methods which rely on passed data is simple enough. However: How do I unit test something which relies on external data? You have to build a test environment. This needs to be carefully planned to enable every test condition to be tested. For ex

[Tutor] More on unit testing - tests for external data...

2009-12-09 Thread Modulok
List, Unit testing functions and methods which rely on passed data is simple enough. However: How do I unit test something which relies on external data? For example, a function which creates a file only if it doesn't exist on disk, or a unit test for a function which makes an SQL query? If anyo