#NEWLINE# def test_benchmark( ) : #NEWLINE# #INDENT# t = TestBenchmark ( 'TestBenchmark' , verbose = True ) #NEWLINE# t . run ( ) #NEWLINE# print ( '{:=^28}' . format ( ' Test benchmark ' ) ) #NEWLINE# t . display ( ) #NEWLINE# results = t . get_results ( ) #NEWLINE# nosetup = results [ 'test_nosetup' ] #NEWLINE# withsetup = results [ 'test_withsetup' ] #NEWLINE# loop = results [ 'test_loop' ] #NEWLINE# zorglub = results [ 'test_zorglub' ] #NEWLINE# assert ( len ( nosetup [ 'results' ] ) == 1 ) #NEWLINE# assert ( nosetup [ 'results' ] [ 0 ] >= 1000.0 ) #NEWLINE# assert ( nosetup [ 'desc' ] is None ) #NEWLINE# assert ( nosetup [ 'unit' ] == 'ms' ) #NEWLINE# assert ( withsetup [ 'results' ] [ 0 ] == 3 ) #NEWLINE# assert ( len ( loop [ 'results' ] ) == 30 ) #NEWLINE# for r in loop [ 'results' ] : #NEWLINE# #INDENT# assert ( ( r >= 0 ) and ( nosetup <= 1000 ) ) #NEWLINE# #UNINDENT# assert ( zorglub [ 'desc' ] == 'this test took 9999 days' ) #NEWLINE# assert ( zorglub [ 'results' ] [ 0 ] == 9999 ) #NEWLINE# assert ( zorglub [ 'unit' ] == 'days' )