@@ -124,10 +124,6 @@ def test_array():
124124 assert array .type == ga .large_wkt ()
125125 assert array .type .storage_type == pa .large_utf8 ()
126126
127- array = ga .array (["POINT (30 10)" ], ga .wkt_view ())
128- assert array .type == ga .wkt_view ()
129- assert array .type .storage_type == pa .string_view ()
130-
131127 array = ga .array ([wkb_item ], ga .wkb ())
132128 assert array .type == ga .wkb ()
133129 assert array .type .storage_type == pa .binary ()
@@ -136,6 +132,20 @@ def test_array():
136132 assert array .type == ga .large_wkb ()
137133 assert array .type .storage_type == pa .large_binary ()
138134
135+
136+ def test_array_view_types ():
137+ # This one requires pyarrow >= 18, because that's when the necessary
138+ # cast() was added.
139+ try :
140+ pa .array (["foofy" ]).cast (pa .string_view ())
141+ except pa .lib .ArrowNotImplementedError :
142+ pytest .skip ("ga.array() with view types requires pyarrow >= 18.0.0" )
143+
144+ array = ga .array (["POINT (30 10)" ], ga .wkt_view ())
145+ assert array .type == ga .wkt_view ()
146+ assert array .type .storage_type == pa .string_view ()
147+
148+ wkb_item = b"\x01 \x01 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x3e \x40 \x00 \x00 \x00 \x00 \x00 \x00 \x24 \x40 "
139149 array = ga .array ([wkb_item ], ga .wkb_view ())
140150 assert array .type == ga .wkb_view ()
141151 assert array .type .storage_type == pa .binary_view ()
0 commit comments