def test_truncate(self): s = "foo" s_truncated = truncate(s) self.assertEqual(s, s_truncated) many_lines = "\n".join(map(lambda x: "line %d" % x, [l for l in range(500)])) less_lines = truncate(many_lines) self.assertTrue("lines suppressed" in less_lines)
def test_no_truncate(self): text = 'arst' self.assertEqual(truncate(text), text)
def test_trunctate(self): text = 'a\na\na\na\na\na\na\na\na\na\na\na \ \na\na\na\na\na\na\na\na\na\na\na \ \na\na\na\na\na\na\na\na\na\na' self.assertNotEqual(truncate(text), text)