Skip to content

Instantly share code, notes, and snippets.

@jeremysanders
Created May 16, 2022 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremysanders/9aca53cfccd5414d43f9f33eae911287 to your computer and use it in GitHub Desktop.
Save jeremysanders/9aca53cfccd5414d43f9f33eae911287 to your computer and use it in GitHub Desktop.
From: Jeremy Sanders <jeremy@jeremysanders.net>
Subject: Fix test on i386 and other platforms without numpy.float128
Index: debian-iminuit/tests/test_cost.py
===================================================================
--- debian-iminuit.orig/tests/test_cost.py
+++ debian-iminuit/tests/test_cost.py
@@ -709,7 +709,7 @@ def test_NormalConstraint_properties():
assert_equal(nc.covariance, (1, 2))
-@pytest.mark.parametrize("dtype", (np.float32, np.float128))
+@pytest.mark.parametrize("dtype", (np.float32, np.longdouble))
def test_soft_l1_loss(dtype):
v = np.array([0], dtype=dtype)
assert _soft_l1_loss(v) == v
@@ -731,9 +731,9 @@ def test_multinominal_chi2():
assert_allclose(_multinominal_chi2(n, one), 0)
-def test_model_float128():
+def test_model_longdouble():
def model(x, a):
- x = x.astype(np.float128)
+ x = x.astype(np.longdouble)
return a + x
for cost in (
@@ -746,7 +746,7 @@ def test_model_float128():
LeastSquares([1.0], [2.0], [3.0], model),
LeastSquares([1.0], [2.0], [3.0], model, loss="soft_l1"),
):
- assert cost(1).dtype == np.float128
+ assert cost(1).dtype == np.longdouble
Minuit(cost, a=0).migrad() # should not raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment