예제 #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'