diff --git a/dp_wizard/app/results_panel.py b/dp_wizard/app/results_panel.py index f966d49..eca63ce 100644 --- a/dp_wizard/app/results_panel.py +++ b/dp_wizard/app/results_panel.py @@ -78,7 +78,8 @@ def analysis_plan() -> AnalysisPlan: for col in weights().keys() } return AnalysisPlan( - csv_path=private_csv_path(), + # Prefer private CSV, if available: + csv_path=private_csv_path() or public_csv_path(), contributions=contributions(), epsilon=epsilon(), columns=columns, diff --git a/dp_wizard/utils/converters.py b/dp_wizard/utils/converters.py index d53d08b..ddfd43c 100644 --- a/dp_wizard/utils/converters.py +++ b/dp_wizard/utils/converters.py @@ -14,6 +14,10 @@ def convert_py_to_nb(python_str: str, execute: bool = False): temp_dir_path = Path(temp_dir) py_path = temp_dir_path / "input.py" py_path.write_text(python_str) + + # DEBUG: + Path("/tmp/script.py").write_text(python_str) + argv = ( [ "jupytext", diff --git a/tests/test_app.py b/tests/test_app.py index 60b7ab3..e53c811 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -18,7 +18,6 @@ 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 will assume a normal distribution" # TODO: Why is incomplete coverage reported here? @@ -67,8 +66,7 @@ def expect_no_error(): # Now upload: csv_path = Path(__file__).parent / "fixtures" / "fake.csv" - # TODO: Switch to public - page.get_by_label("Choose Private CSV").set_input_files(csv_path.resolve()) + page.get_by_label("Choose Public CSV").set_input_files(csv_path.resolve()) expect_no_error() # -- Define analysis -- @@ -95,8 +93,7 @@ def expect_no_error(): page.locator(".irs-bar").click() expect_visible("Epsilon: 0.158") # Simulation - # TODO: Should be public! - expect_visible("This simulation will assume") + expect_visible("Because you've provided a public CSV") # Button disabled until column selected: download_results_button = page.get_by_role("button", name="Download results") @@ -108,7 +105,6 @@ def expect_no_error(): # Set column details: page.get_by_label("grade").check() - expect_visible(simulation) expect_not_visible("Weight") # Check that default is set correctly: assert page.get_by_label("Upper").input_value() == "10" @@ -117,14 +113,12 @@ def expect_no_error(): page.get_by_label("Upper").fill(new_value) # Uncheck the column: page.get_by_label("grade").uncheck() - expect_visible(simulation) # Recheck the column: page.get_by_label("grade").check() - expect_visible(simulation) assert page.get_by_label("Upper").input_value() == new_value expect_visible("The 95% confidence interval is ±794") page.get_by_text("Data Table").click() - expect_visible("(0, 2]") + expect_visible(f"({new_value}, inf]") # Because values are well above the bins. # Add a second column: # page.get_by_label("blank").check()