예제 #1
0
    def test_nested_list(self):
        """ Test that a nested list is decoded correctly. """

        self.n = bencode.decode_list("lli1ei2eeli3ei4eee")
        self.assertEquals(self.n, [[1, 2], [3, 4]])
예제 #2
0
    def test_empty_list(self):
        """ Test that an empty list is decoded correctly. """

        self.n = bencode.decode_list("le")
        self.assertEquals(self.n, [])
예제 #3
0
    def test_longer_list(self):
        """ Test that a longer list is decoded correctly. """

        self.n = bencode.decode_list("li1ei2ei3ee")
        self.assertEquals(self.n, [1, 2, 3])
예제 #4
0
    def test_mixed_list(self):
        """ Test that a mixed list is decoded correctly. """

        self.n = bencode.decode_list("li1e3:onee")
        self.assertEquals(self.n, [1, "one"])
예제 #5
0
	def test_empty_list(self):
		""" Test that an empty list is decoded correctly. """

		self.n = bencode.decode_list("le")
		self.assertEquals(self.n, [])
예제 #6
0
    def test_simple_list(self):
        """ Test that a one item list is decoded correctly. """

        self.n = bencode.decode_list("li1ee")
        self.assertEquals(self.n, [1])
예제 #7
0
	def test_mixed_list(self):
		""" Test that a mixed list is decoded correctly. """

		self.n = bencode.decode_list("li1e3:onee")
		self.assertEquals(self.n, [1, "one"])
예제 #8
0
	def test_nested_list(self):
		""" Test that a nested list is decoded correctly. """

		self.n = bencode.decode_list("lli1ei2eeli3ei4eee")
		self.assertEquals(self.n, [[1, 2], [3, 4]])
예제 #9
0
	def test_longer_list(self):
		""" Test that a longer list is decoded correctly. """

		self.n = bencode.decode_list("li1ei2ei3ee")
		self.assertEquals(self.n, [1, 2, 3])
예제 #10
0
	def test_simple_list(self):
		""" Test that a one item list is decoded correctly. """

		self.n = bencode.decode_list("li1ee")
		self.assertEquals(self.n, [1])
예제 #11
0
 def test_decode_list(self):
     bstr = b'l4:spam4:eggse'
     # r, de_index = decode_list(bstr, 0)
     # self.assertListEqual([b'spam',b'eggs'], r)
     # self.assertEquals(14, de_index)
     self.assertEqual(([b'spam', b'eggs'], 14), decode_list(bstr, 0))
예제 #12
0
 def test_multi_dimentional_list(self):
     exp = 'l4:spamli4e4:eggsi-23ee5:helloe'
     lst = ['spam', [4, 'eggs', -23], 'hello']
     self.assertEqual(lst, b.decode_list(exp))
예제 #13
0
 def test_one_dimentional_list(self):
     exp = 'l4:spam4:eggsi23ee'
     lst = ['spam', 'eggs', 23]
     self.assertEqual(b.decode_list(exp), lst)