Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe(Reused) is somehow wrongly cached #12

Open
hmax opened this issue Jul 20, 2015 · 1 comment
Open

Maybe(Reused) is somehow wrongly cached #12

hmax opened this issue Jul 20, 2015 · 1 comment
Assignees

Comments

@hmax
Copy link

hmax commented Jul 20, 2015

Following case breaks:

from builders.construct import Reused, Maybe, Random
from builders.modifiers import Given, Enabled
from builders.builder import Builder


class A:
    k = Random()


class B:
    a = Maybe(Reused(A), enabled=False)


def test_building():
    a = Builder(A).build()
    b = Builder(B).withA(Enabled(B.a)).withA(Given(B.a, a)).build()
    b = Builder(B).build()
    assert b.a is None

but if you add one more Builder(B).build() before asserting - everything goes ok

@pupssman
Copy link
Member

Looks like that is due to the state being preserved withing the Enabled thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants