for git v1.5.2 (and below): chdir to the directory of the target file before executin...
[translate_toolkit.git] / lang / test_fr.py
bloba8267945467c4564ca3317f1193689fe2fd4ebcd
1 #!/usr/bin/env python
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('fr')
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'"root" is powerful') == u"« root » is powerful"
15 assert language.punctranslate(u"'root' is powerful") == u"« root » is powerful"
16 assert language.punctranslate(u"`root' is powerful") == u"« root » is powerful"
17 assert language.punctranslate(u'The user "root"') == u"The user « root »"
18 assert language.punctranslate(u"The user 'root'") == u"The user « root »"
19 assert language.punctranslate(u"The user `root'") == u"The user « root »"
20 assert language.punctranslate(u'The user "root"?') == u"The user « root » ?"
21 assert language.punctranslate(u"The user 'root'?") == u"The user « root » ?"
22 assert language.punctranslate(u"The user `root'?") == u"The user « root » ?"
23 assert language.punctranslate(u'Watch the " mark') == u'Watch the " mark'
24 assert language.punctranslate(u"Watch the ' mark") == u"Watch the ' mark"
25 assert language.punctranslate(u"Watch the ` mark") == u"Watch the ` mark"
26 assert language.punctranslate(u'The <a href="info">user</a> "root"?') == u'The <a href="info">user</a> « root » ?'
27 assert language.punctranslate(u"The <a href='info'>user</a> 'root'?") == u"The <a href='info'>user</a> « root » ?"
28 #Broken because we test for equal number of ` and ' in the string
29 #assert language.punctranslate(u"The <a href='info'>user</a> `root'?") == u"The <a href='info'>user</a> « root » ?"
31 def test_sentences():
32 """Tests basic functionality of sentence segmentation."""
33 language = factory.getlanguage('fr')
34 sentences = language.sentences(u"Normal case. Nothing interesting.")
35 assert sentences == [u"Normal case.", u"Nothing interesting."]
36 sentences = language.sentences(u"Is that the case ? Sounds interesting !")
37 assert sentences == [u"Is that the case ?", u"Sounds interesting !"]