[Zope3-checkins] CVS: Zope3/src/zope/i18n/tests - test_messageid.py:1.2
Barry Warsaw
barry@wooz.org
Wed, 9 Apr 2003 17:23:14 -0400
Update of /cvs-repository/Zope3/src/zope/i18n/tests
In directory cvs.zope.org:/tmp/cvs-serv9448
Modified Files:
test_messageid.py
Log Message:
Slightly cleaner implementation of MessageID. Logically I think these
should be immutable (but this is not enforced yet since I'm not sure).
However, the domain and default attributes might as well be directly
accessible so get rid of the setDefault() method.
Also add an __new__() so that the domain and default can be specified
in the constructor. The additional benefit here is that domain and
default are always defined, even if they are set to None (the old way,
you'd have to do a hasattr() first).
Updated docstrings.
Update MessageIDFactory.__call__() to use the new signature for
MessageID.
Whitespace normalization.
=== Zope3/src/zope/i18n/tests/test_messageid.py 1.1 => 1.2 ===
--- Zope3/src/zope/i18n/tests/test_messageid.py:1.1 Mon Mar 24 19:23:05 2003
+++ Zope3/src/zope/i18n/tests/test_messageid.py Wed Apr 9 17:23:14 2003
@@ -19,15 +19,18 @@
import unittest
from zope.i18n.messageid import MessageIDFactory, MessageID
+
class TestMessageID(unittest.TestCase):
- def test(self):
+ def testMessageIDFactory(self):
+ eq = self.assertEqual
fact = MessageIDFactory('test')
id = fact(u'this is a test')
- self.assert_(isinstance(id, MessageID))
- self.assertEqual(id.domain, 'test')
- self.assertEqual(id.default, None)
- id.setDefault(u'blah')
- self.assertEqual(id.default, u'blah')
+ self.failUnless(isinstance(id, MessageID))
+ self.failUnless(isinstance(id, unicode))
+ eq(id.domain, 'test')
+ eq(id.default, None)
+ id.default = u'blah'
+ eq(id.default, u'blah')
def test_suite():