summaryrefslogtreecommitdiff
path: root/test/base/utils.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-12-14 05:53:18 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-12-14 05:53:18 +0000
commit0df750223a5f6ee4cfa987a4abd5ab4691007350 (patch)
tree89780e200d97f36a83d30c5da45122d211cb1075 /test/base/utils.py
parent273e48c9a95825541bd461a1d5402f2e65f95876 (diff)
downloadsqlalchemy-0df750223a5f6ee4cfa987a4abd5ab4691007350.tar.gz
- merged instances_yields branch r3908:3934, minus the "yield" part which remains slightly problematic
- cleanup of mapper._instance, query.instances(). mapper identifies objects which are part of the current load using a app-unique id on the query context. - attributes refactor; attributes now mostly use copy-on-modify instead of copy-on-load behavior, simplified get_history(), added a new set of tests - fixes to OrderedSet such that difference(), intersection() and others can accept an iterator - OrderedIdentitySet passes in OrderedSet to the IdentitySet superclass for usage in difference/intersection/etc. operations so that these methods actually work with ordering behavior. - query.order_by() takes into account aliased joins, i.e. query.join('orders', aliased=True).order_by(Order.id) - cleanup etc.
Diffstat (limited to 'test/base/utils.py')
-rw-r--r--test/base/utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/base/utils.py b/test/base/utils.py
index 932ad876a..6e1b58c4a 100644
--- a/test/base/utils.py
+++ b/test/base/utils.py
@@ -35,6 +35,18 @@ class OrderedDictTest(PersistTest):
self.assert_(o.keys() == ['a', 'b', 'c', 'd', 'e', 'f'])
self.assert_(o.values() == [1, 2, 3, 4, 5, 6])
+class OrderedSetTest(PersistTest):
+ def test_mutators_against_iter(self):
+ # testing a set modified against an iterator
+ o = util.OrderedSet([3,2, 4, 5])
+
+ self.assertEquals(o.difference(iter([3,4])), util.OrderedSet([2,5]))
+
+ self.assertEquals(o.intersection(iter([3,4, 6])), util.OrderedSet([3, 4]))
+
+ self.assertEquals(o.union(iter([3,4, 6])), util.OrderedSet([2, 3, 4, 5, 6]))
+
+
class ColumnCollectionTest(PersistTest):
def test_in(self):
cc = sql.ColumnCollection()