Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.patched_library.niFake_GetCalDateAndTime.side_effect = self.side_effects_helper.niFake_GetCalDateAndTime
month = 12
day = 30
year = 1988
hour = 10
minute = 15
self.side_effects_helper['GetCalDateAndTime']['return'] = 0
self.side_effects_helper['GetCalDateAndTime']['month'] = month
self.side_effects_helper['GetCalDateAndTime']['day'] = day
self.side_effects_helper['GetCalDateAndTime']['year'] = year
self.side_effects_helper['GetCalDateAndTime']['hour'] = hour
self.side_effects_helper['GetCalDateAndTime']['minute'] = minute
with nifake.Session('dev1') as session:
last_cal = session.get_cal_date_and_time(0)
assert isinstance(last_cal, hightime.datetime)
assert hightime.datetime(year, month, day, hour, minute) == last_cal
def test_get_cal_date_time(self):
self.patched_library.niFake_GetCalDateAndTime.side_effect = self.side_effects_helper.niFake_GetCalDateAndTime
month = 12
day = 30
year = 1988
hour = 10
minute = 15
self.side_effects_helper['GetCalDateAndTime']['return'] = 0
self.side_effects_helper['GetCalDateAndTime']['month'] = month
self.side_effects_helper['GetCalDateAndTime']['day'] = day
self.side_effects_helper['GetCalDateAndTime']['year'] = year
self.side_effects_helper['GetCalDateAndTime']['hour'] = hour
self.side_effects_helper['GetCalDateAndTime']['minute'] = minute
with nifake.Session('dev1') as session:
last_cal = session.get_cal_date_and_time(0)
assert isinstance(last_cal, hightime.datetime)
assert hightime.datetime(year, month, day, hour, minute) == last_cal
def get_cal_date_and_time(self, cal_type):
'''get_cal_date_and_time
Returns the date and time of the last calibration performed.
Args:
cal_type (int): Specifies the type of calibration performed (external or self-calibration).
Returns:
month (hightime.datetime): Indicates date and time of the last calibration.
'''
month, day, year, hour, minute = self._get_cal_date_and_time(cal_type)
return hightime.datetime(year, month, day, hour, minute)