~ubuntu-branches/ubuntu/wily/pyicu/wily-proposed

« back to all changes in this revision

Viewing changes to test/test_MessageFormat.py

  • Committer: Bazaar Package Importer
  • Author(s): Bernd Zeimetz
  • Date: 2010-07-11 00:00:06 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100711000006-5qwkzo9b3b0jv8an
Tags: 1.0-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
1
2
# ====================================================================
2
3
# Copyright (c) 2005-2010 Open Source Applications Foundation.
3
4
#
24
25
import sys, os
25
26
 
26
27
from unittest import TestCase, main
27
 
from PyICU import *
 
28
from icu import *
28
29
 
29
30
 
30
31
class TestMessageFormat(TestCase):
72
73
        msgFormat.setFormats(formats)
73
74
        self.assert_(msgFormat.getFormats()[0].getTimeZone().getID() == tzid)
74
75
 
 
76
    def testSelectFormat(self):
 
77
 
 
78
        try:
 
79
            from icu import SelectFormat
 
80
        except ImportError:
 
81
            return
 
82
 
 
83
        format = u"{0} est {1, select, female {allée} other {allé}} à Paris."
 
84
        msgFormat = MessageFormat(format, Locale("fr"))
 
85
        args = [Formattable("Kirti"), Formattable("female")]
 
86
 
 
87
        self.assert_(msgFormat.format(args) == u"Kirti est allée à Paris.")
 
88
 
75
89
 
76
90
if __name__ == "__main__":
77
91
    main()