Skip to content

Commit d3884d1

Browse files
committed
Fix outdated doctests
by running `make.jl` with `doctest=:fix` inside `makedocs`. Julia version was 1.6.2.
1 parent 62105c0 commit d3884d1

File tree

8 files changed

+76
-55
lines changed

8 files changed

+76
-55
lines changed

docs/src/priority-queue.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ julia> # Julia code
3333
3434
julia> # Insert keys with associated priorities
3535
pq["a"] = 10; pq["b"] = 5; pq["c"] = 15; pq
36-
PriorityQueue{Any,Any,Base.Order.ForwardOrdering} with 3 entries:
36+
PriorityQueue{Any, Any, Base.Order.ForwardOrdering} with 3 entries:
3737
"b" => 5
3838
"a" => 10
3939
"c" => 15
4040
4141
julia> # Change the priority of an existing key
4242
pq["a"] = 0; pq
43-
PriorityQueue{Any,Any,Base.Order.ForwardOrdering} with 3 entries:
43+
PriorityQueue{Any, Any, Base.Order.ForwardOrdering} with 3 entries:
4444
"a" => 0
4545
"b" => 5
4646
"c" => 15
4747
```
4848
It is also possible to iterate over the priorities and elements of the queue in sorted order.
4949
```jldoctest
5050
julia> pq = PriorityQueue("a"=>2, "b"=>1, "c"=>3)
51-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 3 entries:
51+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 3 entries:
5252
"b" => 1
5353
"a" => 2
5454
"c" => 3

docs/src/robin_dict.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ Examples:
1313

1414
```jldoctest
1515
julia> d = RobinDict{Int, Char}(1 => 'a', 2 => 'b')
16-
RobinDict{Int64,Char} with 2 entries:
16+
RobinDict{Int64, Char} with 2 entries:
1717
2 => 'b'
1818
1 => 'a'
1919
2020
julia> d[3] = 'c';
2121
2222
julia> collect(d)
23-
3-element Array{Pair{Int64,Char},1}:
23+
3-element Vector{Pair{Int64, Char}}:
2424
2 => 'b'
2525
3 => 'c'
2626
1 => 'a'
@@ -31,7 +31,7 @@ julia> d[1]
3131
'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
3232
3333
julia> d
34-
RobinDict{Int64,Char} with 2 entries:
34+
RobinDict{Int64, Char} with 2 entries:
3535
3 => 'c'
3636
1 => 'a'
3737

docs/src/swiss_dict.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Examples:
1212

1313
```jldoctest
1414
julia> d = SwissDict(1 => 'a', 2 => 'b')
15-
SwissDict{Int64,Char} with 2 entries:
15+
SwissDict{Int64, Char} with 2 entries:
1616
1 => 'a'
1717
2 => 'b'
1818
1919
julia> d[3] = 'c';
2020
2121
julia> collect(d)
22-
3-element Array{Pair{Int64,Char},1}:
22+
3-element Vector{Pair{Int64, Char}}:
2323
1 => 'a'
2424
2 => 'b'
2525
3 => 'c'
@@ -30,7 +30,7 @@ julia> d[1]
3030
'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
3131
3232
julia> d
33-
SwissDict{Int64,Char} with 2 entries:
33+
SwissDict{Int64, Char} with 2 entries:
3434
1 => 'a'
3535
3 => 'c'
3636

src/heaps/arrays_as_heaps.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Return `true` if an array is heap-ordered according to the given order.
122122
123123
```jldoctest
124124
julia> a = [1,2,3]
125-
3-element Array{Int64,1}:
125+
3-element Vector{Int64}:
126126
1
127127
2
128128
3

src/ordered_robin_dict.jl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ are taken from 2-tuples `(key,value)` generated by the argument.
1212
# Examples
1313
```jldoctest
1414
julia> OrderedRobinDict([("A", 1), ("B", 2)])
15-
OrderedRobinDict{String,Int64} with 2 entries:
15+
OrderedRobinDict{String, Int64} with 2 entries:
1616
"A" => 1
1717
"B" => 2
1818
```
@@ -21,7 +21,7 @@ Alternatively, a sequence of pair arguments may be passed.
2121
2222
```jldoctest
2323
julia> OrderedRobinDict("A"=>1, "B"=>2)
24-
OrderedRobinDict{String,Int64} with 2 entries:
24+
OrderedRobinDict{String, Int64} with 2 entries:
2525
"A" => 1
2626
"B" => 2
2727
```
@@ -94,14 +94,15 @@ Remove all elements from a `collection`.
9494
# Examples
9595
```jldoctest
9696
julia> A = OrderedRobinDict("a" => 1, "b" => 2)
97-
OrderedRobinDict{String,Int64} with 2 entries:
97+
OrderedRobinDict{String, Int64} with 2 entries:
9898
"a" => 1
9999
"b" => 2
100100
101101
julia> empty!(A);
102102
103+
103104
julia> A
104-
OrderedRobinDict{String,Int64} with 0 entries
105+
OrderedRobinDict{String, Int64}()
105106
```
106107
"""
107108
function Base.empty!(h::OrderedRobinDict{K,V}) where {K, V}
@@ -191,14 +192,15 @@ Return the value stored for the given key, or if no mapping for the key is prese
191192
```jldoctest
192193
julia> d = OrderedRobinDict("a"=>1, "b"=>2, "c"=>3);
193194
195+
194196
julia> get!(d, "a", 5)
195197
1
196198
197199
julia> get!(d, "d", 4)
198200
4
199201
200202
julia> d
201-
OrderedRobinDict{String,Int64} with 4 entries:
203+
OrderedRobinDict{String, Int64} with 4 entries:
202204
"a" => 1
203205
"b" => 2
204206
"c" => 3
@@ -251,6 +253,7 @@ key is present.
251253
```jldoctest
252254
julia> d = OrderedRobinDict("a"=>1, "b"=>2);
253255
256+
254257
julia> get(d, "a", 3)
255258
1
256259
@@ -291,7 +294,7 @@ Determine whether a collection has a mapping for a given `key`.
291294
# Examples
292295
```jldoctest
293296
julia> D = OrderedRobinDict('a'=>2, 'b'=>3)
294-
OrderedRobinDict{Char,Int64} with 2 entries:
297+
OrderedRobinDict{Char, Int64} with 2 entries:
295298
'a' => 2
296299
'b' => 3
297300
@@ -313,7 +316,7 @@ Return the key matching argument `key` if one exists in `collection`, otherwise
313316
# Examples
314317
```jldoctest
315318
julia> D = OrderedRobinDict('a'=>2, 'b'=>3)
316-
OrderedRobinDict{Char,Int64} with 2 entries:
319+
OrderedRobinDict{Char, Int64} with 2 entries:
317320
'a' => 2
318321
'b' => 3
319322
@@ -364,13 +367,17 @@ Delete and return the mapping for `key` if it exists in `collection`, otherwise
364367
```jldoctest
365368
julia> d = OrderedRobinDict("a"=>1, "b"=>2, "c"=>3);
366369
370+
367371
julia> pop!(d, "a")
368372
1
369373
370374
julia> pop!(d, "d")
371375
ERROR: KeyError: key "d" not found
372376
Stacktrace:
373-
[...]
377+
[1] pop!(h::OrderedRobinDict{String, Int64}, key::String)
378+
@ DataStructures ~/.julia/dev/DataStructures/src/ordered_robin_dict.jl:357
379+
[2] top-level scope
380+
@ none:1
374381
375382
julia> pop!(d, "e", 4)
376383
4
@@ -389,12 +396,12 @@ Delete the mapping for the given key in a collection, and return the collection.
389396
# Examples
390397
```jldoctest
391398
julia> d = OrderedRobinDict("a"=>1, "b"=>2)
392-
OrderedRobinDict{String,Int64} with 2 entries:
399+
OrderedRobinDict{String, Int64} with 2 entries:
393400
"a" => 1
394401
"b" => 2
395402
396403
julia> delete!(d, "b")
397-
OrderedRobinDict{String,Int64} with 1 entry:
404+
OrderedRobinDict{String, Int64} with 1 entry:
398405
"a" => 1
399406
```
400407
"""

src/priorityqueue.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ lowest priority element.
1717
1818
```jldoctest
1919
julia> PriorityQueue(Base.Order.Forward, "a" => 2, "b" => 3, "c" => 1)
20-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 3 entries:
20+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 3 entries:
2121
"c" => 1
2222
"a" => 2
2323
"b" => 3
@@ -214,13 +214,13 @@ Insert the a key `k` into a priority queue `pq` with priority `v`.
214214
215215
```jldoctest
216216
julia> a = PriorityQueue(PriorityQueue("a"=>1, "b"=>2, "c"=>3))
217-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 3 entries:
217+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 3 entries:
218218
"a" => 1
219219
"b" => 2
220220
"c" => 3
221221
222222
julia> enqueue!(a, "d"=>4)
223-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 4 entries:
223+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 4 entries:
224224
"a" => 1
225225
"b" => 2
226226
"c" => 3
@@ -255,7 +255,7 @@ Remove and return the lowest priority key from a priority queue.
255255
256256
```jldoctest
257257
julia> a = PriorityQueue(Base.Order.Forward, ["a" => 2, "b" => 3, "c" => 1])
258-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 3 entries:
258+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 3 entries:
259259
"c" => 1
260260
"a" => 2
261261
"b" => 3
@@ -264,7 +264,7 @@ julia> dequeue!(a)
264264
"c"
265265
266266
julia> a
267-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 2 entries:
267+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 2 entries:
268268
"a" => 2
269269
"b" => 3
270270
```
@@ -280,7 +280,7 @@ Remove and return a the lowest priority key and value from a priority queue as a
280280
281281
```jldoctest
282282
julia> a = PriorityQueue(Base.Order.Forward, "a" => 2, "b" => 3, "c" => 1)
283-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 3 entries:
283+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 3 entries:
284284
"c" => 1
285285
"a" => 2
286286
"b" => 3
@@ -289,7 +289,7 @@ julia> dequeue_pair!(a)
289289
"c" => 1
290290
291291
julia> a
292-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 2 entries:
292+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 2 entries:
293293
"a" => 2
294294
"b" => 3
295295
```
@@ -319,12 +319,12 @@ Delete the mapping for the given key in a priority queue, and return the priorit
319319
# Examples
320320
```jldoctest
321321
julia> q = PriorityQueue(Base.Order.Forward, "a"=>2, "b"=>3, "c"=>1)
322-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 3 entries:
322+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 3 entries:
323323
"c" => 1
324324
"a" => 2
325325
"b" => 3
326326
julia> delete!(q, "b")
327-
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 2 entries:
327+
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 2 entries:
328328
"c" => 1
329329
"a" => 2
330330
```

src/robin_dict.jl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ are taken from 2-tuples `(key,value)` generated by the argument.
1212
# Examples
1313
```jldoctest
1414
julia> RobinDict([("A", 1), ("B", 2)])
15-
RobinDict{String,Int64} with 2 entries:
15+
RobinDict{String, Int64} with 2 entries:
1616
"B" => 2
1717
"A" => 1
1818
```
@@ -21,7 +21,7 @@ Alternatively, a sequence of pair arguments may be passed.
2121
2222
```jldoctest
2323
julia> RobinDict("A"=>1, "B"=>2)
24-
RobinDict{String,Int64} with 2 entries:
24+
RobinDict{String, Int64} with 2 entries:
2525
"B" => 2
2626
"A" => 1
2727
```
@@ -259,14 +259,15 @@ Remove all elements from a `collection`.
259259
# Examples
260260
```jldoctest
261261
julia> A = RobinDict("a" => 1, "b" => 2)
262-
RobinDict{String,Int64} with 2 entries:
262+
RobinDict{String, Int64} with 2 entries:
263263
"b" => 2
264264
"a" => 1
265265
266266
julia> empty!(A);
267267
268+
268269
julia> A
269-
RobinDict{String,Int64} with 0 entries
270+
RobinDict{String, Int64}()
270271
```
271272
"""
272273
function Base.empty!(h::RobinDict{K,V}) where {K, V}
@@ -310,14 +311,15 @@ Return the value stored for the given key, or if no mapping for the key is prese
310311
```jldoctest
311312
julia> d = RobinDict("a"=>1, "b"=>2, "c"=>3);
312313
314+
313315
julia> get!(d, "a", 5)
314316
1
315317
316318
julia> get!(d, "d", 4)
317319
4
318320
319321
julia> d
320-
RobinDict{String,Int64} with 4 entries:
322+
RobinDict{String, Int64} with 4 entries:
321323
"c" => 3
322324
"b" => 2
323325
"a" => 1
@@ -374,6 +376,7 @@ key is present.
374376
```jldoctest
375377
julia> d = RobinDict("a"=>1, "b"=>2);
376378
379+
377380
julia> get(d, "a", 3)
378381
1
379382
@@ -414,7 +417,7 @@ Determine whether a collection has a mapping for a given `key`.
414417
# Examples
415418
```jldoctest
416419
julia> D = RobinDict('a'=>2, 'b'=>3)
417-
RobinDict{Char,Int64} with 2 entries:
420+
RobinDict{Char, Int64} with 2 entries:
418421
'a' => 2
419422
'b' => 3
420423
@@ -436,7 +439,7 @@ Return the key matching argument `key` if one exists in `collection`, otherwise
436439
# Examples
437440
```jldoctest
438441
julia> D = RobinDict('a'=>2, 'b'=>3)
439-
RobinDict{Char,Int64} with 2 entries:
442+
RobinDict{Char, Int64} with 2 entries:
440443
'a' => 2
441444
'b' => 3
442445
@@ -512,13 +515,17 @@ Delete and return the mapping for `key` if it exists in `collection`, otherwise
512515
```jldoctest
513516
julia> d = RobinDict("a"=>1, "b"=>2, "c"=>3);
514517
518+
515519
julia> pop!(d, "a")
516520
1
517521
518522
julia> pop!(d, "d")
519523
ERROR: KeyError: key "d" not found
520524
Stacktrace:
521-
[...]
525+
[1] pop!(h::RobinDict{String, Int64}, key0::String)
526+
@ DataStructures ~/.julia/dev/DataStructures/src/robin_dict.jl:505
527+
[2] top-level scope
528+
@ none:1
522529
523530
julia> pop!(d, "e", 4)
524531
4
@@ -547,12 +554,12 @@ Delete the mapping for the given key in a collection, and return the collection.
547554
# Examples
548555
```jldoctest
549556
julia> d = RobinDict("a"=>1, "b"=>2)
550-
RobinDict{String,Int64} with 2 entries:
557+
RobinDict{String, Int64} with 2 entries:
551558
"b" => 2
552559
"a" => 1
553560
554561
julia> delete!(d, "b")
555-
RobinDict{String,Int64} with 1 entry:
562+
RobinDict{String, Int64} with 1 entry:
556563
"a" => 1
557564
```
558565
"""

0 commit comments

Comments
 (0)