Skip to content

Commit

Permalink
change dataframe mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jan 9, 2025
1 parent f8347c7 commit d6669cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/bimorph_mirror_analysis/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def calculate_voltages(
file_type = file_path.split(".")[-1]
if human_readable is not None:
pivoted, *_ = read_bluesky_plan_output(file_path)
print("1")
pivoted.to_csv(human_readable)

optimal_voltages = calculate_optimal_voltages(file_path)
Expand Down
9 changes: 8 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import subprocess
import sys
from unittest.mock import patch
from unittest.mock import MagicMock, patch

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -60,9 +60,16 @@ def test_human_readable_option(human_readable: str | bool):
patch(
"bimorph_mirror_analysis.__main__.calculate_optimal_voltages"
) as mock_calculate_optimal_voltages,
patch(
"bimorph_mirror_analysis.__main__.read_bluesky_plan_output"
) as mock_read_bluesky_plan_output,
patch.object(pd.DataFrame, "to_csv") as mock_to_csv,
):
# Create a mock DataFrame
mock_pivoted = MagicMock(spec=pd.DataFrame)
mock_read_bluesky_plan_output.return_value = (mock_pivoted,)
mock_calculate_optimal_voltages.return_value = np.array([72.14, 50.98, 18.59])

if type(human_readable) is str:
result = runner.invoke(
app,
Expand Down

0 comments on commit d6669cc

Please sign in to comment.