Пример #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)