On 15 July 2015 at 09:41, A.M. Kuchling <a...@amk.ca> wrote: > On Tue, Jul 14, 2015 at 09:53:33AM -0700, Ethan Furman wrote: >> Part of writing tests is making sure they fail (and for the right reason) -- >> proper testing of the tests would reveal such a typo. > > And there are other failure modes for writing tests that succeed but > are not testing what you think. For example, you might re-use the > same method name: > > def test_connection(self): > # Never executed > ... > > ... 200 lines and 10 other test methods later ... > > def test_connection(self): > ... > > Or misuse assertRaises: > > with self.assertRaises(TypeError): > 1 + "a" > # Second statement never reached > [] + 'b' > > I don't think unittest can protect its users from such things.
It can't, but there is a sliding scale of API usability, and we should try to be up the good end of that :). http://sweng.the-davies.net/Home/rustys-api-design-manifesto -Rob -- Robert Collins <rbtcoll...@hp.com> Distinguished Technologist HP Converged Cloud _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com