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"
def test_roundtrip_quoting(): specials = [ "Fish & chips", "five < six", "six > five", "Use ", "Use &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
def test_roundtrip_quoting(): specials = ['Fish & chips', 'five < six', 'six > five', 'Use ', 'Use &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
def test_roundtrip_quoting(): specials = ['Fish & chips', 'five < six', 'six > five', 'Use ', 'Use &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
def unquotefrompo(postr): return pypo.unquotefrompo(postr)