コード例 #1
0
 def test_parse_schema(self, tmpdir):
     schema = """
     @0xbf5147cbbecf40c1;
     struct Point {
         x @0 :Int64;
         y @1 :Int64;
     }
     """
     filename = tmpdir.join('foo.capnp')
     filename.write(schema)
     comp = DynamicCompiler([])
     req = comp.parse_schema(filename=filename)
     assert req.requestedFiles[0].filename == str(filename)
コード例 #2
0
 def test_parse_schema(self, tmpdir):
     schema = """
     @0xbf5147cbbecf40c1;
     struct Point {
         x @0 :Int64;
         y @1 :Int64;
     }
     """
     filename = tmpdir.join('foo.capnp')
     filename.write(schema)
     comp = DynamicCompiler([])
     req = comp.parse_schema(filename=filename)
     # from capnproto 0.7.0, RequestedFile.filename no longer contains an
     # absolute path: https://github.com/capnproto/capnproto/issues/881
     #
     # For the purpose of this test, it is enough to check that the
     # basename is the same
     reqname = req.requestedFiles[0].filename.decode('utf-8')
     assert py.path.local(reqname).basename == filename.basename