Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9)

Side by Side Diff: Lib/test/test_cprofile.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_copy.py ('k') | Lib/test/test_dbm.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Test suite for the cProfile module.""" 1 """Test suite for the cProfile module."""
2 2
3 import sys 3 import sys
4 from test.support import run_unittest, TESTFN, unlink 4 from test.support import run_unittest, TESTFN, unlink
5 5
6 # rip off all interesting stuff from test_profile 6 # rip off all interesting stuff from test_profile
7 import cProfile 7 import cProfile
8 from test.test_profile import ProfileTest, regenerate_expected_output 8 from test.test_profile import ProfileTest, regenerate_expected_output
9 9
10 class CProfileTest(ProfileTest): 10 class CProfileTest(ProfileTest):
11 profilerclass = cProfile.Profile 11 profilerclass = cProfile.Profile
12 expected_max_output = "{built-in method max}" 12 expected_max_output = "{built-in method max}"
13 13
14 def get_expected_output(self): 14 def get_expected_output(self):
15 return _ProfileOutput 15 return _ProfileOutput
16 16
17 # Issue 3895. 17 # Issue 3895.
18 def test_bad_counter_during_dealloc(self): 18 def test_bad_counter_during_dealloc(self):
19 import _lsprof 19 import _lsprof
20 # Must use a file as StringIO doesn't trigger the bug. 20 # Must use a file as StringIO doesn't trigger the bug.
21 orig_stderr = sys.stderr 21 with open(TESTFN, 'w') as file:
22 try: 22 sys.stderr = file
23 with open(TESTFN, 'w') as file: 23 try:
24 sys.stderr = file 24 obj = _lsprof.Profiler(lambda: int)
25 try: 25 obj.enable()
26 obj = _lsprof.Profiler(lambda: int) 26 obj = _lsprof.Profiler(1)
27 obj.enable() 27 obj.disable()
28 obj = _lsprof.Profiler(1) 28 finally:
29 obj.disable() 29 sys.stderr = sys.__stderr__
30 finally: 30 unlink(TESTFN)
31 sys.stderr = orig_stderr
32 finally:
33 unlink(TESTFN)
34 31
35 32
36 def test_main(): 33 def test_main():
37 run_unittest(CProfileTest) 34 run_unittest(CProfileTest)
38 35
39 def main(): 36 def main():
40 if '-r' not in sys.argv: 37 if '-r' not in sys.argv:
41 test_main() 38 test_main()
42 else: 39 else:
43 regenerate_expected_output(__file__, CProfileTest) 40 regenerate_expected_output(__file__, CProfileTest)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 6 0.234 0.300 profilee.py:88(helper2) 83 6 0.234 0.300 profilee.py:88(helper2)
87 profilee.py:73(helper1) -> 4 0.000 0.000 {built-in method exc_info} 84 profilee.py:73(helper1) -> 4 0.000 0.000 {built-in method exc_info}
88 profilee.py:84(helper2_indirect) -> 2 0.006 0.040 profilee.py:35(factorial) 85 profilee.py:84(helper2_indirect) -> 2 0.006 0.040 profilee.py:35(factorial)
89 2 0.078 0.100 profilee.py:88(helper2) 86 2 0.078 0.100 profilee.py:88(helper2)
90 profilee.py:88(helper2) -> 8 0.064 0.080 profilee.py:98(subhelper) 87 profilee.py:88(helper2) -> 8 0.064 0.080 profilee.py:98(subhelper)
91 profilee.py:98(subhelper) -> 16 0.016 0.016 profilee.py:110(__getattr__) 88 profilee.py:98(subhelper) -> 16 0.016 0.016 profilee.py:110(__getattr__)
92 {built-in method hasattr} -> 12 0.012 0.012 profilee.py:110(__getattr__)""" 89 {built-in method hasattr} -> 12 0.012 0.012 profilee.py:110(__getattr__)"""
93 90
94 if __name__ == "__main__": 91 if __name__ == "__main__":
95 main() 92 main()
OLDNEW
« no previous file with comments | « Lib/test/test_copy.py ('k') | Lib/test/test_dbm.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+