ids = []
for i in range(10):
ids.append(str(i))
- self.s.add(ids[-1], directory=False)
+ self.s.add(ids[-1], directory=(i % 2 == 0))
s = sorted(self.s.children())
self.failUnless(s == ids, '\n %s\n !=\n %s' % (s, ids))
ids = []
for i in range(10):
ids.append(str(i))
- self.s.add(ids[-1], 'parent', directory=True)
+ self.s.add(ids[-1], 'parent', directory=(i % 2 == 0))
s = sorted(self.s.children('parent'))
self.failUnless(s == ids, '\n %s\n !=\n %s' % (s, ids))
s = self.s.children()
ids = []
for i in range(10):
ids.append('parent/%s' % str(i))
- self.s.add(ids[-1], 'parent', directory=True)
+ self.s.add(ids[-1], 'parent', directory=(i % 2 == 0))
s = sorted(self.s.children('parent'))
self.failUnless(s == ids, '\n %s\n !=\n %s' % (s, ids))
ids = []
for i in range(10):
ids.append(str(i))
- self.s.add(ids[-1], directory=True)
+ self.s.add(ids[-1], directory=(i % 2 == 0))
for i in range(10):
self.s.remove(ids.pop())
s = sorted(self.s.children())
ids = []
for i in range(10):
ids.append(str(i))
- self.s.add(ids[-1], 'parent', directory=False)
+ self.s.add(ids[-1], 'parent', directory=False)#(i % 2 == 0))
for i in range(10):
self.s.remove(ids.pop())
s = sorted(self.s.children('parent'))
self.failUnless(s == ids, '\n %s\n !=\n %s' % (s, ids))
- s = self.s.children()
- self.failUnless(s == ['parent'], s)
+ if len(s) > 0:
+ s = self.s.children()
+ self.failUnless(s == ['parent'], s)
def test_remove_directory_not_empty(self):
"""
ids = []
for i in range(10):
ids.append(str(i))
- self.s.add(ids[-1], 'parent', directory=True)
+ self.s.add(ids[-1], 'parent', directory=(i % 2 == 0))
self.s.remove(ids.pop()) # empty directory removal succeeds
try:
self.s.remove('parent') # empty directory removal succeeds
ids.append(str(i))
self.s.add(ids[-1], 'parent', directory=True)
for j in range(10): # add some grandkids
- self.s.add(str(20*(i+1)+j), ids[-1], directory=False)
+ self.s.add(str(20*(i+1)+j), ids[-1], directory=(i%2 == 0))
self.s.recursive_remove('parent')
s = sorted(self.s.children())
self.failUnless(s == [], s)
ids = []
for i in range(10):
ids.append(str(i))
- self.s.add(ids[-1], 'parent', directory=False)
+ self.s.add(ids[-1], 'parent', directory=(i % 2 == 0))
self.s.disconnect()
self.s.connect()
s = sorted(self.s.children('parent'))
children = []
for i in range(10):
new_child = str(i)
- self.s.add(new_child, 'parent', directory=False)
+ self.s.add(new_child, 'parent', directory=(i % 2 == 0))
self.s.set(new_child, self.val)
revs.append(self.s.commit('%s: %d' % (self.commit_msg, i),
self.commit_body))
c for c in (
ob for ob in globals().values() if isinstance(ob, type))
if issubclass(c, StorageTestCase) \
- and not issubclass(c, VersionedStorageTestCase)]
+ and c.Class == Storage]
for base_class in storage_testcase_classes:
testcase_class_name = storage_class.__name__ + base_class.__name__
storage_testcase_classes = [
c for c in (
ob for ob in globals().values() if isinstance(ob, type))
- if issubclass(c, StorageTestCase)]
+ if issubclass(c, StorageTestCase) \
+ and c.Class == Storage]
for base_class in storage_testcase_classes:
testcase_class_name = storage_class.__name__ + base_class.__name__