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

relax some doctests to better match non-requirement of ordering of Dict and Set #57693

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions base/abstractdict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ But `keys(a)`, `values(a)` and `pairs(a)` all iterate `a`
and return the elements in the same order.

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> a = Dict(zip(["a", "b", "c"], [1, 2, 3]))
Dict{String, Int64} with 3 entries:
"c" => 3
Expand Down Expand Up @@ -207,7 +207,7 @@ Update collection with pairs from the other collections.
See also [`merge`](@ref).

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> d1 = Dict(1 => 2, 3 => 4);

julia> d2 = Dict(1 => 4, 4 => 5);
Expand Down Expand Up @@ -251,7 +251,7 @@ compatibility.
`mergewith!` requires Julia 1.5 or later.

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> d1 = Dict(1 => 2, 3 => 4);

julia> d2 = Dict(1 => 4, 4 => 5);
Expand Down Expand Up @@ -425,7 +425,7 @@ Update `d`, removing elements for which `f` is `false`.
The function `f` is passed `key=>value` pairs.

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> d = Dict(1=>"a", 2=>"b", 3=>"c")
Dict{Int64, String} with 3 entries:
2 => "b"
Expand Down
4 changes: 2 additions & 2 deletions base/abstractset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This is an infix operator, allowing `s ∪ itr`.
See also [`unique`](@ref), [`intersect`](@ref), [`isdisjoint`](@ref), [`vcat`](@ref), [`Iterators.flatten`](@ref).

# Examples
```jldoctest
```jldoctest; filter = r"(?m)^\\s+\\S"
julia> union([1, 2], [3])
3-element Vector{Int64}:
1
Expand Down Expand Up @@ -68,7 +68,7 @@ Maintain order with arrays.
$(_DOCS_ALIASING_WARNING)

# Examples
```jldoctest
```jldoctest; filter = r"(?m)^\\s+\\S"
julia> a = Set([3, 4, 5]);

julia> union!(a, 1:2:7);
Expand Down
4 changes: 2 additions & 2 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ Retrieve the value(s) stored at the given key or index within a collection. The
See also [`get`](@ref), [`keys`](@ref), [`eachindex`](@ref).

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> A = Dict("a" => 1, "b" => 2)
Dict{String, Int64} with 2 entries:
"b" => 2
Expand Down Expand Up @@ -967,7 +967,7 @@ Store the given value at the given key or index within a collection. The syntax
x` is converted by the compiler to `(setindex!(a, x, i, j, ...); x)`.

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> a = Dict("a"=>1)
Dict{String, Int64} with 1 entry:
"a" => 1
Expand Down
10 changes: 5 additions & 5 deletions base/dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Given a single iterable argument, constructs a [`Dict`](@ref) whose key-value pa
are taken from 2-tuples `(key,value)` generated by the argument.

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> Dict([("A", 1), ("B", 2)])
Dict{String, Int64} with 2 entries:
"B" => 2
Expand All @@ -47,7 +47,7 @@ Dict{String, Int64} with 2 entries:

Alternatively, a sequence of pair arguments may be passed.

```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> Dict("A"=>1, "B"=>2)
Dict{String, Int64} with 2 entries:
"B" => 2
Expand Down Expand Up @@ -205,7 +205,7 @@ end
Remove all elements from a `collection`.

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> A = Dict("a" => 1, "b" => 2)
Dict{String, Int64} with 2 entries:
"b" => 2
Expand Down Expand Up @@ -389,7 +389,7 @@ Return the value stored for the given key, or if no mapping for the key is prese
`key => default`, and return `default`.

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> d = Dict("a"=>1, "b"=>2, "c"=>3);

julia> get!(d, "a", 5)
Expand Down Expand Up @@ -654,7 +654,7 @@ end
Delete the mapping for the given key in a collection, if any, and return the collection.

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> d = Dict("a"=>1, "b"=>2)
Dict{String, Int64} with 2 entries:
"b" => 2
Expand Down
2 changes: 1 addition & 1 deletion base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ This function simply returns its argument by default, since the elements
of a general iterator are normally considered its "values".

# Examples
```jldoctest
```jldoctest; filter = r"(?m)^\\s+\\S"
julia> d = Dict("a"=>1, "b"=>2);

julia> values(d)
Expand Down
4 changes: 2 additions & 2 deletions base/float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ See also [`trunc`](@ref).
julia> unsafe_trunc(Int, -2.2)
-2

julia> unsafe_trunc(Int, NaN)
-9223372036854775808
julia> unsafe_trunc(Int, NaN) isa Int
true
```
"""
function unsafe_trunc end
Expand Down
2 changes: 1 addition & 1 deletion base/hashing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Typically, any type that implements `hash` should also implement its own [`==`](

The hash value may change when a new Julia process is started.

```jldoctest
```jldoctest; filter = r"0x[0-9a-f]{16}"
julia> a = hash(10)
0x95ea2955abd45275

Expand Down
2 changes: 1 addition & 1 deletion base/regex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ See [`keys`](@ref keys(::RegexMatch)) for more information.
Constructing NamedTuples and Dicts from RegexMatches requires Julia 1.11

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> m = match(r"(?<hour>\\d+):(?<minute>\\d+)(am|pm)?", "11:30 in the morning")
RegexMatch("11:30", hour="11", minute="30", 3=nothing)

Expand Down
6 changes: 3 additions & 3 deletions base/set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ See also: [`in`](@ref), [`push!`](@ref), [`Set`](@ref)
This function requires at least 1.11.

# Examples
```jldoctest; filter = r"^ [1234]\$"
```jldoctest; filter = r"(?m)^\\s+\\S"
julia> s = Set{Any}([1, 2, 3]); in!(4, s)
false

Expand Down Expand Up @@ -753,7 +753,7 @@ If `count` is specified, then replace at most `count` values in total
(replacements being defined as `new(x) !== x`).

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> replace!(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
4-element Vector{Int64}:
2
Expand Down Expand Up @@ -849,7 +849,7 @@ If `count` is specified, then replace at most `count` values in total
Version 1.7 is required to replace elements of a `Tuple`.

# Examples
```jldoctest
```jldoctest; filter = r"^\\s*\\S+\\s*=>.*"m
julia> replace(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
4-element Vector{Int64}:
2
Expand Down
2 changes: 1 addition & 1 deletion stdlib/TOML/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ julia> err.column
The [`TOML.print`](@ref) function is used to print (or serialize) data into TOML
format.

```jldoctest
```jldoctest; filter = r"^\s*\S+\s*=.*"m
julia> using TOML

julia> data = Dict(
Expand Down