def test_parse_with_comments(self): path = str(ROOT_PATH.joinpath('test.lang')) parsed = parse(path, extract_comments=True) expected = { u'Hooray! Your Firefox is up to date.': [ u'This is for the Whatsnew page: ' u'http://www-dev.allizom.org/b/firefox/whatsnew/', u'F\xe9licitations ! ' u'Votre Firefox a \xe9t\xe9 mis \xe0 jour.', ], u'Your Firefox is out of date.': [ None, u'Votre Firefox ne semble pas \xe0 jour.', ], u'Firefox Beta': [ None, u'Firefox Beta', ], u'Firefox Aurora': [ None, u'Firefox Aurora', ], } eq_(parsed, expected)
def test_parse_with_comments(self): path = str(ROOT_PATH.joinpath('test.lang')) parsed = parse(path, extract_comments=True) expected = { u'Hooray! Your Firefox is up to date.': [ u'This is for the Whatsnew page: ' u'http://www-dev.allizom.org/b/firefox/whatsnew/', u'F\xe9licitations ! ' u'Votre Firefox a \xe9t\xe9 mis \xe0 jour.', ], u'Your Firefox is out of date.': [ None, u'Votre Firefox ne semble pas \xe0 jour.', ], u'Firefox Beta': [ None, u'Firefox Beta', ], u'Firefox Aurora': [ None, u'Firefox Aurora', ], } assert parsed == expected
def test_parse_ingnores_untranslated(self): """parse should skip strings that aren't translated.""" path = os.path.join(ROOT, 'locale/de/main.lang') parsed = parse(path) expected = { u'The State of Mozilla': u'Awesome Baby! YEEEAAHHHH!!' } self.assertDictEqual(parsed, expected)
def test_parse_utf8_error(self): path = os.path.join(ROOT, "test_utf8_error.lang") parsed = parse(path) eq_(len(mail.outbox), 1) eq_(mail.outbox[0].subject, "[Django] %s is corrupted" % path) expected = {u"Update now": u"Niha rojane bike", u"Supported Devices": u"C�haz�n pi�tgiriy"} eq_(parsed, expected) mail.outbox = []
def test_parse(self): path = os.path.join(ROOT, "test.lang") parsed = parse(path) expected = { u"Hooray! Your Firefox is up to date.": u"F\xe9licitations ! " u"Votre Firefox a \xe9t\xe9 mis \xe0 jour.", u"Your Firefox is out of date.": u"Votre Firefox ne semble pas \xe0 jour.", } eq_(parsed, expected)
def test_parse_utf8_error(self): path = os.path.join(ROOT, 'test_utf8_error.lang') parsed = parse(path) eq_(len(mail.outbox), 1) eq_(mail.outbox[0].subject, '[Django] %s is corrupted' % path) expected = { u'Update now': u'Niha rojane bike', u'Supported Devices': u'C�haz�n pi�tgiriy' } eq_(parsed, expected) mail.outbox = []
def test_parse(self): path = os.path.join(ROOT, 'test.lang') parsed = parse(path) expected = { u'Hooray! Your Firefox is up to date.': u'F\xe9licitations ! ' u'Votre Firefox a \xe9t\xe9 mis \xe0 jour.', u'Your Firefox is out of date.': u'Votre Firefox ne semble pas \xe0 jour.' } eq_(parsed, expected)
def test_parse_utf8_error(self): path = str(ROOT_PATH.joinpath('test_utf8_error.lang')) parsed = parse(path) assert len(mail.outbox) == 1 assert mail.outbox[0].subject == '[bedrock] %s is corrupted' % path expected = { 'Update now': 'Niha rojane bike', 'Supported Devices': 'C�haz�n pi�tgiriy�' } assert parsed == expected mail.outbox = []
def test_parse_not_skip_untranslated(self): path = os.path.join(ROOT, "test.lang") parsed = parse(path, skip_untranslated=False) expected = { u"Hooray! Your Firefox is up to date.": u"F\xe9licitations ! " u"Votre Firefox a \xe9t\xe9 mis \xe0 jour.", u"Your Firefox is out of date.": u"Votre Firefox ne semble pas \xe0 jour.", u"Firefox Beta": u"Firefox Beta", u"Firefox Aurora": u"Firefox Aurora", } eq_(parsed, expected)
def test_parse_utf8_error(self): path = str(ROOT_PATH.joinpath('test_utf8_error.lang')) parsed = parse(path) assert len(mail.outbox) == 1 assert mail.outbox[0].subject == '[bedrock] %s is corrupted' % path expected = { u'Update now': u'Niha rojane bike', u'Supported Devices': u'C�haz�n pi�tgiriy' } assert parsed == expected mail.outbox = []
def test_parse_not_skip_untranslated(self): path = os.path.join(ROOT, 'test.lang') parsed = parse(path, skip_untranslated=False) expected = { u'Hooray! Your Firefox is up to date.': u'F\xe9licitations ! ' u'Votre Firefox a \xe9t\xe9 mis \xe0 jour.', u'Your Firefox is out of date.': u'Votre Firefox ne semble pas \xe0 jour.', u'Firefox Beta': u'Firefox Beta', u'Firefox Aurora': u'Firefox Aurora' } eq_(parsed, expected)
def test_parse(self): path = str(ROOT_PATH.joinpath('test.lang')) parsed = parse(path) expected = { u'Hooray! Your Firefox is up to date.': u'F\xe9licitations ! ' u'Votre Firefox a \xe9t\xe9 mis \xe0 jour.', u'Your Firefox is out of date.': u'Votre Firefox ne semble pas \xe0 jour.', u'Firefox Beta': u'Firefox Beta', u'Firefox Aurora': u'Firefox Aurora', } assert parsed == expected
def test_parse_with_comments(self): path = os.path.join(ROOT, "test.lang") parsed = parse(path, extract_comments=True) expected = { u"Hooray! Your Firefox is up to date.": [ u"This is for the Whatsnew page: " u"http://www-dev.allizom.org/b/firefox/whatsnew/", u"F\xe9licitations ! " u"Votre Firefox a \xe9t\xe9 mis \xe0 jour.", ], u"Your Firefox is out of date.": [None, u"Votre Firefox ne semble pas \xe0 jour."], } eq_(parsed, expected)
def test_parse_not_skip_untranslated(self): path = str(ROOT_PATH.joinpath('test.lang')) parsed = parse(path, skip_untranslated=False) expected = { u'Hooray! Your Firefox is up to date.': u'F\xe9licitations ! ' u'Votre Firefox a \xe9t\xe9 mis \xe0 jour.', u'Your Firefox is out of date.': u'Votre Firefox ne semble pas \xe0 jour.', u'Firefox Beta': u'Firefox Beta', u'Firefox Aurora': u'Firefox Aurora', u'Firefox Developer Edition': u'Firefox Developer Edition', } assert parsed == expected
def test_parse(self): path = str(ROOT_PATH.joinpath('test.lang')) parsed = parse(path) expected = { u'Hooray! Your Firefox is up to date.': u'F\xe9licitations ! ' u'Votre Firefox a \xe9t\xe9 mis \xe0 jour.', u'Your Firefox is out of date.': u'Votre Firefox ne semble pas \xe0 jour.', u'Firefox Beta': u'Firefox Beta', u'Firefox Aurora': u'Firefox Aurora', } eq_(parsed, expected)
def test_parse_not_skip_untranslated(self): path = str(ROOT_PATH.joinpath('test.lang')) parsed = parse(path, skip_untranslated=False) expected = { u'Hooray! Your Firefox is up to date.': u'F\xe9licitations ! ' u'Votre Firefox a \xe9t\xe9 mis \xe0 jour.', u'Your Firefox is out of date.': u'Votre Firefox ne semble pas \xe0 jour.', u'Firefox Beta': u'Firefox Beta', u'Firefox Aurora': u'Firefox Aurora', u'Firefox Developer Edition': u'Firefox Developer Edition', } eq_(parsed, expected)