Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
29 changes: 21 additions & 8 deletions Lib/test/test_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6028,15 +6028,28 @@ 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()
import argparse

parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
group.add_argument("tests", nargs="*", default=[], help="specific tests to run")
group.add_argument(
"-s",
"--skip",
action="store_true",
help="skip over 90%% of the arithmetic tests",
)
parser.add_argument(
"-d",
"--debug",
action="store_true",
help="shows the test number and context before each test",
)
args = parser.parse_args()

if opt.skip:
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 :mod:`optparse` with :mod:`argparse` in ``Lib/test/test_decimal.py``.
Loading