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 Some Tests #6736

Merged
merged 7 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions openbb_platform/extensions/etf/integration/test_etf_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def test_etf_search(params, headers):
"adjustment": "splits_and_dividends",
"provider": "yfinance",
"symbol": "SPY",
"start_date": "2023-06-01",
"end_date": "2023-06-03",
"start_date": None,
"end_date": None,
"interval": "1h",
}
),
Expand Down
4 changes: 2 additions & 2 deletions openbb_platform/extensions/etf/integration/test_etf_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ def test_etf_search(params, obb):
"adjustment": "splits_and_dividends",
"provider": "yfinance",
"symbol": "SPY",
"start_date": "2023-06-01",
"end_date": "2023-06-03",
"start_date": None,
"end_date": None,
"interval": "1h",
}
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def test_fixedincome_government_eu_yield_curve(params, headers):
"cusip": None,
"page_size": None,
"page_num": None,
"security_type": "Bond",
"security_type": "bond",
"provider": "government_us",
}
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def test_fixedincome_government_eu_yield_curve(params, obb):
"cusip": None,
"page_size": None,
"page_num": None,
"security_type": "Bond",
"security_type": "bond",
"provider": "government_us",
}
),
Expand Down
15 changes: 11 additions & 4 deletions openbb_platform/providers/sec/openbb_sec/models/rss_litigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ def extract_data(
) -> List[Dict]:
"""Return the raw data from the SEC endpoint."""
# pylint: disable=import-outside-toplevel
import xmltodict # noqa
from openbb_core.provider.utils.helpers import make_request # noqa
from pandas import DataFrame, to_datetime # noqa
import re # noqa
import xmltodict
from openbb_core.provider.utils.helpers import make_request
from pandas import DataFrame, to_datetime

results: List = []
url = "https://www.sec.gov/enforcement-litigation/litigation-releases/rss"
Expand All @@ -63,7 +64,13 @@ def extract_data(
if r.status_code != 200:
raise OpenBBError(f"Status code {r.status_code} returned.")

data = xmltodict.parse(r.content)
def clean_xml(xml_content):
"""Clean the XML content before parsing."""
xml_content = re.sub(r"&(?!amp;|lt;|gt;|quot;|apos;)", "&", xml_content)
return xml_content

cleaned_content = clean_xml(r.text)
data = xmltodict.parse(cleaned_content)
cols = ["title", "link", "summary", "date", "id"]
feed = DataFrame.from_records(data["rss"]["channel"]["item"])[
["title", "link", "description", "pubDate", "dc:creator"]
Expand Down
4 changes: 1 addition & 3 deletions openbb_platform/tests/test_auto_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
@pytest.fixture(autouse=True)
def setup_mocks():
"""Set up mocks for the test."""
with patch(
"openbb_core.app.static.package_builder.PackageBuilder.auto_build"
) as mock_auto_build:
with patch("openbb._PackageBuilder.auto_build") as mock_auto_build:
mock_auto_build.return_value = None
yield mock_auto_build

Expand Down
Loading