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.
Created on 2018年03月29日 20:07 by sblondon, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg314670 - (view) | Author: Stéphane Blondon (sblondon) * | Date: 2018年03月29日 20:07 | |
In several cases, tests use ```self.assertTrue(a in b)```. Using ```self.assertIn(a, b)``` seems to be better.
For examples:
./Lib/test/test_inspect.py:
self.assertTrue('(po, pk' in repr(sig))
./Lib/test/test_configparser.py:
self.assertTrue('that_value' in cf['Spacey Bar'])
./Lib/test/test_collections.py:
self.assertTrue(elem in c)
There are some cases where ```self.assertTrue(a not in b)``` could be replaced by ```self.assertNotIn(a, b)```
./Lib/tkinter/test/test_ttk/test_widgets.py:
self.assertTrue('.' not in value)
./Lib/test/mapping_tests.py:
self.assertTrue(not ('a' in d))
self.assertTrue('a' not in d)
$ find . -name "*.py" | xargs grep -r "assertTrue.* in "
finds 131 occurences but there are some false positives inside the output.
I can write a patch if you are interested.
|
|||
| msg314671 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年03月29日 20:29 | |
This is a duplicate of issue16510. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:59 | admin | set | github: 77364 |
| 2018年03月29日 20:29:02 | serhiy.storchaka | set | status: open -> closed superseder: Using appropriate checks in tests nosy: + serhiy.storchaka messages: + msg314671 resolution: duplicate stage: resolved |
| 2018年03月29日 20:07:40 | sblondon | create | |