#NEWLINE# def test_plus( self ) : #NEWLINE# #INDENT# iters = 10000 #NEWLINE# gram = "var     | 'a'\n        | 'b'\n        | 'c'\nroot    | var\n        | 'd'" #NEWLINE# w = Grammar ( gram ) #NEWLINE# r = { #NEWLINE# #INDENT# 'a' : 0 , #NEWLINE# 'b' : 0 , #NEWLINE# 'c' : 0 , #NEWLINE# 'd' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# i = 0 #NEWLINE# while ( i < self ) : #NEWLINE# #INDENT# i += 1 #NEWLINE# v = w . generate ( ) #NEWLINE# r [ v ] += 1 #NEWLINE# #UNINDENT# for v in r . values ( ) : #NEWLINE# #INDENT# self . assertAlmostEqual ( ( ( 1.0 * v ) / iters ) , 0.25 , delta = 0.03 )