MCPcopy Create free account
hub / github.com/python/cpython / test_files_list

Method test_files_list

Lib/test/test_tools/test_i18n.py:398–422  ·  view source on GitHub ↗

Make sure the directories are inspected for source files bpo-31920

(self)

Source from the content-addressed store, hash-verified

396 self.assert_POT_equal(expected, output)
397
398 def test_files_list(self):
399 """Make sure the directories are inspected for source files
400 bpo-31920
401 """
402 text1 = 'Text to translate1'
403 text2 = 'Text to translate2'
404 text3 = 'Text to ignore'
405 with temp_cwd(None), temp_dir(None) as sdir:
406 pymod = Path(sdir, 'pypkg', 'pymod.py')
407 pymod.parent.mkdir()
408 pymod.write_text(f'_({text1!r})', encoding='utf-8')
409
410 pymod2 = Path(sdir, 'pkg.py', 'pymod2.py')
411 pymod2.parent.mkdir()
412 pymod2.write_text(f'_({text2!r})', encoding='utf-8')
413
414 pymod3 = Path(sdir, 'CVS', 'pymod3.py')
415 pymod3.parent.mkdir()
416 pymod3.write_text(f'_({text3!r})', encoding='utf-8')
417
418 assert_python_ok('-Xutf8', self.script, sdir)
419 data = Path('messages.pot').read_text(encoding='utf-8')
420 self.assertIn(f'msgid "{text1}"', data)
421 self.assertIn(f'msgid "{text2}"', data)
422 self.assertNotIn(text3, data)
423
424 def test_help_text(self):
425 """Test that the help text is displayed."""

Callers

nothing calls this directly

Calls 9

write_textMethod · 0.95
temp_cwdFunction · 0.90
temp_dirFunction · 0.90
PathClass · 0.90
assert_python_okFunction · 0.90
assertInMethod · 0.80
assertNotInMethod · 0.80
mkdirMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected