Add initial tests
This commit is contained in:
24
test/test_load.py
Normal file
24
test/test_load.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import pytest
|
||||
import capnp
|
||||
from capnp 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_load():
|
||||
capnp.load(os.path.join(this_dir, 'addressbook.capnp'))
|
||||
|
||||
def test_constants(addressbook):
|
||||
assert addressbook.qux == 123
|
||||
|
||||
def test_classes(addressbook):
|
||||
assert addressbook.AddressBook
|
||||
assert addressbook.Person
|
||||
|
||||
def test_schemas(addressbook):
|
||||
assert type(addressbook.AddressBook.schema) is _capnp._StructSchema
|
||||
assert type(addressbook.Person.schema) is _capnp._StructSchema
|
||||
Reference in New Issue
Block a user