本文整理汇总了Python中translate.storage.test_base.headerless_len函数的典型用法代码示例。如果您正苦于以下问题:Python headerless_len函数的具体用法?Python headerless_len怎么用?Python headerless_len使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了headerless_len函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_msgid_comments
def test_msgid_comments(self):
"""Tests that msgid comments don't feature anywhere."""
posource = 'msgid "_: Capital. ACRONYMN. (msgid) comment 3. %d Extra sentence.\\n"\n"cow"\nmsgstr "koei"\n'
pofile = self.parse_text(posource)
filter_result = self.filter(pofile)
if headerless_len(filter_result.units):
print first_translatable(filter_result)
assert headerless_len(filter_result.units) == 0
开发者ID:AndryulE,项目名称:kitsune,代码行数:8,代码来源:test_pofilter.py
示例2: test_newlines
def test_newlines(self):
"""Tests that things keep working with empty entries"""
minicsv = '"source","target"\r\n"yellow pencil","żółty\\nołówek"'
pofile = self.csv2po(minicsv)
assert pofile.findunit("yellow pencil") is not None
assert pofile.findunit("yellow pencil").target == "żółty\\nołówek"
assert headerless_len(pofile.units) == 1
开发者ID:diorcety,项目名称:translate,代码行数:7,代码来源:test_csv2po.py
示例3: test_keep_translations
def test_keep_translations(self):
"""check that we can grep unicode messages and use unicode regex search strings"""
posource = '#: schemas.in\nmsgid "test"\nmsgstr "rest"\n'
poresult = self.pogrep(posource, "schemas.in", ["--invert-match", "--keep-translations", "--search=locations"])
assert poresult.index(posource) >= 0
poresult = self.pogrep(posource, "schemas.in", ["--invert-match", "--search=locations"])
assert headerless_len(po.pofile(poresult).units) == 0
开发者ID:onia,项目名称:translate,代码行数:7,代码来源:test_pogrep.py
示例4: test_simplegrep_comments
def test_simplegrep_comments(self):
"""grep for a string in the comments"""
posource = '# (review) comment\n#: test.c\nmsgid "test"\nmsgstr "rest"\n'
poresult = self.pogrep(posource, "review", ["--search=comment"])
assert poresult.index(posource) >= 0
poresult = self.pogrep(posource, "test", ["--search=comment"])
assert headerless_len(po.pofile(poresult).units) == 0
开发者ID:onia,项目名称:translate,代码行数:7,代码来源:test_pogrep.py
示例5: test_simplegrep_locations
def test_simplegrep_locations(self):
"""grep for a string in the location comments"""
posource = '#: test.c\nmsgid "test"\nmsgstr "rest"\n'
poresult = self.pogrep(posource, "test.c", ["--search=locations"])
assert poresult.index(posource) >= 0
poresult = self.pogrep(posource, "rest.c", ["--search=locations"])
assert headerless_len(po.pofile(poresult).units) == 0
开发者ID:onia,项目名称:translate,代码行数:7,代码来源:test_pogrep.py
示例6: test_simplegrep_msgstr
def test_simplegrep_msgstr(self):
"""grep for a string in the target"""
posource = '#: test.c\nmsgid "test"\nmsgstr "rest"\n'
poresult = self.pogrep(posource, "rest", ["--search=msgstr"])
assert poresult.index(posource) >= 0
poresult = self.pogrep(posource, "test", ["--search=msgstr"])
assert headerless_len(po.pofile(poresult).units) == 0
开发者ID:onia,项目名称:translate,代码行数:7,代码来源:test_pogrep.py
示例7: test_unicode
def test_unicode(self):
"""tests that we can handle UTF-8 encoded characters when there is no
known header specified encoding"""
self.unit.source = u'Bézier curve'
self.unit.target = u'Bézier-kurwe'
filter_result = self.filter(self.translationstore)
assert headerless_len(filter_result.units) == 0
开发者ID:Veterini,项目名称:translate,代码行数:7,代码来源:test_pofilter.py
示例8: test_empties
def test_empties(self):
"""Tests that things keep working with empty entries"""
minipo = 'msgid "Source"\nmsgstr ""\n\nmsgid ""\nmsgstr ""'
csvfile = self.po2csv(minipo)
assert csvfile.findunit("Source") is not None
assert csvfile.findunit("Source").target == ""
assert headerless_len(csvfile.units) == 1
开发者ID:Jobava,项目名称:translate-toolkit,代码行数:7,代码来源:test_po2csv.py
示例9: test_empties
def test_empties(self):
"""Tests that things keep working with empty entries"""
minicsv = ',SomeSource,'
pofile = self.csv2po(minicsv)
assert pofile.findunit("SomeSource") is not None
assert pofile.findunit("SomeSource").target == ""
assert headerless_len(pofile.units) == 1
开发者ID:Veterini,项目名称:translate,代码行数:7,代码来源:test_csv2po.py
示例10: test_test_against_review
def test_test_against_review(self):
"""test whether to run tests against translations marked for review"""
self.unit.markreviewneeded()
filter_result = self.filter(self.translationstore, cmdlineoptions=["--review"])
assert first_translatable(filter_result).isreview()
filter_result = self.filter(self.translationstore, cmdlineoptions=["--noreview"])
assert headerless_len(filter_result.units) == 0
# Re-initialize the translation store object.
self.setup_method(self)
filter_result = self.filter(self.translationstore, cmdlineoptions=["--review"])
assert headerless_len(filter_result.units) == 0
filter_result = self.filter(self.translationstore, cmdlineoptions=["--noreview"])
assert headerless_len(filter_result.units) == 0
开发者ID:AndryulE,项目名称:kitsune,代码行数:16,代码来源:test_pofilter.py
示例11: test_notes
def test_notes(self):
"""tests the optional adding of notes"""
# let's make sure we trigger the 'long' and/or 'doubleword' test
self.unit.target = u"asdf asdf asdf asdf asdf asdf asdf"
filter_result = self.filter(self.translationstore)
assert headerless_len(filter_result.units) == 1
assert first_translatable(filter_result).geterrors()
# now we remove the existing error. self.unit is changed since we copy
# units - very naughty
if isinstance(self.unit, xliff.xliffunit):
self.unit.removenotes(origin='pofilter')
else:
self.unit.removenotes()
filter_result = self.filter(self.translationstore, cmdlineoptions=["--nonotes"])
assert headerless_len(filter_result.units) == 1
assert len(first_translatable(filter_result).geterrors()) == 0
开发者ID:AndryulE,项目名称:kitsune,代码行数:17,代码来源:test_pofilter.py
示例12: test_non_existant_check
def test_non_existant_check(self):
"""check that we report an error if a user tries to run a non-existant
test"""
filter_result = self.filter(self.translationstore,
cmdlineoptions=["-t nonexistant"])
# TODO Not sure how to check for the stderror result of: warning: could
# not find filter nonexistant
assert headerless_len(filter_result.units) == 0
开发者ID:Veterini,项目名称:translate,代码行数:8,代码来源:test_pofilter.py
示例13: test_isreview
def test_isreview(self):
"""tests the extraction of items marked review"""
filter_result = self.filter(self.translationstore, cmdlineoptions=["--test=isreview"])
assert headerless_len(filter_result.units) == 0
self.unit.markreviewneeded()
filter_result = self.filter(self.translationstore, cmdlineoptions=["--test=isreview"])
assert first_translatable(filter_result).isreview()
开发者ID:AndryulE,项目名称:kitsune,代码行数:8,代码来源:test_pofilter.py
示例14: test_simplegrep_locations_with_comment_enabled
def test_simplegrep_locations_with_comment_enabled(self):
"""grep for a string in "locations", while also "comment" is checked
see http://bugs.locamotion.org/show_bug.cgi?id=1036
"""
posource = '# (review) comment\n#: test.c\nmsgid "test"\nmsgstr "rest"\n'
poresult = self.pogrep(posource, "test", ["--search=comment", "--search=locations"])
assert poresult.index(posource) >= 0
poresult = self.pogrep(posource, "rest", ["--search=comment", "--search=locations"])
assert headerless_len(po.pofile(poresult).units) == 0
开发者ID:onia,项目名称:translate,代码行数:9,代码来源:test_pogrep.py
示例15: test_simplegrep_locations_with_comment_enabled
def test_simplegrep_locations_with_comment_enabled(self):
"""grep for a string in "locations", while also "comment" is checked
see https://github.com/translate/translate/issues/1036
"""
posource = '# (review) comment\n#: test.c\nmsgid "test"\nmsgstr "rest"\n'
poresult = self.pogrep(posource, "test", ["--search=comment", "--search=locations"])
assert poresult.index(posource) >= 0
poresult = self.pogrep(posource, "rest", ["--search=comment", "--search=locations"])
assert headerless_len(po.pofile(poresult).units) == 0
开发者ID:onlinehomeopati,项目名称:translate,代码行数:9,代码来源:test_pogrep.py
示例16: test_minimal
def test_minimal(self):
minixlf = self.xliffskeleton % '''<trans-unit>
<source>red</source>
<target>rooi</target>
</trans-unit>'''
pofile = self.xliff2po(minixlf)
assert headerless_len(pofile.units) == 1
assert pofile.translate("red") == "rooi"
assert pofile.translate("bla") is None
开发者ID:Veterini,项目名称:translate,代码行数:9,代码来源:test_xliff2po.py
示例17: test_preconditions
def test_preconditions(self):
"""tests that the preconditions work correctly"""
self.unit.source = "File"
self.unit.target = ""
filter_result= self.filter(self.translationstore)
# We should only get one error (untranslated), and nothing else
assert headerless_len(filter_result.units) == 1
unit = first_translatable(filter_result)
assert len(unit.geterrors()) == 1
开发者ID:AndryulE,项目名称:kitsune,代码行数:9,代码来源:test_pofilter.py
示例18: test_test_against_fuzzy
def test_test_against_fuzzy(self):
"""test whether to run tests against fuzzy translations"""
self.unit.markfuzzy()
filter_result = self.filter(self.translationstore, cmdlineoptions=["--fuzzy"])
assert first_translatable(filter_result).geterrors().has_key('isfuzzy')
filter_result = self.filter(self.translationstore, cmdlineoptions=["--nofuzzy"])
assert headerless_len(filter_result.units) == 0
# Re-initialize the translation store object in order to get an unfuzzy unit
# with no filter notes.
self.setup_method(self)
filter_result = self.filter(self.translationstore, cmdlineoptions=["--fuzzy"])
assert headerless_len(filter_result.units) == 0
filter_result = self.filter(self.translationstore, cmdlineoptions=["--nofuzzy"])
assert headerless_len(filter_result.units) == 0
开发者ID:AndryulE,项目名称:kitsune,代码行数:19,代码来源:test_pofilter.py
示例19: test_isfuzzy
def test_isfuzzy(self):
"""tests the extraction of items marked fuzzy"""
self.unit.markfuzzy()
filter_result = self.filter(self.translationstore, cmdlineoptions=["--test=isfuzzy"])
assert first_translatable(filter_result).geterrors().has_key('isfuzzy')
self.unit.markfuzzy(False)
filter_result = self.filter(self.translationstore, cmdlineoptions=["--test=isfuzzy"])
assert headerless_len(filter_result.units) == 0
开发者ID:AndryulE,项目名称:kitsune,代码行数:10,代码来源:test_pofilter.py
示例20: test_simple
def test_simple(self):
""" Test the most basic resx conversion """
resx_source = self.XMLskeleton % '''<data name="key" xml:space="preserve">
<value>A simple string</value>
</data>'''
poexpected = '''#: key
msgid "A simple string"
msgstr ""
'''
po_result = self.resx2po(resx_source)
assert str(po_result.units[1]) == poexpected
assert headerless_len(po_result.units) == 1
开发者ID:Veterini,项目名称:translate,代码行数:13,代码来源:test_resx2po.py
注:本文中的translate.storage.test_base.headerless_len函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论