-
Notifications
You must be signed in to change notification settings - Fork 114
feat(data frame): Add .update_cell() and .update_data()
#1719
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
8eec04d
first pass at update_cell
schloerke 65fe19f
Add support for column to be a string. Add assertions
schloerke a228b78
Rename params to `row` and `col`
schloerke f0d9c12
Remove unnecessary session context
schloerke da3aef8
Update app to work with new update code
schloerke 03167d1
Merge branch 'main' into df_update_cell
schloerke 2ba95de
Working version of `.update_data(self, data)`
schloerke 10dec9c
Allow for new columns and type hints! (Needs testing)
schloerke 5660a76
todos
schloerke d67c4c6
Require self session when serializing / registering any components
schloerke ad5fcf5
Clean up some python code
schloerke 19a2a61
Fix app
schloerke e8e1a38
Do not call style update method until the cell patches or data updates
schloerke 3173c4d
Remove print statements
schloerke 7b44816
Clone data before processing it to avoid in-place updates; Raised nar…
schloerke 01b5e36
Expose `.data_patched()`
schloerke bf2f6c2
Talk about the different data methods available to the shiny data frame
schloerke 8adf597
Make reactives variable names clearer
schloerke 75648f7
Add tests to `.update_cell_value()` and `.update_data()`
schloerke 228986c
add assertions for update_cell row/col index values
schloerke e4fd17a
fix bug in `OutputDataFrame.expect_nrow()` to assert the number of vi…
schloerke d65e224
Add comment on how to do docs in the future
schloerke a72afc2
Remove commented code in `.update_data()`
schloerke 308b2c2
Explicitly test for `data=None` values in `DataGrid`, `DataTable` and…
schloerke e6175b5
Update and distribute data method docs
schloerke 40c1d5f
Update CHANGELOG.md
schloerke 364ec0a
Fix dynamic `aria-rowcount` value. Previously fixed to full data size…
schloerke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/playwright/shiny/components/data_frame/update_cell_value/test_cell_value.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from playwright.sync_api import Page | ||
|
|
||
| from shiny.playwright import controller | ||
| from shiny.run import ShinyAppProc | ||
|
|
||
|
|
||
| def test_update_cell_value(page: Page, local_app: ShinyAppProc) -> None: | ||
| page.goto(local_app.url) | ||
|
|
||
| pd_df = controller.OutputDataFrame(page, "pd_df") | ||
| pd_df.expect_cell("PAL0708", row=0, col=0) | ||
|
|
||
| pl_df = controller.OutputDataFrame(page, "pl_df") | ||
| pl_df.expect_cell("PAL0708", row=0, col=0) | ||
|
|
||
| pd_btn = controller.InputActionButton(page, "update_pd_btn") | ||
| pl_btn = controller.InputActionButton(page, "update_pl_btn") | ||
|
|
||
| # Update pandas | ||
| pd_btn.click() | ||
| pd_df.expect_cell("pandas - 1", row=0, col=0) | ||
| pl_df.expect_cell("PAL0708", row=0, col=0) | ||
|
|
||
| # Update polars | ||
| pl_btn.click() | ||
| pl_btn.click() | ||
| pl_btn.click() | ||
|
|
||
| pd_df.expect_cell("pandas - 1", row=0, col=0) | ||
| pl_df.expect_cell("polars - 3", row=0, col=0) | ||
|
|
||
| # Verify other cells do not change | ||
| pd_df.expect_cell("PAL0708", row=1, col=0) | ||
| pd_df.expect_cell("1", row=0, col=1) | ||
| pd_df.expect_cell("2", row=1, col=1) | ||
|
|
||
| pl_df.expect_cell("PAL0708", row=1, col=0) | ||
| pl_df.expect_cell("1", row=0, col=1) | ||
| pl_df.expect_cell("2", row=1, col=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.