Added get_str fix encoding test.

This commit is contained in:
Fabio Caccamo 2019-07-02 15:16:25 +02:00
parent 3e934e245b
commit d6345fcc99
1 changed files with 11 additions and 9 deletions

View File

@ -4,6 +4,7 @@ from benedict.dicts.parse import ParseDict
from datetime import datetime from datetime import datetime
from decimal import Decimal from decimal import Decimal
from six import PY3
import unittest import unittest
@ -441,15 +442,16 @@ class ParseDictTestCase(unittest.TestCase):
self.assertEqual(b.get_str('b'), 'Hello World') self.assertEqual(b.get_str('b'), 'Hello World')
self.assertEqual(b.get_str('c'), '1') self.assertEqual(b.get_str('c'), '1')
# # only python 3 def test_get_str_fix_encoding(self):
# def test_get_str_fix_encoding(self): d = {
# d = { 'a': 'Sexâ\x80\x99n Drug',
# 'a': 'Sexâ\x80\x99n Drug', 'b': 'Localit\xe0',
# 'b': 'Localit\xe0', }
# } b = ParseDict(d)
# b = ParseDict(d) # only python 3
# # self.assertEqual(b.get_str('a'), 'Sex\'n Drug') if PY3:
# # self.assertEqual(b.get_str('b'), 'Località') self.assertEqual(b.get_str('a'), 'Sex\'n Drug')
self.assertEqual(b.get_str('b'), 'Località')
def test_get_str_list(self): def test_get_str_list(self):
d = { d = {