-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix bug that may prevent kwarg to be passed and add test #76
Conversation
The select_arguments wrapper was applied twice to the parent_picker and the combiner, resulting in any TypeError raised by either function accepting a kwarg resulted in the error being caught by the outer select_arguments wrapper and the kwarg not being passed anymore -- since the inner select_arguments wrapper does not have any specific kwargs.
I wonder, will this mix well with the idea that the parent picker might return an iterable? |
I don't see why not |
tests/test_population.py
Outdated
@@ -122,6 +122,18 @@ def test_breed_works_with_kwargs(self, simple_chromosomes, simple_evaluation_fun | |||
assert len(pop2) == 400 | |||
assert pop2.intended_size == 400 | |||
|
|||
def test_breed_raises_with_multiple_values_for_kwarg(self, simple_population): | |||
|
|||
def dummy_combiner(x, y): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use a lambda
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would work just a well. In this case I find any tracebacks easier to read but I guess that isn't really a problem here.
The select_arguments wrapper was applied twice to the parent_picker
and the combiner, resulting in any TypeError raised by either function
accepting a kwarg resulted in the error being caught by the outer
select_arguments wrapper and the kwarg not being passed anymore -- since
the inner select_arguments wrapper does not have any specific kwargs.