test_misc.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:capnpy 作者: antocuni 项目源码 文件源码
def test_listbuilder_null_ptrs(self):
        schema = """
            @0xbf5147cbbecf40c1;
            struct Bar {
                x @0 :Int64;
                y @1 :Int64;
                name @2 :Text;
            }

            struct Foo {
                bars @0 :List(Bar);
            }
        """
        mod = self.compile(schema)
        a = mod.Bar(1, 2, None)
        b = mod.Bar(3, 4, None)
        foo = mod.Foo([a, b])
        a1 = foo.bars[0]
        assert a1.x == 1
        assert a1.y == 2
        assert a1.name is None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号