Skip to content

Commit

Permalink
Merge pull request #134 from invenia/rf/validate-fallback
Browse files Browse the repository at this point in the history
Validate fallback for non-missing vectors
  • Loading branch information
rofinn authored Dec 19, 2022
2 parents abcc605 + 894344e commit 9507123
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Impute"
uuid = "f7bf1975-0170-51b9-8c5f-a992d46b9575"
authors = ["Invenia Technical Computing"]
version = "0.6.9"
version = "0.6.10"

[deps]
BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0"
Expand Down
2 changes: 2 additions & 0 deletions src/validators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,6 @@ function validate(table, v::Validator; cols=nothing, kwargs...)
return table
end

_validate(data::AbstractArray, v::Validator; kwargs...) = disallowmissing(data)

include("validators/threshold.jl")
9 changes: 9 additions & 0 deletions test/validators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
@test isequal(validate(m, t), m)
@test isequal(validate(aa, t), aa)
@test isequal(validate(table, t), table)

# Test type edge cases
@test_throws ThresholdError validate(fill(missing, 10), t)
@test validate(ones(10), t) == ones(10)
@test validate(ones(10), t) isa Vector{Float64}
end

@testset "Weighted" begin
Expand All @@ -66,6 +71,10 @@

@test_throws DimensionMismatch validate(a[1:10], t)
@test_throws DimensionMismatch validate(m[1:3, :], t; dims=:cols)

@test_throws ThresholdError validate(fill(missing, 5), t)
@test validate(ones(5), t) == ones(5)
@test validate(ones(5), t) isa Vector{Float64}
end

@testset "functional" begin
Expand Down

2 comments on commit 9507123

@rofinn
Copy link
Member Author

@rofinn rofinn commented on 9507123 Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/74370

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.10 -m "<description of version>" 9507123cbef3b8b2d66f7949578f3e0d7a8f7a71
git push origin v0.6.10

Please sign in to comment.