X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/e6cd10e7615f4df537e2eaefcf3904a4feecad1f..d0e06b53b09248be34c1d5c0fa8f050bff1d201c:/tests/util.py diff --git a/tests/util.py b/tests/util.py index da65ed0..3670952 100644 --- a/tests/util.py +++ b/tests/util.py @@ -1,8 +1,7 @@ import os import unittest -from contextlib import contextmanager from pathlib import Path -from typing import List, Tuple, Iterator, Any +from typing import List, Tuple, Any import black from functools import partial @@ -12,7 +11,7 @@ EMPTY_LINE = "# EMPTY LINE WITH WHITESPACE" + " (this comment will be removed)" DETERMINISTIC_HEADER = "[Deterministic header]" -DEFAULT_MODE = black.FileMode(experimental_string_processing=True) +DEFAULT_MODE = black.Mode() ff = partial(black.format_file_in_place, mode=DEFAULT_MODE, fast=True) fs = partial(black.format_str, mode=DEFAULT_MODE) @@ -45,17 +44,6 @@ class BlackBaseTestCase(unittest.TestCase): self.assertMultiLineEqual(expected, actual) -@contextmanager -def skip_if_exception(e: str) -> Iterator[None]: - try: - yield - except Exception as exc: - if exc.__class__.__name__ == e: - unittest.skip(f"Encountered expected exception {exc}, skipping") - else: - raise - - def read_data(name: str, data: bool = True) -> Tuple[str, str]: """read_data('test_name') -> 'input', 'output'""" if not name.endswith((".py", ".pyi", ".out", ".diff")):