Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_pstats.py @ 54294:dba767bc3155 legacy-trunk
remove mention of old ctypes version
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 23 May 2009 20:59:09 +0000 |
| parents | 89b13b693864 |
| children | 6baeba54fd24 9c930a32cebb |
| rev | line source |
|---|---|
|
44833
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
1 import unittest |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
2 from test import test_support |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
3 import pstats |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
4 |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
5 |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
6 |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
7 class AddCallersTestCase(unittest.TestCase): |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
8 """Tests for pstats.add_callers helper.""" |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
9 |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
10 def test_combine_results(self): |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
11 """pstats.add_callers should combine the call results of both target |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
12 and source by adding the call time. See issue1269.""" |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
13 target = {"a": (1, 2, 3, 4)} |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
14 source = {"a": (1, 2, 3, 4), "b": (5, 6, 7, 8)} |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
15 new_callers = pstats.add_callers(target, source) |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
16 self.assertEqual(new_callers, {'a': (2, 4, 6, 8), 'b': (5, 6, 7, 8)}) |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
17 |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
18 |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
19 def test_main(): |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
20 test_support.run_unittest( |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
21 AddCallersTestCase |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
22 ) |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
23 |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
24 |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
25 if __name__ == "__main__": |
|
89b13b693864
#1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
26 test_main() |
