def test_decode_dict_noval_err(self): with self.assertRaises(decoder.DecodeError): decoder.decode_dict(b'd3:cowe')
def test_decode_dict_intkey_err(self): with self.assertRaises(decoder.DecodeError): decoder.decode_dict(b'di12e3:mooe')
def test_decode_dict_empty(self): self.assertEqual(decoder.decode_dict(b'de'), OrderedDict())
def test_decode_dict_cowmoospameggs(self): self.assertEqual(decoder.decode_dict(b'd3:cow3:moo4:spam4:eggse'), OrderedDict([(b'cow', b'moo'), (b'spam', b'eggs')]))
def test_decode_dict_duplicatekey_err(self): with self.assertRaises(decoder.DecodeError): decoder.decode_dict(b'd3:cowi123e3:cow4:spame')
def test_decode_dict_nesteddict(self): self.assertEqual(decoder.decode_dict(b'd3:cowd3:cowli123eeee'), OrderedDict([(b'cow', OrderedDict([(b'cow', [123])]))]))
def test_decode_dict_dictkey_err(self): with self.assertRaises(decoder.DecodeError): decoder.decode_dict(b'dd3:cowi123ee3:mooe')