2 # -*- coding: utf-8 -*-
4 from translate
.lang
import factory
6 def test_punctranslate():
7 """Tests that we can translate punctuation."""
8 language
= factory
.getlanguage('vi')
9 assert language
.punctranslate(u
"abc efg") == u
"abc efg"
10 assert language
.punctranslate(u
"abc efg.") == u
"abc efg."
11 assert language
.punctranslate(u
"abc efg!") == u
"abc efg !"
12 assert language
.punctranslate(u
"abc efg? hij!") == u
"abc efg? hij !"
13 assert language
.punctranslate(u
"Delete file: %s?") == u
"Delete file : %s?"
14 assert language
.punctranslate(u
'The user "root"') == u
"The user « root »"
15 # More exhaustive testing of the quoting is in test_fr.py
16 assert language
.punctranslate(u
'Lưu "Tập tin"') == u
"Lưu « Tập tin »"
17 assert language
.punctranslate(u
"Lưu 'Tập tin'") == u
"Lưu « Tập tin »"
18 assert language
.punctranslate(u
"Lưu `Tập tin'") == u
"Lưu « Tập tin »"
21 """Tests basic functionality of sentence segmentation."""
22 language
= factory
.getlanguage('vi')
23 sentences
= language
.sentences(u
"Normal case. Nothing interesting.")
24 assert sentences
== [u
"Normal case.", u
"Nothing interesting."]
25 sentences
= language
.sentences(u
"Is that the case ? Sounds interesting !")
26 assert sentences
== [u
"Is that the case ?", u
"Sounds interesting !"]