Skip to content

Commit 0ff1247

Browse files
committed
Fix zip(strict=...) errors: set strict=False where needed
1 parent a366b8c commit 0ff1247

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

pandas/tests/extension/json/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ def __setitem__(self, key, value) -> None:
135135

136136
if isinstance(key, np.ndarray) and key.dtype == "bool":
137137
# masking
138-
for i, (k, v) in enumerate(zip(key, value, strict=True)):
138+
for i, (k, v) in enumerate(zip(key, value, strict=False)):
139139
if k:
140140
assert isinstance(v, self.dtype.type)
141141
self.data[i] = v
142142
else:
143-
for k, v in zip(key, value, strict=True):
143+
for k, v in zip(key, value, strict=False):
144144
assert isinstance(v, self.dtype.type)
145145
self.data[k] = v
146146

pandas/tests/frame/methods/test_drop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def test_drop(self):
144144

145145
# non-unique - wheee!
146146
nu_df = DataFrame(
147-
list(zip(range(3), range(-3, 1), list("abc"), strict=True)),
147+
list(zip(range(3), range(-3, 1), list("abc"), strict=False)),
148148
columns=["a", "a", "b"],
149149
)
150150
tm.assert_frame_equal(nu_df.drop("a", axis=1), nu_df[["b"]])

pandas/tests/groupby/test_groupby_dropna.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def test_groupby_apply_with_dropna_for_multi_index(dropna, data, selected_data,
326326
gb = df.groupby("groups", dropna=dropna)
327327
result = gb.apply(lambda grp: pd.DataFrame({"values": range(len(grp))}))
328328

329-
mi_tuples = tuple(zip(data["groups"], selected_data["values"], strict=True))
329+
mi_tuples = tuple(zip(data["groups"], selected_data["values"], strict=False))
330330
mi = pd.MultiIndex.from_tuples(mi_tuples, names=["groups", None])
331331
# Since right now, by default MI will drop NA from levels when we create MI
332332
# via `from_*`, so we need to add NA for level manually afterwards.

pandas/tests/io/parser/test_header.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def test_multi_index_unnamed(all_parsers, index_col, columns):
572572

573573
exp_columns.append(col)
574574

575-
columns = MultiIndex.from_tuples(zip(exp_columns, ["0", "1"], strict=True))
575+
columns = MultiIndex.from_tuples(zip(exp_columns, ["0", "1"], strict=False))
576576
expected = DataFrame([[2, 3], [4, 5]], columns=columns)
577577
tm.assert_frame_equal(result, expected)
578578

pandas/tests/strings/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
],
9595
[()] * 100,
9696
[{}] * 100,
97-
strict=True,
97+
strict=False,
9898
)
9999
)
100100
ids, _, _ = zip(*_any_string_method, strict=True) # use method name as fixture-id

pandas/tests/window/test_expanding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def test_iter_expanding_dataframe(df, expected, min_periods):
180180
df = DataFrame(df)
181181
expecteds = [DataFrame(values, index=index) for (values, index) in expected]
182182

183-
for expected, actual in zip(expecteds, df.expanding(min_periods), strict=True):
183+
for expected, actual in zip(expecteds, df.expanding(min_periods), strict=False):
184184
tm.assert_frame_equal(actual, expected)
185185

186186

pandas/tests/window/test_rolling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ def test_iter_rolling_dataframe(df, expected, window, min_periods):
765765
expecteds = [DataFrame(values, index=index) for (values, index) in expected]
766766

767767
for expected, actual in zip(
768-
expecteds, df.rolling(window, min_periods=min_periods), strict=True
768+
expecteds, df.rolling(window, min_periods=min_periods), strict=False
769769
):
770770
tm.assert_frame_equal(actual, expected)
771771

@@ -812,7 +812,7 @@ def test_iter_rolling_on_dataframe(expected, window):
812812
expecteds = [
813813
DataFrame(values, index=df.loc[index, "C"]) for (values, index) in expected
814814
]
815-
for expected, actual in zip(expecteds, df.rolling(window, on="C"), strict=True):
815+
for expected, actual in zip(expecteds, df.rolling(window, on="C"), strict=False):
816816
tm.assert_frame_equal(actual, expected)
817817

818818

0 commit comments

Comments
 (0)