Skip to content

Commit

Permalink
Test GitMeta alias
Browse files Browse the repository at this point in the history
  • Loading branch information
EliahKagan committed Mar 30, 2024
1 parent cf2576e commit 10e0fc2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/deprecation/test_cmd_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit 10e0fc2

Please sign in to comment.