void-packages/srcpkgs/python3-gmpy2/patches/test-optional-mpmath.patch

23 lines
702 B
Diff

Skip mpmath test if module not available
diff --git a/test/test_mpfr.py b/test/test_mpfr.py
index 03f0a44..e9deb79 100644
--- a/test/test_mpfr.py
+++ b/test/test_mpfr.py
@@ -3,7 +3,6 @@ from decimal import Decimal
import pytest
from hypothesis import given, example, settings
from hypothesis.strategies import floats
-import mpmath
import gmpy2
from gmpy2 import (gamma_inc, mpfr, cmp, cmp_abs, zero, nan, mpz, mpq,
@@ -123,6 +122,7 @@ def test_mpfr_nrandom():
def test_mpfr_mpmath():
+ mpmath = pytest.importorskip("mpmath")
a, b, c, d = '1.1', '-1.1', '-3.14', '0'
assert mpfr(a)._mpf_ == (0, mpz(4953959590107546), -52, 53)
assert mpmath.mpf(mpfr(a)) == mpmath.mpf(a)