Package translate :: Package filters :: Module test_prefilters

[hide private]
[frames] | no frames]

# Source Code for Module translate.filters.test_prefilters

     1  #!/usr/bin/env python
     2  # -*- coding: utf-8 -*-
     3
     4  """tests decoration handling functions that are used by checks"""
     5
     6  from translate.filters import prefilters
     7
     8 -def test_removekdecomments():
     9      assert prefilters.removekdecomments(u"Some sṱring") == u"Some sṱring"
    10      assert prefilters.removekdecomments(u"_: Commenṱ\\n\nSome sṱring") == u"Some sṱring"
    11      assert prefilters.removekdecomments(u"_: Commenṱ\\n\n") == u""
    12
    13 -def test_filterwordswithpunctuation():
    14      string = u"Nothing in here."
    15      filtered = prefilters.filterwordswithpunctuation(string)
    16      assert filtered == string
    17      # test listed words (start / end with apostrophe)
    18      string = u"'n Boom het 'n tak."
    19      filtered = prefilters.filterwordswithpunctuation(string)
    20      assert filtered == "n Boom het n tak."
    21      # test words containing apostrophe
    22      string = u"It's in it's own place."
    23      filtered = prefilters.filterwordswithpunctuation(string)
    24      assert filtered == "Its in its own place."
    25      # test strings in unicode
    26      string = u"Iṱ'š"
    27      filtered = prefilters.filterwordswithpunctuation(string)
    28      assert filtered == u"Iṱš"
    29