# Path: boussole/utils.py
# def match_path(path, included_patterns, excluded_patterns, case_sensitive):
#     """
#     Matches a pathname against a set of acceptable and ignored patterns.
# 
#     Inspired from ``watchdog.utils.patterns_match_path`` which was inspired from
#     deprecated ``pathtools.patterns.match_path``.
# 
#     Arguments:
#         path (string): A pathname which will be matched against a pattern.
#         included_patterns (set): Allow filenames matching wildcard patterns
#             specified in this list. If no pattern is specified, the function
#             treats the pathname as a match_path.
#         excluded_patterns (set): Ignores filenames matching wildcard patterns
#             specified in this list. If no pattern is specified, the function
#             treats the pathname as a match_path.
#         case_sensitive (boolean): ``True`` if matching should be
#             case-sensitive; ``False`` otherwise.
# 
#     Raises:
#         ValueError: if included patterns and excluded patterns contain the
#             same pattern.
#     Returns:
#         boolean: ``True`` if the pathname matches; ``False`` otherwise.
#     """
#     if case_sensitive:
#         path = PurePosixPath(path)
#     else:
#         included_patterns = {pattern.lower() for pattern in included_patterns}
#         excluded_patterns = {pattern.lower() for pattern in excluded_patterns}
#         path = PureWindowsPath(path)
# 
#     common_patterns = included_patterns & excluded_patterns
# 
#     if common_patterns:
#         msg = "conflicting patterns '{}' included and excluded"
#         raise ValueError(msg.format(common_patterns))
# 
#     return (
#         any(path.match(p) for p in included_patterns) and
#         not any(path.match(p) for p in excluded_patterns)
#     )


import pytest
from boussole.utils import match_path
        False,
    ),
    (
        "/home/plop/",
        {"*.py"},
        {"*.txt"},
        True,
        False,
    ),
])
def test_match_path_success(path, included, excluded, case_sensitive, expected):
    assert match_path(path, included, excluded, case_sensitive) is expected


@pytest.mark.parametrize("path, included, excluded, case_sensitive", [
    (
        "/home/plop/foobar.py",
        {"*.py"},
        {"*.py"},
        True,
    ),
    (
        "/home/plop/foobar.py",
        {"*.py"},
        {"*.PY"},
        False,
    ),
])
def test_match_path_fail(path, included, excluded, case_sensitive):
    with pytest.raises(ValueError):

# Path: boussole/utils.py
# def match_path(path, included_patterns, excluded_patterns, case_sensitive):
#     """
#     Matches a pathname against a set of acceptable and ignored patterns.
# 
#     Inspired from ``watchdog.utils.patterns_match_path`` which was inspired from
#     deprecated ``pathtools.patterns.match_path``.
# 
#     Arguments:
#         path (string): A pathname which will be matched against a pattern.
#         included_patterns (set): Allow filenames matching wildcard patterns
#             specified in this list. If no pattern is specified, the function
#             treats the pathname as a match_path.
#         excluded_patterns (set): Ignores filenames matching wildcard patterns
#             specified in this list. If no pattern is specified, the function
#             treats the pathname as a match_path.
#         case_sensitive (boolean): ``True`` if matching should be
#             case-sensitive; ``False`` otherwise.
# 
#     Raises:
#         ValueError: if included patterns and excluded patterns contain the
#             same pattern.
#     Returns:
#         boolean: ``True`` if the pathname matches; ``False`` otherwise.
#     """
#     if case_sensitive:
#         path = PurePosixPath(path)
#     else:
#         included_patterns = {pattern.lower() for pattern in included_patterns}
#         excluded_patterns = {pattern.lower() for pattern in excluded_patterns}
#         path = PureWindowsPath(path)
# 
#     common_patterns = included_patterns & excluded_patterns
# 
#     if common_patterns:
#         msg = "conflicting patterns '{}' included and excluded"
#         raise ValueError(msg.format(common_patterns))
# 
#     return (
#         any(path.match(p) for p in included_patterns) and
#         not any(path.match(p) for p in excluded_patterns)
#     )


# Path: tests/000_utils/001_match_path.py
import pytest
from boussole.utils import match_path

        False,
    ),
    (
        "/home/plop/",
        {"*.py"},
        {"*.txt"},
        True,
        False,
    ),
])
def test_match_path_success(path, included, excluded, case_sensitive, expected):
    assert match_path(path, included, excluded, case_sensitive) is expected


@pytest.mark.parametrize("path, included, excluded, case_sensitive", [
    (
        "/home/plop/foobar.py",
        {"*.py"},
        {"*.py"},
        True,
    ),
    (
        "/home/plop/foobar.py",
        {"*.py"},
        {"*.PY"},
        False,
    ),
])
def test_match_path_fail(path, included, excluded, case_sensitive):
    with pytest.raises(ValueError):

        match_path(path, included, excluded, case_sensitive)