• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pypo.quoteforpo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中translate.storage.pypo.quoteforpo函数的典型用法代码示例。如果您正苦于以下问题:Python quoteforpo函数的具体用法?Python quoteforpo怎么用?Python quoteforpo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了quoteforpo函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_roundtrip_quoting

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
开发者ID:asyschikov,项目名称:translate,代码行数:26,代码来源:test_po.py


示例2: test_quoteforpo

 def test_quoteforpo(self):
     """Special escaping routine to manage newlines and linewrap in PO"""
     # Simple case
     assert pypo.quoteforpo("Some test") == ['"Some test"']
     # Newline handling
     assert pypo.quoteforpo("One\nTwo\n") == ['""', '"One\\n"', '"Two\\n"']
     # First line wrapping
     assert pypo.quoteforpo("A very long sentence. A very long sentence. A very long sentence. A ver") == \
                          ['"A very long sentence. A very long sentence. A very long sentence. A ver"']
     assert pypo.quoteforpo("A very long sentence. A very long sentence. A very long sentence. A very") == \
                           ['""',
                            '"A very long sentence. A very long sentence. A very long sentence. A very"']
     # Long line with a newline
     assert pypo.quoteforpo("A very long sentence. A very long sentence. A very long sentence. A very lon\n") == \
                          ['""', '"A very long sentence. A very long sentence. A very long sentence. A very "', '"lon\\n"']
     assert pypo.quoteforpo("A very long sentence. A very long sentence. A very long sentence. A very 123\n") == \
                          ['""', '"A very long sentence. A very long sentence. A very long sentence. A very "', '"123\\n"']
     # Special 77 char failure.
     assert pypo.quoteforpo("Ukuba uyayiqonda into eyenzekayo, \nungaxelela i-&brandShortName; ukuba iqalise ukuthemba ufaniso lwale sayithi. \n<b>Nokuba uyayithemba isayithi, le mposiso isenokuthetha ukuba   kukho umntu \nobhucabhuca ukudibanisa kwakho.</b>") == \
                          ['""',
                           '"Ukuba uyayiqonda into eyenzekayo, \\n"',
                           '"ungaxelela i-&brandShortName; ukuba iqalise ukuthemba ufaniso lwale sayithi. "',
                           '"\\n"',
                           '"<b>Nokuba uyayithemba isayithi, le mposiso isenokuthetha ukuba   kukho umntu "',
                           '"\\n"',
                           '"obhucabhuca ukudibanisa kwakho.</b>"']
开发者ID:claudep,项目名称:translate,代码行数:26,代码来源:test_pypo.py


示例3: test_roundtrip_quoting

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
开发者ID:onia,项目名称:translate,代码行数:11,代码来源:test_po.py


示例4: test_quoteforpo_escaped_quotes

    def test_quoteforpo_escaped_quotes(self):
        """Ensure that we don't break \" in two when wrapping

        See :issue:`3140`
        """
        assert pypo.quoteforpo('''You can get a copy of your Recovery Key by going to &syncBrand.shortName.label; Options on your other device, and selecting  "My Recovery Key" under "Manage Account".''') == [u'""', u'"You can get a copy of your Recovery Key by going to "', u'"&syncBrand.shortName.label; Options on your other device, and selecting  \\""', u'"My Recovery Key\\" under \\"Manage Account\\"."']
开发者ID:claudep,项目名称:translate,代码行数:6,代码来源:test_pypo.py


示例5: quoteforpo

def quoteforpo(text):
    return pypo.quoteforpo(text)
开发者ID:flyeven,项目名称:translate,代码行数:2,代码来源:cpo.py



注:本文中的translate.storage.pypo.quoteforpo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_base.first_translatable函数代码示例发布时间:2022-05-27
下一篇:
Python properties.propfile函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap