def test_encode_smaller(self): MAX_LENGTH = random.randint(10, 1000) message = 'A' * (MAX_LENGTH // 2) self.assertEqual( format.encode(message, MAX_LENGTH), message, )
def test_encode_longer(self): MAX_LENGTH = random.randint(10, 1000) message = 'A' * 1000 with self.assertRaisesRegexp(ValueError, "Message too long"): format.encode(message, MAX_LENGTH)
def test_encode_none(self): self.assertEqual( format.encode(None, 1), None )