From d6345fcc99a3253568b3691e989d957c05361848 Mon Sep 17 00:00:00 2001 From: Fabio Caccamo Date: Tue, 2 Jul 2019 15:16:25 +0200 Subject: [PATCH] Added get_str fix encoding test. --- tests/test_parse_dict.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/test_parse_dict.py b/tests/test_parse_dict.py index 21561dd..66be57a 100644 --- a/tests/test_parse_dict.py +++ b/tests/test_parse_dict.py @@ -4,6 +4,7 @@ from benedict.dicts.parse import ParseDict from datetime import datetime from decimal import Decimal +from six import PY3 import unittest @@ -441,15 +442,16 @@ class ParseDictTestCase(unittest.TestCase): self.assertEqual(b.get_str('b'), 'Hello World') self.assertEqual(b.get_str('c'), '1') - # # only python 3 - # def test_get_str_fix_encoding(self): - # d = { - # 'a': 'Sexâ\x80\x99n Drug', - # 'b': 'Localit\xe0', - # } - # b = ParseDict(d) - # # self.assertEqual(b.get_str('a'), 'Sex\'n Drug') - # # self.assertEqual(b.get_str('b'), 'Località') + def test_get_str_fix_encoding(self): + d = { + 'a': 'Sexâ\x80\x99n Drug', + 'b': 'Localit\xe0', + } + b = ParseDict(d) + # only python 3 + if PY3: + self.assertEqual(b.get_str('a'), 'Sex\'n Drug') + self.assertEqual(b.get_str('b'), 'Località') def test_get_str_list(self): d = {