Repository: mpmath/mpmath (python)
Issue: nstr(mpf('inf')) prints '+inf' (should be 'inf')
While for finite numbers positive sign - ignored.  This also inconsistent across contexts:
```pycon
>>> nstr(mp.mpf('inf'))
'+inf'
>>> nstr(fp.mpf('inf'))
'inf'
```
Pull request description: Misc fixes
* fix mp.convert (missing rounding mode for from_rational)
* ignore .hypothesis/
* drop sign from nstr(mpf('inf')) output, closes #827


Patch:
diff --git a/.gitignore b/.gitignore
index 7698467..b434fda 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,3 +62,6 @@ htmlcov/
 
 # PyCharm files
 .idea/
+
+# Ignore files cached by Hypothesis (including examples directory so far)
+.hypothesis/
diff --git a/docs/basics.rst b/docs/basics.rst
index 680257b..3d40bd4 100644
--- a/docs/basics.rst
+++ b/docs/basics.rst
@@ -53,7 +53,7 @@ The ``mpf`` type is analogous to Python's built-in ``float``. It holds a real nu
     >>> mpf(mpf(2))
     mpf('2.0')
     >>> mpf("inf")
-    mpf('+inf')
+    mpf('inf')
 
 The ``mpc`` type represents a complex number in rectangular form as a pair of ``mpf`` instances. It can be constructed from a Python ``complex``, a real number, or a pair of real numbers:
 
diff --git a/docs/contexts.rst b/docs/contexts.rst
index 354e1a0..77ab898 100644
--- a/docs/contexts.rst
+++ b/docs/contexts.rst
@@ -193,12 +193,12 @@ Some transcendental functions are supported::
     >>> iv.exp(0)
     [1.0, 1.0]
     >>> iv.exp(['-inf','inf'])
-    [0.0, +inf]
+    [0.0, inf]
     >>>
     >>> iv.exp(['-inf',0])
     [0.0, 1.0]
     >>> iv.exp([0,'inf'])
-    [1.0, +inf]
+    [1.0, inf]
     >>> iv.exp([0,1])
     [1.0, 2.7182818284590455349]
     >>>
@@ -207,7 +207,7 @@ Some transcendental functions are supported::
     >>> iv.log([0,1])
     [-inf, 0.0]
     >>> iv.log([0,'inf'])
-    [-inf, +inf]
+    [-inf, inf]
     >>> iv.log(2)
     [0.69314718055994528623, 0.69314718055994539725]
     >>>
diff --git a/mpmath/ctx_mp_python.py b/mpmath/ctx_mp_python.py
index 2d28777..ba45e44 100644
--- a/mpmath/ctx_mp_python.py
+++ b/mpmath/ctx_mp_python.py
@@ -681,7 +681,7 @@ def convert(ctx, x, strings=True):
         prec, rounding = ctx._prec_rounding
         if isinstance(x, numbers.Rational):
             p, q = x.numerator, x.denominator
-            return ctx.make_mpf(from_rational(p, q, prec))
+            return ctx.make_mpf(from_rational(p, q, prec, rounding))
         if strings and isinstance(x, str):
             try:
                 _mpf_ = from_str(x, prec, rounding)
@@ -1095,7 +1095,7 @@ def mag(ctx, x):
             >>> mag(0.01), int(ceil(log(0.01,2)))
             (-6, -6)
             >>> mag(0), mag(inf), mag(-inf), mag(nan)
-            (-inf, +inf, +inf, nan)
+            (-inf, inf, inf, nan)
 
         """
         if hasattr(x, "_mpf_"):
diff --git a/mpmath/function_docs.py b/mpmath/function_docs.py
index db483ee..5963b33 100644
--- a/mpmath/function_docs.py
+++ b/mpmath/function_docs.py
@@ -420,7 +420,7 @@
     >>> sqrt(1+1j)
     (1.09868411346781 + 0.455089860562227j)
     >>> sqrt(inf)
-    +inf
+    inf
 
 Square root evaluation is fast at huge precision::
 
@@ -489,7 +489,7 @@
     >>> exp(-1)
     0.3678794411714423215955238
     >>> exp(inf)
-    +inf
+    inf
     >>> exp(-inf)
     0.0
 
@@ -565,7 +565,7 @@
     >>> cosh(1)
     1.543080634815243778477906
     >>> cosh(-inf), cosh(+inf)
-    (+inf, +inf)
+    (inf, inf)
 
 The hyperbolic cosine is an even, convex function with
 a global minimum at `x = 0`, having a Maclaurin series
@@ -595,7 +595,7 @@
     >>> sinh(1)
     1.175201193643801456882382
     >>> sinh(-inf), sinh(+inf)
-    (-inf, +inf)
+    (-inf, inf)
 
 The hyperbolic sine is an odd function, with a Maclaurin
 series that starts::
@@ -718,7 +718,7 @@
     >>> iv.tan([0,1])
     [0.0, 1.55740772465490223050697482944]
     >>> iv.tan([0,2])  # Interval includes a singularity
-    [-inf, +inf]
+    [-inf, inf]
 """
 
 sec = r"""
@@ -746,7 +746,7 @@
     >>> iv.sec([0,1])
     [1.0, 1.85081571768092561791175326276]
     >>> iv.sec([0,2])  # Interval includes a singularity
-    [-inf, +inf]
+    [-inf, inf]
 """
 
 csc = r"""
@@ -771,9 +771,9 @@
 
     >>> iv.dps = 25; iv.pretty = True
     >>> iv.csc([0,1])  # Interval includes a singularity
-    [1.18839510577812121626159943988, +inf]
+    [1.18839510577812121626159943988, inf]
     >>> iv.csc([0,2])
-    [1.0, +inf]
+    [1.0, inf]
 """
 
 cot = r"""
@@ -799,9 +799,9 @@
 
     >>> iv.dps = 25; iv.pretty = True
     >>> iv.cot([0,1])  # Interval includes a singularity
-    [0.642092615934330703006419974862, +inf]
+    [0.642092615934330703006419974862, inf]
     >>> iv.cot([1,2])
-    [-inf, +inf]
+    [-inf, inf]
 """
 
 acos = r"""
@@ -1627,7 +1627,7 @@
     >>> log(0)
     -inf
     >>> log(inf)
-    +inf
+    inf
 
 The natural logarithm is the antiderivative of `1/x`::
 
@@ -1957,7 +1957,7 @@
     4 24.0
     5 120.0
     >>> fac(inf)
-    +inf
+    inf
     >>> fac(0.5), sqrt(pi)/2
     (0.886226925452758, 0.886226925452758)
 
@@ -2013,7 +2013,7 @@
     4 6.0
     5 24.0
     >>> gamma(inf)
-    +inf
+    inf
     >>> gamma(0)
     Traceback (most recent call last):
       ...
@@ -2100,7 +2100,7 @@
 while higher orders tend to zero::
 
     >>> psi(0,inf), psi(1,inf), psi(2,inf)
-    (+inf, 0.0, 0.0)
+    (inf, 0.0, 0.0)
 
 Evaluation for a complex argument::
 
@@ -2181,7 +2181,7 @@
 The infinite harmonic series `1 + 1/2 + 1/3 + \ldots` diverges::
 
     >>> harmonic(inf)
-    +inf
+    inf
 
 :func:`~mpmath.harmonic` is evaluated using the digamma function rather
 than by summing the harmonic series term by term. It can therefore
@@ -2462,7 +2462,7 @@
     >>> beta(-3, 3)
     -0.333333333333333
     >>> beta(-2, 3)
-    +inf
+    inf
     >>> beta(inf, 1)
     0.0
     >>> beta(inf, 0)
@@ -2868,7 +2868,7 @@
     >>> hyper([1,2,3,4], [5,6,7], 1)   # 4F3 at finite-valued branch point
     1.141783505526870731311423
     >>> hyper([4,5,6,7], [1,2,3], 1)   # 4F3 at pole
-    +inf
+    inf
     >>> hyper([1,2,3,4,5], [6,7,8,9], 10)    # 5F4
     (1.543998916527972259717257 - 0.5876309929580408028816365j)
     >>> hyper([1,2,3,4,5,6], [7,8,9,10,11], 1j)   # 6F5
@@ -2879,7 +2879,7 @@
     >>> hyper(['1/3',1,'3/2',2], ['1/5','11/6','41/8'], 1)
     2.219433352235586121250027
     >>> hyper(['1/3',1,'3/2',2], ['1/5','11/6','5/4'], 1)
-    +inf
+    inf
     >>> eps1 = extradps(6)(lambda: 1 - mpf('1e-6'))()
     >>> hyper(['1/3',1,'3/2',2], ['1/5','11/6','5/4'], eps1)
     2923978034.412973409330956
@@ -3268,7 +3268,7 @@
     >>> hyp2f1(-2.5, 3, 4, 1)
     0.06926406926406926406926407
     >>> hyp2f1(2, 3, 4, 1)
-    +inf
+    inf
 
 Evaluation for huge arguments::
 
@@ -3395,7 +3395,7 @@
 The `U` function may be singular at `z = 0`::
 
     >>> hyperu(1.5, 2, 0)
-    +inf
+    inf
     >>> hyperu(1.5, -2, 0)
     0.1719434921288400112603671
 
@@ -3588,7 +3588,7 @@
     >>> gammainc(-3, -4, -5)
     (-0.2214577048967798566234192 + 0.0j)
     >>> lower_gamma(-3, 5)
-    +inf
+    inf
 
 If `z` is an integer, the recurrence reduces the incomplete gamma
 function to `P(a) \exp(-a) + Q(b) \exp(-b)` where `P` and
@@ -3768,7 +3768,7 @@
     >>> erfi(-1)
     -1.65042575879754
     >>> erfi(inf)
-    +inf
+    inf
     >>> erfi(-inf)
     -inf
 
@@ -3820,7 +3820,7 @@
     >>> erfinv(0)
     0.0
     >>> erfinv(1)
-    +inf
+    inf
     >>> erfinv(-1)
     -inf
 
@@ -4023,7 +4023,7 @@
     >>> ei(1)
     1.89511781635594
     >>> ei(inf)
-    +inf
+    inf
     >>> ei(-inf)
     0.0
 
@@ -4130,7 +4130,7 @@
     >>> findroot(li, 2)
     1.45136923488338105028396848589
     >>> li(inf)
-    +inf
+    inf
     >>> li(2, offset=True)
     0.0
     >>> li(1, offset=True)
@@ -4335,7 +4335,7 @@
     >>> chi(1)
     0.8378669409802082408946786
     >>> chi(inf)
-    +inf
+    inf
     >>> findroot(chi, 0.5)
     0.5238225713898644064509583
     >>> chi(2+3j)
@@ -4367,7 +4367,7 @@
     >>> shi(-1)
     -1.057250875375728514571842
     >>> shi(inf)
-    +inf
+    inf
     >>> shi(2+3j)
     (-0.1931890762719198291678095 + 2.645432555362369624818525j)
 
@@ -4650,11 +4650,11 @@
     0.3333333332991690159427932
     0.3333333333333333333333333
     >>> airyai(+inf,-2); airyai(+inf,-3)
-    +inf
-    +inf
+    inf
+    inf
     >>> airyai(-1000000,-2); airyai(-inf,-2)
     666666.4078472650651209742
-    +inf
+    inf
     >>> airyai(-1000000,-3); airyai(-inf,-3)
     -333333074513.7520264995733
     -inf
@@ -4714,7 +4714,7 @@
     >>> airybi(-1)
     0.10399738949694461188869
     >>> airybi(inf); airybi(-inf)
-    +inf
+    inf
     0.0
 
 Evaluation is supported for large magnitudes of the argument::
@@ -4832,10 +4832,10 @@
     0.0
     >>> airybi(10,-1); airybi(+inf,-1)
     147809803.1074067161675853
-    +inf
+    inf
     >>> airybi(+inf,-2); airybi(+inf,-3)
-    +inf
-    +inf
+    inf
+    inf
     >>> airybi(-1000000,-2); airybi(-inf,-2)
     0.4482883750599908479851085
     0.4482883573538263579148237
@@ -4846,7 +4846,7 @@
     -inf
     >>> airybi(-100000,-4); airybi(-inf,-4)
     2241411040.437759489540248
-    +inf
+    inf
 
 """
 
@@ -5013,7 +5013,7 @@
     >>> ellipk(-inf)
     0.0
     >>> ellipk(1)
-    +inf
+    inf
     >>> ellipk(-1)
     1.31102877714605990523242
     >>> ellipk(2)
@@ -6158,9 +6158,9 @@
 The point `x = 0` is a singularity (logarithmic if `n = 0`)::
 
     >>> besselk(0,0)
-    +inf
+    inf
     >>> besselk(1,0)
-    +inf
+    inf
     >>> for n in range(-4, 5):
     ...     print(besselk(n, '1e-1000'))
     ...
@@ -6326,17 +6326,17 @@
     >>> lambertw(e)
     1.0
     >>> lambertw(inf)
-    +inf
+    inf
     >>> lambertw(0, k=-1)
     -inf
     >>> lambertw(0, k=3)
     -inf
     >>> lambertw(inf, k=2)
-    (+inf + 12.56637061435917295385057j)
+    (inf + 12.56637061435917295385057j)
     >>> lambertw(inf, k=3)
-    (+inf + 18.84955592153875943077586j)
+    (inf + 18.84955592153875943077586j)
     >>> lambertw(-inf, k=3)
-    (+inf + 21.9911485751285526692385j)
+    (inf + 21.9911485751285526692385j)
 
 The `k = 0` and `k = -1` branches join at `z = -1/e` where
 `W(z) = -1` for both branches. Since `-1/e` can only be represented
@@ -6401,7 +6401,7 @@
     >>> barnesg(8)
     24883200.0
     >>> barnesg(inf)
-    +inf
+    inf
     >>> barnesg(0), barnesg(-1), barnesg(-2)
     (0.0, 0.0, 0.0)
 
@@ -6730,7 +6730,7 @@
     1.200973602347074224816022
     1.200973602347074224816022
     >>> loggamma(inf)
-    +inf
+    inf
 
 Huge arguments are permitted::
 
@@ -6802,7 +6802,7 @@
     >>> siegeltheta(0)
     0.0
     >>> siegeltheta(inf)
-    +inf
+    inf
     >>> siegeltheta(-inf)
     -inf
     >>> siegeltheta(1)
@@ -7174,7 +7174,7 @@
 Euler constants::
 
     >>> primezeta(1)
-    +inf
+    inf
     >>> extradps(25)(lambda x: primezeta(1+x)+log(x))(+eps)
     -0.31571845205389007685
     >>> mertens-euler
@@ -8104,7 +8104,7 @@
 Evaluation at zero::
 
     >>> whitm(1,-1,0); whitm(1,-0.5,0); whitm(1,0,0)
-    +inf
+    inf
     nan
     0.0
 
@@ -8158,11 +8158,11 @@
     >>> for m in [-1, -0.5, 0, 0.5, 1]:
     ...     whitw(1, m, 0)
     ...
-    +inf
+    inf
     nan
     0.0
     nan
-    +inf
+    inf
 
 We can verify that :func:`~mpmath.whitw` numerically satisfies the
 differential equation for arbitrarily chosen values::
@@ -9154,7 +9154,7 @@
     1.202056903159594285399738
     1.202056903159594285399738
     >>> dirichlet(1, [1])
-    +inf
+    inf
 
 The alternating zeta function::
 
@@ -9753,7 +9753,7 @@
     >>> eulerpoly(5, -inf)
     -inf
     >>> eulerpoly(6, -inf)
-    +inf
+    inf
 
 Computing Euler numbers::
 
@@ -9997,7 +9997,7 @@
     0.2988589049025509052765491
     0.2988589049025509052765491
     >>> scorerhi(+inf); scorerhi(-inf)
-    +inf
+    inf
     0.0
     >>> scorerhi(1)
     0.9722051551424333218376886
diff --git a/mpmath/functions/elliptic.py b/mpmath/functions/elliptic.py
index 6e7e906..6c0c0ed 100644
--- a/mpmath/functions/elliptic.py
+++ b/mpmath/functions/elliptic.py
@@ -241,7 +241,7 @@ def kfrom(ctx, q=None, m=None, k=None, tau=None, qbar=None):
         >>> kfrom(q=1)
         1
         >>> kfrom(q=-1)
-        (0.0 + +infj)
+        (0.0 + infj)
     """
     if k is not None:
         return ctx.convert(k)
@@ -662,10 +662,10 @@ def elliprf(ctx, x, y, z):
         >>> elliprf(2,2,2)**2
         0.5
         >>> elliprf(1,0,0); elliprf(0,0,1); elliprf(0,1,0); elliprf(0,0,0)
-        +inf
-        +inf
-        +inf
-        +inf
+        inf
+        inf
+        inf
+        inf
 
     Representing complete elliptic integrals in terms of `R_F`::
 
@@ -783,7 +783,7 @@ def elliprc(ctx, x, y, pv=True):
         3.141592653589793238462643
         3.141592653589793238462643
         >>> elliprc(1,0)
-        +inf
+        inf
         >>> elliprc(5,5)**2
         0.2
         >>> elliprc(1,inf); elliprc(inf,1); elliprc(inf,inf)
@@ -856,9 +856,9 @@ def elliprj(ctx, x, y, z, p, integration=1):
         1.380226776765915172432054
         1.380226776765915172432054
         >>> elliprj(1,3,2,0); elliprj(0,1,1,0); elliprj(0,0,0,0)
-        +inf
-        +inf
-        +inf
+        inf
+        inf
+        inf
         >>> elliprj(1,inf,1,0); elliprj(1,1,1,inf)
         0.0
         0.0
@@ -1050,8 +1050,8 @@ def ellipf(ctx, phi, m):
         1.415737208425956198892166
         1.415737208425956198892166
         >>> ellipf(pi/2+eps, 1); ellipf(-pi/2-eps, 1)
-        +inf
-        +inf
+        inf
+        inf
         >>> ellipf(1.5, 1)
         3.340677542798311003320813
 
@@ -1166,9 +1166,9 @@ def ellipe(ctx, *args):
         >>> ellipe(2)
         (0.5990701173677961037199612 + 0.5990701173677961037199612j)
         >>> ellipe(inf)
-        (0.0 + +infj)
+        (0.0 + infj)
         >>> ellipe(-inf)
-        +inf
+        inf
 
     Verifying the defining integral and hypergeometric
     representation::
@@ -1325,9 +1325,9 @@ def ellippi(ctx, *args):
         >>> ellippi(2,inf)
         0.0
         >>> abs(ellippi(1,5))
-        +inf
+        inf
         >>> abs(ellippi(0.25,1))
-        +inf
+        inf
 
     Evaluation in terms of simpler functions::
 
@@ -1373,13 +1373,13 @@ def ellippi(ctx, *args):
     Some degenerate cases::
 
         >>> ellippi(1,1)
-        +inf
+        inf
         >>> ellippi(1,0)
-        +inf
+        inf
         >>> ellippi(1,2,0)
-        +inf
+        inf
         >>> ellippi(1,2,1)
-        +inf
+        inf
         >>> ellippi(1,0,1)
         0.0
 
diff --git a/mpmath/functions/zeta.py b/mpmath/functions/zeta.py
index 4960ff9..9aab919 100644
--- a/mpmath/functions/zeta.py
+++ b/mpmath/functions/zeta.py
@@ -953,7 +953,7 @@ def secondzeta(ctx, s, a = 0.015, **kwargs):
         >>> secondzeta(-8)
         -0.67236328125
         >>> secondzeta(-7)
-        +inf
+        inf
 
     **Implementation notes**
 
diff --git a/mpmath/libmp/libmpf.py b/mpmath/libmp/libmpf.py
index 7cabdb2..225de5d 100644
--- a/mpmath/libmp/libmpf.py
+++ b/mpmath/libmp/libmpf.py
@@ -1195,7 +1195,7 @@ def to_str(s, dps, strip_zeros=True, min_fixed=None, max_fixed=None,
             if show_zero_exponent:
                 t += sep + '+0'
             return prefix + t
-        if s == finf: return '+inf'
+        if s == finf: return 'inf'
         if s == fninf: return '-inf'
         if s == fnan: return 'nan'
         raise ValueError


Test patch:
diff --git a/mpmath/tests/test_convert.py b/mpmath/tests/test_convert.py
index 678af08..73c84ca 100644
--- a/mpmath/tests/test_convert.py
+++ b/mpmath/tests/test_convert.py
@@ -41,7 +41,7 @@ def test_basic_string():
     assert str(mpf("-2163048125l")) == '-2163048125.0'
     assert str(mpf("-2163048125L/1088391168")) == '-1.98738118113799'
     assert str(mpf("2163048125/1088391168l")) == '1.98738118113799'
-    assert str(mpf('inf')) == '+inf'
+    assert str(mpf('inf')) == 'inf'
 
     # issue 613
     assert str(mpf('2_5_0_0.0')) == '2500.0'