for git v1.5.2 (and below): chdir to the directory of the target file before executin...
[translate_toolkit.git] / lang / test_ar.py
blobec32fe97614e0775decf47f207828e2311baa7b4
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('ar')
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; d?") == u"abc، efg؛ d؟"
13 def test_sentences():
14 """Tests basic functionality of sentence segmentation."""
15 language = factory.getlanguage('ar')
16 sentences = language.sentences(u"يوجد بالفعل مجلد بالإسم \"%s\". أترغب في استبداله؟")
17 print sentences
18 assert sentences == [u"يوجد بالفعل مجلد بالإسم \"%s\".", u"أترغب في استبداله؟"]
19 # This probably doesn't make sense: it is just the above reversed, to make sure
20 # we test the '؟' as an end of sentence marker.
21 sentences = language.sentences(u"أترغب في استبداله؟ يوجد بالفعل مجلد بالإسم \"%s\".")
22 print sentences
23 assert sentences == [u"أترغب في استبداله؟", u"يوجد بالفعل مجلد بالإسم \"%s\"."]