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

gunittest: update module interface doctest #1699

Merged
merged 1 commit into from
Jul 4, 2021

Conversation

nilason
Copy link
Contributor

@nilason nilason commented Jul 1, 2021

Adapts documentation to the addition of 'weighting_function' parameter to 'r.neighbors' introduced with 20f370c (#597).

Unit tests fails with errors like:

FAIL: Module (grass.pygrass.modules.interface.module)
Doctest: grass.pygrass.modules.interface.module.Module
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py", line 2204, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for grass.pygrass.modules.interface.module.Module
  File "/Volumes/dev/grass/dist.x86_64-apple-darwin19.6.0/etc/python/grass/pygrass/modules/interface/module.py", line 323, in Module

----------------------------------------------------------------------
File "/Volumes/dev/grass/dist.x86_64-apple-darwin19.6.0/etc/python/grass/pygrass/modules/interface/module.py", line 350, in grass.pygrass.modules.interface.module.Module
Failed example:
    neighbors.get_bash()
Expected:
    'r.neighbors input=mapA method=average size=5 quantile=0.5 output=mapB'
Got:
    'r.neighbors input=mapA size=5 method=average weighting_function=none quantile=0.5 output=mapB'

adapts documentation to the addition of 'weighting_function'
parameter to 'r.neighbors' introduced with
OSGeo@20f370c
@ninsbl
Copy link
Member

ninsbl commented Jul 1, 2021

Thanks @nilason for catching this. What is surprising is that weighting_function is not a required option:

parm.weighting_function->required = NO;

There seems to be a simmilar issue here:
#1158 (comment)
where @wenzeslaus suggests that the issue is probably with the pygrass module interface and not the test...

@nilason
Copy link
Contributor Author

nilason commented Jul 2, 2021

Thanks @nilason for catching this. What is surprising is that weighting_function is not a required option:

parm.weighting_function->required = NO;

There seems to be a simmilar issue here:
#1158 (comment)
where @wenzeslaus suggests that the issue is probably with the pygrass module interface and not the test...

I don't know the code behind the tests well enough yet, but I note method:

parm.method->required = NO;

is neither required, yet present.

@nilason
Copy link
Contributor Author

nilason commented Jul 2, 2021

However both method and weighting_function have default value (->answer = ...).

@ninsbl
Copy link
Member

ninsbl commented Jul 2, 2021

However both method and weighting_function have default value (->answer = ...).

Right. I overlooked that the tests checks the constructed bash command... Makes sense.

@wenzeslaus
Copy link
Member

Handling of "not required" with default value is strange, but that's all I can say about it.

@nilason
Copy link
Contributor Author

nilason commented Jul 3, 2021

Handling of "not required" with default value is strange, but that's all I can say about it.

At first glance, yes, but remember "required" is meant for parameter(s) required for the user's command. I'd say a required parameter with a default would be strange.

@nilason nilason merged commit ff0f931 into OSGeo:master Jul 4, 2021
@nilason nilason deleted the fix-doctest branch July 4, 2021 07:14
@neteler neteler added this to the 8.0.0 milestone Dec 9, 2021
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
adapts documentation to the addition of 'weighting_function'
parameter to 'r.neighbors' introduced with
OSGeo@20f370c
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
adapts documentation to the addition of 'weighting_function'
parameter to 'r.neighbors' introduced with
OSGeo@20f370c
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