Test the code option when diff is passed.
(self)
| 1878 | self.compare_results(result, "", 1) |
| 1879 | |
| 1880 | def test_code_option_diff(self) -> None: |
| 1881 | """Test the code option when diff is passed.""" |
| 1882 | code = "print('hello world')" |
| 1883 | formatted = black.format_str(code, mode=DEFAULT_MODE) |
| 1884 | result_diff = diff(code, formatted, "STDIN", "STDOUT") |
| 1885 | |
| 1886 | args = ["--diff", "--code", code] |
| 1887 | result = BlackRunner().invoke(black.main, args) |
| 1888 | |
| 1889 | # Remove time from diff |
| 1890 | output = DIFF_TIME.sub("", result.output) |
| 1891 | |
| 1892 | assert output == result_diff, "The output did not match the expected value." |
| 1893 | assert result.exit_code == 0, "The exit code is incorrect." |
| 1894 | |
| 1895 | def test_code_option_color_diff(self) -> None: |
| 1896 | """Test the code option when color and diff are passed.""" |
nothing calls this directly
no test coverage detected