Skip to content

Commit

Permalink
[SPARK-47499][PYTHON][CONNECT][TESTS] Enable test_help_command test
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
Reuse `test_help_command` in Connect

### Why are the changes needed?
for test coverage

I checked [SPARK-5464](https://issues.apache.org/jira/browse/SPARK-5464) that it seems doesn't have to create this test dataframe from python RDD

### Does this PR introduce _any_ user-facing change?
no, test-only

### How was this patch tested?
ci

### Was this patch authored or co-authored using generative AI tooling?
no

Closes apache#45634 from zhengruifeng/reuse_test_help.

Authored-by: Ruifeng Zheng <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
  • Loading branch information
zhengruifeng authored and dongjoon-hyun committed Mar 22, 2024
1 parent aea13fc commit ca44489
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/pyspark/sql/tests/connect/test_parity_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@


class DataFrameParityTests(DataFrameTestsMixin, ReusedConnectTestCase):
@unittest.skip("Spark Connect does not support RDD but the tests depend on them.")
def test_help_command(self):
super().test_help_command()
df = self.spark.createDataFrame(data=[{"foo": "bar"}, {"foo": "baz"}])
super().check_help_command(df)

# Spark Connect throws `IllegalArgumentException` when calling `collect` instead of `sample`.
def test_sample(self):
Expand Down
3 changes: 3 additions & 0 deletions python/pyspark/sql/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def test_help_command(self):
rdd = self.sc.parallelize(['{"foo":"bar"}', '{"foo":"baz"}'])
df = self.spark.read.json(rdd)
# render_doc() reproduces the help() exception without printing output
self.check_help_command(df)

def check_help_command(self, df):
pydoc.render_doc(df)
pydoc.render_doc(df.foo)
pydoc.render_doc(df.take(1))
Expand Down

0 comments on commit ca44489

Please sign in to comment.