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.
1 from unittest.mock import patch
4 from parameterized import parameterized
6 from tests.util import (
17 "beginning_backslash",
20 "class_blank_parentheses",
21 "class_methods_new_line",
30 "comment_after_escaped_newline",
32 "composition_no_trailing_comma",
43 "function_trailing_comma",
46 "long_strings__edge_case",
47 "long_strings__regression",
48 "numeric_literals_py2",
51 "python2_unicode_literals",
55 "tricky_unicode_symbols",
61 "tests/test_black.py",
62 "tests/test_format.py",
63 "tests/test_blackd.py",
64 "src/black/__init__.py",
65 "src/blib2to3/pygram.py",
66 "src/blib2to3/pytree.py",
67 "src/blib2to3/pgen2/conv.py",
68 "src/blib2to3/pgen2/driver.py",
69 "src/blib2to3/pgen2/grammar.py",
70 "src/blib2to3/pgen2/literals.py",
71 "src/blib2to3/pgen2/parse.py",
72 "src/blib2to3/pgen2/pgen.py",
73 "src/blib2to3/pgen2/tokenize.py",
74 "src/blib2to3/pgen2/token.py",
79 class TestSimpleFormat(BlackBaseTestCase):
80 @parameterized.expand(SIMPLE_CASES)
81 @patch("black.dump_to_file", dump_to_stderr)
82 def test_simple_format(self, filename: str) -> None:
83 source, expected = read_data(filename)
85 self.assertFormatEqual(expected, actual)
86 black.assert_equivalent(source, actual)
87 black.assert_stable(source, actual, DEFAULT_MODE)
89 @parameterized.expand(SOURCES)
90 @patch("black.dump_to_file", dump_to_stderr)
91 def test_source_is_formatted(self, filename: str) -> None:
92 path = THIS_DIR.parent / filename
93 source, expected = read_data(str(path), data=False)
94 actual = fs(source, mode=DEFAULT_MODE)
95 self.assertFormatEqual(expected, actual)
96 black.assert_equivalent(source, actual)
97 black.assert_stable(source, actual, DEFAULT_MODE)
98 self.assertFalse(ff(path))