def test_format_message_without_character(self): location = Location(path="file.py", module=None, function=None, line=17, character=None) expected = Message(source="mypy", code="error", location=location, message="Important error") self.assertEqual(format_message("file.py:17: error: Important error"), expected)
def test_format_message_without_character_and_columns_in_message(self): location = Location(path="file.py", module=None, function=None, line=17, character=None) expected = Message(source="mypy", code="note", location=location, message="Important error") self.assertEqual( format_message('file.py:17: note: unused "type: ignore" comment'), expected)
def test_format_dupplicated_module_linux(self): location = Location(path="file.py", module=None, function=None, line=0, character=None) expected = Message( source="mypy", code="error", location=location, message= "Duplicate module named 'file' (also at '/Repositories/file.py')", ) self.assertEqual( format_message( "file.py: error: Duplicate module named 'file' (also at '/Repositories/file.py')" ), expected, )