diff --git a/generated/nifake/session.py b/generated/nifake/session.py index 8291fa3d0..ffc2d62cb 100644 --- a/generated/nifake/session.py +++ b/generated/nifake/session.py @@ -44,6 +44,10 @@ class Session(object): ''' An attribute of type string with read/write access. ''' + read_write_integer = AttributeViInt32(1000004) + ''' + An attribute of type integer with read/write access. + ''' def __init__(self, resource_name, id_query=False, reset_device=False, options_string=""): self.library = library_singleton.get() diff --git a/generated/nifake/tests/test_session.py b/generated/nifake/tests/test_session.py index 79cc08dcc..d1062dbda 100644 --- a/generated/nifake/tests/test_session.py +++ b/generated/nifake/tests/test_session.py @@ -400,6 +400,23 @@ def test_init_with_options_nondefault(self): assert(session.vi == SESSION_NUM_FOR_TEST) self.patched_library.niFake_InitWithOptions.assert_called_once_with(b'FakeDevice', True, True, b'Some string', ANY) + def test_get_vi_int32_attribute(self): + self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 + test_number = 3 + self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number + with nifake.Session('dev1') as session: + attr_int = session.read_write_integer + assert(attr_int == test_number) + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(SESSION_NUM_FOR_TEST, b'', 1000004, ANY) + + def test_set_vi_int32_attribute(self): + self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32 + attribute_id = 1000004 + test_number = 1 + with nifake.Session('dev1') as session: + session.read_write_integer = test_number + self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(SESSION_NUM_FOR_TEST, b'', attribute_id, test_number) + def test_read(self): test_maximum_time = 10 test_reading = 5 diff --git a/src/nifake/metadata/attributes.py b/src/nifake/metadata/attributes.py index 89420ecd6..e30a9b5e9 100644 --- a/src/nifake/metadata/attributes.py +++ b/src/nifake/metadata/attributes.py @@ -64,4 +64,16 @@ 'description':'An attribute of type Color with read/write access.', }, }, + 1000004: { + 'access': 'read-write', + 'channel_based': 'False', + 'enum': None, + 'lv_property': 'Fake attributes:Read Write Int', + 'name': 'READ_WRITE_INTEGER', + 'resettable': 'No', + 'type': 'ViInt32', + 'documentation': { + 'description':'An attribute of type integer with read/write access.', + }, + }, } diff --git a/src/nifake/tests/test_session.py b/src/nifake/tests/test_session.py index 79cc08dcc..81041236e 100644 --- a/src/nifake/tests/test_session.py +++ b/src/nifake/tests/test_session.py @@ -400,6 +400,23 @@ def test_init_with_options_nondefault(self): assert(session.vi == SESSION_NUM_FOR_TEST) self.patched_library.niFake_InitWithOptions.assert_called_once_with(b'FakeDevice', True, True, b'Some string', ANY) + def test_get_vi_int32_attribute(self): + self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 + test_number = 3 + self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number + with nifake.Session('dev1') as session: + attr_int = session.read_write_integer + assert(attr_int == test_number) + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(SESSION_NUM_FOR_TEST, b'', 1000004, ANY) + + def test_set_vi_int32_attribute(self): + self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32 + attribute_id = 1000004 + test_number = 1 + with nifake.Session('dev1') as session: + session.read_write_integer = test_number + self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(SESSION_NUM_FOR_TEST, b'', attribute_id, 1) + def test_read(self): test_maximum_time = 10 test_reading = 5