From ecc10846546f89671dfde12b3b46d0b6a840dc04 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Thu, 23 Mar 2023 14:55:32 +0000 Subject: WIP 5 --- .../federation/dmr_reproduce_mypy_zope_pain.py | 29 +++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/http/federation/dmr_reproduce_mypy_zope_pain.py b/tests/http/federation/dmr_reproduce_mypy_zope_pain.py index 9698f5e077..d4170019ef 100644 --- a/tests/http/federation/dmr_reproduce_mypy_zope_pain.py +++ b/tests/http/federation/dmr_reproduce_mypy_zope_pain.py @@ -1,11 +1,25 @@ +from typing import Optional + from twisted.internet.endpoints import _WrappingProtocol -from twisted.internet.interfaces import ( - IProtocolFactory, -) +from twisted.internet.interfaces import IProtocol +from zope.interface import Interface, implementer + + +class IAddress(Interface): + pass + + +@implementer(IAddress) +class DummyAddress: + pass + -from tests.http import ( - dummy_address, -) +dummy_address = DummyAddress() + + +class IProtocolFactory(Interface): + def buildProtocol(addr: IAddress) -> Optional[IProtocol]: + pass def _make_connection( client_factory: IProtocolFactory, @@ -17,6 +31,3 @@ def _make_connection( client_protocol = client_factory.buildProtocol(dummy_address) assert isinstance(client_protocol, _WrappingProtocol) print("Hello") - - - -- cgit 1.5.1