From bf36349072d8441c2e2026abe85596b0e01dbf06 Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Wed, 13 May 2026 15:45:15 -0400 Subject: [PATCH] python3Packages.dedupe-pylbfgs: fix tests Assisted-by: Codex:gpt-5.5 --- .../python-modules/dedupe-pylbfgs/default.nix | 4 +++ .../dedupe-pylbfgs/tests-numpy-2.4.patch | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pkgs/development/python-modules/dedupe-pylbfgs/tests-numpy-2.4.patch diff --git a/pkgs/development/python-modules/dedupe-pylbfgs/default.nix b/pkgs/development/python-modules/dedupe-pylbfgs/default.nix index a06645526753..738177ec8106 100644 --- a/pkgs/development/python-modules/dedupe-pylbfgs/default.nix +++ b/pkgs/development/python-modules/dedupe-pylbfgs/default.nix @@ -26,6 +26,10 @@ buildPythonPackage rec { hash = "sha256-H416dgZQxyqsnhmlK5keW8cJWY6gea4mebVuP0IEVOU="; }; + patches = [ + ./tests-numpy-2.4.patch # https://github.com/dedupeio/pylbfgs/pull/52 + ]; + build-system = [ cython numpy diff --git a/pkgs/development/python-modules/dedupe-pylbfgs/tests-numpy-2.4.patch b/pkgs/development/python-modules/dedupe-pylbfgs/tests-numpy-2.4.patch new file mode 100644 index 000000000000..d90dbc0a69e5 --- /dev/null +++ b/pkgs/development/python-modules/dedupe-pylbfgs/tests-numpy-2.4.patch @@ -0,0 +1,25 @@ +diff --git a/tests/test_lbfgs.py b/tests/test_lbfgs.py +index 1af91ef..65e2da9 100644 +--- a/tests/test_lbfgs.py ++++ b/tests/test_lbfgs.py +@@ -28,16 +28,16 @@ class TestOWLQN: + + def test_owl_line_search_default(self): + def f(x, g, *args): +- g[0] = 2 * x +- return x ** 2 ++ g[0] = 2 * x[0] ++ return x[0] ** 2 + + with pytest.warns(UserWarning, match="OWL-QN"): + xmin = fmin_lbfgs(f, 100., orthantwise_c=1) + + def test_owl_line_search_warning_explicit(self): + def f(x, g, *args): +- g[0] = 2 * x +- return x ** 2 ++ g[0] = 2 * x[0] ++ return x[0] ** 2 + + with pytest.warns(UserWarning, match="OWL-QN"): + xmin = fmin_lbfgs(f, 100., orthantwise_c=1, line_search='default')