]>
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:
) -> None:
runner = BlackRunner()
if ignore_config:
) -> None:
runner = BlackRunner()
if ignore_config:
- args = ["--config", str(THIS_DIR / "empty.toml"), *args]
+ args = ["--verbose", "-- config", str(THIS_DIR / "empty.toml"), *args]
result = runner.invoke(black.main, args)
result = runner.invoke(black.main, args)
- self.assertEqual(result.exit_code, exit_code, msg=runner.stderr_bytes.decode())
+ self.assertEqual(
+ result.exit_code,
+ exit_code,
+ msg=f"Failed with args: {args}. Stderr: {runner.stderr_bytes.decode()!r}",
+ )
@patch("black.dump_to_file", dump_to_stderr)
def checkSourceFile(self, name: str) -> None:
@patch("black.dump_to_file", dump_to_stderr)
def checkSourceFile(self, name: str) -> None:
]
this_abs = THIS_DIR.resolve()
sources.extend(
]
this_abs = THIS_DIR.resolve()
sources.extend(
- black.gen_python_files_in_dir (
- path, this_abs, include, exclude , report, gitignore
+ black.gen_python_files(
+ path.iterdir(), this_abs, include, [exclude] , report, gitignore
)
)
self.assertEqual(sorted(expected), sorted(sources))
)
)
self.assertEqual(sorted(expected), sorted(sources))
]
this_abs = THIS_DIR.resolve()
sources.extend(
]
this_abs = THIS_DIR.resolve()
sources.extend(
- black.gen_python_files_in_dir (
- path, this_abs, include, exclude , report, gitignore
+ black.gen_python_files(
+ path.iterdir(), this_abs, include, [exclude] , report, gitignore
)
)
self.assertEqual(sorted(expected), sorted(sources))
)
)
self.assertEqual(sorted(expected), sorted(sources))
]
this_abs = THIS_DIR.resolve()
sources.extend(
]
this_abs = THIS_DIR.resolve()
sources.extend(
- black.gen_python_files_in_dir (
- path,
+ black.gen_python_files(
+ path.iterdir() ,
- re.compile(black.DEFAULT_EXCLUDES) ,
+ [re.compile(black.DEFAULT_EXCLUDES)] ,
]
this_abs = THIS_DIR.resolve()
sources.extend(
]
this_abs = THIS_DIR.resolve()
sources.extend(
- black.gen_python_files_in_dir (
- path,
+ black.gen_python_files(
+ path.iterdir() ,
this_abs,
re.compile(black.DEFAULT_INCLUDES),
this_abs,
re.compile(black.DEFAULT_INCLUDES),
child.is_symlink.return_value = True
try:
list(
child.is_symlink.return_value = True
try:
list(
- black.gen_python_files_in_dir (
- path, root, include, exclude, report, gitignore
+ black.gen_python_files(
+ path.iterdir() , root, include, exclude, report, gitignore
)
)
except ValueError as ve:
)
)
except ValueError as ve:
child.is_symlink.return_value = False
with self.assertRaises(ValueError):
list(
child.is_symlink.return_value = False
with self.assertRaises(ValueError):
list(
- black.gen_python_files_in_dir (
- path, root, include, exclude, report, gitignore
+ black.gen_python_files(
+ path.iterdir() , root, include, exclude, report, gitignore
)
)
path.iterdir.assert_called()
)
)
path.iterdir.assert_called()