def testAddingBadProtos_WrongLevel(self):
        """Adding a wrong level protocol raises an exception."""
        e = ip.IPProtocol()
        try:
            e.addProto(42, "silliness")
        except components.CannotAdapt:
            pass
        else:
            raise AssertionError('addProto must raise an exception for bad protocols')
Adding a wrong level protocol raises an exception.
stackoverflow/venv/lib/python3.6/site-packages/twisted/pair/test/test_ip.py