Пример #1
0
 def test_merge_blanks(self):
     """checks that merging adds msgid_comments to blanks"""
     posource = '#: source1\nmsgid ""\nmsgstr ""\n\n#: source2\nmsgid ""\nmsgstr ""\n'
     pofile = self.poparse(posource)
     assert len(pofile.units) == 2
     pofile.removeduplicates("merge")
     assert len(pofile.units) == 2
     assert pypo.unquotefrompo(pofile.units[0].msgidcomments) == "_: source1\n"
     assert pypo.unquotefrompo(pofile.units[1].msgidcomments) == "_: source2\n"
Пример #2
0
 def test_merge_blanks(self):
     """checks that merging adds msgid_comments to blanks"""
     posource = '#: source1\nmsgid ""\nmsgstr ""\n\n#: source2\nmsgid ""\nmsgstr ""\n'
     pofile = self.poparse(posource)
     assert len(pofile.units) == 2
     pofile.removeduplicates("merge")
     assert len(pofile.units) == 2
     assert pypo.unquotefrompo(pofile.units[0].msgidcomments) == "_: source1\n"
     assert pypo.unquotefrompo(pofile.units[1].msgidcomments) == "_: source2\n"
Пример #3
0
def test_roundtrip_quoting():
    specials = [
        "Fish & chips",
        "five < six",
        "six > five",
        "Use &nbsp;",
        "Use &amp;nbsp;"
        'A "solution"',
        "skop 'n bal",
        '"""',
        "'''",
        "\n",
        "\t",
        "\r",
        "\\n",
        "\\t",
        "\\r",
        '\\"',
        "\r\n",
        "\\r\\n",
        "\\",
    ]
    for special in specials:
        quoted_special = pypo.quoteforpo(special)
        unquoted_special = pypo.unquotefrompo(quoted_special)
        print("special: %r\nquoted: %r\nunquoted: %r\n" %
              (special, quoted_special, unquoted_special))
        assert special == unquoted_special
Пример #4
0
def test_roundtrip_quoting():
    specials = [
        "Fish & chips",
        "five < six",
        "six > five",
        "Use &nbsp;",
        "Use &amp;nbsp;" 'A "solution"',
        "skop 'n bal",
        '"""',
        "'''",
        "\n",
        "\t",
        "\r",
        "\\n",
        "\\t",
        "\\r",
        '\\"',
        "\r\n",
        "\\r\\n",
        "\\",
    ]
    for special in specials:
        quoted_special = pypo.quoteforpo(special)
        unquoted_special = pypo.unquotefrompo(quoted_special)
        print("special: %r\nquoted: %r\nunquoted: %r\n" % (special, quoted_special, unquoted_special))
        assert special == unquoted_special
Пример #5
0
def test_roundtrip_quoting():
    specials = ['Fish & chips', 'five < six', 'six > five',
                'Use &nbsp;', 'Use &amp;nbsp;'
                'A "solution"', "skop 'n bal", '"""', "'''",
                '\n', '\t', '\r',
                '\\n', '\\t', '\\r', '\\"', '\r\n', '\\r\\n', '\\']
    for special in specials:
        quoted_special = pypo.quoteforpo(special)
        unquoted_special = pypo.unquotefrompo(quoted_special)
        print("special: %r\nquoted: %r\nunquoted: %r\n" % (special, quoted_special, unquoted_special))
        assert special == unquoted_special
Пример #6
0
def test_roundtrip_quoting():
    specials = ['Fish & chips', 'five < six', 'six > five', 
                'Use &nbsp;', 'Use &amp;nbsp;' 
                'A "solution"', "skop 'n bal", '"""', "'''", 
                '\n', '\t', '\r', 
                '\\n', '\\t', '\\r', '\\"', '\r\n', '\\r\\n', '\\']
    for special in specials:
        quoted_special = pypo.quoteforpo(special)
        unquoted_special = pypo.unquotefrompo(quoted_special)
        print "special: %r\nquoted: %r\nunquoted: %r\n" % (special, quoted_special, unquoted_special)
        assert special == unquoted_special
Пример #7
0
def unquotefrompo(postr):
    return pypo.unquotefrompo(postr)