Skip to content

Commit

Permalink
tolerate an additional __init__ argument
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed May 4, 2013
1 parent 73f89ae commit 8f09633
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Record/__init__.py
Expand Up @@ -19,7 +19,7 @@ class Record(object):
__record_schema__ = None
__slots__ = ('_data', '_schema')

def __init__(self, data=None):
def __init__(self, data=None, parent=None):
cls_schema = type(self).__record_schema__
if cls_schema is None:
cls_schema = {}
Expand Down
5 changes: 5 additions & 0 deletions src/Record/tests.py
Expand Up @@ -40,6 +40,11 @@ def test_init(self):
r = R((1, 2, 3, 4))
self.assertEqual(tuple(r), (1, 2, 3))

def test_init_two(self):
parent = object()
r = R((1, 2, None), parent)
self.assertEqual(tuple(r), (1, 2, None))

def test_pickling(self):
# We can create records from sequences
r = R(('x', 42, 1.23))
Expand Down

0 comments on commit 8f09633

Please sign in to comment.