예제 #1
0
    def test_case3(self):
        """Test for double quotes."""
        content = 'msgid "test"\n' \
                  'msgstr "Esto es una \\"prueba\\""\n'
        po = POFile()
        po.load_state_from_string(content)

        self.assertEqual(po.get_msgstr('test'), u'Esto es una "prueba"')
예제 #2
0
    def test_case3(self):
        """Test for double quotes."""
        content = 'msgid "test"\n' \
                  'msgstr "Esto es una \\"prueba\\""\n'
        po = POFile()
        po.load_state_from_string(content)

        self.assertEqual(po.get_msgstr('test'), u'Esto es una "prueba"')
예제 #3
0
    def test_case1(self):
        """Test for newlines."""
        content = 'msgid "Add"\n' \
                  'msgstr "Ajouter\\n"\n'
        po = POFile()
        po.load_state_from_string(content)

        self.assertEqual(po.get_msgstr('Add'), u'Ajouter\n')
예제 #4
0
    def test_case1(self):
        """Test for newlines."""
        content = 'msgid "Add"\n' \
                  'msgstr "Ajouter\\n"\n'
        po = POFile()
        po.load_state_from_string(content)

        self.assertEqual(po.get_msgstr('Add'), u'Ajouter\n')
예제 #5
0
    def test_end_comment(self):
        """Test end comment."""
        content = '#, fuzzy\n' \
                  '#~ msgid "Hello"\n' \
                  '#~ msgstr "Hola"\n'
        po = POFile()
        po.load_state_from_string(content)

        translation = po.gettext(((TEXT, 'Hello'), ))
        self.assertEqual(translation, ((TEXT, 'Hello'), ))
예제 #6
0
    def test_case2(self):
        """Test for multiple lines."""
        content = 'msgid "Hello world"\n' \
                  'msgstr ""\n' \
                  '"Hola "\n' \
                  '"mundo"\n'
        po = POFile()
        po.load_state_from_string(content)

        self.assertEqual(po.get_msgstr('Hello world'), u'Hola mundo')
예제 #7
0
    def test_end_comment(self):
        """Test end comment."""
        content = '#, fuzzy\n' \
                  '#~ msgid "Hello"\n' \
                  '#~ msgstr "Hola"\n'
        po = POFile()
        po.load_state_from_string(content)

        translation = po.gettext(((TEXT, 'Hello'),))
        self.assertEqual(translation,((TEXT, 'Hello'),))
예제 #8
0
    def test_case2(self):
        """Test for multiple lines."""
        content = 'msgid "Hello world"\n' \
                  'msgstr ""\n' \
                  '"Hola "\n' \
                  '"mundo"\n'
        po = POFile()
        po.load_state_from_string(content)

        self.assertEqual(po.get_msgstr('Hello world'), u'Hola mundo')
예제 #9
0
    def test_output(self):
        """Test output."""
        content = '# Comment\n' \
                  '#: pouet.py:45\n' \
                  '#, fuzzy\n' \
                  'msgid "Hello"\n' \
                  'msgstr ""\n' \
                  '"Hola\\n"\n'
        po = POFile()
        po.load_state_from_string(content)

        self.assertEqual((po.get_units())[0].to_str(), content)
예제 #10
0
    def test_output(self):
        """Test output."""
        content = '# Comment\n' \
                  '#: pouet.py:45\n' \
                  '#, fuzzy\n' \
                  'msgid "Hello"\n' \
                  'msgstr ""\n' \
                  '"Hola\\n"\n'
        po = POFile()
        po.load_state_from_string(content)

        self.assertEqual((po.get_units())[0].to_str(), content)
예제 #11
0
    def test_fuzzy(self):
        """Test fuzzy."""
        content = '# Comment\n' \
                  '#: pouet.py:45\n' \
                  '#, fuzzy\n' \
                  'msgid "Hello"\n' \
                  'msgstr ""\n' \
                  '"Hola\\n"\n'
        po = POFile()
        po.load_state_from_string(content)

        translation = po.gettext(((TEXT, 'Hello'), ))
        self.assertEqual(translation, ((TEXT, 'Hello'), ))
예제 #12
0
    def test_fuzzy(self):
        """Test fuzzy."""
        content = '# Comment\n' \
                  '#: pouet.py:45\n' \
                  '#, fuzzy\n' \
                  'msgid "Hello"\n' \
                  'msgstr ""\n' \
                  '"Hola\\n"\n'
        po = POFile()
        po.load_state_from_string(content)

        translation = po.gettext(((TEXT, 'Hello'),))
        self.assertEqual(translation, ((TEXT, 'Hello'),))