Show More
@@ -15,6 +15,7 b' from __future__ import print_function' | |||
|
15 | 15 | |
|
16 | 16 | # Stdlib imports |
|
17 | 17 | import os |
|
18 | import re | |
|
18 | 19 | |
|
19 | 20 | # Third-party imports |
|
20 | 21 | import nose.tools as nt |
@@ -44,15 +45,24 b' ip = get_ipython()' | |||
|
44 | 45 | # defined, if any code is inserted above, the following line will need to be |
|
45 | 46 | # updated. Do NOT insert any whitespace between the next line and the function |
|
46 | 47 | # definition below. |
|
47 |
THIS_LINE_NUMBER = 4 |
|
|
48 | THIS_LINE_NUMBER = 48 # Put here the actual number of this line | |
|
48 | 49 | def test_find_source_lines(): |
|
49 | 50 | nt.assert_equal(oinspect.find_source_lines(test_find_source_lines), |
|
50 | 51 | THIS_LINE_NUMBER+1) |
|
51 | 52 | |
|
52 | 53 | |
|
54 | # A couple of utilities to ensure these tests work the same from a source or a | |
|
55 | # binary install | |
|
56 | def pyfile(fname): | |
|
57 | return re.sub('.py[co]$', '.py', fname) | |
|
58 | ||
|
59 | ||
|
60 | def match_pyfiles(f1, f2): | |
|
61 | nt.assert_equal(pyfile(f1), pyfile(f2)) | |
|
62 | ||
|
63 | ||
|
53 | 64 | def test_find_file(): |
|
54 |
|
|
|
55 | os.path.abspath(__file__)) | |
|
65 | match_pyfiles(oinspect.find_file(test_find_file), os.path.abspath(__file__)) | |
|
56 | 66 | |
|
57 | 67 | |
|
58 | 68 | def test_find_file_decorated1(): |
@@ -67,8 +77,7 b' def test_find_file_decorated1():' | |||
|
67 | 77 | def f(x): |
|
68 | 78 | "My docstring" |
|
69 | 79 | |
|
70 | nt.assert_equal(oinspect.find_file(f), | |
|
71 | os.path.abspath(__file__)) | |
|
80 | match_pyfiles(oinspect.find_file(f), os.path.abspath(__file__)) | |
|
72 | 81 | nt.assert_equal(f.__doc__, "My docstring") |
|
73 | 82 | |
|
74 | 83 | |
@@ -82,8 +91,7 b' def test_find_file_decorated2():' | |||
|
82 | 91 | def f(x): |
|
83 | 92 | "My docstring 2" |
|
84 | 93 | |
|
85 | nt.assert_equal(oinspect.find_file(f), | |
|
86 | os.path.abspath(__file__)) | |
|
94 | match_pyfiles(oinspect.find_file(f), os.path.abspath(__file__)) | |
|
87 | 95 | nt.assert_equal(f.__doc__, "My docstring 2") |
|
88 | 96 | |
|
89 | 97 |
General Comments 0
You need to be logged in to leave comments.
Login now