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

Method test_files_list

Lib/test/test_tools/test_i18n.py:377–401  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

375 self.assert_POT_equal(expected, output)
376
377 def test_files_list(self):
378 """Make sure the directories are inspected for source files
379 bpo-31920
380 """
381 text1 = 'Text to translate1'
382 text2 = 'Text to translate2'
383 text3 = 'Text to ignore'
384 with temp_cwd(None), temp_dir(None) as sdir:
385 pymod = Path(sdir, 'pypkg', 'pymod.py')
386 pymod.parent.mkdir()
387 pymod.write_text(f'_({text1!r})', encoding='utf-8')
388
389 pymod2 = Path(sdir, 'pkg.py', 'pymod2.py')
390 pymod2.parent.mkdir()
391 pymod2.write_text(f'_({text2!r})', encoding='utf-8')
392
393 pymod3 = Path(sdir, 'CVS', 'pymod3.py')
394 pymod3.parent.mkdir()
395 pymod3.write_text(f'_({text3!r})', encoding='utf-8')
396
397 assert_python_ok('-Xutf8', self.script, sdir)
398 data = Path('messages.pot').read_text(encoding='utf-8')
399 self.assertIn(f'msgid "{text1}"', data)
400 self.assertIn(f'msgid "{text2}"', data)
401 self.assertNotIn(text3, data)
402
403
404def extract_from_snapshots():

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