Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions Lib/test/test_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6028,15 +6028,16 @@ def test(arith=None, verbose=None, todo_tests=None, debug=None):


if __name__ == '__main__':
import optparse
p = optparse.OptionParser("test_decimal.py [--debug] [{--skip | test1 [test2 [...]]}]")
p.add_option('--debug', '-d', action='store_true', help='shows the test number and context before each test')
p.add_option('--skip', '-s', action='store_true', help='skip over 90% of the arithmetic tests')
(opt, args) = p.parse_args()

if opt.skip:
import argparse
parser = argparse.ArgumentParser(usage="test_decimal.py [--debug] [{--skip | test1 [test2 [...]]}]")
parser.add_argument('--debug', '-d', action='store_true', help='shows the test number and context before each test')
parser.add_argument('--skip', '-s', action='store_true', help='skip over 90%% of the arithmetic tests')
parser.add_argument('tests', nargs='*', help='specific tests to run')
Comment thread
tonghuaroot marked this conversation as resolved.
Outdated
args = parser.parse_args()

if args.skip:
test(arith=False, verbose=True)
elif args:
test(arith=True, verbose=True, todo_tests=args, debug=opt.debug)
elif args.tests:
test(arith=True, verbose=True, todo_tests=args.tests, debug=args.debug)
else:
test(arith=True, verbose=True)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace the usage of the deprecated optparse module with argparse in Lib/test/test_decimal.py.
Comment thread
tonghuaroot marked this conversation as resolved.
Outdated
Loading