for git v1.5.2 (and below): chdir to the directory of the target file before executin...
[translate_toolkit.git] / lang / test_factory.py
blobf894f593be00c241272cc0452979d9232d2af7fa
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 from translate.lang import factory
6 def test_getlanguage():
7 """Tests that a basic call to getlanguage() works."""
8 kmlanguage = factory.getlanguage('km')
9 assert kmlanguage.code == 'km'
10 assert kmlanguage.fullname == 'Khmer'
12 # Test a non-exisint code
13 language = factory.getlanguage('zz')
14 assert language.nplurals == 0
16 # Test a code without a module
17 language = factory.getlanguage('fy')
18 assert language.nplurals == 2
19 assert language.fullname == "Frisian"
20 assert "n != 1" in language.pluralequation
22 # Test a code without a module and with a country code
23 language = factory.getlanguage('de_AT')
24 assert language.nplurals == 2
25 assert language.fullname == "German"
27 # Test with None as language code
28 language = factory.getlanguage(None)
29 assert language.code == ''
31 #Test with a language code that is a reserved word in Python
32 language = factory.getlanguage('is')
33 assert language.nplurals == 2