def _test(chat=None): if chat: print("Unit tests for gmpy 1.15 (mpq functionality)") print(" running on Python",sys.version) print() if _g.gmp_version(): print("Testing gmpy %s (GMP %s), default caching (%s, %s)" % ( (_g.version(), _g.gmp_version(), _g.get_cache()[0], _g.get_cache()[1]))) else: print("Testing gmpy %s (MPIR %s), default caching (%s, %s)" % ( (_g.version(), _g.mpir_version(), _g.get_cache()[0], _g.get_cache()[1]))) thismod = sys.modules.get(__name__) doctest.testmod(thismod, report=0) if chat: print("Repeating tests, with caching disabled") _g.set_cache(0,128) sav = sys.stdout class _Dummy: encoding = None def write(self,*whatever): pass try: sys.stdout = _Dummy() doctest.testmod(thismod, report=0) finally: sys.stdout = sav if chat: print() print("Overall results for mpq:") return doctest.master.summarize(chat)
def _test(chat=None): if chat: print("Unit tests for gmpy 1.15 (threading)") print(" running on Python", sys.version) print() if _g.gmp_version(): print("Testing gmpy %s (GMP %s) with default caching (%s, %s)" % ( (_g.version(), _g.gmp_version(), _g.get_cache()[0], _g.get_cache()[1]))) else: print("Testing gmpy %s (MPIR %s) with default caching (%s, %s)" % ( (_g.version(), _g.mpir_version(), _g.get_cache()[0], _g.get_cache()[1]))) thismod = sys.modules.get(__name__) doctest.testmod(thismod, report=0) if chat: print("Repeating tests, with caching disabled") _g.set_cache(0,128) sav = sys.stdout class _Dummy: def write(self,*whatever): pass try: sys.stdout = _Dummy() doctest.testmod(thismod, report=0) finally: sys.stdout = sav if chat: print() print("Overall results for thr:") return doctest.master.summarize(chat)
def _test(chat=None): try: float('nan') except ValueError: if "special" in __test__: del(__test__["special"]) if chat: print "Unit tests for gmpy 1.15 (mpz functionality)" print " running on Python %s" % sys.version print if _g.gmp_version(): print "Testing gmpy %s (GMP %s) with default caching (%s, %s)" % ( (_g.version(), _g.gmp_version(), _g.get_cache()[0], _g.get_cache()[1])) else: print "Testing gmpy %s (MPIR %s) with default caching (%s, %s)" % ( (_g.version(), _g.mpir_version(), _g.get_cache()[0], _g.get_cache()[1])) thismod = sys.modules.get(__name__) doctest.testmod(thismod, report=0) if chat: print "Repeating tests, with caching disabled" _g.set_cache(0,128) sav = sys.stdout class _Dummy: def write(self,*whatever): pass try: sys.stdout = _Dummy() doctest.testmod(thismod, report=0) finally: sys.stdout = sav if chat: print print "Overall results for mpz:" return doctest.master.summarize(chat)