#NEWLINE# def test_sample_distribution( self ) : #NEWLINE# #INDENT# n = 5 #NEWLINE# pop = range ( n ) #NEWLINE# trials = 10000 #NEWLINE# def factorial( n ) : #NEWLINE# #INDENT# if ( n == 0 ) : #NEWLINE# #INDENT# return 1 #NEWLINE# #UNINDENT# return ( n * factorial ( ( n - 1 ) ) ) #NEWLINE# #UNINDENT# for k in range ( n ) : #NEWLINE# #INDENT# expected = ( factorial ( n ) // factorial ( ( n - k ) ) ) #NEWLINE# perms = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for i in range ( trials ) : #NEWLINE# #INDENT# perms [ tuple ( self . gen . sample ( pop , k ) ) ] = None #NEWLINE# if ( len ( perms ) == expected ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . fail ( )