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
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import codecs
|
||||||
import unittest
|
import unittest
|
||||||
from tempfile import NamedTemporaryFile as ntf
|
from tempfile import NamedTemporaryFile as ntf
|
||||||
|
|
||||||
|
@ -14,12 +15,12 @@ from tldp.doctypes.common import SignatureChecker
|
||||||
|
|
||||||
|
|
||||||
def genericGuessTest(content, ext):
|
def genericGuessTest(content, ext):
|
||||||
f = ntf(prefix='tldp-guesser-test-', suffix=ext, delete=False)
|
tf = ntf(prefix='tldp-guesser-test-', suffix=ext, delete=False)
|
||||||
f.write(content)
|
tf.close()
|
||||||
f.flush()
|
with codecs.open(tf.name, 'w', encoding='utf-8') as f:
|
||||||
f.close()
|
f.write(content)
|
||||||
dt = guess(f.name)
|
dt = guess(tf.name)
|
||||||
os.unlink(f.name)
|
os.unlink(tf.name)
|
||||||
return dt
|
return dt
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue