Skip to content

Commit

Permalink
Merge pull request #97 from invenia/gm/nightly
Browse files Browse the repository at this point in the history
Fix failing XArray tests
  • Loading branch information
Glenn Moynihan authored Jul 1, 2021
2 parents 1b023b1 + cdb209a commit f929182
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FeatureTransforms"
uuid = "8fd68953-04b8-4117-ac19-158bf6de9782"
authors = ["Invenia Technical Computing Corporation"]
version = "0.3.6"
version = "0.3.7"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
5 changes: 3 additions & 2 deletions src/apply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ the usual [`Transform`](@ref) being invoked.
function apply_append(A::AbstractArray, t; append_dim, kwargs...)::AbstractArray
result = apply(A, t; kwargs...)
result = _postformat(cardinality(t), result, A, append_dim)
return cat(A, result; dims=append_dim)
# Conver result to Array to avoid clashing axis/key names in concatenated result
return cat(A, Array(result); dims=append_dim)
end

"""
Expand Down Expand Up @@ -153,5 +154,5 @@ _postformat(::Cardinality, result, A, append_dim) = result
function _postformat(::ManyToOne, result, A, append_dim)
new_size = collect(size(A))
setindex!(new_size, 1, dim(A, append_dim))
return reshape(result, new_size...)
return copy(reshape(result, new_size...)) # return a copy to remove the reshape type
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using AxisArrays
using AxisKeys
using Base: ReshapedArray
using DataFrames: DataFrame
using Dates
using Documenter: doctest
Expand Down
9 changes: 7 additions & 2 deletions test/types/matrix.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
@testset "matrix" begin
# Want to test that certain subtypes of arrays are compatible
_make_matrix(::Type{Matrix}) = [1 2 3; 4 5 6]
_make_matrix(::Type{SubArray}) = view([1 2 3; 4 5 6], :, :)
_make_matrix(::Type{ReshapedArray}) = reshape([1 2 3; 4 5 6], 2, 3)

x = [1 2 3; 4 5 6]
@testset "$MatrixType" for MatrixType in (Matrix, SubArray, ReshapedArray)

x = _make_matrix(MatrixType)

@test is_transformable(x)

Expand Down
4 changes: 2 additions & 2 deletions test/types/xarray.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "$ArrayType" for ArrayType in (AxisArray, KeyedArray)
@testset "$ArrayType" for ArrayType in (AxisArray, KeyedArray, NamedDimsArray)

x = ArrayType([1 2 3; 4 5 6], foo=["a", "b"], bar=[:x, :y, :z])

Expand Down Expand Up @@ -114,7 +114,7 @@

end

if ArrayType == KeyedArray
if ArrayType != AxisArray
@testset "indexing with dims" begin

T = FakeOneToOneTransform()
Expand Down

2 comments on commit f929182

@glennmoy
Copy link
Member

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/40022

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.3.7 -m "<description of version>" f9291822a0cb0ed63710e49cd753bd94b3c650c8
git push origin v0.3.7

Please sign in to comment.