On Thu, Mar 10, 2011 at 4:36 PM, ezio.melotti <python-check...@python.org> wrote: > http://hg.python.org/cpython/rev/9adc4792db9a > changeset: 68356:9adc4792db9a > branch: 2.7 > user: Ezio Melotti <ezio.melo...@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*. 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. 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-check...@python.org > http://mail.python.org/mailman/listinfo/python-checkins > > -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com