You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I really liked your talk on test & code, and I'm working through the book at the moment.
One comment/question I have is that I found your suggestions when to assert vs raise an exception were a little vague. From my understanding, assertions are great in tests (its the main mechanism to implement them) but should not be in production code. Production code should raise a ValueError, NotImplementedError, SomeCustomError... Something more representative than AssertionError.
Find a commented out `print` statement in your code and transform it into an `assert`.
```
Might lead us to believe that you should have asserts in your production code vs a more appropriate exception.
In the testing to maintain your sanity section you mix tests at runtime (the data is bad) and tests that can be done at implementation time (you're loading the data incorrectlly) which add to the vagueness of when to put asserts.
Hi,
I really liked your talk on test & code, and I'm working through the book at the moment.
One comment/question I have is that I found your suggestions when to assert vs raise an exception were a little vague. From my understanding, assertions are great in tests (its the main mechanism to implement them) but should not be in production code. Production code should raise a ValueError, NotImplementedError, SomeCustomError... Something more representative than AssertionError.
For example, the exercise
codebook/testing.md
Lines 433 to 435 in 083bf38
Might lead us to believe that you should have asserts in your production code vs a more appropriate exception.
In the testing to maintain your sanity section you mix tests at runtime (the data is bad) and tests that can be done at implementation time (you're loading the data incorrectlly) which add to the vagueness of when to put asserts.
codebook/testing.md
Lines 29 to 33 in 083bf38
Thanks again for the ideas, ill be implementing some of them!
The text was updated successfully, but these errors were encountered: