Ejemplo n.º 1
0
 def test_decode_method_should_normalize_and_use_input_encoding(self):
     my_table = Table(
         headers=[u"ham".encode("utf16"), u"spam".encode("utf16"), u"eggs".encode("utf16")], input_encoding="utf16"
     )
     my_table.append((123, 456, 789))
     my_table.append((987, 654, u"python".encode("utf16")))
     my_table.decode()
     my_table.encode()
     self.assertEquals(my_table[1][2], u"python")
Ejemplo n.º 2
0
 def test_decode_method_should_normalize_and_use_input_encoding(self):
     my_table = Table(headers=[
         u'ham'.encode('utf16'), u'spam'.encode('utf16'),
         u'eggs'.encode('utf16')
     ],
                      input_encoding='utf16')
     my_table.append((123, 456, 789))
     my_table.append((987, 654, u'python'.encode('utf16')))
     my_table.decode()
     my_table.encode()
     self.assertEquals(my_table[1][2], u'python')
Ejemplo n.º 3
0
 def test_encode_method_should_normalize_and_use_output_encoding(self):
     my_table = Table(headers=["ham", "spam", "eggs"], output_encoding="utf16")
     my_table.append((123, 456, 789))
     my_table.append({"ham": "abc", "spam": "def", "eggs": "ghi"})
     my_table.append((987, 654, "python"))
     my_table.decode()
     my_table.encode()
     self.assertEquals(my_table[1][0], u"abc".encode("utf16"))
     self.assertEquals(my_table[1][1], u"def".encode("utf16"))
     self.assertEquals(my_table[1][2], u"ghi".encode("utf16"))
     self.assertEquals(my_table[2][2], u"python".encode("utf16"))
Ejemplo n.º 4
0
 def test_encode_method_should_normalize_and_use_output_encoding(self):
     my_table = Table(headers=['ham', 'spam', 'eggs'],
                      output_encoding='utf16')
     my_table.append((123, 456, 789))
     my_table.append({'ham': 'abc', 'spam': 'def', 'eggs': 'ghi'})
     my_table.append((987, 654, 'python'))
     my_table.decode()
     my_table.encode()
     self.assertEquals(my_table[1][0], u'abc'.encode('utf16'))
     self.assertEquals(my_table[1][1], u'def'.encode('utf16'))
     self.assertEquals(my_table[1][2], u'ghi'.encode('utf16'))
     self.assertEquals(my_table[2][2], u'python'.encode('utf16'))