Files
OpenBB/cli/tests/test_outputs_stdio.py
Danglewood 9a30186174 [V5] CLI 2.0 - Pluggable Backends, Non-TTY Default, HTTP Dispatcher, Spec Files + Codegen (#7433)
* stash some changes

* add more robust testing

* mypy

* point PR at V5

* introduce spec file

* codespell

* test fix

* fix workflow environment setup

* fix workflow environment setup

* fix workflow environment setup

* add pyyaml to dependencies

* split lint jobs

* fix workflow environment setup

* fix workflow environment setup

* workflow env setup

* workflow env setup

* clean up code comments

* add auth hook entrypoints

* codespell

* add codegen feature

* codespell

* move _unpack into dispatchers for consistency with codegen packages

* surface nested models in the response

* fix missing coverage in CI

* socrata updates

* test fix

* detect plotly output

* add --include and --exclude flags from generate-extension command

* cap test matrix at python 3.14

* no useless comments

* platform controller command description split

* merge URL overloads from path params

* exclude none and unset from model dump

---------

Co-authored-by: deeleeramone <>
Co-authored-by: Copilot <copilot@github.com>
2026-06-01 19:14:38 +03:00

36 lines
876 B
Python

"""Tests for StdioOutput — alias for TsvOutput."""
import pandas as pd
import pytest
from openbb_cli.outputs.stdio import StdioOutput
from openbb_cli.outputs.tsv import TsvOutput
@pytest.fixture()
def stdio_output():
return StdioOutput()
def test_stdio_is_tsv_subclass():
assert issubclass(StdioOutput, TsvOutput)
def test_stdio_export_no_output(stdio_output, capsys):
stdio_output.display(data="x", export=True)
assert capsys.readouterr().out == ""
def test_stdio_dataframe(stdio_output, capsys):
df = pd.DataFrame({"x": [10, 20], "y": [30, 40]})
stdio_output.display(data=df)
out = capsys.readouterr().out
assert "x\ty" in out
assert "10\t30" in out
def test_stdio_no_ansi_in_output(stdio_output, capsys):
df = pd.DataFrame({"a": [1]})
stdio_output.display(data=df)
assert "\x1b[" not in capsys.readouterr().out