@@ -139,6 +139,66 @@ def test_add_invalid_transform(self, graph: NeuromapsGraph) -> None:
139139 with pytest .raises (TypeError , match = "Unsupported transform type" ):
140140 graph .add_transform ("invalid" , key = "key" ) # type: ignore[arg-type]
141141
142+ def test_add_missing_atlas_space (self , graph : NeuromapsGraph ) -> None :
143+ """Test adding atlas with an invalid space."""
144+ atlas = models .SurfaceAtlas (
145+ name = "Test" ,
146+ description = "Test" ,
147+ file_path = Path ("." ),
148+ space = "invalid" ,
149+ density = "10k" ,
150+ hemisphere = "left" ,
151+ resource_type = "test" ,
152+ )
153+ with pytest .raises (ValueError , match = "not found" ):
154+ graph .add_atlas (atlas )
155+
156+ def test_add_invalid_atlas_type (self , graph : NeuromapsGraph ) -> None :
157+ """Test adding invalid atlas raises error."""
158+ with pytest .raises (TypeError , match = "Unsupported atlas type" ):
159+ graph .add_atlas ("invalid" ) # type: ignore [arg-type]
160+
161+ def test_add_surface_atlas (self , graph : NeuromapsGraph ) -> None :
162+ """Test adding surface atlas."""
163+ atlas = models .SurfaceAtlas (
164+ name = "Test" ,
165+ description = "Test" ,
166+ file_path = Path ("." ),
167+ space = "Yerkes19" ,
168+ density = "10k" ,
169+ hemisphere = "left" ,
170+ resource_type = "test" ,
171+ )
172+ graph .add_atlas (atlas )
173+ assert atlas in graph .nodes ["Yerkes19" ]["data" ].surfaces
174+ assert atlas not in graph .nodes ["Yerkes19" ]["data" ].volumes
175+ assert (
176+ graph ._cache .get_surface_atlas (
177+ atlas .space , atlas .density , atlas .hemisphere , atlas .resource_type
178+ )
179+ == atlas
180+ )
181+
182+ def test_add_volume_atlas (self , graph : NeuromapsGraph ) -> None :
183+ """Test adding volume atlas."""
184+ atlas = models .VolumeAtlas (
185+ name = "Test" ,
186+ description = "Test" ,
187+ file_path = Path ("." ),
188+ space = "Yerkes19" ,
189+ resolution = "1mm" ,
190+ resource_type = "test" ,
191+ )
192+ graph .add_atlas (atlas )
193+ assert atlas not in graph .nodes ["Yerkes19" ]["data" ].surfaces
194+ assert atlas in graph .nodes ["Yerkes19" ]["data" ].volumes
195+ assert (
196+ graph ._cache .get_volume_atlas (
197+ atlas .space , atlas .resolution , atlas .resource_type
198+ )
199+ == atlas
200+ )
201+
142202 def test_fetch_volume_atlas (self , graph : NeuromapsGraph ) -> None :
143203 """Test fetching volume atlas."""
144204 atlas = graph .fetch_volume_atlas (
0 commit comments