def test_encode_badtype_err(self): with self.assertRaises(encoder.EncodeError): encoder.encode(12.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')
def test_encode_helloworld(self): self.assertEqual(encoder.encode(b'hello world'), b'11:hello world')
def test_encode_spameggs123(self): self.assertEqual(encoder.encode([b'spam', b'eggs', 123]), b'l4:spam4:eggsi123ee')
def test_encode_123(self): self.assertEqual(encoder.encode(123), b'i123e')