Skip to content

Conversation

raynae
Copy link
Contributor

@raynae raynae commented Nov 15, 2017

Is this what you had in mind for this issue?

@simonw
Copy link
Owner

simonw commented Nov 16, 2017

It is - but I think this will break on this line since it expects two format string parameters:

template.format(column, param_id)

Needs unit tests too, which live here:

@pytest.mark.parametrize('args,expected_where,expected_params', [

@raynae
Copy link
Contributor Author

raynae commented Nov 16, 2017

Thanks for the guidance. I added a unit test and made a slight change to utils.py.

I didn't realize this, but evidently string.format only complains if you supply less arguments than there are format placeholders, so the original commit worked, but was adding a superfluous named param.

I added a conditional that prevents the named param from being created and ensures the correct number of args are passed to sting.format. It has the side effect of hiding the SQL query in /templates/table.html when there are no other where clauses--not sure if that's the desired outcome here.

@simonw
Copy link
Owner

simonw commented Nov 17, 2017

Looks like your tests are failing because of a bug which I fixed in 9199945 - if you rebase to master the tests should pass.

@raynae
Copy link
Contributor Author

raynae commented Nov 17, 2017

Thanks for bearing with me. I was getting a message about my branch diverging when I tried to push after rebasing, so I merged master into isnull, seems like that did the trick. Let me know if I should make any corrections.

@simonw simonw merged commit ed2b3f2 into simonw:master Nov 17, 2017
@raynae raynae deleted the isnull branch November 17, 2017 15:12
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.

2 participants