示例#1
0
 def test_encode_smaller(self):
     MAX_LENGTH = random.randint(10, 1000)
     message = 'A' * (MAX_LENGTH // 2)
     self.assertEqual(
         format.encode(message, MAX_LENGTH),
         message,
     )
示例#2
0
 def test_encode_smaller(self):
     MAX_LENGTH = random.randint(10, 1000)
     message = 'A' * (MAX_LENGTH // 2)
     self.assertEqual(
         format.encode(message, MAX_LENGTH),
         message,
     )
示例#3
0
 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)
示例#4
0
 def test_encode_none(self):
     self.assertEqual(
         format.encode(None, 1),
         None
     )
示例#5
0
 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)
示例#6
0
 def test_encode_none(self):
     self.assertEqual(
         format.encode(None, 1),
         None
     )