summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-08-02 13:01:32 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-08-02 13:01:32 -0400
commit31ec1fc85eda517c2bc70fd4c9bbd4d51a2546a6 (patch)
treeb970737cf2422895cdbf5abe32cec020058d6c3d
parent4d132c38af1d2e5376c09ffd2574050300e6c691 (diff)
downloadsqlalchemy-31ec1fc85eda517c2bc70fd4c9bbd4d51a2546a6.tar.gz
- add a clear() to SetIsh here so that the control/direct gets cleared
before we do the pop() test. - make clear()/pop() test unconditional
-rw-r--r--test/orm/test_collection.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/test/orm/test_collection.py b/test/orm/test_collection.py
index fab2aac96..3a98da90f 100644
--- a/test/orm/test_collection.py
+++ b/test/orm/test_collection.py
@@ -589,17 +589,19 @@ class CollectionsTest(fixtures.ORMTest):
except TypeError:
assert True
- if hasattr(direct, 'clear'):
- addall(creator(), creator())
- direct.clear()
- control.clear()
- assert_eq()
+ addall(creator(), creator())
+ direct.clear()
+ control.clear()
+ assert_eq()
- if hasattr(direct, 'pop'):
- addall(creator())
- direct.pop()
- control.pop()
- assert_eq()
+ # note: the clear test previously needs
+ # to have executed in order for this to
+ # pass in all cases; else there's the possibility
+ # of non-deterministic behavior.
+ addall(creator())
+ direct.pop()
+ control.pop()
+ assert_eq()
if hasattr(direct, 'difference_update'):
zap()
@@ -812,6 +814,8 @@ class CollectionsTest(fixtures.ORMTest):
self.data.remove(item)
def discard(self, item):
self.data.discard(item)
+ def clear(self):
+ self.data.clear()
def pop(self):
return self.data.pop()
def update(self, other):
@@ -844,6 +848,8 @@ class CollectionsTest(fixtures.ORMTest):
self.data.update(other)
def __iter__(self):
return iter(self.data)
+ def clear(self):
+ self.data.clear()
__hash__ = object.__hash__
def __eq__(self, other):
return self.data == other