Commit dc5178ee authored by auke.klazema's avatar auke.klazema

Added tests to test if addr change command is only given if address is different

parent 95f512e7
......@@ -109,6 +109,18 @@ class PrologixGpibUsbTest(unittest.TestCase):
write_mock.assert_called_with("++addr " + str(address) + chr(10) + command + chr(10))
def test_command_no_prepend_plusplus_addr_if_address_already_used(self):
address = 2
command = "command"
write_mock = self.serial_mock.return_value.write
usb = hpib.PrologixGpibUsb()
usb.command(address, command)
usb.command(address, command)
write_mock.assert_called_with(command + chr(10))
def test_query_prepend_plusplus_addr_if_new_address(self):
address = 2
query = "query"
......@@ -122,6 +134,19 @@ class PrologixGpibUsbTest(unittest.TestCase):
query + chr(10) +
"++read eoi" + chr(10))
def test_query_no_prepend_plusplus_addr_if_address_already_used(self):
address = 2
query = "query"
write_mock = self.serial_mock.return_value.write
usb = hpib.PrologixGpibUsb()
usb.query(address, query)
usb.query(address, query)
write_mock.assert_called_with(query + chr(10) +
"++read eoi" + chr(10))
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment