Skip to content

Commit

Permalink
implement/test len
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed May 4, 2013
1 parent 51402b8 commit ae7d9c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Record/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@ def __add__(self, other):

def __mul__(self, other):
raise TypeError('Record objects do not support repetition')

def __len__(self):
return len(self._schema)
4 changes: 4 additions & 0 deletions src/Record/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,7 @@ def test_add(self):
def test_mul(self):
r = R((1, 2, None))
self.assertRaises(TypeError, r.__mul__, 3)

def test_len(self):
r = R((1, 2, None))
self.assertEqual(len(r), 3)

0 comments on commit ae7d9c8

Please sign in to comment.