Skip to content

Commit 7825d45

Browse files
committed
Fix unicode handling in entry tests
Closes #81
1 parent 853a1fd commit 7825d45

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/test_entry.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
from __future__ import division, print_function, unicode_literals
44

55
from codecs import open
6+
import unicodedata
67
import json
78
import locale
89
from os import environ, stat
910
from os.path import join
11+
import sys
1012

1113
from libarchive import memory_reader, memory_writer
1214

@@ -93,4 +95,13 @@ def check_entries(test_file, regen=False, ignore=''):
9395
for key in ignore:
9496
e1.pop(key)
9597
e2.pop(key)
98+
# Normalize all unicode (can vary depending on the system)
99+
for d in (e1, e2):
100+
for key in d:
101+
if sys.version_info[0] < 3:
102+
IS_UNICODE = isinstance(d[key], unicode) # noqa: F821
103+
else:
104+
IS_UNICODE = isinstance(d[key], str)
105+
if IS_UNICODE:
106+
d[key] = unicodedata.normalize('NFC', d[key])
96107
assert e1 == e2

0 commit comments

Comments
 (0)