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
27 filtered
= prefilters
.filterwordswithpunctuation(string
)
28 assert filtered
== u
"Iṱš"