|
|
|
How to learn how to write great tests in Python?
|
|
1 points
by ajushi
2298 days ago
|
|
I need help. I want to improve. I feel that I'm not writing the best unit tests. Can you guys recommend any books or articles where I can learn how especially in Python? I'm more concerned about strategies about knowing what tests to write and when is the best scenario to write them. I really want to be good at development and this area is what I think I'm lacking.
I'd really appreciate your help. Thank you. |
|
A unit test should test the functionality of a single chunk of code. What kind of stuff are you writing?
I write webservers most of the time. So what I do is, at the top level of the request, immediately pull data off of the request so that I can access to the data in native python types that are easy to mock for testing. Each layer of my webserver does only one thing which could be gluing the auth+services together, but is still easy to mock.