Skip to content

Commit 3d4a815

Browse files
committed
fix: mypy
1 parent 3f52fef commit 3d4a815

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

test/test_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ def test_is_constant() -> None:
740740
assert is_constant(cv)
741741

742742

743-
def test_maybe_group_terms_polars_no_duplicates():
743+
def test_maybe_group_terms_polars_no_duplicates() -> None:
744744
"""Fast path: distinct (labels, vars) pairs skip group_by."""
745745
df = pl.DataFrame({"labels": [0, 0], "vars": [1, 2], "coeffs": [3.0, 4.0]})
746746
result = maybe_group_terms_polars(df)
@@ -749,7 +749,7 @@ def test_maybe_group_terms_polars_no_duplicates():
749749
assert result["coeffs"].to_list() == [3.0, 4.0]
750750

751751

752-
def test_maybe_group_terms_polars_with_duplicates():
752+
def test_maybe_group_terms_polars_with_duplicates() -> None:
753753
"""Slow path: duplicate (labels, vars) pairs trigger group_by."""
754754
df = pl.DataFrame({"labels": [0, 0], "vars": [1, 1], "coeffs": [3.0, 4.0]})
755755
result = maybe_group_terms_polars(df)

test/test_io.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import pickle
99
from pathlib import Path
10+
from typing import Any
1011
from unittest.mock import patch
1112

1213
import numpy as np
@@ -339,7 +340,7 @@ def test_to_file_lp_with_negative_zero_coefficients(tmp_path: Path) -> None:
339340
gurobipy.read(str(fn))
340341

341342

342-
def test_format_and_write_streaming_fallback(tmp_path):
343+
def test_format_and_write_streaming_fallback(tmp_path: Path) -> None:
343344
"""Test that _format_and_write falls back to eager when streaming fails."""
344345
df = pl.DataFrame({"a": ["x", "y"], "b": ["1", "2"]})
345346
columns = [pl.col("a"), pl.lit(" "), pl.col("b")]
@@ -353,7 +354,7 @@ def test_format_and_write_streaming_fallback(tmp_path):
353354
# Force streaming to fail
354355
original_collect = pl.LazyFrame.collect
355356

356-
def failing_collect(self, *args, **kwargs):
357+
def failing_collect(self: pl.LazyFrame, *args: Any, **kwargs: Any) -> pl.DataFrame:
357358
if kwargs.get("engine") == "streaming":
358359
raise RuntimeError("simulated streaming failure")
359360
return original_collect(self, *args, **kwargs)
@@ -367,7 +368,7 @@ def failing_collect(self, *args, **kwargs):
367368
assert content_normal == content_fallback
368369

369370

370-
def test_to_file_lp_same_sign_constraints(tmp_path):
371+
def test_to_file_lp_same_sign_constraints(tmp_path: Path) -> None:
371372
"""Test LP writing when all constraints have the same sign operator."""
372373
m = Model()
373374
N = np.arange(5)

0 commit comments

Comments
 (0)