예제 #1
0
    def test_string_length(self):
        """ Test that string length is respected. """

        self.n = bencode.decode_str("1:abc")
        self.assertEqual(self.n, "a")
예제 #2
0
 def test_str(self):
     bencode = [b'13:parrot sketch', b'6:github']
     real = [b'parrot sketch', b'github']
     for (bencode, real) in list(zip(bencode, real)):
         assert decode_str(bencode, 0)[0] == real
예제 #3
0
    def test_string(self):
        """ Test that a string is decoded correctly. """

        self.n = bencode.decode_str("4:test")
        self.assertEqual(self.n, "test")
예제 #4
0
    def test_long_string(self):
        """ Test that a long string is decoded correctly. """

        self.n = bencode.decode_str("15:averylongstring")
        self.assertEqual(self.n, "averylongstring")
예제 #5
0
	def test_string_length(self):
		""" Test that string length is respected. """

		self.n = bencode.decode_str("1:abc")
		self.assertEqual(self.n, "a")
예제 #6
0
    def test_character(self):
        """ Test that a single character is decoded correctly """

        self.n = bencode.decode_str("1:a")
        self.assertEqual(self.n, "a")
예제 #7
0
	def test_string(self):
		""" Test that a string is decoded correctly. """

		self.n = bencode.decode_str("4:test")
		self.assertEqual(self.n, "test")
예제 #8
0
	def test_long_string(self):
		""" Test that a long string is decoded correctly. """

		self.n = bencode.decode_str("15:averylongstring")
		self.assertEqual(self.n, "averylongstring")
예제 #9
0
	def test_character(self):
		""" Test that a single character is decoded correctly """

		self.n = bencode.decode_str("1:a")
		self.assertEqual(self.n, "a")
예제 #10
0
 def test_exception_on_wrong_datatype(self):
     with self.assertRaises(b.BencodeError) as context:
         b.decode_str('i23e')
예제 #11
0
 def test_str_len(self):
     self.assertEqual('hello', b.decode_str('5:helloworld'))
예제 #12
0
 def test_long_string(self):
     self.assertEqual('dweirieakddewqw', b.decode_str( '15:dweirieakddewqw'))
예제 #13
0
 def test_single_char(self):
     self.assertEqual('a', b.decode_str( '1:a'))