def test_checks_noqa(self): """Test checks on a gettext file ignoring `noqa`-commented lines.""" po_check = PoCheck() po_check.set_check('skip_noqa', True) result = po_check.check_files([local_path('fr_errors.po')]) # be sure we have one file in result self.assertEqual(len(result), 1) # the file has 9 errors (`noqa` was skipped) self.assertEqual(len(result[0][1]), 9)
def test_checks_noqa(): """Test checks on a gettext file ignoring `noqa`-commented lines.""" po_check = PoCheck() po_check.set_check('skip_noqa', True) result = po_check.check_files([local_path('fr_errors.po')]) # be sure we have one file in result assert len(result) == 1 # the file has 9 errors (`noqa` was skipped) assert len(result[0][1]) == 9
def test_checks_fuzzy(): """Test checks on a gettext file including fuzzy strings.""" po_check = PoCheck() po_check.set_check('fuzzy', True) result = po_check.check_files([local_path('fr_errors.po')]) # be sure we have one file in result assert len(result) == 1 # the file has 11 errors (with the fuzzy string) assert len(result[0][1]) == 11
def test_checks_fuzzy(self): """Test checks on a gettext file including fuzzy strings.""" po_check = PoCheck() po_check.set_check('fuzzy', True) result = po_check.check_files([local_path('fr_errors.po')]) # be sure we have one file in result self.assertEqual(len(result), 1) # the file has 11 errors (with the fuzzy string) self.assertEqual(len(result[0][1]), 11)
def test_extract(): """Test extract on a gettext file.""" po_check = PoCheck() po_check.set_check('extract', True) result = po_check.check_files([local_path('fr.po')]) assert len(result) == 1 assert 'fr.po' in result[0][0] assert len(result[0][1]) == 3 report = result[0][1][0] assert report.message == 'Ceci est un test.\n' assert report.idmsg == 'extract' assert report.filename == '-' assert report.line == 0 assert report.mid == '' assert report.mstr == '' assert report.fuzzy is False assert str(report) == 'Ceci est un test.\n\n---' report = result[0][1][1] assert report.message == 'Test sur deux lignes.\nLigne 2.' assert report.idmsg == 'extract' assert report.filename == '-' assert report.line == 0 assert report.mid == '' assert report.mstr == '' assert report.fuzzy is False assert str(report) == 'Test sur deux lignes.\nLigne 2.\n---' report = result[0][1][2] assert report.message == ' erreur : %s' assert report.idmsg == 'extract' assert report.filename == '-' assert report.line == 0 assert report.mid == '' assert report.mstr == '' assert report.fuzzy is False assert str(report) == ' erreur : %s\n---'