Ticket #2771: patch_to_doctest.diff
File patch_to_doctest.diff, 1.1 KB (added by , 18 years ago) |
---|
-
test/doctest.py
1319 1319 __LINECACHE_FILENAME_RE = re.compile(r'<doctest ' 1320 1320 r'(?P<name>[\w\.]+)' 1321 1321 r'\[(?P<examplenum>\d+)\]>$') 1322 def __patched_linecache_getlines(self, filename ):1322 def __patched_linecache_getlines(self, filename, module_globals=None): 1323 1323 m = self.__LINECACHE_FILENAME_RE.match(filename) 1324 1324 if m and m.group('name') == self.test.name: 1325 1325 example = self.test.examples[int(m.group('examplenum'))] 1326 1326 return example.source.splitlines(True) 1327 1327 else: 1328 return self.save_linecache_getlines(filename) 1328 if sys.hexversion < 0x020500a1: 1329 return self.save_linecache_getlines(filename) 1330 else: 1331 return self.save_linecache.getlines(filename, module_globals) 1329 1332 1330 1333 def run(self, test, compileflags=None, out=None, clear_globs=True): 1331 1334 """