You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/rhettinger'closed_at=<Date2014-04-03.05:33:30.525>created_at=<Date2014-02-07.20:26:56.806>labels= ['easy', 'type-feature', 'tests']
title='Use specific asserts in collections tests'updated_at=<Date2017-03-23.17:07:11.930>user='https://github.com/serhiy-storchaka'
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 isnot 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: Falseisnot 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).
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: