Commit f98e6918 authored by Jim Fulton's avatar Jim Fulton

Sets don't have items.

parent ec0cd250
......@@ -205,8 +205,6 @@ static struct PyMethodDef Set_methods[] = {
"__setstate__() -- Set the state of the object"},
{"keys", (PyCFunction) bucket_keys, METH_VARARGS,
"keys() -- Return the keys"},
{"items", (PyCFunction) bucket_keys, METH_VARARGS,
"items() -- Return the items"},
{"has_key", (PyCFunction) bucket_has_key, METH_VARARGS,
"has_key(key) -- Test whether the bucket contains the given key"},
{"clear", (PyCFunction) bucket_clear, METH_VARARGS,
......
......@@ -114,8 +114,6 @@ static struct PyMethodDef TreeSet_methods[] = {
"has_key(key) -- Test whether the bucket contains the given key"},
{"keys", (PyCFunction) BTree_keys, METH_VARARGS,
"keys() -- Return the keys"},
{"items", (PyCFunction) BTree_keys, METH_VARARGS,
"items() -- Return the items"},
{"maxKey", (PyCFunction) BTree_maxKey, METH_VARARGS,
"maxKey([key]) -- Fine the maximum key\n\n"
"If an argument is given, find the maximum <= the argument"},
......
......@@ -135,7 +135,10 @@ class Base:
try:
root = self._getRoot()
#XXX BTree stuff doesn't implement comparison
assert list(root['t'].items()) == list(t.items())
if hasattr(t, 'items'):
assert list(root['t'].items()) == list(t.items())
else:
assert list(root['t'].keys()) == list(t.keys())
finally:
self._closeDB(root)
self._delDB()
......@@ -157,7 +160,10 @@ class Base:
root = self._getRoot()
root['t']._p_changed = None
get_transaction().commit()
assert list(root['t'].items()) == list(t.items())
if hasattr(t,'items'):
assert list(root['t'].items()) == list(t.items())
else:
assert list(root['t'].keys()) == list(t.keys())
finally:
self._closeDB(root)
self._delDB()
......@@ -303,13 +309,6 @@ class NormalSetTests(Base):
t = self.t
assert not t.has_key(1)
def testItems(self):
t = self.t
t.insert(1)
t.insert(3)
t.insert(5)
assert lsubtract(t.items(), [1,3,5]) == [], t.items()
def testKeys(self):
t = self.t
r = xrange(1000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment