Skip to content

Commit 6ff2102

Browse files
committed
Test GitMeta alias
1 parent b51b080 commit 6ff2102

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/deprecation/test_cmd_git.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
import pytest
7272
from pytest import WarningsRecorder
7373

74-
from git.cmd import Git
74+
from git.cmd import Git, GitMeta
7575

7676
_USE_SHELL_DEPRECATED_FRAGMENT = "Git.USE_SHELL is deprecated"
7777
"""Text contained in all USE_SHELL deprecation warnings, and starting most of them."""
@@ -391,3 +391,15 @@ def test_instance_dir() -> None:
391391
instance = Git()
392392
actual = set(dir(instance))
393393
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

0 commit comments

Comments
 (0)