-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feat/ports
- Loading branch information
Showing
8 changed files
with
223 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
from quam.utils.config import generate_config_final_actions | ||
|
||
|
||
def test_config_no_overwrite_existing_offset(): | ||
cfg = { | ||
"controllers": { | ||
"con1": { | ||
"analog_outputs": {1: {"offset": 0.5}}, | ||
"analog_inputs": {2: {"offset": 0.5}}, | ||
}, | ||
}, | ||
} | ||
|
||
generate_config_final_actions(cfg) | ||
|
||
assert cfg == { | ||
"controllers": { | ||
"con1": { | ||
"analog_outputs": {1: {"offset": 0.5}}, | ||
"analog_inputs": {2: {"offset": 0.5}}, | ||
}, | ||
}, | ||
} | ||
|
||
|
||
def test_config_default_offset(): | ||
cfg = { | ||
"controllers": { | ||
"con1": { | ||
"analog_outputs": {1: {}}, | ||
"analog_inputs": {2: {}}, | ||
}, | ||
}, | ||
} | ||
|
||
generate_config_final_actions(cfg) | ||
|
||
assert cfg == { | ||
"controllers": { | ||
"con1": { | ||
"analog_outputs": {1: {"offset": 0.0}}, | ||
"analog_inputs": {2: {"offset": 0.0}}, | ||
}, | ||
}, | ||
} | ||
|
||
|
||
def test_config_default_offset_LF_FEM(): | ||
cfg = { | ||
"controllers": { | ||
"con1": { | ||
"fems": { | ||
2: { | ||
"type": "LF", | ||
"analog_outputs": {1: {}}, | ||
"analog_inputs": {2: {}}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
generate_config_final_actions(cfg) | ||
|
||
assert cfg == { | ||
"controllers": { | ||
"con1": { | ||
"fems": { | ||
2: { | ||
"type": "LF", | ||
"analog_outputs": {1: {"offset": 0.0}}, | ||
"analog_inputs": {2: {"offset": 0.0}}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
|
||
def test_config_no_overwrite_existing_offset_LF_FEM(): | ||
cfg = { | ||
"controllers": { | ||
"con1": { | ||
"fems": { | ||
2: { | ||
"type": "LF", | ||
"analog_outputs": {1: {"offset": 0.5}}, | ||
"analog_inputs": {2: {"offset": 0.5}}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
generate_config_final_actions(cfg) | ||
|
||
assert cfg == { | ||
"controllers": { | ||
"con1": { | ||
"fems": { | ||
2: { | ||
"type": "LF", | ||
"analog_outputs": {1: {"offset": 0.5}}, | ||
"analog_inputs": {2: {"offset": 0.5}}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
|
||
def test_config_default_offset_no_outputs_inputs_entries(): | ||
cfg = {"controllers": {"con1": {}}} | ||
|
||
generate_config_final_actions(cfg) | ||
|
||
assert cfg == {"controllers": {"con1": {}}} | ||
|
||
|
||
def test_config_default_offset_no_outputs_inputs(): | ||
cfg = { | ||
"controllers": { | ||
"con1": { | ||
"analog_outputs": {}, | ||
"analog_inputs": {}, | ||
} | ||
} | ||
} | ||
|
||
generate_config_final_actions(cfg) | ||
|
||
assert cfg == { | ||
"controllers": { | ||
"con1": { | ||
"analog_outputs": {}, | ||
"analog_inputs": {}, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters