Skip to content

Commit

Permalink
- NestedCursorType
Browse files Browse the repository at this point in the history
- ensure the nested cursor type hashes along with 5001
  • Loading branch information
zzzeek committed Oct 8, 2012
1 parent b837740 commit 45d94f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 7 additions & 3 deletions akiban/api.py
@@ -1,9 +1,13 @@
import collections

class NestedCursor(object):
class NestedCursorType(object):
def __eq__(self, other):
return other == 5001 or isinstance(other, NestedCursor)
NESTED_CURSOR = NestedCursor()
return other == 5001 or isinstance(other, NestedCursorType)

def __hash__(self):
return hash(5001)

NESTED_CURSOR = NestedCursorType()


class NestedCursor(object):
Expand Down
6 changes: 6 additions & 0 deletions tests/test_cursor.py
@@ -1,4 +1,6 @@
import unittest
from akiban import api


NUMBER = object()
STRING = object()
Expand Down Expand Up @@ -26,6 +28,10 @@ def _fixture(self):
)
return cursor

def test_typecode_hashable(self):
s = set([5001, api.NESTED_CURSOR, api.NestedCursorType()])
self.assertEquals(len(s), 1)

def test_fetchone(self):
cursor = self._fixture()
self.assertEquals(
Expand Down

0 comments on commit 45d94f1

Please sign in to comment.