<s> import unittest <EOL> from test import support <EOL> from io import StringIO <EOL> import pstats <EOL> class AddCallersTestCase ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_combine_results ( self ) : <EOL> target = { "<STR_LIT:a>" : ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) } <EOL> source = { "<STR_LIT:a>" : ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) , "<STR_LIT:b>" : ( <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> ) } <EOL> new_callers = pstats . add_callers ( target , source ) <EOL> self . assertEqual ( new_callers , { '<STR_LIT:a>' : ( <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:8> ) , '<STR_LIT:b>' : ( <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> ) } ) <EOL> target = { "<STR_LIT:a>" : <NUM_LIT:1> } <EOL> source = { "<STR_LIT:a>" : <NUM_LIT:1> , "<STR_LIT:b>" : <NUM_LIT:5> } <EOL> new_callers = pstats . add_callers ( target , source ) <EOL> self . assertEqual ( new_callers , { '<STR_LIT:a>' : <NUM_LIT:2> , '<STR_LIT:b>' : <NUM_LIT:5> } ) <EOL> class StatsTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> stats_file = support . findfile ( '<STR_LIT>' ) <EOL> self . stats = pstats . Stats ( stats_file ) <EOL> def test_add ( self ) : <EOL> stream = StringIO ( ) <EOL> stats = pstats . Stats ( stream = stream ) <EOL> stats . add ( self . stats , self . stats ) <EOL> def test_main ( ) : <EOL> support . run_unittest ( <EOL> AddCallersTestCase , <EOL> StatsTestCase , <EOL> ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test_main ( ) </s>
