Exemplo n.º 1
0
 def len_input_bytes(self) -> int:
     """The number of RP66V1 bytes to read for one frame of this channel."""
     try:
         return self.count * RepCode.rep_code_fixed_length(self.rep_code)
     except RepCode.ExceptionRepCode as err:
         raise ExceptionFrameChannel(
             f'len_input_bytes() on variable length Rep Code {self.rep_code}'
         ) from err
Exemplo n.º 2
0
 def seek(self, ld: LogicalData) -> None:
     """Increments the logical data without reading any values into the array."""
     if len(self.array) != 0:
         raise ExceptionFrameChannel('seek() on empty array. This seems like a logical error.')
     ld.seek(RepCode.rep_code_fixed_length(self.rep_code) * self.count)
Exemplo n.º 3
0
def test_rep_code_fixed_length_raises(rc):
    with pytest.raises(RepCode.ExceptionRepCode) as err:
        RepCode.rep_code_fixed_length(rc)
    assert err.value.args[
        0] == f'Representation code {rc} is not fixed length.'
Exemplo n.º 4
0
def test_rep_code_fixed_length(rc, expected):
    result = RepCode.rep_code_fixed_length(rc)
    assert result == expected