Skip to content

More examples would be helpful #61

@td-anne

Description

@td-anne

I am trying to use annotated types to encourage hypothesis to automatically generate objects, running into trouble, and realising that I'm really unsure what the intended way to use annotated-types is. Concretely, I have written:

FiniteFloat = Annotated[float, IsFinite]

Is this correct and idiomatic? How should multiple annotations be handled? Is the following acceptable?

PositiveFloat = Annotated[FiniteFloat, Gt(0)]

I don't think annotated types are allowed to be nested like this, or at least hypothesis seems to choke on them, so what is the idiomatic way to compose constraints?

There is also some code demonstrating how to create GroupedMetadata but no code indicating how it should be used, or what for.

I looked into the test suite, but (perhaps understandably) it doesn't really have any idiomatic simple examples I can draw from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions