Commit 4a2e6c82 authored by auke.klazema's avatar auke.klazema

Renamed init parameters

parent 1510fc28
......@@ -19,22 +19,22 @@ class PrologixGpibUsb(PortDevice):
_serialPort = None
_hpib_address = -1
def __init__(self, port="", timeout=1, portFormat="%d", maxDeviceNum=9, verbose=False,
findDevices=False):
def __init__(self, port="", timeout=1, port_format="%d", max_device_num=9, verbose=False,
find_devices=False):
if port == "":
maxDeviceNum, port, portFormat = self._set_default_platform_values()
max_device_num, port, port_format = self._set_default_platform_values()
self._validate_port(port)
if verbose:
print "Looking for ports such as %s in range %d on %s" % \
( port, maxDeviceNum, platform.system() )
(port, max_device_num, platform.system())
self._find_available_port(maxDeviceNum, port, portFormat, timeout, verbose)
self._find_available_port(max_device_num, port, port_format, timeout, verbose)
self._initialize_prologix_gpi()
if findDevices:
if find_devices:
self._find_devices()
else:
self._devices = "Not scanned."
......
......@@ -29,7 +29,7 @@ class PrologixGpibUsbTest(unittest.TestCase):
self.serial_mock.assert_called_with('/dev/ttys000', timeout=1)
def test_getDevices_returns_not_scanned_when_find_devices_is_false(self):
usb = hpib.PrologixGpibUsb(findDevices=False)
usb = hpib.PrologixGpibUsb(find_devices=False)
self.assertEqual(usb.get_devices(), 'Not scanned.')
......@@ -73,14 +73,14 @@ class PrologixGpibUsbTest(unittest.TestCase):
self.serial_mock.return_value.readline.return_value = ""
write_mock = self.serial_mock.return_value.write
hpib.PrologixGpibUsb(findDevices=True)
hpib.PrologixGpibUsb(find_devices=True)
self.assertEqual(write_mock.call_args_list[7],
call("++addr " + str(0) + chr(10) + "*idn?" + chr(10) + "++read" + chr(10)))
def test_if_find_devices_getDevices_will_return_a_list_of_devices(self):
self.serial_mock.return_value.readline.return_value = "Device 1"
usb = hpib.PrologixGpibUsb(findDevices=True)
usb = hpib.PrologixGpibUsb(find_devices=True)
devices = usb.get_devices()
......
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