diff --git a/test/deprecation/test_cmd_git.py b/test/deprecation/test_cmd_git.py index 6c592454a..e44490273 100644 --- a/test/deprecation/test_cmd_git.py +++ b/test/deprecation/test_cmd_git.py @@ -69,7 +69,7 @@ import pytest from pytest import WarningsRecorder -from git.cmd import Git +from git.cmd import Git, GitMeta from .lib import assert_no_deprecation_warning, suppress_deprecation_warning @@ -377,3 +377,15 @@ def test_instance_dir() -> None: instance = Git() actual = set(dir(instance)) assert _EXPECTED_DIR_SUBSET <= actual + + +def test_metaclass_alias() -> None: + """GitMeta aliases Git's metaclass, whether that is type or a custom metaclass.""" + + def accept_metaclass_instance(cls: GitMeta) -> None: + """Check that cls is statically recognizable as an instance of GitMeta.""" + + accept_metaclass_instance(Git) # assert_type would expect Type[Git], not GitMeta. + + # This comes after the static check, just in case it would affect the inference. + assert type(Git) is GitMeta