Skip to content

Commit a5d0d23

Browse files
committed
Add more tests
1 parent 2c2775b commit a5d0d23

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Doc/library/random.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,45 @@ or the :pypi:`more-itertools` project:
687687
('D', 'B', 'E', 'F', 'E')
688688

689689

690+
>>> random.seed(8675309)
691+
>>> random_permutation('ABCDEFG')
692+
('D', 'B', 'E', 'C', 'G', 'A', 'F')
693+
>>> random_permutation('ABCDEFG', 5)
694+
('A', 'G', 'D', 'C', 'B')
695+
696+
697+
>>> random.seed(8675309)
698+
>>> random_combination('ABCDEFG', 7)
699+
('A', 'B', 'C', 'D', 'E', 'F', 'G')
700+
>>> random_combination('ABCDEFG', 6)
701+
('A', 'B', 'C', 'D', 'F', 'G')
702+
>>> random_combination('ABCDEFG', 5)
703+
('A', 'B', 'C', 'E', 'F')
704+
>>> random_combination('ABCDEFG', 4)
705+
('B', 'C', 'D', 'G')
706+
>>> random_combination('ABCDEFG', 3)
707+
('B', 'E', 'G')
708+
>>> random_combination('ABCDEFG', 2)
709+
('E', 'G')
710+
>>> random_combination('ABCDEFG', 1)
711+
('C',)
712+
>>> random_combination('ABCDEFG', 0)
713+
()
714+
715+
716+
>>> random.seed(8675309)
717+
>>> random_combination_with_replacement('ABCDEFG', 7)
718+
('B', 'C', 'D', 'E', 'E', 'E', 'G')
719+
>>> random_combination_with_replacement('ABCDEFG', 3)
720+
('A', 'B', 'E')
721+
>>> random_combination_with_replacement('ABCDEFG', 2)
722+
('A', 'G')
723+
>>> random_combination_with_replacement('ABCDEFG', 1)
724+
('E',)
725+
>>> random_combination_with_replacement('ABCDEFG', 0)
726+
()
727+
728+
690729
>>> random.seed(8675309)
691730
>>> random_derangement('')
692731
()

0 commit comments

Comments
 (0)