Use simpler assert in basic example.

This commit is contained in:
Ezio Melotti 2011-03-10 23:38:18 +02:00
parent c542547211
commit c29cd9384a
1 changed files with 2 additions and 2 deletions

View File

@ -127,13 +127,13 @@ Here is a short script to test three functions from the :mod:`random` module::
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()