Skip to content

Commit

Permalink
New: No longer ignore None results during constraint evaluation (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-zeller committed Feb 9, 2025
1 parent bba3725 commit 340a6f9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/fandango/constraints/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ def fitness(
)
try:
result = self.eval(self.expression, self.global_variables, local_variables)
if result is None:
# This is there to accomodate "constraints" that simply call `print()` (or otherwise produce no value)
# We treat these as "perfect fitness" because they are not actually constraints
return ConstraintFitness(1, 1, True)
# Commented this out for now, as `None` is a valid result
# of functions such as `re.match()` -- AZ
# if result is None:
# return ConstraintFitness(1, 1, True)
if result:
solved += 1
else:
Expand Down

0 comments on commit 340a6f9

Please sign in to comment.