Skip to content

Commit fc10795

Browse files
committed
tests: add data_loader test
1 parent 8b13b27 commit fc10795

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

geos-trame/tests/test_data_loader.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies.
3+
# SPDX-FileContributor: Kitware
4+
# ruff: noqa
5+
import pyvista as pv
6+
from pathlib import Path
7+
8+
from trame_server import Server
9+
from trame_server.state import State
10+
from trame_vuetify.ui.vuetify3 import VAppLayout
11+
12+
from geos.trame.app.core import GeosTrame
13+
from tests.trame_fixtures import trame_server_layout, trame_state
14+
15+
16+
def test_data_loader( trame_server_layout: tuple[ Server, VAppLayout ], trame_state: State ) -> None:
17+
root_path = Path( __file__ ).parent.absolute().__str__()
18+
file_name = root_path + "/data/geosDeck/geosDeck.xml"
19+
20+
geos_trame = GeosTrame( trame_server_layout[ 0 ], file_name )
21+
22+
geos_trame.data_loader.load_vtkmesh_from_id( "Problem/Mesh/0/VTKMesh/0" )
23+
ug: pv.UnstructuredGrid = geos_trame.data_loader.region_viewer.input
24+
assert ug.GetCellData().HasArray( "attribute" )
25+
assert ug.GetPointData().HasArray( "RandomPointScalars" )
26+
assert not ug.GetPointData().HasArray( "RandomPointVectors" )
27+
assert ug.GetPointData().HasArray( "RandomPointVectors_0" )
28+
assert ug.GetPointData().HasArray( "RandomPointVectors_1" )
29+
assert ug.GetPointData().HasArray( "RandomPointVectors_2" )
30+
assert not ug.GetPointData().HasArray( "RandomPointVectors_3" )

0 commit comments

Comments
 (0)