File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 101101def _create_external_table_location (self : Any ) -> str :
102102 """Return the first external table location.
103103
104+ Use :meth:`CreateExternalTable.locations` instead.
105+
104106 Examples:
105107 >>> class Command:
106108 ... def locations(self) -> list[str]:
107109 ... return ["data.csv"]
108- >>> _create_external_table_location( Command())
109- 'data.csv'
110+ >>> Command().locations( )
111+ [ 'data.csv']
110112 """
111113 locations = self .locations ()
112114 return locations [0 ] if locations else ""
Original file line number Diff line number Diff line change @@ -123,6 +123,11 @@ def register_catalog(
123123class CustomTableProviderFactory (dfn .catalog .TableProviderFactory ):
124124 def create (self , cmd : dfn .expr .CreateExternalTable ):
125125 assert cmd .name () == "test_table_factory"
126+ assert cmd .locations () == ["foo" ]
127+
128+ with pytest .warns (DeprecationWarning , match = r"location\(\).+deprecated" ):
129+ assert cmd .location () == "foo"
130+
126131 return create_dataset ()
127132
128133
Original file line number Diff line number Diff line change 1919from concurrent .futures import ThreadPoolExecutor
2020from datetime import date , datetime , time , timezone
2121from decimal import Decimal
22- from unittest .mock import MagicMock
2322
2423import arro3 .core
2524import nanoarrow
4039 BinaryExpr ,
4140 Column ,
4241 CopyTo ,
43- CreateExternalTable ,
4442 CreateIndex ,
4543 DescribeTable ,
4644 DmlStatement ,
@@ -70,17 +68,6 @@ def test_ctx():
7068 return ctx
7169
7270
73- def test_create_external_table_location_is_deprecated ():
74- """The singular location accessor delegates to locations()."""
75- command = MagicMock ()
76- command .locations .return_value = ["first.csv" , "second.csv" ]
77-
78- with pytest .warns (DeprecationWarning , match = r"location\(\).+deprecated" ):
79- location = CreateExternalTable .location (command )
80-
81- assert location == "first.csv"
82-
83-
8471def test_projection (test_ctx ):
8572 df = test_ctx .sql ("select c1, 123, c1 < 123 from test" )
8673 plan = df .logical_plan ()
You can’t perform that action at this time.
0 commit comments