The assertions tag has no wiki summary.
10
votes
1answer
113 views
Automatically run doctest every time program is run
I would like this to happen every time I run a program from the command line. Is my approach Pythonic? I'm interested to know whether there is any problem with readability or correctness. Any general ...
6
votes
1answer
129 views
How should I structure my Unit tests for minimal Asserts?
I always see comments about how a Unit Test should only be testing one piece of functionality. For the most part, I definitely agree with that assessment. However, I'm working on testing a method ...
7
votes
4answers
415 views
5
votes
2answers
92 views
What might be another way to test if int is 32 bits wide at compile time?
Below is code that will compile when INT_MAX is equal to 232. It will generate a compiler error when INT_MAX is not equal to ...
5
votes
2answers
131 views
Defensive programming type-checking
I have issues with dynamically typed languages, and I tend to worry about type a lot.
Numpy has different behaviour depending on if something is a matrix or a plain ndarray, or a list. I didn't ...
6
votes
1answer
467 views
Vector of derived classes
Everyone knows you can't put a Derived in an std::vector<Base>. I decided to implement a collection which does allow you ...