Skip to content

Commit

Permalink
Add test for multi-antennas
Browse files Browse the repository at this point in the history
  • Loading branch information
ToddSchumannNTIA committed Jul 15, 2024
1 parent d7ace3b commit 88a1884
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scos_actions/calibration/tests/test_differential_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,30 @@ def setup_differential_calibration_file(self, tmp_path: Path):
"calibration_reference": "antenna input",
"calibration_data": {3555e6: 11.5},
}
dict_to_json_multiple_antenna = {
"calibration_parameters": ["rf_path", "frequency"],
"calibration_reference": "antenna input",
"calibration_data": {
"antenna1": {3555e6: 11.5},
"antenna2": {3555e6: 21.5},
}
}
self.valid_file_path = tmp_path / "sample_diff_cal.json"
self.valid_file_path_multiple_antenna = tmp_path / "sample_diff_cal_multiple_antenna.json"
self.invalid_file_path = tmp_path / "sample_diff_cal_invalid.json"

self.sample_diff_cal = DifferentialCalibration(
file_path=self.valid_file_path, **dict_to_json
)
self.sample_diff_cal_multiple_antenna = DifferentialCalibration(
file_path=self.valid_file_path_multiple_antenna, **dict_to_json_multiple_antenna
)

with open(self.valid_file_path, "w") as f:
f.write(json.dumps(dict_to_json))

with open(self.valid_file_path_multiple_antenna, "w") as f:
f.write(json.dumps(dict_to_json_multiple_antenna))

dict_to_json.pop("calibration_reference", None)

Expand All @@ -35,6 +50,8 @@ def test_from_json(self):
"""Check from_json functionality with valid and invalid dummy data."""
diff_cal = DifferentialCalibration.from_json(self.valid_file_path)
assert diff_cal == self.sample_diff_cal
diff_cal_multiple_antenna = DifferentialCalibration.from_json(self.valid_file_path_multiple_antenna)
assert diff_cal_multiple_antenna == self.sample_diff_cal_multiple_antenna
with pytest.raises(Exception):
_ = DifferentialCalibration.from_json(self.invalid_file_path)

Expand Down

0 comments on commit 88a1884

Please sign in to comment.