Skip to content

Commit

Permalink
tests and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pdeffebach committed Apr 1, 2020
1 parent 0448d77 commit 1a1d12e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Missings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ passmissing(f) = PassMissing{Core.Typeof(f)}(f)
skipmissings(args...)
Return a tuple of iterators wrapping each of the iterators in `args`, but
skipping elements at positions where at least one of the iterators returns `missing`.
skipping elements at positions where at least one of the iterators returns `missing`
(listwise deletion of missing values).
# Examples
```
Expand Down
8 changes: 7 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ struct CubeRooter end
@test_throws MissingException mx[1]
@test reduce(+, mx) === 18
@test isapprox(mapreduce(cos, *, collect(mx)), mapreduce(cos, *, mx))
@inferred Union{Float64, Missing} mapreduce(cos, *, mx)
if VERSION >= v"1.4.0-DEV"
@inferred Union{Float64, Missing} mapreduce(cos, *, mx)
end

x = [missing missing missing]
y = [1, 2, 3]
mx, my = skipmissings(x, y)
Expand All @@ -118,6 +121,9 @@ struct CubeRooter end
mx, my = skipmissings(x, y)
@test sum(mx) === 1056
@inferred Union{Missing, Int} sum(mx)
if VERSION >= v"1.4.0-DEV"
@inferred Union{Missing, Int} sum(mx)
end

@test levels(1:1) == levels([1]) == levels([1, missing]) == levels([missing, 1]) == [1]
@test levels(2:-1:1) == levels([2, 1]) == levels([2, missing, 1]) == [1, 2]
Expand Down

0 comments on commit 1a1d12e

Please sign in to comment.