Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHORE] connect test: df.get_attr #3349

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/connect/test_get_attr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from __future__ import annotations


def test_get_attr(spark_session):
# Create DataFrame from range(10)
df = spark_session.range(10)

# Get column using df[...]
# df.get_attr("id") is equivalent to df["id"]
df_col = df["id"]
andrewgazelka marked this conversation as resolved.
Show resolved Hide resolved

# Check that column values match expected range
values = df.select(df_col).collect() # Changed to select column first
assert len(values) == 10
assert [row[0] for row in values] == list(range(10)) # Need to extract values from Row objects
andrewgazelka marked this conversation as resolved.
Show resolved Hide resolved