示例#1
0
 def test_parse_response_with_wrong_header(self):
     protocol = OxfordIsobus()
     with pytest.raises(ValueError) as excinfo:
         protocol.parse_response(b'U1', 'R')
     assert str(excinfo.value) == 'Response header mismatch'
示例#2
0
 def test_parse_response_with_error(self):
     protocol = OxfordIsobus()
     with pytest.raises(IOError) as excinfo:
         protocol.parse_response(b'?R', 'R')
     assert str(excinfo.value) == '?R'
示例#3
0
 def test_parse_response_with_data(self):
     protocol = OxfordIsobus()
     assert protocol.parse_response(b'R1337', 'R') == '1337'
示例#4
0
 def test_parse_response_with_wrong_header(self):
     protocol = OxfordIsobus()
     with pytest.raises(ValueError) as excinfo:
         protocol.parse_response(b'U1', 'R')
     assert str(excinfo.value) == 'Response header mismatch'
示例#5
0
 def test_parse_response_with_error(self):
     protocol = OxfordIsobus()
     with pytest.raises(IOError) as excinfo:
         protocol.parse_response(b'?R', 'R')
     assert str(excinfo.value) == '?R'
示例#6
0
 def test_parse_response_with_data(self):
     protocol = OxfordIsobus()
     assert protocol.parse_response(b'R1337', 'R') == '1337'