-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
import argparse | ||
from unittest.mock import patch | ||
|
||
from mmedit.utils import modify_args | ||
|
||
|
||
def test_modify_args(): | ||
|
||
def _parse_args(): | ||
parser = argparse.ArgumentParser(description='Generation demo') | ||
parser.add_argument('--config-path', help='test config file path') | ||
args = parser.parse_args() | ||
return args | ||
|
||
with patch('argparse._sys.argv', ['test.py', '--config_path=config.py']): | ||
modify_args() | ||
args = _parse_args() | ||
assert args.config_path == 'config.py' |