MCPcopy Index your code
hub / github.com/python/cpython / assertMsgidsEqual

Method assertMsgidsEqual

Lib/test/support/i18n_helper.py:44–56  ·  view source on GitHub ↗

Assert that msgids extracted from a given module match a snapshot.

(self, module)

Source from the content-addressed store, hash-verified

42class TestTranslationsBase(unittest.TestCase):
43
44 def assertMsgidsEqual(self, module):
45 '''Assert that msgids extracted from a given module match a
46 snapshot.
47
48 '''
49 skip_if_missing('i18n')
50 res = _generate_po_file(module.__file__, stdout_only=False)
51 self.assertEqual(res.returncode, 0)
52 self.assertEqual(res.stderr, '')
53 msgids = _extract_msgids(res.stdout)
54 snapshot_path = _get_snapshot_path(module.__name__)
55 snapshot = snapshot_path.read_text().splitlines()
56 self.assertListEqual(msgids, snapshot)
57
58
59def update_translation_snapshots(module):

Callers 3

test_translationsMethod · 0.80
test_translationsMethod · 0.80
test_translationsMethod · 0.80

Calls 8

skip_if_missingFunction · 0.90
_generate_po_fileFunction · 0.85
_extract_msgidsFunction · 0.85
_get_snapshot_pathFunction · 0.85
assertListEqualMethod · 0.80
assertEqualMethod · 0.45
splitlinesMethod · 0.45
read_textMethod · 0.45

Tested by 3

test_translationsMethod · 0.64
test_translationsMethod · 0.64
test_translationsMethod · 0.64