fix git support for v1.5.3 (or higher) by setting "--work-tree"
[translate_toolkit.git] / filters / test_prefilters.py
blob864314b181a1ca88e9e84dd95da2ec8474661fb1
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 """tests decoration handling functions that are used by checks"""
6 from translate.filters import prefilters
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""
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ṱš"