X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/7fe19fac5bccc08dbcf21c293ab50f1fcda7716f..25c1b6dff7264278c1ca1649f321a3bd8df293b1:/tests/test_black.py diff --git a/tests/test_black.py b/tests/test_black.py index 629afc5..bc80c8f 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -9,6 +9,7 @@ import inspect from io import BytesIO, TextIOWrapper import os from pathlib import Path +from platform import system import regex as re import sys from tempfile import TemporaryDirectory @@ -1939,6 +1940,23 @@ class BlackTestCase(unittest.TestCase): self.assertEqual(black.find_project_root((src_dir,)), src_dir.resolve()) self.assertEqual(black.find_project_root((src_python,)), src_dir.resolve()) + def test_bpo_33660_workaround(self) -> None: + if system() == "Windows": + return + + # https://bugs.python.org/issue33660 + + old_cwd = Path.cwd() + try: + root = Path("/") + os.chdir(str(root)) + path = Path("workspace") / "project" + report = black.Report(verbose=True) + normalized_path = black.normalize_path_maybe_ignore(path, root, report) + self.assertEqual(normalized_path, "workspace/project") + finally: + os.chdir(str(old_cwd)) + class BlackDTestCase(AioHTTPTestCase): async def get_application(self) -> web.Application: