mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-130197: pygettext: Test the --escape option (GH-131902)
This commit is contained in:
parent
e7980ba233
commit
87d9983994
5 changed files with 138 additions and 3 deletions
|
@ -526,11 +526,21 @@ def extract_from_snapshots():
|
|||
'custom_keywords.py': ('--keyword=foo', '--keyword=nfoo:1,2',
|
||||
'--keyword=pfoo:1c,2',
|
||||
'--keyword=npfoo:1c,2,3', '--keyword=_:1,2'),
|
||||
# == Test character escaping
|
||||
# Escape ascii and unicode:
|
||||
'escapes.py': ('--escape', '--add-comments='),
|
||||
# Escape only ascii and let unicode pass through:
|
||||
('escapes.py', 'ascii-escapes.pot'): ('--add-comments=',),
|
||||
}
|
||||
|
||||
for filename, args in snapshots.items():
|
||||
input_file = DATA_DIR / filename
|
||||
output_file = input_file.with_suffix('.pot')
|
||||
if isinstance(filename, tuple):
|
||||
filename, output_file = filename
|
||||
output_file = DATA_DIR / output_file
|
||||
input_file = DATA_DIR / filename
|
||||
else:
|
||||
input_file = DATA_DIR / filename
|
||||
output_file = input_file.with_suffix('.pot')
|
||||
contents = input_file.read_bytes()
|
||||
with temp_cwd(None):
|
||||
Path(input_file.name).write_bytes(contents)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue