Esempio n. 1
0
 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)
Esempio n. 2
0
 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))
Esempio n. 3
0
 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)