def test_in_port_capnp_optional(self): """Generate optional in port.""" in_port = InPort("index", Optional(int), None, 0) capnp_in_port = dotdf_capnp.InPort.new_message() in_port.capnp(capnp_in_port) self.assertEqual(capnp_in_port.name, "index") self.assertEqual(dill.loads(capnp_in_port.type), Int()) self.assertEqual(capnp_in_port.optional, True)
def test_in_port_capnp(self): """Generate in port.""" in_port = InPort("index", as_delta_type(int), None, 0) capnp_in_port = dotdf_capnp.InPort.new_message() in_port.capnp(capnp_in_port) self.assertEqual(capnp_in_port.name, "index") self.assertEqual(dill.loads(capnp_in_port.type), as_delta_type(int)) self.assertEqual(capnp_in_port.optional, False)