Example #1
0
    def test_empty_list(self):
        """ Test that an empty list is encoded correctly. """

        self.n = bencode.encode_list([])
        self.assertEquals(self.n, "le")
Example #2
0
    def test_mixed_list(self):
        """ Test that a mixed list is encoded correctly. """

        self.n = bencode.encode_list([1, "one"])
        self.assertEquals(self.n, "li1e3:onee")
Example #3
0
    def test_nested_list(self):
        """ Test that a nested list is encoded correctly. """

        self.n = bencode.encode_list([[1, 2], [3, 4]])
        self.assertEquals(self.n, "lli1ei2eeli3ei4eee")
Example #4
0
    def test_simple_list(self):
        """ Test that a one item list is encoded correctly. """

        self.n = bencode.encode_list([1])
        self.assertEquals(self.n, "li1ee")
Example #5
0
    def test_longer_list(self):
        """ Test that a longer list is encoded correctly. """

        self.n = bencode.encode_list([1, 2, 3])
        self.assertEquals(self.n, "li1ei2ei3ee")
	def test_empty_list(self):
		""" Test that an empty list is encoded correctly. """

		self.n = bencode.encode_list([])
		self.assertEquals(self.n, "le")
	def test_nested_list(self):
		""" Test that a nested list is encoded correctly. """

		self.n = bencode.encode_list([[1, 2], [3, 4]])
		self.assertEquals(self.n, "lli1ei2eeli3ei4eee")
	def test_mixed_list(self):
		""" Test that a mixed list is encoded correctly. """

		self.n = bencode.encode_list([1, "one"])
		self.assertEquals(self.n, "li1e3:onee")
	def test_longer_list(self):
		""" Test that a longer list is encoded correctly. """

		self.n = bencode.encode_list([1, 2, 3])
		self.assertEquals(self.n, "li1ei2ei3ee")
	def test_simple_list(self):
		""" Test that a one item list is encoded correctly. """

		self.n = bencode.encode_list([1])
		self.assertEquals(self.n, "li1ee")