Check output, accepting special markers embedded in the output. If the output didn't pass the default validation but the special string '#random' is included, we accept it.
(self, want, got, optionflags)
| 177 | random_re = re.compile(r'#\s*random\s+') |
| 178 | |
| 179 | def check_output(self, want, got, optionflags): |
| 180 | """Check output, accepting special markers embedded in the output. |
| 181 | |
| 182 | If the output didn't pass the default validation but the special string |
| 183 | '#random' is included, we accept it.""" |
| 184 | |
| 185 | # Let the original tester verify first, in case people have valid tests |
| 186 | # that happen to have a comment saying '#random' embedded in. |
| 187 | ret = doctest.OutputChecker.check_output(self, want, got, |
| 188 | optionflags) |
| 189 | if not ret and self.random_re.search(want): |
| 190 | #print >> sys.stderr, 'RANDOM OK:',want # dbg |
| 191 | return True |
| 192 | |
| 193 | return ret |
| 194 | |
| 195 | |
| 196 | class DocTestCase(doctests.DocTestCase): |