-
Notifications
You must be signed in to change notification settings - Fork 147
Enable doc tests in local and CI testing #1409
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -327,8 +327,9 @@ def into_view(self, temporary: bool = False) -> Table: | |
| >>> df = ctx.sql("SELECT 1 AS value") | ||
| >>> view = df.into_view() | ||
| >>> ctx.register_table("values_view", view) | ||
| >>> df.collect() # The DataFrame is still usable | ||
| >>> ctx.sql("SELECT value FROM values_view").collect() | ||
| >>> result = ctx.sql("SELECT value FROM values_view").collect() | ||
| >>> result[0].column("value").to_pylist() | ||
| [1] | ||
| """ | ||
| from datafusion.catalog import Table as _Table | ||
|
|
||
|
|
@@ -1389,9 +1390,12 @@ def fill_null(self, value: Any, subset: list[str] | None = None) -> DataFrame: | |
| DataFrame with null values replaced where type casting is possible | ||
|
|
||
| Examples: | ||
| >>> df = df.fill_null(0) # Fill all nulls with 0 where possible | ||
| >>> # Fill nulls in specific string columns | ||
| >>> df = df.fill_null("missing", subset=["name", "category"]) | ||
| >>> from datafusion import SessionContext, col | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @ntjohnson1 Did you verify from the CI run logs that these tests are now run? I took a brief look and couldn't find anything that was new http://github.com/apache/datafusion-python/actions/runs/22687531822/job/65776433980?pr=1409 🤔
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The doctests run as a part of pytest so if you click on There aren't that many examples in the code at the moment. python/datafusion/dataframe.py::datafusion.dataframe.DataFrame.fill_null PASSED [ 99%]
python/datafusion/dataframe.py::datafusion.dataframe.DataFrame.into_view PASSED [ 99%]
python/datafusion/dataframe_formatter.py::datafusion.dataframe_formatter.configure_formatter PASSED [ 99%]
python/datafusion/dataframe_formatter.py::datafusion.dataframe_formatter.get_formatter PASSED [ 99%]
python/datafusion/dataframe_formatter.py::datafusion.dataframe_formatter.reset_formatter PASSED [ 99%]
python/datafusion/dataframe_formatter.py::datafusion.dataframe_formatter.set_formatter PASSED [100%]
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice -- I checked http://github.com/apache/datafusion-python/actions/runs/22676065624/job/65741468321 (a recent run from main) and indeed those tests are not there |
||
| >>> ctx = SessionContext() | ||
| >>> df = ctx.from_pydict({"a": [1, None, 3], "b": [None, 5, 6]}) | ||
| >>> filled = df.fill_null(0) | ||
| >>> filled.sort(col("a")).collect()[0].column("a").to_pylist() | ||
| [0, 1, 3] | ||
|
|
||
| Notes: | ||
| - Only fills nulls in columns where the value can be cast to the column type | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matches https://docs.pytest.org/en/stable/how-to/doctest.html 👍