Skip to content

Commit

Permalink
test: update tests for new behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Jan 11, 2025
1 parent 5bfd503 commit 1b28be9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions tests/test_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_parse_args_defaults(mocker) -> None:
assert args["config"] == ["config.json"]
assert args["strategy_path"] is None
assert args["datadir"] is None
assert args["verbosity"] == 0
assert args["verbosity"] is None


def test_parse_args_default_userdatadir(mocker) -> None:
Expand All @@ -35,17 +35,17 @@ def test_parse_args_default_userdatadir(mocker) -> None:
assert args["config"] == [str(Path("user_data/config.json"))]
assert args["strategy_path"] is None
assert args["datadir"] is None
assert args["verbosity"] == 0
assert args["verbosity"] is None


def test_parse_args_userdatadir(mocker) -> None:
mocker.patch.object(Path, "is_file", MagicMock(return_value=True))
args = Arguments(["trade", "--user-data-dir", "user_data"]).get_parsed_arg()
args = Arguments(["trade", "--user-data-dir", "user_data", "-v"]).get_parsed_arg()
# configuration defaults to user_data if that is available.
assert args["config"] == [str(Path("user_data/config.json"))]
assert args["strategy_path"] is None
assert args["datadir"] is None
assert args["verbosity"] == 0
assert args["verbosity"] == 1


def test_parse_args_config() -> None:
Expand Down Expand Up @@ -132,7 +132,7 @@ def test_parse_args_backtesting_custom() -> None:
]
call_args = Arguments(args).get_parsed_arg()
assert call_args["config"] == ["test_conf.json"]
assert call_args["verbosity"] == 0
assert call_args["verbosity"] is None
assert call_args["command"] == "backtesting"
assert call_args["func"] is not None
assert call_args["timeframe"] == "1m"
Expand All @@ -145,7 +145,7 @@ def test_parse_args_hyperopt_custom() -> None:
call_args = Arguments(args).get_parsed_arg()
assert call_args["config"] == ["test_conf.json"]
assert call_args["epochs"] == 20
assert call_args["verbosity"] == 0
assert call_args["verbosity"] is None
assert call_args["command"] == "hyperopt"
assert call_args["spaces"] == ["buy"]
assert call_args["func"] is not None
Expand Down
4 changes: 2 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_parse_args_backtesting(mocker) -> None:
assert backtesting_mock.call_count == 1
call_args = backtesting_mock.call_args[0][0]
assert call_args["config"] == ["config.json"]
assert call_args["verbosity"] == 0
assert call_args["verbosity"] is None
assert call_args["command"] == "backtesting"
assert call_args["func"] is not None
assert callable(call_args["func"])
Expand All @@ -57,7 +57,7 @@ def test_main_start_hyperopt(mocker) -> None:
assert hyperopt_mock.call_count == 1
call_args = hyperopt_mock.call_args[0][0]
assert call_args["config"] == ["config.json"]
assert call_args["verbosity"] == 0
assert call_args["verbosity"] is None
assert call_args["command"] == "hyperopt"
assert call_args["func"] is not None
assert callable(call_args["func"])
Expand Down

0 comments on commit 1b28be9

Please sign in to comment.