guake-guake/guake/tests/test_quick_open.py
Gaetan Semet cf0598546b quick edit: bugfixes
- quick edit freeze guake
- warn about unsupported regex in ubuntu 17.10
- fix translation not found with contextual menu
- quick open appears in contextual menu (#1157)

sem-ver: bugfix

Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
2018-04-08 16:50:03 +02:00

31 lines
705 B
Python

import re
from guake.globals import QUICK_OPEN_MATCHERS
from mock import Mock
from textwrap import dedent
def test_quick_open():
chunk = dedent(
"""
Traceback (most recent call last):
File "./test.py", line 5, in <module>
os.path('/bad/path')
TypeError: 'module' object is not callable
"""
)
found = _execute_quick_open(chunk)
assert found == [('./test.py', '5')]
def _execute_quick_open(chunk):
found = []
for line in chunk.split('\n'):
for _1, _2, r in QUICK_OPEN_MATCHERS:
g = re.compile(r).match(line)
if g:
found.append((g.group(1), g.group(2)))
return found