Skip to content

Commit 123a556

Browse files
authored
relax some doctests to better match non-requirement of ordering of Dict and Set (#57693)
discovered during failure of doctests in #57509 but is an independent change
1 parent 7fa969a commit 123a556

File tree

10 files changed

+24
-24
lines changed

10 files changed

+24
-24
lines changed

base/abstractdict.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ But `keys(a)`, `values(a)` and `pairs(a)` all iterate `a`
144144
and return the elements in the same order.
145145
146146
# Examples
147-
```jldoctest
147+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
148148
julia> a = Dict(zip(["a", "b", "c"], [1, 2, 3]))
149149
Dict{String, Int64} with 3 entries:
150150
"c" => 3
@@ -207,7 +207,7 @@ Update collection with pairs from the other collections.
207207
See also [`merge`](@ref).
208208
209209
# Examples
210-
```jldoctest
210+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
211211
julia> d1 = Dict(1 => 2, 3 => 4);
212212
213213
julia> d2 = Dict(1 => 4, 4 => 5);
@@ -251,7 +251,7 @@ compatibility.
251251
`mergewith!` requires Julia 1.5 or later.
252252
253253
# Examples
254-
```jldoctest
254+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
255255
julia> d1 = Dict(1 => 2, 3 => 4);
256256
257257
julia> d2 = Dict(1 => 4, 4 => 5);
@@ -425,7 +425,7 @@ Update `d`, removing elements for which `f` is `false`.
425425
The function `f` is passed `key=>value` pairs.
426426
427427
# Examples
428-
```jldoctest
428+
```jldoctest; filter = r"^\\s+\\d\\s+=>\\s+\\S+\$"m
429429
julia> d = Dict(1=>"a", 2=>"b", 3=>"c")
430430
Dict{Int64, String} with 3 entries:
431431
2 => "b"
@@ -467,7 +467,7 @@ Return a copy of `d`, removing elements for which `f` is `false`.
467467
The function `f` is passed `key=>value` pairs.
468468
469469
# Examples
470-
```jldoctest
470+
```jldoctest; filter = r"^\\s+\\d\\s+=>\\s+\\S+\$"m
471471
julia> d = Dict(1=>"a", 2=>"b")
472472
Dict{Int64, String} with 2 entries:
473473
2 => "b"
@@ -660,7 +660,7 @@ of `dict` then it will be converted to the value type if possible and otherwise
660660
`map!(f, values(dict::AbstractDict))` requires Julia 1.2 or later.
661661
662662
# Examples
663-
```jldoctest
663+
```jldoctest; filter = r"^\\s+\\S+(\\s+=>\\s+\\d)?\$"m
664664
julia> d = Dict(:a => 1, :b => 2)
665665
Dict{Symbol, Int64} with 2 entries:
666666
:a => 1

base/abstractset.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This is an infix operator, allowing `s ∪ itr`.
2525
See also [`unique`](@ref), [`intersect`](@ref), [`isdisjoint`](@ref), [`vcat`](@ref), [`Iterators.flatten`](@ref).
2626
2727
# Examples
28-
```jldoctest
28+
```jldoctest; filter = r"^\\s+\\d\$"m
2929
julia> union([1, 2], [3])
3030
3-element Vector{Int64}:
3131
1
@@ -68,7 +68,7 @@ Maintain order with arrays.
6868
$(_DOCS_ALIASING_WARNING)
6969
7070
# Examples
71-
```jldoctest
71+
```jldoctest; filter = r"^\\s+\\d\$"m
7272
julia> a = Set([3, 4, 5]);
7373
7474
julia> union!(a, 1:2:7);

base/array.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ Retrieve the value(s) stored at the given key or index within a collection. The
911911
See also [`get`](@ref), [`keys`](@ref), [`eachindex`](@ref).
912912
913913
# Examples
914-
```jldoctest
914+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
915915
julia> A = Dict("a" => 1, "b" => 2)
916916
Dict{String, Int64} with 2 entries:
917917
"b" => 2
@@ -967,7 +967,7 @@ Store the given value at the given key or index within a collection. The syntax
967967
x` is converted by the compiler to `(setindex!(a, x, i, j, ...); x)`.
968968
969969
# Examples
970-
```jldoctest
970+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
971971
julia> a = Dict("a"=>1)
972972
Dict{String, Int64} with 1 entry:
973973
"a" => 1

base/dict.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Given a single iterable argument, constructs a [`Dict`](@ref) whose key-value pa
3838
are taken from 2-tuples `(key,value)` generated by the argument.
3939
4040
# Examples
41-
```jldoctest
41+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
4242
julia> Dict([("A", 1), ("B", 2)])
4343
Dict{String, Int64} with 2 entries:
4444
"B" => 2
@@ -47,7 +47,7 @@ Dict{String, Int64} with 2 entries:
4747
4848
Alternatively, a sequence of pair arguments may be passed.
4949
50-
```jldoctest
50+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
5151
julia> Dict("A"=>1, "B"=>2)
5252
Dict{String, Int64} with 2 entries:
5353
"B" => 2
@@ -205,7 +205,7 @@ end
205205
Remove all elements from a `collection`.
206206
207207
# Examples
208-
```jldoctest
208+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
209209
julia> A = Dict("a" => 1, "b" => 2)
210210
Dict{String, Int64} with 2 entries:
211211
"b" => 2
@@ -389,7 +389,7 @@ Return the value stored for the given key, or if no mapping for the key is prese
389389
`key => default`, and return `default`.
390390
391391
# Examples
392-
```jldoctest
392+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
393393
julia> d = Dict("a"=>1, "b"=>2, "c"=>3);
394394
395395
julia> get!(d, "a", 5)
@@ -654,7 +654,7 @@ end
654654
Delete the mapping for the given key in a collection, if any, and return the collection.
655655
656656
# Examples
657-
```jldoctest
657+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
658658
julia> d = Dict("a"=>1, "b"=>2)
659659
Dict{String, Int64} with 2 entries:
660660
"b" => 2

base/essentials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ This function simply returns its argument by default, since the elements
11151115
of a general iterator are normally considered its "values".
11161116
11171117
# Examples
1118-
```jldoctest
1118+
```jldoctest; filter = r"^\\s+\\d\$"m
11191119
julia> d = Dict("a"=>1, "b"=>2);
11201120
11211121
julia> values(d)

base/float.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ See also [`trunc`](@ref).
406406
julia> unsafe_trunc(Int, -2.2)
407407
-2
408408
409-
julia> unsafe_trunc(Int, NaN)
410-
-9223372036854775808
409+
julia> unsafe_trunc(Int, NaN) isa Int
410+
true
411411
```
412412
"""
413413
function unsafe_trunc end

base/hashing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Typically, any type that implements `hash` should also implement its own [`==`](
1515
1616
The hash value may change when a new Julia process is started.
1717
18-
```jldoctest
18+
```jldoctest; filter = r"0x[0-9a-f]{16}"
1919
julia> a = hash(10)
2020
0x95ea2955abd45275
2121

base/regex.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ See [`keys`](@ref keys(::RegexMatch)) for more information.
194194
Constructing NamedTuples and Dicts from RegexMatches requires Julia 1.11
195195
196196
# Examples
197-
```jldoctest
197+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\S+\$"m
198198
julia> m = match(r"(?<hour>\\d+):(?<minute>\\d+)(am|pm)?", "11:30 in the morning")
199199
RegexMatch("11:30", hour="11", minute="30", 3=nothing)
200200

base/set.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ See also: [`in`](@ref), [`push!`](@ref), [`Set`](@ref)
104104
This function requires at least 1.11.
105105
106106
# Examples
107-
```jldoctest; filter = r"^ [1234]\$"
107+
```jldoctest; filter = r"^\\s+\\d\$"m
108108
julia> s = Set{Any}([1, 2, 3]); in!(4, s)
109109
false
110110
@@ -753,7 +753,7 @@ If `count` is specified, then replace at most `count` values in total
753753
(replacements being defined as `new(x) !== x`).
754754
755755
# Examples
756-
```jldoctest
756+
```jldoctest; filter = r"^\\s+\\d+(\\s+=>\\s+\\d)?\$"m
757757
julia> replace!(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
758758
4-element Vector{Int64}:
759759
2
@@ -849,7 +849,7 @@ If `count` is specified, then replace at most `count` values in total
849849
Version 1.7 is required to replace elements of a `Tuple`.
850850
851851
# Examples
852-
```jldoctest
852+
```jldoctest; filter = r"^\\s+\\S+\\s+=>\\s+\\d\$"m
853853
julia> replace(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
854854
4-element Vector{Int64}:
855855
2

stdlib/TOML/docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ julia> err.column
6666
The [`TOML.print`](@ref) function is used to print (or serialize) data into TOML
6767
format.
6868

69-
```jldoctest
69+
```jldoctest; filter = r"^\s*\S+\s*=.*"m
7070
julia> using TOML
7171
7272
julia> data = Dict(

0 commit comments

Comments
 (0)