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

Cartesian products #25

Closed
wants to merge 8 commits into from
Closed

Cartesian products #25

wants to merge 8 commits into from

Conversation

cpennington
Copy link
Contributor

This allows you to nest @data and @file_data decorators to produce Cartesian products.

@cpennington
Copy link
Contributor Author

@nedbat @doctoryes: Review?

@landscape-bot
Copy link

Code Health
Repository health decreased by 2% when pulling ec51667 on edx:cartesian-products into 6175369 on txels:master.

@data(1, 2, 3)
@data(4, 5, 6)
def test_products(self, first_value, second_value):
self.assertTrue(first_value < second_value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about testing for the number of products expected? It'd be nice if these three tests also told someone perusing the code what to expect as far as what products result from the nesting.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this wouldn't be needed if there was some documentation elsewhere about what to expect when nesting @DaTa and @file_data decorators.

@txels
Copy link
Collaborator

txels commented Apr 12, 2015

Hey thanks for this contribution, and sorry for the late reply.

I will need to review this in more detail for feedback on code specifics. I'd appreciate an addition to the documentation describing how this feature is supposed to work. Also a green build would be nice (apparently only a question of pep8 compliance) ;)

@@ -63,7 +63,7 @@ def hello():

pre_size = len(hello.__dict__)
keys = set(hello.__dict__.keys())
data_hello = data(1, 2)(hello)
data_hello = data(1, 2)(data(3)(hello))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer adding a new test case for the new feature, rather than overloading an existing test case.

The main reason being, any new feature should strive to be backwards compatible... meaning all existing tests should pass unmodified. It is harder for me to figure out whether your contribution is backwards-compatible or not, if you modify existing tests.

@txels
Copy link
Collaborator

txels commented Apr 12, 2015

I like that you have brought more structure to the code. This had started out as a tiny library but upon growing with contributions it was starting to look messy. Much appreciated!

@cpennington
Copy link
Contributor Author

@txels: I've updated my PR based on your comments.

@landscape-bot
Copy link

Code Health
Repository health decreased by 2% when pulling 9b44abb on edx:cartesian-products into 6175369 on txels:master.

@@ -4,7 +4,7 @@ envlist = py27, py33, py34
[testenv]
deps =
nose
pep8
pep8>=1.5.7,<1.6 # Versions limited to work with flake8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was fixed in another PR, which unfortunately now makes yours conflict.

@txels
Copy link
Collaborator

txels commented May 14, 2015

Sorry for the delay. I may be able to spend some time on this tomorrow.

@txels
Copy link
Collaborator

txels commented May 14, 2015

Hey @cpennington I just received this other PR from @mycharis that tackles the same issue: #29

I will eventually have to choose one or the other, would you mind taking a look at how that one compares to yours? Maybe you guys could discuss the pros and cons of each approach and come up with the preferred solution.

@cpennington
Copy link
Contributor Author

Closing this in favor of #29, which seems to have built on the ideas that I started with, and taken them to a better place.

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

Successfully merging this pull request may close these issues.

4 participants