@@ -8,6 +8,14 @@ using DataSets:
8
8
StackedDataProject,
9
9
project_name
10
10
11
+ test_project_names = [" a_table" ,
12
+ " a_text_file" ,
13
+ " a_tree_example" ,
14
+ " embedded_blob" ,
15
+ " embedded_tree" ,
16
+ " old_backend_blob" ,
17
+ " old_backend_tree" ]
18
+
11
19
@testset " TomlFileDataProject" begin
12
20
proj = TomlFileDataProject (abspath (" Data.toml" ))
13
21
# getindex, get
@@ -16,13 +24,13 @@ using DataSets:
16
24
@test isnothing (get (proj, " nonexistent_data" , nothing ))
17
25
18
26
# keys
19
- @test sort (collect (keys (proj))) == [ " a_table " , " a_text_file " , " a_tree_example " , " embedded_blob " , " embedded_tree " , " old_backend_blob " , " old_backend_tree " ]
27
+ @test sort (collect (keys (proj))) == test_project_names
20
28
@test haskey (proj, " a_text_file" )
21
29
@test ! haskey (proj, " nonexistent_data" )
22
30
23
31
# iteration
24
- @test sort (getproperty .(collect (proj), :name )) == [ " a_table " , " a_text_file " , " a_tree_example " , " embedded_blob " , " embedded_tree " , " old_backend_blob " , " old_backend_tree " ]
25
- @test sort (first .(pairs (proj))) == [ " a_table " , " a_text_file " , " a_tree_example " , " embedded_blob " , " embedded_tree " , " old_backend_blob " , " old_backend_tree " ]
32
+ @test sort (getproperty .(collect (proj), :name )) == test_project_names
33
+ @test sort (first .(pairs (proj))) == test_project_names
26
34
27
35
# identity
28
36
@test project_name (proj) == abspath (" Data.toml" )
99
107
push! (proj, TomlFileDataProject (joinpath (@__DIR__ , " active_project" , " Data.toml" )))
100
108
push! (proj, TomlFileDataProject (joinpath (@__DIR__ , " Data.toml" )))
101
109
102
- @test sort (collect (keys (proj))) == [ " a_table " , " a_text_file " , " a_tree_example " , " embedded_blob " , " embedded_tree " , " old_backend_blob " , " old_backend_tree " ]
110
+ @test sort (collect (keys (proj))) == test_project_names
103
111
# Data "a_text_file" should be found in the first project in the stack,
104
112
# overriding the data of the same name in the second project.
105
113
@test proj[" a_text_file" ]. uuid == UUID (" 314996ef-12be-40d0-912c-9755af354fdb" )
123
131
124
132
# Test that __init__ takes global DataSets.PROJECT from ENV
125
133
empty! (DataSets. PROJECT)
126
- ENV [" JULIA_DATASETS_PATH" ] = datasets_paths
134
+ ENV [" JULIA_DATASETS_PATH" ] = @__DIR__
127
135
DataSets. __init__ ()
128
- @test DataSets. PROJECT. projects[1 ] isa ActiveDataProject
129
- @test DataSets. PROJECT. projects[2 ] isa TomlFileDataProject
130
- @test DataSets. PROJECT. projects[3 ] isa TomlFileDataProject
136
+ @test DataSets. PROJECT. projects[1 ] isa TomlFileDataProject
137
+ @test project_name (DataSets. PROJECT. projects[1 ]) == joinpath (@__DIR__ , " Data.toml" )
131
138
end
132
139
0 commit comments