def test_get_printable_data_no_transcript(self): inp = {"year": 2016, "month": 1, "day": 1, "transcript": "", "alt": "Test", "title": "Test"} output = xkcd.get_printable_data(json.dumps(inp).encode()) expected_output = u"Test\nRelease date: 2016-1-1\nNo transcript " 'available yet.\n\nTitle text: "Test"' self.assertEqual(output, expected_output)
def test_get_printable_data_invalid_data(self): output = xkcd.get_printable_data("qwerty".encode()) expected_output = "Something went wrong when decoding JSON\nraw " "text:\nqwerty" self.assertEqual(output, expected_output)