mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-16 06:11:57 +00:00
* refactor openbb-sec for v5 * linting * ty * normalize compare_company_facts * add workflows * python 3.10 fix * add more thorough url validation and tests * ty check * ty for python 3.10 * reconfigure with apps * temp pyproject overrride * pyproject * pyproject * pyproject * codespell * pyproject * fix uk schema file links in schema_files * test coverage * test_cli * port #7547 into this pr * no hard coded prefix * improve filing rendering capabilities * fix xml text detection * make codeql happy * missed a file in the commit * test coverage * codespell * fix flakey test * some updates * management_ownership --> management_profiles * proxy statement markdown * ruff * fix test coverage * more tests * test coverage * fix lint errors * Add SEC adviser search, profile, and universe routes (#7559) * Add SEC institutional data fetchers * Add SEC filing index and Form D routes * Add SEC investment adviser people data * Expose SEC adviser and institutional routes * fix(sec): address adviser review feedback * refactor(sec): narrow adviser support to IAPD search * feat(sec): add adviser firm and individual searches * feat(sec): add adviser profile drill-down * fix: repair pre-commit configuration * feat(sec): add adviser universe route * feat(sec): expose complete Form ADV data --------- Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com> * fix test coverage --------- Co-authored-by: deeleeramone <> Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
"""Unit tests for the SEC EDGAR process-wide rate limiter."""
|
|
|
|
from openbb_sec.utils import ratelimit
|
|
|
|
|
|
def test_default_when_unset(monkeypatch):
|
|
"""An unset env var yields the default rate."""
|
|
monkeypatch.delenv(ratelimit.REQUESTS_PER_SECOND_ENV_VAR, raising=False)
|
|
assert ratelimit._requests_per_second() == ratelimit._DEFAULT_REQUESTS_PER_SECOND
|
|
|
|
|
|
def test_valid_override(monkeypatch):
|
|
"""A positive numeric override is honored."""
|
|
monkeypatch.setenv(ratelimit.REQUESTS_PER_SECOND_ENV_VAR, "4.5")
|
|
assert ratelimit._requests_per_second() == 4.5
|
|
|
|
|
|
def test_invalid_value_falls_back(monkeypatch):
|
|
"""A non-numeric override falls back to the default."""
|
|
monkeypatch.setenv(ratelimit.REQUESTS_PER_SECOND_ENV_VAR, "fast")
|
|
assert ratelimit._requests_per_second() == ratelimit._DEFAULT_REQUESTS_PER_SECOND
|
|
|
|
|
|
def test_non_positive_falls_back(monkeypatch):
|
|
"""A zero or negative override falls back to the default."""
|
|
monkeypatch.setenv(ratelimit.REQUESTS_PER_SECOND_ENV_VAR, "0")
|
|
assert ratelimit._requests_per_second() == ratelimit._DEFAULT_REQUESTS_PER_SECOND
|