(self)
| 1067 | @patch("tests.conftest.PRINT_TREE_DIFF", True) |
| 1068 | @pytest.mark.incompatible_with_mypyc |
| 1069 | def test_assertFormatEqual_print_tree_diff(self) -> None: |
| 1070 | out_lines = [] |
| 1071 | err_lines = [] |
| 1072 | |
| 1073 | def out(msg: str, **kwargs: Any) -> None: |
| 1074 | out_lines.append(msg) |
| 1075 | |
| 1076 | def err(msg: str, **kwargs: Any) -> None: |
| 1077 | err_lines.append(msg) |
| 1078 | |
| 1079 | with patch("black.output._out", out), patch("black.output._err", err): |
| 1080 | with self.assertRaises(AssertionError): |
| 1081 | self.assertFormatEqual("j = [1, 2, 3]\n", "j = [1, 2, 3,]\n") |
| 1082 | |
| 1083 | out_str = "".join(out_lines) |
| 1084 | self.assertIn("Tree Diff:", out_str) |
| 1085 | self.assertIn("+ COMMA", out_str) |
| 1086 | self.assertIn("+ ','", out_str) |
| 1087 | self.assertEqual("".join(err_lines), "") |
| 1088 | |
| 1089 | @event_loop() |
| 1090 | @patch("concurrent.futures.ProcessPoolExecutor", MagicMock(side_effect=OSError)) |
nothing calls this directly
no test coverage detected