Ejemplo n.º 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'
Ejemplo n.º 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'
Ejemplo n.º 3
0
 def test_parse_response_with_data(self):
     protocol = OxfordIsobus()
     assert protocol.parse_response(b'R1337', 'R') == '1337'
Ejemplo n.º 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'
Ejemplo n.º 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'
Ejemplo n.º 6
0
 def test_parse_response_with_data(self):
     protocol = OxfordIsobus()
     assert protocol.parse_response(b'R1337', 'R') == '1337'