From c49a7dd9109f2fa9635ff461b15d241a3119cca3 Mon Sep 17 00:00:00 2001 From: Jason Kirtland Date: Thu, 19 Jun 2008 17:40:13 +0000 Subject: [PATCH] - Oops, convert @decorator to 2.3 syntax and strengthen raw_append test. --- lib/sqlalchemy/ext/orderinglist.py | 2 +- test/ext/orderinglist.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/sqlalchemy/ext/orderinglist.py b/lib/sqlalchemy/ext/orderinglist.py index 68d10e7159..b53a57cbed 100644 --- a/lib/sqlalchemy/ext/orderinglist.py +++ b/lib/sqlalchemy/ext/orderinglist.py @@ -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] diff --git a/test/ext/orderinglist.py b/test/ext/orderinglist.py index 460599ae59..4ff03408f4 100644 --- a/test/ext/orderinglist.py +++ b/test/ext/orderinglist.py @@ -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')) -- 2.47.3