# Path: guake/globals.py
# QUICK_OPEN_MATCHERS = [
#     (
#         "Python traceback",
#         r"^\s*File\s\".*\",\sline\s[0-9]+",
#         r"^\s*File\s\"(.*)\",\sline\s([0-9]+)",
#     ),
#     (
#         "Python pytest report",
#         r"^\s.*\:\:[a-zA-Z0-9\_]+\s",
#         r"^\s*(.*\:\:[a-zA-Z0-9\_]+)\s",
#     ),
#     (
#         "line starts by 'ERROR in Filename:line' pattern (GCC/make). File path should exists.",
#         r"\s.\S[^\s\s].[a-zA-Z0-9\/\_\-\.\ ]+\.?[a-zA-Z0-9]+\:[0-9]+",
#         r"\s.\S[^\s\s].(.*)\:([0-9]+)",
#     ),
#     (
#         "line starts by 'Filename:line' pattern (GCC/make). File path should exists.",
#         r"^\s*[a-zA-Z0-9\/\_\-\.\ ]+\.?[a-zA-Z0-9]+\:[0-9]+",
#         r"^\s*(.*)\:([0-9]+)",
#     ),
# ]


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"):

# Path: guake/globals.py
# QUICK_OPEN_MATCHERS = [
#     (
#         "Python traceback",
#         r"^\s*File\s\".*\",\sline\s[0-9]+",
#         r"^\s*File\s\"(.*)\",\sline\s([0-9]+)",
#     ),
#     (
#         "Python pytest report",
#         r"^\s.*\:\:[a-zA-Z0-9\_]+\s",
#         r"^\s*(.*\:\:[a-zA-Z0-9\_]+)\s",
#     ),
#     (
#         "line starts by 'ERROR in Filename:line' pattern (GCC/make). File path should exists.",
#         r"\s.\S[^\s\s].[a-zA-Z0-9\/\_\-\.\ ]+\.?[a-zA-Z0-9]+\:[0-9]+",
#         r"\s.\S[^\s\s].(.*)\:([0-9]+)",
#     ),
#     (
#         "line starts by 'Filename:line' pattern (GCC/make). File path should exists.",
#         r"^\s*[a-zA-Z0-9\/\_\-\.\ ]+\.?[a-zA-Z0-9]+\:[0-9]+",
#         r"^\s*(.*)\:([0-9]+)",
#     ),
# ]


# Path: guake/tests/test_quick_open.py
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: