gh-131178: Add tests for tokenize command-line interface (#131274)

This commit is contained in:
Semyon Moroz 2025-03-27 20:04:16 +04:00 committed by GitHub
parent 8614f86b71
commit 9b83670f0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 83 additions and 3 deletions

View file

@ -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()