Show More
@@ -114,11 +114,12 def test_skip_dt_decorator(): | |||||
114 | # Fetch the docstring from doctest_bad after decoration. |
|
114 | # Fetch the docstring from doctest_bad after decoration. | |
115 | val = doctest_bad.__doc__ |
|
115 | val = doctest_bad.__doc__ | |
116 |
|
116 | |||
117 |
assert |
|
117 | nt.assert_equal(check,val,"doctest_bad docstrings don't match") | |
|
118 | ||||
118 |
|
119 | |||
119 | # Doctest skipping should work for class methods too |
|
120 | # Doctest skipping should work for class methods too | |
120 |
class |
|
121 | class FooClass(object): | |
121 | """Foo |
|
122 | """FooClass | |
122 |
|
123 | |||
123 | Example: |
|
124 | Example: | |
124 |
|
125 | |||
@@ -128,22 +129,22 class foo(object): | |||||
128 |
|
129 | |||
129 | @dec.skip_doctest |
|
130 | @dec.skip_doctest | |
130 | def __init__(self,x): |
|
131 | def __init__(self,x): | |
131 |
"""Make a |
|
132 | """Make a FooClass. | |
132 |
|
133 | |||
133 | Example: |
|
134 | Example: | |
134 |
|
135 | |||
135 |
>>> f = |
|
136 | >>> f = FooClass(3) | |
136 | junk |
|
137 | junk | |
137 | """ |
|
138 | """ | |
138 |
print 'Making a |
|
139 | print 'Making a FooClass.' | |
139 | self.x = x |
|
140 | self.x = x | |
140 |
|
141 | |||
141 | @dec.skip_doctest |
|
142 | @dec.skip_doctest | |
142 | def bar(self,y): |
|
143 | def bar(self,y): | |
143 | """Example: |
|
144 | """Example: | |
144 |
|
145 | |||
145 |
>>> f |
|
146 | >>> ff = FooClass(3) | |
146 | >>> f.bar(0) |
|
147 | >>> ff.bar(0) | |
147 | boom! |
|
148 | boom! | |
148 | >>> 1/0 |
|
149 | >>> 1/0 | |
149 | bam! |
|
150 | bam! | |
@@ -153,15 +154,14 class foo(object): | |||||
153 | def baz(self,y): |
|
154 | def baz(self,y): | |
154 | """Example: |
|
155 | """Example: | |
155 |
|
156 | |||
156 |
>>> f |
|
157 | >>> ff2 = FooClass(3) | |
157 |
Making a |
|
158 | Making a FooClass. | |
158 | >>> f.baz(3) |
|
159 | >>> ff2.baz(3) | |
159 | True |
|
160 | True | |
160 | """ |
|
161 | """ | |
161 | return self.x==y |
|
162 | return self.x==y | |
162 |
|
163 | |||
163 |
|
164 | |||
164 |
|
||||
165 | def test_skip_dt_decorator2(): |
|
165 | def test_skip_dt_decorator2(): | |
166 | """Doctest-skipping decorator should preserve function signature. |
|
166 | """Doctest-skipping decorator should preserve function signature. | |
167 | """ |
|
167 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now