Skip to content

Commit

Permalink
adjusted file names and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Greeshmashaji committed Feb 7, 2025
1 parent 6964a9e commit eb9cd2e
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .settings/module_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -2123,7 +2123,7 @@
"name": "NeutralAtom",
"class": "NeutralAtom",
"args": {},
"module": "modules.applications.optimization.mis.mappings.neutralatom",
"module": "modules.applications.optimization.mis.mappings.neutral_atom",
"requirements": [
{
"name": "pulser",
Expand Down
2 changes: 1 addition & 1 deletion src/demo/instruction_demo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from BenchmarkManager import Instruction
from benchmark_manager import Instruction
from modules.core import Core
from modules.applications.application import Application

Expand Down
2 changes: 1 addition & 1 deletion src/modules/applications/optimization/mis/mis.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def get_default_submodule(self, option: str) -> Core:
from modules.applications.optimization.mis.mappings.qiro import QIRO # pylint: disable=C0415
return QIRO()
elif option == "NeutralAtom":
from modules.applications.optimization.mis.mappings.neutralatom import NeutralAtom # pylint: disable=C0415
from modules.applications.optimization.mis.mappings.neutral_atom import NeutralAtom # pylint: disable=C0415
return NeutralAtom()
else:
raise NotImplementedError(f"Mapping Option {option} not implemented")
Expand Down
2 changes: 1 addition & 1 deletion src/modules/applications/optimization/sat/sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_default_submodule(self, option: str) -> Core:
from modules.applications.optimization.sat.mappings.choiqubo import ChoiQUBO # pylint: disable=C0415
return ChoiQUBO()
elif option == "ChoiIsing":
from modules.applications.optimization.sat.mappings.choiIsing import ChoiIsing # pylint: disable=C0415
from modules.applications.optimization.sat.mappings.choiising import ChoiIsing # pylint: disable=C0415
return ChoiIsing()
elif option == "DinneenQUBO":
from modules.applications.optimization.sat.mappings.dinneenqubo import DinneenQUBO # pylint: disable=C0415
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestNeutralAtom(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.neutral_atom_instance = NeutralAtom()
with open("tests/modules/applications/optimization/MIS/mappings/MIS_test_graph.pkl", "rb") as file:
with open("tests/modules/applications/optimization/mis/mappings/mis_test_graph.pkl", "rb") as file:
cls.graph = pickle.load(file)
cls.config = {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TestIsing(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.ising_instance = Ising()
with open("tests/modules/applications/optimization/PVC/mappings/pvc_graph_1_seam.gpickle", "rb") as file:
with open("tests/modules/applications/optimization/pvc/mappings/pvc_graph_1_seam.gpickle", "rb") as file:
cls.graph = pickle.load(file)

def test_get_requirements(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestQUBO(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.qubo_instance = QUBO()
with open("tests/modules/applications/optimization/PVC/mappings/pvc_graph_1_seam.gpickle", "rb") as file:
with open("tests/modules/applications/optimization/pvc/mappings/pvc_graph_1_seam.gpickle", "rb") as file:
cls.graph = pickle.load(file)

def test_get_requirements(self):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_benchmark_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ def test_save_as_json(self, mock_json_dump, mock_open_file):
mock_open_file.assert_called_once_with(f"{self.benchmark_manager.store_dir}/results.json", 'w')
mock_json_dump.assert_called_once_with(mock_results, mock_open_file(), indent=2)

@patch("src.BenchmarkManager.Plotter.visualize_results")
@patch("src.BenchmarkManager.BenchmarkManager._save_as_json")
@patch("src.BenchmarkManager.ConfigManager")
@patch("src.benchmark_manager.Plotter.visualize_results")
@patch("src.benchmark_manager.BenchmarkManager._save_as_json")
@patch("src.benchmark_manager.ConfigManager")
def test_summarize_results(self, mock_config_manager, mock_save_json, mock_visualize):
self.benchmark_manager.summarize_results(["/mock/dir1", "/mock/dir2"])
mock_save_json.assert_called()
Expand All @@ -137,8 +137,8 @@ def test_load_results(self, mock_open_file, mock_glob):
self.assertEqual(len(results), 4, "Expected to load results from both directories.")
self.assertEqual(results[0]["result"], "mock", "Expected the first result to match mock.")

@patch("src.BenchmarkManager.preprocess")
@patch("src.BenchmarkManager.postprocess")
@patch("src.benchmark_manager.preprocess")
@patch("src.benchmark_manager.postprocess")
def test_traverse_config(self, mock_postprocess, mock_preprocess):
# Mock the preprocess function to return expected values
mock_preprocess.return_value = (Instruction.PROCEED, "processed_input", 0.1)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class TestConfigManager(unittest.TestCase):
def setUp(self):
self.config_manager = ConfigManager()

@patch("src.ConfigManager.inquirer.prompt")
@patch("src.ConfigManager.checkbox")
@patch("src.config_manager.inquirer.prompt")
@patch("src.config_manager.checkbox")
def test_query_module(self, mock_checkbox, mock_prompt):
# Mock responses for checkbox and prompt
mock_checkbox.return_value = {"param1": [1, 2]} # Simulates a user selecting 1 and 2
Expand Down Expand Up @@ -96,7 +96,7 @@ def test_translate_legacy_config_helper(self):
self.assertEqual(result[0]["name"], "SolverA")
self.assertEqual(len(result[0]["submodules"]), 1)

@patch("src.ConfigManager._get_instance_with_sub_options")
@patch("src.config_manager._get_instance_with_sub_options")
def test_load_config(self, mock_get_instance):
mock_app_instance = MagicMock()
mock_get_instance.return_value = mock_app_instance
Expand Down Expand Up @@ -218,8 +218,8 @@ def test_create_tree_figure(self):
self.config_manager.create_tree_figure("/mock/store/dir")
mock_savefig.assert_called_once_with("/mock/store/dir/BenchmarkGraph.png", format="PNG")

@patch("src.ConfigManager.inquirer.prompt")
@patch("src.ConfigManager.checkbox")
@patch("src.config_manager.inquirer.prompt")
@patch("src.config_manager.checkbox")
def test_query_for_config(self, mock_checkbox, mock_prompt):
mock_checkbox.return_value = {"param1": [1, 2, "Custom Input"]}
mock_prompt.side_effect = [{"custom_input": "custom_value"}]
Expand Down

0 comments on commit eb9cd2e

Please sign in to comment.