-
Notifications
You must be signed in to change notification settings - Fork 189
Add Unit test for cfg_time_start_trig #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DeborahOoi96
merged 21 commits into
ni:master
from
DeborahOoi96:users/deooi/AddCfgTimeStartFT
Feb 20, 2024
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
c23fdae
Add unit test for cfg_time_start_trig
c1724d1
Fix lint error
8b844e5
Address comments
2f5e584
Address comments
b6668f4
Fix build
8880d5f
Address comments
90d33c6
fix lint error and update
6e81791
Update:
707a1d6
Update codegen files
2e13b81
Fix spacing
2e08b15
Fix grpc test failures
468dae5
Address comments
2584127
Fix rebase
34745eb
Fix grpc test
99cf544
Fix Ci build
8ee0ceb
Fix test
6ba9796
Fix test
dbad9db
Fix grpc time as well
309aa5f
Remove libtime changes and mark tests as xfail
b17d4c0
Fix lint
a2c199d
Fix test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,53 @@ | ||
| from datetime import timedelta | ||
|
|
||
| import pytest | ||
| from hightime import datetime as ht_datetime | ||
|
|
||
| from nidaqmx.constants import Timescale | ||
| from nidaqmx.task import Task | ||
|
|
||
|
|
||
| @pytest.fixture() | ||
| def ai_voltage_field_daq_task(task, sim_field_daq_device): | ||
| """Gets AI voltage task.""" | ||
| task.ai_channels.add_ai_voltage_chan(sim_field_daq_device.ai_physical_chans[0].name) | ||
| yield task | ||
|
|
||
|
|
||
| def test___default_arguments___cfg_time_start_trig___no_errors( | ||
| ai_voltage_field_daq_task: Task, | ||
| ): | ||
| ai_voltage_field_daq_task.timing.cfg_samp_clk_timing(1000) | ||
| trigger_time = ht_datetime.now() + timedelta(seconds=10) | ||
|
|
||
| ai_voltage_field_daq_task.triggers.start_trigger.cfg_time_start_trig(trigger_time) | ||
|
|
||
| when_value = ai_voltage_field_daq_task.triggers.start_trigger.trig_when | ||
| timescale_value = ai_voltage_field_daq_task.triggers.start_trigger.timestamp_timescale | ||
| assert timescale_value == Timescale.USE_HOST | ||
| assert when_value.year == trigger_time.year | ||
| assert when_value.month == trigger_time.month | ||
| assert when_value.day == trigger_time.day | ||
| assert when_value.hour == trigger_time.hour | ||
| assert when_value.minute == trigger_time.minute | ||
| assert when_value.second == trigger_time.second | ||
|
|
||
|
|
||
| def test___arguments_provided___cfg_time_start_trig___no_errors( | ||
| ai_voltage_field_daq_task: Task, | ||
| ): | ||
| ai_voltage_field_daq_task.timing.cfg_samp_clk_timing(1000) | ||
| trigger_time = ht_datetime.now() + timedelta(seconds=10) | ||
| # simulated devices don't support setting timescale to USE_IO_DEVICE | ||
| timescale = Timescale.USE_HOST | ||
|
|
||
| ai_voltage_field_daq_task.triggers.start_trigger.cfg_time_start_trig(trigger_time, timescale) | ||
|
|
||
| when_value = ai_voltage_field_daq_task.triggers.start_trigger.trig_when | ||
| assert when_value.year == trigger_time.year | ||
| assert when_value.month == trigger_time.month | ||
| assert when_value.day == trigger_time.day | ||
| assert when_value.hour == trigger_time.hour | ||
| assert when_value.minute == trigger_time.minute | ||
| assert when_value.second == trigger_time.second | ||
| assert ai_voltage_field_daq_task.triggers.start_trigger.timestamp_timescale == timescale |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.