@@ -148,6 +148,18 @@ def test_to_b2z_materializes_view():
148148 assert list (opened ["id" ][:]) == [2 , 3 ]
149149
150150
151+ def test_copy_to_b2z_uses_urlpath_extension ():
152+ dest = table_path ("copy_dst.b2z" )
153+ t = CTable (Row , new_data = [(10 , 50.0 , True ), (20 , 60.0 , False )])
154+
155+ copied = t .copy (urlpath = dest )
156+
157+ assert isinstance (copied , CTable )
158+ assert os .path .exists (dest )
159+ assert len (copied ) == 2
160+ assert list (copied ["id" ][:]) == [10 , 20 ]
161+
162+
151163def test_to_b2d_unpacks_persistent_b2z ():
152164 src_b2d = table_path ("to_b2d_src.b2d" )
153165 src_b2z = table_path ("to_b2d_src.b2z" )
@@ -179,6 +191,25 @@ def test_to_b2d_materializes_view():
179191 assert list (opened ["id" ][:]) == [2 , 3 ]
180192
181193
194+ def test_copy_to_b2d_uses_urlpath_extension ():
195+ dest = table_path ("copy_dst.b2d" )
196+ t = CTable (Row , new_data = [(10 , 50.0 , True ), (20 , 60.0 , False )])
197+
198+ copied = t .copy (urlpath = dest )
199+
200+ assert isinstance (copied , CTable )
201+ assert os .path .isdir (dest )
202+ assert len (copied ) == 2
203+ assert list (copied ["id" ][:]) == [10 , 20 ]
204+
205+
206+ def test_copy_rejects_unknown_urlpath_extension ():
207+ t = CTable (Row , new_data = [(10 , 50.0 , True )])
208+
209+ with pytest .raises (ValueError , match = r"\.b2z or \.b2d" ):
210+ t .copy (urlpath = table_path ("copy_dst.b2nd" ))
211+
212+
182213def test_column_order_preserved_after_reopen ():
183214 """Column order from the schema JSON is respected on reopen."""
184215 path = table_path ("order" )
0 commit comments