Skip to content

Commit

Permalink
Update test_namedarray.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Aug 5, 2024
1 parent f4ee1f9 commit e01a16e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion xarray/tests/test_namedarray.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import copy
import sys
from abc import abstractmethod
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, Generic, cast, overload
Expand Down Expand Up @@ -90,7 +91,13 @@ def check_duck_array_typevar(a: duckarray[Any, _DType]) -> duckarray[Any, _DType
missing_attrs = ""
actual_attrs = set(dir(b))
for t in _arrayfunction_or_api:
expected_attrs = t.__protocol_attrs__
if sys.version_info >= (3, 11):
expected_attrs = t.__protocol_attrs__
else:
from typing import _get_protocol_attrs

expected_attrs = _get_protocol_attrs(t)

missing_attrs_ = expected_attrs - actual_attrs
if missing_attrs_:
missing_attrs += f"{t.__name__} - {missing_attrs_}\n"
Expand Down

0 comments on commit e01a16e

Please sign in to comment.