]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Oops, convert @decorator to 2.3 syntax and strengthen raw_append test.
authorJason Kirtland <jek@discorporate.us>
Thu, 19 Jun 2008 17:40:13 +0000 (17:40 +0000)
committerJason Kirtland <jek@discorporate.us>
Thu, 19 Jun 2008 17:40:13 +0000 (17:40 +0000)
lib/sqlalchemy/ext/orderinglist.py
test/ext/orderinglist.py

index 68d10e71595cab086a5d6f05b604a6f3352f1070..b53a57cbedcaca289ffeb935fb0a7e60079ee149 100644 (file)
@@ -233,11 +233,11 @@ class OrderingList(list):
         super(OrderingList, self).append(entity)
         self._order_entity(len(self) - 1, entity, self.reorder_on_append)
 
-    @collection.adds(1)
     def _raw_append(self, entity):
         """Append without any ordering behavior."""
 
         super(OrderingList, self).append(entity)
+    _raw_append = collection.adds(1)(_raw_append)
 
     def insert(self, index, entity):
         self[index:index] = [entity]
index 460599ae59590c9f85225ae9683c52a7f11b6661..4ff03408f44a53c728c6c303d87f066b3dd6750a 100644 (file)
@@ -2,6 +2,7 @@ import testenv; testenv.configure_for_tests()
 from sqlalchemy import *
 from sqlalchemy.orm import *
 from sqlalchemy.ext.orderinglist import *
+from testlib.testing import eq_
 from testlib import *
 
 
@@ -194,7 +195,6 @@ class OrderingListTest(TestBase):
 
         s1.bullets._reorder()
         self.assert_(s1.bullets[4].position == 5)
-
         session = create_session()
         session.save(s1)
         session.flush()
@@ -210,8 +210,17 @@ class OrderingListTest(TestBase):
 
         titles = ['s1/b1','s1/b2','s1/b100','s1/b4', 'raw']
         found = [b.text for b in srt.bullets]
+        eq_(titles, found)
 
-        self.assert_(titles == found)
+        srt.bullets._raw_append(Bullet('raw2'))
+        srt.bullets[-1].position = 6
+        session.flush()
+        session.clear()
+
+        srt = session.query(Slide).get(id)
+        titles = ['s1/b1','s1/b2','s1/b100','s1/b4', 'raw', 'raw2']
+        found = [b.text for b in srt.bullets]
+        eq_(titles, found)
 
     def test_insert(self):
         self._setup(ordering_list('position'))