File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import sys
4+
35import pytest
46
57from jsonargparse import set_parsing_settings
68from jsonargparse ._optionals import (
79 _get_config_read_mode ,
810 docstring_parser_support ,
11+ final ,
912 fsspec_support ,
1013 get_docstring_parse_options ,
1114 import_docstring_parser ,
1922 ruyaml_support ,
2023 url_support ,
2124)
25+ from jsonargparse .typing import is_final_class
2226from jsonargparse_tests .conftest import (
2327 skip_if_docstring_parser_unavailable ,
2428 skip_if_fsspec_unavailable ,
@@ -176,3 +180,17 @@ def test_config_read_mode_fsspec_support_false():
176180 assert "fr" == _get_config_read_mode ()
177181 set_parsing_settings (config_read_mode_fsspec_enabled = False )
178182 assert "fr" == _get_config_read_mode ()
183+
184+
185+ # final decorator tests
186+
187+
188+ @final
189+ class FinalClass :
190+ pass
191+
192+
193+ @pytest .mark .skipif (sys .version_info < (3 , 11 ), reason = "final decorator __final__ introduced in python 3.11" )
194+ def test_final_decorator ():
195+ assert is_final_class (FinalClass ) is True
196+ assert is_final_class (test_final_decorator ) is False
You can’t perform that action at this time.
0 commit comments