()
| 402 | |
| 403 | |
| 404 | def 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 | |
| 433 | def update_POT_snapshots(): |
no test coverage detected