From 9706eab0b9f3199bf589566905398b02249e1d23 Mon Sep 17 00:00:00 2001 From: Gawtham Senthil Date: Wed, 18 Jun 2025 14:46:15 -0400 Subject: [PATCH] adding variable checking and renaming expected file name --- mobo_assignment_test.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mobo_assignment_test.py b/mobo_assignment_test.py index edde490..921cda9 100644 --- a/mobo_assignment_test.py +++ b/mobo_assignment_test.py @@ -11,11 +11,15 @@ @pytest.fixture(scope="session") def get_namespace(): - script_fname = "mobo_assignment_ans.py" + script_fname = "mobo_assignment.py" script_content = open(script_fname).read() namespace = {} exec(script_content, namespace) + required_vars = ["ax_client", "ax_client_full", "ax_client_thresh", "num_pareto_optimal_thresh", "num_pareto_sustainable_thresh", "num_pareto_optimal", "num_pareto_sustainable", "max_strength", "max_glass_t", "tradeoff"] + missing_vars = [var for var in required_vars if var not in namespace] + if missing_vars: + pytest.skip(f"Assignment incomplete. Missing variables: {missing_vars}") return namespace @@ -24,7 +28,7 @@ def test_task_a(get_namespace): running_ax_client = get_namespace["ax_client_full"] user_op_params = running_ax_client.experiment.parameters - # assert that len op_params is 4 + # assert that len op_params is 5 assert len(user_op_params) == 5, "Expected 5 parameters, got {}".format( len(user_op_params) ) @@ -36,7 +40,7 @@ def test_task_a(get_namespace): user_op_params.keys() ) - # assert that the ax_client budget is 25 + # assert that the ax_client budget is 40 assert ( len(running_ax_client.get_trials_data_frame()) == 40 ), "Expected optimization budget of 40 trials, got {}".format(