-
Notifications
You must be signed in to change notification settings - Fork 17
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
Resolve ambiguities #86
Open
KeithWM
wants to merge
17
commits into
JuliaData:main
Choose a base branch
from
KeithWM:resolve-ambiguities-without-autoformat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
cfe75ee
Switch to using retest for faster development.
KeithWM ca220d4
Added tests known to fail on current implementation.
KeithWM ed6ce80
Fixed some of the broken tests to be properly broken.
KeithWM d5588a1
Added BigInt along Integer in the definition of several comparisons for
KeithWM 67d948a
Also define Base.reduce for hcat and vcat.
KeithWM 8cc04a8
Implemented methods for removing ambiguity in hcat and vcat.
KeithWM 25beb56
Made broadcast test work as expected.
KeithWM d49c10b
Reserve behaviour of Base.Broadcast.broadcasted(s::S, c::ChainedVector)
KeithWM 0a7dd11
Fixed copyto! with a PermutedDimsArray{Any, 1}
KeithWM 09e01a9
Added comment explaning that one test is maybe NOT our responsibility.
KeithWM 8ea444c
Fixed findall(Fix2{typeof(in)}, ::ChainedVector) ambiguity.
KeithWM 7776fc4
Version bumped Julia to 1.6
KeithWM 8a279a1
Added a test to cover the case of copyto!(::AbstractVector,
KeithWM e7f1767
Included a test case for the broadcasting of a ChainedVector
KeithWM 9ae27d9
Removed duplicated deleteat! testset.
KeithWM 6ec2e5b
Merge pull request #1 from JuliaData/main
KeithWM b6af311
Merge branch 'main' into resolve-ambiguities-without-autoformat
KeithWM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[deps] | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
ReTest = "e0db7c4e-2690-44b9-bad6-7687da720f89" | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module SentinelArrayTests | ||
using ReTest | ||
using Random, SparseArrays | ||
|
||
using SentinelArrays | ||
|
||
include("sentinelarrays.jl") | ||
include("missingvector.jl") | ||
include("chainedvector.jl") | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
|
||
@testset "MissingVector" begin | ||
|
||
x = MissingVector(10) | ||
@test all(x .=== missing) | ||
@test length(x) == 10 | ||
@test length(x) isa Int | ||
@test Base.IndexStyle(x) == Base.IndexLinear() | ||
|
||
y = similar(x, Missing, 5) | ||
@test length(y) == 5 | ||
|
||
y = empty(x) | ||
@test length(y) == 0 | ||
|
||
x[1] = missing | ||
x[end] = missing | ||
@test x[1] === missing | ||
@test x[end] === missing | ||
|
||
y = similar(x) | ||
@test typeof(y) == MissingVector | ||
@test length(y) == 10 | ||
y = similar(x, 20) | ||
@test typeof(y) == MissingVector | ||
@test length(y) == 20 | ||
|
||
@test isequal(copy(x), x) | ||
empty!(x) | ||
@test length(x) == 0 | ||
@test isequal(copy(x), x) | ||
|
||
@test_throws ArgumentError resize!(x, -1) | ||
resize!(x, 10) | ||
@test length(x) == 10 | ||
|
||
push!(x, missing) | ||
@test x[end] === missing | ||
empty!(x) | ||
push!(x, missing) | ||
@test x[1] === x[end] === missing | ||
|
||
pushfirst!(x, missing) | ||
@test x[1] === missing | ||
empty!(x) | ||
pushfirst!(x, missing) | ||
@test x[1] === x[end] === missing | ||
pushfirst!(x, missing) | ||
|
||
@test pop!(x) === missing | ||
@test popfirst!(x) === missing | ||
@test isempty(x) | ||
|
||
@test_throws BoundsError insert!(x, 0, missing) | ||
@test_throws BoundsError insert!(x, 2, missing) | ||
insert!(x, 1, missing) | ||
@test x[1] === missing | ||
insert!(x, 1, missing) | ||
@test x[1] === missing | ||
|
||
x = MissingVector(10) | ||
y = MissingVector(10) | ||
|
||
z = vcat(x, y) | ||
@test length(z) == 20 | ||
|
||
empty!(x) | ||
z = vcat(x, y) | ||
@test isequal(z, y) | ||
|
||
x = MissingVector(10) | ||
append!(x, y) | ||
@test length(x) == 20 | ||
|
||
x = MissingVector(10) | ||
append!(x, (missing for _ = 1:10)) | ||
@test length(x) == 20 | ||
|
||
empty!(x) | ||
append!(x, y) | ||
@test isequal(x, y) | ||
|
||
x = MissingVector(10) | ||
y = MissingVector(10) | ||
|
||
prepend!(y, x) | ||
@test length(y) == 20 | ||
|
||
y = MissingVector(10) | ||
prepend!(y, (missing for _ = 1:10)) | ||
@test length(y) == 20 | ||
|
||
empty!(y) | ||
prepend!(y, x) | ||
@test isequal(y, x) | ||
|
||
x = MissingVector(10) | ||
deleteat!(x, 1) | ||
@test x[1] === missing | ||
deleteat!(x, 1:4) | ||
@test length(x) == 5 | ||
deleteat!(x, [2, 4]) | ||
@test length(x) == 3 | ||
|
||
m = similar(x) | ||
@test length(m) == length(x) | ||
m = similar(x, Missing) | ||
@test length(m) == length(x) | ||
@test typeof(m[1:3]) == typeof(m) | ||
|
||
deleteat!(x, [true, true, false]) | ||
@test length(x) == 1 | ||
empty!(x) | ||
@test_throws ArgumentError pop!(x) | ||
@test_throws ArgumentError popfirst!(x) | ||
|
||
m = MissingVector(5) | ||
c = ChainedVector([m, m, m]) | ||
c2 = copy(c) | ||
@test length(c) == length(c2) | ||
@test c2 isa MissingVector | ||
|
||
deleteat!(c2, Int[]) | ||
@test length(c2) == 15 | ||
|
||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm personally not a fan of test Projects yet; they're undersupported by too many ecosystem tools at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware or ecosystems that don't support them. But it's OK as long as it works here on Github, right?