Skip to content

Commit

Permalink
do not clean up values
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc committed Nov 7, 2024
1 parent c8b4ddc commit 1247392
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
6 changes: 3 additions & 3 deletions dp_creator_ii/app/analysis_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def _update_checkbox_group():
@reactive.event(input.columns_checkbox_group)
def _on_column_set_change():
column_ids_selected = input.columns_checkbox_group()
_cleanup_reactive_dict(lower_bounds, column_ids_selected)
_cleanup_reactive_dict(upper_bounds, column_ids_selected)
_cleanup_reactive_dict(bin_counts, column_ids_selected)
# We only clean up the weights, and everything else is left in place,
# so if you restore a column, you see the original values.
# (Except for weight, which goes back to the default.)
_cleanup_reactive_dict(weights, column_ids_selected)

@render.ui
Expand Down
24 changes: 16 additions & 8 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
default_app = create_app_fixture(Path(__file__).parent / "fixtures/default_app.py")
tooltip = "#choose_csv_demo_tooltip_ui svg"
for_the_demo = "For the demo, we'll imagine"
simulation = "This simulation assumes a normal distribution"


# TODO: Why is incomplete coverage reported here?
Expand Down Expand Up @@ -84,16 +85,23 @@ def expect_no_error():

# Set column details:
page.get_by_label("grade").check()
page.get_by_label("Min").click()
page.get_by_label("Min").fill("0")
# TODO: All these recalculations cause timeouts:
expect_visible(simulation)
# Check that default is set correctly:
assert page.get_by_label("Max").input_value() == "10"
# Reset, and confirm:
new_value = "20"
page.get_by_label("Max").fill(new_value)
# Uncheck the column:
page.get_by_label("grade").uncheck()
expect_not_visible(simulation)
# Recheck the column:
page.get_by_label("grade").check()
expect_visible(simulation)
assert page.get_by_label("Max").input_value() == new_value
# TODO: Setting more inputs without checking for updates
# cause recalculations to pile up, and these cause timeouts on CI:
# It is still rerendering the graph after hitting "Download results".
# https://github.com/opendp/dp-creator-ii/issues/116
# page.get_by_label("Max").click()
# page.get_by_label("Max").fill("100")
# page.get_by_label("Bins").click()
# page.get_by_label("Bins").fill("20")
page.get_by_label("Weight").select_option("1")
expect_no_error()

# -- Download results --
Expand Down

0 comments on commit 1247392

Please sign in to comment.