@@ -247,7 +247,7 @@ def test_read_dmo_write_dlo_throws_error(self):
247
247
finally :
248
248
os .unlink (temp_path )
249
249
250
- def test_invalid_multiple_writes (self ):
250
+ def test_multiple_writes (self ):
251
251
"""Test scanning a file with multiple write operations."""
252
252
content = textwrap .dedent (
253
253
"""
@@ -258,15 +258,25 @@ def test_invalid_multiple_writes(self):
258
258
# Read from DLO
259
259
df = client.read_dlo("input_dlo")
260
260
261
- # Write to multiple DLOs - invalid
262
- client.write_to_dlo("output_dlo_1", df, "overwrite")
263
- client.write_to_dlo("output_dlo_2", df, "overwrite")
261
+ # Transform data for different outputs
262
+ df_filtered = df.filter(df.col > 10)
263
+ df_aggregated = df.groupBy("category").agg({"value": "sum"})
264
+
265
+ # Write to multiple DLOs
266
+ client.write_to_dlo("output_filtered", df_filtered, "overwrite")
267
+ client.write_to_dlo("output_aggregated", df_aggregated, "overwrite")
264
268
"""
265
269
)
266
270
temp_path = create_test_script (content )
267
271
try :
268
- with pytest .raises (ValueError , match = "Cannot write to more than one DLO" ):
269
- scan_file (temp_path )
272
+ result = scan_file (temp_path )
273
+ assert "input_dlo" in result .read_dlo
274
+ assert "output_filtered" in result .write_to_dlo
275
+ assert "output_aggregated" in result .write_to_dlo
276
+ assert len (result .read_dlo ) == 1
277
+ assert len (result .write_to_dlo ) == 2
278
+ assert len (result .read_dmo ) == 0
279
+ assert len (result .write_to_dmo ) == 0
270
280
finally :
271
281
os .unlink (temp_path )
272
282
0 commit comments