Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self):
_PointerMatcher.__init__(self, _visatype.ViInt64)
def __init__(self, expected_value):
_ScalarMatcher.__init__(self, _visatype.ViUInt32, expected_value)
def __init__(self):
_PointerMatcher.__init__(self, _visatype.ViSession)
def __init__(self, expected_value):
_ScalarMatcher.__init__(self, _visatype.ViInt32, expected_value)
def __init__(self):
_PointerMatcher.__init__(self, _visatype.ViBoolean)
def __init__(self, expected_value):
_ScalarMatcher.__init__(self, _visatype.ViInt16, expected_value)
def __init__(self, expected_size_or_value):
_BufferMatcher.__init__(self, _visatype.ViChar, expected_size_or_value)
def test_close():
session = nidigital.Session(resource_name=','.join(instruments), options='Simulate=1, DriverSetup=Model:6570')
session.vil = 1
session.close()
try:
session.vil = 1
assert False
except nidigital.Error as e:
assert e.code == -1074130544
self.side_effects_helper['FetchHistoryRAMCycleInformation']['timeSetIndex'] = 0
self.side_effects_helper['FetchHistoryRAMCycleInformation']['vectorNumber'] = 9
self.side_effects_helper['FetchHistoryRAMCycleInformation']['cycleNumber'] = 11
self.side_effects_helper['FetchHistoryRAMCycleInformation']['numDutCycles'] = 1
self.patched_library.niDigital_GetPatternName.side_effect = self.side_effects_helper.niDigital_GetPatternName
self.side_effects_helper['GetPatternName']['name'] = 'new_pattern'
self.patched_library.niDigital_GetTimeSetName.side_effect = self.side_effects_helper.niDigital_GetTimeSetName
self.side_effects_helper['GetTimeSetName']['name'] = 't0'
self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMScanCycleNumber
self.side_effects_helper['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] = -1
self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMCyclePinData
self.side_effects_helper['FetchHistoryRAMCyclePinData']['actualNumPinData'] = 8
self.side_effects_helper['FetchHistoryRAMCyclePinData']['expectedPinStates'] = [nidigital.PinState.X.value] * 8
self.side_effects_helper['FetchHistoryRAMCyclePinData']['actualPinStates'] = [nidigital.PinState.NOT_A_PIN_STATE.value] * 8
self.side_effects_helper['FetchHistoryRAMCyclePinData']['perPinPassFail'] = [True] * 8
with nidigital.Session('') as session:
history_ram_cycle_info = session.sites[1].fetch_history_ram_cycle_information(
position=6,
samples_to_read=-1)
self.patched_library.niDigital_FetchHistoryRAMCycleInformation.assert_called_once()
assert self.patched_library.niDigital_GetPatternName.call_count == 2
assert self.patched_library.niDigital_GetTimeSetName.call_count == 2
self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.assert_called_once()
assert self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count == 2
assert len(history_ram_cycle_info) == 1
assert history_ram_cycle_info[0].vector_number == 9
assert history_ram_cycle_info[0].cycle_number == 11
def test_fetch_history_ram_cycle_information_samples_to_read_all(self):
self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount
self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 7
self.patched_library.niDigital_GetAttributeViBoolean.side_effect = self.side_effects_helper.niDigital_GetAttributeViBoolean
self.side_effects_helper['GetAttributeViBoolean']['value'] = True # history_ram_number_of_samples_is_finite
self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = self.niDigital_FetchHistoryRAMCycleInformation_looping
self.patched_library.niDigital_GetPatternName.side_effect = self.side_effects_helper.niDigital_GetPatternName
self.side_effects_helper['GetPatternName']['name'] = 'new_pattern'
self.patched_library.niDigital_GetTimeSetName.side_effect = self.niDigital_GetTimeSetName_looping
self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = self.niDigital_FetchHistoryRAMScanCycleNumber_looping
self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = self.niDigital_FetchHistoryRAMCyclePinData_looping
self.patched_library.niDigital_GetPatternPinList.side_effect = self.side_effects_helper.niDigital_GetPatternPinList
pin_list = ['LO' + str(i) for i in range(4)] + ['HI' + str(i) for i in range(4)]
self.side_effects_helper['GetPatternPinList']['pinList'] = ','.join(pin_list)
with nidigital.Session('') as session:
history_ram_cycle_info = session.sites[1].fetch_history_ram_cycle_information(
position=0,
samples_to_read=-1)
assert self.patched_library.niDigital_FetchHistoryRAMCycleInformation.call_count == 7
assert self.patched_library.niDigital_GetPatternName.call_count == 2 # there's only one pattern, so this is a 2
assert self.patched_library.niDigital_GetTimeSetName.call_count == 6 # 3 time sets, so this is a 6
assert self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.call_count == 7
assert self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count == 20 # 10 DUT cycles
assert len(history_ram_cycle_info) == 7
assert all([i.pattern_name == 'new_pattern' for i in history_ram_cycle_info])
time_set_names = [i.time_set_name for i in history_ram_cycle_info]
assert time_set_names == ['t0', 'tScan', 'tScan', 't2X', 't2X', 't2X', 't0']
vector_numbers = [i.vector_number for i in history_ram_cycle_info]