mirror of https://github.com/tLDP/python-tldp
switch to codecs.open and expect UTF-8 data
This commit is contained in:
parent
0d93e6fca1
commit
7c17c0dc5b
|
@ -2,6 +2,7 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import os
|
||||
import codecs
|
||||
import unittest
|
||||
from tempfile import NamedTemporaryFile as ntf
|
||||
|
||||
|
@ -14,12 +15,12 @@ from tldp.doctypes.common import SignatureChecker
|
|||
|
||||
|
||||
def genericGuessTest(content, ext):
|
||||
f = ntf(prefix='tldp-guesser-test-', suffix=ext, delete=False)
|
||||
tf = ntf(prefix='tldp-guesser-test-', suffix=ext, delete=False)
|
||||
tf.close()
|
||||
with codecs.open(tf.name, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
f.flush()
|
||||
f.close()
|
||||
dt = guess(f.name)
|
||||
os.unlink(f.name)
|
||||
dt = guess(tf.name)
|
||||
os.unlink(tf.name)
|
||||
return dt
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue