update InterfaceOptions to fix failing test

This commit is contained in:
Alec Rosenbaum 2021-01-15 13:02:08 -05:00
parent ae93499a37
commit 86b7e6ac86

View File

@ -5,11 +5,12 @@ from .utils import yank_fields_from_attrs
# For static type checking with Mypy
MYPY = False
if MYPY:
from typing import Dict # NOQA
from typing import Dict, Iterable, Type # NOQA
class InterfaceOptions(BaseOptions):
fields = None # type: Dict[str, Field]
interfaces = () # type: Iterable[Type[Interface]]
class Interface(BaseType):
@ -45,7 +46,7 @@ class Interface(BaseType):
"""
@classmethod
def __init_subclass_with_meta__(cls, _meta=None, **options):
def __init_subclass_with_meta__(cls, _meta=None, interfaces=(), **options):
if not _meta:
_meta = InterfaceOptions(cls)
@ -58,6 +59,9 @@ class Interface(BaseType):
else:
_meta.fields = fields
if not _meta.interfaces:
_meta.interfaces = interfaces
super(Interface, cls).__init_subclass_with_meta__(_meta=_meta, **options)
@classmethod