Skip to content

Commit

Permalink
add pytest for modify_args
Browse files Browse the repository at this point in the history
  • Loading branch information
nijkah committed Mar 25, 2022
1 parent e526772 commit 264ada9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_utils/test_modify_args.py
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'

0 comments on commit 264ada9

Please # to comment.