def test_to_json_dict (self): report = PycheckerModuleReport("any.module") report.add_warning(PycheckerWarning("warning 1", 1)) report.add_warning(PycheckerWarning("warning 2", 2)) expected = { "name": "any.module", "warnings": [{"message": "warning 1", "line_number": 1}, {"message": "warning 2", "line_number": 2}] } self.assertEquals(expected, report.to_json_dict())