@@ -214,3 +214,35 @@ def test_set_custom_header(tmp_path):
214214 assert h .box ().top_right == o .osm .Location (10 , 45 )
215215 finally :
216216 rd .close ()
217+
218+
219+ def test_add_node_after_close (tmp_path , simple_handler ):
220+ node_opl = "n235 v1 dV c0 t i0 u Telephant=yes x98.7 y-3.45"
221+
222+ filename = tmp_path / (str (uuid .uuid4 ()) + '.opl' )
223+ writer = o .SimpleWriter (str (filename ), 1024 * 1024 )
224+ writer .close ()
225+
226+ with pytest .raises (RuntimeError , match = 'closed' ):
227+ simple_handler (node_opl , node = lambda o : writer .add_node (o ))
228+
229+
230+ def test_add_way_after_close (tmp_path , simple_handler ):
231+ node_opl = "w1 Nn1"
232+
233+ filename = tmp_path / (str (uuid .uuid4 ()) + '.opl' )
234+ writer = o .SimpleWriter (str (filename ), 1024 * 1024 )
235+ writer .close ()
236+
237+ with pytest .raises (RuntimeError , match = 'closed' ):
238+ simple_handler (node_opl , way = lambda o : writer .add_way (o ))
239+
240+ def test_add_relation_after_close (tmp_path , simple_handler ):
241+ node_opl = "r54 Mn1@,w3@foo"
242+
243+ filename = tmp_path / (str (uuid .uuid4 ()) + '.opl' )
244+ writer = o .SimpleWriter (str (filename ), 1024 * 1024 )
245+ writer .close ()
246+
247+ with pytest .raises (RuntimeError , match = 'closed' ):
248+ simple_handler (node_opl , relation = lambda o : writer .add_relation (o ))
0 commit comments