mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
* I missed some sheet_name ones :) * Move quote to main menu and combine yahoo finance commands * Update stocks for quote * First update to move yfinance away from main functionality * Small updates * Update tests to reflect changes * Fix some little things * Update docs a little too * Remove the Due Diligence menu * Update tests for new change * Update fa and stocks with new text and move some stuff around * Bye bye dd * Pls work * work.. * work.. * work.. * Work..| * Add tests back in * Remove tests * Fix fix fix * Remove tests to fix conflicts * Improve the `stocks/search` command (#4084) * Improve search command * Make it more intuitive * Fix tests * Update the docs * Ok done * Ok done 2 * Ok done 3 * Git update tests that failed * Update commands with --sheet-name that didn't work (#4088) * Update commands with --sheet-name that didn't work * Fix test * oops * Adds auto completion to `news` (#4089) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * returning always a dataframe * Revert "returning always a dataframe" This reverts commitd5dbf3132f. * quick fix to auto complete args --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Hotfix/Windows-CLI (#4087) * init * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * oops --------- Co-authored-by: James Maslek <jmaslek11@gmail.com> * Adds end date to `forex/load` (#4077) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * returning always a dataframe * Revert "returning always a dataframe" This reverts commitd5dbf3132f. * adding end date to the forex load * added some tests * added example * always show msg * rewriting test * updating tests * updating tests * Redo load tests --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update tests to reflect changes * work.. * Remove tests * Fix fix fix * Remove tests * Update the whole test folder * Small updates * Revert change * Update eodhd to reflect it requires a paid plan and update tests * Fix all the tests * Update tests * Update integration tests * Removing tests so no whining happens * ADD ALL THE TESTS * Fix linting * gitignore. thanks jer * Add back dd and redirect to fa * Update to just display a message * Update OpenBB SDK commands * Fixing issues with exporting * Fix ruff messing up * Fix tests * Fix the tests by disabling isort to run on tests folder --------- Co-authored-by: Jeroen Bouma <jeroenbouma@Jeroens-MacBook-Pro.local> Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: teh_coderer <me@tehcoderer.com>
103 lines
2.5 KiB
Python
103 lines
2.5 KiB
Python
from typing import Optional
|
|
|
|
import pytest
|
|
|
|
try:
|
|
from website import (
|
|
generate_sdk_markdown as gen_sdk,
|
|
generate_terminal_markdown as gen_term,
|
|
)
|
|
except ImportError:
|
|
pytest.skip(allow_module_level=True)
|
|
|
|
|
|
def test_generate_terminal_markdown():
|
|
"""Test the terminal markdown generator"""
|
|
assert gen_term.main() is True
|
|
|
|
|
|
def test_generate_sdk_markdown():
|
|
"""Test the sdk markdown generator"""
|
|
assert gen_sdk.main() is True
|
|
|
|
|
|
def mock_func(arg1: Optional[str] = "Test", arg2: Optional[bool] = True) -> bool:
|
|
"""Stuff here or stuff there, it doesn't matter, it's everywhere.
|
|
|
|
|
|
Parameters
|
|
----------
|
|
arg1 : Optional[str]
|
|
The first argument, by default "Test"
|
|
arg2 : Optional[bool]
|
|
The second argument, by default True
|
|
|
|
Returns
|
|
-------
|
|
bool
|
|
The return value.
|
|
"""
|
|
del arg1, arg2
|
|
return True
|
|
|
|
|
|
# pylint:disable=too-few-public-methods
|
|
class MockTrailMap:
|
|
"""Mock trail map"""
|
|
|
|
def __init__(self):
|
|
self.trailmap = ""
|
|
self.func_attr = {"model": mock_func}
|
|
self.class_attr = {"model": "mock"}
|
|
self.lineon = {"model": 69}
|
|
self.full_path = {"model": "test/mock_func.py"}
|
|
self.model = "mock_func"
|
|
self.long_doc = {"model": mock_func.__doc__}
|
|
self.func_def = {
|
|
"model": 'openbb.mock(arg1: Optional[str] = "Test", arg2: Optional[bool] = True)'
|
|
}
|
|
self.params = {"model": {}}
|
|
for k, p in gen_sdk.get_signature_parameters(
|
|
mock_func, mock_func.__globals__
|
|
).items():
|
|
self.params["model"][k] = p
|
|
|
|
|
|
EXPECTED_OUTPUT = """Stuff here or stuff there, it doesn't matter, it's everywhere.
|
|
|
|
Source Code: [[link](https://github.com/OpenBB-finance/OpenBBTerminal/tree/main/test/mock_func.py#L69)]
|
|
|
|
```python wordwrap
|
|
openbb.mock(arg1: Optional[str] = "Test", arg2: Optional[bool] = True)
|
|
```
|
|
|
|
---
|
|
|
|
## Parameters
|
|
|
|
| Name | Type | Description | Default | Optional |
|
|
| ---- | ---- | ----------- | ------- | -------- |
|
|
| arg1 | Optional[str] | The first argument, by default "Test" | Test | True |
|
|
| arg2 | Optional[bool] | The second argument, by default True | True | True |
|
|
|
|
|
|
---
|
|
|
|
## Returns
|
|
|
|
| Type | Description |
|
|
| ---- | ----------- |
|
|
| bool | The return value. |
|
|
---
|
|
|
|
"""
|
|
|
|
|
|
def test_sdk_docstring_to_markdown():
|
|
"""Test the docstring to markdown converter"""
|
|
mock = MockTrailMap()
|
|
func_meta = gen_sdk.get_function_meta(mock, "model")
|
|
result = gen_sdk.generate_markdown_section(func_meta)
|
|
|
|
assert result == EXPECTED_OUTPUT
|