Skip to content
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

Merged
merged 6 commits into from
Sep 26, 2018

Conversation

rogiervandergeer
Copy link
Collaborator

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.

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.
@koaning
Copy link
Contributor

koaning commented Mar 28, 2018

I wonder, will this mix well with the idea that the parent picker might return an iterable?

@rogiervandergeer
Copy link
Collaborator Author

I don't see why not

@@ -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):
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@koaning koaning merged commit f1fcb2b into master Sep 26, 2018
@koaning koaning deleted the optional-arguments branch September 26, 2018 14:48
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants