From: Jason Kirtland Date: Thu, 19 Jun 2008 17:40:13 +0000 (+0000) Subject: - Oops, convert @decorator to 2.3 syntax and strengthen raw_append test. X-Git-Tag: rel_0_5beta2~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c49a7dd9109f2fa9635ff461b15d241a3119cca3;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Oops, convert @decorator to 2.3 syntax and strengthen raw_append test. --- 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'))