File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 71
71
import pytest
72
72
from pytest import WarningsRecorder
73
73
74
- from git .cmd import Git
74
+ from git .cmd import Git , GitMeta
75
75
76
76
_USE_SHELL_DEPRECATED_FRAGMENT = "Git.USE_SHELL is deprecated"
77
77
"""Text contained in all USE_SHELL deprecation warnings, and starting most of them."""
@@ -391,3 +391,15 @@ def test_instance_dir() -> None:
391
391
instance = Git ()
392
392
actual = set (dir (instance ))
393
393
assert _EXPECTED_DIR_SUBSET <= actual
394
+
395
+
396
+ def test_metaclass_alias () -> None :
397
+ """GitMeta aliases Git's metaclass, whether that is type or a custom metaclass."""
398
+
399
+ def accept_metaclass_instance (cls : GitMeta ) -> None :
400
+ """Check that cls is statically recognizable as an instance of GitMeta."""
401
+
402
+ accept_metaclass_instance (Git ) # assert_type would expect Type[Git], not GitMeta.
403
+
404
+ # This comes after the static check, just in case it would affect the inference.
405
+ assert type (Git ) is GitMeta
You can’t perform that action at this time.
0 commit comments