From cfce23e40667ab83e60a4e17b11edae6319d09a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Sat, 24 Jun 2023 21:37:48 -0400 Subject: [PATCH 1/6] refactor: start adding tests in the code --- Project.toml | 3 +- docs/Project.toml | 2 - src/Mangal.jl | 7 +-- src/ecologicalnetworks.jl | 118 -------------------------------------- src/generators.jl | 2 +- src/interaction.jl | 33 +++++++++++ test/Project.toml | 2 +- test/interactions.jl | 18 ------ test/runtests.jl | 43 +------------- 9 files changed, 39 insertions(+), 189 deletions(-) delete mode 100644 src/ecologicalnetworks.jl delete mode 100644 test/interactions.jl diff --git a/Project.toml b/Project.toml index 852b24e..e5a6237 100644 --- a/Project.toml +++ b/Project.toml @@ -6,13 +6,12 @@ version = "0.4.3" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" -EcologicalNetworks = "f03a62fe-f8ab-5b77-a061-bb599b765229" GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe" [compat] -EcologicalNetworks = "0.4, 0.5" GeoInterface = "1.3" HTTP = "0.8, 0.9, 1.8" JSON = "0.21" diff --git a/docs/Project.toml b/docs/Project.toml index 6ef56f1..b9a15bb 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,5 +1,3 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" -Weave = "44d3d7a6-8a23-5bf8-98c5-b353f8df5ec9" - diff --git a/src/Mangal.jl b/src/Mangal.jl index 18f9a1a..b2f894b 100644 --- a/src/Mangal.jl +++ b/src/Mangal.jl @@ -3,8 +3,8 @@ module Mangal using HTTP using JSON using GeoInterface -using EcologicalNetworks using Dates +using TestItems const web_root = "https://mangal.io/" const api_root = web_root * "api/v2/" @@ -86,9 +86,4 @@ include(joinpath(".", "count.jl")) # Show include(joinpath(".", "show.jl")) -# EcologicalNetworks wrapper -using EcologicalNetworks: EcologicalNetworks -include(joinpath(".", "ecologicalnetworks.jl")) -export taxonize - end # module diff --git a/src/ecologicalnetworks.jl b/src/ecologicalnetworks.jl deleted file mode 100644 index aeb5d6b..0000000 --- a/src/ecologicalnetworks.jl +++ /dev/null @@ -1,118 +0,0 @@ -try - EcologicalNetworks._check_species_validity(::Type{MangalNode}) = nothing - EcologicalNetworks._check_species_validity(::Type{MangalReferenceTaxon}) = nothing -catch e - @info "Compatibility with EcologicalNetworks 0.3 will be removed soon" - EcologicalNetworks.check_species_validity(::Type{MangalNode}) = nothing - EcologicalNetworks.check_species_validity(::Type{MangalReferenceTaxon}) = nothing -end - -function get_all_interactions(n::MangalNetwork, query::Pair...) - page_size = 250 - network_interactions = MangalInteraction[] - interactions_to_get = count(MangalInteraction, n, query...) - pages_to_do = convert(Int64, ceil(interactions_to_get/page_size)) - for page in 1:pages_to_do - paging_query = ["page" => "$(page-1)", "count" => page_size, query...] - append!(network_interactions, Mangal.interactions(n, paging_query...)) - end - return network_interactions -end - -import Base.convert - -""" - convert(::Type{EcologicalNetworks.UnipartiteNetwork}, n::MangalNetwork, query::Pair...) - -TODO -""" -function convert(::Type{EcologicalNetworks.UnipartiteNetwork}, n::MangalNetwork, query::Pair...) - all_interactions = Mangal.get_all_interactions(n, query...) - return convert(EcologicalNetworks.UnipartiteNetwork, all_interactions) -end - -""" - convert(::Type{EcologicalNetworks.UnipartiteNetwork}, n::MangalNetwork, query::Pair...) - -TODO -""" -function convert(::Type{EcologicalNetworks.UnipartiteQuantitativeNetwork}, n::MangalNetwork, query::Pair...) - all_interactions = Mangal.get_all_interactions(n, query...) - return convert(EcologicalNetworks.UnipartiteQuantitativeNetwork, all_interactions) -end - -""" - convert(::Type{UnipartiteNetwork}, interac::Vector{MangalInteraction}) - -TODO -""" -function convert(::Type{EcologicalNetworks.UnipartiteNetwork}, interac::Vector{MangalInteraction}) - - all_object_nodes = MangalNode[] - - for i in interac - append!(all_object_nodes, [i.from, i.to]) - end - - object_nodes = unique(all_object_nodes) - S = length(object_nodes) - A = zeros(Bool, (S,S)) - N = EcologicalNetworks.UnipartiteNetwork(A, object_nodes) - for i in interac - if i.strength != 0 - N[i.from, i.to] = true - end - end - - return N -end - -""" - convert(::Type{UnipartiteNetwork}, interac::Vector{MangalInteraction}) - -TODO -""" -function convert(::Type{EcologicalNetworks.UnipartiteQuantitativeNetwork}, interac::Vector{MangalInteraction}) - - all_object_nodes = MangalNode[] - - for i in interac - append!(all_object_nodes, [i.from, i.to]) - end - - object_nodes = unique(all_object_nodes) - S = length(object_nodes) - A = zeros(Float64, (S,S)) - N = EcologicalNetworks.UnipartiteQuantitativeNetwork(A, object_nodes) - for i in interac - if i.strength != 0 - N[i.from, i.to] = convert(Float64, i.strength) - end - end - - return N -end - -""" -missing are dropped -""" -function taxonize(N::T) where {T <: EcologicalNetworks.UnipartiteNetwork} - @assert eltype(species(N)) == MangalNode - unique_ref_taxa = unique([s.taxon for s in EcologicalNetworks.species(N)]) - @warn "This function really should inform of dropped nodes" - filter!(!ismissing, unique_ref_taxa) - u_refs = convert(Vector{MangalReferenceTaxon}, unique_ref_taxa) - S = length(u_refs) - A = zeros(Bool, (S,S)) - K = EcologicalNetworks.UnipartiteNetwork(A, u_refs) - for s1 in EcologicalNetworks.species(N) - if !ismissing(s1.taxon) - for s2 in EcologicalNetworks.species(N) - if !ismissing(s2.taxon) - K[s1.taxon,s2.taxon] = N[s1,s2] - end - end - end - end - return EcologicalNetworks.simplify(K) -end diff --git a/src/generators.jl b/src/generators.jl index c88a69c..605ebd5 100644 --- a/src/generators.jl +++ b/src/generators.jl @@ -20,7 +20,7 @@ for mg_type_pair in types_names Returns the number of $($mg_type) objects that match a query. """ - function count(::Type{$mg_type}, query::Pair...) + function Base.count(::Type{$mg_type}, query::Pair...) return Mangal.number_of_objects(Mangal._MANGAL_ENDPOINTS[$mg_type], query...) end end diff --git a/src/interaction.jl b/src/interaction.jl index d53319d..27774a7 100644 --- a/src/interaction.jl +++ b/src/interaction.jl @@ -45,3 +45,36 @@ Returns interactions within a network. function interactions(n::MangalNetwork, query::Pair...) return interactions("network_id" => n.id, query...) end + + +@testitem "We can get all interactions" begin + @test typeof(interactions()) <: Vector{MangalInteraction} +end + +@testitem "We can get all interactions by type" begin + @test typeof(interactions(Pair("type", "mutualism"))) <: Vector{MangalInteraction} +end + +@testitem "We can get all interactions to a node" begin + @test typeof(interactions(:, node(31863))) <: Vector{MangalInteraction} +end + +@testitem "We can get all interactions from a node" begin + @test typeof(interactions(node(31904), :)) <: Vector{MangalInteraction} +end + +@testitem "We can get all interactions to a node by type" begin + @test typeof(interactions(:, node(31863), Pair("type", "predation"))) <: Vector{MangalInteraction} +end + +@testitem "We can get all interactions from a node by type" begin + @test typeof(interactions(node(31904), :, Pair("type", "predation"))) <: Vector{MangalInteraction} +end + +@testitem "We can get interactions between nodes" begin + @test typeof(interactions(node(31904), node(31863))) <: Vector{MangalInteraction} +end + +@testitem "We can get interactions between nodes by type" begin + @test typeof(interactions(node(31904), node(31863), Pair("type", "predation"))) <: Vector{MangalInteraction} +end diff --git a/test/Project.toml b/test/Project.toml index d7097a0..7c239d8 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,3 +1,3 @@ [deps] -EcologicalNetworks = "f03a62fe-f8ab-5b77-a061-bb599b765229" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" diff --git a/test/interactions.jl b/test/interactions.jl deleted file mode 100644 index 2e9b4d2..0000000 --- a/test/interactions.jl +++ /dev/null @@ -1,18 +0,0 @@ -module MangalTestInteractions - - using Mangal - using Test - - @test typeof(interactions()) <: Vector{MangalInteraction} - @test typeof(interactions(Pair("type", "mutualism"))) <: Vector{MangalInteraction} - - @test typeof(interactions(:, node(31863))) <: Vector{MangalInteraction} - @test typeof(interactions(node(31904), :)) <: Vector{MangalInteraction} - - @test typeof(interactions(:, node(31863), Pair("type", "predation"))) <: Vector{MangalInteraction} - @test typeof(interactions(node(31904), :, Pair("type", "predation"))) <: Vector{MangalInteraction} - - @test typeof(interactions(node(31904), node(31863))) <: Vector{MangalInteraction} - @test typeof(interactions(node(31904), node(31863), Pair("type", "predation"))) <: Vector{MangalInteraction} - -end diff --git a/test/runtests.jl b/test/runtests.jl index 9c1d171..84bde59 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,41 +1,2 @@ -using Mangal -using Test - -my_tests = [ - "backbone.jl", - "nodes.jl", - "cache.jl", - "attributes.jl", - "datasets.jl", - "networks.jl", - "interactions.jl", - "knownbugs.jl", - "users.jl" -] - -global test_n -global anyerrors - -# Shhhh... -Mangal.login_message() - -test_n = 1 -anyerrors = false - -for my_test in my_tests - try - include(my_test) - println("[TEST $(lpad(test_n,2))] \033[1m\033[32mPASS\033[0m $(my_test)") - catch e - global anyerrors = true - println("[TEST $(lpad(test_n,2))] \033[1m\033[31mFAIL\033[0m $(my_test)") - showerror(stdout, e, backtrace()) - println() - throw("TEST FAILED") - end - global test_n += 1 -end - -if anyerrors - throw("Tests failed") -end +using TestItemRunner +@run_package_tests \ No newline at end of file From 18728de750f6327e41dccb947ff82c099e7a7d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Sat, 24 Jun 2023 21:50:19 -0400 Subject: [PATCH 2/6] refactor: move some more tests --- src/interaction.jl | 1 - src/network.jl | 38 ++++++++++++++++++++++++++++++++++++++ src/node.jl | 6 ++++++ test/networks.jl | 40 ---------------------------------------- test/setup.jl | 3 --- 5 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 test/networks.jl delete mode 100644 test/setup.jl diff --git a/src/interaction.jl b/src/interaction.jl index 27774a7..994b95d 100644 --- a/src/interaction.jl +++ b/src/interaction.jl @@ -46,7 +46,6 @@ function interactions(n::MangalNetwork, query::Pair...) return interactions("network_id" => n.id, query...) end - @testitem "We can get all interactions" begin @test typeof(interactions()) <: Vector{MangalInteraction} end diff --git a/src/network.jl b/src/network.jl index 1a9ecb7..fc70759 100644 --- a/src/network.jl +++ b/src/network.jl @@ -16,3 +16,41 @@ function network(name::AbstractString) q = networks(Pair("name", name)) return isequal(1)(length(q)) ? only(q) : nothing end + +@testitem "We can get networks" begin + @test typeof(networks()) <: Vector{MangalNetwork} +end + +@testitem "We can get a network by ID" begin + @test typeof(network(19)) <: MangalNetwork +end + +@testitem "We can get a network by name" begin + @test typeof(network("howking_1968_19680601_12")) <: MangalNetwork +end + +@testitem "We can get a network by dataset" begin + ds = dataset(62) + n_ds = networks(ds) + @test typeof(n_ds) <: Vector{MangalNetwork} +end + +@testitem "We can get a network by dataset with additional arguments" begin + ds = dataset(62) + n_ds_q = networks(ds, Pair("count", 2)) + @test typeof(n_ds_q) <: Vector{MangalNetwork} + @test length(n_ds_q) == 2 +end + +@testitem "We can page through multiple network queries" begin + this_page = 1 + networks_ponisio = networks(dataset("ponisio_2017"), Pair("count", 10), Pair("page", this_page)) + keep_querying = true + while keep_querying + global this_page += 1 + response = networks(dataset("ponisio_2017"), Pair("count", 10), Pair("page", this_page)) + append!(networks_ponisio, response) + global keep_querying = length(response) > 0 + end + @test length(networks_ponisio) == 131 +end \ No newline at end of file diff --git a/src/node.jl b/src/node.jl index 8548506..9818269 100644 --- a/src/node.jl +++ b/src/node.jl @@ -15,3 +15,9 @@ Returns the nodes that are instance of a `MangalReferenceTaxon`, with an additio function nodes(taxon::MangalReferenceTaxon, query::Pair...) return nodes(Pair("taxonomy_id", taxon.id), query...) end + +@testitem "We can get nodes of a network" begin + N1 = network(19) + nN1 = nodes(N1) + @test typeof(nN1) <: Vector{MangalNode} +end \ No newline at end of file diff --git a/test/networks.jl b/test/networks.jl deleted file mode 100644 index fc474a8..0000000 --- a/test/networks.jl +++ /dev/null @@ -1,40 +0,0 @@ -module MangalTestNetwork - using Mangal - using Test - include("setup.jl") - - # Nodes of a network - N1 = network(19) - nN1 = nodes(N1) - @test typeof(nN1) <: Vector{MangalNode} - - # Datasets with no arguments - @test typeof(networks()) <: Vector{MangalNetwork} - - # Networks by id - @test typeof(network(19)) <: MangalNetwork - - # Network by name - @test typeof(network("howking_1968_19680601_12")) <: MangalNetwork - - # Networks by dataset - ds = dataset(62) # Olesen - n_ds = networks(ds) - @test typeof(n_ds) <: Vector{MangalNetwork} - n_ds_q = networks(ds, Pair("count", 2)) - @test typeof(n_ds_q) <: Vector{MangalNetwork} - @test length(n_ds_q) == 2 - - # Wrap multiple calls - this_page = 1 - networks_ponisio = networks(dataset("ponisio_2017"), Pair("count", 10), Pair("page", this_page)) - keep_querying = true - while keep_querying - global this_page += 1 - response = networks(dataset("ponisio_2017"), Pair("count", 10), Pair("page", this_page)) - append!(networks_ponisio, response) - global keep_querying = length(response) > 0 - end - @test length(networks_ponisio) == 131 - -end diff --git a/test/setup.jl b/test/setup.jl deleted file mode 100644 index 18ebb15..0000000 --- a/test/setup.jl +++ /dev/null @@ -1,3 +0,0 @@ -# This will use the MANGAL_BEARER_TOKEN variable on the Travis build - -# Mangal.login() From 47722e7c48a51eb8cf55c0abb632d6a089518b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Sun, 25 Jun 2023 14:02:35 -0400 Subject: [PATCH 3/6] ci: update ci files --- .github/workflows/CI.yml | 3 +++ .github/workflows/CompatHelper.yml | 2 +- .github/workflows/Documentation.yml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ea3c4c1..09bdaa8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,6 +17,9 @@ jobs: version: - '1.5' - '1.6' + - '1.7' + - '1.8' + - '1.9' os: - ubuntu-latest - macOS-latest diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 05f8d37..1aa3ec9 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: [1.4.0] + julia-version: [1.9.0] julia-arch: [x86] os: [ubuntu-latest] steps: diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index e1aa7f0..e4c3f98 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@latest with: - version: '1.5' + version: '1.9' - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy From 6dad941835f1f835115e9060483692801e12b468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Sun, 25 Jun 2023 14:09:09 -0400 Subject: [PATCH 4/6] compat: Julia versions --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index e5a6237..ec47bf0 100644 --- a/Project.toml +++ b/Project.toml @@ -2,7 +2,7 @@ name = "Mangal" uuid = "b8b640a6-63d9-51e6-b784-5033db27bef2" authors = ["Timothée Poisot "] repo-url = "https://github.com/PoisotLab/Mangal.jl.git" -version = "0.4.3" +version = "0.5.0" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" @@ -15,4 +15,4 @@ TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe" GeoInterface = "1.3" HTTP = "0.8, 0.9, 1.8" JSON = "0.21" -julia = "1.5" +julia = "1.5, 1.6, 1.7, 1.8, 1.9" From ee4f4cdc2c0267eebadb7d1eca9430d237bf2ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Sun, 25 Jun 2023 14:09:17 -0400 Subject: [PATCH 5/6] test: move tests in the code --- src/Mangal.jl | 11 +++++++++++ src/backbone.jl | 18 ++++++++++++++++++ src/dataset.jl | 17 +++++++++++++++++ src/login.jl | 4 ++++ src/node.jl | 17 +++++++++++++++++ test/attributes.jl | 11 ----------- test/backbone.jl | 16 ---------------- test/cache.jl | 13 ------------- test/datasets.jl | 22 ---------------------- test/nodes.jl | 16 ---------------- test/users.jl | 8 -------- 11 files changed, 67 insertions(+), 86 deletions(-) delete mode 100644 test/attributes.jl delete mode 100644 test/backbone.jl delete mode 100644 test/cache.jl delete mode 100644 test/datasets.jl delete mode 100644 test/nodes.jl delete mode 100644 test/users.jl diff --git a/src/Mangal.jl b/src/Mangal.jl index b2f894b..d0feccd 100644 --- a/src/Mangal.jl +++ b/src/Mangal.jl @@ -86,4 +86,15 @@ include(joinpath(".", "count.jl")) # Show include(joinpath(".", "show.jl")) +@testitem "We can get data in/out of cache" begin + N = nodes()[1] + n = node(N.id) + @test length(Mangal._MANGAL_CACHES[MangalNode]) != 0 +end + +@testitem "We can get attribute data" begin + @test typeof(attributes()) <: Vector{MangalAttribute} + @test typeof(attribute(6)) <: MangalAttribute +end + end # module diff --git a/src/backbone.jl b/src/backbone.jl index d1f3b34..adc6192 100644 --- a/src/backbone.jl +++ b/src/backbone.jl @@ -7,3 +7,21 @@ function backbone(name::AbstractString) q = backbones(Pair("name", name)) return isequal(1)(length(q)) ? only(q) : nothing end + + +@testitem "We can get data from the backbone" begin + @test typeof(backbones()) <: Vector{MangalReferenceTaxon} +end + +@testitem "We can get data from the backbone with a search" begin + @test typeof(backbones("q" => "Salix")) <: Vector{MangalReferenceTaxon} +end + +@testitem "We can get specific taxa from the backbone" begin + @test backbone(1).name == "Abutilon theophrasti" + @test backbone("Abutilon theophrasti").id == 1 +end + +@testitem "We can get paged data from the backbone" begin + @test length(backbones(Pair("count", 10))) == 10 +end \ No newline at end of file diff --git a/src/dataset.jl b/src/dataset.jl index 69c37cd..c6f896a 100644 --- a/src/dataset.jl +++ b/src/dataset.jl @@ -7,3 +7,20 @@ function dataset(name::AbstractString) q = datasets(Pair("name", name)) return isequal(1)(length(q)) ? only(q) : nothing end + +@testitem "We can get dataset data" begin + @test typeof(datasets()) <: Vector{MangalDataset} + + # Datasets with count + count_2 = datasets(Pair("count", 2)) + @test typeof(count_2) <: Vector{MangalDataset} + @test length(count_2) == 2 + + # Dataset by id + @test typeof(dataset(1)) <: MangalDataset + + # Dataset by name + @test typeof(dataset("roberson_1929")) <: MangalDataset + + @test isnothing(dataset("This_DOESNOT_exist")) +end \ No newline at end of file diff --git a/src/login.jl b/src/login.jl index 3c6d862..f60a3f6 100644 --- a/src/login.jl +++ b/src/login.jl @@ -52,3 +52,7 @@ function login_message() @info msg end + +@testitem "We can get user data" begin + @test typeof(users()) <: Vector{MangalUser} +end \ No newline at end of file diff --git a/src/node.jl b/src/node.jl index 9818269..6680720 100644 --- a/src/node.jl +++ b/src/node.jl @@ -16,8 +16,25 @@ function nodes(taxon::MangalReferenceTaxon, query::Pair...) return nodes(Pair("taxonomy_id", taxon.id), query...) end +@testitem "We can get node data" begin + @test typeof(nodes()) <: Vector{MangalNode} +end + @testitem "We can get nodes of a network" begin N1 = network(19) nN1 = nodes(N1) @test typeof(nN1) <: Vector{MangalNode} +end + + +@testitem "We can get taxonomic data in nodes" begin + n1 = node(2158) + @test typeof(n1) <: MangalNode + @test typeof(n1.taxon) <: MangalReferenceTaxon +end + +@testitem "We can get nodes from backbone data" begin + b1 = backbone(1) + nb1 = nodes(b1) + @test first(nb1).taxon == b1 end \ No newline at end of file diff --git a/test/attributes.jl b/test/attributes.jl deleted file mode 100644 index 0f75fa2..0000000 --- a/test/attributes.jl +++ /dev/null @@ -1,11 +0,0 @@ -module MangalTestAttributes - using Mangal - using Test - include("setup.jl") - - @test typeof(attributes()) <: Vector{MangalAttribute} - - n1 = attribute(6) - @test typeof(n1) <: MangalAttribute - -end diff --git a/test/backbone.jl b/test/backbone.jl deleted file mode 100644 index 1915273..0000000 --- a/test/backbone.jl +++ /dev/null @@ -1,16 +0,0 @@ -module MangalTestBackbone - using Mangal - using Test - include("setup.jl") - - # Backbone only - @test typeof(backbones()) <: Vector{MangalReferenceTaxon} - - @test typeof(backbones("q" => "Salix")) <: Vector{MangalReferenceTaxon} - - @test backbone(1).name == "Abutilon theophrasti" - @test backbone("Abutilon theophrasti").id == 1 - - @test length(backbones(Pair("count", 10))) == 10 - -end diff --git a/test/cache.jl b/test/cache.jl deleted file mode 100644 index 929e563..0000000 --- a/test/cache.jl +++ /dev/null @@ -1,13 +0,0 @@ -module MangalTestCache - using Mangal - using Test - include("setup.jl") - - # random node - N = nodes()[1] - - n = node(N.id) - - @test length(Mangal._MANGAL_CACHES[MangalNode]) != 0 - -end diff --git a/test/datasets.jl b/test/datasets.jl deleted file mode 100644 index 5cced30..0000000 --- a/test/datasets.jl +++ /dev/null @@ -1,22 +0,0 @@ -module MangalTestDataset - using Mangal - using Test - include("setup.jl") - - # Datasets with no arguments - @test typeof(datasets()) <: Vector{MangalDataset} - - # Datasets with count - count_2 = datasets(Pair("count", 2)) - @test typeof(count_2) <: Vector{MangalDataset} - @test length(count_2) == 2 - - # Dataset by id - @test typeof(dataset(1)) <: MangalDataset - - # Dataset by name - @test typeof(dataset("roberson_1929")) <: MangalDataset - - @test isnothing(dataset("This_DOESNOT_exist")) - -end diff --git a/test/nodes.jl b/test/nodes.jl deleted file mode 100644 index c30b599..0000000 --- a/test/nodes.jl +++ /dev/null @@ -1,16 +0,0 @@ -module MangalTestNodes - using Mangal - using Test - include("setup.jl") - - @test typeof(nodes()) <: Vector{MangalNode} - - n1 = node(2158) - @test typeof(n1) <: MangalNode - @test typeof(n1.taxon) <: MangalReferenceTaxon - - b1 = backbone(1) - nb1 = nodes(b1) - @test first(nb1).taxon == b1 - -end diff --git a/test/users.jl b/test/users.jl deleted file mode 100644 index 7c29fbe..0000000 --- a/test/users.jl +++ /dev/null @@ -1,8 +0,0 @@ -module MangalTestUsers - - using Mangal - using Test - - @test typeof(users()) <: Vector{MangalUser} - -end From 9edadd4d42bc7f371bdcde5358ce5916c679cf83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Sun, 25 Jun 2023 14:14:10 -0400 Subject: [PATCH 6/6] doc: update build workflow --- docs/Project.toml | 1 + docs/make.jl | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index b9a15bb..db1dde9 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,3 +1,4 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" +Weave = "44d3d7a6-8a23-5bf8-98c5-b353f8df5ec9" diff --git a/docs/make.jl b/docs/make.jl index b4ea367..6ed9cb5 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -16,7 +16,6 @@ _pkg_doc = [ _pkg_vig = [ "Introduction" => "vignettes/introduction.md", "Counting & paging" => "vignettes/counting.md", - "Network analysis" => "vignettes/ecologicalnetworks.md" ] _list_of_pages = [ @@ -34,6 +33,6 @@ makedocs( deploydocs( deps = Deps.pip("pygments", "python-markdown-math"), - repo = "github.com/EcoJulia/Mangal.jl.git", - devbranch = "master" + repo = "github.com/PoisotLab/Mangal.jl.git", + devbranch = "main" )