예제 #1
0
def test_gpibusbcomm_address():
    # Create our communicator
    comm = GPIBCommunicator(mock.MagicMock(), 1)

    port_name = mock.PropertyMock(return_value="/dev/address")
    type(comm._file).address = port_name

    # Check that our address function is working
    eq_(comm.address, (1, "/dev/address"))
    port_name.assert_called_with()

    # Able to set GPIB address
    comm.address = 5
    eq_(comm._gpib_address, 5)

    # Able to set address with a list
    comm.address = [6, "/dev/foobar"]  # pylint: disable=redefined-variable-type
    eq_(comm._gpib_address, 6)
    port_name.assert_called_with("/dev/foobar")
예제 #2
0
def test_gpibusbcomm_address():
    # Create our communicator
    comm = GPIBCommunicator(mock.MagicMock(), 1)

    port_name = mock.PropertyMock(return_value="/dev/address")
    type(comm._file).address = port_name

    # Check that our address function is working
    eq_(comm.address, (1, "/dev/address"))
    port_name.assert_called_with()

    # Able to set GPIB address
    comm.address = 5
    eq_(comm._gpib_address, 5)

    # Able to set address with a list
    comm.address = [6, "/dev/foobar"]
    eq_(comm._gpib_address, 6)
    port_name.assert_called_with("/dev/foobar")
예제 #3
0
def test_gpibusbcomm_address():
    # Create our communicator
    comm = GPIBCommunicator(mock.MagicMock(), 1)

    port_name = mock.PropertyMock(return_value="/dev/address")
    type(comm._file).address = port_name

    # Check that our address function is working
    assert comm.address == (1, "/dev/address")
    port_name.assert_called_with()

    # Able to set GPIB address
    comm.address = 5
    assert comm._gpib_address == 5

    # Able to set address with a list
    comm.address = [6, "/dev/foobar"]
    assert comm._gpib_address == 6
    port_name.assert_called_with("/dev/foobar")
예제 #4
0
def test_gpibusbcomm_address_wrong_type():
    comm = GPIBCommunicator(mock.MagicMock(), 1)
    comm.address = "derp"
예제 #5
0
def test_gpibusbcomm_address_out_of_range():
    comm = GPIBCommunicator(mock.MagicMock(), 1)

    comm.address = 31
예제 #6
0
def test_gpibusbcomm_address_wrong_type():
    comm = GPIBCommunicator(mock.MagicMock(), 1)
    comm.address = "derp"
예제 #7
0
def test_gpibusbcomm_address_out_of_range():
    comm = GPIBCommunicator(mock.MagicMock(), 1)

    comm.address = 31
def test_gpibusbcomm_address_wrong_type():
    with pytest.raises(TypeError):
        comm = GPIBCommunicator(mock.MagicMock(), 1)
        comm.address = "derp"
def test_gpibusbcomm_address_out_of_range():
    with pytest.raises(ValueError):
        comm = GPIBCommunicator(mock.MagicMock(), 1)

        comm.address = 31
예제 #10
0
def test_gpibusbcomm_address_wrong_type():
    with pytest.raises(TypeError):
        comm = GPIBCommunicator(mock.MagicMock(), 1)
        comm.address = "derp"
예제 #11
0
def test_gpibusbcomm_address_out_of_range():
    with pytest.raises(ValueError):
        comm = GPIBCommunicator(mock.MagicMock(), 1)

        comm.address = 31