Exemplo n.º 1
0
 def test_open_and_close(self):
     session = nimodinst.Session('')
     self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with(
         _matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher(),
         _matchers.ViInt32PointerMatcher())
     session.close()
     self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with(
         _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
Exemplo n.º 2
0
 def test_context_manager(self):
     with nimodinst.Session('') as session:
         assert type(session) == nimodinst.Session
         self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with(
             _matchers.ViStringMatcher(''),
             _matchers.ViSessionPointerMatcher(),
             _matchers.ViInt32PointerMatcher())
     self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with(
         _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
Exemplo n.º 3
0
 def test_get_tclk_session_reference(self):
     session = nitclk.SessionReference(SESSION_NUM_FOR_TEST)
     self.patched_library.niTClk_GetAttributeViSession.side_effect = self.side_effects_helper.niTClk_GetAttributeViSession
     attribute_id = 3
     other_session_number = 43
     self.side_effects_helper['GetAttributeViSession'][
         'value'] = other_session_number
     attr_session_reference = session.start_trigger_master_session
     assert type(attr_session_reference) is nitclk.SessionReference
     assert (attr_session_reference._get_tclk_session_reference() ==
             other_session_number)
     self.patched_library.niTClk_GetAttributeViSession.assert_called_once_with(
         _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
         _matchers.ViStringMatcher(''),
         _matchers.ViAttrMatcher(attribute_id),
         _matchers.ViSessionPointerMatcher())