77
88
99@pytest .fixture ()
10- def example_seg_method () -> seg_methods .UniformWater :
11- return seg_methods .UniformWater ()
10+ def example_seg_method () -> seg_methods .UniformSegmentation :
11+ return seg_methods .UniformSegmentation (
12+ materials = {
13+ 'water' : Material (
14+ name = "water" ,
15+ sound_speed = 1500.0 ,
16+ density = 1000.0 ,
17+ attenuation = 0.0 ,
18+ specific_heat = 4182.0 ,
19+ thermal_conductivity = 0.598
20+ ),
21+ 'skull' : Material (
22+ name = "skull" ,
23+ sound_speed = 4080.0 ,
24+ density = 1900.0 ,
25+ attenuation = 0.0 ,
26+ specific_heat = 1100.0 ,
27+ thermal_conductivity = 0.3
28+ ),
29+ },
30+ ref_material = 'water' ,
31+ )
1232
1333def test_seg_method_dict_conversion (example_seg_method : seg_methods .UniformSegmentation ):
1434 assert SegmentationMethod .from_dict (example_seg_method .to_dict ()) == example_seg_method
@@ -19,9 +39,27 @@ def test_seg_method_no_instantiate_abstract_class():
1939
2040def test_uniform_seg_method_no_reference_material ():
2141 with pytest .raises (ValueError , match = "Reference material non_existent_material not found." ):
22- seg_method = seg_methods .UniformWater ()
23- seg_method .ref_material = 'non_existent_material'
24- seg_method .__post_init__ ()
42+ UniformSegmentation (
43+ materials = {
44+ 'water' : Material (
45+ name = "water" ,
46+ sound_speed = 1500.0 ,
47+ density = 1000.0 ,
48+ attenuation = 0.0 ,
49+ specific_heat = 4182.0 ,
50+ thermal_conductivity = 0.598
51+ ),
52+ 'skull' : Material (
53+ name = "skull" ,
54+ sound_speed = 4080.0 ,
55+ density = 1900.0 ,
56+ attenuation = 0.0 ,
57+ specific_heat = 1100.0 ,
58+ thermal_conductivity = 0.3
59+ ),
60+ },
61+ ref_material = 'non_existent_material' ,
62+ )
2563
2664def test_uniformwater_errors_when_specify_ref_material ():
2765 with pytest .raises (TypeError ):
@@ -30,5 +68,5 @@ def test_uniformwater_errors_when_specify_ref_material():
3068 )
3169
3270def test_materials_as_none_gets_default_materials ():
33- seg_method = seg_methods .UniformWater (materials = None ) # pyright: ignore[reportArgumentType]
71+ seg_method = seg_methods .UniformSegmentation (materials = None ) # pyright: ignore[reportArgumentType]
3472 assert seg_method .materials == MATERIALS .copy ()
0 commit comments