|  | 
| 1 | 1 | 
 | 
| 2 |  | -@testset "constructor" begin | 
|  | 2 | +@testitem "constructor" begin | 
| 3 | 3 |     @test_throws AssertionError DataStore(10, (:x => rand(10), :y => rand(2, 4))) | 
| 4 | 4 | 
 | 
| 5 | 5 |     @testset "keyword args" begin | 
|  | 
| 13 | 13 |     end | 
| 14 | 14 | end | 
| 15 | 15 | 
 | 
| 16 |  | -@testset "getproperty / setproperty!" begin | 
|  | 16 | +@testitem "getproperty / setproperty!" begin | 
| 17 | 17 |     x = rand(10) | 
| 18 | 18 |     ds = DataStore(10, (:x => x, :y => rand(2, 10))) | 
| 19 | 19 |     @test ds.x == ds[:x] == x | 
|  | 
| 25 | 25 |     @test fill(DataStore(), 3) isa Vector | 
| 26 | 26 | end | 
| 27 | 27 | 
 | 
| 28 |  | -@testset "setindex!" begin | 
|  | 28 | +@testitem "setindex!" begin | 
| 29 | 29 |     ds = DataStore(10) | 
| 30 | 30 |     x = rand(10) | 
| 31 | 31 |     @test (ds[:x] = x) == x # Tests setindex! | 
| 32 | 32 |     @test ds.x == ds[:x] == x | 
| 33 | 33 | end | 
| 34 | 34 | 
 | 
| 35 |  | -@testset "map" begin | 
|  | 35 | +@testitem "map" begin | 
| 36 | 36 |     ds = DataStore(10, (:x => rand(10), :y => rand(2, 10))) | 
| 37 | 37 |     ds2 = map(x -> x .+ 1, ds) | 
| 38 | 38 |     @test ds2.x == ds.x .+ 1 | 
|  | 
| 41 | 41 |     @test_throws AssertionError ds2=map(x -> [x; x], ds) | 
| 42 | 42 | end | 
| 43 | 43 | 
 | 
| 44 |  | -@testset "getdata / getn" begin | 
|  | 44 | +@testitem "getdata / getn" begin | 
| 45 | 45 |     ds = DataStore(10, (:x => rand(10), :y => rand(2, 10))) | 
| 46 |  | -    @test getdata(ds) == getfield(ds, :_data) | 
|  | 46 | +    @test GNNGraphs.getdata(ds) == getfield(ds, :_data) | 
| 47 | 47 |     @test_throws KeyError ds.data | 
| 48 |  | -    @test getn(ds) == getfield(ds, :_n) | 
|  | 48 | +    @test GNNGraphs.getn(ds) == getfield(ds, :_n) | 
| 49 | 49 |     @test_throws KeyError ds.n | 
| 50 | 50 | end | 
| 51 | 51 | 
 | 
| 52 |  | -@testset "cat empty" begin | 
|  | 52 | +@testitem "cat empty" begin | 
| 53 | 53 |     ds1 = DataStore(2, (:x => rand(2))) | 
| 54 | 54 |     ds2 = DataStore(1, (:x => rand(1))) | 
| 55 | 55 |     dsempty = DataStore(0, (:x => rand(0))) | 
| 56 | 56 | 
 | 
| 57 | 57 |     ds = GNNGraphs.cat_features(ds1, ds2) | 
| 58 |  | -    @test getn(ds) == 3 | 
|  | 58 | +    @test GNNGraphs.getn(ds) == 3 | 
| 59 | 59 |     ds = GNNGraphs.cat_features(ds1, dsempty) | 
| 60 |  | -    @test getn(ds) == 2 | 
|  | 60 | +    @test GNNGraphs.getn(ds) == 2 | 
| 61 | 61 | 
 | 
| 62 | 62 |     # issue #280 | 
| 63 | 63 |     g = GNNGraph([1], [2]) | 
| 64 | 64 |     h = add_edges(g, Int[], Int[])  # adds no edges | 
| 65 |  | -    @test getn(g.edata) == 1 | 
| 66 |  | -    @test getn(h.edata) == 1 | 
|  | 65 | +    @test GNNGraphs.getn(g.edata) == 1 | 
|  | 66 | +    @test GNNGraphs.getn(h.edata) == 1 | 
| 67 | 67 | end | 
| 68 | 68 | 
 | 
| 69 | 69 | 
 | 
| 70 |  | -@testset "gradient" begin | 
|  | 70 | +@testitem "gradient"  setup=[GraphsTestModule] begin | 
|  | 71 | +    using .GraphsTestModule | 
| 71 | 72 |     ds = DataStore(10, (:x => rand(10), :y => rand(2, 10))) | 
| 72 | 73 | 
 | 
| 73 | 74 |     f1(ds) = sum(ds.x) | 
|  | 
| 80 | 81 |     @test grad == exp.(x) | 
| 81 | 82 | end | 
| 82 | 83 | 
 | 
| 83 |  | -@testset "functor" begin | 
|  | 84 | +@testitem "functor" begin | 
|  | 85 | +    using Functors | 
| 84 | 86 |     ds = DataStore(10, (:x => zeros(10), :y => ones(2, 10))) | 
| 85 | 87 |     p, re = Functors.functor(ds) | 
| 86 |  | -    @test p[1] === getn(ds) | 
| 87 |  | -    @test p[2] === getdata(ds) | 
|  | 88 | +    @test p[1] === GNNGraphs.getn(ds) | 
|  | 89 | +    @test p[2] === GNNGraphs.getdata(ds) | 
| 88 | 90 |     @test ds == re(p) | 
| 89 | 91 | 
 | 
| 90 | 92 |     ds2 = Functors.fmap(ds) do x | 
|  | 
0 commit comments