def test_unsorted(self): first = POEntry(msgid="Second", msgstr="Translation") second = POEntry(msgid="First", msgstr="Translation") status = Status() status.step(first) status.step(second) self.assertFalse(sort_validator(status))
def test_next_step(self): status = Status() status.step(sentinel.first) status.step(sentinel.second) self.assertEqual(status.entry, sentinel.second) self.assertEqual(status.previous, sentinel.first)
def test_fail(self): entry = POEntry(msgid="Source", msgstr="Translation", occurrences=[('source.py', 1)]) status = Status() status.step(entry) self.assertFalse(no_location_validator(status))
def test_msgctxt_both(self): first = POEntry(msgid="First", msgstr="Trans.", msgctxt="abbrev.") second = POEntry(msgid="First", msgstr="Translation", msgctxt="long") status = Status() status.step(first) status.step(second) self.assertTrue(sort_validator(status))
def test_fail_multiple_flags(self): entry = POEntry(msgid="Source", msgstr="Translation", flags=['another', 'fuzzy', 'flag']) status = Status() status.step(entry) self.assertFalse(fuzzy_validator(status))
def test_fail_fuzzy(self): # Fuzzy translations are considered untranslated entry = POEntry(msgid="Source", msgstr="Translation", flags=['fuzzy']) status = Status() status.step(entry) self.assertFalse(untranslated_validator(status))
def test_fail_missing(self): entry = POEntry(msgid="Source", msgstr="") status = Status() status.step(entry) self.assertFalse(untranslated_validator(status))
def test_fail(self): entry = POEntry(msgid="Source", msgstr="Translation", obsolete=True) status = Status() status.step(entry) self.assertFalse(obsolete_validator(status))
def test_fail_fuzzy(self): entry = POEntry(msgid="Source", msgstr="Translation", flags=['fuzzy']) status = Status() status.step(entry) self.assertFalse(fuzzy_validator(status))
def test_first_step(self): status = Status() status.step(sentinel.first) self.assertEqual(status.entry, sentinel.first) self.assertIsNone(status.previous)
def test_pass(self): entry = POEntry(msgid="Source", msgstr="Translation") status = Status() status.step(entry) self.assertTrue(no_location_validator(status))
def test_fail_obsolete(self): # Obsolete translations are considered untranslated entry = POEntry(msgid="Source", msgstr="Translation", obsolete=True) status = Status() status.step(entry) self.assertFalse(untranslated_validator(status))
def test_first_entry(self): entry = POEntry(msgid="Source", msgstr="Translation") status = Status() status.step(entry) self.assertTrue(sort_validator(status))