MCPcopy
hub / github.com/psf/black / test_assertFormatEqual_print_tree_diff

Method test_assertFormatEqual_print_tree_diff

tests/test_black.py:1069–1087  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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))

Callers

nothing calls this directly

Calls 1

assertFormatEqualMethod · 0.80

Tested by

no test coverage detected