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
Fixed #25629: Added checks of the number of arguments for GeoDjango DB functions. #5499
Fixed #25629: Added checks of the number of arguments for GeoDjango DB functions. #5499
Conversation
This is actually a pretty smart idea. Should we push this all the way back to |
That was also something I wondered. Sergey, motivated to try it? |
@claudep What exactly do you suggests? |
@@ -18,8 +18,12 @@ class GeoFunc(Func): | |||
function = None | |||
output_field_class = None | |||
geom_param_pos = 0 | |||
arity = None |
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.
Move this to expressions.Func
I've added inline comments. But I'd like to see the arity property and check code inside Will also need docs calling out the new property and behaviour. A separate ticket/PR can be opened to use the arity check in functions that expect a certain number of args. |
a91cf51
to
84d9850
Compare
I would keep the first commit very focused on the arity addition, that is keep the expressions.py and docs changes, add arity on Lower/Upper functions + a test in |
OK, I'll do it. |
84d9850
to
164bb36
Compare
@@ -389,6 +389,9 @@ def test_lower(self): | |||
lambda a: (a.lower_name, a.name) | |||
) | |||
|
|||
with self.assertRaises(TypeError): |
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.
Could you use an assertRaisesMessage to assert the exception message is appropriate?
818012e
to
f682beb
Compare
I've pushed the first commit (0a26121). Could you rebase the PR and add the |
f682beb
to
d812988
Compare
Pushed in a449b7e, thanks! |
No description provided.