Example #1
0
 def test_encode_badtype_err(self):
     with self.assertRaises(encoder.EncodeError):
         encoder.encode(12.0)
Example #2
0
 def test_encode_cowmoospameggs(self):
     self.assertEqual(
         encoder.encode(OrderedDict([(b'cow', b'moo'),
                                     (b'spam', b'eggs')])),
         b'd3:cow3:moo4:spam4:eggse')
Example #3
0
 def test_encode_helloworld(self):
     self.assertEqual(encoder.encode(b'hello world'), b'11:hello world')
Example #4
0
 def test_encode_spameggs123(self):
     self.assertEqual(encoder.encode([b'spam', b'eggs', 123]),
                      b'l4:spam4:eggsi123ee')
Example #5
0
 def test_encode_123(self):
     self.assertEqual(encoder.encode(123), b'i123e')