Skip to content
GitLab
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
dc5178ee
Commit
dc5178ee
authored
Feb 16, 2018
by
auke.klazema
Browse files
Added tests to test if addr change command is only given if address is different
parent
95f512e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/test_hpib.py
View file @
dc5178ee
...
...
@@ -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
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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