Closed labdmitriy closed 9 months ago
@labdmitriy I addressed type-checking in this new section of the second post https://www.thedigitalcatonline.com/blog/2020/09/11/tdd-in-python-with-pytest-part-2/#the-problem-of-types. Please let me know it it makes sense or if there are still open questions. It's always useful to discuss such topics!
Hi Leonardo,
I followed Step 8 - Testing exceptions and there you provide the updated implementation of the multiplication operation:
With this implementation we have the following cases:
Based on these cases, I decided to implement the following version of the multiplication, where we at first check if all operands are numeric values (I used Number class from numbers standard package assuming that we can accept all numeric values, but maybe Integral class will be more correct), and only then explicitly check if there are any zero values (and all tests are passed successfully):
class SimpleCalculator: [...]