Skip to content

Commit

Permalink
Call evaluate_pre() instead of evaluate() on Maybe decider
Browse files Browse the repository at this point in the history
e19142c introduced evaluate_pre to
perform context unrolling before to call the semi-public evaluate().

The Maybe decider was not updated at that time, but its context need to
be unrolled.
  • Loading branch information
francoisfreitag committed Apr 18, 2023
1 parent fc0e8a2 commit ef7dea3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion factory/declarations.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def evaluate_post(self, instance, step, overrides):
return target

def evaluate_pre(self, instance, step, overrides):
choice = self.decider.evaluate(instance=instance, step=step, extra={})
choice = self.decider.evaluate_pre(instance=instance, step=step, overrides={})
target = self.yes if choice else self.no

if isinstance(target, BaseDeclaration):
Expand Down
2 changes: 1 addition & 1 deletion factory/faker.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, provider, **kwargs):
**kwargs)

def evaluate(self, instance, step, extra):
locale = extra.pop('locale', None)
locale = extra.pop('locale')
subfaker = self._get_faker(locale)
return subfaker.format(self.provider, **extra)

Expand Down

0 comments on commit ef7dea3

Please sign in to comment.