diff babel/messages/tests/catalog.py @ 360:36408f068138

Message.clone doesn't return a shallow copy any longer. This fixes a bug with update where flags where shared.
author aronacher
date Tue, 17 Jun 2008 21:55:14 +0000
parents 90849c44c531
children 1b78b747b386
line wrap: on
line diff
--- a/babel/messages/tests/catalog.py
+++ b/babel/messages/tests/catalog.py
@@ -34,6 +34,7 @@
         assert catalog.PYTHON_FORMAT.search('foo %(name).*f')
         assert catalog.PYTHON_FORMAT.search('foo %(name)3.*f')
         assert catalog.PYTHON_FORMAT.search('foo %(name)*.*f')
+        assert catalog.PYTHON_FORMAT.search('foo %()s')
 
     def test_translator_comments(self):
         mess = catalog.Message('foo', user_comments=['Comment About `foo`'])
@@ -44,6 +45,12 @@
         self.assertEqual(mess.auto_comments, ['Comment 1 About `foo`',
                                          'Comment 2 About `foo`'])
 
+    def test_clone_message_object(self):
+        msg = catalog.Message('foo', locations=[('foo.py', 42)])
+        clone = msg.clone()
+        clone.locations.append(('bar.py', 42))
+        self.assertEqual(msg.locations, [('foo.py', 42)])
+
 
 class CatalogTestCase(unittest.TestCase):
 
Copyright (C) 2012-2017 Edgewall Software