Esempio n. 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]])
Esempio n. 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, [])
Esempio 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])
Esempio n. 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"])
	def test_empty_list(self):
		""" Test that an empty list is decoded correctly. """

		self.n = bencode.decode_list("le")
		self.assertEquals(self.n, [])
Esempio 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])
	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"])
	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]])
	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])
Esempio n. 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])
Esempio n. 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))
Esempio n. 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))
Esempio n. 13
0
 def test_one_dimentional_list(self):
     exp = 'l4:spam4:eggsi23ee'
     lst = ['spam', 'eggs', 23]
     self.assertEqual(b.decode_list(exp), lst)