~barcc/ubuntu/saucy/pyicu/lp1200419

« back to all changes in this revision

Viewing changes to test/test_MessageFormat.py

  • Committer: Package Import Robot
  • Author(s): Jakub Wilk, Bernd Zeimetz, Jakub Wilk
  • Date: 2011-11-13 12:07:46 UTC
  • mfrom: (3.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20111113120746-20jj2w42dzz6xozt
Tags: 1.3-1
* Team upload.

[ Bernd Zeimetz ]
* Migrate to dh_python2 (closes: #635633).

[ Jakub Wilk ]
* New upstream version.
  + Fix compatiblity with ICU 4.8 (closes: #628584).
  + Rewrite platform-definitions-fix.dpatch from scratch.
  + Revert upstream change to make ICUtzinfo a heap type.
* Bump standards version to 3.9.2 (no changes needed).
* Don't override shared library dependency information for libpython2.X; the
  exension modules aren't linked to it anyway.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
        f = Formattable(UnicodeString(x))
37
37
 
38
38
        text = MessageFormat.formatMessage("This is a string: {0}.", [f])
39
 
        self.assert_(text == "This is a string: x.")
 
39
        self.assertTrue(text == "This is a string: x.")
40
40
 
41
41
    def testFormat(self):
42
42
 
45
45
        msgFormat = MessageFormat("This is a string: {0}")
46
46
 
47
47
        text = msgFormat.format([f], FieldPosition())
48
 
        self.assert_(text == "This is a string: x")
 
48
        self.assertTrue(text == "This is a string: x")
49
49
 
50
 
        f = UnicodeString(x)
51
 
        text = msgFormat %f
52
 
        self.assert_(text == "This is a string: x")
 
50
        if (sys.version_info < (3,)):
 
51
            # Reduced features of % operator might be intentional
 
52
            f = UnicodeString(x)
 
53
            text = msgFormat %f
 
54
            self.assertTrue(text == "This is a string: x")
53
55
 
54
56
    def testFormatAppend(self):
55
57
 
58
60
        msgFormat = MessageFormat("This is a string: {0}")
59
61
 
60
62
        text = msgFormat.format([f], UnicodeString("x"), FieldPosition())
61
 
        self.assert_(text == "xThis is a string: x")
 
63
        self.assertTrue(text == "xThis is a string: x")
62
64
 
63
65
    def testFormats(self):
64
66
 
68
70
        formats = msgFormat.getFormats()
69
71
 
70
72
        formats[0].setTimeZone(TimeZone.createTimeZone(tzid))
71
 
        self.assert_(msgFormat.getFormats()[0].getTimeZone().getID() == orig)
 
73
        self.assertTrue(msgFormat.getFormats()[0].getTimeZone().getID() == orig)
72
74
 
73
75
        msgFormat.setFormats(formats)
74
 
        self.assert_(msgFormat.getFormats()[0].getTimeZone().getID() == tzid)
 
76
        self.assertTrue(msgFormat.getFormats()[0].getTimeZone().getID() == tzid)
75
77
 
76
78
    def testSelectFormat(self):
77
79
 
84
86
        msgFormat = MessageFormat(format, Locale("fr"))
85
87
        args = [Formattable("Kirti"), Formattable("female")]
86
88
 
87
 
        self.assert_(msgFormat.format(args) == u"Kirti est allée à Paris.")
 
89
        self.assertTrue(msgFormat.format(args) == u"Kirti est allée à Paris.")
88
90
 
89
91
 
90
92
if __name__ == "__main__":