-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from OpenBB-finance/feature/add-testing-infra
Add testing
- Loading branch information
Showing
8 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: ci | ||
name: Lint | ||
|
||
on: [push] | ||
on: [pull_request] | ||
|
||
jobs: | ||
lint: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Test | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.7.1 | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'poetry' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
poetry install | ||
- name: Run Pytest | ||
run : poetry run pytest tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from openbb import obb | ||
|
||
from openbb_agents.tools import from_openbb_to_langchain_func | ||
|
||
|
||
def test_from_openbb_to_langchain_func(): | ||
"""Test that we can create a StructuredTool from an OpenBB function.""" | ||
test_openbb_command_root = "/equity/profile" | ||
|
||
test_openbb_callable = obb.equity.profile | ||
test_openbb_schema = obb.coverage.command_model[".equity.profile"] | ||
|
||
actual_result = from_openbb_to_langchain_func( | ||
openbb_command_root=test_openbb_command_root, | ||
openbb_callable=test_openbb_callable, | ||
openbb_schema=test_openbb_schema, | ||
) | ||
|
||
assert actual_result.name == "/equity/profile" | ||
assert "Equity Info" in actual_result.description # Check for docstring | ||
assert "name" in actual_result.description # Check for output field | ||
assert actual_result.args_schema.__name__ == "/equity/profileInputModel" | ||
assert actual_result.args_schema.schema() == { | ||
"title": "/equity/profileInputModel", | ||
"type": "object", | ||
"properties": { | ||
"symbol": { | ||
"title": "Symbol", | ||
"description": "Symbol to get data for.", | ||
"type": "string", | ||
} | ||
}, | ||
"required": ["symbol"], | ||
} |