示例#1
0
    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)
示例#2
0
    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
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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 = []
示例#6
0
 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)
示例#7
0
 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 = []
示例#8
0
 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)
示例#9
0
 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 = []
示例#10
0
 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)
示例#11
0
 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 = []
示例#12
0
 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)
示例#13
0
 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 = []
示例#14
0
 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)
示例#15
0
 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
示例#16
0
    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)
示例#17
0
 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
示例#18
0
 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)
示例#19
0
 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)