Closed aaaaalbert closed 8 years ago
@yyzhuang, feel free to test this version of argparse
for your project.
Unit test results from my humble machine:
albert$ for FILE in *_argparse_* ; do python utf.py -f $FILE ; done
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_bool.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_bool_default.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_bool_missing.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_int.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_int_default.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_int_missing.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_int_missing_value.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_int_nonint.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_int_uses_first.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_str.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_str_default.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_str_missing.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_str_missing_value.r2py [ PASS ]
Testing module: seattlelib
Running: ut_seattlelib_argparse_scan_str_uses_first.r2py [ PASS ]
I think we also need a unit test to check whether argparse_scan_str
can parse non-str value of str argument, just like ut_seattlelib_argparse_scan_int_nonint.r2py
Hmmm, the point is that all callargs are str
s in the first place (and are not parsed into str
). Parsing from str
is only done for int
args.
Example: 123
is a string that can be parsed as an integer. xyz
is a string that cannot be parsed as an integer. (Both are strings, still).
OK, that makes sense to me!
Also, add unit tests.