Skip to content

HasMetadata doesn't work in some subclasses #49

@wRAR

Description

@wRAR

This fails:

def test_metadata_with_returns():
    class MyProduct(Product):
        pass

    class CustomProductPage(ProductPage, Returns[MyProduct]):
        pass

    url = ResponseUrl("https://example.com")
    html = b""
    page = CustomProductPage(response=HttpResponse(url=url, body=html))
    metadata = page.metadata
    @field
    def metadata(self) -> MetadataT:
>       value = self.metadata_cls()
E       TypeError: 'NoneType' object is not callable

zyte_common_items/pages.py:67: TypeError

zyte_common_items.pages._get_metadata_class in the case of this CustomProductPage cannot find any HasMetadata base and returns None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions