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

Method test_assertFormatEqual_print_full_tree

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

Source from the content-addressed store, hash-verified

1045 @patch("tests.conftest.PRINT_TREE_DIFF", False)
1046 @pytest.mark.incompatible_with_mypyc
1047 def test_assertFormatEqual_print_full_tree(self) -> None:
1048 out_lines = []
1049 err_lines = []
1050
1051 def out(msg: str, **kwargs: Any) -> None:
1052 out_lines.append(msg)
1053
1054 def err(msg: str, **kwargs: Any) -> None:
1055 err_lines.append(msg)
1056
1057 with patch("black.output._out", out), patch("black.output._err", err):
1058 with self.assertRaises(AssertionError):
1059 self.assertFormatEqual("j = [1, 2, 3]", "j = [1, 2, 3,]")
1060
1061 out_str = "".join(out_lines)
1062 self.assertIn("Expected tree:", out_str)
1063 self.assertIn("Actual tree:", out_str)
1064 self.assertEqual("".join(err_lines), "")
1065
1066 @patch("tests.conftest.PRINT_FULL_TREE", False)
1067 @patch("tests.conftest.PRINT_TREE_DIFF", True)

Callers

nothing calls this directly

Calls 1

assertFormatEqualMethod · 0.80

Tested by

no test coverage detected