File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ PYTHON ?= python
55test :
66 $(PYTHON ) -m memory_profiler test/test_func.py
77 $(PYTHON ) -m memory_profiler test/test_loop.py
8+ $(PYTHON ) -m memory_profiler test/test_mprofile.py
89 $(PYTHON ) -m memory_profiler test/test_as.py
910 $(PYTHON ) -m memory_profiler test/test_global.py
1011 $(PYTHON ) -m memory_profiler test/test_precision_command_line.py
Original file line number Diff line number Diff line change 44
55@profile
66def test1 (l ):
7+ """test1 docstring"""
78 a = [1 ] * l
89 time .sleep (1 )
910 return a
@@ -14,8 +15,22 @@ def test2(l):
1415 time .sleep (1 )
1516 return b
1617
18+ def test3 (l ):
19+ """test3 docstring"""
20+ return l
21+
1722if __name__ == "__main__" :
1823 l = 100000
1924 test1 (l )
2025 test2 (2 * l )
2126
27+ # make sure that the function name and docstring are set
28+ # by functools.wraps
29+ # memory_profile.py def profile func is not None case
30+ assert (test1 .__name__ == 'test1' ), 'function name is incorrect'
31+ assert (test1 .__doc__ == 'test1 docstring' ), 'function docstring is incorrect'
32+ # memory_profile.py def profile func is None case
33+ profile_maker = profile ()
34+ profiled_test3 = profile_maker (test3 )
35+ assert (profiled_test3 .__name__ == 'test3' ), 'function name is incorrect'
36+ assert (profiled_test3 .__doc__ == 'test3 docstring' ), 'function docstring is incorrect'
You can’t perform that action at this time.
0 commit comments