Fix platform-dependent type-check errors (#11345)

Use more explicit `sys.platform` checks, instead of the previous check using `in`, which mypy understands.

Fixes #11343
This commit is contained in:
Warren Markham
2023-08-27 22:40:24 +10:00
committed by GitHub
parent 00fedcc439
commit ff23347f1f
2 changed files with 19 additions and 9 deletions

View File

@@ -291,7 +291,8 @@ class TestParser:
def test_argcomplete(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
try:
encoding = locale.getencoding() # New in Python 3.11, ignores utf-8 mode
# New in Python 3.11, ignores utf-8 mode
encoding = locale.getencoding() # type: ignore[attr-defined]
except AttributeError:
encoding = locale.getpreferredencoding(False)
try: