@@ -242,6 +242,41 @@ def test_rocket_encoder(rocket_name, request):
242242 )
243243
244244
245+ @pytest .mark .parametrize (
246+ "fin_name" ,
247+ [
248+ "calisto_trapezoidal_fins" ,
249+ "calisto_trapezoidal_fins_custom_sweep_length" ,
250+ "calisto_trapezoidal_fins_custom_sweep_angle" ,
251+ ],
252+ )
253+ def test_trapezoidal_fins_encoder (fin_name , request ):
254+ """Test encoding a ``rocketpy.TrapezoidalFins``.
255+
256+ Parameters
257+ ----------
258+ fin_name : str
259+ Name of the fin fixture to encode.
260+ request : pytest.FixtureRequest
261+ Pytest request object.
262+ """
263+ fin_to_encode = request .getfixturevalue (fin_name )
264+
265+ json_encoded = json .dumps (fin_to_encode , cls = RocketPyEncoder )
266+
267+ fin_loaded = json .loads (json_encoded , cls = RocketPyDecoder )
268+
269+ assert isinstance (fin_loaded , type (fin_to_encode ))
270+ assert fin_to_encode .n == fin_loaded .n
271+ assert np .isclose (fin_to_encode .span , fin_loaded .span )
272+ assert np .isclose (fin_to_encode .root_chord , fin_loaded .root_chord )
273+ assert np .isclose (fin_to_encode .tip_chord , fin_loaded .tip_chord )
274+ assert np .isclose (fin_to_encode .rocket_radius , fin_loaded .rocket_radius )
275+ assert np .isclose (fin_to_encode .sweep_length , fin_loaded .sweep_length )
276+ if fin_to_encode ._sweep_angle is not None and fin_loaded ._sweep_angle is not None :
277+ assert np .isclose (fin_to_encode .sweep_angle , fin_loaded .sweep_angle )
278+
279+
245280@pytest .mark .parametrize ("rocket_name" , ["calisto_robust" , "calisto_hybrid_modded" ])
246281def test_encoder_discretize (rocket_name , request ):
247282 """Test encoding the total mass of ``rocketpy.Rocket`` with
0 commit comments