@@ -182,7 +182,7 @@ def ctx():
182182
183183
184184@pytest .fixture
185- def df (ctx ):
185+ def complex_window_df (ctx ):
186186 # create a RecordBatch and a new DataFrame from it
187187 batch = pa .RecordBatch .from_arrays (
188188 [
@@ -196,7 +196,7 @@ def df(ctx):
196196
197197
198198@pytest .fixture
199- def simple_df (ctx ):
199+ def count_window_df (ctx ):
200200 # create a RecordBatch and a new DataFrame from it
201201 batch = pa .RecordBatch .from_arrays (
202202 [pa .array ([1 , 2 , 3 ]), pa .array ([4 , 4 , 6 ])],
@@ -205,7 +205,7 @@ def simple_df(ctx):
205205 return ctx .create_dataframe ([[batch ]], name = "test_table" )
206206
207207
208- def test_udwf_errors (df ):
208+ def test_udwf_errors (complex_window_df ):
209209 with pytest .raises (TypeError ):
210210 udwf (
211211 NotSubclassOfWindowEvaluator ,
@@ -225,13 +225,13 @@ def test_udwf_errors_with_message():
225225 )
226226
227227
228- def test_udwf_basic_usage (simple_df ):
228+ def test_udwf_basic_usage (count_window_df ):
229229 """Test basic UDWF usage with a simple counting window function."""
230230 simple_count = udwf (
231231 SimpleWindowCount , pa .int64 (), pa .int64 (), volatility = "immutable"
232232 )
233233
234- df = simple_df .select (
234+ df = count_window_df .select (
235235 simple_count (column ("a" ))
236236 .window_frame (WindowFrame ("rows" , None , None ))
237237 .build ()
@@ -241,13 +241,13 @@ def test_udwf_basic_usage(simple_df):
241241 assert result .column (0 ) == pa .array ([0 , 1 , 2 ])
242242
243243
244- def test_udwf_with_args (simple_df ):
244+ def test_udwf_with_args (count_window_df ):
245245 """Test UDWF with constructor arguments."""
246246 count_base10 = udwf (
247247 lambda : SimpleWindowCount (10 ), pa .int64 (), pa .int64 (), volatility = "immutable"
248248 )
249249
250- df = simple_df .select (
250+ df = count_window_df .select (
251251 count_base10 (column ("a" ))
252252 .window_frame (WindowFrame ("rows" , None , None ))
253253 .build ()
@@ -257,14 +257,14 @@ def test_udwf_with_args(simple_df):
257257 assert result .column (0 ) == pa .array ([10 , 11 , 12 ])
258258
259259
260- def test_udwf_decorator_basic (simple_df ):
260+ def test_udwf_decorator_basic (count_window_df ):
261261 """Test UDWF used as a decorator."""
262262
263263 @udwf ([pa .int64 ()], pa .int64 (), "immutable" )
264264 def window_count () -> WindowEvaluator :
265265 return SimpleWindowCount ()
266266
267- df = simple_df .select (
267+ df = count_window_df .select (
268268 window_count (column ("a" ))
269269 .window_frame (WindowFrame ("rows" , None , None ))
270270 .build ()
@@ -274,14 +274,14 @@ def window_count() -> WindowEvaluator:
274274 assert result .column (0 ) == pa .array ([0 , 1 , 2 ])
275275
276276
277- def test_udwf_decorator_with_args (simple_df ):
277+ def test_udwf_decorator_with_args (count_window_df ):
278278 """Test UDWF decorator with constructor arguments."""
279279
280280 @udwf ([pa .int64 ()], pa .int64 (), "immutable" )
281281 def window_count_base10 () -> WindowEvaluator :
282282 return SimpleWindowCount (10 )
283283
284- df = simple_df .select (
284+ df = count_window_df .select (
285285 window_count_base10 (column ("a" ))
286286 .window_frame (WindowFrame ("rows" , None , None ))
287287 .build ()
@@ -291,7 +291,7 @@ def window_count_base10() -> WindowEvaluator:
291291 assert result .column (0 ) == pa .array ([10 , 11 , 12 ])
292292
293293
294- def test_register_udwf (ctx , simple_df ):
294+ def test_register_udwf (ctx , count_window_df ):
295295 """Test registering and using UDWF in SQL context."""
296296 window_count = udwf (
297297 SimpleWindowCount ,
@@ -415,8 +415,8 @@ def test_register_udwf(ctx, simple_df):
415415
416416
417417@pytest .mark .parametrize (("name" , "expr" , "expected" ), data_test_udwf_functions )
418- def test_udwf_functions (df , name , expr , expected ):
419- df = df .select ("a" , "b" , f .round (expr , lit (3 )).alias (name ))
418+ def test_udwf_functions (complex_window_df , name , expr , expected ):
419+ df = complex_window_df .select ("a" , "b" , f .round (expr , lit (3 )).alias (name ))
420420
421421 # execute and collect the first (and only) batch
422422 result = df .sort (column ("a" )).select (column (name )).collect ()[0 ]
0 commit comments