This page tests how the stderr warning feature handles the merge_streams option in myst-nb.
When merge_streams is False, stderr gets its own .output.stderr element. Our feature SHOULD collapse this.
print("Normal output")
warnings.warn("This is a warning")
Normal output
UserWarning: This is a warning
warnings.warn("This is a warning")
When merge_streams is True, myst-nb combines stdout and stderr into a single .output.stream element. Our feature should NOT collapse this since there's no .output.stderr class.
print("Normal output")
warnings.warn("This is a warning")
Normal output
UserWarning: This is a warning
warnings.warn("This is a warning")
Even when merge_streams is True, if a cell ONLY produces stderr (no stdout), it should still use .output.stderr class and our feature SHOULD collapse it.
warnings.warn("Only a warning, no stdout")
UserWarning: Only a warning, no stdout
warnings.warn("Only a warning, no stdout")
Key insight: When merge_streams=True, myst-nb combines stdout and stderr into a single .output.stream element.
Our feature only targets .output.stderr elements, so merged streams will display normally.
This is the correct behavior because: