Skip to content

Commit

Permalink
🐛 fix the issue with attributed
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisot committed Oct 8, 2019
1 parent 7a5f9fd commit 31aa90d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Mangal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export datasets, dataset
export networks, network
export references, reference
export interactions, interaction
export attributes, attribute

# Datasets
include(joinpath(".", "dataset.jl"))
Expand Down
2 changes: 1 addition & 1 deletion src/response_format.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function format_mangal_response(::Type{MangalAttribute}, d::Dict{T,Any}) where {
obj_id = d["id"]
obj_name = d["name"]
obj_description = d["description"]
obj_unit = d["unit"]
obj_unit = inothing(d["unit"]) ? missing : d["unit"]

return MangalAttribute(obj_id, obj_name, obj_description, obj_unit)
end
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct MangalAttribute
id::Int64
name:: AbstractString
description::AbstractString
unit::AbstractString
unit::Union{AbstractString,Missing}
end

"""
Expand Down
11 changes: 11 additions & 0 deletions test/attributes.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module MangalTestAttributes
using Mangal
using Test
include("setup.jl")

@test typeof(attributes()) <: Vector{MangalAttributes}

n1 = attribute(6)
@test typeof(n1) <: MangalAttribute

end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ my_tests = [
"backbone.jl",
"nodes.jl",
"cache.jl",
"attributes.jl",
"datasets.jl",
"networks.jl",
"interactions.jl"
Expand Down

0 comments on commit 31aa90d

Please sign in to comment.