Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fix tests for charting #6262

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions openbb_platform/obbject_extensions/charting/tests/test_charting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
from pydantic import BaseModel


class MockDataframe:
def __init__(self):
self.columns = ["column1", "column2"]


mock_dataframe = MockDataframe()


@pytest.fixture()
def obbject():
class MockStdParams(BaseModel):
Expand All @@ -23,8 +31,12 @@ def __init__(self):
)
self.results = "mock_results"

self.provider = "mock_provider"
self.extra = "mock_extra"
self.warnings = "mock_warnings"

def to_dataframe(self):
return "mock_dataframe"
return mock_dataframe

return MockOOBject()

Expand Down Expand Up @@ -121,7 +133,7 @@ def test_to_chart(mock_to_chart, obbject):
# Assert
assert obj._obbject.chart.fig == mock_fig
mock_to_chart.assert_called_once_with(
"mock_dataframe",
mock_dataframe,
indicators=None,
symbol="",
candles=True,
Expand Down
Loading