On 11/03/2011 4.45, Nick Coghlan wrote: > On Thu, Mar 10, 2011 at 4:36 PM, ezio.melotti > <python-checkins at python.org> wrote: >> http://hg.python.org/cpython/rev/9adc4792db9a >> changeset: 68356:9adc4792db9a >> branch: 2.7 >> user: Ezio Melotti<ezio.melotti at gmail.com> >> date: Thu Mar 10 23:35:39 2011 +0200 >> summary: >> Use simpler assert in basic example. > Please don't. Now the new methods are available, using assertTrue() on > supported expressions is actively throwing away data, and the docs > shouldn't recommend it *anywhere*. I agree with you, but Raymond wants to keep the example as simple as possible and asked me to change it back. > If using assertIn() at this point in the docs is a genuine problem, > find an alternative test example that isn't better written using one > of the more specific methods. That would be best. Can you come up with a different example that only uses assertEqual/assertTrue/assertRaises? Best Regards, Ezio Melotti > Cheers, > Nick. > >> files: >> Doc/library/unittest.rst >> >> diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst >> --- a/Doc/library/unittest.rst >> +++ b/Doc/library/unittest.rst >> @@ -130,13 +130,13 @@ >> >> def test_choice(self): >> element = random.choice(self.seq) >> - self.assertIn(element, self.seq) >> + self.assertTrue(element in self.seq) >> >> def test_sample(self): >> with self.assertRaises(ValueError): >> random.sample(self.seq, 20) >> for element in random.sample(self.seq, 5): >> - self.assertIn(element, self.seq) >> + self.assertTrue(element in self.seq) >> >> if __name__ == '__main__': >> unittest.main() >> >> -- >> Repository URL: http://hg.python.org/cpython >> >> _______________________________________________ >> Python-checkins mailing list >> Python-checkins at python.org >> http://mail.python.org/mailman/listinfo/python-checkins >> >> > >
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4