Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pandas/tests/extension/base/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ def test_combine_le(self, data_repeated):
result = s1.combine(s2, lambda x1, x2: x1 <= x2)
expected = pd.Series(
pd.array(
[a <= b for (a, b) in zip(list(orig_data1), list(orig_data2))],
[
a <= b
for (a, b) in zip(list(orig_data1), list(orig_data2), strict=True)
],
dtype=self._combine_le_expected_dtype,
)
)
Expand All @@ -369,7 +372,7 @@ def test_combine_le(self, data_repeated):
def _construct_for_combine_add(self, left, right):
if isinstance(right, type(left)):
return left._from_sequence(
[a + b for (a, b) in zip(list(left), list(right))],
[a + b for (a, b) in zip(list(left), list(right), strict=True)],
dtype=left.dtype,
)
else:
Expand Down Expand Up @@ -627,7 +630,7 @@ def test_repeat(self, data, repeats, as_series, use_numpy):
result = np.repeat(arr, repeats) if use_numpy else arr.repeat(repeats)

repeats = [repeats] * 3 if isinstance(repeats, int) else repeats
expected = [x for x, n in zip(arr, repeats) for _ in range(n)]
expected = [x for x, n in zip(arr, repeats, strict=True) for _ in range(n)]
expected = type(data)._from_sequence(expected, dtype=data.dtype)
if as_series:
expected = pd.Series(expected, index=arr.index.repeat(repeats))
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/date/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def __setitem__(self, key: int | slice | np.ndarray, value: Any) -> None:
self._day[key] = value.day

def __repr__(self) -> str:
return f"DateArray{list(zip(self._year, self._month, self._day))}"
return f"DateArray{list(zip(self._year, self._month, self._day, strict=True))}"

def copy(self) -> DateArray:
return DateArray((self._year.copy(), self._month.copy(), self._day.copy()))
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/decimal/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def convert_values(param):

# If the operator is not defined for the underlying objects,
# a TypeError should be raised
res = [op(a, b) for (a, b) in zip(lvalues, rvalues)]
res = [op(a, b) for (a, b) in zip(lvalues, rvalues, strict=True)]

return np.asarray(res, dtype=bool)

Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/extension/json/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __getitem__(self, item):
item = pd.api.indexers.check_array_indexer(self, item)
if is_bool_dtype(item.dtype):
return type(self)._from_sequence(
[x for x, m in zip(self, item) if m], dtype=self.dtype
[x for x, m in zip(self, item, strict=True) if m], dtype=self.dtype
)
# integer
return type(self)([self.data[i] for i in item])
Expand All @@ -146,12 +146,12 @@ def __setitem__(self, key, value) -> None:

if isinstance(key, np.ndarray) and key.dtype == "bool":
# masking
for i, (k, v) in enumerate(zip(key, value)):
for i, (k, v) in enumerate(zip(key, value, strict=False)):
if k:
assert isinstance(v, self.dtype.type)
self.data[i] = v
else:
for k, v in zip(key, value):
for k, v in zip(key, value, strict=False):
assert isinstance(v, self.dtype.type)
self.data[k] = v

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _construct_for_combine_add(self, left, right):

if isinstance(right, type(left)):
return left._from_sequence(
[a + b for (a, b) in zip(list(left), list(right))],
[a + b for (a, b) in zip(list(left), list(right), strict=True)],
dtype=dtype,
)
else:
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_combine_add(self, data_repeated):
s2 = pd.Series(orig_data2)
result = s1.combine(s2, lambda x1, x2: x1 + x2)
expected = pd.Series(
[a + b for (a, b) in zip(list(orig_data1), list(orig_data2))]
[a + b for (a, b) in zip(list(orig_data1), list(orig_data2), strict=True)]
)
tm.assert_series_equal(result, expected)

Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/extension/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
def make_data(n: int):
left_array = np.random.default_rng(2).uniform(size=n).cumsum()
right_array = left_array + np.random.default_rng(2).uniform(size=n)
return [Interval(left, right) for left, right in zip(left_array, right_array)]
return [
Interval(left, right)
for left, right in zip(left_array, right_array, strict=True)
]


@pytest.fixture
Expand Down
Loading