Files
pycapnp/test/test_schema.py
Adeeb Shihadeh 5befba15f3 Minimal pycapnp
2026-09-21 18:57:37 -07:00

22 lines
495 B
Python

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