Commit 018047e5 authored by Jim Fulton's avatar Jim Fulton

Sets don't have items.

parent 4ac250c3
...@@ -205,8 +205,6 @@ static struct PyMethodDef Set_methods[] = { ...@@ -205,8 +205,6 @@ static struct PyMethodDef Set_methods[] = {
"__setstate__() -- Set the state of the object"}, "__setstate__() -- Set the state of the object"},
{"keys", (PyCFunction) bucket_keys, METH_VARARGS, {"keys", (PyCFunction) bucket_keys, METH_VARARGS,
"keys() -- Return the keys"}, "keys() -- Return the keys"},
{"items", (PyCFunction) bucket_keys, METH_VARARGS,
"items() -- Return the items"},
{"has_key", (PyCFunction) bucket_has_key, METH_VARARGS, {"has_key", (PyCFunction) bucket_has_key, METH_VARARGS,
"has_key(key) -- Test whether the bucket contains the given key"}, "has_key(key) -- Test whether the bucket contains the given key"},
{"clear", (PyCFunction) bucket_clear, METH_VARARGS, {"clear", (PyCFunction) bucket_clear, METH_VARARGS,
......
...@@ -114,8 +114,6 @@ static struct PyMethodDef TreeSet_methods[] = { ...@@ -114,8 +114,6 @@ static struct PyMethodDef TreeSet_methods[] = {
"has_key(key) -- Test whether the bucket contains the given key"}, "has_key(key) -- Test whether the bucket contains the given key"},
{"keys", (PyCFunction) BTree_keys, METH_VARARGS, {"keys", (PyCFunction) BTree_keys, METH_VARARGS,
"keys() -- Return the keys"}, "keys() -- Return the keys"},
{"items", (PyCFunction) BTree_keys, METH_VARARGS,
"items() -- Return the items"},
{"maxKey", (PyCFunction) BTree_maxKey, METH_VARARGS, {"maxKey", (PyCFunction) BTree_maxKey, METH_VARARGS,
"maxKey([key]) -- Fine the maximum key\n\n" "maxKey([key]) -- Fine the maximum key\n\n"
"If an argument is given, find the maximum <= the argument"}, "If an argument is given, find the maximum <= the argument"},
......
...@@ -135,7 +135,10 @@ class Base: ...@@ -135,7 +135,10 @@ class Base:
try: try:
root = self._getRoot() root = self._getRoot()
#XXX BTree stuff doesn't implement comparison #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: finally:
self._closeDB(root) self._closeDB(root)
self._delDB() self._delDB()
...@@ -157,7 +160,10 @@ class Base: ...@@ -157,7 +160,10 @@ class Base:
root = self._getRoot() root = self._getRoot()
root['t']._p_changed = None root['t']._p_changed = None
get_transaction().commit() 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: finally:
self._closeDB(root) self._closeDB(root)
self._delDB() self._delDB()
...@@ -303,13 +309,6 @@ class NormalSetTests(Base): ...@@ -303,13 +309,6 @@ class NormalSetTests(Base):
t = self.t t = self.t
assert not t.has_key(1) 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): def testKeys(self):
t = self.t t = self.t
r = xrange(1000) 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