def addprotocol(self, protocol, **options): """ Enable a new protocol on the controller. :param protocol: A registered protocol name or an instance of a protocol. """ if isinstance(protocol, str): protocol = getprotocol(protocol, **options) self.protocols.append(protocol) protocol.root = weakref.proxy(self)
def test_getprotocol(): try: getprotocol("invalid") assert False, "ValueError was not raised" except ValueError: pass
def test_getprotocol(): try: getprotocol('invalid') assert False, "ValueError was not raised" except ValueError: pass