home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 June / maximum-cd-2011-06.iso / DiscContents / LibO_3.3.1_Win_x86_install_multi.exe / libreoffice1.cab / test_pstats.py < prev    next >
Encoding:
Python Source  |  2011-02-15  |  687 b   |  27 lines

  1. import unittest
  2. from test import test_support
  3. import pstats
  4.  
  5.  
  6.  
  7. class AddCallersTestCase(unittest.TestCase):
  8.     """Tests for pstats.add_callers helper."""
  9.  
  10.     def test_combine_results(self):
  11.         """pstats.add_callers should combine the call results of both target
  12.         and source by adding the call time. See issue1269."""
  13.         target = {"a": (1, 2, 3, 4)}
  14.         source = {"a": (1, 2, 3, 4), "b": (5, 6, 7, 8)}
  15.         new_callers = pstats.add_callers(target, source)
  16.         self.assertEqual(new_callers, {'a': (2, 4, 6, 8), 'b': (5, 6, 7, 8)})
  17.  
  18.  
  19. def test_main():
  20.     test_support.run_unittest(
  21.         AddCallersTestCase
  22.     )
  23.  
  24.  
  25. if __name__ == "__main__":
  26.     test_main()
  27.