1
1
# coding: utf-8
2
2
3
+ import codecs
4
+
3
5
from delphin .util import safe_int , SExpr , detect_encoding , LookaheadIterator
4
6
5
- import pytest , codecs
7
+ import pytest
8
+
6
9
7
10
def test_safe_int ():
8
11
assert safe_int ('1' ) == 1
@@ -58,6 +61,7 @@ def test_SExpr_format():
58
61
# assert unescape_string('\\xe3\\x81\\x82') == 'あ'
59
62
# assert unescape_string('\\N{HIRAGANA LETTER A}') == 'あ'
60
63
64
+
61
65
@pytest .fixture
62
66
def empty_file (tmp_path ):
63
67
f = tmp_path / 'empty.txt'
@@ -116,7 +120,7 @@ def shiftjis_file(tmp_path):
116
120
def eucjp_file (tmp_path ):
117
121
f = tmp_path / 'eucjp.txt'
118
122
f .write_text (u'; coding: euc_jp\n '
119
- u'a=\" あ\" ' , encoding = 'euc_jp' )
123
+ u'a=\" あ\" ' , encoding = 'euc_jp' )
120
124
return str (f )
121
125
122
126
@@ -142,9 +146,11 @@ def invalid3_file(tmp_path):
142
146
return str (f )
143
147
144
148
145
- def test_detect_encoding (empty_file , nocomment_file , utf8_file , utf8var1_file ,
149
+ def test_detect_encoding (
150
+ empty_file , nocomment_file , utf8_file , utf8var1_file ,
146
151
utf8var2_file , shiftjis_file , eucjp_file , latin1_file , invalid1_file ,
147
- invalid2_file , invalid3_file ):
152
+ invalid2_file , invalid3_file
153
+ ):
148
154
assert detect_encoding (empty_file ) == 'utf-8'
149
155
assert detect_encoding (nocomment_file ) == 'utf-8'
150
156
assert detect_encoding (utf8_file ) == 'utf-8'
0 commit comments