@@ -98,8 +98,7 @@ def test_create_word() -> None:
9898def test_apply_word_without_json (tmp_path : Path ) -> None :
9999
100100 user_dict = UserDictionary (
101- user_dict_path = tmp_path / "test_apply_word_without_json.json" ,
102- compiled_dict_path = tmp_path / "test_apply_word_without_json.dic" ,
101+ user_dict_path = tmp_path / "test_apply_word_without_json.json"
103102 )
104103 user_dict .apply_word (
105104 WordProperty (surface = "test" , pronunciation = "テスト" , accent_type = 1 )
@@ -119,10 +118,7 @@ def test_apply_word_with_json(tmp_path: Path) -> None:
119118 user_dict_path .write_text (
120119 json .dumps (valid_dict_dict_json , ensure_ascii = False ), encoding = "utf-8"
121120 )
122- user_dict = UserDictionary (
123- user_dict_path = user_dict_path ,
124- compiled_dict_path = tmp_path / "test_apply_word_with_json.dic" ,
125- )
121+ user_dict = UserDictionary (user_dict_path = user_dict_path )
126122 user_dict .apply_word (
127123 WordProperty (surface = "test2" , pronunciation = "テストツー" , accent_type = 3 )
128124 )
@@ -141,10 +137,7 @@ def test_rewrite_word_invalid_id(tmp_path: Path) -> None:
141137 user_dict_path .write_text (
142138 json .dumps (valid_dict_dict_json , ensure_ascii = False ), encoding = "utf-8"
143139 )
144- user_dict = UserDictionary (
145- user_dict_path = user_dict_path ,
146- compiled_dict_path = (tmp_path / "test_rewrite_word_invalid_id.dic" ),
147- )
140+ user_dict = UserDictionary (user_dict_path = user_dict_path )
148141 with pytest .raises (UserDictInputError ):
149142 user_dict .rewrite_word (
150143 "c2be4dc5-d07d-4767-8be1-04a1bb3f05a9" ,
@@ -157,10 +150,7 @@ def test_rewrite_word_valid_id(tmp_path: Path) -> None:
157150 user_dict_path .write_text (
158151 json .dumps (valid_dict_dict_json , ensure_ascii = False ), encoding = "utf-8"
159152 )
160- user_dict = UserDictionary (
161- user_dict_path = user_dict_path ,
162- compiled_dict_path = tmp_path / "test_rewrite_word_valid_id.dic" ,
163- )
153+ user_dict = UserDictionary (user_dict_path = user_dict_path )
164154 user_dict .rewrite_word (
165155 "aab7dda2-0d97-43c8-8cb7-3f440dab9b4e" ,
166156 WordProperty (surface = "test2" , pronunciation = "テストツー" , accent_type = 2 ),
@@ -178,10 +168,7 @@ def test_delete_word_invalid_id(tmp_path: Path) -> None:
178168 user_dict_path .write_text (
179169 json .dumps (valid_dict_dict_json , ensure_ascii = False ), encoding = "utf-8"
180170 )
181- user_dict = UserDictionary (
182- user_dict_path = user_dict_path ,
183- compiled_dict_path = tmp_path / "test_delete_word_invalid_id.dic" ,
184- )
171+ user_dict = UserDictionary (user_dict_path = user_dict_path )
185172 with pytest .raises (UserDictInputError ):
186173 user_dict .delete_word (word_uuid = "c2be4dc5-d07d-4767-8be1-04a1bb3f05a9" )
187174
@@ -191,10 +178,7 @@ def test_delete_word_valid_id(tmp_path: Path) -> None:
191178 user_dict_path .write_text (
192179 json .dumps (valid_dict_dict_json , ensure_ascii = False ), encoding = "utf-8"
193180 )
194- user_dict = UserDictionary (
195- user_dict_path = user_dict_path ,
196- compiled_dict_path = tmp_path / "test_delete_word_valid_id.dic" ,
197- )
181+ user_dict = UserDictionary (user_dict_path = user_dict_path )
198182 user_dict .delete_word (word_uuid = "aab7dda2-0d97-43c8-8cb7-3f440dab9b4e" )
199183 assert len (user_dict .read_dict ()) == 0
200184
@@ -218,13 +202,10 @@ def test_priority() -> None:
218202
219203def test_import_dict (tmp_path : Path ) -> None :
220204 user_dict_path = tmp_path / "test_import_dict.json"
221- compiled_dict_path = tmp_path / "test_import_dict.dic"
222205 user_dict_path .write_text (
223206 json .dumps (valid_dict_dict_json , ensure_ascii = False ), encoding = "utf-8"
224207 )
225- user_dict = UserDictionary (
226- user_dict_path = user_dict_path , compiled_dict_path = compiled_dict_path
227- )
208+ user_dict = UserDictionary (user_dict_path = user_dict_path )
228209 user_dict .import_user_dict (
229210 {"b1affe2a-d5f0-4050-926c-f28e0c1d9a98" : import_word }, override = False
230211 )
@@ -236,13 +217,10 @@ def test_import_dict(tmp_path: Path) -> None:
236217
237218def test_import_dict_no_override (tmp_path : Path ) -> None :
238219 user_dict_path = tmp_path / "test_import_dict_no_override.json"
239- compiled_dict_path = tmp_path / "test_import_dict_no_override.dic"
240220 user_dict_path .write_text (
241221 json .dumps (valid_dict_dict_json , ensure_ascii = False ), encoding = "utf-8"
242222 )
243- user_dict = UserDictionary (
244- user_dict_path = user_dict_path , compiled_dict_path = compiled_dict_path
245- )
223+ user_dict = UserDictionary (user_dict_path = user_dict_path )
246224 user_dict .import_user_dict (
247225 {"aab7dda2-0d97-43c8-8cb7-3f440dab9b4e" : import_word }, override = False
248226 )
@@ -253,13 +231,10 @@ def test_import_dict_no_override(tmp_path: Path) -> None:
253231
254232def test_import_dict_override (tmp_path : Path ) -> None :
255233 user_dict_path = tmp_path / "test_import_dict_override.json"
256- compiled_dict_path = tmp_path / "test_import_dict_override.dic"
257234 user_dict_path .write_text (
258235 json .dumps (valid_dict_dict_json , ensure_ascii = False ), encoding = "utf-8"
259236 )
260- user_dict = UserDictionary (
261- user_dict_path = user_dict_path , compiled_dict_path = compiled_dict_path
262- )
237+ user_dict = UserDictionary (user_dict_path = user_dict_path )
263238 user_dict .import_user_dict (
264239 {"aab7dda2-0d97-43c8-8cb7-3f440dab9b4e" : import_word }, override = True
265240 )
@@ -268,15 +243,12 @@ def test_import_dict_override(tmp_path: Path) -> None:
268243
269244def test_import_invalid_word (tmp_path : Path ) -> None :
270245 user_dict_path = tmp_path / "test_import_invalid_dict.json"
271- compiled_dict_path = tmp_path / "test_import_invalid_dict.dic"
272246 invalid_accent_associative_rule_word = deepcopy (import_word )
273247 invalid_accent_associative_rule_word .accent_associative_rule = "invalid"
274248 user_dict_path .write_text (
275249 json .dumps (valid_dict_dict_json , ensure_ascii = False ), encoding = "utf-8"
276250 )
277- user_dict = UserDictionary (
278- user_dict_path = user_dict_path , compiled_dict_path = compiled_dict_path
279- )
251+ user_dict = UserDictionary (user_dict_path = user_dict_path )
280252 with pytest .raises (AssertionError ):
281253 user_dict .import_user_dict (
282254 {
@@ -299,10 +271,7 @@ def test_import_invalid_word(tmp_path: Path) -> None:
299271
300272def test_update_dict (tmp_path : Path ) -> None :
301273 user_dict_path = tmp_path / "test_update_dict.json"
302- compiled_dict_path = tmp_path / "test_update_dict.dic"
303- user_dict = UserDictionary (
304- user_dict_path = user_dict_path , compiled_dict_path = compiled_dict_path
305- )
274+ user_dict = UserDictionary (user_dict_path = user_dict_path )
306275 user_dict .update_dict ()
307276 test_text = "テスト用の文字列"
308277 success_pronunciation = "デフォルトノジショデハゼッタイニセイセイサレナイヨミ"
0 commit comments