@@ -641,6 +641,92 @@ def test_return_types_of_operations_on_named_objects(mixing_elbow_settings_sessi
641641 assert var3 .obj_name == "air-copied"
642642
643643
644+ @pytest .mark .skip ("https://github.com/ansys/pyfluent/issues/3813" )
645+ @pytest .mark .fluent_version (">=25.1" )
646+ def test_settings_with_deprecated_flag (mixing_elbow_settings_session ):
647+ solver = mixing_elbow_settings_session
648+ solver .settings .solution .initialization .hybrid_initialize ()
649+ graphics = solver .settings .results .graphics
650+ graphics .contour ["contour-velocity" ] = {
651+ "field" : "velocity-magnitude" ,
652+ "surfaces_list" : ["wall-elbow" ],
653+ }
654+ # In the line below, "range_option" and "coloring" are deprecated.
655+ if solver .get_fluent_version () <= FluentVersion .v251 :
656+ # From v252 'get_state' behaviour is to be corrected in Fluent.
657+ assert {"range_option" , "range_options" , "coloring" , "colorings" }.issubset (
658+ set (graphics .contour ["contour-velocity" ]())
659+ )
660+ assert (
661+ graphics .contour ["contour-velocity" ].range_option .get_attr ("deprecated-version" )
662+ == "25.1"
663+ )
664+ assert (
665+ graphics .contour ["contour-velocity" ].coloring .get_attr ("deprecated-version" )
666+ == "25.1"
667+ )
668+
669+ # Deprecated objects should not be active
670+ assert not graphics .contour ["contour-velocity" ].range_option .is_active ()
671+ assert graphics .contour ["contour-velocity" ].range_options .is_active ()
672+
673+ # in 'get_state'
674+ if solver .get_fluent_version () >= FluentVersion .v252 :
675+ # From v252 'get_state' behaviour is to be corrected in Fluent.
676+ assert not {"range_option" , "coloring" }.issubset (
677+ set (graphics .contour ["contour-velocity" ].get_state ())
678+ )
679+ assert {"range_options" , "colorings" }.issubset (
680+ set (graphics .contour ["contour-velocity" ].get_state ())
681+ )
682+ else :
683+ assert {"range_option" , "range_options" , "coloring" , "colorings" }.issubset (
684+ set (graphics .contour ["contour-velocity" ].get_state ())
685+ )
686+
687+ # in 'child_names'
688+ # 'child_names', 'command_names' and 'query_names' will remain unchanged.
689+ assert {"range_option" , "range_options" , "coloring" , "colorings" }.issubset (
690+ set (graphics .contour ["contour-velocity" ].child_names )
691+ )
692+
693+ # in 'get_active_child_names'
694+ assert not {"range_option" , "coloring" }.issubset (
695+ set (graphics .contour ["contour-velocity" ].get_active_child_names ())
696+ )
697+ assert {"range_options" , "colorings" }.issubset (
698+ set (graphics .contour ["contour-velocity" ].get_active_child_names ())
699+ )
700+
701+ # in 'dir'
702+ assert not {"range_option" , "coloring" }.issubset (
703+ set (dir (graphics .contour ["contour-velocity" ]))
704+ )
705+ assert {"range_options" , "colorings" }.issubset (
706+ set (dir (graphics .contour ["contour-velocity" ]))
707+ )
708+
709+ # This should be True, as attribute is present, just not exposed.
710+ for item in ["range_option" , "range_options" , "coloring" , "colorings" ]:
711+ assert hasattr (graphics .contour ["contour-velocity" ], item )
712+
713+ # Named-object
714+ solver .settings .solution .report_definitions .surface ["report-def-1" ] = {}
715+ solver .settings .solution .report_definitions .surface ["report-def-1" ].report_type = (
716+ "surface-area"
717+ )
718+ solver .settings .solution .report_definitions .surface [
719+ "report-def-1"
720+ ].surface_names = ["cold-inlet" , "hot-inlet" ]
721+ assert "create_output_parameter" not in dir (
722+ solver .settings .solution .report_definitions .surface ["report-def-1" ]
723+ )
724+ assert hasattr (
725+ solver .settings .solution .report_definitions .surface ["report-def-1" ],
726+ "create_output_parameter" ,
727+ )
728+
729+
644730@pytest .fixture
645731def use_runtime_python_classes (monkeypatch : pytest .MonkeyPatch ):
646732 monkeypatch .setenv ("PYFLUENT_USE_RUNTIME_PYTHON_CLASSES" , "1" )
0 commit comments