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 sblondon
Recipients sblondon
Date 2018-03-29.20:07:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522354060.39.0.467229070634.issue33183@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-03-29 20:07:40sblondonsetrecipients: + sblondon
2018-03-29 20:07:40sblondonsetmessageid: <1522354060.39.0.467229070634.issue33183@psf.upfronthosting.co.za>
2018-03-29 20:07:40sblondonlinkissue33183 messages
2018-03-29 20:07:40sblondoncreate