Skip to content

Commit

Permalink
Finish coverage for Instruments, minus not supported open_ methods
Browse files Browse the repository at this point in the history
  • Loading branch information
scasagrande committed May 9, 2016
1 parent 4312207 commit 8038de8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions instruments/tests/test_base_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,18 @@ def test_instrument_sendcmd_noack():
inst._file.sendcmd.assert_called_with("foobar")


@raises(PromptError)
def test_instrument_sendcmd_noack_bad_prompt():
mock_filelike = mock.MagicMock()
mock_filelike.__class__ = AbstractCommunicator
inst = ik.Instrument(mock_filelike)

inst.prompt = "> "
inst.read = mock.MagicMock(return_value="* ")

inst.sendcmd("foobar")


def test_instrument_sendcmd():
mock_filelike = mock.MagicMock()
mock_filelike.__class__ = AbstractCommunicator
Expand Down Expand Up @@ -468,6 +480,19 @@ def test_instrument_query_noack():
inst.read.assert_called_with(2)


@raises(PromptError)
def test_instrument_query_noack_bad_prompt():
mock_filelike = mock.MagicMock()
mock_filelike.__class__ = AbstractCommunicator
inst = ik.Instrument(mock_filelike)
inst._file.query.return_value = "datas"

inst.prompt = "> "
inst.read = mock.MagicMock(return_value="* ")

_ = inst.query("foobar?")


def test_instrument_query():
"""
Expected order of operations:
Expand Down

0 comments on commit 8038de8

Please sign in to comment.