@pytest.mark.parametrize('status, raising, message', [(QDataStream.Ok, False, None), (QDataStream.ReadPastEnd, True, 'The data stream has read past the end of the data in the underlying device.'), (QDataStream.ReadCorruptData, True, 'The data stream has read corrupt data.'), (QDataStream.WriteFailed, True, 'The data stream cannot write to the underlying device.')])
def test_check_qdatastream(status, raising, message):
 stream = QDataStream()
 stream.setStatus(status)
 if raising:
  with pytest.raises(OSError) as excinfo:
   qtutils.check_qdatastream(stream)
  assert (str(excinfo.value) == message)
 else:
  qtutils.check_qdatastream(stream)

@ pytest . mark . parametrize ( 'status, raising, message' , [ ( QDataStream . Ok , False , None ) , ( QDataStream . ReadPastEnd , True , 'The data stream has read past the end of the data in the underlying device.' ) , ( QDataStream . ReadCorruptData , True , 'The data stream has read corrupt data.' ) , ( QDataStream . WriteFailed , True , 'The data stream cannot write to the underlying device.' ) ] ) def test_check_qdatastream ( status , raising , message ) : stream = QDataStream ( ) stream . setStatus ( status ) if raising : with pytest . raises ( OSError ) as excinfo : qtutils . check_qdatastream ( stream ) assert ( str ( excinfo . value ) == message ) else : qtutils . check_qdatastream ( stream )
test check_qdatastream .