X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/445f094f1fa2d998bf0cc0007ea48d62953fa876..199e3eb76b74d9d2cada527403a3989287c4e8b3:/tests/test_black.py diff --git a/tests/test_black.py b/tests/test_black.py index 5ab25cd..098a9ec 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -1406,7 +1406,7 @@ class BlackTestCase(BlackBaseTestCase): ) self.assertEqual(sorted(expected), sorted(sources)) - def test_gitingore_used_as_default(self) -> None: + def test_gitignore_used_as_default(self) -> None: path = Path(THIS_DIR / "data" / "include_exclude_tests") include = re.compile(r"\.pyi?$") extend_exclude = re.compile(r"/exclude/") @@ -1703,6 +1703,33 @@ class BlackTestCase(BlackBaseTestCase): ) self.assertEqual(sorted(expected), sorted(sources)) + def test_nested_gitignore(self) -> None: + path = Path(THIS_DIR / "data" / "nested_gitignore_tests") + include = re.compile(r"\.pyi?$") + exclude = re.compile(r"") + root_gitignore = black.files.get_gitignore(path) + report = black.Report() + expected: List[Path] = [ + Path(path / "x.py"), + Path(path / "root/b.py"), + Path(path / "root/c.py"), + Path(path / "root/child/c.py"), + ] + this_abs = THIS_DIR.resolve() + sources = list( + black.gen_python_files( + path.iterdir(), + this_abs, + include, + exclude, + None, + None, + report, + root_gitignore, + ) + ) + self.assertEqual(sorted(expected), sorted(sources)) + def test_empty_include(self) -> None: path = THIS_DIR / "data" / "include_exclude_tests" report = black.Report()