FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

import sys import re import unittest from curtsies.fmtfuncs import bold, green, magenta, cyan, red, plain from unittest import mock from bpython.curtsiesfrontend import interpreter pypy = "PyPy" in sys.version def remove_ansi(s): return re.sub(r"(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]".encode("ascii"), b"", s) class TestInterpreter(unittest.TestCase): def interp_errlog(self): i = interpreter.Interp() a = [] i.write = a.append return i, a def err_lineno(self, a): strings = [x.__unicode__() for x in a] for line in reversed(strings): clean_line = remove_ansi(line) m = re.search(r"line (\d+)[,]", clean_line) if m: return int(m.group(1)) return None def test_syntaxerror(self): i, a = self.interp_errlog() i.runsource("1.1.1.1") if (3, 10, 1)

Back | FazBrowse Home | New Git URL