test_ctor.py 文件源码

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

项目:capnpy 作者: antocuni 项目源码 文件源码
def test_nested_group(self):
        schema = """
        @0xbf5147cbbecf40c1;
        struct Shape {
            position :group {
                a :group {
                    x @0 :Int64;
                    y @1 :Int64;
                }
                b :group {
                    x @2 :Int64;
                    y @3 :Int64;
                }
            }
        }
        """
        mod = self.compile(schema)
        p = mod.Shape(position=((1, 2), (3, 4)))
        assert p.position.a.x == 1
        assert p.position.a.y == 2
        assert p.position.b.x == 3
        assert p.position.b.y == 4
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号