Index: native_client_sdk/src/tools/lib/tests/quote_test.py |
diff --git a/native_client_sdk/src/tools/lib/tests/quote_test.py b/native_client_sdk/src/tools/lib/tests/quote_test.py |
index fe0e6c36059956dcf253367f0acc97882541c2f4..111cc89c20cc22ea6256aec8cd0aad4d1d5c7985 100755 |
--- a/native_client_sdk/src/tools/lib/tests/quote_test.py |
+++ b/native_client_sdk/src/tools/lib/tests/quote_test.py |
@@ -3,7 +3,7 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-import optparse |
+import argparse |
import os |
import sys |
import unittest |
@@ -92,24 +92,25 @@ class TestQuote(unittest.TestCase): |
# Invoke this file directly for simple manual testing. For running |
# the unittests, use the -t flag. Any flags to be passed to the |
-# unittest module should be passed as after the optparse processing, |
+# unittest module should be passed as after the argparse processing, |
# e.g., "quote_test.py -t -- -v" to pass the -v flag to the unittest |
# module. |
def main(argv): |
global verbose |
- parser = optparse.OptionParser( |
+ parser = argparse.ArgumentParser( |
usage='Usage: %prog [options] word...') |
- parser.add_option('-s', '--special-chars', dest='special_chars', default=':', |
- help='Special characters to quote (default is ":")') |
- parser.add_option('-q', '--quote', dest='quote', default='\\', |
- help='Quote or escape character (default is "\")') |
- parser.add_option('-t', '--run-tests', dest='tests', action='store_true', |
- help='Run built-in tests\n') |
- parser.add_option('-u', '--unquote-input', dest='unquote_input', |
- action='store_true', help='Unquote command line argument') |
- parser.add_option('-v', '--verbose', dest='verbose', action='store_true', |
- help='Verbose test output') |
+ parser.add_argument('-s', '--special-chars', |
+ dest='special_chars', default=':', |
+ help='Special characters to quote (default is ":")') |
+ parser.add_argument('-q', '--quote', dest='quote', default='\\', |
+ help='Quote or escape character (default is "\")') |
+ parser.add_argument('-t', '--run-tests', dest='tests', action='store_true', |
+ help='Run built-in tests\n') |
+ parser.add_argument('-u', '--unquote-input', dest='unquote_input', |
+ action='store_true', help='Unquote command line argument') |
+ parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', |
+ help='Verbose test output') |
options, args = parser.parse_args(argv) |
binji
2014/11/13 23:57:04
fix
|
if options.verbose: |