Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Nov 21, 2023
1 parent fafa919 commit b20b7a7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"""
4 changes: 4 additions & 0 deletions test/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions test/test_mpq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b20b7a7

Please sign in to comment.