Skip to content

hypothesis.stateful.consumes(bundle).flatmap gives TypeError: BundleConsumer.__init__() got an unexpected keyword argument 'consume' #4427

@lycantropos

Description

@lycantropos

A script for reproduction

from hypothesis import strategies as st
from hypothesis.stateful import (
    Bundle,
    RuleBasedStateMachine,
    consumes,
    initialize,
    rule,
)


class Reproduction(RuleBasedStateMachine):
    my_bundle = Bundle('my_bundle')

    @initialize(target=my_bundle)
    def set_initial(self, /) -> str:
        return 'sample text'

    @rule(
        character=consumes(my_bundle).flatmap(
            lambda value: st.sampled_from(value)
        )
    )
    def check(self, /, *, character: str):
        assert isinstance(character, str)
        assert len(character) == 1


TestCase = Reproduction.TestCase

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething is clearly wrong here

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions