mirror of
https://github.com/Guake/guake.git
synced 2025-10-26 11:27:13 +00:00
mock is in the stdlib as unittest.mock now. pytest-mock doesn't need it to run, and the one place it was directly imported, it wasn't even used.
30 lines
683 B
Python
30 lines
683 B
Python
import re
|
|
|
|
from guake.globals import QUICK_OPEN_MATCHERS
|
|
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
|