Add ListSchema class

Return it whenever the appropriate Type is converted to a Schema
This commit is contained in:
Jason Paryani
2014-11-19 02:04:57 -08:00
parent 2565db3500
commit 0f0ced971d
4 changed files with 54 additions and 16 deletions

20
test/test_schema.py Normal file
View File

@@ -0,0 +1,20 @@
import pytest
import capnp
import os
this_dir = os.path.dirname(__file__)
@pytest.fixture
def addressbook():
return capnp.load(os.path.join(this_dir, 'addressbook.capnp'))
def test_basic_schema(addressbook):
assert addressbook.Person.schema.fieldnames[0] == 'id'
def test_list_schema(addressbook):
peopleField = addressbook.AddressBook.schema.fields['people']
personType = peopleField.schema.elementType
assert personType.node.id == addressbook.Person.schema.node.id