+ @patch("black.dump_to_file", dump_to_stderr)
+ def test_docstring(self) -> None:
+ source, expected = read_data("docstring")
+ actual = fs(source)
+ self.assertFormatEqual(expected, actual)
+ black.assert_equivalent(source, actual)
+ black.assert_stable(source, actual, DEFAULT_MODE)
+
+ @patch("black.dump_to_file", dump_to_stderr)
+ def test_docstring_no_string_normalization(self) -> None:
+ """Like test_docstring but with string normalization off."""
+ source, expected = read_data("docstring_no_string_normalization")
+ mode = replace(DEFAULT_MODE, string_normalization=False)
+ actual = fs(source, mode=mode)
+ self.assertFormatEqual(expected, actual)
+ black.assert_equivalent(source, actual)
+ black.assert_stable(source, actual, mode)
+
+ def test_long_strings(self) -> None:
+ """Tests for splitting long strings."""
+ source, expected = read_data("long_strings")
+ actual = fs(source)
+ self.assertFormatEqual(expected, actual)
+ black.assert_equivalent(source, actual)
+ black.assert_stable(source, actual, DEFAULT_MODE)
+
+ def test_long_strings_flag_disabled(self) -> None:
+ """Tests for turning off the string processing logic."""
+ source, expected = read_data("long_strings_flag_disabled")
+ mode = replace(DEFAULT_MODE, experimental_string_processing=False)
+ actual = fs(source, mode=mode)
+ self.assertFormatEqual(expected, actual)
+ black.assert_stable(expected, actual, mode)
+
+ @patch("black.dump_to_file", dump_to_stderr)
+ def test_long_strings__edge_case(self) -> None:
+ """Edge-case tests for splitting long strings."""
+ source, expected = read_data("long_strings__edge_case")
+ actual = fs(source)
+ self.assertFormatEqual(expected, actual)
+ black.assert_equivalent(source, actual)
+ black.assert_stable(source, actual, DEFAULT_MODE)
+
+ @patch("black.dump_to_file", dump_to_stderr)
+ def test_long_strings__regression(self) -> None:
+ """Regression tests for splitting long strings."""
+ source, expected = read_data("long_strings__regression")
+ actual = fs(source)
+ self.assertFormatEqual(expected, actual)
+ black.assert_equivalent(source, actual)
+ black.assert_stable(source, actual, DEFAULT_MODE)
+