Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_nitclk_is_done(multiple_niscope_sessions):
nitclk.configure_for_homogeneous_triggers(multiple_niscope_sessions)
nitclk.synchronize(multiple_niscope_sessions, .001)
nitclk.initiate(multiple_niscope_sessions)
nitclk.is_done(multiple_niscope_sessions)
def test_synchronize(self):
min_time = 0.042
self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize
nitclk.synchronize(multiple_session_references, min_time)
self.patched_library.niTClk_Synchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time))
return
def test_nitclk_initiate(multiple_niscope_sessions):
nitclk.configure_for_homogeneous_triggers(multiple_niscope_sessions)
nitclk.synchronize(multiple_niscope_sessions, .001)
nitclk.initiate(multiple_niscope_sessions)
def test_nitclk_synchronize(multiple_niscope_sessions):
nitclk.configure_for_homogeneous_triggers(multiple_niscope_sessions)
nitclk.synchronize(multiple_niscope_sessions, .001)
def test_api_error(self):
error_string = 'Error'
self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize
self.side_effects_helper['Synchronize']['return'] = -1
self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo
self.side_effects_helper['GetExtendedErrorInfo']['errorString'] = error_string
try:
nitclk.synchronize(multiple_session_references, 0.42)
except nitclk.Error as e:
assert e.code == -1
assert e.description == error_string
def test_synchronize_timedelta(self):
min_time = hightime.timedelta(seconds=0.042)
self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize
nitclk.synchronize(multiple_session_references, min_time)
self.patched_library.niTClk_Synchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time.total_seconds()))
return
def test_api_get_error_description_fails(self):
self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize
self.side_effects_helper['Synchronize']['return'] = -1
self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo
self.side_effects_helper['GetExtendedErrorInfo']['return'] = -2
try:
nitclk.synchronize(multiple_session_references, 0.42)
except nitclk.Error as e:
assert e.code == -1 # we want the original error code from getting the attribute.
assert e.description == "Failed to retrieve error description."
def test_nitclk_wait_until_done(multiple_niscope_sessions):
nitclk.configure_for_homogeneous_triggers(multiple_niscope_sessions)
nitclk.synchronize(multiple_niscope_sessions, .001)
nitclk.initiate(multiple_niscope_sessions)
nitclk.wait_until_done(multiple_niscope_sessions, .001)