Skip to content

Commit

Permalink
test(connect): improve show() test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka committed Dec 19, 2024
1 parent ea8f8bd commit 2a2ea4f
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions tests/connect/test_show.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
from __future__ import annotations


def test_show(spark_session):
def test_show(spark_session, capsys):
df = spark_session.range(10)
try:
df.show()
except Exception as e:
assert False, e
df.show()
captured = capsys.readouterr()
expected = (
"╭───────╮\n"
"│ id │\n"
"│ --- │\n"
"│ Int64 │\n"
"╞═══════╡\n"
"│ 0 │\n"
"├╌╌╌╌╌╌╌┤\n"
"│ 1 │\n"
"├╌╌╌╌╌╌╌┤\n"
"│ 2 │\n"
"├╌╌╌╌╌╌╌┤\n"
"│ 3 │\n"
"├╌╌╌╌╌╌╌┤\n"
"│ 4 │\n"
"├╌╌╌╌╌╌╌┤\n"
"│ 5 │\n"
"├╌╌╌╌╌╌╌┤\n"
"│ 6 │\n"
"├╌╌╌╌╌╌╌┤\n"
"│ 7 │\n"
"├╌╌╌╌╌╌╌┤\n"
"│ 8 │\n"
"├╌╌╌╌╌╌╌┤\n"
"│ 9 │\n"
"╰───────╯\n"
)
assert captured.out == expected

0 comments on commit 2a2ea4f

Please sign in to comment.