MCPcopy Index your code
hub / github.com/RustPython/RustPython / extract_from_snapshots

Function extract_from_snapshots

Lib/test/test_tools/test_i18n.py:404–430  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

402
403
404def extract_from_snapshots():
405 snapshots = {
406 'messages.py': ('--docstrings',),
407 'fileloc.py': ('--docstrings',),
408 'docstrings.py': ('--docstrings',),
409 # == Test character escaping
410 # Escape ascii and unicode:
411 'escapes.py': ('--escape',),
412 # Escape only ascii and let unicode pass through:
413 ('escapes.py', 'ascii-escapes.pot'): (),
414 }
415
416 for filename, args in snapshots.items():
417 if isinstance(filename, tuple):
418 filename, output_file = filename
419 output_file = DATA_DIR / output_file
420 input_file = DATA_DIR / filename
421 else:
422 input_file = DATA_DIR / filename
423 output_file = input_file.with_suffix('.pot')
424 contents = input_file.read_bytes()
425 with temp_cwd(None):
426 Path(input_file.name).write_bytes(contents)
427 assert_python_ok('-Xutf8', Test_pygettext.script, *args,
428 input_file.name)
429 yield (input_file, output_file,
430 Path('messages.pot').read_text(encoding='utf-8'))
431
432
433def update_POT_snapshots():

Callers 2

test_pygettext_outputMethod · 0.85
update_POT_snapshotsFunction · 0.85

Calls 9

temp_cwdFunction · 0.90
PathClass · 0.90
assert_python_okFunction · 0.90
isinstanceFunction · 0.85
itemsMethod · 0.45
with_suffixMethod · 0.45
read_bytesMethod · 0.45
write_bytesMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected