diff --git a/test/test_context.py b/test/test_context.py index d8dd1356..0c89f3d5 100644 --- a/test/test_context.py +++ b/test/test_context.py @@ -154,3 +154,16 @@ def test_local_context(): assert (ctx.precision == 53 and ctx.emax == 1073741823 and ctx.emin == -1073741823 and not ctx.subnormalize) + + +def test_context_repr(): + assert repr(get_context()) == \ +"""context(precision=53, real_prec=Default, imag_prec=Default,\n\ + round=RoundToNearest, real_round=Default, imag_round=Default,\n\ + emax=1073741823, emin=-1073741823,\n subnormalize=False,\n\ + trap_underflow=False, underflow=False,\n trap_overflow=False,\ + overflow=False,\n trap_inexact=False, inexact=False,\n\ + trap_invalid=False, invalid=False,\n trap_erange=False,\ + erange=False,\n trap_divzero=False, divzero=False,\n\ + allow_complex=False,\n rational_division=False,\n\ + allow_release_gil=False)""" diff --git a/test/test_functions.py b/test/test_functions.py index 0ecee7c0..2e14c3ac 100644 --- a/test/test_functions.py +++ b/test/test_functions.py @@ -919,3 +919,7 @@ def test_t_mod(): assert t_mod(b,-a) == mpz(87) assert t_mod(-b,a) == mpz(-87) assert t_mod(-b,-a) == mpz(-87) + + +def test_get_max_precision(): + assert gmpy2.get_max_precision() > 53 diff --git a/test/test_mpq.py b/test/test_mpq.py index 23e520b6..70792079 100644 --- a/test/test_mpq.py +++ b/test/test_mpq.py @@ -600,6 +600,14 @@ def test_mpq_qdiv(): assert args == (mpq(2), 1/mpq(2)) +def test_mpq_repr(): + assert repr(mpq(11,13)) == 'mpq(11,13)' + + +def test_mpq_str(): + assert str(mpq(11,13)) == '11/13' + + def test_issue_334(): x = mpq(3,2) y = mpq(x,2)