-
Notifications
You must be signed in to change notification settings - Fork 194
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
Convert code blocks documenting ImmersedBoundaryCondition
to doctests
#3705
Comments
Some doctests for Another solution is to eliminate the warnings themselves. |
If I understand correctly I remember having to do this in #2990, specifically this file. The header has to start with a regex expression like: ```jldoctest; filter = r"└ @ Oceananigans.BuoyancyModels.*" |
Hmm right... that filter stopped working. But now I am realizing there is something peculiar. The filter matches with the last line of the warning --- which acts to filter out the entire warning? Do you understand why that is? That might be the key. The confusing thing about the issue here is that there are multiple warnings. But if we only need to filter the last line of the final warning, perhaps that's what we werent' doing... |
I think it's still working. I found an instance of it still being used here: Oceananigans.jl/src/MultiRegion/multi_region_grid.jl Lines 85 to 97 in a18b81d
It matches the last line of the warning because that's the only line that changes from run to run. In particular the part Oceananigans.jl/src/BuoyancyModels/buoyancy.jl Lines 33 to 36 in d705303
The other lines of the warning are always the same, so they don't need filtering. |
I meant for the specific instance that this issue refers to.
My question is: why does matching the last line of the warning act to remove the whole warning? I am not asking about the intention of the filter. The intention is clear. |
Oof, ok I understand. I thought the filtering would allow us to remove the warnings from the docstring. But it doesn't. Instead we have to include the warning in the docstring (including a random path to someone's Oceananigans version, eg
That's not as nice as I was hoping. |
I think warnings in docstrings are not nice. Perhaps the right solution here is to remove the warning for |
Strikes me that we could also change the log level so that warnings are not emitted. |
Personally I don't see a problem with warnings in the docstrings if that's how the code behaves.
I'm not sure what the expected result of this is. But if this will create a situation where a given docstring won't have warnings, while users copy-pasting the contents from that same docstring may get a warning, then I think it'll be confusing and we should probably avoid that solution. If not, then that sounds like a great solution :) |
We wrote a more verbose version of the warning already in the docs. When 4 warnings print on top of each other, it makes the docs harder to read and therefore less effective. |
@glwagner, could you open an issue pointing to this PR and saying that some doctests were removed and we need to attend to them with proper filtering etc?
Originally posted by @navidcy in #3692 (review)
The text was updated successfully, but these errors were encountered: