This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients rhettinger, serhiy.storchaka
Date 2014-04-03.05:33:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396503210.54.0.700662725178.issue20550@psf.upfronthosting.co.za>
In-reply-to
Content
Sorry, I don't think this makes the tests any better as all.  It is code churn for no benefit.

In our own code, the "more specific tests" risk hiding important details behind the abstraction (losing knowledge of what is actually tested).  For example, I don't like that assertIn actually does a "not in" test or that assertIsNot runs "is".  In those two cases, it doesn't make a difference but does hint at the loss of knowledge.

Also, changing tests carries a higher set of risks than changing other code because there are no tests-for-the-tests.  This means that it would easy to accidentally break a test from testing what it is supposed to and not know about it.

The "has a nicer error message" is a vacuous promise.  The new output:

    Traceback (most recent call last):
      File "/Users/raymond/Documents/tmp14.py", line 10, in test_one
        self.assertIs(a, b)
    AssertionError: a is not b

Isn't any better than the current output:

    Traceback (most recent call last):
      File "/Users/raymond/Documents/tmp14.py", line 13, in test_two
        self.assertTrue(a is b)
    AssertionError: False is not true

Both of them show a failing "is" test and the first one mysteriously outputs "is not" which is technically a different operator (albeit, unimportantly so).
History
Date User Action Args
2014-04-03 05:33:30rhettingersetrecipients: + rhettinger, serhiy.storchaka
2014-04-03 05:33:30rhettingersetmessageid: <1396503210.54.0.700662725178.issue20550@psf.upfronthosting.co.za>
2014-04-03 05:33:30rhettingerlinkissue20550 messages
2014-04-03 05:33:29rhettingercreate