File: test_misc.py

package info (click to toggle)
python-gmpy2 2.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,996 kB
  • sloc: ansic: 24,604; python: 4,911; makefile: 123
file content (22 lines) | stat: -rw-r--r-- 883 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import sys

import gmpy2


def test_misc():
    assert gmpy2.version().startswith('2.2.1')
    assert gmpy2.mp_limbsize() in (32,64)
    assert '5.0.0' <= gmpy2.mp_version()
    assert gmpy2.mpfr_version() and gmpy2.mpfr_version().startswith('MPFR')
    assert gmpy2.mpfr_version() and '3.1.0' <= gmpy2.mpfr_version().split()[1]
    assert gmpy2.mpc_version() and gmpy2.mpc_version().startswith('MPC')
    assert gmpy2.mpc_version() and '1.0' <= gmpy2.mpc_version().split()[1]
    assert gmpy2.license() == ('The GMPY2 source code is licensed under LGPL '
                               '3 or later. The supported versions of the GMP, '
                               'MPFR, and MPC libraries are also licensed '
                               'under LGPL 3 or later.')


def test_sizeof():
    assert sys.getsizeof(gmpy2.mpz(10)) > 0
    assert sys.getsizeof(gmpy2.mpfr('1.0')) > 0