diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-10-17 16:49:15 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-10-17 16:49:15 +0000 |
| commit | cb9321116fcdf350461410a5ecf8b892cfa210a5 (patch) | |
| tree | 6f489d75696e996d38c473e0154caa8156bf7f9f /test/testlib | |
| parent | 14c9d63672346adb59adfebb60660668771f20e4 (diff) | |
| download | sqlalchemy-cb9321116fcdf350461410a5ecf8b892cfa210a5.tar.gz | |
- removed __len__ from "dynamic" collection as it would require issuing
a SQL "count()" operation, thus forcing all list evaluations to issue
redundant SQL [ticket:818]
Diffstat (limited to 'test/testlib')
| -rw-r--r-- | test/testlib/fixtures.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/testlib/fixtures.py b/test/testlib/fixtures.py index ada254c37..6baf16bf0 100644 --- a/test/testlib/fixtures.py +++ b/test/testlib/fixtures.py @@ -42,10 +42,13 @@ class Base(object): except AttributeError: #print "Other class does not have attribute named '%s'" % attr return False - if len(value) != len(getattr(other, attr)): + if not hasattr(value, '__len__'): + value = list(iter(value)) + otherattr = list(iter(otherattr)) + if len(value) != len(otherattr): #print "Length of collection '%s' does not match that of other" % attr return False - for (us, them) in zip(value, getattr(other, attr)): + for (us, them) in zip(value, otherattr): if us != them: #print "1. Attribute named '%s' does not match other" % attr return False |
