Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8327b45

Browse filesBrowse files
committed
Test GitMeta alias
1 parent f92f4c3 commit 8327b45
Copy full SHA for 8327b45

File tree

1 file changed

+13
-1
lines changed
Filter options

1 file changed

+13
-1
lines changed

‎test/deprecation/test_cmd_git.py

Copy file name to clipboardExpand all lines: test/deprecation/test_cmd_git.py
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
import pytest
7070
from pytest import WarningsRecorder
7171

72-
from git.cmd import Git
72+
from git.cmd import Git, GitMeta
7373

7474
from .lib import assert_no_deprecation_warning, suppress_deprecation_warning
7575

@@ -377,3 +377,15 @@ def test_instance_dir() -> None:
377377
instance = Git()
378378
actual = set(dir(instance))
379379
assert _EXPECTED_DIR_SUBSET <= actual
380+
381+
382+
def test_metaclass_alias() -> None:
383+
"""GitMeta aliases Git's metaclass, whether that is type or a custom metaclass."""
384+
385+
def accept_metaclass_instance(cls: GitMeta) -> None:
386+
"""Check that cls is statically recognizable as an instance of GitMeta."""
387+
388+
accept_metaclass_instance(Git) # assert_type would expect Type[Git], not GitMeta.
389+
390+
# This comes after the static check, just in case it would affect the inference.
391+
assert type(Git) is GitMeta

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.