Skip to content

Commit 4619bff

Browse files
committed
Add test to ensure headers are printed when showing a query with no batches
1 parent ed14eab commit 4619bff

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

python/tests/test_dataframe.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,16 @@ def test_empty_to_pandas(df):
14641464
assert set(pandas_df.columns) == {"a", "b", "c"}
14651465

14661466

1467+
def test_show_no_batches(capsys):
1468+
"""Ensure showing a query with no batches still prints headers."""
1469+
ctx = SessionContext()
1470+
df = ctx.sql("SELECT 1 AS a WHERE 1=0")
1471+
df.show()
1472+
captured = capsys.readouterr()
1473+
assert "| a |" in captured.out
1474+
assert "Empty DataFrame" not in captured.out
1475+
1476+
14671477
def test_show_empty_dataframe(df, capsys):
14681478
"""Ensure showing an empty DataFrame prints a helpful message."""
14691479
empty_df = df.limit(0)

0 commit comments

Comments
 (0)