def test_usbtmccomm_terminator_setter(mock_usbtmc): comm = USBTMCCommunicator() term_char = mock.PropertyMock(return_value="\n") type(comm._filelike).term_char = term_char comm.terminator = "*" assert comm._terminator == "*" term_char.assert_called_with(42) comm.terminator = b"*" assert comm._terminator == "*" term_char.assert_called_with(42)
def test_usbtmccomm_terminator_setter(mock_usbtmc): comm = USBTMCCommunicator() term_char = mock.PropertyMock(return_value="\n") type(comm._filelike).term_char = term_char comm.terminator = "*" eq_(comm._terminator, "*") term_char.assert_called_with(42) comm.terminator = b"*" # pylint: disable=redefined-variable-type eq_(comm._terminator, "*") term_char.assert_called_with(42)