Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update unit tests
Browse files Browse the repository at this point in the history
jaegukhyun committed Jul 24, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 1dd92f4 commit 59d899f
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions tests/unit/cli/tools/test_export.py
Original file line number Diff line number Diff line change
@@ -12,13 +12,29 @@
def test_get_args(mocker):
mocker.patch("sys.argv", ["otx", "--load-weights", "load_weights", "--output", "output"])
mocker.patch.object(
target_package, "get_parser_and_hprams_data", return_value=[argparse.ArgumentParser(), "fake", "fake"]
target_package,
"get_parser_and_hprams_data",
return_value=[
argparse.ArgumentParser(),
{"result_based_confidence": False, "confidence_threshold": 0.35},
[
"params",
"--postprocessing.result_based_confidence",
"false",
"--postprocessing.confidence_threshold",
"0.95",
],
],
)

parsed_args = get_args()
parsed_args, override_param = get_args()

assert parsed_args.load_weights == "load_weights"
assert parsed_args.output == "output"
assert override_param == [
"params.postprocessing.result_based_confidence",
"params.postprocessing.confidence_threshold",
]


@pytest.fixture
@@ -33,7 +49,7 @@ def mock_contains(self, val):

mock_args.__contains__ = mock_contains
mock_get_args = mocker.patch("otx.cli.tools.export.get_args")
mock_get_args.return_value = mock_args
mock_get_args.return_value = (mock_args, [])

return mock_args

@@ -61,7 +77,6 @@ def mock_config_manager(mocker):
@e2e_pytest_unit
def test_main(mocker, mock_args, mock_task, mock_config_manager, tmp_dir):
mocker.patch.object(target_package, "is_checkpoint_nncf", return_value=True)
mocker.patch.object(target_package, "create")
mocker.patch.object(target_package, "TaskEnvironment")
mocker.patch.object(target_package, "read_label_schema")
mocker.patch.object(target_package, "read_binary")

0 comments on commit 59d899f

Please sign in to comment.