def testNotInSource(self): tmp_stdout = StringIO() pattern = 'propos' with contextlib.redirect_stdout(tmp_stdout): find_in_po(pattern, ('about.po', ), linenum=False, file_match=True, no_messages=False) output = tmp_stdout.getvalue() self.assertTrue( len(output) == 0, "Original text should not contain " + pattern)
def testNotInTranslation(self): tmp_stdout = StringIO() pattern = 'About' with contextlib.redirect_stdout(tmp_stdout): find_in_po(pattern, ('about.po', ), linenum=False, file_match=True, no_messages=False, in_translation=True, not_in_source=True) output = tmp_stdout.getvalue() self.assertTrue( len(output) == 0, "Translated text should not contain " + pattern)
def test_not_in_translation(about_po): errors, results = find_in_po( "About", ("about.po", ), in_translation=True, not_in_source=True, ) assert not errors assert not results
def test_in_translation(about_po): errors, results = find_in_po( "propos", ("about.po", ), in_translation=True, not_in_source=True, ) assert not errors assert "about.po" in {result.file for result in results}
def test_not_in_source(about_po): errors, results = find_in_po("propos", ("about.po", )) assert not errors assert not results
def test_in_source(about_po): errors, results = find_in_po("About", ("about.po", )) assert not errors assert "about.po" in {result.file for result in results}