I was going through a few tests written in Java using JUnit and I could’nt help noticing the emphasis which is laid on checking the “type” of objects. This is something I have never seen in Python test-suites.
Java being statically-typed and Python being dynamically-typed, should’nt the reverse be the case?
In dynamically-typed languages, developers often follow the duck typing principle — “if it looks like a duck and walks like a duck, it is a duck”. As long as the object does what all the tests require, does it really matter what kind of object it is? Duck typing says no.