Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
auke.klazema
HPIB
Commits
1510fc28
Commit
1510fc28
authored
Feb 16, 2018
by
auke.klazema
Browse files
Removed uneeded member variable usage
parent
3c29bfc8
Changes
2
Hide whitespace changes
Inline
Side-by-side
hpib.py
View file @
1510fc28
...
...
@@ -38,7 +38,6 @@ class PrologixGpibUsb(PortDevice):
self
.
_find_devices
()
else
:
self
.
_devices
=
"Not scanned."
self
.
_hpib_address
=
-
1
def
_set_default_platform_values
(
self
):
if
platform
.
system
()
==
"Linux"
:
...
...
@@ -82,14 +81,14 @@ class PrologixGpibUsb(PortDevice):
def
_find_devices
(
self
):
self
.
_devices
=
[]
for
self
.
_hpib_
address
in
range
(
0
,
31
):
commandStr
=
"++addr "
+
str
(
self
.
_hpib_
address
)
+
chr
(
10
)
+
\
for
address
in
range
(
0
,
31
):
commandStr
=
"++addr "
+
str
(
address
)
+
chr
(
10
)
+
\
"*idn?"
+
chr
(
10
)
+
\
"++read"
+
chr
(
10
)
self
.
_serialPort
.
write
(
commandStr
)
returnStr
=
self
.
_serialPort
.
readline
()
if
returnStr
!=
""
:
self
.
_devices
+=
[
self
.
_hpib_
address
,
returnStr
]
self
.
_devices
+=
[
address
,
returnStr
]
def
command
(
self
,
hpib_address
,
command
):
if
hpib_address
!=
self
.
_hpib_address
:
...
...
test/test_hpib.py
View file @
1510fc28
...
...
@@ -99,7 +99,7 @@ class PrologixGpibUsbTest(unittest.TestCase):
hpib
.
PrologixGpibUsb
(
port
=
"device"
)
def
test_command_prepend_plusplus_addr_if_new_address
(
self
):
address
=
2
address
=
0
command
=
"command"
write_mock
=
self
.
serial_mock
.
return_value
.
write
...
...
@@ -110,7 +110,7 @@ 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
address
=
0
command
=
"command"
write_mock
=
self
.
serial_mock
.
return_value
.
write
...
...
@@ -122,7 +122,7 @@ class PrologixGpibUsbTest(unittest.TestCase):
write_mock
.
assert_called_with
(
command
+
chr
(
10
))
def
test_query_prepend_plusplus_addr_if_new_address
(
self
):
address
=
2
address
=
0
query
=
"query"
write_mock
=
self
.
serial_mock
.
return_value
.
write
...
...
@@ -135,7 +135,7 @@ class PrologixGpibUsbTest(unittest.TestCase):
"++read eoi"
+
chr
(
10
))
def
test_query_no_prepend_plusplus_addr_if_address_already_used
(
self
):
address
=
2
address
=
0
query
=
"query"
write_mock
=
self
.
serial_mock
.
return_value
.
write
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment