]>
git.madduck.net Git - etc/vim.git/blobdiff - tests/test_black.py
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
if ignore_config:
args = ["--verbose", "--config", str(THIS_DIR / "empty.toml"), *args]
result = runner.invoke(black.main, args)
if ignore_config:
args = ["--verbose", "--config", str(THIS_DIR / "empty.toml"), *args]
result = runner.invoke(black.main, args)
+ assert result.stdout_bytes is not None
+ assert result.stderr_bytes is not None
self.assertEqual(
result.exit_code,
exit_code,
self.assertEqual(
result.exit_code,
exit_code,
self.assertEqual(result.exit_code, 123)
finally:
os.unlink(tmp_file)
self.assertEqual(result.exit_code, 123)
finally:
os.unlink(tmp_file)
+ assert result.stderr_bytes is not None
actual = (
result.stderr_bytes.decode()
.replace("\n", "")
actual = (
result.stderr_bytes.decode()
.replace("\n", "")
def test_shhh_click(self) -> None:
try:
def test_shhh_click(self) -> None:
try:
- from click import _unicodefun # type: ignore
+ from click import _unicodefun
except ModuleNotFoundError:
self.skipTest("Incompatible Click version")
if not hasattr(_unicodefun, "_verify_python3_env"):
except ModuleNotFoundError:
self.skipTest("Incompatible Click version")
if not hasattr(_unicodefun, "_verify_python3_env"):
with patch("locale.getpreferredencoding") as gpe:
gpe.return_value = "ASCII"
with self.assertRaises(RuntimeError):
with patch("locale.getpreferredencoding") as gpe:
gpe.return_value = "ASCII"
with self.assertRaises(RuntimeError):
- _unicodefun._verify_python3_env()
+ _unicodefun._verify_python3_env() # type: ignore
# Now, let's silence Click...
black.patch_click()
# ...and confirm it's silent.
with patch("locale.getpreferredencoding") as gpe:
gpe.return_value = "ASCII"
try:
# Now, let's silence Click...
black.patch_click()
# ...and confirm it's silent.
with patch("locale.getpreferredencoding") as gpe:
gpe.return_value = "ASCII"
try:
- _unicodefun._verify_python3_env()
+ _unicodefun._verify_python3_env() # type: ignore
except RuntimeError as re:
self.fail(f"`patch_click()` failed, exception still raised: {re}")
except RuntimeError as re:
self.fail(f"`patch_click()` failed, exception still raised: {re}")