File tree 1 file changed +18
-0
lines changed 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
+ import sys
4
+
3
5
import pytest
4
6
5
7
from jsonargparse import set_parsing_settings
6
8
from jsonargparse ._optionals import (
7
9
_get_config_read_mode ,
8
10
docstring_parser_support ,
11
+ final ,
9
12
fsspec_support ,
10
13
get_docstring_parse_options ,
11
14
import_docstring_parser ,
19
22
ruyaml_support ,
20
23
url_support ,
21
24
)
25
+ from jsonargparse .typing import is_final_class
22
26
from jsonargparse_tests .conftest import (
23
27
skip_if_docstring_parser_unavailable ,
24
28
skip_if_fsspec_unavailable ,
@@ -176,3 +180,17 @@ def test_config_read_mode_fsspec_support_false():
176
180
assert "fr" == _get_config_read_mode ()
177
181
set_parsing_settings (config_read_mode_fsspec_enabled = False )
178
182
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