def check_file(self, filename: str, mode: black.Mode, *, data: bool = True) -> None: source, expected = read_data(filename, data=data) actual = fs(source, mode=mode) self.assertFormatEqual(expected, actual) if source != actual: black.assert_equivalent(source, actual) black.assert_stable(source, actual, mode)
def test_source_is_formatted(self, filename: str) -> None: path = THIS_DIR.parent / filename source, expected = read_data(str(path), data=False) actual = fs(source, mode=DEFAULT_MODE) self.assertFormatEqual(expected, actual) black.assert_equivalent(source, actual) black.assert_stable(source, actual, DEFAULT_MODE) self.assertFalse(ff(path))
def test_simple_format(self, filename: str) -> None: source, expected = read_data(filename) actual = fs(source) self.assertFormatEqual(expected, actual) black.assert_equivalent(source, actual) black.assert_stable(source, actual, DEFAULT_MODE)