File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -1223,5 +1223,22 @@ def test_add_multiple_config_arguments_error(self):
1223
1223
parser .add_argument ('--cfg2' , action = ActionConfigFile )
1224
1224
1225
1225
1226
+ def test_parser_alias (self ):
1227
+ import jsonargparse
1228
+
1229
+ # Create a parser where --bar is an alias for --foo
1230
+ parser = jsonargparse .ArgumentParser ()
1231
+ parser .add_argument ('--foo' , '--bar' )
1232
+
1233
+ parsed = parser .parse_string ('foo: "aaa"' )
1234
+ assert parsed .foo == 'aaa'
1235
+
1236
+ parsed = parser .parse_string ('bar: "bbb"' )
1237
+ assert parsed .foo == 'bbb'
1238
+
1239
+ parsed = parser .parse_args (['--bar' , 'ccc' ])
1240
+ assert parsed .foo == 'ccc'
1241
+
1242
+
1226
1243
if __name__ == '__main__' :
1227
1244
unittest .main (verbosity = 2 )
You can’t perform that action at this time.
0 commit comments