File tree Expand file tree Collapse file tree
simpeg_drivers/plate_simulation/models
tests/plate_simulation/runtest Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616from pydantic import (
1717 BaseModel ,
1818 ConfigDict ,
19+ Field ,
1920 ValidationInfo ,
2021 field_validator ,
2122 model_validator ,
@@ -46,7 +47,7 @@ class PlateOptions(BaseModel):
4647 model_config = ConfigDict (arbitrary_types_allowed = True )
4748
4849 name : str = "Plate"
49- plate_property : float
50+ plate_property : float = Field ( validation_alias = "plate" )
5051 geometry : PlateModel
5152 number : int = 1
5253 spacing : float = 0.0
@@ -124,7 +125,7 @@ class OverburdenOptions(BaseModel):
124125 """
125126
126127 thickness : float
127- overburden_property : float
128+ overburden_property : float = Field ( validation_alias = "overburden" )
128129
129130
130131class ModelOptions (BaseModel ):
Original file line number Diff line number Diff line change @@ -55,7 +55,11 @@ def test_gravity_plate_simulation(tmp_path):
5555 plate_refinement = [4 , 2 ],
5656 )
5757
58- overburden_params = OverburdenOptions (thickness = 50.0 , overburden_property = 0.2 )
58+ overburden_params = OverburdenOptions (
59+ thickness = 50.0 ,
60+ overburden = 0.2 , # tests alias handling
61+ )
62+ assert overburden_params .overburden_property == 0.2
5963
6064 plate_params = PlateOptions (
6165 name = "plate" ,
You can’t perform that action at this time.
0 commit comments