Re: Need advice on writing better test cases.

2017-08-28 Thread Anubhav Yadav
> A good way to learn unit testing and regression testing is to download > the Python source code and read the test suites. It’s a fantastic idea. I will also have a good understanding of the internals of the standard library and at I can learn more about testing. Any specific module that you

Re: Need advice on writing better test cases.

2017-08-28 Thread Steven D'Aprano
On Mon, 28 Aug 2017 01:55:25 +0530, Anubhav Yadav wrote: > Can you suggest me the right python testing frameworks that I should be > using? Right now I am using unittest to write test cases and manual > if/else statements to run the functional test cases. A good way to learn unit testing and reg

Re: Need advice on writing better test cases.

2017-08-28 Thread Anubhav Yadav
> If you have a function and you want to assert *that function's* > behaviour, you can avoid external dependencies during the test run by > providing fake resources. These can be mocks (e.g. with ‘unittest.mock’) > or other fake resources that are going to behave exactly how you want, > for the pu

Re: Need advice on writing better test cases.

2017-08-28 Thread Anubhav Yadav
> On 28-Aug-2017, at 04:35, Ben Finney wrote: > > Anubhav Yadav writes: > >> I want to write more test cases, specially that rely on database >> insertions and reads and file IO. > > Thanks for taking seriously the importance of test cases for your code! > > One important thing to recognise

Re: Need advice on writing better test cases.

2017-08-27 Thread Ben Finney
Anubhav Yadav writes: > I want to write more test cases, specially that rely on database > insertions and reads and file IO. Thanks for taking seriously the importance of test cases for your code! One important thing to recognise is that a unit test is only one type of test. It tests one unit o

Need advice on writing better test cases.

2017-08-27 Thread Anubhav Yadav
Hello, I am a (self-learned) python developer and I write a lot of python code everyday. I try to do as much unit testing as possible. But I want to be better at it, I want to write more test cases, specially that rely on database insertions and reads and file IO. Here are my use-cases for test