mirror of https://github.com/python/cpython
Use simpler assert in basic example.
This commit is contained in:
parent
c542547211
commit
c29cd9384a
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue