mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-131178: Add tests for tokenize
command-line interface (#131274)
This commit is contained in:
parent
8614f86b71
commit
9b83670f0f
2 changed files with 83 additions and 3 deletions
|
@ -499,7 +499,7 @@ def generate_tokens(readline):
|
|||
"""
|
||||
return _generate_tokens_from_c_tokenizer(readline, extra_tokens=True)
|
||||
|
||||
def main():
|
||||
def _main(args=None):
|
||||
import argparse
|
||||
|
||||
# Helper error handling routines
|
||||
|
@ -524,7 +524,7 @@ def main():
|
|||
help='the file to tokenize; defaults to stdin')
|
||||
parser.add_argument('-e', '--exact', dest='exact', action='store_true',
|
||||
help='display token names using the exact type')
|
||||
args = parser.parse_args()
|
||||
args = parser.parse_args(args)
|
||||
|
||||
try:
|
||||
# Tokenize the input
|
||||
|
@ -589,4 +589,4 @@ def _generate_tokens_from_c_tokenizer(source, encoding=None, extra_tokens=False)
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
_main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue