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

Allow replacements in doctest filters #1271

Merged
merged 33 commits into from
Dec 30, 2022
Merged

Conversation

mortenpi
Copy link
Member

This allows regex - substitution pairs to be passed as doctest filters, giving more control over filtering.

For example, the following filter can be used to only retain the first 8 digits after the decimal point of a floating point number: r"([0-9]+\.[0-9]{8})[0-9]+" => s"\1***"

This means that this will pass (sqrt(2) == 1.4142135623730951):

```jldoctest; filter = r"([0-9]+\.[0-9]{8})[0-9]+" => s"\1***"
julia> sqrt(2)
1.41421356000
```

But this will not:

```jldoctest; filter = r"([0-9]+\.[0-9]{8})[0-9]+" => s"\1***"
julia> sqrt(2)
1.4142999999999
```

@mortenpi mortenpi added this to the 0.25.0 milestone Mar 24, 2020
@mortenpi mortenpi modified the milestones: 0.25.0, 0.26.0 Jun 8, 2020
@mortenpi mortenpi removed this from the 0.26.0 milestone Dec 8, 2020
@mortenpi mortenpi added this to the 0.27.0 milestone Apr 18, 2021
@mortenpi mortenpi modified the milestones: 0.27.0, 0.28.0 Jun 9, 2021
@mortenpi mortenpi removed this from the 0.28.0 milestone Jun 23, 2022
@mortenpi mortenpi added this to the 0.28.0 milestone Oct 30, 2022
@mortenpi mortenpi merged commit dd1e334 into master Dec 30, 2022
@mortenpi mortenpi deleted the mp/doctest-filter-replace branch December 30, 2022 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants