def test_mixed_dict(self): """ Test that a dict with a list value is encoded correctly. """ self.n = bencode.encode_dict({'key': ['a', 'b']}) self.assertEquals(self.n, "d3:keyl1:a1:bee")
def test_nested_dict(self): """ Test that a nested dict is encoded correctly. """ self.n = bencode.encode_dict({"key": {"key": "value"}}) self.assertEquals(self.n, "d3:keyd3:key5:valueee")
def test_simple_dict(self): """ Test that a one key dict is encoded correctly. """ self.n = bencode.encode_dict({"key": "value"}) self.assertEquals(self.n, "d3:key5:valuee")
def test_longer_dict(self): """ Test that a longer dict is encoded correctly. """ self.n = bencode.encode_dict({"key_1": "value_1", "key_2": "value_2"}) self.assertEquals(self.n, "d5:key_17:value_15:key_27:value_2e")
def test_nested_dict(self): """ Test that a nested dict is encoded correctly. """ self.n = bencode.encode_dict({"key":{"key":"value"}}) self.assertEquals(self.n, "d3:keyd3:key5:valueee")
def test_longer_dict(self): """ Test that a longer dict is encoded correctly. """ self.n = bencode.encode_dict({"key_1":"value_1", "key_2":"value_2"}) self.assertEquals(self.n, "d5:key_17:value_15:key_27:value_2e")
def test_simple_dict(self): """ Test that a one key dict is encoded correctly. """ self.n = bencode.encode_dict({"key":"value"}) self.assertEquals(self.n, "d3:key5:valuee")
def bencodeDict(self, data): myData = [] bencode.encode_dict(data, myData) myData = "".join(myData) return myData