Skip to content

Commit

Permalink
Hotfix/fred (#4493)
Browse files Browse the repository at this point in the history
* Updated reqs

* Updated reqs

* Fix test

---------

Co-authored-by: teh_coderer <[email protected]>
Co-authored-by: James Maslek <[email protected]>
  • Loading branch information
3 people authored Mar 15, 2023
1 parent 753ccfe commit 6581868
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions openbb_terminal/economy/economy_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,10 @@ def call_fred(self, other_args: List[str]):
dest="parameter",
default="",
help="Series ID of the Macro Economic data from FRED",
required="-h" not in other_args
and "--help" not in other_args
and "-q" not in other_args
and "--query" not in other_args,
)
parser.add_argument(
"-s",
Expand All @@ -704,6 +708,10 @@ def call_fred(self, other_args: List[str]):
nargs="+",
dest="query",
help="Query the FRED database to obtain Series IDs given the query search term.",
required="-h" not in other_args
and "--help" not in other_args
and "-p" not in other_args
and "--parameter" not in other_args,
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-p")
Expand Down
6 changes: 3 additions & 3 deletions tests/openbb_terminal/economy/test_economy_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ def test_call_fred_query(mocker):
"other_args, mocked_func, called_args, called_kwargs",
[
(
["--parameter=dgs2,dgs5"],
["--parameter", "dgs2,dgs5"],
"fred_view.display_fred_series",
[],
dict(
Expand All @@ -850,7 +850,7 @@ def test_call_fred_query(mocker):
),
),
(
["--parameter=DgS2,dgs5", "--export=csv", "--raw"],
["--parameter", "DgS2,dgs5", "--export=csv", "--raw"],
"fred_view.display_fred_series",
[],
dict(
Expand All @@ -865,7 +865,7 @@ def test_call_fred_query(mocker):
),
),
(
["--parameter=DgS2,dgs5", "--export=csv", "--start=2022-10-10"],
["--parameter", "DgS2,dgs5", "--export=csv", "--start=2022-10-10"],
"fred_view.display_fred_series",
[],
dict(
Expand Down

0 comments on commit 6581868

Please sign in to comment.