Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 committed Aug 21, 2023
1 parent 7428393 commit f06cbb5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Lib/test/test_tools/test_i18n/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

skip_if_missing()

DATA_DIR = Path(__file__).resolve().parent / 'data'


class Test_pygettext(unittest.TestCase):
"""Tests for the pygettext.py tool"""
Expand Down Expand Up @@ -339,20 +341,19 @@ def test_calls_in_fstring_with_partially_wrong_expression(self):

def test_pygettext_output(self):
"""Test that the pygettext output exactly matches a file."""
data_dir = Path(__file__).parent / 'data'
filenames = (('messages.py', 'messages.pot'),
('docstrings.py', 'docstrings.pot'),
('fileloc.py', 'fileloc.pot'))

for input_file, output_file in filenames:
with self.subTest(f'Input file: data/{input_file}'):
contents = (data_dir / input_file).read_text(encoding='utf-8')
with self.subTest(input_file=f'data/{input_file}'):
contents = (DATA_DIR / input_file).read_text(encoding='utf-8')
with temp_cwd(None):
Path(input_file).write_text(contents)
assert_python_ok(self.script, '--docstrings', input_file)
output = Path('messages.pot').read_text()

expected = (data_dir / output_file).read_text(encoding='utf-8')
expected = (DATA_DIR / output_file).read_text(encoding='utf-8')
self.assert_POT_equal(expected, output)

def test_files_list(self):
Expand Down

0 comments on commit f06cbb5

Please sign in to comment.