From b8436b026a90291ba26afa4f7a2700720b03339f Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 4 May 2011 05:41:33 +0000 Subject: [PATCH] remove python test cases --- sys/lib/python/test/185test.db | Bin 16384 -> 0 bytes sys/lib/python/test/README | 423 -- sys/lib/python/test/__init__.py | 1 - sys/lib/python/test/audiotest.au | Bin 23493 -> 0 bytes sys/lib/python/test/autotest.py | 6 - sys/lib/python/test/bad_coding.py | 1 - sys/lib/python/test/bad_coding2.py | 2 - sys/lib/python/test/badsyntax_future3.py | 10 - sys/lib/python/test/badsyntax_future4.py | 10 - sys/lib/python/test/badsyntax_future5.py | 12 - sys/lib/python/test/badsyntax_future6.py | 10 - sys/lib/python/test/badsyntax_future7.py | 11 - sys/lib/python/test/badsyntax_future8.py | 10 - sys/lib/python/test/badsyntax_future9.py | 10 - sys/lib/python/test/badsyntax_nocaret.py | 2 - sys/lib/python/test/check_soundcard.vbs | 13 - sys/lib/python/test/cjkencodings_test.py | 1004 ---- sys/lib/python/test/crashers/README | 20 - .../python/test/crashers/bogus_code_obj.py | 19 - .../python/test/crashers/borrowed_ref_1.py | 29 - .../python/test/crashers/borrowed_ref_2.py | 38 - .../test/crashers/dangerous_subclassing.py | 12 - sys/lib/python/test/crashers/gc_inspection.py | 32 - .../python/test/crashers/infinite_rec_1.py | 11 - .../python/test/crashers/infinite_rec_2.py | 10 - .../python/test/crashers/infinite_rec_4.py | 7 - .../python/test/crashers/infinite_rec_5.py | 10 - .../python/test/crashers/loosing_dict_ref.py | 21 - .../python/test/crashers/modify_dict_attr.py | 19 - .../python/test/crashers/nasty_eq_vs_dict.py | 47 - .../test/crashers/recursion_limit_too_high.py | 16 - .../python/test/crashers/recursive_call.py | 15 - .../python/test/crashers/weakref_in_del.py | 17 - .../python/test/decimaltestdata/abs.decTest | 161 - .../python/test/decimaltestdata/add.decTest | 1127 ----- .../python/test/decimaltestdata/base.decTest | 1272 ----- .../python/test/decimaltestdata/clamp.decTest | 197 - .../test/decimaltestdata/compare.decTest | 717 --- .../test/decimaltestdata/decimal128.decTest | 441 -- .../test/decimaltestdata/decimal32.decTest | 385 -- .../test/decimaltestdata/decimal64.decTest | 444 -- .../test/decimaltestdata/divide.decTest | 818 ---- .../test/decimaltestdata/divideint.decTest | 470 -- .../test/decimaltestdata/inexact.decTest | 215 - .../python/test/decimaltestdata/max.decTest | 376 -- .../python/test/decimaltestdata/min.decTest | 363 -- .../python/test/decimaltestdata/minus.decTest | 182 - .../test/decimaltestdata/multiply.decTest | 651 --- .../test/decimaltestdata/normalize.decTest | 225 - .../python/test/decimaltestdata/plus.decTest | 181 - .../python/test/decimaltestdata/power.decTest | 651 --- .../test/decimaltestdata/quantize.decTest | 780 --- .../decimaltestdata/randomBound32.decTest | 2443 ---------- .../test/decimaltestdata/randoms.decTest | 4029 ---------------- .../test/decimaltestdata/remainder.decTest | 629 --- .../decimaltestdata/remainderNear.decTest | 560 --- .../test/decimaltestdata/rescale.decTest | 758 --- .../test/decimaltestdata/rounding.decTest | 1079 ----- .../test/decimaltestdata/samequantum.decTest | 353 -- .../test/decimaltestdata/squareroot.decTest | 2958 ------------ .../test/decimaltestdata/subtract.decTest | 863 ---- .../test/decimaltestdata/testall.decTest | 58 - .../test/decimaltestdata/tointegral.decTest | 176 - sys/lib/python/test/doctest_aliases.py | 13 - sys/lib/python/test/double_const.py | 30 - sys/lib/python/test/empty.vbs | 1 - sys/lib/python/test/exception_hierarchy.txt | 48 - sys/lib/python/test/fork_wait.py | 78 - sys/lib/python/test/greyrgb.uue | 1547 ------ sys/lib/python/test/infinite_reload.py | 7 - sys/lib/python/test/inspect_fodder.py | 56 - sys/lib/python/test/inspect_fodder2.py | 99 - sys/lib/python/test/leakers/README.txt | 32 - sys/lib/python/test/leakers/__init__.py | 0 sys/lib/python/test/leakers/test_ctypes.py | 16 - sys/lib/python/test/leakers/test_gestalt.py | 14 - sys/lib/python/test/leakers/test_selftype.py | 13 - sys/lib/python/test/list_tests.py | 522 -- sys/lib/python/test/mapping_tests.py | 672 --- sys/lib/python/test/output/test_MimeWriter | 110 - sys/lib/python/test/output/test_cProfile | 79 - sys/lib/python/test/output/test_cgi | 42 - sys/lib/python/test/output/test_class | 101 - sys/lib/python/test/output/test_cookie | 32 - sys/lib/python/test/output/test_extcall | 112 - sys/lib/python/test/output/test_frozen | 4 - sys/lib/python/test/output/test_global | 5 - sys/lib/python/test/output/test_grammar | 69 - sys/lib/python/test/output/test_httplib | 13 - sys/lib/python/test/output/test_linuxaudiodev | 7 - sys/lib/python/test/output/test_logging | 525 -- sys/lib/python/test/output/test_math | 28 - sys/lib/python/test/output/test_mmap | 38 - sys/lib/python/test/output/test_new | 7 - sys/lib/python/test/output/test_nis | 2 - sys/lib/python/test/output/test_opcodes | 6 - sys/lib/python/test/output/test_openpty | 2 - sys/lib/python/test/output/test_operations | 21 - sys/lib/python/test/output/test_ossaudiodev | 2 - sys/lib/python/test/output/test_pep277 | 3 - sys/lib/python/test/output/test_pkg | 45 - sys/lib/python/test/output/test_poll | 19 - sys/lib/python/test/output/test_popen | 3 - sys/lib/python/test/output/test_popen2 | 9 - sys/lib/python/test/output/test_profile | 84 - sys/lib/python/test/output/test_pty | 3 - sys/lib/python/test/output/test_pyexpat | 110 - sys/lib/python/test/output/test_regex | 29 - sys/lib/python/test/output/test_resource | 2 - sys/lib/python/test/output/test_rgbimg | 2 - sys/lib/python/test/output/test_scope | 24 - sys/lib/python/test/output/test_signal | 2 - sys/lib/python/test/output/test_thread | 18 - .../python/test/output/test_threadedtempfile | 5 - sys/lib/python/test/output/test_tokenize | 659 --- sys/lib/python/test/output/test_types | 15 - sys/lib/python/test/output/test_winreg | 3 - sys/lib/python/test/output/test_xdrlib | 19 - sys/lib/python/test/output/xmltests | 364 -- sys/lib/python/test/outstanding_bugs.py | 27 - sys/lib/python/test/pickletester.py | 1001 ---- sys/lib/python/test/pyclbr_input.py | 33 - sys/lib/python/test/pydocfodder.py | 210 - sys/lib/python/test/pystone.py | 266 - sys/lib/python/test/re_tests.py | 674 --- sys/lib/python/test/regex_tests.py | 287 -- sys/lib/python/test/regrtest.py | 1384 ------ sys/lib/python/test/reperf.py | 23 - sys/lib/python/test/sample_doctest.py | 76 - sys/lib/python/test/seq_tests.py | 323 -- sys/lib/python/test/sgml_input.html | 212 - sys/lib/python/test/sortperf.py | 169 - sys/lib/python/test/string_tests.py | 1173 ----- sys/lib/python/test/test.xml | 115 - sys/lib/python/test/test.xml.out | 115 - sys/lib/python/test/test_MimeWriter.py | 170 - sys/lib/python/test/test_StringIO.py | 167 - sys/lib/python/test/test___all__.py | 185 - sys/lib/python/test/test___future__.py | 59 - sys/lib/python/test/test__locale.py | 124 - sys/lib/python/test/test_aepack.py | 84 - sys/lib/python/test/test_al.py | 23 - sys/lib/python/test/test_anydbm.py | 95 - sys/lib/python/test/test_applesingle.py | 72 - sys/lib/python/test/test_array.py | 996 ---- sys/lib/python/test/test_ast.py | 204 - sys/lib/python/test/test_asynchat.py | 93 - sys/lib/python/test/test_atexit.py | 100 - sys/lib/python/test/test_audioop.py | 282 -- sys/lib/python/test/test_augassign.py | 327 -- sys/lib/python/test/test_base64.py | 198 - sys/lib/python/test/test_bastion.py | 3 - sys/lib/python/test/test_bigaddrspace.py | 46 - sys/lib/python/test/test_bigmem.py | 964 ---- sys/lib/python/test/test_binascii.py | 165 - sys/lib/python/test/test_binhex.py | 49 - sys/lib/python/test/test_binop.py | 328 -- sys/lib/python/test/test_bisect.py | 253 - sys/lib/python/test/test_bool.py | 348 -- sys/lib/python/test/test_bsddb.py | 297 -- sys/lib/python/test/test_bsddb185.py | 43 - sys/lib/python/test/test_bsddb3.py | 76 - sys/lib/python/test/test_bufio.py | 60 - sys/lib/python/test/test_builtin.py | 1783 ------- sys/lib/python/test/test_bz2.py | 371 -- sys/lib/python/test/test_cProfile.py | 123 - sys/lib/python/test/test_calendar.py | 393 -- sys/lib/python/test/test_call.py | 131 - sys/lib/python/test/test_capi.py | 55 - sys/lib/python/test/test_cd.py | 26 - sys/lib/python/test/test_cfgparser.py | 426 -- sys/lib/python/test/test_cgi.py | 275 -- sys/lib/python/test/test_charmapcodec.py | 56 - sys/lib/python/test/test_cl.py | 78 - sys/lib/python/test/test_class.py | 412 -- sys/lib/python/test/test_cmath.py | 52 - sys/lib/python/test/test_cmd_line.py | 93 - sys/lib/python/test/test_code.py | 102 - sys/lib/python/test/test_codeccallbacks.py | 800 --- sys/lib/python/test/test_codecencodings_cn.py | 61 - sys/lib/python/test/test_codecencodings_hk.py | 29 - sys/lib/python/test/test_codecencodings_jp.py | 111 - sys/lib/python/test/test_codecencodings_kr.py | 55 - sys/lib/python/test/test_codecencodings_tw.py | 29 - sys/lib/python/test/test_codecmaps_cn.py | 29 - sys/lib/python/test/test_codecmaps_hk.py | 22 - sys/lib/python/test/test_codecmaps_jp.py | 73 - sys/lib/python/test/test_codecmaps_kr.py | 44 - sys/lib/python/test/test_codecmaps_tw.py | 34 - sys/lib/python/test/test_codecs.py | 1279 ----- sys/lib/python/test/test_codeop.py | 192 - sys/lib/python/test/test_coding.py | 28 - sys/lib/python/test/test_coercion.py | 347 -- sys/lib/python/test/test_colorsys.py | 76 - sys/lib/python/test/test_commands.py | 65 - sys/lib/python/test/test_compare.py | 59 - sys/lib/python/test/test_compile.py | 402 -- sys/lib/python/test/test_compiler.py | 207 - sys/lib/python/test/test_complex.py | 341 -- sys/lib/python/test/test_complex_args.py | 91 - sys/lib/python/test/test_contains.py | 133 - sys/lib/python/test/test_contextlib.py | 340 -- sys/lib/python/test/test_cookie.py | 50 - sys/lib/python/test/test_cookielib.py | 1736 ------- sys/lib/python/test/test_copy.py | 591 --- sys/lib/python/test/test_copy_reg.py | 121 - sys/lib/python/test/test_cpickle.py | 103 - sys/lib/python/test/test_crypt.py | 11 - sys/lib/python/test/test_csv.py | 991 ---- sys/lib/python/test/test_ctypes.py | 12 - sys/lib/python/test/test_curses.py | 275 -- sys/lib/python/test/test_datetime.py | 3287 ------------- sys/lib/python/test/test_dbm.py | 55 - sys/lib/python/test/test_decimal.py | 1133 ----- sys/lib/python/test/test_decorators.py | 273 -- sys/lib/python/test/test_defaultdict.py | 149 - sys/lib/python/test/test_deque.py | 632 --- sys/lib/python/test/test_descr.py | 4283 ----------------- sys/lib/python/test/test_descrtut.py | 494 -- sys/lib/python/test/test_dict.py | 477 -- sys/lib/python/test/test_difflib.py | 161 - sys/lib/python/test/test_difflib_expect.html | 526 -- sys/lib/python/test/test_dircache.py | 73 - sys/lib/python/test/test_dis.py | 156 - sys/lib/python/test/test_distutils.py | 17 - sys/lib/python/test/test_dl.py | 34 - sys/lib/python/test/test_doctest.py | 2418 ---------- sys/lib/python/test/test_doctest.txt | 17 - sys/lib/python/test/test_doctest2.py | 120 - sys/lib/python/test/test_doctest2.txt | 14 - sys/lib/python/test/test_doctest3.txt | 5 - sys/lib/python/test/test_doctest4.txt | 17 - sys/lib/python/test/test_dumbdbm.py | 155 - sys/lib/python/test/test_dummy_thread.py | 181 - sys/lib/python/test/test_dummy_threading.py | 73 - sys/lib/python/test/test_email.py | 13 - sys/lib/python/test/test_email_codecs.py | 15 - sys/lib/python/test/test_email_renamed.py | 13 - sys/lib/python/test/test_enumerate.py | 214 - sys/lib/python/test/test_eof.py | 32 - sys/lib/python/test/test_errno.py | 49 - .../python/test/test_exception_variations.py | 180 - sys/lib/python/test/test_exceptions.py | 345 -- sys/lib/python/test/test_extcall.py | 279 -- sys/lib/python/test/test_fcntl.py | 69 - sys/lib/python/test/test_file.py | 336 -- sys/lib/python/test/test_filecmp.py | 134 - sys/lib/python/test/test_fileinput.py | 227 - sys/lib/python/test/test_float.py | 110 - sys/lib/python/test/test_fnmatch.py | 46 - sys/lib/python/test/test_fork1.py | 32 - sys/lib/python/test/test_format.py | 248 - sys/lib/python/test/test_fpformat.py | 75 - sys/lib/python/test/test_frozen.py | 27 - sys/lib/python/test/test_funcattrs.py | 402 -- sys/lib/python/test/test_functools.py | 293 -- sys/lib/python/test/test_future.py | 106 - sys/lib/python/test/test_future1.py | 11 - sys/lib/python/test/test_future2.py | 10 - sys/lib/python/test/test_future3.py | 30 - sys/lib/python/test/test_gc.py | 636 --- sys/lib/python/test/test_gdbm.py | 46 - sys/lib/python/test/test_generators.py | 1839 ------- sys/lib/python/test/test_genexps.py | 280 -- sys/lib/python/test/test_getargs.py | 24 - sys/lib/python/test/test_getargs2.py | 264 - sys/lib/python/test/test_getopt.py | 180 - sys/lib/python/test/test_gettext.py | 458 -- sys/lib/python/test/test_gl.py | 150 - sys/lib/python/test/test_glob.py | 104 - sys/lib/python/test/test_global.py | 51 - sys/lib/python/test/test_grammar.py | 856 ---- sys/lib/python/test/test_grp.py | 89 - sys/lib/python/test/test_gzip.py | 149 - sys/lib/python/test/test_hash.py | 36 - sys/lib/python/test/test_hashlib.py | 191 - sys/lib/python/test/test_heapq.py | 286 -- sys/lib/python/test/test_hexoct.py | 116 - sys/lib/python/test/test_hmac.py | 168 - sys/lib/python/test/test_hotshot.py | 132 - sys/lib/python/test/test_htmllib.py | 69 - sys/lib/python/test/test_htmlparser.py | 318 -- sys/lib/python/test/test_httplib.py | 172 - sys/lib/python/test/test_imageop.py | 177 - sys/lib/python/test/test_imaplib.py | 12 - sys/lib/python/test/test_imgfile.py | 116 - sys/lib/python/test/test_imp.py | 43 - sys/lib/python/test/test_import.py | 236 - sys/lib/python/test/test_importhooks.py | 276 -- sys/lib/python/test/test_index.py | 223 - sys/lib/python/test/test_inspect.py | 482 -- sys/lib/python/test/test_ioctl.py | 41 - sys/lib/python/test/test_isinstance.py | 277 -- sys/lib/python/test/test_iter.py | 886 ---- sys/lib/python/test/test_iterlen.py | 258 - sys/lib/python/test/test_itertools.py | 969 ---- sys/lib/python/test/test_largefile.py | 170 - sys/lib/python/test/test_linuxaudiodev.py | 92 - sys/lib/python/test/test_list.py | 37 - sys/lib/python/test/test_locale.py | 115 - sys/lib/python/test/test_logging.py | 685 --- sys/lib/python/test/test_long.py | 503 -- sys/lib/python/test/test_long_future.py | 55 - sys/lib/python/test/test_longexp.py | 14 - sys/lib/python/test/test_macfs.py | 78 - sys/lib/python/test/test_macostools.py | 94 - sys/lib/python/test/test_macpath.py | 63 - sys/lib/python/test/test_mailbox.py | 1848 ------- sys/lib/python/test/test_marshal.py | 233 - sys/lib/python/test/test_math.py | 208 - sys/lib/python/test/test_md5.py | 58 - sys/lib/python/test/test_mhlib.py | 348 -- sys/lib/python/test/test_mimetools.py | 50 - sys/lib/python/test/test_mimetypes.py | 70 - sys/lib/python/test/test_minidom.py | 1397 ------ sys/lib/python/test/test_mmap.py | 395 -- sys/lib/python/test/test_module.py | 48 - sys/lib/python/test/test_multibytecodec.py | 231 - .../test/test_multibytecodec_support.py | 318 -- sys/lib/python/test/test_multifile.py | 66 - sys/lib/python/test/test_mutants.py | 292 -- sys/lib/python/test/test_netrc.py | 48 - sys/lib/python/test/test_new.py | 183 - sys/lib/python/test/test_nis.py | 39 - sys/lib/python/test/test_normalization.py | 88 - sys/lib/python/test/test_ntpath.py | 133 - sys/lib/python/test/test_old_mailbox.py | 153 - sys/lib/python/test/test_opcodes.py | 101 - sys/lib/python/test/test_openpty.py | 19 - sys/lib/python/test/test_operations.py | 78 - sys/lib/python/test/test_operator.py | 490 -- sys/lib/python/test/test_optparse.py | 1640 ------- sys/lib/python/test/test_os.py | 438 -- sys/lib/python/test/test_ossaudiodev.py | 163 - sys/lib/python/test/test_parser.py | 448 -- sys/lib/python/test/test_peepholer.py | 188 - sys/lib/python/test/test_pep247.py | 50 - sys/lib/python/test/test_pep263.py | 23 - sys/lib/python/test/test_pep277.py | 115 - sys/lib/python/test/test_pep292.py | 194 - sys/lib/python/test/test_pep352.py | 182 - sys/lib/python/test/test_pickle.py | 73 - sys/lib/python/test/test_pickletools.py | 3 - sys/lib/python/test/test_pkg.py | 259 - sys/lib/python/test/test_pkgimport.py | 82 - sys/lib/python/test/test_platform.py | 79 - sys/lib/python/test/test_plistlib.py | 193 - sys/lib/python/test/test_poll.py | 192 - sys/lib/python/test/test_popen.py | 40 - sys/lib/python/test/test_popen2.py | 78 - sys/lib/python/test/test_posix.py | 199 - sys/lib/python/test/test_posixpath.py | 515 -- sys/lib/python/test/test_pow.py | 126 - sys/lib/python/test/test_pprint.py | 217 - sys/lib/python/test/test_profile.py | 123 - sys/lib/python/test/test_profilehooks.py | 368 -- sys/lib/python/test/test_pty.py | 147 - sys/lib/python/test/test_pwd.py | 94 - sys/lib/python/test/test_pyclbr.py | 188 - sys/lib/python/test/test_pyexpat.py | 388 -- sys/lib/python/test/test_queue.py | 281 -- sys/lib/python/test/test_quopri.py | 199 - sys/lib/python/test/test_random.py | 552 --- sys/lib/python/test/test_re.py | 744 --- sys/lib/python/test/test_repr.py | 307 -- sys/lib/python/test/test_resource.py | 56 - sys/lib/python/test/test_rfc822.py | 257 - sys/lib/python/test/test_rgbimg.py | 70 - sys/lib/python/test/test_richcmp.py | 337 -- sys/lib/python/test/test_robotparser.py | 142 - sys/lib/python/test/test_runpy.py | 172 - sys/lib/python/test/test_sax.py | 788 --- sys/lib/python/test/test_scope.py | 561 --- sys/lib/python/test/test_scriptpackages.py | 52 - sys/lib/python/test/test_select.py | 70 - sys/lib/python/test/test_set.py | 1535 ------ sys/lib/python/test/test_sets.py | 856 ---- sys/lib/python/test/test_sgmllib.py | 439 -- sys/lib/python/test/test_sha.py | 52 - sys/lib/python/test/test_shelve.py | 135 - sys/lib/python/test/test_shlex.py | 192 - sys/lib/python/test/test_shutil.py | 157 - sys/lib/python/test/test_signal.py | 167 - sys/lib/python/test/test_site.py | 236 - sys/lib/python/test/test_slice.py | 110 - sys/lib/python/test/test_socket.py | 995 ---- sys/lib/python/test/test_socket_ssl.py | 134 - sys/lib/python/test/test_socketserver.py | 218 - sys/lib/python/test/test_softspace.py | 14 - sys/lib/python/test/test_sort.py | 289 -- sys/lib/python/test/test_sqlite.py | 17 - sys/lib/python/test/test_startfile.py | 37 - sys/lib/python/test/test_str.py | 89 - sys/lib/python/test/test_strftime.py | 158 - sys/lib/python/test/test_string.py | 113 - sys/lib/python/test/test_stringprep.py | 88 - sys/lib/python/test/test_strop.py | 134 - sys/lib/python/test/test_strptime.py | 523 -- sys/lib/python/test/test_struct.py | 625 --- sys/lib/python/test/test_structmembers.py | 48 - sys/lib/python/test/test_structseq.py | 104 - sys/lib/python/test/test_subprocess.py | 653 --- sys/lib/python/test/test_sunaudiodev.py | 28 - sys/lib/python/test/test_sundry.py | 77 - sys/lib/python/test/test_support.py | 517 -- sys/lib/python/test/test_symtable.py | 44 - sys/lib/python/test/test_syntax.py | 500 -- sys/lib/python/test/test_sys.py | 357 -- sys/lib/python/test/test_tarfile.py | 729 --- sys/lib/python/test/test_tcl.py | 157 - sys/lib/python/test/test_tempfile.py | 668 --- sys/lib/python/test/test_textwrap.py | 568 --- sys/lib/python/test/test_thread.py | 160 - sys/lib/python/test/test_threaded_import.py | 75 - sys/lib/python/test/test_threadedtempfile.py | 86 - sys/lib/python/test/test_threading.py | 208 - sys/lib/python/test/test_threading_local.py | 26 - sys/lib/python/test/test_threadsignals.py | 84 - sys/lib/python/test/test_time.py | 222 - sys/lib/python/test/test_timeout.py | 198 - sys/lib/python/test/test_tokenize.py | 114 - sys/lib/python/test/test_trace.py | 626 --- sys/lib/python/test/test_traceback.py | 162 - sys/lib/python/test/test_transformer.py | 35 - sys/lib/python/test/test_tuple.py | 83 - sys/lib/python/test/test_types.py | 286 -- sys/lib/python/test/test_ucn.py | 144 - sys/lib/python/test/test_unary.py | 59 - sys/lib/python/test/test_unicode.py | 828 ---- sys/lib/python/test/test_unicode_file.py | 213 - sys/lib/python/test/test_unicodedata.py | 225 - sys/lib/python/test/test_unittest.py | 31 - sys/lib/python/test/test_univnewlines.py | 123 - sys/lib/python/test/test_unpack.py | 131 - sys/lib/python/test/test_urllib.py | 560 --- sys/lib/python/test/test_urllib2.py | 1054 ---- sys/lib/python/test/test_urllib2net.py | 295 -- sys/lib/python/test/test_urllibnet.py | 160 - sys/lib/python/test/test_urlparse.py | 295 -- sys/lib/python/test/test_userdict.py | 350 -- sys/lib/python/test/test_userlist.py | 60 - sys/lib/python/test/test_userstring.py | 119 - sys/lib/python/test/test_uu.py | 180 - sys/lib/python/test/test_uuid.py | 459 -- sys/lib/python/test/test_wait3.py | 38 - sys/lib/python/test/test_wait4.py | 37 - sys/lib/python/test/test_warnings.py | 105 - sys/lib/python/test/test_wave.py | 32 - sys/lib/python/test/test_weakref.py | 1158 ----- sys/lib/python/test/test_whichdb.py | 66 - sys/lib/python/test/test_winreg.py | 156 - sys/lib/python/test/test_winsound.py | 209 - sys/lib/python/test/test_with.py | 620 --- sys/lib/python/test/test_wsgiref.py | 615 --- sys/lib/python/test/test_xdrlib.py | 3 - sys/lib/python/test/test_xml_etree.py | 354 -- sys/lib/python/test/test_xml_etree_c.py | 223 - sys/lib/python/test/test_xmllib.py | 51 - sys/lib/python/test/test_xmlrpc.py | 155 - sys/lib/python/test/test_xpickle.py | 44 - sys/lib/python/test/test_xrange.py | 64 - sys/lib/python/test/test_zipfile.py | 357 -- sys/lib/python/test/test_zipfile64.py | 101 - sys/lib/python/test/test_zipimport.py | 429 -- sys/lib/python/test/test_zlib.py | 481 -- sys/lib/python/test/testall.py | 4 - sys/lib/python/test/testcodec.py | 48 - sys/lib/python/test/testimg.uue | 1170 ----- sys/lib/python/test/testimgr.uue | 1170 ----- sys/lib/python/test/testrgb.uue | 971 ---- sys/lib/python/test/testtar.tar | Bin 133120 -> 0 bytes sys/lib/python/test/tf_inherit_check.py | 25 - .../python/test/threaded_import_hangers.py | 42 - sys/lib/python/test/time_hashlib.py | 87 - sys/lib/python/test/tokenize_tests.txt | 178 - sys/lib/python/test/xmltests.py | 21 - 476 files changed, 133470 deletions(-) delete mode 100644 sys/lib/python/test/185test.db delete mode 100644 sys/lib/python/test/README delete mode 100644 sys/lib/python/test/__init__.py delete mode 100644 sys/lib/python/test/audiotest.au delete mode 100644 sys/lib/python/test/autotest.py delete mode 100644 sys/lib/python/test/bad_coding.py delete mode 100644 sys/lib/python/test/bad_coding2.py delete mode 100644 sys/lib/python/test/badsyntax_future3.py delete mode 100644 sys/lib/python/test/badsyntax_future4.py delete mode 100644 sys/lib/python/test/badsyntax_future5.py delete mode 100644 sys/lib/python/test/badsyntax_future6.py delete mode 100644 sys/lib/python/test/badsyntax_future7.py delete mode 100644 sys/lib/python/test/badsyntax_future8.py delete mode 100644 sys/lib/python/test/badsyntax_future9.py delete mode 100644 sys/lib/python/test/badsyntax_nocaret.py delete mode 100644 sys/lib/python/test/check_soundcard.vbs delete mode 100644 sys/lib/python/test/cjkencodings_test.py delete mode 100644 sys/lib/python/test/crashers/README delete mode 100644 sys/lib/python/test/crashers/bogus_code_obj.py delete mode 100644 sys/lib/python/test/crashers/borrowed_ref_1.py delete mode 100644 sys/lib/python/test/crashers/borrowed_ref_2.py delete mode 100644 sys/lib/python/test/crashers/dangerous_subclassing.py delete mode 100644 sys/lib/python/test/crashers/gc_inspection.py delete mode 100644 sys/lib/python/test/crashers/infinite_rec_1.py delete mode 100644 sys/lib/python/test/crashers/infinite_rec_2.py delete mode 100644 sys/lib/python/test/crashers/infinite_rec_4.py delete mode 100644 sys/lib/python/test/crashers/infinite_rec_5.py delete mode 100644 sys/lib/python/test/crashers/loosing_dict_ref.py delete mode 100644 sys/lib/python/test/crashers/modify_dict_attr.py delete mode 100644 sys/lib/python/test/crashers/nasty_eq_vs_dict.py delete mode 100644 sys/lib/python/test/crashers/recursion_limit_too_high.py delete mode 100644 sys/lib/python/test/crashers/recursive_call.py delete mode 100644 sys/lib/python/test/crashers/weakref_in_del.py delete mode 100644 sys/lib/python/test/decimaltestdata/abs.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/add.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/base.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/clamp.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/compare.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/decimal128.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/decimal32.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/decimal64.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/divide.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/divideint.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/inexact.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/max.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/min.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/minus.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/multiply.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/normalize.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/plus.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/power.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/quantize.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/randomBound32.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/randoms.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/remainder.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/remainderNear.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/rescale.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/rounding.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/samequantum.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/squareroot.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/subtract.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/testall.decTest delete mode 100644 sys/lib/python/test/decimaltestdata/tointegral.decTest delete mode 100644 sys/lib/python/test/doctest_aliases.py delete mode 100644 sys/lib/python/test/double_const.py delete mode 100644 sys/lib/python/test/empty.vbs delete mode 100644 sys/lib/python/test/exception_hierarchy.txt delete mode 100644 sys/lib/python/test/fork_wait.py delete mode 100644 sys/lib/python/test/greyrgb.uue delete mode 100644 sys/lib/python/test/infinite_reload.py delete mode 100644 sys/lib/python/test/inspect_fodder.py delete mode 100644 sys/lib/python/test/inspect_fodder2.py delete mode 100644 sys/lib/python/test/leakers/README.txt delete mode 100644 sys/lib/python/test/leakers/__init__.py delete mode 100644 sys/lib/python/test/leakers/test_ctypes.py delete mode 100644 sys/lib/python/test/leakers/test_gestalt.py delete mode 100644 sys/lib/python/test/leakers/test_selftype.py delete mode 100644 sys/lib/python/test/list_tests.py delete mode 100644 sys/lib/python/test/mapping_tests.py delete mode 100644 sys/lib/python/test/output/test_MimeWriter delete mode 100644 sys/lib/python/test/output/test_cProfile delete mode 100644 sys/lib/python/test/output/test_cgi delete mode 100644 sys/lib/python/test/output/test_class delete mode 100644 sys/lib/python/test/output/test_cookie delete mode 100644 sys/lib/python/test/output/test_extcall delete mode 100644 sys/lib/python/test/output/test_frozen delete mode 100644 sys/lib/python/test/output/test_global delete mode 100644 sys/lib/python/test/output/test_grammar delete mode 100644 sys/lib/python/test/output/test_httplib delete mode 100644 sys/lib/python/test/output/test_linuxaudiodev delete mode 100644 sys/lib/python/test/output/test_logging delete mode 100644 sys/lib/python/test/output/test_math delete mode 100644 sys/lib/python/test/output/test_mmap delete mode 100644 sys/lib/python/test/output/test_new delete mode 100644 sys/lib/python/test/output/test_nis delete mode 100644 sys/lib/python/test/output/test_opcodes delete mode 100644 sys/lib/python/test/output/test_openpty delete mode 100644 sys/lib/python/test/output/test_operations delete mode 100644 sys/lib/python/test/output/test_ossaudiodev delete mode 100644 sys/lib/python/test/output/test_pep277 delete mode 100644 sys/lib/python/test/output/test_pkg delete mode 100644 sys/lib/python/test/output/test_poll delete mode 100644 sys/lib/python/test/output/test_popen delete mode 100644 sys/lib/python/test/output/test_popen2 delete mode 100644 sys/lib/python/test/output/test_profile delete mode 100644 sys/lib/python/test/output/test_pty delete mode 100644 sys/lib/python/test/output/test_pyexpat delete mode 100644 sys/lib/python/test/output/test_regex delete mode 100644 sys/lib/python/test/output/test_resource delete mode 100644 sys/lib/python/test/output/test_rgbimg delete mode 100644 sys/lib/python/test/output/test_scope delete mode 100644 sys/lib/python/test/output/test_signal delete mode 100644 sys/lib/python/test/output/test_thread delete mode 100644 sys/lib/python/test/output/test_threadedtempfile delete mode 100644 sys/lib/python/test/output/test_tokenize delete mode 100644 sys/lib/python/test/output/test_types delete mode 100644 sys/lib/python/test/output/test_winreg delete mode 100644 sys/lib/python/test/output/test_xdrlib delete mode 100644 sys/lib/python/test/output/xmltests delete mode 100644 sys/lib/python/test/outstanding_bugs.py delete mode 100644 sys/lib/python/test/pickletester.py delete mode 100644 sys/lib/python/test/pyclbr_input.py delete mode 100644 sys/lib/python/test/pydocfodder.py delete mode 100755 sys/lib/python/test/pystone.py delete mode 100755 sys/lib/python/test/re_tests.py delete mode 100644 sys/lib/python/test/regex_tests.py delete mode 100755 sys/lib/python/test/regrtest.py delete mode 100644 sys/lib/python/test/reperf.py delete mode 100644 sys/lib/python/test/sample_doctest.py delete mode 100644 sys/lib/python/test/seq_tests.py delete mode 100644 sys/lib/python/test/sgml_input.html delete mode 100644 sys/lib/python/test/sortperf.py delete mode 100644 sys/lib/python/test/string_tests.py delete mode 100644 sys/lib/python/test/test.xml delete mode 100644 sys/lib/python/test/test.xml.out delete mode 100644 sys/lib/python/test/test_MimeWriter.py delete mode 100644 sys/lib/python/test/test_StringIO.py delete mode 100644 sys/lib/python/test/test___all__.py delete mode 100644 sys/lib/python/test/test___future__.py delete mode 100644 sys/lib/python/test/test__locale.py delete mode 100755 sys/lib/python/test/test_aepack.py delete mode 100755 sys/lib/python/test/test_al.py delete mode 100644 sys/lib/python/test/test_anydbm.py delete mode 100644 sys/lib/python/test/test_applesingle.py delete mode 100755 sys/lib/python/test/test_array.py delete mode 100644 sys/lib/python/test/test_ast.py delete mode 100644 sys/lib/python/test/test_asynchat.py delete mode 100644 sys/lib/python/test/test_atexit.py delete mode 100644 sys/lib/python/test/test_audioop.py delete mode 100644 sys/lib/python/test/test_augassign.py delete mode 100644 sys/lib/python/test/test_base64.py delete mode 100644 sys/lib/python/test/test_bastion.py delete mode 100644 sys/lib/python/test/test_bigaddrspace.py delete mode 100644 sys/lib/python/test/test_bigmem.py delete mode 100755 sys/lib/python/test/test_binascii.py delete mode 100755 sys/lib/python/test/test_binhex.py delete mode 100644 sys/lib/python/test/test_binop.py delete mode 100644 sys/lib/python/test/test_bisect.py delete mode 100644 sys/lib/python/test/test_bool.py delete mode 100755 sys/lib/python/test/test_bsddb.py delete mode 100644 sys/lib/python/test/test_bsddb185.py delete mode 100644 sys/lib/python/test/test_bsddb3.py delete mode 100644 sys/lib/python/test/test_bufio.py delete mode 100644 sys/lib/python/test/test_builtin.py delete mode 100644 sys/lib/python/test/test_bz2.py delete mode 100644 sys/lib/python/test/test_cProfile.py delete mode 100644 sys/lib/python/test/test_calendar.py delete mode 100644 sys/lib/python/test/test_call.py delete mode 100644 sys/lib/python/test/test_capi.py delete mode 100755 sys/lib/python/test/test_cd.py delete mode 100644 sys/lib/python/test/test_cfgparser.py delete mode 100644 sys/lib/python/test/test_cgi.py delete mode 100644 sys/lib/python/test/test_charmapcodec.py delete mode 100755 sys/lib/python/test/test_cl.py delete mode 100644 sys/lib/python/test/test_class.py delete mode 100755 sys/lib/python/test/test_cmath.py delete mode 100644 sys/lib/python/test/test_cmd_line.py delete mode 100644 sys/lib/python/test/test_code.py delete mode 100644 sys/lib/python/test/test_codeccallbacks.py delete mode 100644 sys/lib/python/test/test_codecencodings_cn.py delete mode 100644 sys/lib/python/test/test_codecencodings_hk.py delete mode 100644 sys/lib/python/test/test_codecencodings_jp.py delete mode 100644 sys/lib/python/test/test_codecencodings_kr.py delete mode 100644 sys/lib/python/test/test_codecencodings_tw.py delete mode 100644 sys/lib/python/test/test_codecmaps_cn.py delete mode 100644 sys/lib/python/test/test_codecmaps_hk.py delete mode 100644 sys/lib/python/test/test_codecmaps_jp.py delete mode 100644 sys/lib/python/test/test_codecmaps_kr.py delete mode 100644 sys/lib/python/test/test_codecmaps_tw.py delete mode 100644 sys/lib/python/test/test_codecs.py delete mode 100644 sys/lib/python/test/test_codeop.py delete mode 100644 sys/lib/python/test/test_coding.py delete mode 100644 sys/lib/python/test/test_coercion.py delete mode 100644 sys/lib/python/test/test_colorsys.py delete mode 100644 sys/lib/python/test/test_commands.py delete mode 100644 sys/lib/python/test/test_compare.py delete mode 100644 sys/lib/python/test/test_compile.py delete mode 100644 sys/lib/python/test/test_compiler.py delete mode 100644 sys/lib/python/test/test_complex.py delete mode 100644 sys/lib/python/test/test_complex_args.py delete mode 100644 sys/lib/python/test/test_contains.py delete mode 100644 sys/lib/python/test/test_contextlib.py delete mode 100644 sys/lib/python/test/test_cookie.py delete mode 100644 sys/lib/python/test/test_cookielib.py delete mode 100644 sys/lib/python/test/test_copy.py delete mode 100644 sys/lib/python/test/test_copy_reg.py delete mode 100644 sys/lib/python/test/test_cpickle.py delete mode 100755 sys/lib/python/test/test_crypt.py delete mode 100644 sys/lib/python/test/test_csv.py delete mode 100644 sys/lib/python/test/test_ctypes.py delete mode 100644 sys/lib/python/test/test_curses.py delete mode 100644 sys/lib/python/test/test_datetime.py delete mode 100755 sys/lib/python/test/test_dbm.py delete mode 100644 sys/lib/python/test/test_decimal.py delete mode 100644 sys/lib/python/test/test_decorators.py delete mode 100644 sys/lib/python/test/test_defaultdict.py delete mode 100644 sys/lib/python/test/test_deque.py delete mode 100644 sys/lib/python/test/test_descr.py delete mode 100644 sys/lib/python/test/test_descrtut.py delete mode 100644 sys/lib/python/test/test_dict.py delete mode 100644 sys/lib/python/test/test_difflib.py delete mode 100644 sys/lib/python/test/test_difflib_expect.html delete mode 100644 sys/lib/python/test/test_dircache.py delete mode 100644 sys/lib/python/test/test_dis.py delete mode 100644 sys/lib/python/test/test_distutils.py delete mode 100755 sys/lib/python/test/test_dl.py delete mode 100644 sys/lib/python/test/test_doctest.py delete mode 100644 sys/lib/python/test/test_doctest.txt delete mode 100644 sys/lib/python/test/test_doctest2.py delete mode 100644 sys/lib/python/test/test_doctest2.txt delete mode 100644 sys/lib/python/test/test_doctest3.txt delete mode 100644 sys/lib/python/test/test_doctest4.txt delete mode 100644 sys/lib/python/test/test_dumbdbm.py delete mode 100644 sys/lib/python/test/test_dummy_thread.py delete mode 100644 sys/lib/python/test/test_dummy_threading.py delete mode 100644 sys/lib/python/test/test_email.py delete mode 100644 sys/lib/python/test/test_email_codecs.py delete mode 100644 sys/lib/python/test/test_email_renamed.py delete mode 100644 sys/lib/python/test/test_enumerate.py delete mode 100644 sys/lib/python/test/test_eof.py delete mode 100755 sys/lib/python/test/test_errno.py delete mode 100644 sys/lib/python/test/test_exception_variations.py delete mode 100644 sys/lib/python/test/test_exceptions.py delete mode 100644 sys/lib/python/test/test_extcall.py delete mode 100755 sys/lib/python/test/test_fcntl.py delete mode 100644 sys/lib/python/test/test_file.py delete mode 100644 sys/lib/python/test/test_filecmp.py delete mode 100644 sys/lib/python/test/test_fileinput.py delete mode 100644 sys/lib/python/test/test_float.py delete mode 100644 sys/lib/python/test/test_fnmatch.py delete mode 100644 sys/lib/python/test/test_fork1.py delete mode 100644 sys/lib/python/test/test_format.py delete mode 100644 sys/lib/python/test/test_fpformat.py delete mode 100644 sys/lib/python/test/test_frozen.py delete mode 100644 sys/lib/python/test/test_funcattrs.py delete mode 100644 sys/lib/python/test/test_functools.py delete mode 100644 sys/lib/python/test/test_future.py delete mode 100644 sys/lib/python/test/test_future1.py delete mode 100644 sys/lib/python/test/test_future2.py delete mode 100644 sys/lib/python/test/test_future3.py delete mode 100644 sys/lib/python/test/test_gc.py delete mode 100755 sys/lib/python/test/test_gdbm.py delete mode 100644 sys/lib/python/test/test_generators.py delete mode 100644 sys/lib/python/test/test_genexps.py delete mode 100644 sys/lib/python/test/test_getargs.py delete mode 100644 sys/lib/python/test/test_getargs2.py delete mode 100644 sys/lib/python/test/test_getopt.py delete mode 100644 sys/lib/python/test/test_gettext.py delete mode 100755 sys/lib/python/test/test_gl.py delete mode 100644 sys/lib/python/test/test_glob.py delete mode 100644 sys/lib/python/test/test_global.py delete mode 100644 sys/lib/python/test/test_grammar.py delete mode 100755 sys/lib/python/test/test_grp.py delete mode 100644 sys/lib/python/test/test_gzip.py delete mode 100644 sys/lib/python/test/test_hash.py delete mode 100644 sys/lib/python/test/test_hashlib.py delete mode 100644 sys/lib/python/test/test_heapq.py delete mode 100644 sys/lib/python/test/test_hexoct.py delete mode 100644 sys/lib/python/test/test_hmac.py delete mode 100644 sys/lib/python/test/test_hotshot.py delete mode 100644 sys/lib/python/test/test_htmllib.py delete mode 100755 sys/lib/python/test/test_htmlparser.py delete mode 100644 sys/lib/python/test/test_httplib.py delete mode 100755 sys/lib/python/test/test_imageop.py delete mode 100644 sys/lib/python/test/test_imaplib.py delete mode 100755 sys/lib/python/test/test_imgfile.py delete mode 100644 sys/lib/python/test/test_imp.py delete mode 100644 sys/lib/python/test/test_import.py delete mode 100644 sys/lib/python/test/test_importhooks.py delete mode 100644 sys/lib/python/test/test_index.py delete mode 100644 sys/lib/python/test/test_inspect.py delete mode 100644 sys/lib/python/test/test_ioctl.py delete mode 100644 sys/lib/python/test/test_isinstance.py delete mode 100644 sys/lib/python/test/test_iter.py delete mode 100644 sys/lib/python/test/test_iterlen.py delete mode 100644 sys/lib/python/test/test_itertools.py delete mode 100644 sys/lib/python/test/test_largefile.py delete mode 100644 sys/lib/python/test/test_linuxaudiodev.py delete mode 100644 sys/lib/python/test/test_list.py delete mode 100644 sys/lib/python/test/test_locale.py delete mode 100644 sys/lib/python/test/test_logging.py delete mode 100644 sys/lib/python/test/test_long.py delete mode 100644 sys/lib/python/test/test_long_future.py delete mode 100644 sys/lib/python/test/test_longexp.py delete mode 100644 sys/lib/python/test/test_macfs.py delete mode 100644 sys/lib/python/test/test_macostools.py delete mode 100644 sys/lib/python/test/test_macpath.py delete mode 100644 sys/lib/python/test/test_mailbox.py delete mode 100644 sys/lib/python/test/test_marshal.py delete mode 100644 sys/lib/python/test/test_math.py delete mode 100644 sys/lib/python/test/test_md5.py delete mode 100644 sys/lib/python/test/test_mhlib.py delete mode 100644 sys/lib/python/test/test_mimetools.py delete mode 100644 sys/lib/python/test/test_mimetypes.py delete mode 100644 sys/lib/python/test/test_minidom.py delete mode 100644 sys/lib/python/test/test_mmap.py delete mode 100644 sys/lib/python/test/test_module.py delete mode 100644 sys/lib/python/test/test_multibytecodec.py delete mode 100644 sys/lib/python/test/test_multibytecodec_support.py delete mode 100644 sys/lib/python/test/test_multifile.py delete mode 100644 sys/lib/python/test/test_mutants.py delete mode 100644 sys/lib/python/test/test_netrc.py delete mode 100644 sys/lib/python/test/test_new.py delete mode 100644 sys/lib/python/test/test_nis.py delete mode 100644 sys/lib/python/test/test_normalization.py delete mode 100644 sys/lib/python/test/test_ntpath.py delete mode 100644 sys/lib/python/test/test_old_mailbox.py delete mode 100644 sys/lib/python/test/test_opcodes.py delete mode 100644 sys/lib/python/test/test_openpty.py delete mode 100644 sys/lib/python/test/test_operations.py delete mode 100644 sys/lib/python/test/test_operator.py delete mode 100644 sys/lib/python/test/test_optparse.py delete mode 100644 sys/lib/python/test/test_os.py delete mode 100644 sys/lib/python/test/test_ossaudiodev.py delete mode 100644 sys/lib/python/test/test_parser.py delete mode 100644 sys/lib/python/test/test_peepholer.py delete mode 100644 sys/lib/python/test/test_pep247.py delete mode 100644 sys/lib/python/test/test_pep263.py delete mode 100644 sys/lib/python/test/test_pep277.py delete mode 100644 sys/lib/python/test/test_pep292.py delete mode 100644 sys/lib/python/test/test_pep352.py delete mode 100644 sys/lib/python/test/test_pickle.py delete mode 100644 sys/lib/python/test/test_pickletools.py delete mode 100644 sys/lib/python/test/test_pkg.py delete mode 100644 sys/lib/python/test/test_pkgimport.py delete mode 100644 sys/lib/python/test/test_platform.py delete mode 100644 sys/lib/python/test/test_plistlib.py delete mode 100644 sys/lib/python/test/test_poll.py delete mode 100644 sys/lib/python/test/test_popen.py delete mode 100644 sys/lib/python/test/test_popen2.py delete mode 100644 sys/lib/python/test/test_posix.py delete mode 100644 sys/lib/python/test/test_posixpath.py delete mode 100644 sys/lib/python/test/test_pow.py delete mode 100644 sys/lib/python/test/test_pprint.py delete mode 100644 sys/lib/python/test/test_profile.py delete mode 100644 sys/lib/python/test/test_profilehooks.py delete mode 100644 sys/lib/python/test/test_pty.py delete mode 100644 sys/lib/python/test/test_pwd.py delete mode 100644 sys/lib/python/test/test_pyclbr.py delete mode 100644 sys/lib/python/test/test_pyexpat.py delete mode 100644 sys/lib/python/test/test_queue.py delete mode 100644 sys/lib/python/test/test_quopri.py delete mode 100644 sys/lib/python/test/test_random.py delete mode 100644 sys/lib/python/test/test_re.py delete mode 100644 sys/lib/python/test/test_repr.py delete mode 100644 sys/lib/python/test/test_resource.py delete mode 100644 sys/lib/python/test/test_rfc822.py delete mode 100644 sys/lib/python/test/test_rgbimg.py delete mode 100644 sys/lib/python/test/test_richcmp.py delete mode 100644 sys/lib/python/test/test_robotparser.py delete mode 100644 sys/lib/python/test/test_runpy.py delete mode 100644 sys/lib/python/test/test_sax.py delete mode 100644 sys/lib/python/test/test_scope.py delete mode 100644 sys/lib/python/test/test_scriptpackages.py delete mode 100644 sys/lib/python/test/test_select.py delete mode 100644 sys/lib/python/test/test_set.py delete mode 100644 sys/lib/python/test/test_sets.py delete mode 100644 sys/lib/python/test/test_sgmllib.py delete mode 100644 sys/lib/python/test/test_sha.py delete mode 100644 sys/lib/python/test/test_shelve.py delete mode 100644 sys/lib/python/test/test_shlex.py delete mode 100644 sys/lib/python/test/test_shutil.py delete mode 100644 sys/lib/python/test/test_signal.py delete mode 100644 sys/lib/python/test/test_site.py delete mode 100644 sys/lib/python/test/test_slice.py delete mode 100644 sys/lib/python/test/test_socket.py delete mode 100644 sys/lib/python/test/test_socket_ssl.py delete mode 100644 sys/lib/python/test/test_socketserver.py delete mode 100644 sys/lib/python/test/test_softspace.py delete mode 100644 sys/lib/python/test/test_sort.py delete mode 100644 sys/lib/python/test/test_sqlite.py delete mode 100644 sys/lib/python/test/test_startfile.py delete mode 100644 sys/lib/python/test/test_str.py delete mode 100755 sys/lib/python/test/test_strftime.py delete mode 100644 sys/lib/python/test/test_string.py delete mode 100644 sys/lib/python/test/test_stringprep.py delete mode 100644 sys/lib/python/test/test_strop.py delete mode 100644 sys/lib/python/test/test_strptime.py delete mode 100644 sys/lib/python/test/test_struct.py delete mode 100644 sys/lib/python/test/test_structmembers.py delete mode 100644 sys/lib/python/test/test_structseq.py delete mode 100644 sys/lib/python/test/test_subprocess.py delete mode 100644 sys/lib/python/test/test_sunaudiodev.py delete mode 100644 sys/lib/python/test/test_sundry.py delete mode 100644 sys/lib/python/test/test_support.py delete mode 100644 sys/lib/python/test/test_symtable.py delete mode 100644 sys/lib/python/test/test_syntax.py delete mode 100644 sys/lib/python/test/test_sys.py delete mode 100644 sys/lib/python/test/test_tarfile.py delete mode 100644 sys/lib/python/test/test_tcl.py delete mode 100644 sys/lib/python/test/test_tempfile.py delete mode 100644 sys/lib/python/test/test_textwrap.py delete mode 100644 sys/lib/python/test/test_thread.py delete mode 100644 sys/lib/python/test/test_threaded_import.py delete mode 100644 sys/lib/python/test/test_threadedtempfile.py delete mode 100644 sys/lib/python/test/test_threading.py delete mode 100644 sys/lib/python/test/test_threading_local.py delete mode 100644 sys/lib/python/test/test_threadsignals.py delete mode 100644 sys/lib/python/test/test_time.py delete mode 100644 sys/lib/python/test/test_timeout.py delete mode 100644 sys/lib/python/test/test_tokenize.py delete mode 100644 sys/lib/python/test/test_trace.py delete mode 100644 sys/lib/python/test/test_traceback.py delete mode 100644 sys/lib/python/test/test_transformer.py delete mode 100644 sys/lib/python/test/test_tuple.py delete mode 100644 sys/lib/python/test/test_types.py delete mode 100644 sys/lib/python/test/test_ucn.py delete mode 100644 sys/lib/python/test/test_unary.py delete mode 100644 sys/lib/python/test/test_unicode.py delete mode 100644 sys/lib/python/test/test_unicode_file.py delete mode 100644 sys/lib/python/test/test_unicodedata.py delete mode 100644 sys/lib/python/test/test_unittest.py delete mode 100644 sys/lib/python/test/test_univnewlines.py delete mode 100644 sys/lib/python/test/test_unpack.py delete mode 100644 sys/lib/python/test/test_urllib.py delete mode 100644 sys/lib/python/test/test_urllib2.py delete mode 100644 sys/lib/python/test/test_urllib2net.py delete mode 100644 sys/lib/python/test/test_urllibnet.py delete mode 100644 sys/lib/python/test/test_urlparse.py delete mode 100644 sys/lib/python/test/test_userdict.py delete mode 100644 sys/lib/python/test/test_userlist.py delete mode 100755 sys/lib/python/test/test_userstring.py delete mode 100644 sys/lib/python/test/test_uu.py delete mode 100644 sys/lib/python/test/test_uuid.py delete mode 100644 sys/lib/python/test/test_wait3.py delete mode 100644 sys/lib/python/test/test_wait4.py delete mode 100644 sys/lib/python/test/test_warnings.py delete mode 100644 sys/lib/python/test/test_wave.py delete mode 100644 sys/lib/python/test/test_weakref.py delete mode 100644 sys/lib/python/test/test_whichdb.py delete mode 100644 sys/lib/python/test/test_winreg.py delete mode 100644 sys/lib/python/test/test_winsound.py delete mode 100644 sys/lib/python/test/test_with.py delete mode 100755 sys/lib/python/test/test_wsgiref.py delete mode 100644 sys/lib/python/test/test_xdrlib.py delete mode 100644 sys/lib/python/test/test_xml_etree.py delete mode 100644 sys/lib/python/test/test_xml_etree_c.py delete mode 100644 sys/lib/python/test/test_xmllib.py delete mode 100644 sys/lib/python/test/test_xmlrpc.py delete mode 100644 sys/lib/python/test/test_xpickle.py delete mode 100644 sys/lib/python/test/test_xrange.py delete mode 100644 sys/lib/python/test/test_zipfile.py delete mode 100644 sys/lib/python/test/test_zipfile64.py delete mode 100644 sys/lib/python/test/test_zipimport.py delete mode 100644 sys/lib/python/test/test_zlib.py delete mode 100644 sys/lib/python/test/testall.py delete mode 100644 sys/lib/python/test/testcodec.py delete mode 100644 sys/lib/python/test/testimg.uue delete mode 100644 sys/lib/python/test/testimgr.uue delete mode 100644 sys/lib/python/test/testrgb.uue delete mode 100644 sys/lib/python/test/testtar.tar delete mode 100644 sys/lib/python/test/tf_inherit_check.py delete mode 100644 sys/lib/python/test/threaded_import_hangers.py delete mode 100644 sys/lib/python/test/time_hashlib.py delete mode 100644 sys/lib/python/test/tokenize_tests.txt delete mode 100644 sys/lib/python/test/xmltests.py diff --git a/sys/lib/python/test/185test.db b/sys/lib/python/test/185test.db deleted file mode 100644 index 14cb5e258bc0961fa22527dcb5d947a6a0fd5480..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI!F$%&k6vpwdEl39?E*_+VxVZETogm3F&#|5EvW>p)=!6hL2%%!YfB_?hOiN-`lllUss(0VDkB{x+ zV>>gQt(|>lvK`LH%~5@2!8Sa5^#)cC+^0Yp?ZN&4&3u{`ddw zFMs(<^)G+1ukrhT`paJ`|Lfy#eByGPEX$HO&N9cg9UFh8xU$^FUs;kQDZV+mljpgE zC!~~Rk#cyLrI}?IhNfGlVcC|Q+m?yTGA&(IRZZ6oLpOEPGIU+T4Mib;*`{vTc!VMv zifAe+hBEkrd?(d(v;|^J(l#k$n1mP`?c+ihXw@)55$Lk;C+euGu9*tQx46hnLT{yc zqw(!zmD!1E$RgKl)GPH`xl(O51|pkBbALP>UR~YZ4=)~WFK6>0N@b4ji6YCJqOO`~ zjum)8U})Y@McMRh)Ay$H&`q>V75W2KqPl&S=d{?$11C?@B#NU9vA6%B_I-!c`x))ohp z6=lXMz^V()9#6Bnqve*wGu=w1({2ieCWfgX3QQd&4kSZ198FObno>B<%9DKIf`v_5 zHVr#k2EhVMtaE~)8j-sUMzb)=a#1sMBk{su6=$X?aF$}Gk(Z7ak(Y#;mMeA=%!AR? zbE8a4^K`WsPeu>!GKw@U(aktqrqe|hS`I^7oSLKR+|P4WYWL_4E2)~1g2niLqtk6s zyewO(t|(luMYX%4VrpRm4ip*+(Ve!Dqn z4^#!TIl8U#%^uzF>yCjfV3~=+3j>~2Z71@lZs4Y=q?wu?&b-OPaOKbJ+)`63cHQyf zZoF6|fhZfg7EZm%-DD9gbHk9qC1JP-?-o9`EF)^7nl7T*Xdb13BJz|f=&9po6Ev+E z?Y>BfdSco0#8eHYHRy4DCABb>b5jw^Yl&fl~rS@4p zvW#({tFlDa5O7e^*faV<{Noy^NJO%a4{FQ?QX3r$<>vTa7-@^q4Bk!*2%uWR!8 zJX(IQ1TN-_%; zv2Q94Ejm^(xtsd4+}350we$F9HbHY*Dsr|2Zb+<^Yzf$!DQC^oMV6|R-Wiy*6Rv#Q z*Htia&E#!2TA7}JwS-)kG|$LA)f|Y;s@j%wCr~4a6Pp4hYS!3XMUKPRHQHfAf3~vj zAqg0P)y!lVEM`e8o4rm(o6&S`4M7vF*KO9E8bjSz*}TN_RBn$Fe`0vNJZL!_#PwY? zO_Z!Hn_?0_xXGOviUQZRy7oN3!;JLvk|_5qXBa0BhRbtI+Ze=)U=;X)kT(Q%U?wv^ zpPG))kXVIDR!)Ky?~5&g?`8fZ4dR5->pI5>p&RSV#FVQ#CwH8=moIIaxAUOiHy+fa*-?3^=12GKF?+vl>>Tdh z7Y-AH8QN5(a@4+l`C%EB=8FH4uD>t-x%a^ketQ*-dPjo)?dgkc@u0IIzSTDNPR>uBJeajt(Xp~o`n>Ny z>zWVqv@L8}so!b$-grg2zHgRp&SR!|ChoMTM0g%&`(#!>g}w*y>&Bfbf^2_mN@;ecV-p~uNKF9o&M*j@}X~Q zyNh^7k{3zNZnfUbUv<>O-pl0~6**J>*V3P#eCsJcc%^lGQ`;%TG z<)??`3{s(x!m1uE>0IlVejO9rL=kSb^l3i zp3d_2?QCOL`S0Vw(@t<&)IX1>ojozzX?yQJJAdD`-rp5wtk3R-dQtW0Z^yf@*nD)_ zGLlz)uOsnv`Jc;QUrqA&^BvdQQPb{qxl;V{M|Zbycktt7lA4K7ohq+))c-nm|7uS^ zcpLPGXs}m3dbZQ}egE>WrNP^eyZ(|+cB_4d5+b<39qhEgZ z!K%F2n7utKZIll_`kU&x8#c5H@$ZGbe;i)_HQ)Gn*fcKq(PsHle)h8b=f~rhn=j9P zAC+$>dV6!a+uwYa2k(zJUp_m3f7`9JkLLAmTYlEF z{_F7JKL&fBKW?XD_pHCM+9}YrKR=v5-`pC#JK2>I^>~LG^frz1hY!b3s3-gH!}i|y zldC5K2`aC6`upY9?#Ai6$%dAV51*AKc2M0r{r$fDdgJcH)mC@tn=e_tPL7%!6d zoBLg6UwURLgSJ}uuz$RD|JU?WFtiKvhi5dSD~)IUfB2tY7hnH*Iz8F64@%```dZq3 z^~e6Oy7{-{kMB43*4^m~Ij{ITFQ;$E5%Zt)(YO1&UVgt>?-a{)vHRxB$)54+`KPZ} zv!@^Rr+Ra@|KwNdxAx_;r#q*2#&ApheYYX@RGVGBdH=_({rA(O>rrdt`*eF4=?~>! zcHV5C{^!%JA6K#W>#O&zo!(}#+_TUB>+sJ~`TIY=ety`zx+;_^O_6!}`fYw%EB@z0 zyQBW?xh8MbTl#XQo&294-j_Po`)|L0?}xwBT}!g!TKChR2d&;;?d$wxdrzJ0ZSEF3 zg}+zcxbuyTC-U@cS}A`PJ3l0ECU1KGG%t3avJXEF;xh9aU-K$Lu_NujKM6MeE*y{k z2)5l%y`JISc6VBDvp-%|{>IL`Kc4Jlf6n3!Th5=m|2X?bzuuS~f16ZGXIf>sVeyS$ zxi`r*|3X+sXU&a`xc-vfty4~V@_)VmQr=me@Ben3dLJg{4`$>@rQtb`K1!i-rHT_Yi{TRT5fee9=u&%|8jA{{np^vZ)el(T5ZrX zKE3_pa_5=&aQ^;>WqzCb{asBgKlKl~>=xgZxboSjTdgV-3)JH6_lwe#S6%aD z)+?>f4RuFpR0{Mz>;rydyBh9ahNX*#$?!?{b*W>S59 z_Q&U;^w&YP^|e~wb|z|Z2UFa#-W+{lcc1NL!xO%2mjC-~zqL^)PLEGk^nBzkx425BzWsUsolF0{;$-g>U!Cp`d-?W@t#bb6 z@K0&$Wo7o`^U|1%PiA|)LSd)y{q5Oh``1!C{}jgR^yq9%@9h=q!f$_k@$0`9)%a7A z>y!IryH$L#Tgv}=yRSXpu9)9$Qz0CmWv{niJ$qibd3SN&|J!a!-_IPuyS)?kUhh;I z&Exk6Bkfn+kUsJ=_wM3C>ukL!Rk=Stf3pj}76t7<&8_K;T5S}zOSJ#{=~wK{U61{y z$w4yBOU<3FBIp0}@J}6Iyz#+ZFdp8=rFMC*td0M9@;Tq#+PhN@eQBDGgJOMqtH>sA z&c5oews)iX!6+TizRx?%-cDJY{(f>`Y(3q4;PzEabshv(*EQ4INAHH+Bom^6mX0_jG&PIKMZq_3?w-sBY|4 z+UeV)Kf}GP&4~YMEhfRuWu^A=b*1E-zP&l>Y&3V(GvofjI&+t`!plmT%|Gn_xvIZ@ z9kf2@>FS>2Fq-P+W+nQ9|z+1}o)mAdN1m&1|pYNu7YvnNwwsi`&GFE+H3^P{}^YNJ^h`HNNV z##Fbo+bVOxmy^$aXXho;yMMSEx2MlNIi^``Riwp- z!#~_XVS{F`PS59V9DVq5>1;l)bdN4iXMM9XQnOaMP!N4AfVaE%ly=Sz?lp!| zt|hq!#iQN+{`EY4u~X`w-kr{ya&IzCF?W?-{Q2PXvbMRwN+)MywJ&I=YEmhc%i6>5 zC&$k7y{-P};e1t>dGAW=?roQv`ToIYx4!w5rp_;xdQZ|$IlZu3D9g9MpB`tg3a^{f z<@vH{()Wqc-`pv5mVcb>N7bDtyl{E4f_EwP#qO)U?V7#+`Rhd7eA=#`o?p#m+gv*R zSH;bWdHCt;owfUu>#9=0<-W z%_f66SH#R!=+oc7?you<&&%5N*F$$gO$No?VzDBAfA{skt#7<6Ti5%C!GsE891doS;# zE+y}ji#7H9_x;nXvb9s2j1L|Rzj0{;yVZ&v=iAqh!=U_>DxYAHHGA+~T~$hj@*w_l z_i162pNN&SA9pKNQ!Wg*Tq+e9>)`UsRBt{Ji`O^vxkw)PrBZR1mQRlNAJWRR?#^)O z&KX0$G}3ZuuR!y+pO4O#<(-|qMRNHd_|nMB2Zf!zYJc(dVn68Dp0adszKT;lxU==W za=FOrXJ0>G#ibXOy;*X1r!2KmX!mQowG!|_R4=|1Pp;514M-dtu0-|AHvWBBFn+$ndS3s!pVXcDaix!G&h z>OFOOFg%N^%m!mPXNe(qWH_y;O1W5Nqr=s?Q(-n(B{~ZowQsnI&$dg&ra0dpo#y4< zGhT_$6GvgK*eu!{J?B*b#QWH6^fnCc=534=FH@NWtWSkHXA>DKE2I~t#W@9-A5gxwY(3^;$ETL zGpC=fF0~T9t39kP0@dNCw}DYC?v=Xw{9t~r>~cHspdP^koGqB zFoW>B>q@SBb~Q}f?IvTcZpS03y1UUVrGD;GnR0tKkL$Jiz#0BHI$vsq?ON4?*el9y z*R|z65U0+5d^|f}R@kofeRAW|7L~+e_r$+h2W3Q8RSBh?KK7Kp=2G`5-Y#Dldo}`{B7s{=c z#L0f&ZtU(o+1spiijAruk0zO1W7T*uzWaQ8cy6CrFc+#tyq zsZgfq`NQbOyBnSzk35Q!3`bIvu2tQwzvy?R1d#(jKf7{6R?YI|X#RCEcFRt+p9#9& zp#;X2xK54L6aV`9QxSi*4Q|*?^ zWl@rH*$AWCWyW&~+$*cu)q|V$+x>xI!5b&(hL+G393%GU ze%focMZ-z;xpVDmd718t2nO*^>QAEnpe037=p@t8%x62bGDAs%Xr`-sS7BR1p2ewi zoBg=6rgeqa9T?Squ$-mcUWd<}Rqo%Ooc;i(bZyy?X-TkSwO-n(^cYn(hqL3e#hsL! zew291aygzvy;iLwvofbm$G}2Tt4h;?sK{`Dt_-T$9ta%Ir<2RunZ?o#iI){QTi)L+ zMY`Oe`ZU7^lkfM7tl6tjt#+^Fc;jKxYZXhaaqu7^!~xjk_U!m_7Ft}lT(0%} zj7UoM5@gMZQJ}eUYYAgsfz$k1b%Pl9fiw91dB5S7erA zW!;iNn8_s;3vX$RFpf+iRFi9x={UN~FiN!Y7kV5e%T(nVS;vAQ2nZLf#Im6=T_t`L zg6k-@D@InBf{QI(>0jGjY_%J9k8nCUS2#b z+pS7fS4>Gy7sG`V}mD>rq)JRbfScjS5(QCC$J!bK2rU5b}%OA&ghvznWHzeQty5jgVwRR*UZ zLqeepb(LMr+G?$@IEJKktvGN6j^-5vQni76x;&mX!g(uwse`pTbFPStGQ!2mW_uM@vwV>b*>DsIe68;* zu};fI7zdT+~Bt&fHB3rJdfJZv%cqIa~=_##J&&gvhB^_vA#1I)&ZpZ~GjxNuOrL zqIGkXMzNh#DioXZW?n0nKYn(?var;5_ssBk9L*)Yva3j@DEm+uM-SEs?@qI8zuvSsR-{W6uO}d=e>8tNoexI!*HKnVql_{Ji z{`FY9->#$`X0V>XpHXp>Soc;0o zYB>)2&w_p-n;w00tm&X!;bVrqRN2Dn>#sjXo>6&z-z`kfzFj!MtgzSPOxC<)+I#cU zUrxUpT?@!Rvt9(f6*tglA`MtJqO}TH9q|E`Qu*yyjL0sC-d+iY3r3{#qtLEce%-yyYHUdet6kF;x^NCbgvxPgRoPl zj9AQOoeozTynAx?VN3YZ-qy0kgYrqYyhgWaB&`1+uugUN_tvX7ObPD8+-L5zlWA=t z6l1|rwUyN2+q>uEU*682osKq4j}N2MQUAW#kjo~lnUG2OPW#<6`~9Z$g?l~rdv5w8 zr6;}eoX$DRZD|x$IvD@@#(#R?KDFm9b8+Ugr_DxMW_iU+1jndX-)zwDUa+6}7Z*t- z3Kz@4QfbWDLC%LVWAy9uFaP=RzCz16o~FjRTkDGRDYc}P_GD8729l}Be!rb$8m(s7P}kIfP*=v1V# z+T`r%*E_m*RH@Coo$Jfe*+eipW=%rCH{r$n>&E@5T0S**@A{44hZvtphNyN2qCp|! zLws13FBi6Q)8`$Yo%!m>H4R>*m`q2k+TyWGS1Z#RNyq_^+)PHKNzx^mM>+>!sAd>| z*|{EtnwqPKEE}dKAqgl`IVq7DL69;YT&?GGQ^`z8MY4dIYbp|r6anClLbPA7g9u47 zjtM|*s!Hf6Ch~7cQVwzupk>u8%b}%_&x9g6JRg>0np$qlR<2seAxTJj6!Ly7TSc6o zS5!%{Y*a`c$1q{<>UoY-kOT-J$#gTZG#DDTPI9M^#$+M_j)qCjm1Ek30$o>Z)3H;;ZUC@(E)zcibIJ$zNV1`rOh)oIUAU3iLkZ_ z0_xI0NZyRbLFA^klNv~r$ayJ43@^*TIf1G=mTVg!33))W<$Gfoe?b`gNK)e{nc@Si zh#{n=ry!Mvx0tytfvap+lwvG3Cs~8OM7PnVBb&Ji3L(VJR8yVI%5%dp^GV1@apGt8 zP0XYdnX;N)O0<#rX0e(k+m50ns$wOMo5op)1=e^`<{W{-;M2&O$Ep-sism>-=IYY% zTy;WA^~1=C^wdT68#aW5`~o_dD~oAj88qA@N@5zw^s#e=vkg&0Kwp9y*JLfzHRO_5 z5+{JovMdZ&UI2I>d$TZ&!J?WTYeo>JnT=)0G+pkSifP5Vm0>@Mye=`wFyKU1>U9-P zRPsz4kTf^b$d-2IrO1Q>uuWpik!4c@Z>q>WvlA>jxZSZ#8z!F}db81L?pju2AzKIQ z;W^170BB9-97j7^g`63*umf3@)VO`S@HdSM%9yI+;xui{)aqT6uWr z&fMk7UAms@hOXzk0kRE4WP3zu9FwF^CnHt|5ga7FQc)yH5Y}B|jzl;#U=q`yjAm)_ zom}{X+*yBTSeE5rQKOE8VT+(wL%Ju~x*!`#oFsvi+uF2pd5Zk&2>{GmGtpK$|}STQc*$T zI!#r`!EP~knQVM%ng*HWFs7TYtZU0IzC1b)$M%XYnM@l3N<6_u~;KI?KjsxocM z>b%|2td0ag)9F|F(Mf4A3QCpO^Tjj>+f=Nu!Q3%9x^G_ZQ`GIG(p-&J#@r7@EzFH< z7(>W#*`E)pc@!1Q*(4t?N08T%riSxXo^qVGA93!fQAnq$HClP8P8^A8g8X8h9^VP< z!)j1fGC1X&z@ikMfwDDio$E-8wBwBBcFSOUnFV;lB5My*2{eafCJxHjPQ?MucRMsE zDGV>M48seWA`T!2BwlkgUQ;ANGBwSz0d|lAj+}8D3MjLoYV9aDb0m|;fe)vKyOu+7 zdcgS7lp%%LTanv=YI z6d?)qgnm*KW!JTcIK)lJTT+c&XUQplw1P(Y~hD3Y;40#9@b$BQI+o=1wQ1P2_j zuc1MYgIstV0E+=vF(N_=LDKjJ0!Vbp_rIqDf$F7#b?83Rn^Uk=U*( zf+8A3Az+adL$TpjBwtYwaNAOB6=x%0eK@G6ky8?wAw@Ot%|x4683)rsmO+CdLk>P* zXhcmL8OG#*n*apX>p{#E5CN1=mej%UEdz)Rw=pA_VPZ=dIXDG<34}~ED7ub9M`~}!xzUyvmi{>VWR*b1H=PI zSr`g941fhg0s>HBEs%A_>|ytyLxM3ddE|3VAbAGfKz&exTNo6Ui*N{*6i-M6023@R z5hl1pwjw|UtReCNLhyi?7o_hs^RJr&OB0$&4bl?f4syPPFc?OTPfWmio zh2Q9o+{V_&sQ?rQ^V(L7{bRjG}i)tiD^gyw_W#AB?2c{=x>uNSJEXfWOsn-`Ae-Xl; z2L6}u%yhirEW{xM`!W2#jTFjSIH$loiWb_)JXt{@T zCfLH#!&;o5o)B8ne&^TfNkecS${+74Q6G{U9ru2MyKMz$JyBXFj zwt}LXGeicsR5ZoDrmx1UgdM<&kjY9SaYz2nLR1);4 zh>%S{>yOx$$S1fMNGF8%pj*fuHxO6=_hJ`ADde!dv9kc}9a0VdAh!t1Vi%IFXeBV% zApndF8i;I9@cx=vp{a2E$T9)p4II+4GAuCJJm51@A6^ppH?X`mI)jJd&*C+LLi zP6;_j=u)v{2&tS%H~4ypR|m=-4dS#CBpK9P3Y3xoWDv0k$&Q&;WRxKf@dIW-8AMF6 zR;DF^8iG*FG{fX#B~XxvK`g3F4$Gm`+Qb57aJaw`pyG@QrolvQ%qu8`(12eElc7jZ z=5QTAFq@zhD~9FASGaz#aHxX%klaK9l5bFpiUOGnJ@GhN;sYZ8(Kc38Lkl{DI|c-% zCRz~AFIFeEFd3DfP(7-eE>0_6Sq;F2!6s->uar|z~q>0 zkVg8zLK6W^#PnLBz+;6ju|$~Ff7K!LPJ{Hq^6RlQ%C5hY5AuyPO)k>+|L-EtAAA1)JbJA0^A>4=6eHJ~&h`Dr zdZbZ8|G#Nk7b6wO54qOW2x)8b$h|coYhZx8n4-sJd2AY`iA=yWlOeA;1k1N>{{J1{ zdKP|mio2u%Q~^`2Cw0vaSj?Z5)-C>|W!*U;Xx%Y7daOcjuPx%AUH$v{&yMh%jDr+@ zTv0Nw7zTlx_#yPIi;z-3C;ML&Fb+Z*84aoPuSHmsKnO*-HP8O50Wx}07@Ue>ktqNS z!45;SC=5mhBqAao(iNNu;jwPXNMVw|wG0=MLYUUnWR77i4~H-f9IF%%`A&Qbnu~|y z7?oiAnuBJ~j_314f&U%q$ABMIQDI2S{WiafeOtlVP|T+!DuOE8*W)GAY6@P6lZ!;s zr#jVRB-l)s^Ss?`DJy$vLH5R0D8svDW&Zp&ReN2@jBFo0Lb97|bD&s}b3RW8Ra%|p zF#a5br!%fG;1b)pzmLUEQxEbu1)9oZU+Q!y)Ej+|}F0)SJ zoleAZQF2F#jPrtuJxRG%O|+1ja+1(r5#3FrCV-#EFMMrJ0!!y4vO0&Gogo_1-jFg;{9F^@GCe1iU6ON-@x7$#Y zIpFltW+@)0X02Rm^rMrpU?{1H1W3nH}5tzL?7Z{Y76iz z1NfG>-;#4B%acirvzoSyR3l9gv}~5C0F@5YhlYSzwSayBR2RT5GSY13 ziDm~`#t(FhAp8}CJOH`?)|3zp2tr*6psslp4sy+j;D&`m8WigUDXJkj8v0ijpc^yG z4uI7V$55c^MG|fBEhEn2OhPaPe(lsJ(FOQ#VR-=!iuTIXBRjHK8Q30HRE*)k4#0q6 zR!gF@)U_zjR7OqVw1?@A3=-%xC{~=Z=J{+0=e?Cm13ko{<5ijq7UB{bsDquy@Y7kY zjBT4?(}<75g)NzxDX3`oQc-3rxEn znO%1pGqP{W#*+O^ja0(lIp?la=RwN1l<50#5HK6$9hk_*(SQ9$g0?q~H6o=S0 zW{2%FjOH$k@Lm>77O|rc5r`aTFNxV`n@F!=Ipe`drXG9{0P_Zp!QyB@UoaH~z)0j+ zK@LL0zfmm%9(MteDByWX1aL*&A1l#aXlA-3a%LLjB#SV|QCk=)fTV&xHLU4_ z6kz0{2<0Alp_U^&ro%^qOf1=1u+eR7`mrK2fS2Yfh*XjU1lPU@->wl^{NhfCgB&Lq zbAh#8ScRE}I0DDvw618+#N>V{%|cTWw49RzL~w6x4&XG?0zOy+D@gt|Y$9p|rayopc}}1TVjFmd z4hT#_V1}q4z{IusK&Sv%5D1BYcVe-Uzm!XP>VYz_hurXWxZ7Oe#Z0gPhCib`}a zl!*+F0lFuKF7P}c5O{!CsmL61G+RMd7S7M|=n$$*;Ziw7A%v22ghx=>v;k351;;gj z*dQZ94TB;N4OyDnqNmK5`H`bu>pI zXN@)D6#yIt#Me?4oBmPTk>Ow{2-*=8jDLx4WW;}vX+YnA<`@FNIbvNvqQH*edrT~p zjSeadxX0o=iitAD7*ri+;b9md-44Lt^xZrQGJ@Rzxv^v5SA;JeailEL(g}_-CpomA zDH@4^d6x0c1eTE;my2#f9CS7~$+i{MjTIvk8D3#1P9A2GduFI<%r=F-Z=U2v)2i zBC8ut6xd0)eheoh3l$@(aiBY14o#>@uq!mUreXgg_`}l_Z|D+o{IZ1$aR9Fo76fyS zc|lxTWHDQi{Xv)oE)r}o>+8K?;R}od;%CBJCP=6#i9DP{#yyyzu)Kl1!Oq0Dfi;6@ z$MzvHphqB0SQh_HJVh9YcvZoI*jq4#0M5}rF*Kl%NLMf~z*T4sO~8U!7Xa(yJ{kw} zVVnNMm*8}Q`PVIj`v`g@n}h6>#|r=y7eR%v13&?I46}t&cub6a)F6*xprR{63W}@? zk%DLs+nRv5^@S0TCh$Qn)B^`T7AM7iwgrm_h?4Bw#|Cg4#YivsMOYS}>+0n9`rEp- zpM9=-T(`Dv5R-vc*1+~>ucVnZU1UGt9~sK}2e%1P>pn;c^7mtRr2RED>%URPNP#aw z5o|74hX9kr;3J)`M}hlfI^e6sbga=annH_YfM^MFADb495YrEqIU$d9MQ&lJWRB1- z%Hs=`9vWdy$(lCwfpuG7U=b3{BbFHf?id~ElsH2%S%ePa?1aw3-JcK{79X6YctDth z7#MJh;FS)@j9Ax)ivYf4_-%<9}=4u z$pUy)2%;b41tXvf{uY5xqD7d%Z3d*GTK;^2gaphVcppu(JkkOZys`xOmXcrwbKgO7 z@!CxTxI#~q@RD^IIjpHA$YG_CRW*x% z(M05SL5AX`Dz^^_7u#Wmw{k@O%_=}Q{bqN7myh867~T&dE0 zn-Yc`pXYejh-tFLh8nrEX*9R+&KpVqu7LiyjB{#Yg;Kq#x&HllHc9#ZfFUoDfHWNY zdT*u2e61v;`Dli-Pz*&=w2T)ZSk~3l;wPyuRGY{}9?c)zoT2b)8-bUw^4~pm;AR0= zY~y_ycnA<6Fp!~0*|5!vnJv!prCw^mDKZUa3tI$$rv;8U9_M3A@|>Aj?;r`si>4Fb zcAy;)d4@nsuHktK{aC08s)EQc@(?VUh8Q869`F7!9M6G@ax%n=VA7&0 zbPC=Wp+tB$g^l;CKo-IF1D=L3N0tpQK#j?k6g!HMnur?2#M48BDv%5~mzSW8psJGu zg33x$NIUq^umM07(jGZZcHm?KR6!<4iq{C?1AZ2GM38JE0h`150ylGxy^z}}*-r_S zHlP9sLpTd84_nI2V2{Qr)GLH3r~o)x`(PA>_#lA}-~r6wx`G}zk@b_U!xA7L`w_H* z7`*)jW6B{6VC&ju3TqT#55Zc|E#h$_+6LMknfVX4%7F7M5kW&rz2;08_Fh~0fZFBuGuM&XnzUQ7bn zz|-}HymFI6D`}+_L!gq;)ScQ=ruLb7#|U!&G+}E(Pf_T6I6%6CdateeY5Z^|cQfR^Aas1cocbDGkb;y9eHB{Xfz8!(-?>k%fuEC`y=jDV+np zggY>IGr&vW8V6}czKfF<_BxKjF@5Z04jL^*#?c~-qma0h;TQ!(5MXJ6S2YRm1H+cp z2@=C?I35t!&4`N?AQg!@#5f_yC$}MI5p5$sF6`zH#_K#On)!_XL+h0(+y^9KeuQWI@#lqg2dnjRo+ z(c&^u;S@$8S&y)C5J3dsUcyLUX)E}ER$`)=u)JZZYiNOkpoLeNc%c0pSsQU;`tT}b zwh~LZ0O_MzG9(Gi8X^re*GXV2<#?4EfWD^6h%>COn(KOs#5+xk z5lhGsk<4I^06AbafSqB8!$$%niYD*{bx4>6`W>Q^_zjV#h_NDT9j9NS2rno?o+hys ziG-CExJ}@NO2RmCa@<+R0f3!M6(MRFAs9bdWVVF}!5V+Tq{AEPkZPwJi{%o>yaags zAyKp}jDg#g*))VZ1tMEj5wS{Ag<<2L;wfx3?#NL0yM}M zg>4{Vmc%}#q&@&MM`d}AG`Bdxn|Fc`?0{Pu-|4V2loQ^zh6G6jbz-ChL~#FLz&R3suoDea z6ljV?YAmr?Ok}pg!Gf3HdCS$>Rs#@#i-zo5L|fsDHDISB4H;oH*4yi?OyXmsZLFv$vtnzrV8<;uq7U;|K0^6h& zTBO>MnIXQ7>FlC$` zN;Mv@y0T18RI$NxScwLNrEW)Yw7T{jz9wU=kY-T|dzEvr-Js!daEl!vRXB0{2gecW z$aID!l1yU*hw2b9%WKq@$dm6 zW)46E!A-J~NWKmb*V=f)ViA*y7|1aGkwiow2-cd|J?kgLX+cm8d^8%29}*cPBE89P5wJ`gy@UWF z({T|Cnczn>NzCLlhk_#YK@X{mTkB%zfs`fIFE%~q03r2%+59ND?g_n-F3})9NJ&x< z>rWa(C*%$s0O%Qik`G+ull%!Ji{(wB8rM8Rx?T6Z?iTFS_g73!Z% z@Oq+AoK!_w!T@BFp#Lm%k2Qa61yhL5@CD% zCbPM2l5i6GKt!HwO#(mADk#K%6nrEV6HnU2ZX+v$QDtQO*fbbE8Uw-W7D=1y$;b4Q z?GCI6T5~ci=t>|DGAvS-3~ix5l51+hS8cA7_N z3KH=AkyyfWKdD7gLdAM;SbT5_#0%!&acc34^bQ&HI5M(9uocN9plp&81xCsc0q{7c z^>nRi_&EtMkC6n04S)+}ArH_cnNY$8k7Fa`5^4z_fVI{QV|q!mU_4ToupjA$)C0MX zO@qHk5(PH(dT^kTOxJqzfL!vGOxyax_;dqX0ERQDKuct+Vy}|I>v_ZQ*7etIlfn=x zkd8lFUi0dDP-HHCt~5IPId_nc7~j7qgSfBIJK;h!OW634C_**a`cEp>B%>iPB>)sCLu+_WARg=$ObDTSef?Y-@{rtxSi@k* zi0~AoVqmzvCVukwV?$ '1' -absx002 abs '-1' -> '1' -absx003 abs '1.00' -> '1.00' -absx004 abs '-1.00' -> '1.00' -absx005 abs '0' -> '0' -absx006 abs '0.00' -> '0.00' -absx007 abs '00.0' -> '0.0' -absx008 abs '00.00' -> '0.00' -absx009 abs '00' -> '0' - -absx010 abs '-2' -> '2' -absx011 abs '2' -> '2' -absx012 abs '-2.00' -> '2.00' -absx013 abs '2.00' -> '2.00' -absx014 abs '-0' -> '0' -absx015 abs '-0.00' -> '0.00' -absx016 abs '-00.0' -> '0.0' -absx017 abs '-00.00' -> '0.00' -absx018 abs '-00' -> '0' - -absx020 abs '-2000000' -> '2000000' -absx021 abs '2000000' -> '2000000' -precision: 7 -absx022 abs '-2000000' -> '2000000' -absx023 abs '2000000' -> '2000000' -precision: 6 -absx024 abs '-2000000' -> '2.00000E+6' Rounded -absx025 abs '2000000' -> '2.00000E+6' Rounded -precision: 3 -absx026 abs '-2000000' -> '2.00E+6' Rounded -absx027 abs '2000000' -> '2.00E+6' Rounded - -absx030 abs '+0.1' -> '0.1' -absx031 abs '-0.1' -> '0.1' -absx032 abs '+0.01' -> '0.01' -absx033 abs '-0.01' -> '0.01' -absx034 abs '+0.001' -> '0.001' -absx035 abs '-0.001' -> '0.001' -absx036 abs '+0.000001' -> '0.000001' -absx037 abs '-0.000001' -> '0.000001' -absx038 abs '+0.000000000001' -> '1E-12' -absx039 abs '-0.000000000001' -> '1E-12' - --- examples from decArith -precision: 9 -absx040 abs '2.1' -> '2.1' -absx041 abs '-100' -> '100' -absx042 abs '101.5' -> '101.5' -absx043 abs '-101.5' -> '101.5' - --- more fixed, potential LHS swaps/overlays if done by subtract 0 -precision: 9 -absx060 abs '-56267E-10' -> '0.0000056267' -absx061 abs '-56267E-5' -> '0.56267' -absx062 abs '-56267E-2' -> '562.67' -absx063 abs '-56267E-1' -> '5626.7' -absx065 abs '-56267E-0' -> '56267' - --- overflow tests -maxexponent: 999999999 -minexponent: -999999999 -precision: 3 -absx120 abs 9.999E+999999999 -> Infinity Inexact Overflow Rounded - --- subnormals and underflow -precision: 3 -maxexponent: 999 -minexponent: -999 -absx210 abs 1.00E-999 -> 1.00E-999 -absx211 abs 0.1E-999 -> 1E-1000 Subnormal -absx212 abs 0.10E-999 -> 1.0E-1000 Subnormal -absx213 abs 0.100E-999 -> 1.0E-1000 Subnormal Rounded -absx214 abs 0.01E-999 -> 1E-1001 Subnormal --- next is rounded to Emin -absx215 abs 0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow -absx216 abs 0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -absx217 abs 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow -absx218 abs 0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -absx219 abs 0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -absx220 abs 0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow - -absx230 abs -1.00E-999 -> 1.00E-999 -absx231 abs -0.1E-999 -> 1E-1000 Subnormal -absx232 abs -0.10E-999 -> 1.0E-1000 Subnormal -absx233 abs -0.100E-999 -> 1.0E-1000 Subnormal Rounded -absx234 abs -0.01E-999 -> 1E-1001 Subnormal --- next is rounded to Emin -absx235 abs -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow -absx236 abs -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -absx237 abs -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow -absx238 abs -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -absx239 abs -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -absx240 abs -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow - --- long operand tests -maxexponent: 999 -minexponent: -999 -precision: 9 -absx301 abs 12345678000 -> 1.23456780E+10 Rounded -absx302 abs 1234567800 -> 1.23456780E+9 Rounded -absx303 abs 1234567890 -> 1.23456789E+9 Rounded -absx304 abs 1234567891 -> 1.23456789E+9 Inexact Rounded -absx305 abs 12345678901 -> 1.23456789E+10 Inexact Rounded -absx306 abs 1234567896 -> 1.23456790E+9 Inexact Rounded - -precision: 15 -absx321 abs 12345678000 -> 12345678000 -absx322 abs 1234567800 -> 1234567800 -absx323 abs 1234567890 -> 1234567890 -absx324 abs 1234567891 -> 1234567891 -absx325 abs 12345678901 -> 12345678901 -absx326 abs 1234567896 -> 1234567896 - - --- Specials -precision: 9 - --- specials -absx520 abs 'Inf' -> 'Infinity' -absx521 abs '-Inf' -> 'Infinity' -absx522 abs NaN -> NaN -absx523 abs sNaN -> NaN Invalid_operation -absx524 abs NaN22 -> NaN22 -absx525 abs sNaN33 -> NaN33 Invalid_operation -absx526 abs -NaN22 -> -NaN22 -absx527 abs -sNaN33 -> -NaN33 Invalid_operation - --- Null tests -absx900 abs # -> NaN Invalid_operation - diff --git a/sys/lib/python/test/decimaltestdata/add.decTest b/sys/lib/python/test/decimaltestdata/add.decTest deleted file mode 100644 index 2d3efabe2..000000000 --- a/sys/lib/python/test/decimaltestdata/add.decTest +++ /dev/null @@ -1,1127 +0,0 @@ ------------------------------------------------------------------------- --- add.decTest -- decimal addition -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 -extended: 1 - --- [first group are 'quick confidence check'] -addx001 add 1 1 -> 2 -addx002 add 2 3 -> 5 -addx003 add '5.75' '3.3' -> 9.05 -addx004 add '5' '-3' -> 2 -addx005 add '-5' '-3' -> -8 -addx006 add '-7' '2.5' -> -4.5 -addx007 add '0.7' '0.3' -> 1.0 -addx008 add '1.25' '1.25' -> 2.50 -addx009 add '1.23456789' '1.00000000' -> '2.23456789' -addx010 add '1.23456789' '1.00000011' -> '2.23456800' - -addx011 add '0.4444444444' '0.5555555555' -> '1.00000000' Inexact Rounded -addx012 add '0.4444444440' '0.5555555555' -> '1.00000000' Inexact Rounded -addx013 add '0.4444444444' '0.5555555550' -> '0.999999999' Inexact Rounded -addx014 add '0.44444444449' '0' -> '0.444444444' Inexact Rounded -addx015 add '0.444444444499' '0' -> '0.444444444' Inexact Rounded -addx016 add '0.4444444444999' '0' -> '0.444444444' Inexact Rounded -addx017 add '0.4444444445000' '0' -> '0.444444445' Inexact Rounded -addx018 add '0.4444444445001' '0' -> '0.444444445' Inexact Rounded -addx019 add '0.444444444501' '0' -> '0.444444445' Inexact Rounded -addx020 add '0.44444444451' '0' -> '0.444444445' Inexact Rounded - -addx021 add 0 1 -> 1 -addx022 add 1 1 -> 2 -addx023 add 2 1 -> 3 -addx024 add 3 1 -> 4 -addx025 add 4 1 -> 5 -addx026 add 5 1 -> 6 -addx027 add 6 1 -> 7 -addx028 add 7 1 -> 8 -addx029 add 8 1 -> 9 -addx030 add 9 1 -> 10 - --- some carrying effects -addx031 add '0.9998' '0.0000' -> '0.9998' -addx032 add '0.9998' '0.0001' -> '0.9999' -addx033 add '0.9998' '0.0002' -> '1.0000' -addx034 add '0.9998' '0.0003' -> '1.0001' - -addx035 add '70' '10000e+9' -> '1.00000000E+13' Inexact Rounded -addx036 add '700' '10000e+9' -> '1.00000000E+13' Inexact Rounded -addx037 add '7000' '10000e+9' -> '1.00000000E+13' Inexact Rounded -addx038 add '70000' '10000e+9' -> '1.00000001E+13' Inexact Rounded -addx039 add '700000' '10000e+9' -> '1.00000007E+13' Rounded - --- symmetry: -addx040 add '10000e+9' '70' -> '1.00000000E+13' Inexact Rounded -addx041 add '10000e+9' '700' -> '1.00000000E+13' Inexact Rounded -addx042 add '10000e+9' '7000' -> '1.00000000E+13' Inexact Rounded -addx044 add '10000e+9' '70000' -> '1.00000001E+13' Inexact Rounded -addx045 add '10000e+9' '700000' -> '1.00000007E+13' Rounded - --- same, higher precision -precision: 15 -addx046 add '10000e+9' '7' -> '10000000000007' -addx047 add '10000e+9' '70' -> '10000000000070' -addx048 add '10000e+9' '700' -> '10000000000700' -addx049 add '10000e+9' '7000' -> '10000000007000' -addx050 add '10000e+9' '70000' -> '10000000070000' -addx051 add '10000e+9' '700000' -> '10000000700000' - --- examples from decarith -addx053 add '12' '7.00' -> '19.00' -addx054 add '1.3' '-1.07' -> '0.23' -addx055 add '1.3' '-1.30' -> '0.00' -addx056 add '1.3' '-2.07' -> '-0.77' -addx057 add '1E+2' '1E+4' -> '1.01E+4' - --- zero preservation -precision: 6 -addx060 add '10000e+9' '70000' -> '1.00000E+13' Inexact Rounded -addx061 add 1 '0.0001' -> '1.0001' -addx062 add 1 '0.00001' -> '1.00001' -addx063 add 1 '0.000001' -> '1.00000' Inexact Rounded -addx064 add 1 '0.0000001' -> '1.00000' Inexact Rounded -addx065 add 1 '0.00000001' -> '1.00000' Inexact Rounded - --- some funny zeros [in case of bad signum] -addx070 add 1 0 -> 1 -addx071 add 1 0. -> 1 -addx072 add 1 .0 -> 1.0 -addx073 add 1 0.0 -> 1.0 -addx074 add 1 0.00 -> 1.00 -addx075 add 0 1 -> 1 -addx076 add 0. 1 -> 1 -addx077 add .0 1 -> 1.0 -addx078 add 0.0 1 -> 1.0 -addx079 add 0.00 1 -> 1.00 - -precision: 9 - --- some carries -addx080 add 999999998 1 -> 999999999 -addx081 add 999999999 1 -> 1.00000000E+9 Rounded -addx082 add 99999999 1 -> 100000000 -addx083 add 9999999 1 -> 10000000 -addx084 add 999999 1 -> 1000000 -addx085 add 99999 1 -> 100000 -addx086 add 9999 1 -> 10000 -addx087 add 999 1 -> 1000 -addx088 add 99 1 -> 100 -addx089 add 9 1 -> 10 - - --- more LHS swaps -addx090 add '-56267E-10' 0 -> '-0.0000056267' -addx091 add '-56267E-6' 0 -> '-0.056267' -addx092 add '-56267E-5' 0 -> '-0.56267' -addx093 add '-56267E-4' 0 -> '-5.6267' -addx094 add '-56267E-3' 0 -> '-56.267' -addx095 add '-56267E-2' 0 -> '-562.67' -addx096 add '-56267E-1' 0 -> '-5626.7' -addx097 add '-56267E-0' 0 -> '-56267' -addx098 add '-5E-10' 0 -> '-5E-10' -addx099 add '-5E-7' 0 -> '-5E-7' -addx100 add '-5E-6' 0 -> '-0.000005' -addx101 add '-5E-5' 0 -> '-0.00005' -addx102 add '-5E-4' 0 -> '-0.0005' -addx103 add '-5E-1' 0 -> '-0.5' -addx104 add '-5E0' 0 -> '-5' -addx105 add '-5E1' 0 -> '-50' -addx106 add '-5E5' 0 -> '-500000' -addx107 add '-5E8' 0 -> '-500000000' -addx108 add '-5E9' 0 -> '-5.00000000E+9' Rounded -addx109 add '-5E10' 0 -> '-5.00000000E+10' Rounded -addx110 add '-5E11' 0 -> '-5.00000000E+11' Rounded -addx111 add '-5E100' 0 -> '-5.00000000E+100' Rounded - --- more RHS swaps -addx113 add 0 '-56267E-10' -> '-0.0000056267' -addx114 add 0 '-56267E-6' -> '-0.056267' -addx116 add 0 '-56267E-5' -> '-0.56267' -addx117 add 0 '-56267E-4' -> '-5.6267' -addx119 add 0 '-56267E-3' -> '-56.267' -addx120 add 0 '-56267E-2' -> '-562.67' -addx121 add 0 '-56267E-1' -> '-5626.7' -addx122 add 0 '-56267E-0' -> '-56267' -addx123 add 0 '-5E-10' -> '-5E-10' -addx124 add 0 '-5E-7' -> '-5E-7' -addx125 add 0 '-5E-6' -> '-0.000005' -addx126 add 0 '-5E-5' -> '-0.00005' -addx127 add 0 '-5E-4' -> '-0.0005' -addx128 add 0 '-5E-1' -> '-0.5' -addx129 add 0 '-5E0' -> '-5' -addx130 add 0 '-5E1' -> '-50' -addx131 add 0 '-5E5' -> '-500000' -addx132 add 0 '-5E8' -> '-500000000' -addx133 add 0 '-5E9' -> '-5.00000000E+9' Rounded -addx134 add 0 '-5E10' -> '-5.00000000E+10' Rounded -addx135 add 0 '-5E11' -> '-5.00000000E+11' Rounded -addx136 add 0 '-5E100' -> '-5.00000000E+100' Rounded - --- related -addx137 add 1 '0E-12' -> '1.00000000' Rounded -addx138 add -1 '0E-12' -> '-1.00000000' Rounded -addx139 add '0E-12' 1 -> '1.00000000' Rounded -addx140 add '0E-12' -1 -> '-1.00000000' Rounded -addx141 add 1E+4 0.0000 -> '10000.0000' -addx142 add 1E+4 0.00000 -> '10000.0000' Rounded -addx143 add 0.000 1E+5 -> '100000.000' -addx144 add 0.0000 1E+5 -> '100000.000' Rounded - --- [some of the next group are really constructor tests] -addx146 add '00.0' 0 -> '0.0' -addx147 add '0.00' 0 -> '0.00' -addx148 add 0 '0.00' -> '0.00' -addx149 add 0 '00.0' -> '0.0' -addx150 add '00.0' '0.00' -> '0.00' -addx151 add '0.00' '00.0' -> '0.00' -addx152 add '3' '.3' -> '3.3' -addx153 add '3.' '.3' -> '3.3' -addx154 add '3.0' '.3' -> '3.3' -addx155 add '3.00' '.3' -> '3.30' -addx156 add '3' '3' -> '6' -addx157 add '3' '+3' -> '6' -addx158 add '3' '-3' -> '0' -addx159 add '0.3' '-0.3' -> '0.0' -addx160 add '0.03' '-0.03' -> '0.00' - --- try borderline precision, with carries, etc. -precision: 15 -addx161 add '1E+12' '-1' -> '999999999999' -addx162 add '1E+12' '1.11' -> '1000000000001.11' -addx163 add '1.11' '1E+12' -> '1000000000001.11' -addx164 add '-1' '1E+12' -> '999999999999' -addx165 add '7E+12' '-1' -> '6999999999999' -addx166 add '7E+12' '1.11' -> '7000000000001.11' -addx167 add '1.11' '7E+12' -> '7000000000001.11' -addx168 add '-1' '7E+12' -> '6999999999999' - --- 123456789012345 123456789012345 1 23456789012345 -addx170 add '0.444444444444444' '0.555555555555563' -> '1.00000000000001' Inexact Rounded -addx171 add '0.444444444444444' '0.555555555555562' -> '1.00000000000001' Inexact Rounded -addx172 add '0.444444444444444' '0.555555555555561' -> '1.00000000000001' Inexact Rounded -addx173 add '0.444444444444444' '0.555555555555560' -> '1.00000000000000' Inexact Rounded -addx174 add '0.444444444444444' '0.555555555555559' -> '1.00000000000000' Inexact Rounded -addx175 add '0.444444444444444' '0.555555555555558' -> '1.00000000000000' Inexact Rounded -addx176 add '0.444444444444444' '0.555555555555557' -> '1.00000000000000' Inexact Rounded -addx177 add '0.444444444444444' '0.555555555555556' -> '1.00000000000000' Rounded -addx178 add '0.444444444444444' '0.555555555555555' -> '0.999999999999999' -addx179 add '0.444444444444444' '0.555555555555554' -> '0.999999999999998' -addx180 add '0.444444444444444' '0.555555555555553' -> '0.999999999999997' -addx181 add '0.444444444444444' '0.555555555555552' -> '0.999999999999996' -addx182 add '0.444444444444444' '0.555555555555551' -> '0.999999999999995' -addx183 add '0.444444444444444' '0.555555555555550' -> '0.999999999999994' - --- and some more, including residue effects and different roundings -precision: 9 -rounding: half_up -addx200 add '123456789' 0 -> '123456789' -addx201 add '123456789' 0.000000001 -> '123456789' Inexact Rounded -addx202 add '123456789' 0.000001 -> '123456789' Inexact Rounded -addx203 add '123456789' 0.1 -> '123456789' Inexact Rounded -addx204 add '123456789' 0.4 -> '123456789' Inexact Rounded -addx205 add '123456789' 0.49 -> '123456789' Inexact Rounded -addx206 add '123456789' 0.499999 -> '123456789' Inexact Rounded -addx207 add '123456789' 0.499999999 -> '123456789' Inexact Rounded -addx208 add '123456789' 0.5 -> '123456790' Inexact Rounded -addx209 add '123456789' 0.500000001 -> '123456790' Inexact Rounded -addx210 add '123456789' 0.500001 -> '123456790' Inexact Rounded -addx211 add '123456789' 0.51 -> '123456790' Inexact Rounded -addx212 add '123456789' 0.6 -> '123456790' Inexact Rounded -addx213 add '123456789' 0.9 -> '123456790' Inexact Rounded -addx214 add '123456789' 0.99999 -> '123456790' Inexact Rounded -addx215 add '123456789' 0.999999999 -> '123456790' Inexact Rounded -addx216 add '123456789' 1 -> '123456790' -addx217 add '123456789' 1.000000001 -> '123456790' Inexact Rounded -addx218 add '123456789' 1.00001 -> '123456790' Inexact Rounded -addx219 add '123456789' 1.1 -> '123456790' Inexact Rounded - -rounding: half_even -addx220 add '123456789' 0 -> '123456789' -addx221 add '123456789' 0.000000001 -> '123456789' Inexact Rounded -addx222 add '123456789' 0.000001 -> '123456789' Inexact Rounded -addx223 add '123456789' 0.1 -> '123456789' Inexact Rounded -addx224 add '123456789' 0.4 -> '123456789' Inexact Rounded -addx225 add '123456789' 0.49 -> '123456789' Inexact Rounded -addx226 add '123456789' 0.499999 -> '123456789' Inexact Rounded -addx227 add '123456789' 0.499999999 -> '123456789' Inexact Rounded -addx228 add '123456789' 0.5 -> '123456790' Inexact Rounded -addx229 add '123456789' 0.500000001 -> '123456790' Inexact Rounded -addx230 add '123456789' 0.500001 -> '123456790' Inexact Rounded -addx231 add '123456789' 0.51 -> '123456790' Inexact Rounded -addx232 add '123456789' 0.6 -> '123456790' Inexact Rounded -addx233 add '123456789' 0.9 -> '123456790' Inexact Rounded -addx234 add '123456789' 0.99999 -> '123456790' Inexact Rounded -addx235 add '123456789' 0.999999999 -> '123456790' Inexact Rounded -addx236 add '123456789' 1 -> '123456790' -addx237 add '123456789' 1.00000001 -> '123456790' Inexact Rounded -addx238 add '123456789' 1.00001 -> '123456790' Inexact Rounded -addx239 add '123456789' 1.1 -> '123456790' Inexact Rounded --- critical few with even bottom digit... -addx240 add '123456788' 0.499999999 -> '123456788' Inexact Rounded -addx241 add '123456788' 0.5 -> '123456788' Inexact Rounded -addx242 add '123456788' 0.500000001 -> '123456789' Inexact Rounded - -rounding: down -addx250 add '123456789' 0 -> '123456789' -addx251 add '123456789' 0.000000001 -> '123456789' Inexact Rounded -addx252 add '123456789' 0.000001 -> '123456789' Inexact Rounded -addx253 add '123456789' 0.1 -> '123456789' Inexact Rounded -addx254 add '123456789' 0.4 -> '123456789' Inexact Rounded -addx255 add '123456789' 0.49 -> '123456789' Inexact Rounded -addx256 add '123456789' 0.499999 -> '123456789' Inexact Rounded -addx257 add '123456789' 0.499999999 -> '123456789' Inexact Rounded -addx258 add '123456789' 0.5 -> '123456789' Inexact Rounded -addx259 add '123456789' 0.500000001 -> '123456789' Inexact Rounded -addx260 add '123456789' 0.500001 -> '123456789' Inexact Rounded -addx261 add '123456789' 0.51 -> '123456789' Inexact Rounded -addx262 add '123456789' 0.6 -> '123456789' Inexact Rounded -addx263 add '123456789' 0.9 -> '123456789' Inexact Rounded -addx264 add '123456789' 0.99999 -> '123456789' Inexact Rounded -addx265 add '123456789' 0.999999999 -> '123456789' Inexact Rounded -addx266 add '123456789' 1 -> '123456790' -addx267 add '123456789' 1.00000001 -> '123456790' Inexact Rounded -addx268 add '123456789' 1.00001 -> '123456790' Inexact Rounded -addx269 add '123456789' 1.1 -> '123456790' Inexact Rounded - --- input preparation tests (operands should not be rounded) -precision: 3 -rounding: half_up - -addx270 add '12345678900000' 9999999999999 -> '2.23E+13' Inexact Rounded -addx271 add '9999999999999' 12345678900000 -> '2.23E+13' Inexact Rounded - -addx272 add '12E+3' '3444' -> '1.54E+4' Inexact Rounded -addx273 add '12E+3' '3446' -> '1.54E+4' Inexact Rounded -addx274 add '12E+3' '3449.9' -> '1.54E+4' Inexact Rounded -addx275 add '12E+3' '3450.0' -> '1.55E+4' Inexact Rounded -addx276 add '12E+3' '3450.1' -> '1.55E+4' Inexact Rounded -addx277 add '12E+3' '3454' -> '1.55E+4' Inexact Rounded -addx278 add '12E+3' '3456' -> '1.55E+4' Inexact Rounded - -addx281 add '3444' '12E+3' -> '1.54E+4' Inexact Rounded -addx282 add '3446' '12E+3' -> '1.54E+4' Inexact Rounded -addx283 add '3449.9' '12E+3' -> '1.54E+4' Inexact Rounded -addx284 add '3450.0' '12E+3' -> '1.55E+4' Inexact Rounded -addx285 add '3450.1' '12E+3' -> '1.55E+4' Inexact Rounded -addx286 add '3454' '12E+3' -> '1.55E+4' Inexact Rounded -addx287 add '3456' '12E+3' -> '1.55E+4' Inexact Rounded - -rounding: half_down -addx291 add '3444' '12E+3' -> '1.54E+4' Inexact Rounded -addx292 add '3446' '12E+3' -> '1.54E+4' Inexact Rounded -addx293 add '3449.9' '12E+3' -> '1.54E+4' Inexact Rounded -addx294 add '3450.0' '12E+3' -> '1.54E+4' Inexact Rounded -addx295 add '3450.1' '12E+3' -> '1.55E+4' Inexact Rounded -addx296 add '3454' '12E+3' -> '1.55E+4' Inexact Rounded -addx297 add '3456' '12E+3' -> '1.55E+4' Inexact Rounded - --- 1 in last place tests -rounding: half_up -addx301 add -1 1 -> 0 -addx302 add 0 1 -> 1 -addx303 add 1 1 -> 2 -addx304 add 12 1 -> 13 -addx305 add 98 1 -> 99 -addx306 add 99 1 -> 100 -addx307 add 100 1 -> 101 -addx308 add 101 1 -> 102 -addx309 add -1 -1 -> -2 -addx310 add 0 -1 -> -1 -addx311 add 1 -1 -> 0 -addx312 add 12 -1 -> 11 -addx313 add 98 -1 -> 97 -addx314 add 99 -1 -> 98 -addx315 add 100 -1 -> 99 -addx316 add 101 -1 -> 100 - -addx321 add -0.01 0.01 -> 0.00 -addx322 add 0.00 0.01 -> 0.01 -addx323 add 0.01 0.01 -> 0.02 -addx324 add 0.12 0.01 -> 0.13 -addx325 add 0.98 0.01 -> 0.99 -addx326 add 0.99 0.01 -> 1.00 -addx327 add 1.00 0.01 -> 1.01 -addx328 add 1.01 0.01 -> 1.02 -addx329 add -0.01 -0.01 -> -0.02 -addx330 add 0.00 -0.01 -> -0.01 -addx331 add 0.01 -0.01 -> 0.00 -addx332 add 0.12 -0.01 -> 0.11 -addx333 add 0.98 -0.01 -> 0.97 -addx334 add 0.99 -0.01 -> 0.98 -addx335 add 1.00 -0.01 -> 0.99 -addx336 add 1.01 -0.01 -> 1.00 - --- some more cases where adding 0 affects the coefficient -precision: 9 -addx340 add 1E+3 0 -> 1000 -addx341 add 1E+8 0 -> 100000000 -addx342 add 1E+9 0 -> 1.00000000E+9 Rounded -addx343 add 1E+10 0 -> 1.00000000E+10 Rounded --- which simply follow from these cases ... -addx344 add 1E+3 1 -> 1001 -addx345 add 1E+8 1 -> 100000001 -addx346 add 1E+9 1 -> 1.00000000E+9 Inexact Rounded -addx347 add 1E+10 1 -> 1.00000000E+10 Inexact Rounded -addx348 add 1E+3 7 -> 1007 -addx349 add 1E+8 7 -> 100000007 -addx350 add 1E+9 7 -> 1.00000001E+9 Inexact Rounded -addx351 add 1E+10 7 -> 1.00000000E+10 Inexact Rounded - --- tryzeros cases -precision: 7 -rounding: half_up -maxExponent: 92 -minexponent: -92 -addx361 add 0E+50 10000E+1 -> 1.0000E+5 -addx362 add 10000E+1 0E-50 -> 100000.0 Rounded -addx363 add 10000E+1 10000E-50 -> 100000.0 Rounded Inexact - --- a curiosity from JSR 13 testing -rounding: half_down -precision: 10 -addx370 add 99999999 81512 -> 100081511 -precision: 6 -addx371 add 99999999 81512 -> 1.00082E+8 Rounded Inexact -rounding: half_up -precision: 10 -addx372 add 99999999 81512 -> 100081511 -precision: 6 -addx373 add 99999999 81512 -> 1.00082E+8 Rounded Inexact -rounding: half_even -precision: 10 -addx374 add 99999999 81512 -> 100081511 -precision: 6 -addx375 add 99999999 81512 -> 1.00082E+8 Rounded Inexact - --- ulp replacement tests -precision: 9 -maxexponent: 999999999 -minexponent: -999999999 -addx400 add 1 77e-7 -> 1.0000077 -addx401 add 1 77e-8 -> 1.00000077 -addx402 add 1 77e-9 -> 1.00000008 Inexact Rounded -addx403 add 1 77e-10 -> 1.00000001 Inexact Rounded -addx404 add 1 77e-11 -> 1.00000000 Inexact Rounded -addx405 add 1 77e-12 -> 1.00000000 Inexact Rounded -addx406 add 1 77e-999 -> 1.00000000 Inexact Rounded -addx407 add 1 77e-9999999 -> 1.00000000 Inexact Rounded - -addx410 add 10 77e-7 -> 10.0000077 -addx411 add 10 77e-8 -> 10.0000008 Inexact Rounded -addx412 add 10 77e-9 -> 10.0000001 Inexact Rounded -addx413 add 10 77e-10 -> 10.0000000 Inexact Rounded -addx414 add 10 77e-11 -> 10.0000000 Inexact Rounded -addx415 add 10 77e-12 -> 10.0000000 Inexact Rounded -addx416 add 10 77e-999 -> 10.0000000 Inexact Rounded -addx417 add 10 77e-9999999 -> 10.0000000 Inexact Rounded - -addx420 add 77e-7 1 -> 1.0000077 -addx421 add 77e-8 1 -> 1.00000077 -addx422 add 77e-9 1 -> 1.00000008 Inexact Rounded -addx423 add 77e-10 1 -> 1.00000001 Inexact Rounded -addx424 add 77e-11 1 -> 1.00000000 Inexact Rounded -addx425 add 77e-12 1 -> 1.00000000 Inexact Rounded -addx426 add 77e-999 1 -> 1.00000000 Inexact Rounded -addx427 add 77e-9999999 1 -> 1.00000000 Inexact Rounded - -addx430 add 77e-7 10 -> 10.0000077 -addx431 add 77e-8 10 -> 10.0000008 Inexact Rounded -addx432 add 77e-9 10 -> 10.0000001 Inexact Rounded -addx433 add 77e-10 10 -> 10.0000000 Inexact Rounded -addx434 add 77e-11 10 -> 10.0000000 Inexact Rounded -addx435 add 77e-12 10 -> 10.0000000 Inexact Rounded -addx436 add 77e-999 10 -> 10.0000000 Inexact Rounded -addx437 add 77e-9999999 10 -> 10.0000000 Inexact Rounded - --- negative ulps -addx440 add 1 -77e-7 -> 0.9999923 -addx441 add 1 -77e-8 -> 0.99999923 -addx442 add 1 -77e-9 -> 0.999999923 -addx443 add 1 -77e-10 -> 0.999999992 Inexact Rounded -addx444 add 1 -77e-11 -> 0.999999999 Inexact Rounded -addx445 add 1 -77e-12 -> 1.00000000 Inexact Rounded -addx446 add 1 -77e-999 -> 1.00000000 Inexact Rounded -addx447 add 1 -77e-9999999 -> 1.00000000 Inexact Rounded - -addx450 add 10 -77e-7 -> 9.9999923 -addx451 add 10 -77e-8 -> 9.99999923 -addx452 add 10 -77e-9 -> 9.99999992 Inexact Rounded -addx453 add 10 -77e-10 -> 9.99999999 Inexact Rounded -addx454 add 10 -77e-11 -> 10.0000000 Inexact Rounded -addx455 add 10 -77e-12 -> 10.0000000 Inexact Rounded -addx456 add 10 -77e-999 -> 10.0000000 Inexact Rounded -addx457 add 10 -77e-9999999 -> 10.0000000 Inexact Rounded - -addx460 add -77e-7 1 -> 0.9999923 -addx461 add -77e-8 1 -> 0.99999923 -addx462 add -77e-9 1 -> 0.999999923 -addx463 add -77e-10 1 -> 0.999999992 Inexact Rounded -addx464 add -77e-11 1 -> 0.999999999 Inexact Rounded -addx465 add -77e-12 1 -> 1.00000000 Inexact Rounded -addx466 add -77e-999 1 -> 1.00000000 Inexact Rounded -addx467 add -77e-9999999 1 -> 1.00000000 Inexact Rounded - -addx470 add -77e-7 10 -> 9.9999923 -addx471 add -77e-8 10 -> 9.99999923 -addx472 add -77e-9 10 -> 9.99999992 Inexact Rounded -addx473 add -77e-10 10 -> 9.99999999 Inexact Rounded -addx474 add -77e-11 10 -> 10.0000000 Inexact Rounded -addx475 add -77e-12 10 -> 10.0000000 Inexact Rounded -addx476 add -77e-999 10 -> 10.0000000 Inexact Rounded -addx477 add -77e-9999999 10 -> 10.0000000 Inexact Rounded - --- negative ulps -addx480 add -1 77e-7 -> -0.9999923 -addx481 add -1 77e-8 -> -0.99999923 -addx482 add -1 77e-9 -> -0.999999923 -addx483 add -1 77e-10 -> -0.999999992 Inexact Rounded -addx484 add -1 77e-11 -> -0.999999999 Inexact Rounded -addx485 add -1 77e-12 -> -1.00000000 Inexact Rounded -addx486 add -1 77e-999 -> -1.00000000 Inexact Rounded -addx487 add -1 77e-9999999 -> -1.00000000 Inexact Rounded - -addx490 add -10 77e-7 -> -9.9999923 -addx491 add -10 77e-8 -> -9.99999923 -addx492 add -10 77e-9 -> -9.99999992 Inexact Rounded -addx493 add -10 77e-10 -> -9.99999999 Inexact Rounded -addx494 add -10 77e-11 -> -10.0000000 Inexact Rounded -addx495 add -10 77e-12 -> -10.0000000 Inexact Rounded -addx496 add -10 77e-999 -> -10.0000000 Inexact Rounded -addx497 add -10 77e-9999999 -> -10.0000000 Inexact Rounded - -addx500 add 77e-7 -1 -> -0.9999923 -addx501 add 77e-8 -1 -> -0.99999923 -addx502 add 77e-9 -1 -> -0.999999923 -addx503 add 77e-10 -1 -> -0.999999992 Inexact Rounded -addx504 add 77e-11 -1 -> -0.999999999 Inexact Rounded -addx505 add 77e-12 -1 -> -1.00000000 Inexact Rounded -addx506 add 77e-999 -1 -> -1.00000000 Inexact Rounded -addx507 add 77e-9999999 -1 -> -1.00000000 Inexact Rounded - -addx510 add 77e-7 -10 -> -9.9999923 -addx511 add 77e-8 -10 -> -9.99999923 -addx512 add 77e-9 -10 -> -9.99999992 Inexact Rounded -addx513 add 77e-10 -10 -> -9.99999999 Inexact Rounded -addx514 add 77e-11 -10 -> -10.0000000 Inexact Rounded -addx515 add 77e-12 -10 -> -10.0000000 Inexact Rounded -addx516 add 77e-999 -10 -> -10.0000000 Inexact Rounded -addx517 add 77e-9999999 -10 -> -10.0000000 Inexact Rounded - - --- long operands -maxexponent: 999 -minexponent: -999 -precision: 9 -addx521 add 12345678000 0 -> 1.23456780E+10 Rounded -addx522 add 0 12345678000 -> 1.23456780E+10 Rounded -addx523 add 1234567800 0 -> 1.23456780E+9 Rounded -addx524 add 0 1234567800 -> 1.23456780E+9 Rounded -addx525 add 1234567890 0 -> 1.23456789E+9 Rounded -addx526 add 0 1234567890 -> 1.23456789E+9 Rounded -addx527 add 1234567891 0 -> 1.23456789E+9 Inexact Rounded -addx528 add 0 1234567891 -> 1.23456789E+9 Inexact Rounded -addx529 add 12345678901 0 -> 1.23456789E+10 Inexact Rounded -addx530 add 0 12345678901 -> 1.23456789E+10 Inexact Rounded -addx531 add 1234567896 0 -> 1.23456790E+9 Inexact Rounded -addx532 add 0 1234567896 -> 1.23456790E+9 Inexact Rounded - -precision: 15 --- still checking -addx541 add 12345678000 0 -> 12345678000 -addx542 add 0 12345678000 -> 12345678000 -addx543 add 1234567800 0 -> 1234567800 -addx544 add 0 1234567800 -> 1234567800 -addx545 add 1234567890 0 -> 1234567890 -addx546 add 0 1234567890 -> 1234567890 -addx547 add 1234567891 0 -> 1234567891 -addx548 add 0 1234567891 -> 1234567891 -addx549 add 12345678901 0 -> 12345678901 -addx550 add 0 12345678901 -> 12345678901 -addx551 add 1234567896 0 -> 1234567896 -addx552 add 0 1234567896 -> 1234567896 - --- verify a query -precision: 16 -maxExponent: +394 -minExponent: -393 -rounding: down -addx561 add 1e-398 9.000000000000000E+384 -> 9.000000000000000E+384 Inexact Rounded -addx562 add 0 9.000000000000000E+384 -> 9.000000000000000E+384 Rounded --- and using decimal64 bounds... -precision: 16 -maxExponent: +384 -minExponent: -383 -rounding: down -addx563 add 1e-388 9.000000000000000E+374 -> 9.000000000000000E+374 Inexact Rounded -addx564 add 0 9.000000000000000E+374 -> 9.000000000000000E+374 Rounded - --- some more residue effects with extreme rounding -precision: 9 -rounding: half_up -addx601 add 123456789 0.000001 -> 123456789 Inexact Rounded -rounding: half_even -addx602 add 123456789 0.000001 -> 123456789 Inexact Rounded -rounding: half_down -addx603 add 123456789 0.000001 -> 123456789 Inexact Rounded -rounding: floor -addx604 add 123456789 0.000001 -> 123456789 Inexact Rounded -rounding: ceiling -addx605 add 123456789 0.000001 -> 123456790 Inexact Rounded -rounding: up -addx606 add 123456789 0.000001 -> 123456790 Inexact Rounded -rounding: down -addx607 add 123456789 0.000001 -> 123456789 Inexact Rounded - -rounding: half_up -addx611 add 123456789 -0.000001 -> 123456789 Inexact Rounded -rounding: half_even -addx612 add 123456789 -0.000001 -> 123456789 Inexact Rounded -rounding: half_down -addx613 add 123456789 -0.000001 -> 123456789 Inexact Rounded -rounding: floor -addx614 add 123456789 -0.000001 -> 123456788 Inexact Rounded -rounding: ceiling -addx615 add 123456789 -0.000001 -> 123456789 Inexact Rounded -rounding: up -addx616 add 123456789 -0.000001 -> 123456789 Inexact Rounded -rounding: down -addx617 add 123456789 -0.000001 -> 123456788 Inexact Rounded - -rounding: half_up -addx621 add 123456789 0.499999 -> 123456789 Inexact Rounded -rounding: half_even -addx622 add 123456789 0.499999 -> 123456789 Inexact Rounded -rounding: half_down -addx623 add 123456789 0.499999 -> 123456789 Inexact Rounded -rounding: floor -addx624 add 123456789 0.499999 -> 123456789 Inexact Rounded -rounding: ceiling -addx625 add 123456789 0.499999 -> 123456790 Inexact Rounded -rounding: up -addx626 add 123456789 0.499999 -> 123456790 Inexact Rounded -rounding: down -addx627 add 123456789 0.499999 -> 123456789 Inexact Rounded - -rounding: half_up -addx631 add 123456789 -0.499999 -> 123456789 Inexact Rounded -rounding: half_even -addx632 add 123456789 -0.499999 -> 123456789 Inexact Rounded -rounding: half_down -addx633 add 123456789 -0.499999 -> 123456789 Inexact Rounded -rounding: floor -addx634 add 123456789 -0.499999 -> 123456788 Inexact Rounded -rounding: ceiling -addx635 add 123456789 -0.499999 -> 123456789 Inexact Rounded -rounding: up -addx636 add 123456789 -0.499999 -> 123456789 Inexact Rounded -rounding: down -addx637 add 123456789 -0.499999 -> 123456788 Inexact Rounded - -rounding: half_up -addx641 add 123456789 0.500001 -> 123456790 Inexact Rounded -rounding: half_even -addx642 add 123456789 0.500001 -> 123456790 Inexact Rounded -rounding: half_down -addx643 add 123456789 0.500001 -> 123456790 Inexact Rounded -rounding: floor -addx644 add 123456789 0.500001 -> 123456789 Inexact Rounded -rounding: ceiling -addx645 add 123456789 0.500001 -> 123456790 Inexact Rounded -rounding: up -addx646 add 123456789 0.500001 -> 123456790 Inexact Rounded -rounding: down -addx647 add 123456789 0.500001 -> 123456789 Inexact Rounded - -rounding: half_up -addx651 add 123456789 -0.500001 -> 123456788 Inexact Rounded -rounding: half_even -addx652 add 123456789 -0.500001 -> 123456788 Inexact Rounded -rounding: half_down -addx653 add 123456789 -0.500001 -> 123456788 Inexact Rounded -rounding: floor -addx654 add 123456789 -0.500001 -> 123456788 Inexact Rounded -rounding: ceiling -addx655 add 123456789 -0.500001 -> 123456789 Inexact Rounded -rounding: up -addx656 add 123456789 -0.500001 -> 123456789 Inexact Rounded -rounding: down -addx657 add 123456789 -0.500001 -> 123456788 Inexact Rounded - --- long operand triangle -rounding: half_up -precision: 37 -addx660 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337114834538 -precision: 36 -addx661 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892233711483454 Inexact Rounded -precision: 35 -addx662 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223371148345 Inexact Rounded -precision: 34 -addx663 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337114835 Inexact Rounded -precision: 33 -addx664 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892233711483 Inexact Rounded -precision: 32 -addx665 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223371148 Inexact Rounded -precision: 31 -addx666 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337115 Inexact Rounded -precision: 30 -addx667 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892233711 Inexact Rounded -precision: 29 -addx668 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223371 Inexact Rounded -precision: 28 -addx669 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337 Inexact Rounded -precision: 27 -addx670 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892234 Inexact Rounded -precision: 26 -addx671 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223 Inexact Rounded -precision: 25 -addx672 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922 Inexact Rounded -precision: 24 -addx673 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892 Inexact Rounded -precision: 23 -addx674 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389 Inexact Rounded -precision: 22 -addx675 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023639 Inexact Rounded -precision: 21 -addx676 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102364 Inexact Rounded -precision: 20 -addx677 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236 Inexact Rounded -precision: 19 -addx678 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211024 Inexact Rounded -precision: 18 -addx679 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102 Inexact Rounded -precision: 17 -addx680 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110 Inexact Rounded -precision: 16 -addx681 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211 Inexact Rounded -precision: 15 -addx682 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221 Inexact Rounded -precision: 14 -addx683 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422 Inexact Rounded -precision: 13 -addx684 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42 Inexact Rounded -precision: 12 -addx685 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4 Inexact Rounded -precision: 11 -addx686 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166 Inexact Rounded -precision: 10 -addx687 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.847117417E+10 Inexact Rounded -precision: 9 -addx688 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.84711742E+10 Inexact Rounded -precision: 8 -addx689 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.8471174E+10 Inexact Rounded -precision: 7 -addx690 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.847117E+10 Inexact Rounded -precision: 6 -addx691 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.84712E+10 Inexact Rounded -precision: 5 -addx692 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.8471E+10 Inexact Rounded -precision: 4 -addx693 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.847E+10 Inexact Rounded -precision: 3 -addx694 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.85E+10 Inexact Rounded -precision: 2 -addx695 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.8E+10 Inexact Rounded -precision: 1 -addx696 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 1E+11 Inexact Rounded - --- more zeros, etc. -rounding: half_up -precision: 9 - -addx701 add 5.00 1.00E-3 -> 5.00100 -addx702 add 00.00 0.000 -> 0.000 -addx703 add 00.00 0E-3 -> 0.000 -addx704 add 0E-3 00.00 -> 0.000 - -addx710 add 0E+3 00.00 -> 0.00 -addx711 add 0E+3 00.0 -> 0.0 -addx712 add 0E+3 00. -> 0 -addx713 add 0E+3 00.E+1 -> 0E+1 -addx714 add 0E+3 00.E+2 -> 0E+2 -addx715 add 0E+3 00.E+3 -> 0E+3 -addx716 add 0E+3 00.E+4 -> 0E+3 -addx717 add 0E+3 00.E+5 -> 0E+3 -addx718 add 0E+3 -00.0 -> 0.0 -addx719 add 0E+3 -00. -> 0 -addx731 add 0E+3 -00.E+1 -> 0E+1 - -addx720 add 00.00 0E+3 -> 0.00 -addx721 add 00.0 0E+3 -> 0.0 -addx722 add 00. 0E+3 -> 0 -addx723 add 00.E+1 0E+3 -> 0E+1 -addx724 add 00.E+2 0E+3 -> 0E+2 -addx725 add 00.E+3 0E+3 -> 0E+3 -addx726 add 00.E+4 0E+3 -> 0E+3 -addx727 add 00.E+5 0E+3 -> 0E+3 -addx728 add -00.00 0E+3 -> 0.00 -addx729 add -00.0 0E+3 -> 0.0 -addx730 add -00. 0E+3 -> 0 - -addx732 add 0 0 -> 0 -addx733 add 0 -0 -> 0 -addx734 add -0 0 -> 0 -addx735 add -0 -0 -> -0 -- IEEE 854 special case - -addx736 add 1 -1 -> 0 -addx737 add -1 -1 -> -2 -addx738 add 1 1 -> 2 -addx739 add -1 1 -> 0 - -addx741 add 0 -1 -> -1 -addx742 add -0 -1 -> -1 -addx743 add 0 1 -> 1 -addx744 add -0 1 -> 1 -addx745 add -1 0 -> -1 -addx746 add -1 -0 -> -1 -addx747 add 1 0 -> 1 -addx748 add 1 -0 -> 1 - -addx751 add 0.0 -1 -> -1.0 -addx752 add -0.0 -1 -> -1.0 -addx753 add 0.0 1 -> 1.0 -addx754 add -0.0 1 -> 1.0 -addx755 add -1.0 0 -> -1.0 -addx756 add -1.0 -0 -> -1.0 -addx757 add 1.0 0 -> 1.0 -addx758 add 1.0 -0 -> 1.0 - -addx761 add 0 -1.0 -> -1.0 -addx762 add -0 -1.0 -> -1.0 -addx763 add 0 1.0 -> 1.0 -addx764 add -0 1.0 -> 1.0 -addx765 add -1 0.0 -> -1.0 -addx766 add -1 -0.0 -> -1.0 -addx767 add 1 0.0 -> 1.0 -addx768 add 1 -0.0 -> 1.0 - -addx771 add 0.0 -1.0 -> -1.0 -addx772 add -0.0 -1.0 -> -1.0 -addx773 add 0.0 1.0 -> 1.0 -addx774 add -0.0 1.0 -> 1.0 -addx775 add -1.0 0.0 -> -1.0 -addx776 add -1.0 -0.0 -> -1.0 -addx777 add 1.0 0.0 -> 1.0 -addx778 add 1.0 -0.0 -> 1.0 - --- Specials -addx780 add -Inf -Inf -> -Infinity -addx781 add -Inf -1000 -> -Infinity -addx782 add -Inf -1 -> -Infinity -addx783 add -Inf -0 -> -Infinity -addx784 add -Inf 0 -> -Infinity -addx785 add -Inf 1 -> -Infinity -addx786 add -Inf 1000 -> -Infinity -addx787 add -1000 -Inf -> -Infinity -addx788 add -Inf -Inf -> -Infinity -addx789 add -1 -Inf -> -Infinity -addx790 add -0 -Inf -> -Infinity -addx791 add 0 -Inf -> -Infinity -addx792 add 1 -Inf -> -Infinity -addx793 add 1000 -Inf -> -Infinity -addx794 add Inf -Inf -> NaN Invalid_operation - -addx800 add Inf -Inf -> NaN Invalid_operation -addx801 add Inf -1000 -> Infinity -addx802 add Inf -1 -> Infinity -addx803 add Inf -0 -> Infinity -addx804 add Inf 0 -> Infinity -addx805 add Inf 1 -> Infinity -addx806 add Inf 1000 -> Infinity -addx807 add Inf Inf -> Infinity -addx808 add -1000 Inf -> Infinity -addx809 add -Inf Inf -> NaN Invalid_operation -addx810 add -1 Inf -> Infinity -addx811 add -0 Inf -> Infinity -addx812 add 0 Inf -> Infinity -addx813 add 1 Inf -> Infinity -addx814 add 1000 Inf -> Infinity -addx815 add Inf Inf -> Infinity - -addx821 add NaN -Inf -> NaN -addx822 add NaN -1000 -> NaN -addx823 add NaN -1 -> NaN -addx824 add NaN -0 -> NaN -addx825 add NaN 0 -> NaN -addx826 add NaN 1 -> NaN -addx827 add NaN 1000 -> NaN -addx828 add NaN Inf -> NaN -addx829 add NaN NaN -> NaN -addx830 add -Inf NaN -> NaN -addx831 add -1000 NaN -> NaN -addx832 add -1 NaN -> NaN -addx833 add -0 NaN -> NaN -addx834 add 0 NaN -> NaN -addx835 add 1 NaN -> NaN -addx836 add 1000 NaN -> NaN -addx837 add Inf NaN -> NaN - -addx841 add sNaN -Inf -> NaN Invalid_operation -addx842 add sNaN -1000 -> NaN Invalid_operation -addx843 add sNaN -1 -> NaN Invalid_operation -addx844 add sNaN -0 -> NaN Invalid_operation -addx845 add sNaN 0 -> NaN Invalid_operation -addx846 add sNaN 1 -> NaN Invalid_operation -addx847 add sNaN 1000 -> NaN Invalid_operation -addx848 add sNaN NaN -> NaN Invalid_operation -addx849 add sNaN sNaN -> NaN Invalid_operation -addx850 add NaN sNaN -> NaN Invalid_operation -addx851 add -Inf sNaN -> NaN Invalid_operation -addx852 add -1000 sNaN -> NaN Invalid_operation -addx853 add -1 sNaN -> NaN Invalid_operation -addx854 add -0 sNaN -> NaN Invalid_operation -addx855 add 0 sNaN -> NaN Invalid_operation -addx856 add 1 sNaN -> NaN Invalid_operation -addx857 add 1000 sNaN -> NaN Invalid_operation -addx858 add Inf sNaN -> NaN Invalid_operation -addx859 add NaN sNaN -> NaN Invalid_operation - --- propagating NaNs -addx861 add NaN1 -Inf -> NaN1 -addx862 add +NaN2 -1000 -> NaN2 -addx863 add NaN3 1000 -> NaN3 -addx864 add NaN4 Inf -> NaN4 -addx865 add NaN5 +NaN6 -> NaN5 -addx866 add -Inf NaN7 -> NaN7 -addx867 add -1000 NaN8 -> NaN8 -addx868 add 1000 NaN9 -> NaN9 -addx869 add Inf +NaN10 -> NaN10 -addx871 add sNaN11 -Inf -> NaN11 Invalid_operation -addx872 add sNaN12 -1000 -> NaN12 Invalid_operation -addx873 add sNaN13 1000 -> NaN13 Invalid_operation -addx874 add sNaN14 NaN17 -> NaN14 Invalid_operation -addx875 add sNaN15 sNaN18 -> NaN15 Invalid_operation -addx876 add NaN16 sNaN19 -> NaN19 Invalid_operation -addx877 add -Inf +sNaN20 -> NaN20 Invalid_operation -addx878 add -1000 sNaN21 -> NaN21 Invalid_operation -addx879 add 1000 sNaN22 -> NaN22 Invalid_operation -addx880 add Inf sNaN23 -> NaN23 Invalid_operation -addx881 add +NaN25 +sNaN24 -> NaN24 Invalid_operation -addx882 add -NaN26 NaN28 -> -NaN26 -addx883 add -sNaN27 sNaN29 -> -NaN27 Invalid_operation -addx884 add 1000 -NaN30 -> -NaN30 -addx885 add 1000 -sNaN31 -> -NaN31 Invalid_operation - --- overflow, underflow and subnormal tests -maxexponent: 999999999 -minexponent: -999999999 -precision: 9 -addx890 add 1E+999999999 9E+999999999 -> Infinity Overflow Inexact Rounded -addx891 add 9E+999999999 1E+999999999 -> Infinity Overflow Inexact Rounded -addx892 add -1.1E-999999999 1E-999999999 -> -1E-1000000000 Subnormal -addx893 add 1E-999999999 -1.1e-999999999 -> -1E-1000000000 Subnormal -addx894 add -1.0001E-999999999 1E-999999999 -> -1E-1000000003 Subnormal -addx895 add 1E-999999999 -1.0001e-999999999 -> -1E-1000000003 Subnormal -addx896 add -1E+999999999 -9E+999999999 -> -Infinity Overflow Inexact Rounded -addx897 add -9E+999999999 -1E+999999999 -> -Infinity Overflow Inexact Rounded -addx898 add +1.1E-999999999 -1E-999999999 -> 1E-1000000000 Subnormal -addx899 add -1E-999999999 +1.1e-999999999 -> 1E-1000000000 Subnormal -addx900 add +1.0001E-999999999 -1E-999999999 -> 1E-1000000003 Subnormal -addx901 add -1E-999999999 +1.0001e-999999999 -> 1E-1000000003 Subnormal -addx902 add -1E+999999999 +9E+999999999 -> 8E+999999999 -addx903 add -9E+999999999 +1E+999999999 -> -8E+999999999 - -precision: 3 -addx904 add 0 -9.999E+999999999 -> -Infinity Inexact Overflow Rounded -addx905 add -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded -addx906 add 0 9.999E+999999999 -> Infinity Inexact Overflow Rounded -addx907 add 9.999E+999999999 0 -> Infinity Inexact Overflow Rounded - -precision: 3 -maxexponent: 999 -minexponent: -999 -addx910 add 1.00E-999 0 -> 1.00E-999 -addx911 add 0.1E-999 0 -> 1E-1000 Subnormal -addx912 add 0.10E-999 0 -> 1.0E-1000 Subnormal -addx913 add 0.100E-999 0 -> 1.0E-1000 Subnormal Rounded -addx914 add 0.01E-999 0 -> 1E-1001 Subnormal --- next is rounded to Emin -addx915 add 0.999E-999 0 -> 1.00E-999 Inexact Rounded Subnormal Underflow -addx916 add 0.099E-999 0 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -addx917 add 0.009E-999 0 -> 1E-1001 Inexact Rounded Subnormal Underflow -addx918 add 0.001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow -addx919 add 0.0009E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow -addx920 add 0.0001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow - -addx930 add -1.00E-999 0 -> -1.00E-999 -addx931 add -0.1E-999 0 -> -1E-1000 Subnormal -addx932 add -0.10E-999 0 -> -1.0E-1000 Subnormal -addx933 add -0.100E-999 0 -> -1.0E-1000 Subnormal Rounded -addx934 add -0.01E-999 0 -> -1E-1001 Subnormal --- next is rounded to Emin -addx935 add -0.999E-999 0 -> -1.00E-999 Inexact Rounded Subnormal Underflow -addx936 add -0.099E-999 0 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -addx937 add -0.009E-999 0 -> -1E-1001 Inexact Rounded Subnormal Underflow -addx938 add -0.001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow -addx939 add -0.0009E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow -addx940 add -0.0001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow - --- some non-zero subnormal adds -addx950 add 1.00E-999 0.1E-999 -> 1.10E-999 -addx951 add 0.1E-999 0.1E-999 -> 2E-1000 Subnormal -addx952 add 0.10E-999 0.1E-999 -> 2.0E-1000 Subnormal -addx953 add 0.100E-999 0.1E-999 -> 2.0E-1000 Subnormal Rounded -addx954 add 0.01E-999 0.1E-999 -> 1.1E-1000 Subnormal -addx955 add 0.999E-999 0.1E-999 -> 1.10E-999 Inexact Rounded -addx956 add 0.099E-999 0.1E-999 -> 2.0E-1000 Inexact Rounded Subnormal Underflow -addx957 add 0.009E-999 0.1E-999 -> 1.1E-1000 Inexact Rounded Subnormal Underflow -addx958 add 0.001E-999 0.1E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -addx959 add 0.0009E-999 0.1E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -addx960 add 0.0001E-999 0.1E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow --- negatives... -addx961 add 1.00E-999 -0.1E-999 -> 9.0E-1000 Subnormal -addx962 add 0.1E-999 -0.1E-999 -> 0E-1000 -addx963 add 0.10E-999 -0.1E-999 -> 0E-1001 -addx964 add 0.100E-999 -0.1E-999 -> 0E-1001 Clamped -addx965 add 0.01E-999 -0.1E-999 -> -9E-1001 Subnormal -addx966 add 0.999E-999 -0.1E-999 -> 9.0E-1000 Inexact Rounded Subnormal Underflow -addx967 add 0.099E-999 -0.1E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow -addx968 add 0.009E-999 -0.1E-999 -> -9E-1001 Inexact Rounded Subnormal Underflow -addx969 add 0.001E-999 -0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -addx970 add 0.0009E-999 -0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -addx971 add 0.0001E-999 -0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow - --- check overflow edge case -precision: 7 -rounding: half_up -maxExponent: 96 -minExponent: -95 -addx972 apply 9.999999E+96 -> 9.999999E+96 -addx973 add 9.999999E+96 1 -> 9.999999E+96 Inexact Rounded -addx974 add 9999999E+90 1 -> 9.999999E+96 Inexact Rounded -addx975 add 9999999E+90 1E+90 -> Infinity Overflow Inexact Rounded -addx976 add 9999999E+90 9E+89 -> Infinity Overflow Inexact Rounded -addx977 add 9999999E+90 8E+89 -> Infinity Overflow Inexact Rounded -addx978 add 9999999E+90 7E+89 -> Infinity Overflow Inexact Rounded -addx979 add 9999999E+90 6E+89 -> Infinity Overflow Inexact Rounded -addx980 add 9999999E+90 5E+89 -> Infinity Overflow Inexact Rounded -addx981 add 9999999E+90 4E+89 -> 9.999999E+96 Inexact Rounded -addx982 add 9999999E+90 3E+89 -> 9.999999E+96 Inexact Rounded -addx983 add 9999999E+90 2E+89 -> 9.999999E+96 Inexact Rounded -addx984 add 9999999E+90 1E+89 -> 9.999999E+96 Inexact Rounded - -addx985 apply -9.999999E+96 -> -9.999999E+96 -addx986 add -9.999999E+96 -1 -> -9.999999E+96 Inexact Rounded -addx987 add -9999999E+90 -1 -> -9.999999E+96 Inexact Rounded -addx988 add -9999999E+90 -1E+90 -> -Infinity Overflow Inexact Rounded -addx989 add -9999999E+90 -9E+89 -> -Infinity Overflow Inexact Rounded -addx990 add -9999999E+90 -8E+89 -> -Infinity Overflow Inexact Rounded -addx991 add -9999999E+90 -7E+89 -> -Infinity Overflow Inexact Rounded -addx992 add -9999999E+90 -6E+89 -> -Infinity Overflow Inexact Rounded -addx993 add -9999999E+90 -5E+89 -> -Infinity Overflow Inexact Rounded -addx994 add -9999999E+90 -4E+89 -> -9.999999E+96 Inexact Rounded -addx995 add -9999999E+90 -3E+89 -> -9.999999E+96 Inexact Rounded -addx996 add -9999999E+90 -2E+89 -> -9.999999E+96 Inexact Rounded -addx997 add -9999999E+90 -1E+89 -> -9.999999E+96 Inexact Rounded - --- check for double-rounded subnormals -precision: 5 -maxexponent: 79 -minexponent: -79 --- Add: lhs and rhs 0 -addx1001 add 1.52444E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1002 add 1.52445E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1003 add 1.52446E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1004 add 0 1.52444E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1005 add 0 1.52445E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1006 add 0 1.52446E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow - --- Add: lhs >> rhs and vice versa -addx1011 add 1.52444E-80 1E-100 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1012 add 1.52445E-80 1E-100 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1013 add 1.52446E-80 1E-100 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1014 add 1E-100 1.52444E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1015 add 1E-100 1.52445E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow -addx1016 add 1E-100 1.52446E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow - --- Add: lhs + rhs addition carried out -addx1021 add 1.52443E-80 1.00001E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow -addx1022 add 1.52444E-80 1.00001E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow -addx1023 add 1.52445E-80 1.00001E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow -addx1024 add 1.00001E-80 1.52443E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow -addx1025 add 1.00001E-80 1.52444E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow -addx1026 add 1.00001E-80 1.52445E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow - --- And for round down full and subnormal results -precision: 16 -maxExponent: +384 -minExponent: -383 -rounding: down - -addx1100 add 1e+2 -1e-383 -> 99.99999999999999 Rounded Inexact -addx1101 add 1e+1 -1e-383 -> 9.999999999999999 Rounded Inexact -addx1103 add +1 -1e-383 -> 0.9999999999999999 Rounded Inexact -addx1104 add 1e-1 -1e-383 -> 0.09999999999999999 Rounded Inexact -addx1105 add 1e-2 -1e-383 -> 0.009999999999999999 Rounded Inexact -addx1106 add 1e-3 -1e-383 -> 0.0009999999999999999 Rounded Inexact -addx1107 add 1e-4 -1e-383 -> 0.00009999999999999999 Rounded Inexact -addx1108 add 1e-5 -1e-383 -> 0.000009999999999999999 Rounded Inexact -addx1109 add 1e-6 -1e-383 -> 9.999999999999999E-7 Rounded Inexact - -rounding: ceiling -addx1110 add -1e+2 +1e-383 -> -99.99999999999999 Rounded Inexact -addx1111 add -1e+1 +1e-383 -> -9.999999999999999 Rounded Inexact -addx1113 add -1 +1e-383 -> -0.9999999999999999 Rounded Inexact -addx1114 add -1e-1 +1e-383 -> -0.09999999999999999 Rounded Inexact -addx1115 add -1e-2 +1e-383 -> -0.009999999999999999 Rounded Inexact -addx1116 add -1e-3 +1e-383 -> -0.0009999999999999999 Rounded Inexact -addx1117 add -1e-4 +1e-383 -> -0.00009999999999999999 Rounded Inexact -addx1118 add -1e-5 +1e-383 -> -0.000009999999999999999 Rounded Inexact -addx1119 add -1e-6 +1e-383 -> -9.999999999999999E-7 Rounded Inexact - -rounding: down -precision: 7 -maxExponent: +96 -minExponent: -95 -addx1130 add 1 -1e-200 -> 0.9999999 Rounded Inexact --- subnormal boundary -addx1131 add 1.000000E-94 -1e-200 -> 9.999999E-95 Rounded Inexact -addx1132 add 1.000001E-95 -1e-200 -> 1.000000E-95 Rounded Inexact -addx1133 add 1.000000E-95 -1e-200 -> 9.99999E-96 Rounded Inexact Subnormal Underflow -addx1134 add 0.999999E-95 -1e-200 -> 9.99998E-96 Rounded Inexact Subnormal Underflow -addx1135 add 0.001000E-95 -1e-200 -> 9.99E-99 Rounded Inexact Subnormal Underflow -addx1136 add 0.000999E-95 -1e-200 -> 9.98E-99 Rounded Inexact Subnormal Underflow -addx1137 add 1.000000E-95 -1e-101 -> 9.99999E-96 Subnormal -addx1138 add 10000E-101 -1e-200 -> 9.999E-98 Subnormal Inexact Rounded Underflow -addx1139 add 1000E-101 -1e-200 -> 9.99E-99 Subnormal Inexact Rounded Underflow -addx1140 add 100E-101 -1e-200 -> 9.9E-100 Subnormal Inexact Rounded Underflow -addx1141 add 10E-101 -1e-200 -> 9E-101 Subnormal Inexact Rounded Underflow -addx1142 add 1E-101 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow -addx1143 add 0E-101 -1e-200 -> -0E-101 Subnormal Inexact Rounded Underflow -addx1144 add 1E-102 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow - -addx1151 add 10000E-102 -1e-200 -> 9.99E-99 Subnormal Inexact Rounded Underflow -addx1152 add 1000E-102 -1e-200 -> 9.9E-100 Subnormal Inexact Rounded Underflow -addx1153 add 100E-102 -1e-200 -> 9E-101 Subnormal Inexact Rounded Underflow -addx1154 add 10E-102 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow -addx1155 add 1E-102 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow -addx1156 add 0E-102 -1e-200 -> -0E-101 Subnormal Inexact Rounded Underflow -addx1157 add 1E-103 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow - -addx1160 add 100E-105 -1e-101 -> -0E-101 Subnormal Inexact Rounded Underflow -addx1161 add 100E-105 -1e-201 -> 0E-101 Subnormal Inexact Rounded Underflow - - --- Null tests -addx9990 add 10 # -> NaN Invalid_operation -addx9991 add # 10 -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/base.decTest b/sys/lib/python/test/decimaltestdata/base.decTest deleted file mode 100644 index 96a4b9d1d..000000000 --- a/sys/lib/python/test/decimaltestdata/base.decTest +++ /dev/null @@ -1,1272 +0,0 @@ ------------------------------------------------------------------------- --- base.decTest -- base decimal <--> string conversions -- --- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- This file tests base conversions from string to a decimal number --- and back to a string (in either Scientific or Engineering form) - --- Note that unlike other operations the operand is subject to rounding --- to conform to emax and precision settings (that is, numbers will --- conform to rules and exponent will be in permitted range). - -precision: 15 -rounding: half_up -maxExponent: 999999999 -minExponent: -999999999 -extended: 1 - -basx001 toSci 0 -> 0 -basx002 toSci 1 -> 1 -basx003 toSci 1.0 -> 1.0 -basx004 toSci 1.00 -> 1.00 -basx005 toSci 10 -> 10 -basx006 toSci 1000 -> 1000 -basx007 toSci 10.0 -> 10.0 -basx008 toSci 10.1 -> 10.1 -basx009 toSci 10.4 -> 10.4 -basx010 toSci 10.5 -> 10.5 -basx011 toSci 10.6 -> 10.6 -basx012 toSci 10.9 -> 10.9 -basx013 toSci 11.0 -> 11.0 -basx014 toSci 1.234 -> 1.234 -basx015 toSci 0.123 -> 0.123 -basx016 toSci 0.012 -> 0.012 -basx017 toSci -0 -> -0 -basx018 toSci -0.0 -> -0.0 -basx019 toSci -00.00 -> -0.00 - -basx021 toSci -1 -> -1 -basx022 toSci -1.0 -> -1.0 -basx023 toSci -0.1 -> -0.1 -basx024 toSci -9.1 -> -9.1 -basx025 toSci -9.11 -> -9.11 -basx026 toSci -9.119 -> -9.119 -basx027 toSci -9.999 -> -9.999 - -basx030 toSci '123456789.123456' -> '123456789.123456' -basx031 toSci '123456789.000000' -> '123456789.000000' -basx032 toSci '123456789123456' -> '123456789123456' -basx033 toSci '0.0000123456789' -> '0.0000123456789' -basx034 toSci '0.00000123456789' -> '0.00000123456789' -basx035 toSci '0.000000123456789' -> '1.23456789E-7' -basx036 toSci '0.0000000123456789' -> '1.23456789E-8' - -basx037 toSci '0.123456789012344' -> '0.123456789012344' -basx038 toSci '0.123456789012345' -> '0.123456789012345' - --- String [many more examples are implicitly tested elsewhere] --- strings without E cannot generate E in result -basx100 toSci "12" -> '12' -basx101 toSci "-76" -> '-76' -basx102 toSci "12.76" -> '12.76' -basx103 toSci "+12.76" -> '12.76' -basx104 toSci "012.76" -> '12.76' -basx105 toSci "+0.003" -> '0.003' -basx106 toSci "17." -> '17' -basx107 toSci ".5" -> '0.5' -basx108 toSci "044" -> '44' -basx109 toSci "0044" -> '44' -basx110 toSci "0.0005" -> '0.0005' -basx111 toSci "00.00005" -> '0.00005' -basx112 toSci "0.000005" -> '0.000005' -basx113 toSci "0.0000050" -> '0.0000050' -basx114 toSci "0.0000005" -> '5E-7' -basx115 toSci "0.00000005" -> '5E-8' -basx116 toSci "12345678.543210" -> '12345678.543210' -basx117 toSci "2345678.543210" -> '2345678.543210' -basx118 toSci "345678.543210" -> '345678.543210' -basx119 toSci "0345678.54321" -> '345678.54321' -basx120 toSci "345678.5432" -> '345678.5432' -basx121 toSci "+345678.5432" -> '345678.5432' -basx122 toSci "+0345678.5432" -> '345678.5432' -basx123 toSci "+00345678.5432" -> '345678.5432' -basx124 toSci "-345678.5432" -> '-345678.5432' -basx125 toSci "-0345678.5432" -> '-345678.5432' -basx126 toSci "-00345678.5432" -> '-345678.5432' --- examples -basx127 toSci "5E-6" -> '0.000005' -basx128 toSci "50E-7" -> '0.0000050' -basx129 toSci "5E-7" -> '5E-7' - - --- [No exotics as no Unicode] - --- Numbers with E -basx130 toSci "0.000E-1" -> '0.0000' -basx131 toSci "0.000E-2" -> '0.00000' -basx132 toSci "0.000E-3" -> '0.000000' -basx133 toSci "0.000E-4" -> '0E-7' -basx134 toSci "0.00E-2" -> '0.0000' -basx135 toSci "0.00E-3" -> '0.00000' -basx136 toSci "0.00E-4" -> '0.000000' -basx137 toSci "0.00E-5" -> '0E-7' -basx138 toSci "+0E+9" -> '0E+9' -basx139 toSci "-0E+9" -> '-0E+9' -basx140 toSci "1E+9" -> '1E+9' -basx141 toSci "1e+09" -> '1E+9' -basx142 toSci "1E+90" -> '1E+90' -basx143 toSci "+1E+009" -> '1E+9' -basx144 toSci "0E+9" -> '0E+9' -basx145 toSci "1E+9" -> '1E+9' -basx146 toSci "1E+09" -> '1E+9' -basx147 toSci "1e+90" -> '1E+90' -basx148 toSci "1E+009" -> '1E+9' -basx149 toSci "000E+9" -> '0E+9' -basx150 toSci "1E9" -> '1E+9' -basx151 toSci "1e09" -> '1E+9' -basx152 toSci "1E90" -> '1E+90' -basx153 toSci "1E009" -> '1E+9' -basx154 toSci "0E9" -> '0E+9' -basx155 toSci "0.000e+0" -> '0.000' -basx156 toSci "0.000E-1" -> '0.0000' -basx157 toSci "4E+9" -> '4E+9' -basx158 toSci "44E+9" -> '4.4E+10' -basx159 toSci "0.73e-7" -> '7.3E-8' -basx160 toSci "00E+9" -> '0E+9' -basx161 toSci "00E-9" -> '0E-9' -basx162 toSci "10E+9" -> '1.0E+10' -basx163 toSci "10E+09" -> '1.0E+10' -basx164 toSci "10e+90" -> '1.0E+91' -basx165 toSci "10E+009" -> '1.0E+10' -basx166 toSci "100e+9" -> '1.00E+11' -basx167 toSci "100e+09" -> '1.00E+11' -basx168 toSci "100E+90" -> '1.00E+92' -basx169 toSci "100e+009" -> '1.00E+11' - -basx170 toSci "1.265" -> '1.265' -basx171 toSci "1.265E-20" -> '1.265E-20' -basx172 toSci "1.265E-8" -> '1.265E-8' -basx173 toSci "1.265E-4" -> '0.0001265' -basx174 toSci "1.265E-3" -> '0.001265' -basx175 toSci "1.265E-2" -> '0.01265' -basx176 toSci "1.265E-1" -> '0.1265' -basx177 toSci "1.265E-0" -> '1.265' -basx178 toSci "1.265E+1" -> '12.65' -basx179 toSci "1.265E+2" -> '126.5' -basx180 toSci "1.265E+3" -> '1265' -basx181 toSci "1.265E+4" -> '1.265E+4' -basx182 toSci "1.265E+8" -> '1.265E+8' -basx183 toSci "1.265E+20" -> '1.265E+20' - -basx190 toSci "12.65" -> '12.65' -basx191 toSci "12.65E-20" -> '1.265E-19' -basx192 toSci "12.65E-8" -> '1.265E-7' -basx193 toSci "12.65E-4" -> '0.001265' -basx194 toSci "12.65E-3" -> '0.01265' -basx195 toSci "12.65E-2" -> '0.1265' -basx196 toSci "12.65E-1" -> '1.265' -basx197 toSci "12.65E-0" -> '12.65' -basx198 toSci "12.65E+1" -> '126.5' -basx199 toSci "12.65E+2" -> '1265' -basx200 toSci "12.65E+3" -> '1.265E+4' -basx201 toSci "12.65E+4" -> '1.265E+5' -basx202 toSci "12.65E+8" -> '1.265E+9' -basx203 toSci "12.65E+20" -> '1.265E+21' - -basx210 toSci "126.5" -> '126.5' -basx211 toSci "126.5E-20" -> '1.265E-18' -basx212 toSci "126.5E-8" -> '0.000001265' -basx213 toSci "126.5E-4" -> '0.01265' -basx214 toSci "126.5E-3" -> '0.1265' -basx215 toSci "126.5E-2" -> '1.265' -basx216 toSci "126.5E-1" -> '12.65' -basx217 toSci "126.5E-0" -> '126.5' -basx218 toSci "126.5E+1" -> '1265' -basx219 toSci "126.5E+2" -> '1.265E+4' -basx220 toSci "126.5E+3" -> '1.265E+5' -basx221 toSci "126.5E+4" -> '1.265E+6' -basx222 toSci "126.5E+8" -> '1.265E+10' -basx223 toSci "126.5E+20" -> '1.265E+22' - -basx230 toSci "1265" -> '1265' -basx231 toSci "1265E-20" -> '1.265E-17' -basx232 toSci "1265E-8" -> '0.00001265' -basx233 toSci "1265E-4" -> '0.1265' -basx234 toSci "1265E-3" -> '1.265' -basx235 toSci "1265E-2" -> '12.65' -basx236 toSci "1265E-1" -> '126.5' -basx237 toSci "1265E-0" -> '1265' -basx238 toSci "1265E+1" -> '1.265E+4' -basx239 toSci "1265E+2" -> '1.265E+5' -basx240 toSci "1265E+3" -> '1.265E+6' -basx241 toSci "1265E+4" -> '1.265E+7' -basx242 toSci "1265E+8" -> '1.265E+11' -basx243 toSci "1265E+20" -> '1.265E+23' - -basx250 toSci "0.1265" -> '0.1265' -basx251 toSci "0.1265E-20" -> '1.265E-21' -basx252 toSci "0.1265E-8" -> '1.265E-9' -basx253 toSci "0.1265E-4" -> '0.00001265' -basx254 toSci "0.1265E-3" -> '0.0001265' -basx255 toSci "0.1265E-2" -> '0.001265' -basx256 toSci "0.1265E-1" -> '0.01265' -basx257 toSci "0.1265E-0" -> '0.1265' -basx258 toSci "0.1265E+1" -> '1.265' -basx259 toSci "0.1265E+2" -> '12.65' -basx260 toSci "0.1265E+3" -> '126.5' -basx261 toSci "0.1265E+4" -> '1265' -basx262 toSci "0.1265E+8" -> '1.265E+7' -basx263 toSci "0.1265E+20" -> '1.265E+19' - -basx270 toSci "0.09e999" -> '9E+997' -basx271 toSci "0.9e999" -> '9E+998' -basx272 toSci "9e999" -> '9E+999' -basx273 toSci "9.9e999" -> '9.9E+999' -basx274 toSci "9.99e999" -> '9.99E+999' -basx275 toSci "9.99e-999" -> '9.99E-999' -basx276 toSci "9.9e-999" -> '9.9E-999' -basx277 toSci "9e-999" -> '9E-999' -basx279 toSci "99e-999" -> '9.9E-998' -basx280 toSci "999e-999" -> '9.99E-997' -basx281 toSci '0.9e-998' -> '9E-999' -basx282 toSci '0.09e-997' -> '9E-999' -basx283 toSci '0.1e1000' -> '1E+999' -basx284 toSci '10e-1000' -> '1.0E-999' - --- some more negative zeros [systematic tests below] -basx290 toSci "-0.000E-1" -> '-0.0000' -basx291 toSci "-0.000E-2" -> '-0.00000' -basx292 toSci "-0.000E-3" -> '-0.000000' -basx293 toSci "-0.000E-4" -> '-0E-7' -basx294 toSci "-0.00E-2" -> '-0.0000' -basx295 toSci "-0.00E-3" -> '-0.00000' -basx296 toSci "-0.0E-2" -> '-0.000' -basx297 toSci "-0.0E-3" -> '-0.0000' -basx298 toSci "-0E-2" -> '-0.00' -basx299 toSci "-0E-3" -> '-0.000' - --- Engineering notation tests -basx301 toSci 10e12 -> 1.0E+13 -basx302 toEng 10e12 -> 10E+12 -basx303 toSci 10e11 -> 1.0E+12 -basx304 toEng 10e11 -> 1.0E+12 -basx305 toSci 10e10 -> 1.0E+11 -basx306 toEng 10e10 -> 100E+9 -basx307 toSci 10e9 -> 1.0E+10 -basx308 toEng 10e9 -> 10E+9 -basx309 toSci 10e8 -> 1.0E+9 -basx310 toEng 10e8 -> 1.0E+9 -basx311 toSci 10e7 -> 1.0E+8 -basx312 toEng 10e7 -> 100E+6 -basx313 toSci 10e6 -> 1.0E+7 -basx314 toEng 10e6 -> 10E+6 -basx315 toSci 10e5 -> 1.0E+6 -basx316 toEng 10e5 -> 1.0E+6 -basx317 toSci 10e4 -> 1.0E+5 -basx318 toEng 10e4 -> 100E+3 -basx319 toSci 10e3 -> 1.0E+4 -basx320 toEng 10e3 -> 10E+3 -basx321 toSci 10e2 -> 1.0E+3 -basx322 toEng 10e2 -> 1.0E+3 -basx323 toSci 10e1 -> 1.0E+2 -basx324 toEng 10e1 -> 100 -basx325 toSci 10e0 -> 10 -basx326 toEng 10e0 -> 10 -basx327 toSci 10e-1 -> 1.0 -basx328 toEng 10e-1 -> 1.0 -basx329 toSci 10e-2 -> 0.10 -basx330 toEng 10e-2 -> 0.10 -basx331 toSci 10e-3 -> 0.010 -basx332 toEng 10e-3 -> 0.010 -basx333 toSci 10e-4 -> 0.0010 -basx334 toEng 10e-4 -> 0.0010 -basx335 toSci 10e-5 -> 0.00010 -basx336 toEng 10e-5 -> 0.00010 -basx337 toSci 10e-6 -> 0.000010 -basx338 toEng 10e-6 -> 0.000010 -basx339 toSci 10e-7 -> 0.0000010 -basx340 toEng 10e-7 -> 0.0000010 -basx341 toSci 10e-8 -> 1.0E-7 -basx342 toEng 10e-8 -> 100E-9 -basx343 toSci 10e-9 -> 1.0E-8 -basx344 toEng 10e-9 -> 10E-9 -basx345 toSci 10e-10 -> 1.0E-9 -basx346 toEng 10e-10 -> 1.0E-9 -basx347 toSci 10e-11 -> 1.0E-10 -basx348 toEng 10e-11 -> 100E-12 -basx349 toSci 10e-12 -> 1.0E-11 -basx350 toEng 10e-12 -> 10E-12 -basx351 toSci 10e-13 -> 1.0E-12 -basx352 toEng 10e-13 -> 1.0E-12 - -basx361 toSci 7E12 -> 7E+12 -basx362 toEng 7E12 -> 7E+12 -basx363 toSci 7E11 -> 7E+11 -basx364 toEng 7E11 -> 700E+9 -basx365 toSci 7E10 -> 7E+10 -basx366 toEng 7E10 -> 70E+9 -basx367 toSci 7E9 -> 7E+9 -basx368 toEng 7E9 -> 7E+9 -basx369 toSci 7E8 -> 7E+8 -basx370 toEng 7E8 -> 700E+6 -basx371 toSci 7E7 -> 7E+7 -basx372 toEng 7E7 -> 70E+6 -basx373 toSci 7E6 -> 7E+6 -basx374 toEng 7E6 -> 7E+6 -basx375 toSci 7E5 -> 7E+5 -basx376 toEng 7E5 -> 700E+3 -basx377 toSci 7E4 -> 7E+4 -basx378 toEng 7E4 -> 70E+3 -basx379 toSci 7E3 -> 7E+3 -basx380 toEng 7E3 -> 7E+3 -basx381 toSci 7E2 -> 7E+2 -basx382 toEng 7E2 -> 700 -basx383 toSci 7E1 -> 7E+1 -basx384 toEng 7E1 -> 70 -basx385 toSci 7E0 -> 7 -basx386 toEng 7E0 -> 7 -basx387 toSci 7E-1 -> 0.7 -basx388 toEng 7E-1 -> 0.7 -basx389 toSci 7E-2 -> 0.07 -basx390 toEng 7E-2 -> 0.07 -basx391 toSci 7E-3 -> 0.007 -basx392 toEng 7E-3 -> 0.007 -basx393 toSci 7E-4 -> 0.0007 -basx394 toEng 7E-4 -> 0.0007 -basx395 toSci 7E-5 -> 0.00007 -basx396 toEng 7E-5 -> 0.00007 -basx397 toSci 7E-6 -> 0.000007 -basx398 toEng 7E-6 -> 0.000007 -basx399 toSci 7E-7 -> 7E-7 -basx400 toEng 7E-7 -> 700E-9 -basx401 toSci 7E-8 -> 7E-8 -basx402 toEng 7E-8 -> 70E-9 -basx403 toSci 7E-9 -> 7E-9 -basx404 toEng 7E-9 -> 7E-9 -basx405 toSci 7E-10 -> 7E-10 -basx406 toEng 7E-10 -> 700E-12 -basx407 toSci 7E-11 -> 7E-11 -basx408 toEng 7E-11 -> 70E-12 -basx409 toSci 7E-12 -> 7E-12 -basx410 toEng 7E-12 -> 7E-12 -basx411 toSci 7E-13 -> 7E-13 -basx412 toEng 7E-13 -> 700E-15 - --- Exacts remain exact up to precision .. -precision: 9 -basx420 toSci 100 -> 100 -basx421 toEng 100 -> 100 -basx422 toSci 1000 -> 1000 -basx423 toEng 1000 -> 1000 -basx424 toSci 999.9 -> 999.9 -basx425 toEng 999.9 -> 999.9 -basx426 toSci 1000.0 -> 1000.0 -basx427 toEng 1000.0 -> 1000.0 -basx428 toSci 1000.1 -> 1000.1 -basx429 toEng 1000.1 -> 1000.1 -basx430 toSci 10000 -> 10000 -basx431 toEng 10000 -> 10000 -basx432 toSci 100000 -> 100000 -basx433 toEng 100000 -> 100000 -basx434 toSci 1000000 -> 1000000 -basx435 toEng 1000000 -> 1000000 -basx436 toSci 10000000 -> 10000000 -basx437 toEng 10000000 -> 10000000 -basx438 toSci 100000000 -> 100000000 -basx439 toEng 100000000 -> 100000000 -basx440 toSci 1000000000 -> 1.00000000E+9 Rounded -basx441 toEng 1000000000 -> 1.00000000E+9 Rounded -basx442 toSci 1000000000 -> 1.00000000E+9 Rounded -basx443 toEng 1000000000 -> 1.00000000E+9 Rounded -basx444 toSci 1000000003 -> 1.00000000E+9 Rounded Inexact -basx445 toEng 1000000003 -> 1.00000000E+9 Rounded Inexact -basx446 toSci 1000000005 -> 1.00000001E+9 Rounded Inexact -basx447 toEng 1000000005 -> 1.00000001E+9 Rounded Inexact -basx448 toSci 10000000050 -> 1.00000001E+10 Rounded Inexact -basx449 toEng 10000000050 -> 10.0000001E+9 Rounded Inexact -basx450 toSci 1000000009 -> 1.00000001E+9 Rounded Inexact -basx451 toEng 1000000009 -> 1.00000001E+9 Rounded Inexact -basx452 toSci 10000000000 -> 1.00000000E+10 Rounded -basx453 toEng 10000000000 -> 10.0000000E+9 Rounded -basx454 toSci 10000000003 -> 1.00000000E+10 Rounded Inexact -basx455 toEng 10000000003 -> 10.0000000E+9 Rounded Inexact -basx456 toSci 10000000005 -> 1.00000000E+10 Rounded Inexact -basx457 toEng 10000000005 -> 10.0000000E+9 Rounded Inexact -basx458 toSci 10000000009 -> 1.00000000E+10 Rounded Inexact -basx459 toEng 10000000009 -> 10.0000000E+9 Rounded Inexact -basx460 toSci 100000000000 -> 1.00000000E+11 Rounded -basx461 toEng 100000000000 -> 100.000000E+9 Rounded -basx462 toSci 100000000300 -> 1.00000000E+11 Rounded Inexact -basx463 toEng 100000000300 -> 100.000000E+9 Rounded Inexact -basx464 toSci 100000000500 -> 1.00000001E+11 Rounded Inexact -basx465 toEng 100000000500 -> 100.000001E+9 Rounded Inexact -basx466 toSci 100000000900 -> 1.00000001E+11 Rounded Inexact -basx467 toEng 100000000900 -> 100.000001E+9 Rounded Inexact -basx468 toSci 1000000000000 -> 1.00000000E+12 Rounded -basx469 toEng 1000000000000 -> 1.00000000E+12 Rounded -basx470 toSci 1000000003000 -> 1.00000000E+12 Rounded Inexact -basx471 toEng 1000000003000 -> 1.00000000E+12 Rounded Inexact -basx472 toSci 1000000005000 -> 1.00000001E+12 Rounded Inexact -basx473 toEng 1000000005000 -> 1.00000001E+12 Rounded Inexact -basx474 toSci 1000000009000 -> 1.00000001E+12 Rounded Inexact -basx475 toEng 1000000009000 -> 1.00000001E+12 Rounded Inexact - --- check rounding modes heeded -precision: 5 -rounding: ceiling -bsrx401 toSci 1.23450 -> 1.2345 Rounded -bsrx402 toSci 1.234549 -> 1.2346 Rounded Inexact -bsrx403 toSci 1.234550 -> 1.2346 Rounded Inexact -bsrx404 toSci 1.234551 -> 1.2346 Rounded Inexact -rounding: down -bsrx405 toSci 1.23450 -> 1.2345 Rounded -bsrx406 toSci 1.234549 -> 1.2345 Rounded Inexact -bsrx407 toSci 1.234550 -> 1.2345 Rounded Inexact -bsrx408 toSci 1.234551 -> 1.2345 Rounded Inexact -rounding: floor -bsrx410 toSci 1.23450 -> 1.2345 Rounded -bsrx411 toSci 1.234549 -> 1.2345 Rounded Inexact -bsrx412 toSci 1.234550 -> 1.2345 Rounded Inexact -bsrx413 toSci 1.234551 -> 1.2345 Rounded Inexact -rounding: half_down -bsrx415 toSci 1.23450 -> 1.2345 Rounded -bsrx416 toSci 1.234549 -> 1.2345 Rounded Inexact -bsrx417 toSci 1.234550 -> 1.2345 Rounded Inexact -bsrx418 toSci 1.234650 -> 1.2346 Rounded Inexact -bsrx419 toSci 1.234551 -> 1.2346 Rounded Inexact -rounding: half_even -bsrx421 toSci 1.23450 -> 1.2345 Rounded -bsrx422 toSci 1.234549 -> 1.2345 Rounded Inexact -bsrx423 toSci 1.234550 -> 1.2346 Rounded Inexact -bsrx424 toSci 1.234650 -> 1.2346 Rounded Inexact -bsrx425 toSci 1.234551 -> 1.2346 Rounded Inexact -rounding: down -bsrx426 toSci 1.23450 -> 1.2345 Rounded -bsrx427 toSci 1.234549 -> 1.2345 Rounded Inexact -bsrx428 toSci 1.234550 -> 1.2345 Rounded Inexact -bsrx429 toSci 1.234551 -> 1.2345 Rounded Inexact -rounding: half_up -bsrx431 toSci 1.23450 -> 1.2345 Rounded -bsrx432 toSci 1.234549 -> 1.2345 Rounded Inexact -bsrx433 toSci 1.234550 -> 1.2346 Rounded Inexact -bsrx434 toSci 1.234650 -> 1.2347 Rounded Inexact -bsrx435 toSci 1.234551 -> 1.2346 Rounded Inexact --- negatives -rounding: ceiling -bsrx501 toSci -1.23450 -> -1.2345 Rounded -bsrx502 toSci -1.234549 -> -1.2345 Rounded Inexact -bsrx503 toSci -1.234550 -> -1.2345 Rounded Inexact -bsrx504 toSci -1.234551 -> -1.2345 Rounded Inexact -rounding: down -bsrx505 toSci -1.23450 -> -1.2345 Rounded -bsrx506 toSci -1.234549 -> -1.2345 Rounded Inexact -bsrx507 toSci -1.234550 -> -1.2345 Rounded Inexact -bsrx508 toSci -1.234551 -> -1.2345 Rounded Inexact -rounding: floor -bsrx510 toSci -1.23450 -> -1.2345 Rounded -bsrx511 toSci -1.234549 -> -1.2346 Rounded Inexact -bsrx512 toSci -1.234550 -> -1.2346 Rounded Inexact -bsrx513 toSci -1.234551 -> -1.2346 Rounded Inexact -rounding: half_down -bsrx515 toSci -1.23450 -> -1.2345 Rounded -bsrx516 toSci -1.234549 -> -1.2345 Rounded Inexact -bsrx517 toSci -1.234550 -> -1.2345 Rounded Inexact -bsrx518 toSci -1.234650 -> -1.2346 Rounded Inexact -bsrx519 toSci -1.234551 -> -1.2346 Rounded Inexact -rounding: half_even -bsrx521 toSci -1.23450 -> -1.2345 Rounded -bsrx522 toSci -1.234549 -> -1.2345 Rounded Inexact -bsrx523 toSci -1.234550 -> -1.2346 Rounded Inexact -bsrx524 toSci -1.234650 -> -1.2346 Rounded Inexact -bsrx525 toSci -1.234551 -> -1.2346 Rounded Inexact -rounding: down -bsrx526 toSci -1.23450 -> -1.2345 Rounded -bsrx527 toSci -1.234549 -> -1.2345 Rounded Inexact -bsrx528 toSci -1.234550 -> -1.2345 Rounded Inexact -bsrx529 toSci -1.234551 -> -1.2345 Rounded Inexact -rounding: half_up -bsrx531 toSci -1.23450 -> -1.2345 Rounded -bsrx532 toSci -1.234549 -> -1.2345 Rounded Inexact -bsrx533 toSci -1.234550 -> -1.2346 Rounded Inexact -bsrx534 toSci -1.234650 -> -1.2347 Rounded Inexact -bsrx535 toSci -1.234551 -> -1.2346 Rounded Inexact - -rounding: half_up -precision: 9 - --- The 'baddies' tests from DiagBigDecimal, plus some new ones -basx500 toSci '1..2' -> NaN Conversion_syntax -basx501 toSci '.' -> NaN Conversion_syntax -basx502 toSci '..' -> NaN Conversion_syntax -basx503 toSci '++1' -> NaN Conversion_syntax -basx504 toSci '--1' -> NaN Conversion_syntax -basx505 toSci '-+1' -> NaN Conversion_syntax -basx506 toSci '+-1' -> NaN Conversion_syntax -basx507 toSci '12e' -> NaN Conversion_syntax -basx508 toSci '12e++' -> NaN Conversion_syntax -basx509 toSci '12f4' -> NaN Conversion_syntax -basx510 toSci ' +1' -> NaN Conversion_syntax -basx511 toSci '+ 1' -> NaN Conversion_syntax -basx512 toSci '12 ' -> NaN Conversion_syntax -basx513 toSci ' + 1' -> NaN Conversion_syntax -basx514 toSci ' - 1 ' -> NaN Conversion_syntax -basx515 toSci 'x' -> NaN Conversion_syntax -basx516 toSci '-1-' -> NaN Conversion_syntax -basx517 toSci '12-' -> NaN Conversion_syntax -basx518 toSci '3+' -> NaN Conversion_syntax -basx519 toSci '' -> NaN Conversion_syntax -basx520 toSci '1e-' -> NaN Conversion_syntax -basx521 toSci '7e99999a' -> NaN Conversion_syntax -basx522 toSci '7e123567890x' -> NaN Conversion_syntax -basx523 toSci '7e12356789012x' -> NaN Conversion_syntax -basx524 toSci '' -> NaN Conversion_syntax -basx525 toSci 'e100' -> NaN Conversion_syntax -basx526 toSci '\u0e5a' -> NaN Conversion_syntax -basx527 toSci '\u0b65' -> NaN Conversion_syntax -basx528 toSci '123,65' -> NaN Conversion_syntax -basx529 toSci '1.34.5' -> NaN Conversion_syntax -basx530 toSci '.123.5' -> NaN Conversion_syntax -basx531 toSci '01.35.' -> NaN Conversion_syntax -basx532 toSci '01.35-' -> NaN Conversion_syntax -basx533 toSci '0000..' -> NaN Conversion_syntax -basx534 toSci '.0000.' -> NaN Conversion_syntax -basx535 toSci '00..00' -> NaN Conversion_syntax -basx536 toSci '111e*123' -> NaN Conversion_syntax -basx537 toSci '111e123-' -> NaN Conversion_syntax -basx538 toSci '111e+12+' -> NaN Conversion_syntax -basx539 toSci '111e1-3-' -> NaN Conversion_syntax -basx540 toSci '111e1*23' -> NaN Conversion_syntax -basx541 toSci '111e1e+3' -> NaN Conversion_syntax -basx542 toSci '1e1.0' -> NaN Conversion_syntax -basx543 toSci '1e123e' -> NaN Conversion_syntax -basx544 toSci 'ten' -> NaN Conversion_syntax -basx545 toSci 'ONE' -> NaN Conversion_syntax -basx546 toSci '1e.1' -> NaN Conversion_syntax -basx547 toSci '1e1.' -> NaN Conversion_syntax -basx548 toSci '1ee' -> NaN Conversion_syntax -basx549 toSci 'e+1' -> NaN Conversion_syntax -basx550 toSci '1.23.4' -> NaN Conversion_syntax -basx551 toSci '1.2.1' -> NaN Conversion_syntax -basx552 toSci '1E+1.2' -> NaN Conversion_syntax -basx553 toSci '1E+1.2.3' -> NaN Conversion_syntax -basx554 toSci '1E++1' -> NaN Conversion_syntax -basx555 toSci '1E--1' -> NaN Conversion_syntax -basx556 toSci '1E+-1' -> NaN Conversion_syntax -basx557 toSci '1E-+1' -> NaN Conversion_syntax -basx558 toSci '1E''1' -> NaN Conversion_syntax -basx559 toSci "1E""1" -> NaN Conversion_syntax -basx560 toSci "1E""""" -> NaN Conversion_syntax --- Near-specials -basx561 toSci "qNaN" -> NaN Conversion_syntax -basx562 toSci "NaNq" -> NaN Conversion_syntax -basx563 toSci "NaNs" -> NaN Conversion_syntax -basx564 toSci "Infi" -> NaN Conversion_syntax -basx565 toSci "Infin" -> NaN Conversion_syntax -basx566 toSci "Infini" -> NaN Conversion_syntax -basx567 toSci "Infinit" -> NaN Conversion_syntax -basx568 toSci "-Infinit" -> NaN Conversion_syntax -basx569 toSci "0Inf" -> NaN Conversion_syntax -basx570 toSci "9Inf" -> NaN Conversion_syntax -basx571 toSci "-0Inf" -> NaN Conversion_syntax -basx572 toSci "-9Inf" -> NaN Conversion_syntax -basx573 toSci "-sNa" -> NaN Conversion_syntax -basx574 toSci "xNaN" -> NaN Conversion_syntax -basx575 toSci "0sNaN" -> NaN Conversion_syntax - --- subnormals and overflows -basx576 toSci '99e999999999' -> Infinity Overflow Inexact Rounded -basx577 toSci '999e999999999' -> Infinity Overflow Inexact Rounded -basx578 toSci '0.9e-999999999' -> 9E-1000000000 Subnormal -basx579 toSci '0.09e-999999999' -> 9E-1000000001 Subnormal -basx580 toSci '0.1e1000000000' -> 1E+999999999 -basx581 toSci '10e-1000000000' -> 1.0E-999999999 -basx582 toSci '0.9e9999999999' -> Infinity Overflow Inexact Rounded -basx583 toSci '99e-9999999999' -> 0E-1000000007 Underflow Subnormal Inexact Rounded -basx584 toSci '111e9999999999' -> Infinity Overflow Inexact Rounded -basx585 toSci '1111e-9999999999' -> 0E-1000000007 Underflow Subnormal Inexact Rounded -basx586 toSci '1111e-99999999999' -> 0E-1000000007 Underflow Subnormal Inexact Rounded -basx587 toSci '7e1000000000' -> Infinity Overflow Inexact Rounded --- negatives the same -basx588 toSci '-99e999999999' -> -Infinity Overflow Inexact Rounded -basx589 toSci '-999e999999999' -> -Infinity Overflow Inexact Rounded -basx590 toSci '-0.9e-999999999' -> -9E-1000000000 Subnormal -basx591 toSci '-0.09e-999999999' -> -9E-1000000001 Subnormal -basx592 toSci '-0.1e1000000000' -> -1E+999999999 -basx593 toSci '-10e-1000000000' -> -1.0E-999999999 -basx594 toSci '-0.9e9999999999' -> -Infinity Overflow Inexact Rounded -basx595 toSci '-99e-9999999999' -> -0E-1000000007 Underflow Subnormal Inexact Rounded -basx596 toSci '-111e9999999999' -> -Infinity Overflow Inexact Rounded -basx597 toSci '-1111e-9999999999' -> -0E-1000000007 Underflow Subnormal Inexact Rounded -basx598 toSci '-1111e-99999999999' -> -0E-1000000007 Underflow Subnormal Inexact Rounded -basx599 toSci '-7e1000000000' -> -Infinity Overflow Inexact Rounded - --- Zeros -basx601 toSci 0.000000000 -> 0E-9 -basx602 toSci 0.00000000 -> 0E-8 -basx603 toSci 0.0000000 -> 0E-7 -basx604 toSci 0.000000 -> 0.000000 -basx605 toSci 0.00000 -> 0.00000 -basx606 toSci 0.0000 -> 0.0000 -basx607 toSci 0.000 -> 0.000 -basx608 toSci 0.00 -> 0.00 -basx609 toSci 0.0 -> 0.0 -basx610 toSci .0 -> 0.0 -basx611 toSci 0. -> 0 -basx612 toSci -.0 -> -0.0 -basx613 toSci -0. -> -0 -basx614 toSci -0.0 -> -0.0 -basx615 toSci -0.00 -> -0.00 -basx616 toSci -0.000 -> -0.000 -basx617 toSci -0.0000 -> -0.0000 -basx618 toSci -0.00000 -> -0.00000 -basx619 toSci -0.000000 -> -0.000000 -basx620 toSci -0.0000000 -> -0E-7 -basx621 toSci -0.00000000 -> -0E-8 -basx622 toSci -0.000000000 -> -0E-9 - -basx630 toSci 0.00E+0 -> 0.00 -basx631 toSci 0.00E+1 -> 0.0 -basx632 toSci 0.00E+2 -> 0 -basx633 toSci 0.00E+3 -> 0E+1 -basx634 toSci 0.00E+4 -> 0E+2 -basx635 toSci 0.00E+5 -> 0E+3 -basx636 toSci 0.00E+6 -> 0E+4 -basx637 toSci 0.00E+7 -> 0E+5 -basx638 toSci 0.00E+8 -> 0E+6 -basx639 toSci 0.00E+9 -> 0E+7 - -basx640 toSci 0.0E+0 -> 0.0 -basx641 toSci 0.0E+1 -> 0 -basx642 toSci 0.0E+2 -> 0E+1 -basx643 toSci 0.0E+3 -> 0E+2 -basx644 toSci 0.0E+4 -> 0E+3 -basx645 toSci 0.0E+5 -> 0E+4 -basx646 toSci 0.0E+6 -> 0E+5 -basx647 toSci 0.0E+7 -> 0E+6 -basx648 toSci 0.0E+8 -> 0E+7 -basx649 toSci 0.0E+9 -> 0E+8 - -basx650 toSci 0E+0 -> 0 -basx651 toSci 0E+1 -> 0E+1 -basx652 toSci 0E+2 -> 0E+2 -basx653 toSci 0E+3 -> 0E+3 -basx654 toSci 0E+4 -> 0E+4 -basx655 toSci 0E+5 -> 0E+5 -basx656 toSci 0E+6 -> 0E+6 -basx657 toSci 0E+7 -> 0E+7 -basx658 toSci 0E+8 -> 0E+8 -basx659 toSci 0E+9 -> 0E+9 - -basx660 toSci 0.0E-0 -> 0.0 -basx661 toSci 0.0E-1 -> 0.00 -basx662 toSci 0.0E-2 -> 0.000 -basx663 toSci 0.0E-3 -> 0.0000 -basx664 toSci 0.0E-4 -> 0.00000 -basx665 toSci 0.0E-5 -> 0.000000 -basx666 toSci 0.0E-6 -> 0E-7 -basx667 toSci 0.0E-7 -> 0E-8 -basx668 toSci 0.0E-8 -> 0E-9 -basx669 toSci 0.0E-9 -> 0E-10 - -basx670 toSci 0.00E-0 -> 0.00 -basx671 toSci 0.00E-1 -> 0.000 -basx672 toSci 0.00E-2 -> 0.0000 -basx673 toSci 0.00E-3 -> 0.00000 -basx674 toSci 0.00E-4 -> 0.000000 -basx675 toSci 0.00E-5 -> 0E-7 -basx676 toSci 0.00E-6 -> 0E-8 -basx677 toSci 0.00E-7 -> 0E-9 -basx678 toSci 0.00E-8 -> 0E-10 -basx679 toSci 0.00E-9 -> 0E-11 - --- Specials -precision: 4 -basx700 toSci "NaN" -> NaN -basx701 toSci "nan" -> NaN -basx702 toSci "nAn" -> NaN -basx703 toSci "NAN" -> NaN -basx704 toSci "+NaN" -> NaN -basx705 toSci "+nan" -> NaN -basx706 toSci "+nAn" -> NaN -basx707 toSci "+NAN" -> NaN -basx708 toSci "-NaN" -> -NaN -basx709 toSci "-nan" -> -NaN -basx710 toSci "-nAn" -> -NaN -basx711 toSci "-NAN" -> -NaN -basx712 toSci 'NaN0' -> NaN -basx713 toSci 'NaN1' -> NaN1 -basx714 toSci 'NaN12' -> NaN12 -basx715 toSci 'NaN123' -> NaN123 -basx716 toSci 'NaN1234' -> NaN1234 -basx717 toSci 'NaN01' -> NaN1 -basx718 toSci 'NaN012' -> NaN12 -basx719 toSci 'NaN0123' -> NaN123 -basx720 toSci 'NaN01234' -> NaN1234 -basx721 toSci 'NaN001' -> NaN1 -basx722 toSci 'NaN0012' -> NaN12 -basx723 toSci 'NaN00123' -> NaN123 -basx724 toSci 'NaN001234' -> NaN1234 -basx725 toSci 'NaN12345' -> NaN Conversion_syntax -basx726 toSci 'NaN123e+1' -> NaN Conversion_syntax -basx727 toSci 'NaN12.45' -> NaN Conversion_syntax -basx728 toSci 'NaN-12' -> NaN Conversion_syntax -basx729 toSci 'NaN+12' -> NaN Conversion_syntax - -basx730 toSci "sNaN" -> sNaN -basx731 toSci "snan" -> sNaN -basx732 toSci "SnAn" -> sNaN -basx733 toSci "SNAN" -> sNaN -basx734 toSci "+sNaN" -> sNaN -basx735 toSci "+snan" -> sNaN -basx736 toSci "+SnAn" -> sNaN -basx737 toSci "+SNAN" -> sNaN -basx738 toSci "-sNaN" -> -sNaN -basx739 toSci "-snan" -> -sNaN -basx740 toSci "-SnAn" -> -sNaN -basx741 toSci "-SNAN" -> -sNaN -basx742 toSci 'sNaN0000' -> sNaN -basx743 toSci 'sNaN7' -> sNaN7 -basx744 toSci 'sNaN007234' -> sNaN7234 -basx745 toSci 'sNaN72345' -> NaN Conversion_syntax -basx746 toSci 'sNaN72.45' -> NaN Conversion_syntax -basx747 toSci 'sNaN-72' -> NaN Conversion_syntax - -basx748 toSci "Inf" -> Infinity -basx749 toSci "inf" -> Infinity -basx750 toSci "iNf" -> Infinity -basx751 toSci "INF" -> Infinity -basx752 toSci "+Inf" -> Infinity -basx753 toSci "+inf" -> Infinity -basx754 toSci "+iNf" -> Infinity -basx755 toSci "+INF" -> Infinity -basx756 toSci "-Inf" -> -Infinity -basx757 toSci "-inf" -> -Infinity -basx758 toSci "-iNf" -> -Infinity -basx759 toSci "-INF" -> -Infinity - -basx760 toSci "Infinity" -> Infinity -basx761 toSci "infinity" -> Infinity -basx762 toSci "iNfInItY" -> Infinity -basx763 toSci "INFINITY" -> Infinity -basx764 toSci "+Infinity" -> Infinity -basx765 toSci "+infinity" -> Infinity -basx766 toSci "+iNfInItY" -> Infinity -basx767 toSci "+INFINITY" -> Infinity -basx768 toSci "-Infinity" -> -Infinity -basx769 toSci "-infinity" -> -Infinity -basx770 toSci "-iNfInItY" -> -Infinity -basx771 toSci "-INFINITY" -> -Infinity - --- Specials and zeros for toEng -basx772 toEng "NaN" -> NaN -basx773 toEng "-Infinity" -> -Infinity -basx774 toEng "-sNaN" -> -sNaN -basx775 toEng "-NaN" -> -NaN -basx776 toEng "+Infinity" -> Infinity -basx778 toEng "+sNaN" -> sNaN -basx779 toEng "+NaN" -> NaN -basx780 toEng "INFINITY" -> Infinity -basx781 toEng "SNAN" -> sNaN -basx782 toEng "NAN" -> NaN -basx783 toEng "infinity" -> Infinity -basx784 toEng "snan" -> sNaN -basx785 toEng "nan" -> NaN -basx786 toEng "InFINITY" -> Infinity -basx787 toEng "SnAN" -> sNaN -basx788 toEng "nAN" -> NaN -basx789 toEng "iNfinity" -> Infinity -basx790 toEng "sNan" -> sNaN -basx791 toEng "Nan" -> NaN -basx792 toEng "Infinity" -> Infinity -basx793 toEng "sNaN" -> sNaN - --- Zero toEng, etc. -basx800 toEng 0e+1 -> "0.00E+3" -- doc example - -basx801 toEng 0.000000000 -> 0E-9 -basx802 toEng 0.00000000 -> 0.00E-6 -basx803 toEng 0.0000000 -> 0.0E-6 -basx804 toEng 0.000000 -> 0.000000 -basx805 toEng 0.00000 -> 0.00000 -basx806 toEng 0.0000 -> 0.0000 -basx807 toEng 0.000 -> 0.000 -basx808 toEng 0.00 -> 0.00 -basx809 toEng 0.0 -> 0.0 -basx810 toEng .0 -> 0.0 -basx811 toEng 0. -> 0 -basx812 toEng -.0 -> -0.0 -basx813 toEng -0. -> -0 -basx814 toEng -0.0 -> -0.0 -basx815 toEng -0.00 -> -0.00 -basx816 toEng -0.000 -> -0.000 -basx817 toEng -0.0000 -> -0.0000 -basx818 toEng -0.00000 -> -0.00000 -basx819 toEng -0.000000 -> -0.000000 -basx820 toEng -0.0000000 -> -0.0E-6 -basx821 toEng -0.00000000 -> -0.00E-6 -basx822 toEng -0.000000000 -> -0E-9 - -basx830 toEng 0.00E+0 -> 0.00 -basx831 toEng 0.00E+1 -> 0.0 -basx832 toEng 0.00E+2 -> 0 -basx833 toEng 0.00E+3 -> 0.00E+3 -basx834 toEng 0.00E+4 -> 0.0E+3 -basx835 toEng 0.00E+5 -> 0E+3 -basx836 toEng 0.00E+6 -> 0.00E+6 -basx837 toEng 0.00E+7 -> 0.0E+6 -basx838 toEng 0.00E+8 -> 0E+6 -basx839 toEng 0.00E+9 -> 0.00E+9 - -basx840 toEng 0.0E+0 -> 0.0 -basx841 toEng 0.0E+1 -> 0 -basx842 toEng 0.0E+2 -> 0.00E+3 -basx843 toEng 0.0E+3 -> 0.0E+3 -basx844 toEng 0.0E+4 -> 0E+3 -basx845 toEng 0.0E+5 -> 0.00E+6 -basx846 toEng 0.0E+6 -> 0.0E+6 -basx847 toEng 0.0E+7 -> 0E+6 -basx848 toEng 0.0E+8 -> 0.00E+9 -basx849 toEng 0.0E+9 -> 0.0E+9 - -basx850 toEng 0E+0 -> 0 -basx851 toEng 0E+1 -> 0.00E+3 -basx852 toEng 0E+2 -> 0.0E+3 -basx853 toEng 0E+3 -> 0E+3 -basx854 toEng 0E+4 -> 0.00E+6 -basx855 toEng 0E+5 -> 0.0E+6 -basx856 toEng 0E+6 -> 0E+6 -basx857 toEng 0E+7 -> 0.00E+9 -basx858 toEng 0E+8 -> 0.0E+9 -basx859 toEng 0E+9 -> 0E+9 - -basx860 toEng 0.0E-0 -> 0.0 -basx861 toEng 0.0E-1 -> 0.00 -basx862 toEng 0.0E-2 -> 0.000 -basx863 toEng 0.0E-3 -> 0.0000 -basx864 toEng 0.0E-4 -> 0.00000 -basx865 toEng 0.0E-5 -> 0.000000 -basx866 toEng 0.0E-6 -> 0.0E-6 -basx867 toEng 0.0E-7 -> 0.00E-6 -basx868 toEng 0.0E-8 -> 0E-9 -basx869 toEng 0.0E-9 -> 0.0E-9 - -basx870 toEng 0.00E-0 -> 0.00 -basx871 toEng 0.00E-1 -> 0.000 -basx872 toEng 0.00E-2 -> 0.0000 -basx873 toEng 0.00E-3 -> 0.00000 -basx874 toEng 0.00E-4 -> 0.000000 -basx875 toEng 0.00E-5 -> 0.0E-6 -basx876 toEng 0.00E-6 -> 0.00E-6 -basx877 toEng 0.00E-7 -> 0E-9 -basx878 toEng 0.00E-8 -> 0.0E-9 -basx879 toEng 0.00E-9 -> 0.00E-9 - --- Giga exponent initial tests -maxExponent: 999999999 -minExponent: -999999999 - -basx951 toSci '99e999' -> '9.9E+1000' -basx952 toSci '999e999' -> '9.99E+1001' -basx953 toSci '0.9e-999' -> '9E-1000' -basx954 toSci '0.09e-999' -> '9E-1001' -basx955 toSci '0.1e1001' -> '1E+1000' -basx956 toSci '10e-1001' -> '1.0E-1000' -basx957 toSci '0.9e9999' -> '9E+9998' -basx958 toSci '99e-9999' -> '9.9E-9998' -basx959 toSci '111e9997' -> '1.11E+9999' -basx960 toSci '1111e-9999' -> '1.111E-9996' -basx961 toSci '99e9999' -> '9.9E+10000' -basx962 toSci '999e9999' -> '9.99E+10001' -basx963 toSci '0.9e-9999' -> '9E-10000' -basx964 toSci '0.09e-9999' -> '9E-10001' -basx965 toSci '0.1e10001' -> '1E+10000' -basx966 toSci '10e-10001' -> '1.0E-10000' -basx967 toSci '0.9e99999' -> '9E+99998' -basx968 toSci '99e-99999' -> '9.9E-99998' -basx969 toSci '111e99999' -> '1.11E+100001' -basx970 toSci '1111e-99999' -> '1.111E-99996' -basx971 toSci "0.09e999999999" -> '9E+999999997' -basx972 toSci "0.9e999999999" -> '9E+999999998' -basx973 toSci "9e999999999" -> '9E+999999999' -basx974 toSci "9.9e999999999" -> '9.9E+999999999' -basx975 toSci "9.99e999999999" -> '9.99E+999999999' -basx976 toSci "9.99e-999999999" -> '9.99E-999999999' -basx977 toSci "9.9e-999999999" -> '9.9E-999999999' -basx978 toSci "9e-999999999" -> '9E-999999999' -basx979 toSci "99e-999999999" -> '9.9E-999999998' -basx980 toSci "999e-999999999" -> '9.99E-999999997' - --- Varying exponent maximums -precision: 5 -maxexponent: 0 -minexponent: 0 -emax001 toSci -1E+2 -> -Infinity Overflow Inexact Rounded -emax002 toSci -100 -> -Infinity Overflow Inexact Rounded -emax003 toSci -10 -> -Infinity Overflow Inexact Rounded -emax004 toSci -9.9 -> -9.9 -emax005 toSci -9 -> -9 -emax006 toSci -1 -> -1 -emax007 toSci 0 -> 0 -emax008 toSci 1 -> 1 -emax009 toSci 9 -> 9 -emax010 toSci 9.9 -> 9.9 -emax011 toSci 10 -> Infinity Overflow Inexact Rounded -emax012 toSci 100 -> Infinity Overflow Inexact Rounded -emax013 toSci 1E+2 -> Infinity Overflow Inexact Rounded -emax014 toSci 0.99 -> 0.99 Subnormal -emax015 toSci 0.1 -> 0.1 Subnormal -emax016 toSci 0.01 -> 0.01 Subnormal -emax017 toSci 1E-1 -> 0.1 Subnormal -emax018 toSci 1E-2 -> 0.01 Subnormal - -maxexponent: 1 -minexponent: -1 -emax100 toSci -1E+3 -> -Infinity Overflow Inexact Rounded -emax101 toSci -1E+2 -> -Infinity Overflow Inexact Rounded -emax102 toSci -100 -> -Infinity Overflow Inexact Rounded -emax103 toSci -10 -> -10 -emax104 toSci -9.9 -> -9.9 -emax105 toSci -9 -> -9 -emax106 toSci -1 -> -1 -emax107 toSci 0 -> 0 -emax108 toSci 1 -> 1 -emax109 toSci 9 -> 9 -emax110 toSci 9.9 -> 9.9 -emax111 toSci 10 -> 10 -emax112 toSci 100 -> Infinity Overflow Inexact Rounded -emax113 toSci 1E+2 -> Infinity Overflow Inexact Rounded -emax114 toSci 1E+3 -> Infinity Overflow Inexact Rounded -emax115 toSci 0.99 -> 0.99 -emax116 toSci 0.1 -> 0.1 -emax117 toSci 0.01 -> 0.01 Subnormal -emax118 toSci 1E-1 -> 0.1 -emax119 toSci 1E-2 -> 0.01 Subnormal -emax120 toSci 1E-3 -> 0.001 Subnormal -emax121 toSci 1.1E-3 -> 0.0011 Subnormal -emax122 toSci 1.11E-3 -> 0.00111 Subnormal -emax123 toSci 1.111E-3 -> 0.00111 Subnormal Underflow Inexact Rounded -emax124 toSci 1.1111E-3 -> 0.00111 Subnormal Underflow Inexact Rounded -emax125 toSci 1.11111E-3 -> 0.00111 Subnormal Underflow Inexact Rounded - -maxexponent: 2 -minexponent: -2 -precision: 9 -emax200 toSci -1E+3 -> -Infinity Overflow Inexact Rounded -emax201 toSci -1E+2 -> -1E+2 -emax202 toSci -100 -> -100 -emax203 toSci -10 -> -10 -emax204 toSci -9.9 -> -9.9 -emax205 toSci -9 -> -9 -emax206 toSci -1 -> -1 -emax207 toSci 0 -> 0 -emax208 toSci 1 -> 1 -emax209 toSci 9 -> 9 -emax210 toSci 9.9 -> 9.9 -emax211 toSci 10 -> 10 -emax212 toSci 100 -> 100 -emax213 toSci 1E+2 -> 1E+2 -emax214 toSci 1E+3 -> Infinity Overflow Inexact Rounded -emax215 toSci 0.99 -> 0.99 -emax216 toSci 0.1 -> 0.1 -emax217 toSci 0.01 -> 0.01 -emax218 toSci 0.001 -> 0.001 Subnormal -emax219 toSci 1E-1 -> 0.1 -emax220 toSci 1E-2 -> 0.01 -emax221 toSci 1E-3 -> 0.001 Subnormal -emax222 toSci 1E-4 -> 0.0001 Subnormal -emax223 toSci 1E-5 -> 0.00001 Subnormal -emax224 toSci 1E-6 -> 0.000001 Subnormal -emax225 toSci 1E-7 -> 1E-7 Subnormal -emax226 toSci 1E-8 -> 1E-8 Subnormal -emax227 toSci 1E-9 -> 1E-9 Subnormal -emax228 toSci 1E-10 -> 1E-10 Subnormal -emax229 toSci 1E-11 -> 0E-10 Underflow Subnormal Inexact Rounded -emax230 toSci 1E-12 -> 0E-10 Underflow Subnormal Inexact Rounded - -maxexponent: 7 -minexponent: -7 -emax231 toSci 1E-8 -> 1E-8 Subnormal -emax232 toSci 1E-7 -> 1E-7 -emax233 toSci 1E-6 -> 0.000001 -emax234 toSci 1E-5 -> 0.00001 -emax235 toSci 1E+5 -> 1E+5 -emax236 toSci 1E+6 -> 1E+6 -emax237 toSci 1E+7 -> 1E+7 -emax238 toSci 1E+8 -> Infinity Overflow Inexact Rounded - -maxexponent: 9 -minexponent: -9 -emax240 toSci 1E-21 -> 0E-17 Subnormal Underflow Inexact Rounded -emax241 toSci 1E-10 -> 1E-10 Subnormal -emax242 toSci 1E-9 -> 1E-9 -emax243 toSci 1E-8 -> 1E-8 -emax244 toSci 1E-7 -> 1E-7 -emax245 toSci 1E+7 -> 1E+7 -emax246 toSci 1E+8 -> 1E+8 -emax247 toSci 1E+9 -> 1E+9 -emax248 toSci 1E+10 -> Infinity Overflow Inexact Rounded - -maxexponent: 10 -- boundary -minexponent: -10 -emax250 toSci 1E-21 -> 0E-18 Underflow Subnormal Inexact Rounded -emax251 toSci 1E-11 -> 1E-11 Subnormal -emax252 toSci 1E-10 -> 1E-10 -emax253 toSci 1E-9 -> 1E-9 -emax254 toSci 1E-8 -> 1E-8 -emax255 toSci 1E+8 -> 1E+8 -emax256 toSci 1E+9 -> 1E+9 -emax257 toSci 1E+10 -> 1E+10 -emax258 toSci 1E+11 -> Infinity Overflow Inexact Rounded - -emax260 toSci 1.00E-21 -> 0E-18 Underflow Subnormal Inexact Rounded -emax261 toSci 1.00E-11 -> 1.00E-11 Subnormal -emax262 toSci 1.00E-10 -> 1.00E-10 -emax263 toSci 1.00E-9 -> 1.00E-9 -emax264 toSci 1.00E-8 -> 1.00E-8 -emax265 toSci 1.00E+8 -> 1.00E+8 -emax266 toSci 1.00E+9 -> 1.00E+9 -emax267 toSci 1.00E+10 -> 1.00E+10 -emax268 toSci 1.00E+11 -> Infinity Overflow Inexact Rounded -emax270 toSci 9.99E-21 -> 0E-18 Underflow Subnormal Inexact Rounded -emax271 toSci 9.99E-11 -> 9.99E-11 Subnormal -emax272 toSci 9.99E-10 -> 9.99E-10 -emax273 toSci 9.99E-9 -> 9.99E-9 -emax274 toSci 9.99E-8 -> 9.99E-8 -emax275 toSci 9.99E+8 -> 9.99E+8 -emax276 toSci 9.99E+9 -> 9.99E+9 -emax277 toSci 9.99E+10 -> 9.99E+10 -emax278 toSci 9.99E+11 -> Infinity Overflow Inexact Rounded - -maxexponent: 99 -minexponent: -99 -emax280 toSci 1E-120 -> 0E-107 Underflow Subnormal Inexact Rounded -emax281 toSci 1E-100 -> 1E-100 Subnormal -emax282 toSci 1E-99 -> 1E-99 -emax283 toSci 1E-98 -> 1E-98 -emax284 toSci 1E+98 -> 1E+98 -emax285 toSci 1E+99 -> 1E+99 -emax286 toSci 1E+100 -> Infinity Overflow Inexact Rounded - -maxexponent: 999 -minexponent: -999 -emax291 toSci 1E-1000 -> 1E-1000 Subnormal -emax292 toSci 1E-999 -> 1E-999 -emax293 toSci 1E+999 -> 1E+999 -emax294 toSci 1E+1000 -> Infinity Overflow Inexact Rounded -maxexponent: 9999 -minexponent: -9999 -emax301 toSci 1E-10000 -> 1E-10000 Subnormal -emax302 toSci 1E-9999 -> 1E-9999 -emax303 toSci 1E+9999 -> 1E+9999 -emax304 toSci 1E+10000 -> Infinity Overflow Inexact Rounded -maxexponent: 99999 -minexponent: -99999 -emax311 toSci 1E-100000 -> 1E-100000 Subnormal -emax312 toSci 1E-99999 -> 1E-99999 -emax313 toSci 1E+99999 -> 1E+99999 -emax314 toSci 1E+100000 -> Infinity Overflow Inexact Rounded -maxexponent: 999999 -minexponent: -999999 -emax321 toSci 1E-1000000 -> 1E-1000000 Subnormal -emax322 toSci 1E-999999 -> 1E-999999 -emax323 toSci 1E+999999 -> 1E+999999 -emax324 toSci 1E+1000000 -> Infinity Overflow Inexact Rounded -maxexponent: 9999999 -minexponent: -9999999 -emax331 toSci 1E-10000000 -> 1E-10000000 Subnormal -emax332 toSci 1E-9999999 -> 1E-9999999 -emax333 toSci 1E+9999999 -> 1E+9999999 -emax334 toSci 1E+10000000 -> Infinity Overflow Inexact Rounded -maxexponent: 99999999 -minexponent: -99999999 -emax341 toSci 1E-100000000 -> 1E-100000000 Subnormal -emax342 toSci 1E-99999999 -> 1E-99999999 -emax343 toSci 1E+99999999 -> 1E+99999999 -emax344 toSci 1E+100000000 -> Infinity Overflow Inexact Rounded - -maxexponent: 999999999 -minexponent: -999999999 -emax347 toSci 1E-1000000008 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -emax348 toSci 1E-1000000007 -> 1E-1000000007 Subnormal -emax349 toSci 1E-1000000000 -> 1E-1000000000 Subnormal -emax350 toSci 1E-999999999 -> 1E-999999999 -emax351 toSci 1E+999999999 -> 1E+999999999 -emax352 toSci 1E+1000000000 -> Infinity Overflow Inexact Rounded -emax353 toSci 1.000E-1000000000 -> 1.000E-1000000000 Subnormal -emax354 toSci 1.000E-999999999 -> 1.000E-999999999 -emax355 toSci 1.000E+999999999 -> 1.000E+999999999 -emax356 toSci 1.000E+1000000000 -> Infinity Overflow Inexact Rounded -emax357 toSci 1.001E-1000000008 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -emax358 toSci 1.001E-1000000007 -> 1E-1000000007 Subnormal Inexact Rounded Underflow -emax359 toSci 1.001E-1000000000 -> 1.001E-1000000000 Subnormal -emax360 toSci 1.001E-999999999 -> 1.001E-999999999 -emax361 toSci 1.001E+999999999 -> 1.001E+999999999 -emax362 toSci 1.001E+1000000000 -> Infinity Overflow Inexact Rounded -emax363 toSci 9.000E-1000000000 -> 9.000E-1000000000 Subnormal -emax364 toSci 9.000E-999999999 -> 9.000E-999999999 -emax365 toSci 9.000E+999999999 -> 9.000E+999999999 -emax366 toSci 9.000E+1000000000 -> Infinity Overflow Inexact Rounded -emax367 toSci 9.999E-1000000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -emax368 toSci 9.999E-1000000008 -> 1E-1000000007 Underflow Subnormal Inexact Rounded -emax369 toSci 9.999E-1000000007 -> 1.0E-1000000006 Underflow Subnormal Inexact Rounded -emax370 toSci 9.999E-1000000000 -> 9.999E-1000000000 Subnormal -emax371 toSci 9.999E-999999999 -> 9.999E-999999999 -emax372 toSci 9.999E+999999999 -> 9.999E+999999999 - -emax373 toSci 9.999E+1000000000 -> Infinity Overflow Inexact Rounded -emax374 toSci -1E-1000000000 -> -1E-1000000000 Subnormal -emax375 toSci -1E-999999999 -> -1E-999999999 -emax376 toSci -1E+999999999 -> -1E+999999999 -emax377 toSci -1E+1000000000 -> -Infinity Overflow Inexact Rounded -emax378 toSci -1.000E-1000000000 -> -1.000E-1000000000 Subnormal -emax379 toSci -1.000E-999999999 -> -1.000E-999999999 -emax380 toSci -1.000E+999999999 -> -1.000E+999999999 -emax381 toSci -1.000E+1000000000 -> -Infinity Overflow Inexact Rounded -emax382 toSci -1.001E-1000000008 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -emax383 toSci -1.001E-999999999 -> -1.001E-999999999 -emax384 toSci -1.001E+999999999 -> -1.001E+999999999 -emax385 toSci -1.001E+1000000000 -> -Infinity Overflow Inexact Rounded -emax386 toSci -9.000E-1000000123 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -emax387 toSci -9.000E-999999999 -> -9.000E-999999999 -emax388 toSci -9.000E+999999999 -> -9.000E+999999999 -emax389 toSci -9.000E+1000000000 -> -Infinity Overflow Inexact Rounded -emax390 toSci -9.999E-1000000008 -> -1E-1000000007 Underflow Subnormal Inexact Rounded -emax391 toSci -9.999E-999999999 -> -9.999E-999999999 -emax392 toSci -9.999E+999999999 -> -9.999E+999999999 -emax393 toSci -9.999E+1000000000 -> -Infinity Overflow Inexact Rounded - --- Now check 854 rounding of subnormals and proper underflow to 0 -precision: 5 -maxExponent: 999 -minexponent: -999 -rounding: half_even - -emax400 toSci 1.0000E-999 -> 1.0000E-999 -emax401 toSci 0.1E-999 -> 1E-1000 Subnormal -emax402 toSci 0.1000E-999 -> 1.000E-1000 Subnormal -emax403 toSci 0.0100E-999 -> 1.00E-1001 Subnormal -emax404 toSci 0.0010E-999 -> 1.0E-1002 Subnormal -emax405 toSci 0.0001E-999 -> 1E-1003 Subnormal -emax406 toSci 0.00010E-999 -> 1E-1003 Subnormal Rounded -emax407 toSci 0.00013E-999 -> 1E-1003 Underflow Subnormal Inexact Rounded -emax408 toSci 0.00015E-999 -> 2E-1003 Underflow Subnormal Inexact Rounded -emax409 toSci 0.00017E-999 -> 2E-1003 Underflow Subnormal Inexact Rounded -emax410 toSci 0.00023E-999 -> 2E-1003 Underflow Subnormal Inexact Rounded -emax411 toSci 0.00025E-999 -> 2E-1003 Underflow Subnormal Inexact Rounded -emax412 toSci 0.00027E-999 -> 3E-1003 Underflow Subnormal Inexact Rounded -emax413 toSci 0.000149E-999 -> 1E-1003 Underflow Subnormal Inexact Rounded -emax414 toSci 0.000150E-999 -> 2E-1003 Underflow Subnormal Inexact Rounded -emax415 toSci 0.000151E-999 -> 2E-1003 Underflow Subnormal Inexact Rounded -emax416 toSci 0.000249E-999 -> 2E-1003 Underflow Subnormal Inexact Rounded -emax417 toSci 0.000250E-999 -> 2E-1003 Underflow Subnormal Inexact Rounded -emax418 toSci 0.000251E-999 -> 3E-1003 Underflow Subnormal Inexact Rounded -emax419 toSci 0.00009E-999 -> 1E-1003 Underflow Subnormal Inexact Rounded -emax420 toSci 0.00005E-999 -> 0E-1003 Underflow Subnormal Inexact Rounded -emax421 toSci 0.00003E-999 -> 0E-1003 Underflow Subnormal Inexact Rounded -emax422 toSci 0.000009E-999 -> 0E-1003 Underflow Subnormal Inexact Rounded -emax423 toSci 0.000005E-999 -> 0E-1003 Underflow Subnormal Inexact Rounded -emax424 toSci 0.000003E-999 -> 0E-1003 Underflow Subnormal Inexact Rounded - -emax425 toSci 0.001049E-999 -> 1.0E-1002 Underflow Subnormal Inexact Rounded -emax426 toSci 0.001050E-999 -> 1.0E-1002 Underflow Subnormal Inexact Rounded -emax427 toSci 0.001051E-999 -> 1.1E-1002 Underflow Subnormal Inexact Rounded -emax428 toSci 0.001149E-999 -> 1.1E-1002 Underflow Subnormal Inexact Rounded -emax429 toSci 0.001150E-999 -> 1.2E-1002 Underflow Subnormal Inexact Rounded -emax430 toSci 0.001151E-999 -> 1.2E-1002 Underflow Subnormal Inexact Rounded - -emax432 toSci 0.010049E-999 -> 1.00E-1001 Underflow Subnormal Inexact Rounded -emax433 toSci 0.010050E-999 -> 1.00E-1001 Underflow Subnormal Inexact Rounded -emax434 toSci 0.010051E-999 -> 1.01E-1001 Underflow Subnormal Inexact Rounded -emax435 toSci 0.010149E-999 -> 1.01E-1001 Underflow Subnormal Inexact Rounded -emax436 toSci 0.010150E-999 -> 1.02E-1001 Underflow Subnormal Inexact Rounded -emax437 toSci 0.010151E-999 -> 1.02E-1001 Underflow Subnormal Inexact Rounded - -emax440 toSci 0.10103E-999 -> 1.010E-1000 Underflow Subnormal Inexact Rounded -emax441 toSci 0.10105E-999 -> 1.010E-1000 Underflow Subnormal Inexact Rounded -emax442 toSci 0.10107E-999 -> 1.011E-1000 Underflow Subnormal Inexact Rounded -emax443 toSci 0.10113E-999 -> 1.011E-1000 Underflow Subnormal Inexact Rounded -emax444 toSci 0.10115E-999 -> 1.012E-1000 Underflow Subnormal Inexact Rounded -emax445 toSci 0.10117E-999 -> 1.012E-1000 Underflow Subnormal Inexact Rounded - -emax450 toSci 1.10730E-1000 -> 1.107E-1000 Underflow Subnormal Inexact Rounded -emax451 toSci 1.10750E-1000 -> 1.108E-1000 Underflow Subnormal Inexact Rounded -emax452 toSci 1.10770E-1000 -> 1.108E-1000 Underflow Subnormal Inexact Rounded -emax453 toSci 1.10830E-1000 -> 1.108E-1000 Underflow Subnormal Inexact Rounded -emax454 toSci 1.10850E-1000 -> 1.108E-1000 Underflow Subnormal Inexact Rounded -emax455 toSci 1.10870E-1000 -> 1.109E-1000 Underflow Subnormal Inexact Rounded - --- make sure sign OK -emax456 toSci -0.10103E-999 -> -1.010E-1000 Underflow Subnormal Inexact Rounded -emax457 toSci -0.10105E-999 -> -1.010E-1000 Underflow Subnormal Inexact Rounded -emax458 toSci -0.10107E-999 -> -1.011E-1000 Underflow Subnormal Inexact Rounded -emax459 toSci -0.10113E-999 -> -1.011E-1000 Underflow Subnormal Inexact Rounded -emax460 toSci -0.10115E-999 -> -1.012E-1000 Underflow Subnormal Inexact Rounded -emax461 toSci -0.10117E-999 -> -1.012E-1000 Underflow Subnormal Inexact Rounded - --- '999s' cases -emax464 toSci 999999E-999 -> 1.0000E-993 Inexact Rounded -emax465 toSci 99999.0E-999 -> 9.9999E-995 Rounded -emax466 toSci 99999.E-999 -> 9.9999E-995 -emax467 toSci 9999.9E-999 -> 9.9999E-996 -emax468 toSci 999.99E-999 -> 9.9999E-997 -emax469 toSci 99.999E-999 -> 9.9999E-998 -emax470 toSci 9.9999E-999 -> 9.9999E-999 -emax471 toSci 0.99999E-999 -> 1.0000E-999 Underflow Subnormal Inexact Rounded -emax472 toSci 0.099999E-999 -> 1.000E-1000 Underflow Subnormal Inexact Rounded -emax473 toSci 0.0099999E-999 -> 1.00E-1001 Underflow Subnormal Inexact Rounded -emax474 toSci 0.00099999E-999 -> 1.0E-1002 Underflow Subnormal Inexact Rounded -emax475 toSci 0.000099999E-999 -> 1E-1003 Underflow Subnormal Inexact Rounded -emax476 toSci 0.0000099999E-999 -> 0E-1003 Underflow Subnormal Inexact Rounded -emax477 toSci 0.00000099999E-999 -> 0E-1003 Underflow Subnormal Inexact Rounded -emax478 toSci 0.000000099999E-999 -> 0E-1003 Underflow Subnormal Inexact Rounded - --- Exponents with insignificant leading zeros -precision: 16 -maxExponent: 999999999 -minexponent: -999999999 -basx1001 toSci 1e999999999 -> 1E+999999999 -basx1002 toSci 1e0999999999 -> 1E+999999999 -basx1003 toSci 1e00999999999 -> 1E+999999999 -basx1004 toSci 1e000999999999 -> 1E+999999999 -basx1005 toSci 1e000000000000999999999 -> 1E+999999999 -basx1006 toSci 1e000000000001000000007 -> Infinity Overflow Inexact Rounded -basx1007 toSci 1e-999999999 -> 1E-999999999 -basx1008 toSci 1e-0999999999 -> 1E-999999999 -basx1009 toSci 1e-00999999999 -> 1E-999999999 -basx1010 toSci 1e-000999999999 -> 1E-999999999 -basx1011 toSci 1e-000000000000999999999 -> 1E-999999999 -basx1012 toSci 1e-000000000001000000007 -> 1E-1000000007 Subnormal - --- Edge cases for int32 exponents... -basx1021 tosci 1e+2147483649 -> Infinity Overflow Inexact Rounded -basx1022 tosci 1e+2147483648 -> Infinity Overflow Inexact Rounded -basx1023 tosci 1e+2147483647 -> Infinity Overflow Inexact Rounded -basx1024 tosci 1e-2147483647 -> 0E-1000000014 Underflow Subnormal Inexact Rounded -basx1025 tosci 1e-2147483648 -> 0E-1000000014 Underflow Subnormal Inexact Rounded -basx1026 tosci 1e-2147483649 -> 0E-1000000014 Underflow Subnormal Inexact Rounded --- same unbalanced -precision: 7 -maxExponent: 96 -minexponent: -95 -basx1031 tosci 1e+2147483649 -> Infinity Overflow Inexact Rounded -basx1032 tosci 1e+2147483648 -> Infinity Overflow Inexact Rounded -basx1033 tosci 1e+2147483647 -> Infinity Overflow Inexact Rounded -basx1034 tosci 1e-2147483647 -> 0E-101 Underflow Subnormal Inexact Rounded -basx1035 tosci 1e-2147483648 -> 0E-101 Underflow Subnormal Inexact Rounded -basx1036 tosci 1e-2147483649 -> 0E-101 Underflow Subnormal Inexact Rounded - --- check for double-rounded subnormals -precision: 5 -maxexponent: 79 -minexponent: -79 -basx1041 toSci 1.52444E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow -basx1042 toSci 1.52445E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow -basx1043 toSci 1.52446E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow - diff --git a/sys/lib/python/test/decimaltestdata/clamp.decTest b/sys/lib/python/test/decimaltestdata/clamp.decTest deleted file mode 100644 index 722971ad8..000000000 --- a/sys/lib/python/test/decimaltestdata/clamp.decTest +++ /dev/null @@ -1,197 +0,0 @@ ------------------------------------------------------------------------- --- clamp.decTest -- clamped exponent tests (format-independent) -- --- Copyright (c) IBM Corporation, 2000, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- This set of tests uses the same limits as the 8-byte concrete --- representation, but applies clamping without using format-specific --- conversions. - -extended: 1 -precision: 16 -rounding: half_even -maxExponent: 384 -minExponent: -383 -clamp: 1 - --- General testcases - --- Normality -clam010 apply 1234567890123456 -> 1234567890123456 -clam011 apply 1234567890123456.0 -> 1234567890123456 Rounded -clam012 apply 1234567890123456.1 -> 1234567890123456 Rounded Inexact -clam013 apply -1234567890123456 -> -1234567890123456 -clam014 apply -1234567890123456.0 -> -1234567890123456 Rounded -clam015 apply -1234567890123456.1 -> -1234567890123456 Rounded Inexact - - --- Nmax and similar -clam022 apply 9.999999999999999E+384 -> 9.999999999999999E+384 -clam024 apply 1.234567890123456E+384 -> 1.234567890123456E+384 --- fold-downs (more below) -clam030 apply 1.23E+384 -> 1.230000000000000E+384 Clamped -clam032 apply 1E+384 -> 1.000000000000000E+384 Clamped - -clam051 apply 12345 -> 12345 -clam053 apply 1234 -> 1234 -clam055 apply 123 -> 123 -clam057 apply 12 -> 12 -clam059 apply 1 -> 1 -clam061 apply 1.23 -> 1.23 -clam063 apply 123.45 -> 123.45 - --- Nmin and below -clam071 apply 1E-383 -> 1E-383 -clam073 apply 1.000000000000000E-383 -> 1.000000000000000E-383 -clam075 apply 1.000000000000001E-383 -> 1.000000000000001E-383 - -clam077 apply 0.100000000000000E-383 -> 1.00000000000000E-384 Subnormal -clam079 apply 0.000000000000010E-383 -> 1.0E-397 Subnormal -clam081 apply 0.00000000000001E-383 -> 1E-397 Subnormal -clam083 apply 0.000000000000001E-383 -> 1E-398 Subnormal - --- underflows -clam090 apply 1e-398 -> #0000000000000001 Subnormal -clam091 apply 1.9e-398 -> #0000000000000002 Subnormal Underflow Inexact Rounded -clam092 apply 1.1e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded -clam093 apply 1.00000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded -clam094 apply 1.00000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded -clam095 apply 1.000000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded -clam096 apply 0.1e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded -clam097 apply 0.00000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded -clam098 apply 0.00000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded -clam099 apply 0.000000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded - --- Same again, negatives --- Nmax and similar -clam122 apply -9.999999999999999E+384 -> -9.999999999999999E+384 -clam124 apply -1.234567890123456E+384 -> -1.234567890123456E+384 --- fold-downs (more below) -clam130 apply -1.23E+384 -> -1.230000000000000E+384 Clamped -clam132 apply -1E+384 -> -1.000000000000000E+384 Clamped - -clam151 apply -12345 -> -12345 -clam153 apply -1234 -> -1234 -clam155 apply -123 -> -123 -clam157 apply -12 -> -12 -clam159 apply -1 -> -1 -clam161 apply -1.23 -> -1.23 -clam163 apply -123.45 -> -123.45 - --- Nmin and below -clam171 apply -1E-383 -> -1E-383 -clam173 apply -1.000000000000000E-383 -> -1.000000000000000E-383 -clam175 apply -1.000000000000001E-383 -> -1.000000000000001E-383 - -clam177 apply -0.100000000000000E-383 -> -1.00000000000000E-384 Subnormal -clam179 apply -0.000000000000010E-383 -> -1.0E-397 Subnormal -clam181 apply -0.00000000000001E-383 -> -1E-397 Subnormal -clam183 apply -0.000000000000001E-383 -> -1E-398 Subnormal - --- underflows -clam189 apply -1e-398 -> #8000000000000001 Subnormal -clam190 apply -1.0e-398 -> #8000000000000001 Subnormal Rounded -clam191 apply -1.9e-398 -> #8000000000000002 Subnormal Underflow Inexact Rounded -clam192 apply -1.1e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded -clam193 apply -1.00000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded -clam194 apply -1.00000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded -clam195 apply -1.000000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded -clam196 apply -0.1e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded -clam197 apply -0.00000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded -clam198 apply -0.00000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded -clam199 apply -0.000000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded - --- zeros -clam401 apply 0E-500 -> 0E-398 Clamped -clam402 apply 0E-400 -> 0E-398 Clamped -clam403 apply 0E-398 -> 0E-398 -clam404 apply 0.000000000000000E-383 -> 0E-398 -clam405 apply 0E-2 -> 0.00 -clam406 apply 0 -> 0 -clam407 apply 0E+3 -> 0E+3 -clam408 apply 0E+369 -> 0E+369 --- clamped zeros... -clam410 apply 0E+370 -> 0E+369 Clamped -clam411 apply 0E+384 -> 0E+369 Clamped -clam412 apply 0E+400 -> 0E+369 Clamped -clam413 apply 0E+500 -> 0E+369 Clamped - --- negative zeros -clam420 apply -0E-500 -> -0E-398 Clamped -clam421 apply -0E-400 -> -0E-398 Clamped -clam422 apply -0E-398 -> -0E-398 -clam423 apply -0.000000000000000E-383 -> -0E-398 -clam424 apply -0E-2 -> -0.00 -clam425 apply -0 -> -0 -clam426 apply -0E+3 -> -0E+3 -clam427 apply -0E+369 -> -0E+369 --- clamped zeros... -clam431 apply -0E+370 -> -0E+369 Clamped -clam432 apply -0E+384 -> -0E+369 Clamped -clam433 apply -0E+400 -> -0E+369 Clamped -clam434 apply -0E+500 -> -0E+369 Clamped - --- fold-down full sequence -clam601 apply 1E+384 -> 1.000000000000000E+384 Clamped -clam603 apply 1E+383 -> 1.00000000000000E+383 Clamped -clam605 apply 1E+382 -> 1.0000000000000E+382 Clamped -clam607 apply 1E+381 -> 1.000000000000E+381 Clamped -clam609 apply 1E+380 -> 1.00000000000E+380 Clamped -clam611 apply 1E+379 -> 1.0000000000E+379 Clamped -clam613 apply 1E+378 -> 1.000000000E+378 Clamped -clam615 apply 1E+377 -> 1.00000000E+377 Clamped -clam617 apply 1E+376 -> 1.0000000E+376 Clamped -clam619 apply 1E+375 -> 1.000000E+375 Clamped -clam621 apply 1E+374 -> 1.00000E+374 Clamped -clam623 apply 1E+373 -> 1.0000E+373 Clamped -clam625 apply 1E+372 -> 1.000E+372 Clamped -clam627 apply 1E+371 -> 1.00E+371 Clamped -clam629 apply 1E+370 -> 1.0E+370 Clamped -clam631 apply 1E+369 -> 1E+369 -clam633 apply 1E+368 -> 1E+368 --- same with 9s -clam641 apply 9E+384 -> 9.000000000000000E+384 Clamped -clam643 apply 9E+383 -> 9.00000000000000E+383 Clamped -clam645 apply 9E+382 -> 9.0000000000000E+382 Clamped -clam647 apply 9E+381 -> 9.000000000000E+381 Clamped -clam649 apply 9E+380 -> 9.00000000000E+380 Clamped -clam651 apply 9E+379 -> 9.0000000000E+379 Clamped -clam653 apply 9E+378 -> 9.000000000E+378 Clamped -clam655 apply 9E+377 -> 9.00000000E+377 Clamped -clam657 apply 9E+376 -> 9.0000000E+376 Clamped -clam659 apply 9E+375 -> 9.000000E+375 Clamped -clam661 apply 9E+374 -> 9.00000E+374 Clamped -clam663 apply 9E+373 -> 9.0000E+373 Clamped -clam665 apply 9E+372 -> 9.000E+372 Clamped -clam667 apply 9E+371 -> 9.00E+371 Clamped -clam669 apply 9E+370 -> 9.0E+370 Clamped -clam671 apply 9E+369 -> 9E+369 -clam673 apply 9E+368 -> 9E+368 - --- example from documentation -precision: 7 -rounding: half_even -maxExponent: +96 -minExponent: -95 - -clamp: 0 -clam700 apply 1.23E+96 -> 1.23E+96 - -clamp: 1 -clam701 apply 1.23E+96 -> 1.230000E+96 Clamped diff --git a/sys/lib/python/test/decimaltestdata/compare.decTest b/sys/lib/python/test/decimaltestdata/compare.decTest deleted file mode 100644 index 21651ad0a..000000000 --- a/sys/lib/python/test/decimaltestdata/compare.decTest +++ /dev/null @@ -1,717 +0,0 @@ ------------------------------------------------------------------------- --- compare.decTest -- decimal comparison -- --- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- Note that we cannot assume add/subtract tests cover paths adequately, --- here, because the code might be quite different (comparison cannot --- overflow or underflow, so actual subtractions are not necesary). - -extended: 1 - -precision: 9 -rounding: half_up -maxExponent: 999 -minexponent: -999 - --- sanity checks -comx001 compare -2 -2 -> 0 -comx002 compare -2 -1 -> -1 -comx003 compare -2 0 -> -1 -comx004 compare -2 1 -> -1 -comx005 compare -2 2 -> -1 -comx006 compare -1 -2 -> 1 -comx007 compare -1 -1 -> 0 -comx008 compare -1 0 -> -1 -comx009 compare -1 1 -> -1 -comx010 compare -1 2 -> -1 -comx011 compare 0 -2 -> 1 -comx012 compare 0 -1 -> 1 -comx013 compare 0 0 -> 0 -comx014 compare 0 1 -> -1 -comx015 compare 0 2 -> -1 -comx016 compare 1 -2 -> 1 -comx017 compare 1 -1 -> 1 -comx018 compare 1 0 -> 1 -comx019 compare 1 1 -> 0 -comx020 compare 1 2 -> -1 -comx021 compare 2 -2 -> 1 -comx022 compare 2 -1 -> 1 -comx023 compare 2 0 -> 1 -comx025 compare 2 1 -> 1 -comx026 compare 2 2 -> 0 - -comx031 compare -20 -20 -> 0 -comx032 compare -20 -10 -> -1 -comx033 compare -20 00 -> -1 -comx034 compare -20 10 -> -1 -comx035 compare -20 20 -> -1 -comx036 compare -10 -20 -> 1 -comx037 compare -10 -10 -> 0 -comx038 compare -10 00 -> -1 -comx039 compare -10 10 -> -1 -comx040 compare -10 20 -> -1 -comx041 compare 00 -20 -> 1 -comx042 compare 00 -10 -> 1 -comx043 compare 00 00 -> 0 -comx044 compare 00 10 -> -1 -comx045 compare 00 20 -> -1 -comx046 compare 10 -20 -> 1 -comx047 compare 10 -10 -> 1 -comx048 compare 10 00 -> 1 -comx049 compare 10 10 -> 0 -comx050 compare 10 20 -> -1 -comx051 compare 20 -20 -> 1 -comx052 compare 20 -10 -> 1 -comx053 compare 20 00 -> 1 -comx055 compare 20 10 -> 1 -comx056 compare 20 20 -> 0 - -comx061 compare -2.0 -2.0 -> 0 -comx062 compare -2.0 -1.0 -> -1 -comx063 compare -2.0 0.0 -> -1 -comx064 compare -2.0 1.0 -> -1 -comx065 compare -2.0 2.0 -> -1 -comx066 compare -1.0 -2.0 -> 1 -comx067 compare -1.0 -1.0 -> 0 -comx068 compare -1.0 0.0 -> -1 -comx069 compare -1.0 1.0 -> -1 -comx070 compare -1.0 2.0 -> -1 -comx071 compare 0.0 -2.0 -> 1 -comx072 compare 0.0 -1.0 -> 1 -comx073 compare 0.0 0.0 -> 0 -comx074 compare 0.0 1.0 -> -1 -comx075 compare 0.0 2.0 -> -1 -comx076 compare 1.0 -2.0 -> 1 -comx077 compare 1.0 -1.0 -> 1 -comx078 compare 1.0 0.0 -> 1 -comx079 compare 1.0 1.0 -> 0 -comx080 compare 1.0 2.0 -> -1 -comx081 compare 2.0 -2.0 -> 1 -comx082 compare 2.0 -1.0 -> 1 -comx083 compare 2.0 0.0 -> 1 -comx085 compare 2.0 1.0 -> 1 -comx086 compare 2.0 2.0 -> 0 - --- now some cases which might overflow if subtract were used -maxexponent: 999999999 -minexponent: -999999999 -comx090 compare 9.99999999E+999999999 9.99999999E+999999999 -> 0 -comx091 compare -9.99999999E+999999999 9.99999999E+999999999 -> -1 -comx092 compare 9.99999999E+999999999 -9.99999999E+999999999 -> 1 -comx093 compare -9.99999999E+999999999 -9.99999999E+999999999 -> 0 - --- some differing length/exponent cases -comx100 compare 7.0 7.0 -> 0 -comx101 compare 7.0 7 -> 0 -comx102 compare 7 7.0 -> 0 -comx103 compare 7E+0 7.0 -> 0 -comx104 compare 70E-1 7.0 -> 0 -comx105 compare 0.7E+1 7 -> 0 -comx106 compare 70E-1 7 -> 0 -comx107 compare 7.0 7E+0 -> 0 -comx108 compare 7.0 70E-1 -> 0 -comx109 compare 7 0.7E+1 -> 0 -comx110 compare 7 70E-1 -> 0 - -comx120 compare 8.0 7.0 -> 1 -comx121 compare 8.0 7 -> 1 -comx122 compare 8 7.0 -> 1 -comx123 compare 8E+0 7.0 -> 1 -comx124 compare 80E-1 7.0 -> 1 -comx125 compare 0.8E+1 7 -> 1 -comx126 compare 80E-1 7 -> 1 -comx127 compare 8.0 7E+0 -> 1 -comx128 compare 8.0 70E-1 -> 1 -comx129 compare 8 0.7E+1 -> 1 -comx130 compare 8 70E-1 -> 1 - -comx140 compare 8.0 9.0 -> -1 -comx141 compare 8.0 9 -> -1 -comx142 compare 8 9.0 -> -1 -comx143 compare 8E+0 9.0 -> -1 -comx144 compare 80E-1 9.0 -> -1 -comx145 compare 0.8E+1 9 -> -1 -comx146 compare 80E-1 9 -> -1 -comx147 compare 8.0 9E+0 -> -1 -comx148 compare 8.0 90E-1 -> -1 -comx149 compare 8 0.9E+1 -> -1 -comx150 compare 8 90E-1 -> -1 - --- and again, with sign changes -+ .. -comx200 compare -7.0 7.0 -> -1 -comx201 compare -7.0 7 -> -1 -comx202 compare -7 7.0 -> -1 -comx203 compare -7E+0 7.0 -> -1 -comx204 compare -70E-1 7.0 -> -1 -comx205 compare -0.7E+1 7 -> -1 -comx206 compare -70E-1 7 -> -1 -comx207 compare -7.0 7E+0 -> -1 -comx208 compare -7.0 70E-1 -> -1 -comx209 compare -7 0.7E+1 -> -1 -comx210 compare -7 70E-1 -> -1 - -comx220 compare -8.0 7.0 -> -1 -comx221 compare -8.0 7 -> -1 -comx222 compare -8 7.0 -> -1 -comx223 compare -8E+0 7.0 -> -1 -comx224 compare -80E-1 7.0 -> -1 -comx225 compare -0.8E+1 7 -> -1 -comx226 compare -80E-1 7 -> -1 -comx227 compare -8.0 7E+0 -> -1 -comx228 compare -8.0 70E-1 -> -1 -comx229 compare -8 0.7E+1 -> -1 -comx230 compare -8 70E-1 -> -1 - -comx240 compare -8.0 9.0 -> -1 -comx241 compare -8.0 9 -> -1 -comx242 compare -8 9.0 -> -1 -comx243 compare -8E+0 9.0 -> -1 -comx244 compare -80E-1 9.0 -> -1 -comx245 compare -0.8E+1 9 -> -1 -comx246 compare -80E-1 9 -> -1 -comx247 compare -8.0 9E+0 -> -1 -comx248 compare -8.0 90E-1 -> -1 -comx249 compare -8 0.9E+1 -> -1 -comx250 compare -8 90E-1 -> -1 - --- and again, with sign changes +- .. -comx300 compare 7.0 -7.0 -> 1 -comx301 compare 7.0 -7 -> 1 -comx302 compare 7 -7.0 -> 1 -comx303 compare 7E+0 -7.0 -> 1 -comx304 compare 70E-1 -7.0 -> 1 -comx305 compare .7E+1 -7 -> 1 -comx306 compare 70E-1 -7 -> 1 -comx307 compare 7.0 -7E+0 -> 1 -comx308 compare 7.0 -70E-1 -> 1 -comx309 compare 7 -.7E+1 -> 1 -comx310 compare 7 -70E-1 -> 1 - -comx320 compare 8.0 -7.0 -> 1 -comx321 compare 8.0 -7 -> 1 -comx322 compare 8 -7.0 -> 1 -comx323 compare 8E+0 -7.0 -> 1 -comx324 compare 80E-1 -7.0 -> 1 -comx325 compare .8E+1 -7 -> 1 -comx326 compare 80E-1 -7 -> 1 -comx327 compare 8.0 -7E+0 -> 1 -comx328 compare 8.0 -70E-1 -> 1 -comx329 compare 8 -.7E+1 -> 1 -comx330 compare 8 -70E-1 -> 1 - -comx340 compare 8.0 -9.0 -> 1 -comx341 compare 8.0 -9 -> 1 -comx342 compare 8 -9.0 -> 1 -comx343 compare 8E+0 -9.0 -> 1 -comx344 compare 80E-1 -9.0 -> 1 -comx345 compare .8E+1 -9 -> 1 -comx346 compare 80E-1 -9 -> 1 -comx347 compare 8.0 -9E+0 -> 1 -comx348 compare 8.0 -90E-1 -> 1 -comx349 compare 8 -.9E+1 -> 1 -comx350 compare 8 -90E-1 -> 1 - --- and again, with sign changes -- .. -comx400 compare -7.0 -7.0 -> 0 -comx401 compare -7.0 -7 -> 0 -comx402 compare -7 -7.0 -> 0 -comx403 compare -7E+0 -7.0 -> 0 -comx404 compare -70E-1 -7.0 -> 0 -comx405 compare -.7E+1 -7 -> 0 -comx406 compare -70E-1 -7 -> 0 -comx407 compare -7.0 -7E+0 -> 0 -comx408 compare -7.0 -70E-1 -> 0 -comx409 compare -7 -.7E+1 -> 0 -comx410 compare -7 -70E-1 -> 0 - -comx420 compare -8.0 -7.0 -> -1 -comx421 compare -8.0 -7 -> -1 -comx422 compare -8 -7.0 -> -1 -comx423 compare -8E+0 -7.0 -> -1 -comx424 compare -80E-1 -7.0 -> -1 -comx425 compare -.8E+1 -7 -> -1 -comx426 compare -80E-1 -7 -> -1 -comx427 compare -8.0 -7E+0 -> -1 -comx428 compare -8.0 -70E-1 -> -1 -comx429 compare -8 -.7E+1 -> -1 -comx430 compare -8 -70E-1 -> -1 - -comx440 compare -8.0 -9.0 -> 1 -comx441 compare -8.0 -9 -> 1 -comx442 compare -8 -9.0 -> 1 -comx443 compare -8E+0 -9.0 -> 1 -comx444 compare -80E-1 -9.0 -> 1 -comx445 compare -.8E+1 -9 -> 1 -comx446 compare -80E-1 -9 -> 1 -comx447 compare -8.0 -9E+0 -> 1 -comx448 compare -8.0 -90E-1 -> 1 -comx449 compare -8 -.9E+1 -> 1 -comx450 compare -8 -90E-1 -> 1 - - --- testcases that subtract to lots of zeros at boundaries [pgr] -precision: 40 -comx470 compare 123.4560000000000000E789 123.456E789 -> 0 -comx471 compare 123.456000000000000E-89 123.456E-89 -> 0 -comx472 compare 123.45600000000000E789 123.456E789 -> 0 -comx473 compare 123.4560000000000E-89 123.456E-89 -> 0 -comx474 compare 123.456000000000E789 123.456E789 -> 0 -comx475 compare 123.45600000000E-89 123.456E-89 -> 0 -comx476 compare 123.4560000000E789 123.456E789 -> 0 -comx477 compare 123.456000000E-89 123.456E-89 -> 0 -comx478 compare 123.45600000E789 123.456E789 -> 0 -comx479 compare 123.4560000E-89 123.456E-89 -> 0 -comx480 compare 123.456000E789 123.456E789 -> 0 -comx481 compare 123.45600E-89 123.456E-89 -> 0 -comx482 compare 123.4560E789 123.456E789 -> 0 -comx483 compare 123.456E-89 123.456E-89 -> 0 -comx484 compare 123.456E-89 123.4560000000000000E-89 -> 0 -comx485 compare 123.456E789 123.456000000000000E789 -> 0 -comx486 compare 123.456E-89 123.45600000000000E-89 -> 0 -comx487 compare 123.456E789 123.4560000000000E789 -> 0 -comx488 compare 123.456E-89 123.456000000000E-89 -> 0 -comx489 compare 123.456E789 123.45600000000E789 -> 0 -comx490 compare 123.456E-89 123.4560000000E-89 -> 0 -comx491 compare 123.456E789 123.456000000E789 -> 0 -comx492 compare 123.456E-89 123.45600000E-89 -> 0 -comx493 compare 123.456E789 123.4560000E789 -> 0 -comx494 compare 123.456E-89 123.456000E-89 -> 0 -comx495 compare 123.456E789 123.45600E789 -> 0 -comx496 compare 123.456E-89 123.4560E-89 -> 0 -comx497 compare 123.456E789 123.456E789 -> 0 - --- wide-ranging, around precision; signs equal -precision: 9 -comx500 compare 1 1E-15 -> 1 -comx501 compare 1 1E-14 -> 1 -comx502 compare 1 1E-13 -> 1 -comx503 compare 1 1E-12 -> 1 -comx504 compare 1 1E-11 -> 1 -comx505 compare 1 1E-10 -> 1 -comx506 compare 1 1E-9 -> 1 -comx507 compare 1 1E-8 -> 1 -comx508 compare 1 1E-7 -> 1 -comx509 compare 1 1E-6 -> 1 -comx510 compare 1 1E-5 -> 1 -comx511 compare 1 1E-4 -> 1 -comx512 compare 1 1E-3 -> 1 -comx513 compare 1 1E-2 -> 1 -comx514 compare 1 1E-1 -> 1 -comx515 compare 1 1E-0 -> 0 -comx516 compare 1 1E+1 -> -1 -comx517 compare 1 1E+2 -> -1 -comx518 compare 1 1E+3 -> -1 -comx519 compare 1 1E+4 -> -1 -comx521 compare 1 1E+5 -> -1 -comx522 compare 1 1E+6 -> -1 -comx523 compare 1 1E+7 -> -1 -comx524 compare 1 1E+8 -> -1 -comx525 compare 1 1E+9 -> -1 -comx526 compare 1 1E+10 -> -1 -comx527 compare 1 1E+11 -> -1 -comx528 compare 1 1E+12 -> -1 -comx529 compare 1 1E+13 -> -1 -comx530 compare 1 1E+14 -> -1 -comx531 compare 1 1E+15 -> -1 --- LR swap -comx540 compare 1E-15 1 -> -1 -comx541 compare 1E-14 1 -> -1 -comx542 compare 1E-13 1 -> -1 -comx543 compare 1E-12 1 -> -1 -comx544 compare 1E-11 1 -> -1 -comx545 compare 1E-10 1 -> -1 -comx546 compare 1E-9 1 -> -1 -comx547 compare 1E-8 1 -> -1 -comx548 compare 1E-7 1 -> -1 -comx549 compare 1E-6 1 -> -1 -comx550 compare 1E-5 1 -> -1 -comx551 compare 1E-4 1 -> -1 -comx552 compare 1E-3 1 -> -1 -comx553 compare 1E-2 1 -> -1 -comx554 compare 1E-1 1 -> -1 -comx555 compare 1E-0 1 -> 0 -comx556 compare 1E+1 1 -> 1 -comx557 compare 1E+2 1 -> 1 -comx558 compare 1E+3 1 -> 1 -comx559 compare 1E+4 1 -> 1 -comx561 compare 1E+5 1 -> 1 -comx562 compare 1E+6 1 -> 1 -comx563 compare 1E+7 1 -> 1 -comx564 compare 1E+8 1 -> 1 -comx565 compare 1E+9 1 -> 1 -comx566 compare 1E+10 1 -> 1 -comx567 compare 1E+11 1 -> 1 -comx568 compare 1E+12 1 -> 1 -comx569 compare 1E+13 1 -> 1 -comx570 compare 1E+14 1 -> 1 -comx571 compare 1E+15 1 -> 1 --- similar with an useful coefficient, one side only -comx580 compare 0.000000987654321 1E-15 -> 1 -comx581 compare 0.000000987654321 1E-14 -> 1 -comx582 compare 0.000000987654321 1E-13 -> 1 -comx583 compare 0.000000987654321 1E-12 -> 1 -comx584 compare 0.000000987654321 1E-11 -> 1 -comx585 compare 0.000000987654321 1E-10 -> 1 -comx586 compare 0.000000987654321 1E-9 -> 1 -comx587 compare 0.000000987654321 1E-8 -> 1 -comx588 compare 0.000000987654321 1E-7 -> 1 -comx589 compare 0.000000987654321 1E-6 -> -1 -comx590 compare 0.000000987654321 1E-5 -> -1 -comx591 compare 0.000000987654321 1E-4 -> -1 -comx592 compare 0.000000987654321 1E-3 -> -1 -comx593 compare 0.000000987654321 1E-2 -> -1 -comx594 compare 0.000000987654321 1E-1 -> -1 -comx595 compare 0.000000987654321 1E-0 -> -1 -comx596 compare 0.000000987654321 1E+1 -> -1 -comx597 compare 0.000000987654321 1E+2 -> -1 -comx598 compare 0.000000987654321 1E+3 -> -1 -comx599 compare 0.000000987654321 1E+4 -> -1 - --- check some unit-y traps -precision: 20 -comx600 compare 12 12.2345 -> -1 -comx601 compare 12.0 12.2345 -> -1 -comx602 compare 12.00 12.2345 -> -1 -comx603 compare 12.000 12.2345 -> -1 -comx604 compare 12.0000 12.2345 -> -1 -comx605 compare 12.00000 12.2345 -> -1 -comx606 compare 12.000000 12.2345 -> -1 -comx607 compare 12.0000000 12.2345 -> -1 -comx608 compare 12.00000000 12.2345 -> -1 -comx609 compare 12.000000000 12.2345 -> -1 -comx610 compare 12.1234 12 -> 1 -comx611 compare 12.1234 12.0 -> 1 -comx612 compare 12.1234 12.00 -> 1 -comx613 compare 12.1234 12.000 -> 1 -comx614 compare 12.1234 12.0000 -> 1 -comx615 compare 12.1234 12.00000 -> 1 -comx616 compare 12.1234 12.000000 -> 1 -comx617 compare 12.1234 12.0000000 -> 1 -comx618 compare 12.1234 12.00000000 -> 1 -comx619 compare 12.1234 12.000000000 -> 1 -comx620 compare -12 -12.2345 -> 1 -comx621 compare -12.0 -12.2345 -> 1 -comx622 compare -12.00 -12.2345 -> 1 -comx623 compare -12.000 -12.2345 -> 1 -comx624 compare -12.0000 -12.2345 -> 1 -comx625 compare -12.00000 -12.2345 -> 1 -comx626 compare -12.000000 -12.2345 -> 1 -comx627 compare -12.0000000 -12.2345 -> 1 -comx628 compare -12.00000000 -12.2345 -> 1 -comx629 compare -12.000000000 -12.2345 -> 1 -comx630 compare -12.1234 -12 -> -1 -comx631 compare -12.1234 -12.0 -> -1 -comx632 compare -12.1234 -12.00 -> -1 -comx633 compare -12.1234 -12.000 -> -1 -comx634 compare -12.1234 -12.0000 -> -1 -comx635 compare -12.1234 -12.00000 -> -1 -comx636 compare -12.1234 -12.000000 -> -1 -comx637 compare -12.1234 -12.0000000 -> -1 -comx638 compare -12.1234 -12.00000000 -> -1 -comx639 compare -12.1234 -12.000000000 -> -1 -precision: 9 - --- extended zeros -comx640 compare 0 0 -> 0 -comx641 compare 0 -0 -> 0 -comx642 compare 0 -0.0 -> 0 -comx643 compare 0 0.0 -> 0 -comx644 compare -0 0 -> 0 -comx645 compare -0 -0 -> 0 -comx646 compare -0 -0.0 -> 0 -comx647 compare -0 0.0 -> 0 -comx648 compare 0.0 0 -> 0 -comx649 compare 0.0 -0 -> 0 -comx650 compare 0.0 -0.0 -> 0 -comx651 compare 0.0 0.0 -> 0 -comx652 compare -0.0 0 -> 0 -comx653 compare -0.0 -0 -> 0 -comx654 compare -0.0 -0.0 -> 0 -comx655 compare -0.0 0.0 -> 0 - -comx656 compare -0E1 0.0 -> 0 -comx657 compare -0E2 0.0 -> 0 -comx658 compare 0E1 0.0 -> 0 -comx659 compare 0E2 0.0 -> 0 -comx660 compare -0E1 0 -> 0 -comx661 compare -0E2 0 -> 0 -comx662 compare 0E1 0 -> 0 -comx663 compare 0E2 0 -> 0 -comx664 compare -0E1 -0E1 -> 0 -comx665 compare -0E2 -0E1 -> 0 -comx666 compare 0E1 -0E1 -> 0 -comx667 compare 0E2 -0E1 -> 0 -comx668 compare -0E1 -0E2 -> 0 -comx669 compare -0E2 -0E2 -> 0 -comx670 compare 0E1 -0E2 -> 0 -comx671 compare 0E2 -0E2 -> 0 -comx672 compare -0E1 0E1 -> 0 -comx673 compare -0E2 0E1 -> 0 -comx674 compare 0E1 0E1 -> 0 -comx675 compare 0E2 0E1 -> 0 -comx676 compare -0E1 0E2 -> 0 -comx677 compare -0E2 0E2 -> 0 -comx678 compare 0E1 0E2 -> 0 -comx679 compare 0E2 0E2 -> 0 - --- trailing zeros; unit-y -precision: 20 -comx680 compare 12 12 -> 0 -comx681 compare 12 12.0 -> 0 -comx682 compare 12 12.00 -> 0 -comx683 compare 12 12.000 -> 0 -comx684 compare 12 12.0000 -> 0 -comx685 compare 12 12.00000 -> 0 -comx686 compare 12 12.000000 -> 0 -comx687 compare 12 12.0000000 -> 0 -comx688 compare 12 12.00000000 -> 0 -comx689 compare 12 12.000000000 -> 0 -comx690 compare 12 12 -> 0 -comx691 compare 12.0 12 -> 0 -comx692 compare 12.00 12 -> 0 -comx693 compare 12.000 12 -> 0 -comx694 compare 12.0000 12 -> 0 -comx695 compare 12.00000 12 -> 0 -comx696 compare 12.000000 12 -> 0 -comx697 compare 12.0000000 12 -> 0 -comx698 compare 12.00000000 12 -> 0 -comx699 compare 12.000000000 12 -> 0 - --- long operand checks -maxexponent: 999 -minexponent: -999 -precision: 9 -comx701 compare 12345678000 1 -> 1 -comx702 compare 1 12345678000 -> -1 -comx703 compare 1234567800 1 -> 1 -comx704 compare 1 1234567800 -> -1 -comx705 compare 1234567890 1 -> 1 -comx706 compare 1 1234567890 -> -1 -comx707 compare 1234567891 1 -> 1 -comx708 compare 1 1234567891 -> -1 -comx709 compare 12345678901 1 -> 1 -comx710 compare 1 12345678901 -> -1 -comx711 compare 1234567896 1 -> 1 -comx712 compare 1 1234567896 -> -1 -comx713 compare -1234567891 1 -> -1 -comx714 compare 1 -1234567891 -> 1 -comx715 compare -12345678901 1 -> -1 -comx716 compare 1 -12345678901 -> 1 -comx717 compare -1234567896 1 -> -1 -comx718 compare 1 -1234567896 -> 1 - -precision: 15 --- same with plenty of precision -comx721 compare 12345678000 1 -> 1 -comx722 compare 1 12345678000 -> -1 -comx723 compare 1234567800 1 -> 1 -comx724 compare 1 1234567800 -> -1 -comx725 compare 1234567890 1 -> 1 -comx726 compare 1 1234567890 -> -1 -comx727 compare 1234567891 1 -> 1 -comx728 compare 1 1234567891 -> -1 -comx729 compare 12345678901 1 -> 1 -comx730 compare 1 12345678901 -> -1 -comx731 compare 1234567896 1 -> 1 -comx732 compare 1 1234567896 -> -1 - --- residue cases -precision: 5 -comx740 compare 1 0.9999999 -> 1 -comx741 compare 1 0.999999 -> 1 -comx742 compare 1 0.99999 -> 1 -comx743 compare 1 1.0000 -> 0 -comx744 compare 1 1.00001 -> -1 -comx745 compare 1 1.000001 -> -1 -comx746 compare 1 1.0000001 -> -1 -comx750 compare 0.9999999 1 -> -1 -comx751 compare 0.999999 1 -> -1 -comx752 compare 0.99999 1 -> -1 -comx753 compare 1.0000 1 -> 0 -comx754 compare 1.00001 1 -> 1 -comx755 compare 1.000001 1 -> 1 -comx756 compare 1.0000001 1 -> 1 - --- a selection of longies -comx760 compare -36852134.84194296250843579428931 -5830629.8347085025808756560357940 -> -1 -comx761 compare -36852134.84194296250843579428931 -36852134.84194296250843579428931 -> 0 -comx762 compare -36852134.94194296250843579428931 -36852134.84194296250843579428931 -> -1 -comx763 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 --- precisions above or below the difference should have no effect -precision: 11 -comx764 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 10 -comx765 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 9 -comx766 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 8 -comx767 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 7 -comx768 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 6 -comx769 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 5 -comx770 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 4 -comx771 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 3 -comx772 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 2 -comx773 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -precision: 1 -comx774 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 - --- Specials -precision: 9 -comx780 compare Inf -Inf -> 1 -comx781 compare Inf -1000 -> 1 -comx782 compare Inf -1 -> 1 -comx783 compare Inf -0 -> 1 -comx784 compare Inf 0 -> 1 -comx785 compare Inf 1 -> 1 -comx786 compare Inf 1000 -> 1 -comx787 compare Inf Inf -> 0 -comx788 compare -1000 Inf -> -1 -comx789 compare -Inf Inf -> -1 -comx790 compare -1 Inf -> -1 -comx791 compare -0 Inf -> -1 -comx792 compare 0 Inf -> -1 -comx793 compare 1 Inf -> -1 -comx794 compare 1000 Inf -> -1 -comx795 compare Inf Inf -> 0 - -comx800 compare -Inf -Inf -> 0 -comx801 compare -Inf -1000 -> -1 -comx802 compare -Inf -1 -> -1 -comx803 compare -Inf -0 -> -1 -comx804 compare -Inf 0 -> -1 -comx805 compare -Inf 1 -> -1 -comx806 compare -Inf 1000 -> -1 -comx807 compare -Inf Inf -> -1 -comx808 compare -Inf -Inf -> 0 -comx809 compare -1000 -Inf -> 1 -comx810 compare -1 -Inf -> 1 -comx811 compare -0 -Inf -> 1 -comx812 compare 0 -Inf -> 1 -comx813 compare 1 -Inf -> 1 -comx814 compare 1000 -Inf -> 1 -comx815 compare Inf -Inf -> 1 - -comx821 compare NaN -Inf -> NaN -comx822 compare NaN -1000 -> NaN -comx823 compare NaN -1 -> NaN -comx824 compare NaN -0 -> NaN -comx825 compare NaN 0 -> NaN -comx826 compare NaN 1 -> NaN -comx827 compare NaN 1000 -> NaN -comx828 compare NaN Inf -> NaN -comx829 compare NaN NaN -> NaN -comx830 compare -Inf NaN -> NaN -comx831 compare -1000 NaN -> NaN -comx832 compare -1 NaN -> NaN -comx833 compare -0 NaN -> NaN -comx834 compare 0 NaN -> NaN -comx835 compare 1 NaN -> NaN -comx836 compare 1000 NaN -> NaN -comx837 compare Inf NaN -> NaN -comx838 compare -NaN -NaN -> -NaN -comx839 compare +NaN -NaN -> NaN -comx840 compare -NaN +NaN -> -NaN - -comx841 compare sNaN -Inf -> NaN Invalid_operation -comx842 compare sNaN -1000 -> NaN Invalid_operation -comx843 compare sNaN -1 -> NaN Invalid_operation -comx844 compare sNaN -0 -> NaN Invalid_operation -comx845 compare sNaN 0 -> NaN Invalid_operation -comx846 compare sNaN 1 -> NaN Invalid_operation -comx847 compare sNaN 1000 -> NaN Invalid_operation -comx848 compare sNaN NaN -> NaN Invalid_operation -comx849 compare sNaN sNaN -> NaN Invalid_operation -comx850 compare NaN sNaN -> NaN Invalid_operation -comx851 compare -Inf sNaN -> NaN Invalid_operation -comx852 compare -1000 sNaN -> NaN Invalid_operation -comx853 compare -1 sNaN -> NaN Invalid_operation -comx854 compare -0 sNaN -> NaN Invalid_operation -comx855 compare 0 sNaN -> NaN Invalid_operation -comx856 compare 1 sNaN -> NaN Invalid_operation -comx857 compare 1000 sNaN -> NaN Invalid_operation -comx858 compare Inf sNaN -> NaN Invalid_operation -comx859 compare NaN sNaN -> NaN Invalid_operation - --- propagating NaNs -comx860 compare NaN9 -Inf -> NaN9 -comx861 compare NaN8 999 -> NaN8 -comx862 compare NaN77 Inf -> NaN77 -comx863 compare -NaN67 NaN5 -> -NaN67 -comx864 compare -Inf -NaN4 -> -NaN4 -comx865 compare -999 -NaN33 -> -NaN33 -comx866 compare Inf NaN2 -> NaN2 -comx867 compare -NaN41 -NaN42 -> -NaN41 -comx868 compare +NaN41 -NaN42 -> NaN41 -comx869 compare -NaN41 +NaN42 -> -NaN41 -comx870 compare +NaN41 +NaN42 -> NaN41 - -comx871 compare -sNaN99 -Inf -> -NaN99 Invalid_operation -comx872 compare sNaN98 -11 -> NaN98 Invalid_operation -comx873 compare sNaN97 NaN -> NaN97 Invalid_operation -comx874 compare sNaN16 sNaN94 -> NaN16 Invalid_operation -comx875 compare NaN85 sNaN83 -> NaN83 Invalid_operation -comx876 compare -Inf sNaN92 -> NaN92 Invalid_operation -comx877 compare 088 sNaN81 -> NaN81 Invalid_operation -comx878 compare Inf sNaN90 -> NaN90 Invalid_operation -comx879 compare NaN -sNaN89 -> -NaN89 Invalid_operation - --- overflow and underflow tests .. subnormal results now allowed -maxExponent: 999999999 -minexponent: -999999999 -comx880 compare +1.23456789012345E-0 9E+999999999 -> -1 -comx881 compare 9E+999999999 +1.23456789012345E-0 -> 1 -comx882 compare +0.100 9E-999999999 -> 1 -comx883 compare 9E-999999999 +0.100 -> -1 -comx885 compare -1.23456789012345E-0 9E+999999999 -> -1 -comx886 compare 9E+999999999 -1.23456789012345E-0 -> 1 -comx887 compare -0.100 9E-999999999 -> -1 -comx888 compare 9E-999999999 -0.100 -> 1 - -comx889 compare 1e-599999999 1e-400000001 -> -1 -comx890 compare 1e-599999999 1e-400000000 -> -1 -comx891 compare 1e-600000000 1e-400000000 -> -1 -comx892 compare 9e-999999998 0.01 -> -1 -comx893 compare 9e-999999998 0.1 -> -1 -comx894 compare 0.01 9e-999999998 -> 1 -comx895 compare 1e599999999 1e400000001 -> 1 -comx896 compare 1e599999999 1e400000000 -> 1 -comx897 compare 1e600000000 1e400000000 -> 1 -comx898 compare 9e999999998 100 -> 1 -comx899 compare 9e999999998 10 -> 1 -comx900 compare 100 9e999999998 -> -1 --- signs -comx901 compare 1e+777777777 1e+411111111 -> 1 -comx902 compare 1e+777777777 -1e+411111111 -> 1 -comx903 compare -1e+777777777 1e+411111111 -> -1 -comx904 compare -1e+777777777 -1e+411111111 -> -1 -comx905 compare 1e-777777777 1e-411111111 -> -1 -comx906 compare 1e-777777777 -1e-411111111 -> 1 -comx907 compare -1e-777777777 1e-411111111 -> -1 -comx908 compare -1e-777777777 -1e-411111111 -> 1 - --- Null tests -comx990 compare 10 # -> NaN Invalid_operation -comx991 compare # 10 -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/decimal128.decTest b/sys/lib/python/test/decimaltestdata/decimal128.decTest deleted file mode 100644 index 3cc9d0631..000000000 --- a/sys/lib/python/test/decimaltestdata/decimal128.decTest +++ /dev/null @@ -1,441 +0,0 @@ ------------------------------------------------------------------------- --- decimal128.decTest -- decimal sixteen-byte format testcases -- --- Copyright (c) IBM Corporation, 2000, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- This set of tests is for the sixteen-byte concrete representation. --- Its characteristics are: --- --- 1 bit sign --- 5 bits combination field --- 12 bits exponent continuation --- 110 bits coefficient continuation --- --- Total exponent length 14 bits --- Total coefficient length 114 bits (34 digits) --- --- Elimit = 12287 (maximum encoded exponent) --- Emax = 6144 (largest exponent value) --- Emin = -6143 (smallest exponent value) --- bias = 6176 (subtracted from encoded exponent) = -Etiny - -extended: 1 -precision: 34 -rounding: half_up -maxExponent: 6144 -minExponent: -6143 - --- General testcases --- (mostly derived from the Strawman 4 document and examples) -decg001 apply #A20780000000000000000000000003D0 -> -7.50 -decg002 apply -7.50 -> #A20780000000000000000000000003D0 - --- Normality -decf010 apply 1234567890123456789012345678901234 -> #2608134b9c1e28e56f3c127177823534 -decf011 apply 1234567890123456789012345678901234.0 -> #2608134b9c1e28e56f3c127177823534 Rounded -decf012 apply 1234567890123456789012345678901234.1 -> #2608134b9c1e28e56f3c127177823534 Rounded Inexact -decf013 apply -1234567890123456789012345678901234 -> #a608134b9c1e28e56f3c127177823534 -decf014 apply -1234567890123456789012345678901234.0 -> #a608134b9c1e28e56f3c127177823534 Rounded -decf015 apply -1234567890123456789012345678901234.1 -> #a608134b9c1e28e56f3c127177823534 Rounded Inexact - - --- Nmax and similar -decf022 apply 9.999999999999999999999999999999999E+6144 -> #77ffcff3fcff3fcff3fcff3fcff3fcff -decf023 apply #77ffcff3fcff3fcff3fcff3fcff3fcff -> 9.999999999999999999999999999999999E+6144 -decf024 apply 1.234567890123456789012345678901234E+6144 -> #47ffd34b9c1e28e56f3c127177823534 -decf025 apply #47ffd34b9c1e28e56f3c127177823534 -> 1.234567890123456789012345678901234E+6144 --- fold-downs (more below) -decf030 apply 1.23E+6144 -> #47ffd300000000000000000000000000 Clamped -decf031 apply #47ffd300000000000000000000000000 -> 1.230000000000000000000000000000000E+6144 -decf032 apply 1E+6144 -> #47ffc000000000000000000000000000 Clamped -decf033 apply #47ffc000000000000000000000000000 -> 1.000000000000000000000000000000000E+6144 - --- overflows -maxExponent: 9999 -- set high so conversion causes the overflow -minExponent: -9999 -decf040 apply 10E+6144 -> #78000000000000000000000000000000 Overflow Rounded Inexact -decf041 apply 1.000000000000000E+6145 -> #78000000000000000000000000000000 Overflow Rounded Inexact -maxExponent: 6144 -minExponent: -6143 - -decf051 apply 12345 -> #220800000000000000000000000049c5 -decf052 apply #220800000000000000000000000049c5 -> 12345 -decf053 apply 1234 -> #22080000000000000000000000000534 -decf054 apply #22080000000000000000000000000534 -> 1234 -decf055 apply 123 -> #220800000000000000000000000000a3 -decf056 apply #220800000000000000000000000000a3 -> 123 -decf057 apply 12 -> #22080000000000000000000000000012 -decf058 apply #22080000000000000000000000000012 -> 12 -decf059 apply 1 -> #22080000000000000000000000000001 -decf060 apply #22080000000000000000000000000001 -> 1 -decf061 apply 1.23 -> #220780000000000000000000000000a3 -decf062 apply #220780000000000000000000000000a3 -> 1.23 -decf063 apply 123.45 -> #220780000000000000000000000049c5 -decf064 apply #220780000000000000000000000049c5 -> 123.45 - --- Nmin and below -decf071 apply 1E-6143 -> #00084000000000000000000000000001 -decf072 apply #00084000000000000000000000000001 -> 1E-6143 -decf073 apply 1.000000000000000000000000000000000E-6143 -> #04000000000000000000000000000000 -decf074 apply #04000000000000000000000000000000 -> 1.000000000000000000000000000000000E-6143 -decf075 apply 1.000000000000000000000000000000001E-6143 -> #04000000000000000000000000000001 -decf076 apply #04000000000000000000000000000001 -> 1.000000000000000000000000000000001E-6143 - -decf077 apply 0.100000000000000000000000000000000E-6143 -> #00000800000000000000000000000000 Subnormal -decf078 apply #00000800000000000000000000000000 -> 1.00000000000000000000000000000000E-6144 Subnormal -decf079 apply 0.000000000000000000000000000000010E-6143 -> #00000000000000000000000000000010 Subnormal -decf080 apply #00000000000000000000000000000010 -> 1.0E-6175 Subnormal -decf081 apply 0.00000000000000000000000000000001E-6143 -> #00004000000000000000000000000001 Subnormal -decf082 apply #00004000000000000000000000000001 -> 1E-6175 Subnormal -decf083 apply 0.000000000000000000000000000000001E-6143 -> #00000000000000000000000000000001 Subnormal -decf084 apply #00000000000000000000000000000001 -> 1E-6176 Subnormal - --- underflows -decf090 apply 1e-6176 -> #00000000000000000000000000000001 Subnormal -decf091 apply 1.9e-6176 -> #00000000000000000000000000000002 Subnormal Underflow Inexact Rounded -decf092 apply 1.1e-6176 -> #00000000000000000000000000000001 Subnormal Underflow Inexact Rounded -decf093 apply 1.00000000001e-6176 -> #00000000000000000000000000000001 Subnormal Underflow Inexact Rounded -decf094 apply 1.00000000000001e-6176 -> #00000000000000000000000000000001 Subnormal Underflow Inexact Rounded -decf095 apply 1.000000000000001e-6176 -> #00000000000000000000000000000001 Subnormal Underflow Inexact Rounded -decf096 apply 0.1e-6176 -> #00000000000000000000000000000000 Subnormal Underflow Inexact Rounded -decf097 apply 0.00000000001e-6176 -> #00000000000000000000000000000000 Subnormal Underflow Inexact Rounded -decf098 apply 0.00000000000001e-6176 -> #00000000000000000000000000000000 Subnormal Underflow Inexact Rounded -decf099 apply 0.000000000000001e-6176 -> #00000000000000000000000000000000 Subnormal Underflow Inexact Rounded -decf100 apply 999999999999999999999999999999999e-6176 -> #00000ff3fcff3fcff3fcff3fcff3fcff Subnormal - --- same again, negatives --- Nmax and similar -decf122 apply -9.999999999999999999999999999999999E+6144 -> #f7ffcff3fcff3fcff3fcff3fcff3fcff -decf123 apply #f7ffcff3fcff3fcff3fcff3fcff3fcff -> -9.999999999999999999999999999999999E+6144 -decf124 apply -1.234567890123456789012345678901234E+6144 -> #c7ffd34b9c1e28e56f3c127177823534 -decf125 apply #c7ffd34b9c1e28e56f3c127177823534 -> -1.234567890123456789012345678901234E+6144 --- fold-downs (more below) -decf130 apply -1.23E+6144 -> #c7ffd300000000000000000000000000 Clamped -decf131 apply #c7ffd300000000000000000000000000 -> -1.230000000000000000000000000000000E+6144 -decf132 apply -1E+6144 -> #c7ffc000000000000000000000000000 Clamped -decf133 apply #c7ffc000000000000000000000000000 -> -1.000000000000000000000000000000000E+6144 - --- overflows -maxExponent: 9999 -- set high so conversion causes the overflow -minExponent: -9999 -decf140 apply -10E+6144 -> #f8000000000000000000000000000000 Overflow Rounded Inexact -decf141 apply -1.000000000000000E+6145 -> #f8000000000000000000000000000000 Overflow Rounded Inexact -maxExponent: 6144 -minExponent: -6143 - -decf151 apply -12345 -> #a20800000000000000000000000049c5 -decf152 apply #a20800000000000000000000000049c5 -> -12345 -decf153 apply -1234 -> #a2080000000000000000000000000534 -decf154 apply #a2080000000000000000000000000534 -> -1234 -decf155 apply -123 -> #a20800000000000000000000000000a3 -decf156 apply #a20800000000000000000000000000a3 -> -123 -decf157 apply -12 -> #a2080000000000000000000000000012 -decf158 apply #a2080000000000000000000000000012 -> -12 -decf159 apply -1 -> #a2080000000000000000000000000001 -decf160 apply #a2080000000000000000000000000001 -> -1 -decf161 apply -1.23 -> #a20780000000000000000000000000a3 -decf162 apply #a20780000000000000000000000000a3 -> -1.23 -decf163 apply -123.45 -> #a20780000000000000000000000049c5 -decf164 apply #a20780000000000000000000000049c5 -> -123.45 - --- Nmin and below -decf171 apply -1E-6143 -> #80084000000000000000000000000001 -decf172 apply #80084000000000000000000000000001 -> -1E-6143 -decf173 apply -1.000000000000000000000000000000000E-6143 -> #84000000000000000000000000000000 -decf174 apply #84000000000000000000000000000000 -> -1.000000000000000000000000000000000E-6143 -decf175 apply -1.000000000000000000000000000000001E-6143 -> #84000000000000000000000000000001 -decf176 apply #84000000000000000000000000000001 -> -1.000000000000000000000000000000001E-6143 - -decf177 apply -0.100000000000000000000000000000000E-6143 -> #80000800000000000000000000000000 Subnormal -decf178 apply #80000800000000000000000000000000 -> -1.00000000000000000000000000000000E-6144 Subnormal -decf179 apply -0.000000000000000000000000000000010E-6143 -> #80000000000000000000000000000010 Subnormal -decf180 apply #80000000000000000000000000000010 -> -1.0E-6175 Subnormal -decf181 apply -0.00000000000000000000000000000001E-6143 -> #80004000000000000000000000000001 Subnormal -decf182 apply #80004000000000000000000000000001 -> -1E-6175 Subnormal -decf183 apply -0.000000000000000000000000000000001E-6143 -> #80000000000000000000000000000001 Subnormal -decf184 apply #80000000000000000000000000000001 -> -1E-6176 Subnormal - --- underflows -decf190 apply -1e-6176 -> #80000000000000000000000000000001 Subnormal -decf191 apply -1.9e-6176 -> #80000000000000000000000000000002 Subnormal Underflow Inexact Rounded -decf192 apply -1.1e-6176 -> #80000000000000000000000000000001 Subnormal Underflow Inexact Rounded -decf193 apply -1.00000000001e-6176 -> #80000000000000000000000000000001 Subnormal Underflow Inexact Rounded -decf194 apply -1.00000000000001e-6176 -> #80000000000000000000000000000001 Subnormal Underflow Inexact Rounded -decf195 apply -1.000000000000001e-6176 -> #80000000000000000000000000000001 Subnormal Underflow Inexact Rounded -decf196 apply -0.1e-6176 -> #80000000000000000000000000000000 Subnormal Underflow Inexact Rounded -decf197 apply -0.00000000001e-6176 -> #80000000000000000000000000000000 Subnormal Underflow Inexact Rounded -decf198 apply -0.00000000000001e-6176 -> #80000000000000000000000000000000 Subnormal Underflow Inexact Rounded -decf199 apply -0.000000000000001e-6176 -> #80000000000000000000000000000000 Subnormal Underflow Inexact Rounded -decf200 apply -999999999999999999999999999999999e-6176 -> #80000ff3fcff3fcff3fcff3fcff3fcff Subnormal - --- zeros -decf400 apply 0E-8000 -> #00000000000000000000000000000000 Clamped -decf401 apply 0E-6177 -> #00000000000000000000000000000000 Clamped -decf402 apply 0E-6176 -> #00000000000000000000000000000000 -decf403 apply #00000000000000000000000000000000 -> 0E-6176 -decf404 apply 0.000000000000000000000000000000000E-6143 -> #00000000000000000000000000000000 -decf405 apply #00000000000000000000000000000000 -> 0E-6176 -decf406 apply 0E-2 -> #22078000000000000000000000000000 -decf407 apply #22078000000000000000000000000000 -> 0.00 -decf408 apply 0 -> #22080000000000000000000000000000 -decf409 apply #22080000000000000000000000000000 -> 0 -decf410 apply 0E+3 -> #2208c000000000000000000000000000 -decf411 apply #2208c000000000000000000000000000 -> 0E+3 -decf412 apply 0E+6111 -> #43ffc000000000000000000000000000 -decf413 apply #43ffc000000000000000000000000000 -> 0E+6111 --- clamped zeros... -decf414 apply 0E+6112 -> #43ffc000000000000000000000000000 Clamped -decf415 apply #43ffc000000000000000000000000000 -> 0E+6111 -decf416 apply 0E+6144 -> #43ffc000000000000000000000000000 Clamped -decf417 apply #43ffc000000000000000000000000000 -> 0E+6111 -decf418 apply 0E+8000 -> #43ffc000000000000000000000000000 Clamped -decf419 apply #43ffc000000000000000000000000000 -> 0E+6111 - --- negative zeros -decf420 apply -0E-8000 -> #80000000000000000000000000000000 Clamped -decf421 apply -0E-6177 -> #80000000000000000000000000000000 Clamped -decf422 apply -0E-6176 -> #80000000000000000000000000000000 -decf423 apply #80000000000000000000000000000000 -> -0E-6176 -decf424 apply -0.000000000000000000000000000000000E-6143 -> #80000000000000000000000000000000 -decf425 apply #80000000000000000000000000000000 -> -0E-6176 -decf426 apply -0E-2 -> #a2078000000000000000000000000000 -decf427 apply #a2078000000000000000000000000000 -> -0.00 -decf428 apply -0 -> #a2080000000000000000000000000000 -decf429 apply #a2080000000000000000000000000000 -> -0 -decf430 apply -0E+3 -> #a208c000000000000000000000000000 -decf431 apply #a208c000000000000000000000000000 -> -0E+3 -decf432 apply -0E+6111 -> #c3ffc000000000000000000000000000 -decf433 apply #c3ffc000000000000000000000000000 -> -0E+6111 --- clamped zeros... -decf434 apply -0E+6112 -> #c3ffc000000000000000000000000000 Clamped -decf435 apply #c3ffc000000000000000000000000000 -> -0E+6111 -decf436 apply -0E+6144 -> #c3ffc000000000000000000000000000 Clamped -decf437 apply #c3ffc000000000000000000000000000 -> -0E+6111 -decf438 apply -0E+8000 -> #c3ffc000000000000000000000000000 Clamped -decf439 apply #c3ffc000000000000000000000000000 -> -0E+6111 - --- Specials -decf500 apply Infinity -> #78000000000000000000000000000000 -decf501 apply #78787878787878787878787878787878 -> #78000000000000000000000000000000 -decf502 apply #78000000000000000000000000000000 -> Infinity -decf503 apply #79797979797979797979797979797979 -> #78000000000000000000000000000000 -decf504 apply #79000000000000000000000000000000 -> Infinity -decf505 apply #7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a -> #78000000000000000000000000000000 -decf506 apply #7a000000000000000000000000000000 -> Infinity -decf507 apply #7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b -> #78000000000000000000000000000000 -decf508 apply #7b000000000000000000000000000000 -> Infinity - -decf509 apply NaN -> #7c000000000000000000000000000000 -decf510 apply #7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c -> #7c003c7c7c7c7c7c7c7c7c7c7c7c7c7c -decf511 apply #7c000000000000000000000000000000 -> NaN -decf512 apply #7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d -> #7c003d7d7d7d7d7d7d7d7d7d7d7d7d7d -decf513 apply #7d000000000000000000000000000000 -> NaN -decf514 apply #7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e -> #7e003e7e7c7e7e7e7e7c7e7e7e7e7c7e -decf515 apply #7e000000000000000000000000000000 -> sNaN -decf516 apply #7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f -> #7e003f7f7c7f7f7f7f7c7f7f7f7f7c7f -decf517 apply #7f000000000000000000000000000000 -> sNaN -decf518 apply #7fffffffffffffffffffffffffffffff -> sNaN999999999999999999999999999999999 -decf519 apply #7fffffffffffffffffffffffffffffff -> #7e000ff3fcff3fcff3fcff3fcff3fcff - -decf520 apply -Infinity -> #f8000000000000000000000000000000 -decf521 apply #f8787878787878787878787878787878 -> #f8000000000000000000000000000000 -decf522 apply #f8000000000000000000000000000000 -> -Infinity -decf523 apply #f9797979797979797979797979797979 -> #f8000000000000000000000000000000 -decf524 apply #f9000000000000000000000000000000 -> -Infinity -decf525 apply #fa7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a -> #f8000000000000000000000000000000 -decf526 apply #fa000000000000000000000000000000 -> -Infinity -decf527 apply #fb7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b -> #f8000000000000000000000000000000 -decf528 apply #fb000000000000000000000000000000 -> -Infinity - -decf529 apply -NaN -> #fc000000000000000000000000000000 -decf530 apply #fc7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c -> #fc003c7c7c7c7c7c7c7c7c7c7c7c7c7c -decf531 apply #fc000000000000000000000000000000 -> -NaN -decf532 apply #fd7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d -> #fc003d7d7d7d7d7d7d7d7d7d7d7d7d7d -decf533 apply #fd000000000000000000000000000000 -> -NaN -decf534 apply #fe7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e -> #fe003e7e7c7e7e7e7e7c7e7e7e7e7c7e -decf535 apply #fe000000000000000000000000000000 -> -sNaN -decf536 apply #ff7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f -> #fe003f7f7c7f7f7f7f7c7f7f7f7f7c7f -decf537 apply #ff000000000000000000000000000000 -> -sNaN -decf538 apply #ffffffffffffffffffffffffffffffff -> -sNaN999999999999999999999999999999999 -decf539 apply #ffffffffffffffffffffffffffffffff -> #fe000ff3fcff3fcff3fcff3fcff3fcff - -decf540 apply NaN -> #7c000000000000000000000000000000 -decf541 apply NaN0 -> #7c000000000000000000000000000000 -decf542 apply NaN1 -> #7c000000000000000000000000000001 -decf543 apply NaN12 -> #7c000000000000000000000000000012 -decf544 apply NaN79 -> #7c000000000000000000000000000079 -decf545 apply NaN12345 -> #7c0000000000000000000000000049c5 -decf546 apply NaN123456 -> #7c000000000000000000000000028e56 -decf547 apply NaN799799 -> #7c0000000000000000000000000f7fdf -decf548 apply NaN799799799799799799799799799799799 -> #7c003dff7fdff7fdff7fdff7fdff7fdf -decf549 apply NaN999999999999999999999999999999999 -> #7c000ff3fcff3fcff3fcff3fcff3fcff -decf550 apply NaN1234567890123456789012345678901234 -> #7c000000000000000000000000000000 -- too many digits - --- fold-down full sequence -decf600 apply 1E+6145 -> #78000000000000000000000000000000 Overflow Inexact Rounded -decf601 apply 1E+6144 -> #47ffc000000000000000000000000000 Clamped -decf602 apply #47ffc000000000000000000000000000 -> 1.000000000000000000000000000000000E+6144 -decf603 apply 1E+6143 -> #43ffc800000000000000000000000000 Clamped -decf604 apply #43ffc800000000000000000000000000 -> 1.00000000000000000000000000000000E+6143 -decf605 apply 1E+6142 -> #43ffc100000000000000000000000000 Clamped -decf606 apply #43ffc100000000000000000000000000 -> 1.0000000000000000000000000000000E+6142 -decf607 apply 1E+6141 -> #43ffc010000000000000000000000000 Clamped -decf608 apply #43ffc010000000000000000000000000 -> 1.000000000000000000000000000000E+6141 -decf609 apply 1E+6140 -> #43ffc002000000000000000000000000 Clamped -decf610 apply #43ffc002000000000000000000000000 -> 1.00000000000000000000000000000E+6140 -decf611 apply 1E+6139 -> #43ffc000400000000000000000000000 Clamped -decf612 apply #43ffc000400000000000000000000000 -> 1.0000000000000000000000000000E+6139 -decf613 apply 1E+6138 -> #43ffc000040000000000000000000000 Clamped -decf614 apply #43ffc000040000000000000000000000 -> 1.000000000000000000000000000E+6138 -decf615 apply 1E+6137 -> #43ffc000008000000000000000000000 Clamped -decf616 apply #43ffc000008000000000000000000000 -> 1.00000000000000000000000000E+6137 -decf617 apply 1E+6136 -> #43ffc000001000000000000000000000 Clamped -decf618 apply #43ffc000001000000000000000000000 -> 1.0000000000000000000000000E+6136 -decf619 apply 1E+6135 -> #43ffc000000100000000000000000000 Clamped -decf620 apply #43ffc000000100000000000000000000 -> 1.000000000000000000000000E+6135 -decf621 apply 1E+6134 -> #43ffc000000020000000000000000000 Clamped -decf622 apply #43ffc000000020000000000000000000 -> 1.00000000000000000000000E+6134 -decf623 apply 1E+6133 -> #43ffc000000004000000000000000000 Clamped -decf624 apply #43ffc000000004000000000000000000 -> 1.0000000000000000000000E+6133 -decf625 apply 1E+6132 -> #43ffc000000000400000000000000000 Clamped -decf626 apply #43ffc000000000400000000000000000 -> 1.000000000000000000000E+6132 -decf627 apply 1E+6131 -> #43ffc000000000080000000000000000 Clamped -decf628 apply #43ffc000000000080000000000000000 -> 1.00000000000000000000E+6131 -decf629 apply 1E+6130 -> #43ffc000000000010000000000000000 Clamped -decf630 apply #43ffc000000000010000000000000000 -> 1.0000000000000000000E+6130 -decf631 apply 1E+6129 -> #43ffc000000000001000000000000000 Clamped -decf632 apply #43ffc000000000001000000000000000 -> 1.000000000000000000E+6129 -decf633 apply 1E+6128 -> #43ffc000000000000200000000000000 Clamped -decf634 apply #43ffc000000000000200000000000000 -> 1.00000000000000000E+6128 -decf635 apply 1E+6127 -> #43ffc000000000000040000000000000 Clamped -decf636 apply #43ffc000000000000040000000000000 -> 1.0000000000000000E+6127 -decf637 apply 1E+6126 -> #43ffc000000000000004000000000000 Clamped -decf638 apply #43ffc000000000000004000000000000 -> 1.000000000000000E+6126 -decf639 apply 1E+6125 -> #43ffc000000000000000800000000000 Clamped -decf640 apply #43ffc000000000000000800000000000 -> 1.00000000000000E+6125 -decf641 apply 1E+6124 -> #43ffc000000000000000100000000000 Clamped -decf642 apply #43ffc000000000000000100000000000 -> 1.0000000000000E+6124 -decf643 apply 1E+6123 -> #43ffc000000000000000010000000000 Clamped -decf644 apply #43ffc000000000000000010000000000 -> 1.000000000000E+6123 -decf645 apply 1E+6122 -> #43ffc000000000000000002000000000 Clamped -decf646 apply #43ffc000000000000000002000000000 -> 1.00000000000E+6122 -decf647 apply 1E+6121 -> #43ffc000000000000000000400000000 Clamped -decf648 apply #43ffc000000000000000000400000000 -> 1.0000000000E+6121 -decf649 apply 1E+6120 -> #43ffc000000000000000000040000000 Clamped -decf650 apply #43ffc000000000000000000040000000 -> 1.000000000E+6120 -decf651 apply 1E+6119 -> #43ffc000000000000000000008000000 Clamped -decf652 apply #43ffc000000000000000000008000000 -> 1.00000000E+6119 -decf653 apply 1E+6118 -> #43ffc000000000000000000001000000 Clamped -decf654 apply #43ffc000000000000000000001000000 -> 1.0000000E+6118 -decf655 apply 1E+6117 -> #43ffc000000000000000000000100000 Clamped -decf656 apply #43ffc000000000000000000000100000 -> 1.000000E+6117 -decf657 apply 1E+6116 -> #43ffc000000000000000000000020000 Clamped -decf658 apply #43ffc000000000000000000000020000 -> 1.00000E+6116 -decf659 apply 1E+6115 -> #43ffc000000000000000000000004000 Clamped -decf660 apply #43ffc000000000000000000000004000 -> 1.0000E+6115 -decf661 apply 1E+6114 -> #43ffc000000000000000000000000400 Clamped -decf662 apply #43ffc000000000000000000000000400 -> 1.000E+6114 -decf663 apply 1E+6113 -> #43ffc000000000000000000000000080 Clamped -decf664 apply #43ffc000000000000000000000000080 -> 1.00E+6113 -decf665 apply 1E+6112 -> #43ffc000000000000000000000000010 Clamped -decf666 apply #43ffc000000000000000000000000010 -> 1.0E+6112 -decf667 apply 1E+6111 -> #43ffc000000000000000000000000001 -decf668 apply #43ffc000000000000000000000000001 -> 1E+6111 -decf669 apply 1E+6110 -> #43ff8000000000000000000000000001 -decf670 apply #43ff8000000000000000000000000001 -> 1E+6110 - --- Selected DPD codes -decf700 apply #22080000000000000000000000000000 -> 0 -decf701 apply #22080000000000000000000000000009 -> 9 -decf702 apply #22080000000000000000000000000010 -> 10 -decf703 apply #22080000000000000000000000000019 -> 19 -decf704 apply #22080000000000000000000000000020 -> 20 -decf705 apply #22080000000000000000000000000029 -> 29 -decf706 apply #22080000000000000000000000000030 -> 30 -decf707 apply #22080000000000000000000000000039 -> 39 -decf708 apply #22080000000000000000000000000040 -> 40 -decf709 apply #22080000000000000000000000000049 -> 49 -decf710 apply #22080000000000000000000000000050 -> 50 -decf711 apply #22080000000000000000000000000059 -> 59 -decf712 apply #22080000000000000000000000000060 -> 60 -decf713 apply #22080000000000000000000000000069 -> 69 -decf714 apply #22080000000000000000000000000070 -> 70 -decf715 apply #22080000000000000000000000000071 -> 71 -decf716 apply #22080000000000000000000000000072 -> 72 -decf717 apply #22080000000000000000000000000073 -> 73 -decf718 apply #22080000000000000000000000000074 -> 74 -decf719 apply #22080000000000000000000000000075 -> 75 -decf720 apply #22080000000000000000000000000076 -> 76 -decf721 apply #22080000000000000000000000000077 -> 77 -decf722 apply #22080000000000000000000000000078 -> 78 -decf723 apply #22080000000000000000000000000079 -> 79 - -decf730 apply #2208000000000000000000000000029e -> 994 -decf731 apply #2208000000000000000000000000029f -> 995 -decf732 apply #220800000000000000000000000002a0 -> 520 -decf733 apply #220800000000000000000000000002a1 -> 521 - --- DPD: one of each of the huffman groups -decf740 apply #220800000000000000000000000003f7 -> 777 -decf741 apply #220800000000000000000000000003f8 -> 778 -decf742 apply #220800000000000000000000000003eb -> 787 -decf743 apply #2208000000000000000000000000037d -> 877 -decf744 apply #2208000000000000000000000000039f -> 997 -decf745 apply #220800000000000000000000000003bf -> 979 -decf746 apply #220800000000000000000000000003df -> 799 -decf747 apply #2208000000000000000000000000006e -> 888 - - --- DPD all-highs cases (includes the 24 redundant codes) -decf750 apply #2208000000000000000000000000006e -> 888 -decf751 apply #2208000000000000000000000000016e -> 888 -decf752 apply #2208000000000000000000000000026e -> 888 -decf753 apply #2208000000000000000000000000036e -> 888 -decf754 apply #2208000000000000000000000000006f -> 889 -decf755 apply #2208000000000000000000000000016f -> 889 -decf756 apply #2208000000000000000000000000026f -> 889 -decf757 apply #2208000000000000000000000000036f -> 889 - -decf760 apply #2208000000000000000000000000007e -> 898 -decf761 apply #2208000000000000000000000000017e -> 898 -decf762 apply #2208000000000000000000000000027e -> 898 -decf763 apply #2208000000000000000000000000037e -> 898 -decf764 apply #2208000000000000000000000000007f -> 899 -decf765 apply #2208000000000000000000000000017f -> 899 -decf766 apply #2208000000000000000000000000027f -> 899 -decf767 apply #2208000000000000000000000000037f -> 899 - -decf770 apply #220800000000000000000000000000ee -> 988 -decf771 apply #220800000000000000000000000001ee -> 988 -decf772 apply #220800000000000000000000000002ee -> 988 -decf773 apply #220800000000000000000000000003ee -> 988 -decf774 apply #220800000000000000000000000000ef -> 989 -decf775 apply #220800000000000000000000000001ef -> 989 -decf776 apply #220800000000000000000000000002ef -> 989 -decf777 apply #220800000000000000000000000003ef -> 989 - -decf780 apply #220800000000000000000000000000fe -> 998 -decf781 apply #220800000000000000000000000001fe -> 998 -decf782 apply #220800000000000000000000000002fe -> 998 -decf783 apply #220800000000000000000000000003fe -> 998 -decf784 apply #220800000000000000000000000000ff -> 999 -decf785 apply #220800000000000000000000000001ff -> 999 -decf786 apply #220800000000000000000000000002ff -> 999 -decf787 apply #220800000000000000000000000003ff -> 999 - diff --git a/sys/lib/python/test/decimaltestdata/decimal32.decTest b/sys/lib/python/test/decimaltestdata/decimal32.decTest deleted file mode 100644 index faf1cf4c7..000000000 --- a/sys/lib/python/test/decimaltestdata/decimal32.decTest +++ /dev/null @@ -1,385 +0,0 @@ ------------------------------------------------------------------------- --- decimal32.decTest -- decimal four-byte format testcases -- --- Copyright (c) IBM Corporation, 2000, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- This set of tests is for the four-byte concrete representation. --- Its characteristics are: --- --- 1 bit sign --- 5 bits combination field --- 6 bits exponent continuation --- 20 bits coefficient continuation --- --- Total exponent length 8 bits --- Total coefficient length 24 bits (7 digits) --- --- Elimit = 191 (maximum encoded exponent) --- Emax = 96 (largest exponent value) --- Emin = -95 (smallest exponent value) --- bias = 101 (subtracted from encoded exponent) = -Etiny - -extended: 1 -precision: 7 -rounding: half_up -maxExponent: 96 -minExponent: -95 - --- General testcases --- (mostly derived from the Strawman 4 document and examples) -decd001 apply #A23003D0 -> -7.50 -decd002 apply -7.50 -> #A23003D0 - --- Normality -decd010 apply 1234567 -> #2654d2e7 -decd011 apply 1234567.0 -> #2654d2e7 Rounded -decd012 apply 1234567.1 -> #2654d2e7 Rounded Inexact -decd013 apply -1234567 -> #a654d2e7 -decd014 apply -1234567.0 -> #a654d2e7 Rounded -decd015 apply -1234567.1 -> #a654d2e7 Rounded Inexact - - --- Nmax and similar -decd022 apply 9.999999E+96 -> #77f3fcff -decd023 apply #77f3fcff -> 9.999999E+96 -decd024 apply 1.234567E+96 -> #47f4d2e7 -decd025 apply #47f4d2e7 -> 1.234567E+96 --- fold-downs (more below) -decd030 apply 1.23E+96 -> #47f4c000 Clamped -decd031 apply #47f4c000 -> 1.230000E+96 -decd032 apply 1E+96 -> #47f00000 Clamped -decd033 apply #47f00000 -> 1.000000E+96 - --- overflows -maxExponent: 999 -- set high so conversion causes the overflow -minExponent: -999 -decd040 apply 10E+96 -> #78000000 Overflow Rounded Inexact -decd041 apply 1.000000E+97 -> #78000000 Overflow Rounded Inexact -maxExponent: 96 -minExponent: -95 - -decd051 apply 12345 -> #225049c5 -decd052 apply #225049c5 -> 12345 -decd053 apply 1234 -> #22500534 -decd054 apply #22500534 -> 1234 -decd055 apply 123 -> #225000a3 -decd056 apply #225000a3 -> 123 -decd057 apply 12 -> #22500012 -decd058 apply #22500012 -> 12 -decd059 apply 1 -> #22500001 -decd060 apply #22500001 -> 1 -decd061 apply 1.23 -> #223000a3 -decd062 apply #223000a3 -> 1.23 -decd063 apply 123.45 -> #223049c5 -decd064 apply #223049c5 -> 123.45 - --- Nmin and below -decd071 apply 1E-95 -> #00600001 -decd072 apply #00600001 -> 1E-95 -decd073 apply 1.000000E-95 -> #04000000 -decd074 apply #04000000 -> 1.000000E-95 -decd075 apply 1.000001E-95 -> #04000001 -decd076 apply #04000001 -> 1.000001E-95 - -decd077 apply 0.100000E-95 -> #00020000 Subnormal -decd07x apply 1.00000E-96 -> 1.00000E-96 Subnormal -decd078 apply #00020000 -> 1.00000E-96 Subnormal -decd079 apply 0.000010E-95 -> #00000010 Subnormal -decd080 apply #00000010 -> 1.0E-100 Subnormal -decd081 apply 0.000001E-95 -> #00000001 Subnormal -decd082 apply #00000001 -> 1E-101 Subnormal -decd083 apply 1e-101 -> #00000001 Subnormal -decd084 apply #00000001 -> 1E-101 Subnormal -decd08x apply 1e-101 -> 1E-101 Subnormal - --- underflows -decd090 apply 1e-101 -> #00000001 Subnormal -decd091 apply 1.9e-101 -> #00000002 Subnormal Underflow Inexact Rounded -decd092 apply 1.1e-101 -> #00000001 Subnormal Underflow Inexact Rounded -decd093 apply 1.001e-101 -> #00000001 Subnormal Underflow Inexact Rounded -decd094 apply 1.000001e-101 -> #00000001 Subnormal Underflow Inexact Rounded -decd095 apply 1.0000001e-101 -> #00000001 Subnormal Underflow Inexact Rounded -decd096 apply 0.1e-101 -> #00000000 Subnormal Underflow Inexact Rounded -decd097 apply 0.001e-101 -> #00000000 Subnormal Underflow Inexact Rounded -decd098 apply 0.000001e-101 -> #00000000 Subnormal Underflow Inexact Rounded -decd099 apply 0.0000001e-101 -> #00000000 Subnormal Underflow Inexact Rounded - --- same again, negatives -- - --- Nmax and similar -decd122 apply -9.999999E+96 -> #f7f3fcff -decd123 apply #f7f3fcff -> -9.999999E+96 -decd124 apply -1.234567E+96 -> #c7f4d2e7 -decd125 apply #c7f4d2e7 -> -1.234567E+96 --- fold-downs (more below) -decd130 apply -1.23E+96 -> #c7f4c000 Clamped -decd131 apply #c7f4c000 -> -1.230000E+96 -decd132 apply -1E+96 -> #c7f00000 Clamped -decd133 apply #c7f00000 -> -1.000000E+96 - --- overflows -maxExponent: 999 -- set high so conversion causes the overflow -minExponent: -999 -decd140 apply -10E+96 -> #f8000000 Overflow Rounded Inexact -decd141 apply -1.000000E+97 -> #f8000000 Overflow Rounded Inexact -maxExponent: 96 -minExponent: -95 - -decd151 apply -12345 -> #a25049c5 -decd152 apply #a25049c5 -> -12345 -decd153 apply -1234 -> #a2500534 -decd154 apply #a2500534 -> -1234 -decd155 apply -123 -> #a25000a3 -decd156 apply #a25000a3 -> -123 -decd157 apply -12 -> #a2500012 -decd158 apply #a2500012 -> -12 -decd159 apply -1 -> #a2500001 -decd160 apply #a2500001 -> -1 -decd161 apply -1.23 -> #a23000a3 -decd162 apply #a23000a3 -> -1.23 -decd163 apply -123.45 -> #a23049c5 -decd164 apply #a23049c5 -> -123.45 - --- Nmin and below -decd171 apply -1E-95 -> #80600001 -decd172 apply #80600001 -> -1E-95 -decd173 apply -1.000000E-95 -> #84000000 -decd174 apply #84000000 -> -1.000000E-95 -decd175 apply -1.000001E-95 -> #84000001 -decd176 apply #84000001 -> -1.000001E-95 - -decd177 apply -0.100000E-95 -> #80020000 Subnormal -decd178 apply #80020000 -> -1.00000E-96 Subnormal -decd179 apply -0.000010E-95 -> #80000010 Subnormal -decd180 apply #80000010 -> -1.0E-100 Subnormal -decd181 apply -0.000001E-95 -> #80000001 Subnormal -decd182 apply #80000001 -> -1E-101 Subnormal -decd183 apply -1e-101 -> #80000001 Subnormal -decd184 apply #80000001 -> -1E-101 Subnormal - --- underflows -decd190 apply -1e-101 -> #80000001 Subnormal -decd191 apply -1.9e-101 -> #80000002 Subnormal Underflow Inexact Rounded -decd192 apply -1.1e-101 -> #80000001 Subnormal Underflow Inexact Rounded -decd193 apply -1.001e-101 -> #80000001 Subnormal Underflow Inexact Rounded -decd194 apply -1.000001e-101 -> #80000001 Subnormal Underflow Inexact Rounded -decd195 apply -1.0000001e-101 -> #80000001 Subnormal Underflow Inexact Rounded -decd196 apply -0.1e-101 -> #80000000 Subnormal Underflow Inexact Rounded -decd197 apply -0.001e-101 -> #80000000 Subnormal Underflow Inexact Rounded -decd198 apply -0.000001e-101 -> #80000000 Subnormal Underflow Inexact Rounded -decd199 apply -0.0000001e-101 -> #80000000 Subnormal Underflow Inexact Rounded - --- zeros -decd400 apply 0E-400 -> #00000000 Clamped -decd401 apply 0E-101 -> #00000000 -decd402 apply #00000000 -> 0E-101 -decd403 apply 0.000000E-95 -> #00000000 -decd404 apply #00000000 -> 0E-101 -decd405 apply 0E-2 -> #22300000 -decd406 apply #22300000 -> 0.00 -decd407 apply 0 -> #22500000 -decd408 apply #22500000 -> 0 -decd409 apply 0E+3 -> #22800000 -decd410 apply #22800000 -> 0E+3 -decd411 apply 0E+90 -> #43f00000 -decd412 apply #43f00000 -> 0E+90 --- clamped zeros... -decd413 apply 0E+91 -> #43f00000 Clamped -decd414 apply #43f00000 -> 0E+90 -decd415 apply 0E+96 -> #43f00000 Clamped -decd416 apply #43f00000 -> 0E+90 -decd417 apply 0E+400 -> #43f00000 Clamped -decd418 apply #43f00000 -> 0E+90 - --- negative zeros -decd420 apply -0E-400 -> #80000000 Clamped -decd421 apply -0E-101 -> #80000000 -decd422 apply #80000000 -> -0E-101 -decd423 apply -0.000000E-95 -> #80000000 -decd424 apply #80000000 -> -0E-101 -decd425 apply -0E-2 -> #a2300000 -decd426 apply #a2300000 -> -0.00 -decd427 apply -0 -> #a2500000 -decd428 apply #a2500000 -> -0 -decd429 apply -0E+3 -> #a2800000 -decd430 apply #a2800000 -> -0E+3 -decd431 apply -0E+90 -> #c3f00000 -decd432 apply #c3f00000 -> -0E+90 --- clamped zeros... -decd433 apply -0E+91 -> #c3f00000 Clamped -decd434 apply #c3f00000 -> -0E+90 -decd435 apply -0E+96 -> #c3f00000 Clamped -decd436 apply #c3f00000 -> -0E+90 -decd437 apply -0E+400 -> #c3f00000 Clamped -decd438 apply #c3f00000 -> -0E+90 - --- Specials -decd500 apply Infinity -> #78000000 -decd501 apply #78787878 -> #78000000 -decd502 apply #78000000 -> Infinity -decd503 apply #79797979 -> #78000000 -decd504 apply #79000000 -> Infinity -decd505 apply #7a7a7a7a -> #78000000 -decd506 apply #7a000000 -> Infinity -decd507 apply #7b7b7b7b -> #78000000 -decd508 apply #7b000000 -> Infinity -decd509 apply #7c7c7c7c -> #7c0c7c7c - -decd510 apply NaN -> #7c000000 -decd511 apply #7c000000 -> NaN -decd512 apply #7d7d7d7d -> #7c0d7d7d -decd513 apply #7d000000 -> NaN -decd514 apply #7e7e7e7e -> #7e0e7c7e -decd515 apply #7e000000 -> sNaN -decd516 apply #7f7f7f7f -> #7e0f7c7f -decd517 apply #7f000000 -> sNaN -decd518 apply #7fffffff -> sNaN999999 -decd519 apply #7fffffff -> #7e03fcff - -decd520 apply -Infinity -> #f8000000 -decd521 apply #f8787878 -> #f8000000 -decd522 apply #f8000000 -> -Infinity -decd523 apply #f9797979 -> #f8000000 -decd524 apply #f9000000 -> -Infinity -decd525 apply #fa7a7a7a -> #f8000000 -decd526 apply #fa000000 -> -Infinity -decd527 apply #fb7b7b7b -> #f8000000 -decd528 apply #fb000000 -> -Infinity - -decd529 apply -NaN -> #fc000000 -decd530 apply #fc7c7c7c -> #fc0c7c7c -decd531 apply #fc000000 -> -NaN -decd532 apply #fd7d7d7d -> #fc0d7d7d -decd533 apply #fd000000 -> -NaN -decd534 apply #fe7e7e7e -> #fe0e7c7e -decd535 apply #fe000000 -> -sNaN -decd536 apply #ff7f7f7f -> #fe0f7c7f -decd537 apply #ff000000 -> -sNaN -decd538 apply #ffffffff -> -sNaN999999 -decd539 apply #ffffffff -> #fe03fcff - --- diagnostic NaNs -decd540 apply NaN -> #7c000000 -decd541 apply NaN0 -> #7c000000 -decd542 apply NaN1 -> #7c000001 -decd543 apply NaN12 -> #7c000012 -decd544 apply NaN79 -> #7c000079 -decd545 apply NaN12345 -> #7c0049c5 -decd546 apply NaN123456 -> #7c028e56 -decd547 apply NaN799799 -> #7c0f7fdf -decd548 apply NaN999999 -> #7c03fcff -decd549 apply NaN1234567 -> #7c000000 -- too many digits - - --- fold-down full sequence -decd601 apply 1E+96 -> #47f00000 Clamped -decd602 apply #47f00000 -> 1.000000E+96 -decd603 apply 1E+95 -> #43f20000 Clamped -decd604 apply #43f20000 -> 1.00000E+95 -decd605 apply 1E+94 -> #43f04000 Clamped -decd606 apply #43f04000 -> 1.0000E+94 -decd607 apply 1E+93 -> #43f00400 Clamped -decd608 apply #43f00400 -> 1.000E+93 -decd609 apply 1E+92 -> #43f00080 Clamped -decd610 apply #43f00080 -> 1.00E+92 -decd611 apply 1E+91 -> #43f00010 Clamped -decd612 apply #43f00010 -> 1.0E+91 -decd613 apply 1E+90 -> #43f00001 -decd614 apply #43f00001 -> 1E+90 - - --- Selected DPD codes -decd700 apply #22500000 -> 0 -decd701 apply #22500009 -> 9 -decd702 apply #22500010 -> 10 -decd703 apply #22500019 -> 19 -decd704 apply #22500020 -> 20 -decd705 apply #22500029 -> 29 -decd706 apply #22500030 -> 30 -decd707 apply #22500039 -> 39 -decd708 apply #22500040 -> 40 -decd709 apply #22500049 -> 49 -decd710 apply #22500050 -> 50 -decd711 apply #22500059 -> 59 -decd712 apply #22500060 -> 60 -decd713 apply #22500069 -> 69 -decd714 apply #22500070 -> 70 -decd715 apply #22500071 -> 71 -decd716 apply #22500072 -> 72 -decd717 apply #22500073 -> 73 -decd718 apply #22500074 -> 74 -decd719 apply #22500075 -> 75 -decd720 apply #22500076 -> 76 -decd721 apply #22500077 -> 77 -decd722 apply #22500078 -> 78 -decd723 apply #22500079 -> 79 - -decd730 apply #2250029e -> 994 -decd731 apply #2250029f -> 995 -decd732 apply #225002a0 -> 520 -decd733 apply #225002a1 -> 521 - --- DPD: one of each of the huffman groups -decd740 apply #225003f7 -> 777 -decd741 apply #225003f8 -> 778 -decd742 apply #225003eb -> 787 -decd743 apply #2250037d -> 877 -decd744 apply #2250039f -> 997 -decd745 apply #225003bf -> 979 -decd746 apply #225003df -> 799 -decd747 apply #2250006e -> 888 - - --- DPD all-highs cases (includes the 24 redundant codes) -decd750 apply #2250006e -> 888 -decd751 apply #2250016e -> 888 -decd752 apply #2250026e -> 888 -decd753 apply #2250036e -> 888 -decd754 apply #2250006f -> 889 -decd755 apply #2250016f -> 889 -decd756 apply #2250026f -> 889 -decd757 apply #2250036f -> 889 - -decd760 apply #2250007e -> 898 -decd761 apply #2250017e -> 898 -decd762 apply #2250027e -> 898 -decd763 apply #2250037e -> 898 -decd764 apply #2250007f -> 899 -decd765 apply #2250017f -> 899 -decd766 apply #2250027f -> 899 -decd767 apply #2250037f -> 899 - -decd770 apply #225000ee -> 988 -decd771 apply #225001ee -> 988 -decd772 apply #225002ee -> 988 -decd773 apply #225003ee -> 988 -decd774 apply #225000ef -> 989 -decd775 apply #225001ef -> 989 -decd776 apply #225002ef -> 989 -decd777 apply #225003ef -> 989 - -decd780 apply #225000fe -> 998 -decd781 apply #225001fe -> 998 -decd782 apply #225002fe -> 998 -decd783 apply #225003fe -> 998 -decd784 apply #225000ff -> 999 -decd785 apply #225001ff -> 999 -decd786 apply #225002ff -> 999 -decd787 apply #225003ff -> 999 - diff --git a/sys/lib/python/test/decimaltestdata/decimal64.decTest b/sys/lib/python/test/decimaltestdata/decimal64.decTest deleted file mode 100644 index a25416762..000000000 --- a/sys/lib/python/test/decimaltestdata/decimal64.decTest +++ /dev/null @@ -1,444 +0,0 @@ ------------------------------------------------------------------------- --- decimal64.decTest -- decimal eight-byte format testcases -- --- Copyright (c) IBM Corporation, 2000, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- This set of tests is for the eight-byte concrete representation. --- Its characteristics are: --- --- 1 bit sign --- 5 bits combination field --- 8 bits exponent continuation --- 50 bits coefficient continuation --- --- Total exponent length 10 bits --- Total coefficient length 54 bits (16 digits) --- --- Elimit = 767 (maximum encoded exponent) --- Emax = 384 (largest exponent value) --- Emin = -383 (smallest exponent value) --- bias = 398 (subtracted from encoded exponent) = -Etiny - -extended: 1 -precision: 16 -rounding: half_up -maxExponent: 384 -minExponent: -383 - --- General testcases --- (mostly derived from the Strawman 4 document and examples) -dece001 apply #A2300000000003D0 -> -7.50 -dece002 apply -7.50 -> #A2300000000003D0 - --- Normality -dece010 apply 1234567890123456 -> #263934b9c1e28e56 -dece011 apply 1234567890123456.0 -> #263934b9c1e28e56 Rounded -dece012 apply 1234567890123456.1 -> #263934b9c1e28e56 Rounded Inexact -dece013 apply -1234567890123456 -> #a63934b9c1e28e56 -dece014 apply -1234567890123456.0 -> #a63934b9c1e28e56 Rounded -dece015 apply -1234567890123456.1 -> #a63934b9c1e28e56 Rounded Inexact - - --- Nmax and similar -dece022 apply 9.999999999999999E+384 -> #77fcff3fcff3fcff -dece023 apply #77fcff3fcff3fcff -> 9.999999999999999E+384 -dece024 apply 1.234567890123456E+384 -> #47fd34b9c1e28e56 -dece025 apply #47fd34b9c1e28e56 -> 1.234567890123456E+384 --- fold-downs (more below) -dece030 apply 1.23E+384 -> #47fd300000000000 Clamped -dece031 apply #47fd300000000000 -> 1.230000000000000E+384 -dece032 apply 1E+384 -> #47fc000000000000 Clamped -dece033 apply #47fc000000000000 -> 1.000000000000000E+384 - --- overflows -maxExponent: 999 -- set high so conversion causes the overflow -minExponent: -999 -dece040 apply 10E+384 -> #7800000000000000 Overflow Rounded Inexact -dece041 apply 1.000000000000000E+385 -> #7800000000000000 Overflow Rounded Inexact -maxExponent: 384 -minExponent: -383 - -dece051 apply 12345 -> #22380000000049c5 -dece052 apply #22380000000049c5 -> 12345 -dece053 apply 1234 -> #2238000000000534 -dece054 apply #2238000000000534 -> 1234 -dece055 apply 123 -> #22380000000000a3 -dece056 apply #22380000000000a3 -> 123 -dece057 apply 12 -> #2238000000000012 -dece058 apply #2238000000000012 -> 12 -dece059 apply 1 -> #2238000000000001 -dece060 apply #2238000000000001 -> 1 -dece061 apply 1.23 -> #22300000000000a3 -dece062 apply #22300000000000a3 -> 1.23 -dece063 apply 123.45 -> #22300000000049c5 -dece064 apply #22300000000049c5 -> 123.45 - --- Nmin and below -dece071 apply 1E-383 -> #003c000000000001 -dece072 apply #003c000000000001 -> 1E-383 -dece073 apply 1.000000000000000E-383 -> #0400000000000000 -dece074 apply #0400000000000000 -> 1.000000000000000E-383 -dece075 apply 1.000000000000001E-383 -> #0400000000000001 -dece076 apply #0400000000000001 -> 1.000000000000001E-383 - -dece077 apply 0.100000000000000E-383 -> #0000800000000000 Subnormal -dece078 apply #0000800000000000 -> 1.00000000000000E-384 Subnormal -dece079 apply 0.000000000000010E-383 -> #0000000000000010 Subnormal -dece080 apply #0000000000000010 -> 1.0E-397 Subnormal -dece081 apply 0.00000000000001E-383 -> #0004000000000001 Subnormal -dece082 apply #0004000000000001 -> 1E-397 Subnormal -dece083 apply 0.000000000000001E-383 -> #0000000000000001 Subnormal -dece084 apply #0000000000000001 -> 1E-398 Subnormal - --- underflows -dece090 apply 1e-398 -> #0000000000000001 Subnormal -dece091 apply 1.9e-398 -> #0000000000000002 Subnormal Underflow Inexact Rounded -dece092 apply 1.1e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded -dece093 apply 1.00000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded -dece094 apply 1.00000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded -dece095 apply 1.000000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded -dece096 apply 0.1e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded -dece097 apply 0.00000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded -dece098 apply 0.00000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded -dece099 apply 0.000000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded - --- Same again, negatives --- Nmax and similar -dece122 apply -9.999999999999999E+384 -> #f7fcff3fcff3fcff -dece123 apply #f7fcff3fcff3fcff -> -9.999999999999999E+384 -dece124 apply -1.234567890123456E+384 -> #c7fd34b9c1e28e56 -dece125 apply #c7fd34b9c1e28e56 -> -1.234567890123456E+384 --- fold-downs (more below) -dece130 apply -1.23E+384 -> #c7fd300000000000 Clamped -dece131 apply #c7fd300000000000 -> -1.230000000000000E+384 -dece132 apply -1E+384 -> #c7fc000000000000 Clamped -dece133 apply #c7fc000000000000 -> -1.000000000000000E+384 - --- overflows -maxExponent: 999 -- set high so conversion causes the overflow -minExponent: -999 -dece140 apply -10E+384 -> #f800000000000000 Overflow Rounded Inexact -dece141 apply -1.000000000000000E+385 -> #f800000000000000 Overflow Rounded Inexact -maxExponent: 384 -minExponent: -383 - -dece151 apply -12345 -> #a2380000000049c5 -dece152 apply #a2380000000049c5 -> -12345 -dece153 apply -1234 -> #a238000000000534 -dece154 apply #a238000000000534 -> -1234 -dece155 apply -123 -> #a2380000000000a3 -dece156 apply #a2380000000000a3 -> -123 -dece157 apply -12 -> #a238000000000012 -dece158 apply #a238000000000012 -> -12 -dece159 apply -1 -> #a238000000000001 -dece160 apply #a238000000000001 -> -1 -dece161 apply -1.23 -> #a2300000000000a3 -dece162 apply #a2300000000000a3 -> -1.23 -dece163 apply -123.45 -> #a2300000000049c5 -dece164 apply #a2300000000049c5 -> -123.45 - --- Nmin and below -dece171 apply -1E-383 -> #803c000000000001 -dece172 apply #803c000000000001 -> -1E-383 -dece173 apply -1.000000000000000E-383 -> #8400000000000000 -dece174 apply #8400000000000000 -> -1.000000000000000E-383 -dece175 apply -1.000000000000001E-383 -> #8400000000000001 -dece176 apply #8400000000000001 -> -1.000000000000001E-383 - -dece177 apply -0.100000000000000E-383 -> #8000800000000000 Subnormal -dece178 apply #8000800000000000 -> -1.00000000000000E-384 Subnormal -dece179 apply -0.000000000000010E-383 -> #8000000000000010 Subnormal -dece180 apply #8000000000000010 -> -1.0E-397 Subnormal -dece181 apply -0.00000000000001E-383 -> #8004000000000001 Subnormal -dece182 apply #8004000000000001 -> -1E-397 Subnormal -dece183 apply -0.000000000000001E-383 -> #8000000000000001 Subnormal -dece184 apply #8000000000000001 -> -1E-398 Subnormal - --- underflows -dece189 apply -1e-398 -> #8000000000000001 Subnormal -dece190 apply -1.0e-398 -> #8000000000000001 Subnormal Rounded -dece191 apply -1.9e-398 -> #8000000000000002 Subnormal Underflow Inexact Rounded -dece192 apply -1.1e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded -dece193 apply -1.00000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded -dece194 apply -1.00000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded -dece195 apply -1.000000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded -dece196 apply -0.1e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded -dece197 apply -0.00000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded -dece198 apply -0.00000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded -dece199 apply -0.000000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded - --- zeros -dece401 apply 0E-500 -> #0000000000000000 Clamped -dece402 apply 0E-400 -> #0000000000000000 Clamped -dece403 apply 0E-398 -> #0000000000000000 -dece404 apply #0000000000000000 -> 0E-398 -dece405 apply 0.000000000000000E-383 -> #0000000000000000 -dece406 apply #0000000000000000 -> 0E-398 -dece407 apply 0E-2 -> #2230000000000000 -dece408 apply #2230000000000000 -> 0.00 -dece409 apply 0 -> #2238000000000000 -dece410 apply #2238000000000000 -> 0 -dece411 apply 0E+3 -> #2244000000000000 -dece412 apply #2244000000000000 -> 0E+3 -dece413 apply 0E+369 -> #43fc000000000000 -dece414 apply #43fc000000000000 -> 0E+369 --- clamped zeros... -dece415 apply 0E+370 -> #43fc000000000000 Clamped -dece416 apply #43fc000000000000 -> 0E+369 -dece417 apply 0E+384 -> #43fc000000000000 Clamped -dece418 apply #43fc000000000000 -> 0E+369 -dece419 apply 0E+400 -> #43fc000000000000 Clamped -dece420 apply #43fc000000000000 -> 0E+369 -dece421 apply 0E+500 -> #43fc000000000000 Clamped -dece422 apply #43fc000000000000 -> 0E+369 - --- negative zeros -dece431 apply -0E-400 -> #8000000000000000 Clamped -dece432 apply -0E-400 -> #8000000000000000 Clamped -dece433 apply -0E-398 -> #8000000000000000 -dece434 apply #8000000000000000 -> -0E-398 -dece435 apply -0.000000000000000E-383 -> #8000000000000000 -dece436 apply #8000000000000000 -> -0E-398 -dece437 apply -0E-2 -> #a230000000000000 -dece438 apply #a230000000000000 -> -0.00 -dece439 apply -0 -> #a238000000000000 -dece440 apply #a238000000000000 -> -0 -dece441 apply -0E+3 -> #a244000000000000 -dece442 apply #a244000000000000 -> -0E+3 -dece443 apply -0E+369 -> #c3fc000000000000 -dece444 apply #c3fc000000000000 -> -0E+369 --- clamped zeros... -dece445 apply -0E+370 -> #c3fc000000000000 Clamped -dece446 apply #c3fc000000000000 -> -0E+369 -dece447 apply -0E+384 -> #c3fc000000000000 Clamped -dece448 apply #c3fc000000000000 -> -0E+369 -dece449 apply -0E+400 -> #c3fc000000000000 Clamped -dece450 apply #c3fc000000000000 -> -0E+369 -dece451 apply -0E+500 -> #c3fc000000000000 Clamped -dece452 apply #c3fc000000000000 -> -0E+369 - --- Specials -dece500 apply Infinity -> #7800000000000000 -dece501 apply #7878787878787878 -> #7800000000000000 -dece502 apply #7800000000000000 -> Infinity -dece503 apply #7979797979797979 -> #7800000000000000 -dece504 apply #7900000000000000 -> Infinity -dece505 apply #7a7a7a7a7a7a7a7a -> #7800000000000000 -dece506 apply #7a00000000000000 -> Infinity -dece507 apply #7b7b7b7b7b7b7b7b -> #7800000000000000 -dece508 apply #7b00000000000000 -> Infinity - -dece509 apply NaN -> #7c00000000000000 -dece510 apply #7c7c7c7c7c7c7c7c -> #7c007c7c7c7c7c7c -dece511 apply #7c00000000000000 -> NaN -dece512 apply #7d7d7d7d7d7d7d7d -> #7c017d7d7d7d7d7d -dece513 apply #7d00000000000000 -> NaN -dece514 apply #7e7e7e7e7e7e7e7e -> #7e007e7e7e7e7c7e -dece515 apply #7e00000000000000 -> sNaN -dece516 apply #7f7f7f7f7f7f7f7f -> #7e007f7f7f7f7c7f -dece517 apply #7f00000000000000 -> sNaN -dece518 apply #7fffffffffffffff -> sNaN999999999999999 -dece519 apply #7fffffffffffffff -> #7e00ff3fcff3fcff - -dece520 apply -Infinity -> #f800000000000000 -dece521 apply #f878787878787878 -> #f800000000000000 -dece522 apply #f800000000000000 -> -Infinity -dece523 apply #f979797979797979 -> #f800000000000000 -dece524 apply #f900000000000000 -> -Infinity -dece525 apply #fa7a7a7a7a7a7a7a -> #f800000000000000 -dece526 apply #fa00000000000000 -> -Infinity -dece527 apply #fb7b7b7b7b7b7b7b -> #f800000000000000 -dece528 apply #fb00000000000000 -> -Infinity - -dece529 apply -NaN -> #fc00000000000000 -dece530 apply #fc7c7c7c7c7c7c7c -> #fc007c7c7c7c7c7c -dece531 apply #fc00000000000000 -> -NaN -dece532 apply #fd7d7d7d7d7d7d7d -> #fc017d7d7d7d7d7d -dece533 apply #fd00000000000000 -> -NaN -dece534 apply #fe7e7e7e7e7e7e7e -> #fe007e7e7e7e7c7e -dece535 apply #fe00000000000000 -> -sNaN -dece536 apply #ff7f7f7f7f7f7f7f -> #fe007f7f7f7f7c7f -dece537 apply #ff00000000000000 -> -sNaN -dece538 apply #ffffffffffffffff -> -sNaN999999999999999 -dece539 apply #ffffffffffffffff -> #fe00ff3fcff3fcff - --- diagnostic NaNs -dece540 apply NaN -> #7c00000000000000 -dece541 apply NaN0 -> #7c00000000000000 -dece542 apply NaN1 -> #7c00000000000001 -dece543 apply NaN12 -> #7c00000000000012 -dece544 apply NaN79 -> #7c00000000000079 -dece545 apply NaN12345 -> #7c000000000049c5 -dece546 apply NaN123456 -> #7c00000000028e56 -dece547 apply NaN799799 -> #7c000000000f7fdf -dece548 apply NaN799799799799799 -> #7c03dff7fdff7fdf -dece549 apply NaN999999999999999 -> #7c00ff3fcff3fcff -dece550 apply NaN1234567890123456 -> #7c00000000000000 -- too many digits - --- fold-down full sequence -dece601 apply 1E+384 -> #47fc000000000000 Clamped -dece602 apply #47fc000000000000 -> 1.000000000000000E+384 -dece603 apply 1E+383 -> #43fc800000000000 Clamped -dece604 apply #43fc800000000000 -> 1.00000000000000E+383 -dece605 apply 1E+382 -> #43fc100000000000 Clamped -dece606 apply #43fc100000000000 -> 1.0000000000000E+382 -dece607 apply 1E+381 -> #43fc010000000000 Clamped -dece608 apply #43fc010000000000 -> 1.000000000000E+381 -dece609 apply 1E+380 -> #43fc002000000000 Clamped -dece610 apply #43fc002000000000 -> 1.00000000000E+380 -dece611 apply 1E+379 -> #43fc000400000000 Clamped -dece612 apply #43fc000400000000 -> 1.0000000000E+379 -dece613 apply 1E+378 -> #43fc000040000000 Clamped -dece614 apply #43fc000040000000 -> 1.000000000E+378 -dece615 apply 1E+377 -> #43fc000008000000 Clamped -dece616 apply #43fc000008000000 -> 1.00000000E+377 -dece617 apply 1E+376 -> #43fc000001000000 Clamped -dece618 apply #43fc000001000000 -> 1.0000000E+376 -dece619 apply 1E+375 -> #43fc000000100000 Clamped -dece620 apply #43fc000000100000 -> 1.000000E+375 -dece621 apply 1E+374 -> #43fc000000020000 Clamped -dece622 apply #43fc000000020000 -> 1.00000E+374 -dece623 apply 1E+373 -> #43fc000000004000 Clamped -dece624 apply #43fc000000004000 -> 1.0000E+373 -dece625 apply 1E+372 -> #43fc000000000400 Clamped -dece626 apply #43fc000000000400 -> 1.000E+372 -dece627 apply 1E+371 -> #43fc000000000080 Clamped -dece628 apply #43fc000000000080 -> 1.00E+371 -dece629 apply 1E+370 -> #43fc000000000010 Clamped -dece630 apply #43fc000000000010 -> 1.0E+370 -dece631 apply 1E+369 -> #43fc000000000001 -dece632 apply #43fc000000000001 -> 1E+369 -dece633 apply 1E+368 -> #43f8000000000001 -dece634 apply #43f8000000000001 -> 1E+368 --- same with 9s -dece641 apply 9E+384 -> #77fc000000000000 Clamped -dece642 apply #77fc000000000000 -> 9.000000000000000E+384 -dece643 apply 9E+383 -> #43fc8c0000000000 Clamped -dece644 apply #43fc8c0000000000 -> 9.00000000000000E+383 -dece645 apply 9E+382 -> #43fc1a0000000000 Clamped -dece646 apply #43fc1a0000000000 -> 9.0000000000000E+382 -dece647 apply 9E+381 -> #43fc090000000000 Clamped -dece648 apply #43fc090000000000 -> 9.000000000000E+381 -dece649 apply 9E+380 -> #43fc002300000000 Clamped -dece650 apply #43fc002300000000 -> 9.00000000000E+380 -dece651 apply 9E+379 -> #43fc000680000000 Clamped -dece652 apply #43fc000680000000 -> 9.0000000000E+379 -dece653 apply 9E+378 -> #43fc000240000000 Clamped -dece654 apply #43fc000240000000 -> 9.000000000E+378 -dece655 apply 9E+377 -> #43fc000008c00000 Clamped -dece656 apply #43fc000008c00000 -> 9.00000000E+377 -dece657 apply 9E+376 -> #43fc000001a00000 Clamped -dece658 apply #43fc000001a00000 -> 9.0000000E+376 -dece659 apply 9E+375 -> #43fc000000900000 Clamped -dece660 apply #43fc000000900000 -> 9.000000E+375 -dece661 apply 9E+374 -> #43fc000000023000 Clamped -dece662 apply #43fc000000023000 -> 9.00000E+374 -dece663 apply 9E+373 -> #43fc000000006800 Clamped -dece664 apply #43fc000000006800 -> 9.0000E+373 -dece665 apply 9E+372 -> #43fc000000002400 Clamped -dece666 apply #43fc000000002400 -> 9.000E+372 -dece667 apply 9E+371 -> #43fc00000000008c Clamped -dece668 apply #43fc00000000008c -> 9.00E+371 -dece669 apply 9E+370 -> #43fc00000000001a Clamped -dece670 apply #43fc00000000001a -> 9.0E+370 -dece671 apply 9E+369 -> #43fc000000000009 -dece672 apply #43fc000000000009 -> 9E+369 -dece673 apply 9E+368 -> #43f8000000000009 -dece674 apply #43f8000000000009 -> 9E+368 - - --- Selected DPD codes -dece700 apply #2238000000000000 -> 0 -dece701 apply #2238000000000009 -> 9 -dece702 apply #2238000000000010 -> 10 -dece703 apply #2238000000000019 -> 19 -dece704 apply #2238000000000020 -> 20 -dece705 apply #2238000000000029 -> 29 -dece706 apply #2238000000000030 -> 30 -dece707 apply #2238000000000039 -> 39 -dece708 apply #2238000000000040 -> 40 -dece709 apply #2238000000000049 -> 49 -dece710 apply #2238000000000050 -> 50 -dece711 apply #2238000000000059 -> 59 -dece712 apply #2238000000000060 -> 60 -dece713 apply #2238000000000069 -> 69 -dece714 apply #2238000000000070 -> 70 -dece715 apply #2238000000000071 -> 71 -dece716 apply #2238000000000072 -> 72 -dece717 apply #2238000000000073 -> 73 -dece718 apply #2238000000000074 -> 74 -dece719 apply #2238000000000075 -> 75 -dece720 apply #2238000000000076 -> 76 -dece721 apply #2238000000000077 -> 77 -dece722 apply #2238000000000078 -> 78 -dece723 apply #2238000000000079 -> 79 - -dece730 apply #223800000000029e -> 994 -dece731 apply #223800000000029f -> 995 -dece732 apply #22380000000002a0 -> 520 -dece733 apply #22380000000002a1 -> 521 - --- DPD: one of each of the huffman groups -dece740 apply #22380000000003f7 -> 777 -dece741 apply #22380000000003f8 -> 778 -dece742 apply #22380000000003eb -> 787 -dece743 apply #223800000000037d -> 877 -dece744 apply #223800000000039f -> 997 -dece745 apply #22380000000003bf -> 979 -dece746 apply #22380000000003df -> 799 -dece747 apply #223800000000006e -> 888 - - --- DPD all-highs cases (includes the 24 redundant codes) -dece750 apply #223800000000006e -> 888 -dece751 apply #223800000000016e -> 888 -dece752 apply #223800000000026e -> 888 -dece753 apply #223800000000036e -> 888 -dece754 apply #223800000000006f -> 889 -dece755 apply #223800000000016f -> 889 -dece756 apply #223800000000026f -> 889 -dece757 apply #223800000000036f -> 889 - -dece760 apply #223800000000007e -> 898 -dece761 apply #223800000000017e -> 898 -dece762 apply #223800000000027e -> 898 -dece763 apply #223800000000037e -> 898 -dece764 apply #223800000000007f -> 899 -dece765 apply #223800000000017f -> 899 -dece766 apply #223800000000027f -> 899 -dece767 apply #223800000000037f -> 899 - -dece770 apply #22380000000000ee -> 988 -dece771 apply #22380000000001ee -> 988 -dece772 apply #22380000000002ee -> 988 -dece773 apply #22380000000003ee -> 988 -dece774 apply #22380000000000ef -> 989 -dece775 apply #22380000000001ef -> 989 -dece776 apply #22380000000002ef -> 989 -dece777 apply #22380000000003ef -> 989 - -dece780 apply #22380000000000fe -> 998 -dece781 apply #22380000000001fe -> 998 -dece782 apply #22380000000002fe -> 998 -dece783 apply #22380000000003fe -> 998 -dece784 apply #22380000000000ff -> 999 -dece785 apply #22380000000001ff -> 999 -dece786 apply #22380000000002ff -> 999 -dece787 apply #22380000000003ff -> 999 - diff --git a/sys/lib/python/test/decimaltestdata/divide.decTest b/sys/lib/python/test/decimaltestdata/divide.decTest deleted file mode 100644 index 437d82a2f..000000000 --- a/sys/lib/python/test/decimaltestdata/divide.decTest +++ /dev/null @@ -1,818 +0,0 @@ ------------------------------------------------------------------------- --- divide.decTest -- decimal division -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - --- sanity checks -divx001 divide 1 1 -> 1 -divx002 divide 2 1 -> 2 -divx003 divide 1 2 -> 0.5 -divx004 divide 2 2 -> 1 -divx005 divide 0 1 -> 0 -divx006 divide 0 2 -> 0 -divx007 divide 1 3 -> 0.333333333 Inexact Rounded -divx008 divide 2 3 -> 0.666666667 Inexact Rounded -divx009 divide 3 3 -> 1 - -divx010 divide 2.4 1 -> 2.4 -divx011 divide 2.4 -1 -> -2.4 -divx012 divide -2.4 1 -> -2.4 -divx013 divide -2.4 -1 -> 2.4 -divx014 divide 2.40 1 -> 2.40 -divx015 divide 2.400 1 -> 2.400 -divx016 divide 2.4 2 -> 1.2 -divx017 divide 2.400 2 -> 1.200 -divx018 divide 2. 2 -> 1 -divx019 divide 20 20 -> 1 - -divx020 divide 187 187 -> 1 -divx021 divide 5 2 -> 2.5 -divx022 divide 5 2.0 -> 2.5 -divx023 divide 5 2.000 -> 2.5 -divx024 divide 5 0.20 -> 25 -divx025 divide 5 0.200 -> 25 -divx026 divide 10 1 -> 10 -divx027 divide 100 1 -> 100 -divx028 divide 1000 1 -> 1000 -divx029 divide 1000 100 -> 10 - -divx030 divide 1 2 -> 0.5 -divx031 divide 1 4 -> 0.25 -divx032 divide 1 8 -> 0.125 -divx033 divide 1 16 -> 0.0625 -divx034 divide 1 32 -> 0.03125 -divx035 divide 1 64 -> 0.015625 -divx040 divide 1 -2 -> -0.5 -divx041 divide 1 -4 -> -0.25 -divx042 divide 1 -8 -> -0.125 -divx043 divide 1 -16 -> -0.0625 -divx044 divide 1 -32 -> -0.03125 -divx045 divide 1 -64 -> -0.015625 -divx050 divide -1 2 -> -0.5 -divx051 divide -1 4 -> -0.25 -divx052 divide -1 8 -> -0.125 -divx053 divide -1 16 -> -0.0625 -divx054 divide -1 32 -> -0.03125 -divx055 divide -1 64 -> -0.015625 -divx060 divide -1 -2 -> 0.5 -divx061 divide -1 -4 -> 0.25 -divx062 divide -1 -8 -> 0.125 -divx063 divide -1 -16 -> 0.0625 -divx064 divide -1 -32 -> 0.03125 -divx065 divide -1 -64 -> 0.015625 - -divx070 divide 999999999 1 -> 999999999 -divx071 divide 999999999.4 1 -> 999999999 Inexact Rounded -divx072 divide 999999999.5 1 -> 1.00000000E+9 Inexact Rounded -divx073 divide 999999999.9 1 -> 1.00000000E+9 Inexact Rounded -divx074 divide 999999999.999 1 -> 1.00000000E+9 Inexact Rounded -precision: 6 -divx080 divide 999999999 1 -> 1.00000E+9 Inexact Rounded -divx081 divide 99999999 1 -> 1.00000E+8 Inexact Rounded -divx082 divide 9999999 1 -> 1.00000E+7 Inexact Rounded -divx083 divide 999999 1 -> 999999 -divx084 divide 99999 1 -> 99999 -divx085 divide 9999 1 -> 9999 -divx086 divide 999 1 -> 999 -divx087 divide 99 1 -> 99 -divx088 divide 9 1 -> 9 - -precision: 9 -divx090 divide 0. 1 -> 0 -divx091 divide .0 1 -> 0.0 -divx092 divide 0.00 1 -> 0.00 -divx093 divide 0.00E+9 1 -> 0E+7 -divx094 divide 0.0000E-50 1 -> 0E-54 - -divx095 divide 1 1E-8 -> 1E+8 -divx096 divide 1 1E-9 -> 1E+9 -divx097 divide 1 1E-10 -> 1E+10 -divx098 divide 1 1E-11 -> 1E+11 -divx099 divide 1 1E-12 -> 1E+12 - -divx100 divide 1 1 -> 1 -divx101 divide 1 2 -> 0.5 -divx102 divide 1 3 -> 0.333333333 Inexact Rounded -divx103 divide 1 4 -> 0.25 -divx104 divide 1 5 -> 0.2 -divx105 divide 1 6 -> 0.166666667 Inexact Rounded -divx106 divide 1 7 -> 0.142857143 Inexact Rounded -divx107 divide 1 8 -> 0.125 -divx108 divide 1 9 -> 0.111111111 Inexact Rounded -divx109 divide 1 10 -> 0.1 -divx110 divide 1 1 -> 1 -divx111 divide 2 1 -> 2 -divx112 divide 3 1 -> 3 -divx113 divide 4 1 -> 4 -divx114 divide 5 1 -> 5 -divx115 divide 6 1 -> 6 -divx116 divide 7 1 -> 7 -divx117 divide 8 1 -> 8 -divx118 divide 9 1 -> 9 -divx119 divide 10 1 -> 10 - -divx120 divide 3E+1 0.001 -> 3E+4 -divx121 divide 2.200 2 -> 1.100 - -divx130 divide 12345 4.999 -> 2469.49390 Inexact Rounded -divx131 divide 12345 4.99 -> 2473.94790 Inexact Rounded -divx132 divide 12345 4.9 -> 2519.38776 Inexact Rounded -divx133 divide 12345 5 -> 2469 -divx134 divide 12345 5.1 -> 2420.58824 Inexact Rounded -divx135 divide 12345 5.01 -> 2464.07186 Inexact Rounded -divx136 divide 12345 5.001 -> 2468.50630 Inexact Rounded - -precision: 9 -maxexponent: 999999999 -minexponent: -999999999 - --- test possibly imprecise results -divx220 divide 391 597 -> 0.654941374 Inexact Rounded -divx221 divide 391 -597 -> -0.654941374 Inexact Rounded -divx222 divide -391 597 -> -0.654941374 Inexact Rounded -divx223 divide -391 -597 -> 0.654941374 Inexact Rounded - --- test some cases that are close to exponent overflow -maxexponent: 999999999 -minexponent: -999999999 -divx270 divide 1 1e999999999 -> 1E-999999999 -divx271 divide 1 0.9e999999999 -> 1.11111111E-999999999 Inexact Rounded -divx272 divide 1 0.99e999999999 -> 1.01010101E-999999999 Inexact Rounded -divx273 divide 1 0.999999999e999999999 -> 1.00000000E-999999999 Inexact Rounded -divx274 divide 9e999999999 1 -> 9E+999999999 -divx275 divide 9.9e999999999 1 -> 9.9E+999999999 -divx276 divide 9.99e999999999 1 -> 9.99E+999999999 -divx277 divide 9.99999999e999999999 1 -> 9.99999999E+999999999 - -divx280 divide 0.1 9e-999999999 -> 1.11111111E+999999997 Inexact Rounded -divx281 divide 0.1 99e-999999999 -> 1.01010101E+999999996 Inexact Rounded -divx282 divide 0.1 999e-999999999 -> 1.00100100E+999999995 Inexact Rounded - -divx283 divide 0.1 9e-999999998 -> 1.11111111E+999999996 Inexact Rounded -divx284 divide 0.1 99e-999999998 -> 1.01010101E+999999995 Inexact Rounded -divx285 divide 0.1 999e-999999998 -> 1.00100100E+999999994 Inexact Rounded -divx286 divide 0.1 999e-999999997 -> 1.00100100E+999999993 Inexact Rounded -divx287 divide 0.1 9999e-999999997 -> 1.00010001E+999999992 Inexact Rounded -divx288 divide 0.1 99999e-999999997 -> 1.00001000E+999999991 Inexact Rounded - --- Divide into 0 tests - -divx301 divide 0 7 -> 0 -divx302 divide 0 7E-5 -> 0E+5 -divx303 divide 0 7E-1 -> 0E+1 -divx304 divide 0 7E+1 -> 0.0 -divx305 divide 0 7E+5 -> 0.00000 -divx306 divide 0 7E+6 -> 0.000000 -divx307 divide 0 7E+7 -> 0E-7 -divx308 divide 0 70E-5 -> 0E+5 -divx309 divide 0 70E-1 -> 0E+1 -divx310 divide 0 70E+0 -> 0 -divx311 divide 0 70E+1 -> 0.0 -divx312 divide 0 70E+5 -> 0.00000 -divx313 divide 0 70E+6 -> 0.000000 -divx314 divide 0 70E+7 -> 0E-7 -divx315 divide 0 700E-5 -> 0E+5 -divx316 divide 0 700E-1 -> 0E+1 -divx317 divide 0 700E+0 -> 0 -divx318 divide 0 700E+1 -> 0.0 -divx319 divide 0 700E+5 -> 0.00000 -divx320 divide 0 700E+6 -> 0.000000 -divx321 divide 0 700E+7 -> 0E-7 -divx322 divide 0 700E+77 -> 0E-77 - -divx331 divide 0E-3 7E-5 -> 0E+2 -divx332 divide 0E-3 7E-1 -> 0.00 -divx333 divide 0E-3 7E+1 -> 0.0000 -divx334 divide 0E-3 7E+5 -> 0E-8 -divx335 divide 0E-1 7E-5 -> 0E+4 -divx336 divide 0E-1 7E-1 -> 0 -divx337 divide 0E-1 7E+1 -> 0.00 -divx338 divide 0E-1 7E+5 -> 0.000000 -divx339 divide 0E+1 7E-5 -> 0E+6 -divx340 divide 0E+1 7E-1 -> 0E+2 -divx341 divide 0E+1 7E+1 -> 0 -divx342 divide 0E+1 7E+5 -> 0.0000 -divx343 divide 0E+3 7E-5 -> 0E+8 -divx344 divide 0E+3 7E-1 -> 0E+4 -divx345 divide 0E+3 7E+1 -> 0E+2 -divx346 divide 0E+3 7E+5 -> 0.00 - -maxexponent: 92 -minexponent: -92 -precision: 7 -divx351 divide 0E-92 7E-1 -> 0E-91 -divx352 divide 0E-92 7E+1 -> 0E-93 -divx353 divide 0E-92 7E+5 -> 0E-97 -divx354 divide 0E-92 7E+6 -> 0E-98 -divx355 divide 0E-92 7E+7 -> 0E-98 Clamped -divx356 divide 0E-92 777E-1 -> 0E-91 -divx357 divide 0E-92 777E+1 -> 0E-93 -divx358 divide 0E-92 777E+3 -> 0E-95 -divx359 divide 0E-92 777E+4 -> 0E-96 -divx360 divide 0E-92 777E+5 -> 0E-97 -divx361 divide 0E-92 777E+6 -> 0E-98 -divx362 divide 0E-92 777E+7 -> 0E-98 Clamped -divx363 divide 0E-92 7E+92 -> 0E-98 Clamped - -divx371 divide 0E-92 700E-1 -> 0E-91 -divx372 divide 0E-92 700E+1 -> 0E-93 -divx373 divide 0E-92 700E+3 -> 0E-95 -divx374 divide 0E-92 700E+4 -> 0E-96 -divx375 divide 0E-92 700E+5 -> 0E-97 -divx376 divide 0E-92 700E+6 -> 0E-98 -divx377 divide 0E-92 700E+7 -> 0E-98 Clamped - -divx381 divide 0E+92 7E+1 -> 0E+91 -divx382 divide 0E+92 7E+0 -> 0E+92 -divx383 divide 0E+92 7E-1 -> 0E+92 Clamped -divx384 divide 0E+90 777E+1 -> 0E+89 -divx385 divide 0E+90 777E-1 -> 0E+91 -divx386 divide 0E+90 777E-2 -> 0E+92 -divx387 divide 0E+90 777E-3 -> 0E+92 Clamped -divx388 divide 0E+90 777E-4 -> 0E+92 Clamped - -divx391 divide 0E+90 700E+1 -> 0E+89 -divx392 divide 0E+90 700E-1 -> 0E+91 -divx393 divide 0E+90 700E-2 -> 0E+92 -divx394 divide 0E+90 700E-3 -> 0E+92 Clamped -divx395 divide 0E+90 700E-4 -> 0E+92 Clamped - --- input rounding checks -maxexponent: 999 -minexponent: -999 -precision: 9 -divx401 divide 12345678000 1 -> 1.23456780E+10 Rounded -divx402 divide 1 12345678000 -> 8.10000066E-11 Inexact Rounded -divx403 divide 1234567800 1 -> 1.23456780E+9 Rounded -divx404 divide 1 1234567800 -> 8.10000066E-10 Inexact Rounded -divx405 divide 1234567890 1 -> 1.23456789E+9 Rounded -divx406 divide 1 1234567890 -> 8.10000007E-10 Inexact Rounded -divx407 divide 1234567891 1 -> 1.23456789E+9 Inexact Rounded -divx408 divide 1 1234567891 -> 8.10000007E-10 Inexact Rounded -divx409 divide 12345678901 1 -> 1.23456789E+10 Inexact Rounded -divx410 divide 1 12345678901 -> 8.10000007E-11 Inexact Rounded -divx411 divide 1234567896 1 -> 1.23456790E+9 Inexact Rounded -divx412 divide 1 1234567896 -> 8.10000003E-10 Inexact Rounded -divx413 divide 1 1234567897 -> 8.10000003E-10 Inexact Rounded -divx414 divide 1 1234567898 -> 8.10000002E-10 Inexact Rounded -divx415 divide 1 1234567899 -> 8.10000001E-10 Inexact Rounded -divx416 divide 1 1234567900 -> 8.10000001E-10 Inexact Rounded -divx417 divide 1 1234567901 -> 8.10000000E-10 Inexact Rounded -divx418 divide 1 1234567902 -> 8.09999999E-10 Inexact Rounded --- some longies -divx421 divide 1234567896.000000000000 1 -> 1.23456790E+9 Inexact Rounded -divx422 divide 1 1234567896.000000000000 -> 8.10000003E-10 Inexact Rounded -divx423 divide 1234567896.000000000001 1 -> 1.23456790E+9 Inexact Rounded -divx424 divide 1 1234567896.000000000001 -> 8.10000003E-10 Inexact Rounded -divx425 divide 1234567896.000000000000000000000000000000000000000009 1 -> 1.23456790E+9 Inexact Rounded -divx426 divide 1 1234567896.000000000000000000000000000000000000000009 -> 8.10000003E-10 Inexact Rounded -divx427 divide 1234567897.900010000000000000000000000000000000000009 1 -> 1.23456790E+9 Inexact Rounded -divx428 divide 1 1234567897.900010000000000000000000000000000000000009 -> 8.10000002E-10 Inexact Rounded - -precision: 15 --- still checking... -divx441 divide 12345678000 1 -> 12345678000 -divx442 divide 1 12345678000 -> 8.10000066420005E-11 Inexact Rounded -divx443 divide 1234567800 1 -> 1234567800 -divx444 divide 1 1234567800 -> 8.10000066420005E-10 Inexact Rounded -divx445 divide 1234567890 1 -> 1234567890 -divx446 divide 1 1234567890 -> 8.10000007371000E-10 Inexact Rounded -divx447 divide 1234567891 1 -> 1234567891 -divx448 divide 1 1234567891 -> 8.10000006714900E-10 Inexact Rounded -divx449 divide 12345678901 1 -> 12345678901 -divx450 divide 1 12345678901 -> 8.10000007305390E-11 Inexact Rounded -divx451 divide 1234567896 1 -> 1234567896 -divx452 divide 1 1234567896 -> 8.10000003434400E-10 Inexact Rounded - --- high-lows -divx453 divide 1e+1 1 -> 1E+1 -divx454 divide 1e+1 1.0 -> 1E+1 -divx455 divide 1e+1 1.00 -> 1E+1 -divx456 divide 1e+2 2 -> 5E+1 -divx457 divide 1e+2 2.0 -> 5E+1 -divx458 divide 1e+2 2.00 -> 5E+1 - --- some from IEEE discussions -divx460 divide 3e0 2e0 -> 1.5 -divx461 divide 30e-1 2e0 -> 1.5 -divx462 divide 300e-2 2e0 -> 1.50 -divx464 divide 3000e-3 2e0 -> 1.500 -divx465 divide 3e0 20e-1 -> 1.5 -divx466 divide 30e-1 20e-1 -> 1.5 -divx467 divide 300e-2 20e-1 -> 1.5 -divx468 divide 3000e-3 20e-1 -> 1.50 -divx469 divide 3e0 200e-2 -> 1.5 -divx470 divide 30e-1 200e-2 -> 1.5 -divx471 divide 300e-2 200e-2 -> 1.5 -divx472 divide 3000e-3 200e-2 -> 1.5 -divx473 divide 3e0 2000e-3 -> 1.5 -divx474 divide 30e-1 2000e-3 -> 1.5 -divx475 divide 300e-2 2000e-3 -> 1.5 -divx476 divide 3000e-3 2000e-3 -> 1.5 - --- some reciprocals -divx480 divide 1 1.0E+33 -> 1E-33 -divx481 divide 1 10E+33 -> 1E-34 -divx482 divide 1 1.0E-33 -> 1E+33 -divx483 divide 1 10E-33 -> 1E+32 - --- RMS discussion table -maxexponent: 96 -minexponent: -95 -precision: 7 - -divx484 divide 0e5 1e3 -> 0E+2 -divx485 divide 0e5 2e3 -> 0E+2 -divx486 divide 0e5 10e2 -> 0E+3 -divx487 divide 0e5 20e2 -> 0E+3 -divx488 divide 0e5 100e1 -> 0E+4 -divx489 divide 0e5 200e1 -> 0E+4 - -divx491 divide 1e5 1e3 -> 1E+2 -divx492 divide 1e5 2e3 -> 5E+1 -divx493 divide 1e5 10e2 -> 1E+2 -divx494 divide 1e5 20e2 -> 5E+1 -divx495 divide 1e5 100e1 -> 1E+2 -divx496 divide 1e5 200e1 -> 5E+1 - --- tryzeros cases -precision: 7 -rounding: half_up -maxExponent: 92 -minexponent: -92 -divx497 divide 0E+86 1000E-13 -> 0E+92 Clamped -divx498 divide 0E-98 1000E+13 -> 0E-98 Clamped - -precision: 9 -rounding: half_up -maxExponent: 999 -minexponent: -999 - --- focus on trailing zeros issues -precision: 9 -divx500 divide 1 9.9 -> 0.101010101 Inexact Rounded -precision: 8 -divx501 divide 1 9.9 -> 0.10101010 Inexact Rounded -precision: 7 -divx502 divide 1 9.9 -> 0.1010101 Inexact Rounded -precision: 6 -divx503 divide 1 9.9 -> 0.101010 Inexact Rounded -precision: 9 - -divx511 divide 1 2 -> 0.5 -divx512 divide 1.0 2 -> 0.5 -divx513 divide 1.00 2 -> 0.50 -divx514 divide 1.000 2 -> 0.500 -divx515 divide 1.0000 2 -> 0.5000 -divx516 divide 1.00000 2 -> 0.50000 -divx517 divide 1.000000 2 -> 0.500000 -divx518 divide 1.0000000 2 -> 0.5000000 -divx519 divide 1.00 2.00 -> 0.5 - -divx521 divide 2 1 -> 2 -divx522 divide 2 1.0 -> 2 -divx523 divide 2 1.00 -> 2 -divx524 divide 2 1.000 -> 2 -divx525 divide 2 1.0000 -> 2 -divx526 divide 2 1.00000 -> 2 -divx527 divide 2 1.000000 -> 2 -divx528 divide 2 1.0000000 -> 2 -divx529 divide 2.00 1.00 -> 2 - -divx530 divide 2.40 2 -> 1.20 -divx531 divide 2.40 4 -> 0.60 -divx532 divide 2.40 10 -> 0.24 -divx533 divide 2.40 2.0 -> 1.2 -divx534 divide 2.40 4.0 -> 0.6 -divx535 divide 2.40 10.0 -> 0.24 -divx536 divide 2.40 2.00 -> 1.2 -divx537 divide 2.40 4.00 -> 0.6 -divx538 divide 2.40 10.00 -> 0.24 -divx539 divide 0.9 0.1 -> 9 -divx540 divide 0.9 0.01 -> 9E+1 -divx541 divide 0.9 0.001 -> 9E+2 -divx542 divide 5 2 -> 2.5 -divx543 divide 5 2.0 -> 2.5 -divx544 divide 5 2.00 -> 2.5 -divx545 divide 5 20 -> 0.25 -divx546 divide 5 20.0 -> 0.25 -divx547 divide 2.400 2 -> 1.200 -divx548 divide 2.400 2.0 -> 1.20 -divx549 divide 2.400 2.400 -> 1 - -divx550 divide 240 1 -> 240 -divx551 divide 240 10 -> 24 -divx552 divide 240 100 -> 2.4 -divx553 divide 240 1000 -> 0.24 -divx554 divide 2400 1 -> 2400 -divx555 divide 2400 10 -> 240 -divx556 divide 2400 100 -> 24 -divx557 divide 2400 1000 -> 2.4 - --- +ve exponent -precision: 5 -divx570 divide 2.4E+6 2 -> 1.2E+6 -divx571 divide 2.40E+6 2 -> 1.20E+6 -divx572 divide 2.400E+6 2 -> 1.200E+6 -divx573 divide 2.4000E+6 2 -> 1.2000E+6 -divx574 divide 24E+5 2 -> 1.2E+6 -divx575 divide 240E+4 2 -> 1.20E+6 -divx576 divide 2400E+3 2 -> 1.200E+6 -divx577 divide 24000E+2 2 -> 1.2000E+6 -precision: 6 -divx580 divide 2.4E+6 2 -> 1.2E+6 -divx581 divide 2.40E+6 2 -> 1.20E+6 -divx582 divide 2.400E+6 2 -> 1.200E+6 -divx583 divide 2.4000E+6 2 -> 1.2000E+6 -divx584 divide 24E+5 2 -> 1.2E+6 -divx585 divide 240E+4 2 -> 1.20E+6 -divx586 divide 2400E+3 2 -> 1.200E+6 -divx587 divide 24000E+2 2 -> 1.2000E+6 -precision: 7 -divx590 divide 2.4E+6 2 -> 1.2E+6 -divx591 divide 2.40E+6 2 -> 1.20E+6 -divx592 divide 2.400E+6 2 -> 1.200E+6 -divx593 divide 2.4000E+6 2 -> 1.2000E+6 -divx594 divide 24E+5 2 -> 1.2E+6 -divx595 divide 240E+4 2 -> 1.20E+6 -divx596 divide 2400E+3 2 -> 1.200E+6 -divx597 divide 24000E+2 2 -> 1.2000E+6 -precision: 9 -divx600 divide 2.4E+9 2 -> 1.2E+9 -divx601 divide 2.40E+9 2 -> 1.20E+9 -divx602 divide 2.400E+9 2 -> 1.200E+9 -divx603 divide 2.4000E+9 2 -> 1.2000E+9 -divx604 divide 24E+8 2 -> 1.2E+9 -divx605 divide 240E+7 2 -> 1.20E+9 -divx606 divide 2400E+6 2 -> 1.200E+9 -divx607 divide 24000E+5 2 -> 1.2000E+9 - --- long operand triangle -precision: 33 -divx610 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131097703792 Inexact Rounded -precision: 32 -divx611 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813109770379 Inexact Rounded -precision: 31 -divx612 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81310977038 Inexact Rounded -precision: 30 -divx613 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131097704 Inexact Rounded -precision: 29 -divx614 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813109770 Inexact Rounded -precision: 28 -divx615 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81310977 Inexact Rounded -precision: 27 -divx616 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131098 Inexact Rounded -precision: 26 -divx617 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813110 Inexact Rounded -precision: 25 -divx618 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81311 Inexact Rounded -precision: 24 -divx619 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131 Inexact Rounded -precision: 23 -divx620 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813 Inexact Rounded -precision: 22 -divx621 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81 Inexact Rounded -precision: 21 -divx622 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8 Inexact Rounded -precision: 20 -divx623 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817798 Inexact Rounded -precision: 19 -divx624 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888379681780E+19 Inexact Rounded -precision: 18 -divx625 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114088837968178E+19 Inexact Rounded -precision: 17 -divx626 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011408883796818E+19 Inexact Rounded -precision: 16 -divx627 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888379682E+19 Inexact Rounded -precision: 15 -divx628 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114088837968E+19 Inexact Rounded -precision: 14 -divx629 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011408883797E+19 Inexact Rounded -precision: 13 -divx630 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888380E+19 Inexact Rounded -precision: 12 -divx631 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114088838E+19 Inexact Rounded -precision: 11 -divx632 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011408884E+19 Inexact Rounded -precision: 10 -divx633 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888E+19 Inexact Rounded -precision: 9 -divx634 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114089E+19 Inexact Rounded -precision: 8 -divx635 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011409E+19 Inexact Rounded -precision: 7 -divx636 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101141E+19 Inexact Rounded -precision: 6 -divx637 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114E+19 Inexact Rounded -precision: 5 -divx638 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011E+19 Inexact Rounded -precision: 4 -divx639 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101E+19 Inexact Rounded -precision: 3 -divx640 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10E+19 Inexact Rounded -precision: 2 -divx641 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1E+19 Inexact Rounded -precision: 1 -divx642 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4E+19 Inexact Rounded - --- more zeros, etc. -precision: 16 -rounding: half_up -maxExponent: 384 -minExponent: -383 - -divx731 divide 5.00 1E-3 -> 5.00E+3 -divx732 divide 00.00 0.000 -> NaN Division_undefined -divx733 divide 00.00 0E-3 -> NaN Division_undefined -divx734 divide 0 -0 -> NaN Division_undefined -divx735 divide -0 0 -> NaN Division_undefined -divx736 divide -0 -0 -> NaN Division_undefined - -divx741 divide 0 -1 -> -0 -divx742 divide -0 -1 -> 0 -divx743 divide 0 1 -> 0 -divx744 divide -0 1 -> -0 -divx745 divide -1 0 -> -Infinity Division_by_zero -divx746 divide -1 -0 -> Infinity Division_by_zero -divx747 divide 1 0 -> Infinity Division_by_zero -divx748 divide 1 -0 -> -Infinity Division_by_zero - -divx751 divide 0.0 -1 -> -0.0 -divx752 divide -0.0 -1 -> 0.0 -divx753 divide 0.0 1 -> 0.0 -divx754 divide -0.0 1 -> -0.0 -divx755 divide -1.0 0 -> -Infinity Division_by_zero -divx756 divide -1.0 -0 -> Infinity Division_by_zero -divx757 divide 1.0 0 -> Infinity Division_by_zero -divx758 divide 1.0 -0 -> -Infinity Division_by_zero - -divx761 divide 0 -1.0 -> -0E+1 -divx762 divide -0 -1.0 -> 0E+1 -divx763 divide 0 1.0 -> 0E+1 -divx764 divide -0 1.0 -> -0E+1 -divx765 divide -1 0.0 -> -Infinity Division_by_zero -divx766 divide -1 -0.0 -> Infinity Division_by_zero -divx767 divide 1 0.0 -> Infinity Division_by_zero -divx768 divide 1 -0.0 -> -Infinity Division_by_zero - -divx771 divide 0.0 -1.0 -> -0 -divx772 divide -0.0 -1.0 -> 0 -divx773 divide 0.0 1.0 -> 0 -divx774 divide -0.0 1.0 -> -0 -divx775 divide -1.0 0.0 -> -Infinity Division_by_zero -divx776 divide -1.0 -0.0 -> Infinity Division_by_zero -divx777 divide 1.0 0.0 -> Infinity Division_by_zero -divx778 divide 1.0 -0.0 -> -Infinity Division_by_zero - --- Specials -divx780 divide Inf -Inf -> NaN Invalid_operation -divx781 divide Inf -1000 -> -Infinity -divx782 divide Inf -1 -> -Infinity -divx783 divide Inf -0 -> -Infinity -divx784 divide Inf 0 -> Infinity -divx785 divide Inf 1 -> Infinity -divx786 divide Inf 1000 -> Infinity -divx787 divide Inf Inf -> NaN Invalid_operation -divx788 divide -1000 Inf -> -0E-398 Clamped -divx789 divide -Inf Inf -> NaN Invalid_operation -divx790 divide -1 Inf -> -0E-398 Clamped -divx791 divide -0 Inf -> -0E-398 Clamped -divx792 divide 0 Inf -> 0E-398 Clamped -divx793 divide 1 Inf -> 0E-398 Clamped -divx794 divide 1000 Inf -> 0E-398 Clamped -divx795 divide Inf Inf -> NaN Invalid_operation - -divx800 divide -Inf -Inf -> NaN Invalid_operation -divx801 divide -Inf -1000 -> Infinity -divx802 divide -Inf -1 -> Infinity -divx803 divide -Inf -0 -> Infinity -divx804 divide -Inf 0 -> -Infinity -divx805 divide -Inf 1 -> -Infinity -divx806 divide -Inf 1000 -> -Infinity -divx807 divide -Inf Inf -> NaN Invalid_operation -divx808 divide -1000 Inf -> -0E-398 Clamped -divx809 divide -Inf -Inf -> NaN Invalid_operation -divx810 divide -1 -Inf -> 0E-398 Clamped -divx811 divide -0 -Inf -> 0E-398 Clamped -divx812 divide 0 -Inf -> -0E-398 Clamped -divx813 divide 1 -Inf -> -0E-398 Clamped -divx814 divide 1000 -Inf -> -0E-398 Clamped -divx815 divide Inf -Inf -> NaN Invalid_operation - -divx821 divide NaN -Inf -> NaN -divx822 divide NaN -1000 -> NaN -divx823 divide NaN -1 -> NaN -divx824 divide NaN -0 -> NaN -divx825 divide NaN 0 -> NaN -divx826 divide NaN 1 -> NaN -divx827 divide NaN 1000 -> NaN -divx828 divide NaN Inf -> NaN -divx829 divide NaN NaN -> NaN -divx830 divide -Inf NaN -> NaN -divx831 divide -1000 NaN -> NaN -divx832 divide -1 NaN -> NaN -divx833 divide -0 NaN -> NaN -divx834 divide 0 NaN -> NaN -divx835 divide 1 NaN -> NaN -divx836 divide 1000 NaN -> NaN -divx837 divide Inf NaN -> NaN - -divx841 divide sNaN -Inf -> NaN Invalid_operation -divx842 divide sNaN -1000 -> NaN Invalid_operation -divx843 divide sNaN -1 -> NaN Invalid_operation -divx844 divide sNaN -0 -> NaN Invalid_operation -divx845 divide sNaN 0 -> NaN Invalid_operation -divx846 divide sNaN 1 -> NaN Invalid_operation -divx847 divide sNaN 1000 -> NaN Invalid_operation -divx848 divide sNaN NaN -> NaN Invalid_operation -divx849 divide sNaN sNaN -> NaN Invalid_operation -divx850 divide NaN sNaN -> NaN Invalid_operation -divx851 divide -Inf sNaN -> NaN Invalid_operation -divx852 divide -1000 sNaN -> NaN Invalid_operation -divx853 divide -1 sNaN -> NaN Invalid_operation -divx854 divide -0 sNaN -> NaN Invalid_operation -divx855 divide 0 sNaN -> NaN Invalid_operation -divx856 divide 1 sNaN -> NaN Invalid_operation -divx857 divide 1000 sNaN -> NaN Invalid_operation -divx858 divide Inf sNaN -> NaN Invalid_operation -divx859 divide NaN sNaN -> NaN Invalid_operation - --- propagating NaNs -divx861 divide NaN9 -Inf -> NaN9 -divx862 divide NaN8 1000 -> NaN8 -divx863 divide NaN7 Inf -> NaN7 -divx864 divide NaN6 NaN5 -> NaN6 -divx865 divide -Inf NaN4 -> NaN4 -divx866 divide -1000 NaN3 -> NaN3 -divx867 divide Inf NaN2 -> NaN2 - -divx871 divide sNaN99 -Inf -> NaN99 Invalid_operation -divx872 divide sNaN98 -1 -> NaN98 Invalid_operation -divx873 divide sNaN97 NaN -> NaN97 Invalid_operation -divx874 divide sNaN96 sNaN94 -> NaN96 Invalid_operation -divx875 divide NaN95 sNaN93 -> NaN93 Invalid_operation -divx876 divide -Inf sNaN92 -> NaN92 Invalid_operation -divx877 divide 0 sNaN91 -> NaN91 Invalid_operation -divx878 divide Inf sNaN90 -> NaN90 Invalid_operation -divx879 divide NaN sNaN89 -> NaN89 Invalid_operation - -divx881 divide -NaN9 -Inf -> -NaN9 -divx882 divide -NaN8 1000 -> -NaN8 -divx883 divide -NaN7 Inf -> -NaN7 -divx884 divide -NaN6 -NaN5 -> -NaN6 -divx885 divide -Inf -NaN4 -> -NaN4 -divx886 divide -1000 -NaN3 -> -NaN3 -divx887 divide Inf -NaN2 -> -NaN2 - -divx891 divide -sNaN99 -Inf -> -NaN99 Invalid_operation -divx892 divide -sNaN98 -1 -> -NaN98 Invalid_operation -divx893 divide -sNaN97 NaN -> -NaN97 Invalid_operation -divx894 divide -sNaN96 -sNaN94 -> -NaN96 Invalid_operation -divx895 divide -NaN95 -sNaN93 -> -NaN93 Invalid_operation -divx896 divide -Inf -sNaN92 -> -NaN92 Invalid_operation -divx897 divide 0 -sNaN91 -> -NaN91 Invalid_operation -divx898 divide Inf -sNaN90 -> -NaN90 Invalid_operation -divx899 divide -NaN -sNaN89 -> -NaN89 Invalid_operation - -maxexponent: 999999999 -minexponent: -999999999 - --- Various flavours of divide by 0 -divx901 divide 0 0 -> NaN Division_undefined -divx902 divide 0.0E5 0 -> NaN Division_undefined -divx903 divide 0.000 0 -> NaN Division_undefined -divx904 divide 0.0001 0 -> Infinity Division_by_zero -divx905 divide 0.01 0 -> Infinity Division_by_zero -divx906 divide 0.1 0 -> Infinity Division_by_zero -divx907 divide 1 0 -> Infinity Division_by_zero -divx908 divide 1 0.0 -> Infinity Division_by_zero -divx909 divide 10 0.0 -> Infinity Division_by_zero -divx910 divide 1E+100 0.0 -> Infinity Division_by_zero -divx911 divide 1E+1000 0 -> Infinity Division_by_zero - -divx921 divide -0.0001 0 -> -Infinity Division_by_zero -divx922 divide -0.01 0 -> -Infinity Division_by_zero -divx923 divide -0.1 0 -> -Infinity Division_by_zero -divx924 divide -1 0 -> -Infinity Division_by_zero -divx925 divide -1 0.0 -> -Infinity Division_by_zero -divx926 divide -10 0.0 -> -Infinity Division_by_zero -divx927 divide -1E+100 0.0 -> -Infinity Division_by_zero -divx928 divide -1E+1000 0 -> -Infinity Division_by_zero - -divx931 divide 0.0001 -0 -> -Infinity Division_by_zero -divx932 divide 0.01 -0 -> -Infinity Division_by_zero -divx933 divide 0.1 -0 -> -Infinity Division_by_zero -divx934 divide 1 -0 -> -Infinity Division_by_zero -divx935 divide 1 -0.0 -> -Infinity Division_by_zero -divx936 divide 10 -0.0 -> -Infinity Division_by_zero -divx937 divide 1E+100 -0.0 -> -Infinity Division_by_zero -divx938 divide 1E+1000 -0 -> -Infinity Division_by_zero - -divx941 divide -0.0001 -0 -> Infinity Division_by_zero -divx942 divide -0.01 -0 -> Infinity Division_by_zero -divx943 divide -0.1 -0 -> Infinity Division_by_zero -divx944 divide -1 -0 -> Infinity Division_by_zero -divx945 divide -1 -0.0 -> Infinity Division_by_zero -divx946 divide -10 -0.0 -> Infinity Division_by_zero -divx947 divide -1E+100 -0.0 -> Infinity Division_by_zero -divx948 divide -1E+1000 -0 -> Infinity Division_by_zero - --- overflow and underflow tests -precision: 9 -maxexponent: 999999999 -minexponent: -999999999 -divx951 divide 9E+999999999 +0.23456789012345E-0 -> Infinity Inexact Overflow Rounded -divx952 divide +0.100 9E+999999999 -> 1.111111E-1000000001 Inexact Rounded Underflow Subnormal -divx953 divide 9E-999999999 +9.100 -> 9.8901099E-1000000000 Inexact Rounded Underflow Subnormal -divx954 divide -1.23456789 9E+999999999 -> -1.3717421E-1000000000 Subnormal -divx955 divide -1.23456789012345E-0 9E+999999999 -> -1.3717421E-1000000000 Underflow Subnormal Rounded Inexact -divx956 divide -1.23456789012345E-0 7E+999999999 -> -1.7636684E-1000000000 Inexact Rounded Underflow Subnormal -divx957 divide 9E+999999999 -0.83456789012345E-0 -> -Infinity Inexact Overflow Rounded -divx958 divide -0.100 9E+999999999 -> -1.111111E-1000000001 Subnormal Inexact Rounded Underflow -divx959 divide 9E-999999999 -9.100 -> -9.8901099E-1000000000 Inexact Rounded Underflow Subnormal - --- overflow and underflow (additional edge tests in multiply.decTest) --- 'subnormal' results now possible (all hard underflow or overflow in --- base arithemtic) -divx960 divide 1e-600000000 1e+400000001 -> 1E-1000000001 Subnormal -divx961 divide 1e-600000000 1e+400000002 -> 1E-1000000002 Subnormal -divx962 divide 1e-600000000 1e+400000003 -> 1E-1000000003 Subnormal -divx963 divide 1e-600000000 1e+400000004 -> 1E-1000000004 Subnormal -divx964 divide 1e-600000000 1e+400000005 -> 1E-1000000005 Subnormal -divx965 divide 1e-600000000 1e+400000006 -> 1E-1000000006 Subnormal -divx966 divide 1e-600000000 1e+400000007 -> 1E-1000000007 Subnormal -divx967 divide 1e-600000000 1e+400000008 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -divx968 divide 1e-600000000 1e+400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -divx969 divide 1e-600000000 1e+400000010 -> 0E-1000000007 Underflow Subnormal Inexact Rounded --- [no equivalent of 'subnormal' for overflow] -divx970 divide 1e+600000000 1e-400000001 -> Infinity Overflow Inexact Rounded -divx971 divide 1e+600000000 1e-400000002 -> Infinity Overflow Inexact Rounded -divx972 divide 1e+600000000 1e-400000003 -> Infinity Overflow Inexact Rounded -divx973 divide 1e+600000000 1e-400000004 -> Infinity Overflow Inexact Rounded -divx974 divide 1e+600000000 1e-400000005 -> Infinity Overflow Inexact Rounded -divx975 divide 1e+600000000 1e-400000006 -> Infinity Overflow Inexact Rounded -divx976 divide 1e+600000000 1e-400000007 -> Infinity Overflow Inexact Rounded -divx977 divide 1e+600000000 1e-400000008 -> Infinity Overflow Inexact Rounded -divx978 divide 1e+600000000 1e-400000009 -> Infinity Overflow Inexact Rounded -divx979 divide 1e+600000000 1e-400000010 -> Infinity Overflow Inexact Rounded - --- Sign after overflow and underflow -divx980 divide 1e-600000000 1e+400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -divx981 divide 1e-600000000 -1e+400000009 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -divx982 divide -1e-600000000 1e+400000009 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -divx983 divide -1e-600000000 -1e+400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -divx984 divide 1e+600000000 1e-400000009 -> Infinity Overflow Inexact Rounded -divx985 divide 1e+600000000 -1e-400000009 -> -Infinity Overflow Inexact Rounded -divx986 divide -1e+600000000 1e-400000009 -> -Infinity Overflow Inexact Rounded -divx987 divide -1e+600000000 -1e-400000009 -> Infinity Overflow Inexact Rounded - --- Long operand overflow may be a different path -precision: 3 -divx990 divide 1000 9.999E-999999999 -> Infinity Inexact Overflow Rounded -divx991 divide 1000 -9.999E-999999999 -> -Infinity Inexact Overflow Rounded -divx992 divide 9.999E+999999999 0.01 -> Infinity Inexact Overflow Rounded -divx993 divide -9.999E+999999999 0.01 -> -Infinity Inexact Overflow Rounded - --- check for double-rounded subnormals -precision: 5 -maxexponent: 79 -minexponent: -79 -divx1001 divide 1.52444E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow -divx1002 divide 1.52445E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow -divx1003 divide 1.52446E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow - --- a rounding problem in one implementation -precision: 34 -rounding: half_up -maxExponent: 6144 -minExponent: -6143 --- Unbounded answer to 40 digits: --- 1.465811965811965811965811965811965811966E+7000 -divx1010 divide 343E6000 234E-1000 -> Infinity Overflow Inexact Rounded - --- Null tests -divx9998 divide 10 # -> NaN Invalid_operation -divx9999 divide # 10 -> NaN Invalid_operation - diff --git a/sys/lib/python/test/decimaltestdata/divideint.decTest b/sys/lib/python/test/decimaltestdata/divideint.decTest deleted file mode 100644 index 7c31297b2..000000000 --- a/sys/lib/python/test/decimaltestdata/divideint.decTest +++ /dev/null @@ -1,470 +0,0 @@ ------------------------------------------------------------------------- --- divideint.decTest -- decimal integer division -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - -dvix001 divideint 1 1 -> 1 -dvix002 divideint 2 1 -> 2 -dvix003 divideint 1 2 -> 0 -dvix004 divideint 2 2 -> 1 -dvix005 divideint 0 1 -> 0 -dvix006 divideint 0 2 -> 0 -dvix007 divideint 1 3 -> 0 -dvix008 divideint 2 3 -> 0 -dvix009 divideint 3 3 -> 1 - -dvix010 divideint 2.4 1 -> 2 -dvix011 divideint 2.4 -1 -> -2 -dvix012 divideint -2.4 1 -> -2 -dvix013 divideint -2.4 -1 -> 2 -dvix014 divideint 2.40 1 -> 2 -dvix015 divideint 2.400 1 -> 2 -dvix016 divideint 2.4 2 -> 1 -dvix017 divideint 2.400 2 -> 1 -dvix018 divideint 2. 2 -> 1 -dvix019 divideint 20 20 -> 1 - -dvix020 divideint 187 187 -> 1 -dvix021 divideint 5 2 -> 2 -dvix022 divideint 5 2.0 -> 2 -dvix023 divideint 5 2.000 -> 2 -dvix024 divideint 5 0.200 -> 25 -dvix025 divideint 5 0.200 -> 25 - -dvix030 divideint 1 2 -> 0 -dvix031 divideint 1 4 -> 0 -dvix032 divideint 1 8 -> 0 -dvix033 divideint 1 16 -> 0 -dvix034 divideint 1 32 -> 0 -dvix035 divideint 1 64 -> 0 -dvix040 divideint 1 -2 -> -0 -dvix041 divideint 1 -4 -> -0 -dvix042 divideint 1 -8 -> -0 -dvix043 divideint 1 -16 -> -0 -dvix044 divideint 1 -32 -> -0 -dvix045 divideint 1 -64 -> -0 -dvix050 divideint -1 2 -> -0 -dvix051 divideint -1 4 -> -0 -dvix052 divideint -1 8 -> -0 -dvix053 divideint -1 16 -> -0 -dvix054 divideint -1 32 -> -0 -dvix055 divideint -1 64 -> -0 -dvix060 divideint -1 -2 -> 0 -dvix061 divideint -1 -4 -> 0 -dvix062 divideint -1 -8 -> 0 -dvix063 divideint -1 -16 -> 0 -dvix064 divideint -1 -32 -> 0 -dvix065 divideint -1 -64 -> 0 - --- similar with powers of ten -dvix160 divideint 1 1 -> 1 -dvix161 divideint 1 10 -> 0 -dvix162 divideint 1 100 -> 0 -dvix163 divideint 1 1000 -> 0 -dvix164 divideint 1 10000 -> 0 -dvix165 divideint 1 100000 -> 0 -dvix166 divideint 1 1000000 -> 0 -dvix167 divideint 1 10000000 -> 0 -dvix168 divideint 1 100000000 -> 0 -dvix170 divideint 1 -1 -> -1 -dvix171 divideint 1 -10 -> -0 -dvix172 divideint 1 -100 -> -0 -dvix173 divideint 1 -1000 -> -0 -dvix174 divideint 1 -10000 -> -0 -dvix175 divideint 1 -100000 -> -0 -dvix176 divideint 1 -1000000 -> -0 -dvix177 divideint 1 -10000000 -> -0 -dvix178 divideint 1 -100000000 -> -0 -dvix180 divideint -1 1 -> -1 -dvix181 divideint -1 10 -> -0 -dvix182 divideint -1 100 -> -0 -dvix183 divideint -1 1000 -> -0 -dvix184 divideint -1 10000 -> -0 -dvix185 divideint -1 100000 -> -0 -dvix186 divideint -1 1000000 -> -0 -dvix187 divideint -1 10000000 -> -0 -dvix188 divideint -1 100000000 -> -0 -dvix190 divideint -1 -1 -> 1 -dvix191 divideint -1 -10 -> 0 -dvix192 divideint -1 -100 -> 0 -dvix193 divideint -1 -1000 -> 0 -dvix194 divideint -1 -10000 -> 0 -dvix195 divideint -1 -100000 -> 0 -dvix196 divideint -1 -1000000 -> 0 -dvix197 divideint -1 -10000000 -> 0 -dvix198 divideint -1 -100000000 -> 0 - --- some long operand cases here -dvix070 divideint 999999999 1 -> 999999999 -dvix071 divideint 999999999.4 1 -> 999999999 -dvix072 divideint 999999999.5 1 -> 999999999 -dvix073 divideint 999999999.9 1 -> 999999999 -dvix074 divideint 999999999.999 1 -> 999999999 -precision: 6 -dvix080 divideint 999999999 1 -> NaN Division_impossible -dvix081 divideint 99999999 1 -> NaN Division_impossible -dvix082 divideint 9999999 1 -> NaN Division_impossible -dvix083 divideint 999999 1 -> 999999 -dvix084 divideint 99999 1 -> 99999 -dvix085 divideint 9999 1 -> 9999 -dvix086 divideint 999 1 -> 999 -dvix087 divideint 99 1 -> 99 -dvix088 divideint 9 1 -> 9 - -precision: 9 -dvix090 divideint 0. 1 -> 0 -dvix091 divideint .0 1 -> 0 -dvix092 divideint 0.00 1 -> 0 -dvix093 divideint 0.00E+9 1 -> 0 -dvix094 divideint 0.0000E-50 1 -> 0 - -dvix100 divideint 1 1 -> 1 -dvix101 divideint 1 2 -> 0 -dvix102 divideint 1 3 -> 0 -dvix103 divideint 1 4 -> 0 -dvix104 divideint 1 5 -> 0 -dvix105 divideint 1 6 -> 0 -dvix106 divideint 1 7 -> 0 -dvix107 divideint 1 8 -> 0 -dvix108 divideint 1 9 -> 0 -dvix109 divideint 1 10 -> 0 -dvix110 divideint 1 1 -> 1 -dvix111 divideint 2 1 -> 2 -dvix112 divideint 3 1 -> 3 -dvix113 divideint 4 1 -> 4 -dvix114 divideint 5 1 -> 5 -dvix115 divideint 6 1 -> 6 -dvix116 divideint 7 1 -> 7 -dvix117 divideint 8 1 -> 8 -dvix118 divideint 9 1 -> 9 -dvix119 divideint 10 1 -> 10 - --- from DiagBigDecimal -dvix131 divideint 101.3 1 -> 101 -dvix132 divideint 101.0 1 -> 101 -dvix133 divideint 101.3 3 -> 33 -dvix134 divideint 101.0 3 -> 33 -dvix135 divideint 2.4 1 -> 2 -dvix136 divideint 2.400 1 -> 2 -dvix137 divideint 18 18 -> 1 -dvix138 divideint 1120 1000 -> 1 -dvix139 divideint 2.4 2 -> 1 -dvix140 divideint 2.400 2 -> 1 -dvix141 divideint 0.5 2.000 -> 0 -dvix142 divideint 8.005 7 -> 1 -dvix143 divideint 5 2 -> 2 -dvix144 divideint 0 2 -> 0 -dvix145 divideint 0.00 2 -> 0 - --- Others -dvix150 divideint 12345 4.999 -> 2469 -dvix151 divideint 12345 4.99 -> 2473 -dvix152 divideint 12345 4.9 -> 2519 -dvix153 divideint 12345 5 -> 2469 -dvix154 divideint 12345 5.1 -> 2420 -dvix155 divideint 12345 5.01 -> 2464 -dvix156 divideint 12345 5.001 -> 2468 -dvix157 divideint 101 7.6 -> 13 - --- Various flavours of divideint by 0 -maxexponent: 999999999 -minexponent: -999999999 -dvix201 divideint 0 0 -> NaN Division_undefined -dvix202 divideint 0.0E5 0 -> NaN Division_undefined -dvix203 divideint 0.000 0 -> NaN Division_undefined -dvix204 divideint 0.0001 0 -> Infinity Division_by_zero -dvix205 divideint 0.01 0 -> Infinity Division_by_zero -dvix206 divideint 0.1 0 -> Infinity Division_by_zero -dvix207 divideint 1 0 -> Infinity Division_by_zero -dvix208 divideint 1 0.0 -> Infinity Division_by_zero -dvix209 divideint 10 0.0 -> Infinity Division_by_zero -dvix210 divideint 1E+100 0.0 -> Infinity Division_by_zero -dvix211 divideint 1E+1000 0 -> Infinity Division_by_zero -dvix214 divideint -0.0001 0 -> -Infinity Division_by_zero -dvix215 divideint -0.01 0 -> -Infinity Division_by_zero -dvix216 divideint -0.1 0 -> -Infinity Division_by_zero -dvix217 divideint -1 0 -> -Infinity Division_by_zero -dvix218 divideint -1 0.0 -> -Infinity Division_by_zero -dvix219 divideint -10 0.0 -> -Infinity Division_by_zero -dvix220 divideint -1E+100 0.0 -> -Infinity Division_by_zero -dvix221 divideint -1E+1000 0 -> -Infinity Division_by_zero - --- test some cases that are close to exponent overflow -maxexponent: 999999999 -minexponent: -999999999 -dvix270 divideint 1 1e999999999 -> 0 -dvix271 divideint 1 0.9e999999999 -> 0 -dvix272 divideint 1 0.99e999999999 -> 0 -dvix273 divideint 1 0.999999999e999999999 -> 0 -dvix274 divideint 9e999999999 1 -> NaN Division_impossible -dvix275 divideint 9.9e999999999 1 -> NaN Division_impossible -dvix276 divideint 9.99e999999999 1 -> NaN Division_impossible -dvix277 divideint 9.99999999e999999999 1 -> NaN Division_impossible - -dvix280 divideint 0.1 9e-999999999 -> NaN Division_impossible -dvix281 divideint 0.1 99e-999999999 -> NaN Division_impossible -dvix282 divideint 0.1 999e-999999999 -> NaN Division_impossible - -dvix283 divideint 0.1 9e-999999998 -> NaN Division_impossible -dvix284 divideint 0.1 99e-999999998 -> NaN Division_impossible -dvix285 divideint 0.1 999e-999999998 -> NaN Division_impossible -dvix286 divideint 0.1 999e-999999997 -> NaN Division_impossible -dvix287 divideint 0.1 9999e-999999997 -> NaN Division_impossible -dvix288 divideint 0.1 99999e-999999997 -> NaN Division_impossible - - --- overflow and underflow tests [from divide] -maxexponent: 999999999 -minexponent: -999999999 -dvix330 divideint +1.23456789012345E-0 9E+999999999 -> 0 -dvix331 divideint 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible -dvix332 divideint +0.100 9E+999999999 -> 0 -dvix333 divideint 9E-999999999 +9.100 -> 0 -dvix335 divideint -1.23456789012345E-0 9E+999999999 -> -0 -dvix336 divideint 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible -dvix337 divideint -0.100 9E+999999999 -> -0 -dvix338 divideint 9E-999999999 -9.100 -> -0 - --- long operand checks -maxexponent: 999 -minexponent: -999 -precision: 9 -dvix401 divideint 12345678000 100 -> 123456780 -dvix402 divideint 1 12345678000 -> 0 -dvix403 divideint 1234567800 10 -> 123456780 -dvix404 divideint 1 1234567800 -> 0 -dvix405 divideint 1234567890 10 -> 123456789 -dvix406 divideint 1 1234567890 -> 0 -dvix407 divideint 1234567891 10 -> 123456789 -dvix408 divideint 1 1234567891 -> 0 -dvix409 divideint 12345678901 100 -> 123456789 -dvix410 divideint 1 12345678901 -> 0 -dvix411 divideint 1234567896 10 -> 123456789 -dvix412 divideint 1 1234567896 -> 0 -dvix413 divideint 12345678948 100 -> 123456789 -dvix414 divideint 12345678949 100 -> 123456789 -dvix415 divideint 12345678950 100 -> 123456789 -dvix416 divideint 12345678951 100 -> 123456789 -dvix417 divideint 12345678999 100 -> 123456789 - -precision: 15 -dvix441 divideint 12345678000 1 -> 12345678000 -dvix442 divideint 1 12345678000 -> 0 -dvix443 divideint 1234567800 1 -> 1234567800 -dvix444 divideint 1 1234567800 -> 0 -dvix445 divideint 1234567890 1 -> 1234567890 -dvix446 divideint 1 1234567890 -> 0 -dvix447 divideint 1234567891 1 -> 1234567891 -dvix448 divideint 1 1234567891 -> 0 -dvix449 divideint 12345678901 1 -> 12345678901 -dvix450 divideint 1 12345678901 -> 0 -dvix451 divideint 1234567896 1 -> 1234567896 -dvix452 divideint 1 1234567896 -> 0 - -precision: 9 -rounding: half_up -maxExponent: 999 -minexponent: -999 - --- more zeros, etc. -dvix531 divideint 5.00 1E-3 -> 5000 -dvix532 divideint 00.00 0.000 -> NaN Division_undefined -dvix533 divideint 00.00 0E-3 -> NaN Division_undefined -dvix534 divideint 0 -0 -> NaN Division_undefined -dvix535 divideint -0 0 -> NaN Division_undefined -dvix536 divideint -0 -0 -> NaN Division_undefined - -dvix541 divideint 0 -1 -> -0 -dvix542 divideint -0 -1 -> 0 -dvix543 divideint 0 1 -> 0 -dvix544 divideint -0 1 -> -0 -dvix545 divideint -1 0 -> -Infinity Division_by_zero -dvix546 divideint -1 -0 -> Infinity Division_by_zero -dvix547 divideint 1 0 -> Infinity Division_by_zero -dvix548 divideint 1 -0 -> -Infinity Division_by_zero - -dvix551 divideint 0.0 -1 -> -0 -dvix552 divideint -0.0 -1 -> 0 -dvix553 divideint 0.0 1 -> 0 -dvix554 divideint -0.0 1 -> -0 -dvix555 divideint -1.0 0 -> -Infinity Division_by_zero -dvix556 divideint -1.0 -0 -> Infinity Division_by_zero -dvix557 divideint 1.0 0 -> Infinity Division_by_zero -dvix558 divideint 1.0 -0 -> -Infinity Division_by_zero - -dvix561 divideint 0 -1.0 -> -0 -dvix562 divideint -0 -1.0 -> 0 -dvix563 divideint 0 1.0 -> 0 -dvix564 divideint -0 1.0 -> -0 -dvix565 divideint -1 0.0 -> -Infinity Division_by_zero -dvix566 divideint -1 -0.0 -> Infinity Division_by_zero -dvix567 divideint 1 0.0 -> Infinity Division_by_zero -dvix568 divideint 1 -0.0 -> -Infinity Division_by_zero - -dvix571 divideint 0.0 -1.0 -> -0 -dvix572 divideint -0.0 -1.0 -> 0 -dvix573 divideint 0.0 1.0 -> 0 -dvix574 divideint -0.0 1.0 -> -0 -dvix575 divideint -1.0 0.0 -> -Infinity Division_by_zero -dvix576 divideint -1.0 -0.0 -> Infinity Division_by_zero -dvix577 divideint 1.0 0.0 -> Infinity Division_by_zero -dvix578 divideint 1.0 -0.0 -> -Infinity Division_by_zero - --- Specials -dvix580 divideint Inf -Inf -> NaN Invalid_operation -dvix581 divideint Inf -1000 -> -Infinity -dvix582 divideint Inf -1 -> -Infinity -dvix583 divideint Inf -0 -> -Infinity -dvix584 divideint Inf 0 -> Infinity -dvix585 divideint Inf 1 -> Infinity -dvix586 divideint Inf 1000 -> Infinity -dvix587 divideint Inf Inf -> NaN Invalid_operation -dvix588 divideint -1000 Inf -> -0 -dvix589 divideint -Inf Inf -> NaN Invalid_operation -dvix590 divideint -1 Inf -> -0 -dvix591 divideint -0 Inf -> -0 -dvix592 divideint 0 Inf -> 0 -dvix593 divideint 1 Inf -> 0 -dvix594 divideint 1000 Inf -> 0 -dvix595 divideint Inf Inf -> NaN Invalid_operation - -dvix600 divideint -Inf -Inf -> NaN Invalid_operation -dvix601 divideint -Inf -1000 -> Infinity -dvix602 divideint -Inf -1 -> Infinity -dvix603 divideint -Inf -0 -> Infinity -dvix604 divideint -Inf 0 -> -Infinity -dvix605 divideint -Inf 1 -> -Infinity -dvix606 divideint -Inf 1000 -> -Infinity -dvix607 divideint -Inf Inf -> NaN Invalid_operation -dvix608 divideint -1000 Inf -> -0 -dvix609 divideint -Inf -Inf -> NaN Invalid_operation -dvix610 divideint -1 -Inf -> 0 -dvix611 divideint -0 -Inf -> 0 -dvix612 divideint 0 -Inf -> -0 -dvix613 divideint 1 -Inf -> -0 -dvix614 divideint 1000 -Inf -> -0 -dvix615 divideint Inf -Inf -> NaN Invalid_operation - -dvix621 divideint NaN -Inf -> NaN -dvix622 divideint NaN -1000 -> NaN -dvix623 divideint NaN -1 -> NaN -dvix624 divideint NaN -0 -> NaN -dvix625 divideint NaN 0 -> NaN -dvix626 divideint NaN 1 -> NaN -dvix627 divideint NaN 1000 -> NaN -dvix628 divideint NaN Inf -> NaN -dvix629 divideint NaN NaN -> NaN -dvix630 divideint -Inf NaN -> NaN -dvix631 divideint -1000 NaN -> NaN -dvix632 divideint -1 NaN -> NaN -dvix633 divideint -0 NaN -> NaN -dvix634 divideint 0 NaN -> NaN -dvix635 divideint 1 NaN -> NaN -dvix636 divideint 1000 NaN -> NaN -dvix637 divideint Inf NaN -> NaN - -dvix641 divideint sNaN -Inf -> NaN Invalid_operation -dvix642 divideint sNaN -1000 -> NaN Invalid_operation -dvix643 divideint sNaN -1 -> NaN Invalid_operation -dvix644 divideint sNaN -0 -> NaN Invalid_operation -dvix645 divideint sNaN 0 -> NaN Invalid_operation -dvix646 divideint sNaN 1 -> NaN Invalid_operation -dvix647 divideint sNaN 1000 -> NaN Invalid_operation -dvix648 divideint sNaN NaN -> NaN Invalid_operation -dvix649 divideint sNaN sNaN -> NaN Invalid_operation -dvix650 divideint NaN sNaN -> NaN Invalid_operation -dvix651 divideint -Inf sNaN -> NaN Invalid_operation -dvix652 divideint -1000 sNaN -> NaN Invalid_operation -dvix653 divideint -1 sNaN -> NaN Invalid_operation -dvix654 divideint -0 sNaN -> NaN Invalid_operation -dvix655 divideint 0 sNaN -> NaN Invalid_operation -dvix656 divideint 1 sNaN -> NaN Invalid_operation -dvix657 divideint 1000 sNaN -> NaN Invalid_operation -dvix658 divideint Inf sNaN -> NaN Invalid_operation -dvix659 divideint NaN sNaN -> NaN Invalid_operation - --- propagating NaNs -dvix661 divideint NaN9 -Inf -> NaN9 -dvix662 divideint NaN8 1000 -> NaN8 -dvix663 divideint NaN7 Inf -> NaN7 -dvix664 divideint -NaN6 NaN5 -> -NaN6 -dvix665 divideint -Inf NaN4 -> NaN4 -dvix666 divideint -1000 NaN3 -> NaN3 -dvix667 divideint Inf -NaN2 -> -NaN2 - -dvix671 divideint -sNaN99 -Inf -> -NaN99 Invalid_operation -dvix672 divideint sNaN98 -1 -> NaN98 Invalid_operation -dvix673 divideint sNaN97 NaN -> NaN97 Invalid_operation -dvix674 divideint sNaN96 sNaN94 -> NaN96 Invalid_operation -dvix675 divideint NaN95 sNaN93 -> NaN93 Invalid_operation -dvix676 divideint -Inf sNaN92 -> NaN92 Invalid_operation -dvix677 divideint 0 sNaN91 -> NaN91 Invalid_operation -dvix678 divideint Inf -sNaN90 -> -NaN90 Invalid_operation -dvix679 divideint NaN sNaN89 -> NaN89 Invalid_operation - --- some long operand cases again -precision: 8 -dvix710 divideint 100000001 1 -> NaN Division_impossible -dvix711 divideint 100000000.4 1 -> NaN Division_impossible -dvix712 divideint 100000000.5 1 -> NaN Division_impossible -dvix713 divideint 100000000.9 1 -> NaN Division_impossible -dvix714 divideint 100000000.999 1 -> NaN Division_impossible -precision: 6 -dvix720 divideint 100000000 1 -> NaN Division_impossible -dvix721 divideint 10000000 1 -> NaN Division_impossible -dvix722 divideint 1000000 1 -> NaN Division_impossible -dvix723 divideint 100000 1 -> 100000 -dvix724 divideint 10000 1 -> 10000 -dvix725 divideint 1000 1 -> 1000 -dvix726 divideint 100 1 -> 100 -dvix727 divideint 10 1 -> 10 -dvix728 divideint 1 1 -> 1 -dvix729 divideint 1 10 -> 0 - -precision: 9 -maxexponent: 999999999 -minexponent: -999999999 -dvix732 divideint 1 0.99e999999999 -> 0 -dvix733 divideint 1 0.999999999e999999999 -> 0 -dvix734 divideint 9e999999999 1 -> NaN Division_impossible -dvix735 divideint 9.9e999999999 1 -> NaN Division_impossible -dvix736 divideint 9.99e999999999 1 -> NaN Division_impossible -dvix737 divideint 9.99999999e999999999 1 -> NaN Division_impossible - -dvix740 divideint 0.1 9e-999999999 -> NaN Division_impossible -dvix741 divideint 0.1 99e-999999999 -> NaN Division_impossible -dvix742 divideint 0.1 999e-999999999 -> NaN Division_impossible - -dvix743 divideint 0.1 9e-999999998 -> NaN Division_impossible -dvix744 divideint 0.1 99e-999999998 -> NaN Division_impossible -dvix745 divideint 0.1 999e-999999998 -> NaN Division_impossible -dvix746 divideint 0.1 999e-999999997 -> NaN Division_impossible -dvix747 divideint 0.1 9999e-999999997 -> NaN Division_impossible -dvix748 divideint 0.1 99999e-999999997 -> NaN Division_impossible - - --- Null tests -dvix900 divideint 10 # -> NaN Invalid_operation -dvix901 divideint # 10 -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/inexact.decTest b/sys/lib/python/test/decimaltestdata/inexact.decTest deleted file mode 100644 index 3c435bd6b..000000000 --- a/sys/lib/python/test/decimaltestdata/inexact.decTest +++ /dev/null @@ -1,215 +0,0 @@ ------------------------------------------------------------------------- --- inexact.decTest -- decimal inexact and rounded edge cases -- --- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 999 -minexponent: -999 - -inx001 add 1 1 -> 2 -inx002 add 123456789 0 -> 123456789 -inx003 add 123456789 0.0 -> 123456789 Rounded -inx004 add 123456789 0.00 -> 123456789 Rounded -inx005 add 123456789 1 -> 123456790 -inx006 add 123456789 0.1 -> 123456789 Inexact Rounded -inx007 add 123456789 0.01 -> 123456789 Inexact Rounded -inx008 add 123456789 0.001 -> 123456789 Inexact Rounded -inx009 add 123456789 0.000001 -> 123456789 Inexact Rounded -inx010 add 123456789 0.000000001 -> 123456789 Inexact Rounded -inx011 add 123456789 0.000000000001 -> 123456789 Inexact Rounded - -inx012 add 123456789 0.9 -> 123456790 Inexact Rounded -inx013 add 123456789 0.09 -> 123456789 Inexact Rounded -inx014 add 123456789 0.009 -> 123456789 Inexact Rounded -inx015 add 123456789 0.000009 -> 123456789 Inexact Rounded -inx016 add 123456789 0.000000009 -> 123456789 Inexact Rounded -inx017 add 123456789 0.000000000009 -> 123456789 Inexact Rounded - -inx021 add 1 -1 -> 0 -inx022 add 123456789 -0 -> 123456789 -inx023 add 123456789 -0.0 -> 123456789 Rounded -inx024 add 123456789 -0.00 -> 123456789 Rounded -inx025 add 123456789 -1 -> 123456788 -inx026 add 123456789 -0.1 -> 123456789 Inexact Rounded -inx027 add 123456789 -0.01 -> 123456789 Inexact Rounded -inx028 add 123456789 -0.001 -> 123456789 Inexact Rounded -inx029 add 123456789 -0.000001 -> 123456789 Inexact Rounded -inx030 add 123456789 -0.000000001 -> 123456789 Inexact Rounded -inx031 add 123456789 -0.000000000001 -> 123456789 Inexact Rounded -inx032 add 123456789 -0.9 -> 123456788 Inexact Rounded -inx033 add 123456789 -0.09 -> 123456789 Inexact Rounded -inx034 add 123456789 -0.009 -> 123456789 Inexact Rounded -inx035 add 123456789 -0.000009 -> 123456789 Inexact Rounded -inx036 add 123456789 -0.000000009 -> 123456789 Inexact Rounded -inx037 add 123456789 -0.000000000009 -> 123456789 Inexact Rounded - -inx042 add 0 123456789 -> 123456789 -inx043 add 0.0 123456789 -> 123456789 Rounded -inx044 add 0.00 123456789 -> 123456789 Rounded -inx045 add 1 123456789 -> 123456790 -inx046 add 0.1 123456789 -> 123456789 Inexact Rounded -inx047 add 0.01 123456789 -> 123456789 Inexact Rounded -inx048 add 0.001 123456789 -> 123456789 Inexact Rounded -inx049 add 0.000001 123456789 -> 123456789 Inexact Rounded -inx050 add 0.000000001 123456789 -> 123456789 Inexact Rounded -inx051 add 0.000000000001 123456789 -> 123456789 Inexact Rounded -inx052 add 0.9 123456789 -> 123456790 Inexact Rounded -inx053 add 0.09 123456789 -> 123456789 Inexact Rounded -inx054 add 0.009 123456789 -> 123456789 Inexact Rounded -inx055 add 0.000009 123456789 -> 123456789 Inexact Rounded -inx056 add 0.000000009 123456789 -> 123456789 Inexact Rounded -inx057 add 0.000000000009 123456789 -> 123456789 Inexact Rounded - -inx062 add -0 123456789 -> 123456789 -inx063 add -0.0 123456789 -> 123456789 Rounded -inx064 add -0.00 123456789 -> 123456789 Rounded -inx065 add -1 123456789 -> 123456788 -inx066 add -0.1 123456789 -> 123456789 Inexact Rounded -inx067 add -0.01 123456789 -> 123456789 Inexact Rounded -inx068 add -0.001 123456789 -> 123456789 Inexact Rounded -inx069 add -0.000001 123456789 -> 123456789 Inexact Rounded -inx070 add -0.000000001 123456789 -> 123456789 Inexact Rounded -inx071 add -0.000000000001 123456789 -> 123456789 Inexact Rounded -inx072 add -0.9 123456789 -> 123456788 Inexact Rounded -inx073 add -0.09 123456789 -> 123456789 Inexact Rounded -inx074 add -0.009 123456789 -> 123456789 Inexact Rounded -inx075 add -0.000009 123456789 -> 123456789 Inexact Rounded -inx076 add -0.000000009 123456789 -> 123456789 Inexact Rounded -inx077 add -0.000000000009 123456789 -> 123456789 Inexact Rounded - --- some boundaries -inx081 add 999999999 0 -> 999999999 -inx082 add 0.999999999 0.000000000 -> 0.999999999 -inx083 add 999999999 1 -> 1.00000000E+9 Rounded -inx084 add 0.999999999 0.000000001 -> 1.00000000 Rounded -inx085 add 999999999 2 -> 1.00000000E+9 Inexact Rounded -inx086 add 0.999999999 0.000000002 -> 1.00000000 Inexact Rounded -inx087 add 999999999 3 -> 1.00000000E+9 Inexact Rounded -inx089 add 0.999999999 0.000000003 -> 1.00000000 Inexact Rounded - --- minus, plus, and subtract all assumed to work like add. - --- multiply -precision: 8 -inx101 multiply 1000 1000 -> 1000000 -inx102 multiply 9000 9000 -> 81000000 -inx103 multiply 9999 9999 -> 99980001 -inx104 multiply 1000 10000 -> 10000000 -inx105 multiply 10000 10000 -> 1.0000000E+8 Rounded -inx106 multiply 10001 10000 -> 1.0001000E+8 Rounded -inx107 multiply 10001 10001 -> 1.0002000E+8 Inexact Rounded -inx108 multiply 10101 10001 -> 1.0102010E+8 Inexact Rounded -inx109 multiply 10001 10101 -> 1.0102010E+8 Inexact Rounded - --- divide -precision: 4 -inx201 divide 1000 1000 -> 1 -inx202 divide 1000 1 -> 1000 -inx203 divide 1000 2 -> 500 -inx204 divide 1000 3 -> 333.3 Inexact Rounded -inx205 divide 1000 4 -> 250 -inx206 divide 1000 5 -> 200 -inx207 divide 1000 6 -> 166.7 Inexact Rounded -inx208 divide 1000 7 -> 142.9 Inexact Rounded -inx209 divide 1000 8 -> 125 -inx210 divide 1000 9 -> 111.1 Inexact Rounded -inx211 divide 1000 10 -> 100 - -inx220 divide 1 1 -> 1 -inx221 divide 1 2 -> 0.5 -inx222 divide 1 4 -> 0.25 -inx223 divide 1 8 -> 0.125 -inx224 divide 1 16 -> 0.0625 -inx225 divide 1 32 -> 0.03125 -inx226 divide 1 64 -> 0.01563 Inexact Rounded -inx227 divide 1 128 -> 0.007813 Inexact Rounded - -precision: 5 -inx230 divide 1 1 -> 1 -inx231 divide 1 2 -> 0.5 -inx232 divide 1 4 -> 0.25 -inx233 divide 1 8 -> 0.125 -inx234 divide 1 16 -> 0.0625 -inx235 divide 1 32 -> 0.03125 -inx236 divide 1 64 -> 0.015625 -inx237 divide 1 128 -> 0.0078125 - -precision: 3 -inx240 divide 1 1 -> 1 -inx241 divide 1 2 -> 0.5 -inx242 divide 1 4 -> 0.25 -inx243 divide 1 8 -> 0.125 -inx244 divide 1 16 -> 0.0625 -inx245 divide 1 32 -> 0.0313 Inexact Rounded -inx246 divide 1 64 -> 0.0156 Inexact Rounded -inx247 divide 1 128 -> 0.00781 Inexact Rounded - -precision: 2 -inx250 divide 1 1 -> 1 -inx251 divide 1 2 -> 0.5 -inx252 divide 1 4 -> 0.25 -inx253 divide 1 8 -> 0.13 Inexact Rounded -inx254 divide 1 16 -> 0.063 Inexact Rounded -inx255 divide 1 32 -> 0.031 Inexact Rounded -inx256 divide 1 64 -> 0.016 Inexact Rounded -inx257 divide 1 128 -> 0.0078 Inexact Rounded - -precision: 1 -inx260 divide 1 1 -> 1 -inx261 divide 1 2 -> 0.5 -inx262 divide 1 4 -> 0.3 Inexact Rounded -inx263 divide 1 8 -> 0.1 Inexact Rounded -inx264 divide 1 16 -> 0.06 Inexact Rounded -inx265 divide 1 32 -> 0.03 Inexact Rounded -inx266 divide 1 64 -> 0.02 Inexact Rounded -inx267 divide 1 128 -> 0.008 Inexact Rounded - - --- power -precision: 4 -inx301 power 0.5 2 -> 0.25 -inx302 power 0.5 4 -> 0.0625 -inx303 power 0.5 8 -> 0.003906 Inexact Rounded -inx304 power 0.5 16 -> 0.00001526 Inexact Rounded -inx305 power 0.5 32 -> 2.328E-10 Inexact Rounded - --- compare, divideInteger, and remainder are always exact - --- rescale -precision: 4 -inx401 rescale 0 0 -> 0 -inx402 rescale 1 0 -> 1 -inx403 rescale 0.1 +2 -> 0E+2 Inexact Rounded -inx404 rescale 0.1 +1 -> 0E+1 Inexact Rounded -inx405 rescale 0.1 0 -> 0 Inexact Rounded -inx406 rescale 0.1 -1 -> 0.1 -inx407 rescale 0.1 -2 -> 0.10 - --- long operands cause rounding too -precision: 9 -inx801 plus 123456789 -> 123456789 -inx802 plus 1234567890 -> 1.23456789E+9 Rounded -inx803 plus 1234567891 -> 1.23456789E+9 Inexact Rounded -inx804 plus 1234567892 -> 1.23456789E+9 Inexact Rounded -inx805 plus 1234567899 -> 1.23456790E+9 Inexact Rounded -inx806 plus 1234567900 -> 1.23456790E+9 Rounded - diff --git a/sys/lib/python/test/decimaltestdata/max.decTest b/sys/lib/python/test/decimaltestdata/max.decTest deleted file mode 100644 index 9798ae2aa..000000000 --- a/sys/lib/python/test/decimaltestdata/max.decTest +++ /dev/null @@ -1,376 +0,0 @@ ------------------------------------------------------------------------- --- max.decTest -- decimal maximum -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- we assume that base comparison is tested in compare.decTest, so --- these mainly cover special cases and rounding - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - --- sanity checks -maxx001 max -2 -2 -> -2 -maxx002 max -2 -1 -> -1 -maxx003 max -2 0 -> 0 -maxx004 max -2 1 -> 1 -maxx005 max -2 2 -> 2 -maxx006 max -1 -2 -> -1 -maxx007 max -1 -1 -> -1 -maxx008 max -1 0 -> 0 -maxx009 max -1 1 -> 1 -maxx010 max -1 2 -> 2 -maxx011 max 0 -2 -> 0 -maxx012 max 0 -1 -> 0 -maxx013 max 0 0 -> 0 -maxx014 max 0 1 -> 1 -maxx015 max 0 2 -> 2 -maxx016 max 1 -2 -> 1 -maxx017 max 1 -1 -> 1 -maxx018 max 1 0 -> 1 -maxx019 max 1 1 -> 1 -maxx020 max 1 2 -> 2 -maxx021 max 2 -2 -> 2 -maxx022 max 2 -1 -> 2 -maxx023 max 2 0 -> 2 -maxx025 max 2 1 -> 2 -maxx026 max 2 2 -> 2 - --- extended zeros -maxx030 max 0 0 -> 0 -maxx031 max 0 -0 -> 0 -maxx032 max 0 -0.0 -> 0 -maxx033 max 0 0.0 -> 0 -maxx034 max -0 0 -> 0 -- note: -0 = 0, but 0 chosen -maxx035 max -0 -0 -> -0 -maxx036 max -0 -0.0 -> -0.0 -maxx037 max -0 0.0 -> 0.0 -maxx038 max 0.0 0 -> 0 -maxx039 max 0.0 -0 -> 0.0 -maxx040 max 0.0 -0.0 -> 0.0 -maxx041 max 0.0 0.0 -> 0.0 -maxx042 max -0.0 0 -> 0 -maxx043 max -0.0 -0 -> -0.0 -maxx044 max -0.0 -0.0 -> -0.0 -maxx045 max -0.0 0.0 -> 0.0 - -maxx050 max -0E1 0E1 -> 0E+1 -maxx051 max -0E2 0E2 -> 0E+2 -maxx052 max -0E2 0E1 -> 0E+1 -maxx053 max -0E1 0E2 -> 0E+2 -maxx054 max 0E1 -0E1 -> 0E+1 -maxx055 max 0E2 -0E2 -> 0E+2 -maxx056 max 0E2 -0E1 -> 0E+2 -maxx057 max 0E1 -0E2 -> 0E+1 - -maxx058 max 0E1 0E1 -> 0E+1 -maxx059 max 0E2 0E2 -> 0E+2 -maxx060 max 0E2 0E1 -> 0E+2 -maxx061 max 0E1 0E2 -> 0E+2 -maxx062 max -0E1 -0E1 -> -0E+1 -maxx063 max -0E2 -0E2 -> -0E+2 -maxx064 max -0E2 -0E1 -> -0E+1 -maxx065 max -0E1 -0E2 -> -0E+1 - --- Specials -precision: 9 -maxx090 max Inf -Inf -> Infinity -maxx091 max Inf -1000 -> Infinity -maxx092 max Inf -1 -> Infinity -maxx093 max Inf -0 -> Infinity -maxx094 max Inf 0 -> Infinity -maxx095 max Inf 1 -> Infinity -maxx096 max Inf 1000 -> Infinity -maxx097 max Inf Inf -> Infinity -maxx098 max -1000 Inf -> Infinity -maxx099 max -Inf Inf -> Infinity -maxx100 max -1 Inf -> Infinity -maxx101 max -0 Inf -> Infinity -maxx102 max 0 Inf -> Infinity -maxx103 max 1 Inf -> Infinity -maxx104 max 1000 Inf -> Infinity -maxx105 max Inf Inf -> Infinity - -maxx120 max -Inf -Inf -> -Infinity -maxx121 max -Inf -1000 -> -1000 -maxx122 max -Inf -1 -> -1 -maxx123 max -Inf -0 -> -0 -maxx124 max -Inf 0 -> 0 -maxx125 max -Inf 1 -> 1 -maxx126 max -Inf 1000 -> 1000 -maxx127 max -Inf Inf -> Infinity -maxx128 max -Inf -Inf -> -Infinity -maxx129 max -1000 -Inf -> -1000 -maxx130 max -1 -Inf -> -1 -maxx131 max -0 -Inf -> -0 -maxx132 max 0 -Inf -> 0 -maxx133 max 1 -Inf -> 1 -maxx134 max 1000 -Inf -> 1000 -maxx135 max Inf -Inf -> Infinity - --- 2004.08.02 754r chooses number over NaN in mixed cases -maxx141 max NaN -Inf -> -Infinity -maxx142 max NaN -1000 -> -1000 -maxx143 max NaN -1 -> -1 -maxx144 max NaN -0 -> -0 -maxx145 max NaN 0 -> 0 -maxx146 max NaN 1 -> 1 -maxx147 max NaN 1000 -> 1000 -maxx148 max NaN Inf -> Infinity -maxx149 max NaN NaN -> NaN -maxx150 max -Inf NaN -> -Infinity -maxx151 max -1000 NaN -> -1000 -maxx152 max -1 NaN -> -1 -maxx153 max -0 NaN -> -0 -maxx154 max 0 NaN -> 0 -maxx155 max 1 NaN -> 1 -maxx156 max 1000 NaN -> 1000 -maxx157 max Inf NaN -> Infinity - -maxx161 max sNaN -Inf -> NaN Invalid_operation -maxx162 max sNaN -1000 -> NaN Invalid_operation -maxx163 max sNaN -1 -> NaN Invalid_operation -maxx164 max sNaN -0 -> NaN Invalid_operation -maxx165 max sNaN 0 -> NaN Invalid_operation -maxx166 max sNaN 1 -> NaN Invalid_operation -maxx167 max sNaN 1000 -> NaN Invalid_operation -maxx168 max sNaN NaN -> NaN Invalid_operation -maxx169 max sNaN sNaN -> NaN Invalid_operation -maxx170 max NaN sNaN -> NaN Invalid_operation -maxx171 max -Inf sNaN -> NaN Invalid_operation -maxx172 max -1000 sNaN -> NaN Invalid_operation -maxx173 max -1 sNaN -> NaN Invalid_operation -maxx174 max -0 sNaN -> NaN Invalid_operation -maxx175 max 0 sNaN -> NaN Invalid_operation -maxx176 max 1 sNaN -> NaN Invalid_operation -maxx177 max 1000 sNaN -> NaN Invalid_operation -maxx178 max Inf sNaN -> NaN Invalid_operation -maxx179 max NaN sNaN -> NaN Invalid_operation - --- propagating NaNs -maxx181 max NaN9 -Inf -> -Infinity -maxx182 max NaN8 9 -> 9 -maxx183 max -NaN7 Inf -> Infinity - -maxx184 max -NaN1 NaN11 -> -NaN1 -maxx185 max NaN2 NaN12 -> NaN2 -maxx186 max -NaN13 -NaN7 -> -NaN13 -maxx187 max NaN14 -NaN5 -> NaN14 - -maxx188 max -Inf NaN4 -> -Infinity -maxx189 max -9 -NaN3 -> -9 -maxx190 max Inf NaN2 -> Infinity - -maxx191 max sNaN99 -Inf -> NaN99 Invalid_operation -maxx192 max sNaN98 -1 -> NaN98 Invalid_operation -maxx193 max -sNaN97 NaN -> -NaN97 Invalid_operation -maxx194 max sNaN96 sNaN94 -> NaN96 Invalid_operation -maxx195 max NaN95 sNaN93 -> NaN93 Invalid_operation -maxx196 max -Inf sNaN92 -> NaN92 Invalid_operation -maxx197 max 0 sNaN91 -> NaN91 Invalid_operation -maxx198 max Inf -sNaN90 -> -NaN90 Invalid_operation -maxx199 max NaN sNaN89 -> NaN89 Invalid_operation - --- rounding checks -maxexponent: 999 -minexponent: -999 -precision: 9 -maxx201 max 12345678000 1 -> 1.23456780E+10 Rounded -maxx202 max 1 12345678000 -> 1.23456780E+10 Rounded -maxx203 max 1234567800 1 -> 1.23456780E+9 Rounded -maxx204 max 1 1234567800 -> 1.23456780E+9 Rounded -maxx205 max 1234567890 1 -> 1.23456789E+9 Rounded -maxx206 max 1 1234567890 -> 1.23456789E+9 Rounded -maxx207 max 1234567891 1 -> 1.23456789E+9 Inexact Rounded -maxx208 max 1 1234567891 -> 1.23456789E+9 Inexact Rounded -maxx209 max 12345678901 1 -> 1.23456789E+10 Inexact Rounded -maxx210 max 1 12345678901 -> 1.23456789E+10 Inexact Rounded -maxx211 max 1234567896 1 -> 1.23456790E+9 Inexact Rounded -maxx212 max 1 1234567896 -> 1.23456790E+9 Inexact Rounded -maxx213 max -1234567891 1 -> 1 -maxx214 max 1 -1234567891 -> 1 -maxx215 max -12345678901 1 -> 1 -maxx216 max 1 -12345678901 -> 1 -maxx217 max -1234567896 1 -> 1 -maxx218 max 1 -1234567896 -> 1 - -precision: 15 -maxx221 max 12345678000 1 -> 12345678000 -maxx222 max 1 12345678000 -> 12345678000 -maxx223 max 1234567800 1 -> 1234567800 -maxx224 max 1 1234567800 -> 1234567800 -maxx225 max 1234567890 1 -> 1234567890 -maxx226 max 1 1234567890 -> 1234567890 -maxx227 max 1234567891 1 -> 1234567891 -maxx228 max 1 1234567891 -> 1234567891 -maxx229 max 12345678901 1 -> 12345678901 -maxx230 max 1 12345678901 -> 12345678901 -maxx231 max 1234567896 1 -> 1234567896 -maxx232 max 1 1234567896 -> 1234567896 -maxx233 max -1234567891 1 -> 1 -maxx234 max 1 -1234567891 -> 1 -maxx235 max -12345678901 1 -> 1 -maxx236 max 1 -12345678901 -> 1 -maxx237 max -1234567896 1 -> 1 -maxx238 max 1 -1234567896 -> 1 - --- from examples -maxx280 max '3' '2' -> '3' -maxx281 max '-10' '3' -> '3' -maxx282 max '1.0' '1' -> '1' -maxx283 max '1' '1.0' -> '1' -maxx284 max '7' 'NaN' -> '7' - --- overflow and underflow tests ... -maxExponent: 999999999 -minexponent: -999999999 -maxx330 max +1.23456789012345E-0 9E+999999999 -> 9E+999999999 -maxx331 max 9E+999999999 +1.23456789012345E-0 -> 9E+999999999 -maxx332 max +0.100 9E-999999999 -> 0.100 -maxx333 max 9E-999999999 +0.100 -> 0.100 -maxx335 max -1.23456789012345E-0 9E+999999999 -> 9E+999999999 -maxx336 max 9E+999999999 -1.23456789012345E-0 -> 9E+999999999 -maxx337 max -0.100 9E-999999999 -> 9E-999999999 -maxx338 max 9E-999999999 -0.100 -> 9E-999999999 - -maxx339 max 1e-599999999 1e-400000001 -> 1E-400000001 -maxx340 max 1e-599999999 1e-400000000 -> 1E-400000000 -maxx341 max 1e-600000000 1e-400000000 -> 1E-400000000 -maxx342 max 9e-999999998 0.01 -> 0.01 -maxx343 max 9e-999999998 0.1 -> 0.1 -maxx344 max 0.01 9e-999999998 -> 0.01 -maxx345 max 1e599999999 1e400000001 -> 1E+599999999 -maxx346 max 1e599999999 1e400000000 -> 1E+599999999 -maxx347 max 1e600000000 1e400000000 -> 1E+600000000 -maxx348 max 9e999999998 100 -> 9E+999999998 -maxx349 max 9e999999998 10 -> 9E+999999998 -maxx350 max 100 9e999999998 -> 9E+999999998 --- signs -maxx351 max 1e+777777777 1e+411111111 -> 1E+777777777 -maxx352 max 1e+777777777 -1e+411111111 -> 1E+777777777 -maxx353 max -1e+777777777 1e+411111111 -> 1E+411111111 -maxx354 max -1e+777777777 -1e+411111111 -> -1E+411111111 -maxx355 max 1e-777777777 1e-411111111 -> 1E-411111111 -maxx356 max 1e-777777777 -1e-411111111 -> 1E-777777777 -maxx357 max -1e-777777777 1e-411111111 -> 1E-411111111 -maxx358 max -1e-777777777 -1e-411111111 -> -1E-777777777 - --- expanded list from min/max 754r purple prose --- [explicit tests for exponent ordering] -maxx401 max Inf 1.1 -> Infinity -maxx402 max 1.1 1 -> 1.1 -maxx403 max 1 1.0 -> 1 -maxx404 max 1.0 0.1 -> 1.0 -maxx405 max 0.1 0.10 -> 0.1 -maxx406 max 0.10 0.100 -> 0.10 -maxx407 max 0.10 0 -> 0.10 -maxx408 max 0 0.0 -> 0 -maxx409 max 0.0 -0 -> 0.0 -maxx410 max 0.0 -0.0 -> 0.0 -maxx411 max 0.00 -0.0 -> 0.00 -maxx412 max 0.0 -0.00 -> 0.0 -maxx413 max 0 -0.0 -> 0 -maxx414 max 0 -0 -> 0 -maxx415 max -0.0 -0 -> -0.0 -maxx416 max -0 -0.100 -> -0 -maxx417 max -0.100 -0.10 -> -0.100 -maxx418 max -0.10 -0.1 -> -0.10 -maxx419 max -0.1 -1.0 -> -0.1 -maxx420 max -1.0 -1 -> -1.0 -maxx421 max -1 -1.1 -> -1 -maxx423 max -1.1 -Inf -> -1.1 --- same with operands reversed -maxx431 max 1.1 Inf -> Infinity -maxx432 max 1 1.1 -> 1.1 -maxx433 max 1.0 1 -> 1 -maxx434 max 0.1 1.0 -> 1.0 -maxx435 max 0.10 0.1 -> 0.1 -maxx436 max 0.100 0.10 -> 0.10 -maxx437 max 0 0.10 -> 0.10 -maxx438 max 0.0 0 -> 0 -maxx439 max -0 0.0 -> 0.0 -maxx440 max -0.0 0.0 -> 0.0 -maxx441 max -0.0 0.00 -> 0.00 -maxx442 max -0.00 0.0 -> 0.0 -maxx443 max -0.0 0 -> 0 -maxx444 max -0 0 -> 0 -maxx445 max -0 -0.0 -> -0.0 -maxx446 max -0.100 -0 -> -0 -maxx447 max -0.10 -0.100 -> -0.100 -maxx448 max -0.1 -0.10 -> -0.10 -maxx449 max -1.0 -0.1 -> -0.1 -maxx450 max -1 -1.0 -> -1.0 -maxx451 max -1.1 -1 -> -1 -maxx453 max -Inf -1.1 -> -1.1 --- largies -maxx460 max 1000 1E+3 -> 1E+3 -maxx461 max 1E+3 1000 -> 1E+3 -maxx462 max 1000 -1E+3 -> 1000 -maxx463 max 1E+3 -1000 -> 1E+3 -maxx464 max -1000 1E+3 -> 1E+3 -maxx465 max -1E+3 1000 -> 1000 -maxx466 max -1000 -1E+3 -> -1000 -maxx467 max -1E+3 -1000 -> -1000 - - --- overflow tests -maxexponent: 999999999 -minexponent: -999999999 -precision: 3 -maxx500 max 9.999E+999999999 0 -> Infinity Inexact Overflow Rounded -maxx501 max -9.999E+999999999 0 -> 0 - --- subnormals and underflow -precision: 3 -maxexponent: 999 -minexponent: -999 -maxx510 max 1.00E-999 0 -> 1.00E-999 -maxx511 max 0.1E-999 0 -> 1E-1000 Subnormal -maxx512 max 0.10E-999 0 -> 1.0E-1000 Subnormal -maxx513 max 0.100E-999 0 -> 1.0E-1000 Subnormal Rounded -maxx514 max 0.01E-999 0 -> 1E-1001 Subnormal --- next is rounded to Emin -maxx515 max 0.999E-999 0 -> 1.00E-999 Inexact Rounded Subnormal Underflow -maxx516 max 0.099E-999 0 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -maxx517 max 0.009E-999 0 -> 1E-1001 Inexact Rounded Subnormal Underflow -maxx518 max 0.001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow -maxx519 max 0.0009E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow -maxx520 max 0.0001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow - -maxx530 max -1.00E-999 0 -> 0 -maxx531 max -0.1E-999 0 -> 0 -maxx532 max -0.10E-999 0 -> 0 -maxx533 max -0.100E-999 0 -> 0 -maxx534 max -0.01E-999 0 -> 0 -maxx535 max -0.999E-999 0 -> 0 -maxx536 max -0.099E-999 0 -> 0 -maxx537 max -0.009E-999 0 -> 0 -maxx538 max -0.001E-999 0 -> 0 -maxx539 max -0.0009E-999 0 -> 0 -maxx540 max -0.0001E-999 0 -> 0 - --- Null tests -maxx900 max 10 # -> NaN Invalid_operation -maxx901 max # 10 -> NaN Invalid_operation - - - diff --git a/sys/lib/python/test/decimaltestdata/min.decTest b/sys/lib/python/test/decimaltestdata/min.decTest deleted file mode 100644 index 60464016f..000000000 --- a/sys/lib/python/test/decimaltestdata/min.decTest +++ /dev/null @@ -1,363 +0,0 @@ ------------------------------------------------------------------------- --- min.decTest -- decimal minimum -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- we assume that base comparison is tested in compare.decTest, so --- these mainly cover special cases and rounding - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - --- sanity checks -mnmx001 min -2 -2 -> -2 -mnmx002 min -2 -1 -> -2 -mnmx003 min -2 0 -> -2 -mnmx004 min -2 1 -> -2 -mnmx005 min -2 2 -> -2 -mnmx006 min -1 -2 -> -2 -mnmx007 min -1 -1 -> -1 -mnmx008 min -1 0 -> -1 -mnmx009 min -1 1 -> -1 -mnmx010 min -1 2 -> -1 -mnmx011 min 0 -2 -> -2 -mnmx012 min 0 -1 -> -1 -mnmx013 min 0 0 -> 0 -mnmx014 min 0 1 -> 0 -mnmx015 min 0 2 -> 0 -mnmx016 min 1 -2 -> -2 -mnmx017 min 1 -1 -> -1 -mnmx018 min 1 0 -> 0 -mnmx019 min 1 1 -> 1 -mnmx020 min 1 2 -> 1 -mnmx021 min 2 -2 -> -2 -mnmx022 min 2 -1 -> -1 -mnmx023 min 2 0 -> 0 -mnmx025 min 2 1 -> 1 -mnmx026 min 2 2 -> 2 - --- extended zeros -mnmx030 min 0 0 -> 0 -mnmx031 min 0 -0 -> -0 -mnmx032 min 0 -0.0 -> -0.0 -mnmx033 min 0 0.0 -> 0.0 -mnmx034 min -0 0 -> -0 -mnmx035 min -0 -0 -> -0 -mnmx036 min -0 -0.0 -> -0 -mnmx037 min -0 0.0 -> -0 -mnmx038 min 0.0 0 -> 0.0 -mnmx039 min 0.0 -0 -> -0 -mnmx040 min 0.0 -0.0 -> -0.0 -mnmx041 min 0.0 0.0 -> 0.0 -mnmx042 min -0.0 0 -> -0.0 -mnmx043 min -0.0 -0 -> -0 -mnmx044 min -0.0 -0.0 -> -0.0 -mnmx045 min -0.0 0.0 -> -0.0 - -mnmx046 min 0E1 -0E1 -> -0E+1 -mnmx047 min -0E1 0E2 -> -0E+1 -mnmx048 min 0E2 0E1 -> 0E+1 -mnmx049 min 0E1 0E2 -> 0E+1 -mnmx050 min -0E3 -0E2 -> -0E+3 -mnmx051 min -0E2 -0E3 -> -0E+3 - --- Specials -precision: 9 -mnmx090 min Inf -Inf -> -Infinity -mnmx091 min Inf -1000 -> -1000 -mnmx092 min Inf -1 -> -1 -mnmx093 min Inf -0 -> -0 -mnmx094 min Inf 0 -> 0 -mnmx095 min Inf 1 -> 1 -mnmx096 min Inf 1000 -> 1000 -mnmx097 min Inf Inf -> Infinity -mnmx098 min -1000 Inf -> -1000 -mnmx099 min -Inf Inf -> -Infinity -mnmx100 min -1 Inf -> -1 -mnmx101 min -0 Inf -> -0 -mnmx102 min 0 Inf -> 0 -mnmx103 min 1 Inf -> 1 -mnmx104 min 1000 Inf -> 1000 -mnmx105 min Inf Inf -> Infinity - -mnmx120 min -Inf -Inf -> -Infinity -mnmx121 min -Inf -1000 -> -Infinity -mnmx122 min -Inf -1 -> -Infinity -mnmx123 min -Inf -0 -> -Infinity -mnmx124 min -Inf 0 -> -Infinity -mnmx125 min -Inf 1 -> -Infinity -mnmx126 min -Inf 1000 -> -Infinity -mnmx127 min -Inf Inf -> -Infinity -mnmx128 min -Inf -Inf -> -Infinity -mnmx129 min -1000 -Inf -> -Infinity -mnmx130 min -1 -Inf -> -Infinity -mnmx131 min -0 -Inf -> -Infinity -mnmx132 min 0 -Inf -> -Infinity -mnmx133 min 1 -Inf -> -Infinity -mnmx134 min 1000 -Inf -> -Infinity -mnmx135 min Inf -Inf -> -Infinity - --- 2004.08.02 754r chooses number over NaN in mixed cases -mnmx141 min NaN -Inf -> -Infinity -mnmx142 min NaN -1000 -> -1000 -mnmx143 min NaN -1 -> -1 -mnmx144 min NaN -0 -> -0 -mnmx145 min NaN 0 -> 0 -mnmx146 min NaN 1 -> 1 -mnmx147 min NaN 1000 -> 1000 -mnmx148 min NaN Inf -> Infinity -mnmx149 min NaN NaN -> NaN -mnmx150 min -Inf NaN -> -Infinity -mnmx151 min -1000 NaN -> -1000 -mnmx152 min -1 -NaN -> -1 -mnmx153 min -0 NaN -> -0 -mnmx154 min 0 -NaN -> 0 -mnmx155 min 1 NaN -> 1 -mnmx156 min 1000 NaN -> 1000 -mnmx157 min Inf NaN -> Infinity - -mnmx161 min sNaN -Inf -> NaN Invalid_operation -mnmx162 min sNaN -1000 -> NaN Invalid_operation -mnmx163 min sNaN -1 -> NaN Invalid_operation -mnmx164 min sNaN -0 -> NaN Invalid_operation -mnmx165 min -sNaN 0 -> -NaN Invalid_operation -mnmx166 min -sNaN 1 -> -NaN Invalid_operation -mnmx167 min sNaN 1000 -> NaN Invalid_operation -mnmx168 min sNaN NaN -> NaN Invalid_operation -mnmx169 min sNaN sNaN -> NaN Invalid_operation -mnmx170 min NaN sNaN -> NaN Invalid_operation -mnmx171 min -Inf sNaN -> NaN Invalid_operation -mnmx172 min -1000 sNaN -> NaN Invalid_operation -mnmx173 min -1 sNaN -> NaN Invalid_operation -mnmx174 min -0 sNaN -> NaN Invalid_operation -mnmx175 min 0 sNaN -> NaN Invalid_operation -mnmx176 min 1 sNaN -> NaN Invalid_operation -mnmx177 min 1000 sNaN -> NaN Invalid_operation -mnmx178 min Inf sNaN -> NaN Invalid_operation -mnmx179 min NaN sNaN -> NaN Invalid_operation - --- propagating NaNs -mnmx181 min NaN9 -Inf -> -Infinity -mnmx182 min -NaN8 9990 -> 9990 -mnmx183 min NaN71 Inf -> Infinity - -mnmx184 min NaN1 NaN54 -> NaN1 -mnmx185 min NaN22 -NaN53 -> NaN22 -mnmx186 min -NaN3 NaN6 -> -NaN3 -mnmx187 min -NaN44 NaN7 -> -NaN44 - -mnmx188 min -Inf NaN41 -> -Infinity -mnmx189 min -9999 -NaN33 -> -9999 -mnmx190 min Inf NaN2 -> Infinity - -mnmx191 min sNaN99 -Inf -> NaN99 Invalid_operation -mnmx192 min sNaN98 -11 -> NaN98 Invalid_operation -mnmx193 min -sNaN97 NaN8 -> -NaN97 Invalid_operation -mnmx194 min sNaN69 sNaN94 -> NaN69 Invalid_operation -mnmx195 min NaN95 sNaN93 -> NaN93 Invalid_operation -mnmx196 min -Inf sNaN92 -> NaN92 Invalid_operation -mnmx197 min 088 sNaN91 -> NaN91 Invalid_operation -mnmx198 min Inf -sNaN90 -> -NaN90 Invalid_operation -mnmx199 min NaN sNaN86 -> NaN86 Invalid_operation - --- rounding checks -- chosen is rounded, or not -maxExponent: 999 -minexponent: -999 -precision: 9 -mnmx201 min -12345678000 1 -> -1.23456780E+10 Rounded -mnmx202 min 1 -12345678000 -> -1.23456780E+10 Rounded -mnmx203 min -1234567800 1 -> -1.23456780E+9 Rounded -mnmx204 min 1 -1234567800 -> -1.23456780E+9 Rounded -mnmx205 min -1234567890 1 -> -1.23456789E+9 Rounded -mnmx206 min 1 -1234567890 -> -1.23456789E+9 Rounded -mnmx207 min -1234567891 1 -> -1.23456789E+9 Inexact Rounded -mnmx208 min 1 -1234567891 -> -1.23456789E+9 Inexact Rounded -mnmx209 min -12345678901 1 -> -1.23456789E+10 Inexact Rounded -mnmx210 min 1 -12345678901 -> -1.23456789E+10 Inexact Rounded -mnmx211 min -1234567896 1 -> -1.23456790E+9 Inexact Rounded -mnmx212 min 1 -1234567896 -> -1.23456790E+9 Inexact Rounded -mnmx213 min 1234567891 1 -> 1 -mnmx214 min 1 1234567891 -> 1 -mnmx215 min 12345678901 1 -> 1 -mnmx216 min 1 12345678901 -> 1 -mnmx217 min 1234567896 1 -> 1 -mnmx218 min 1 1234567896 -> 1 - -precision: 15 -mnmx221 min -12345678000 1 -> -12345678000 -mnmx222 min 1 -12345678000 -> -12345678000 -mnmx223 min -1234567800 1 -> -1234567800 -mnmx224 min 1 -1234567800 -> -1234567800 -mnmx225 min -1234567890 1 -> -1234567890 -mnmx226 min 1 -1234567890 -> -1234567890 -mnmx227 min -1234567891 1 -> -1234567891 -mnmx228 min 1 -1234567891 -> -1234567891 -mnmx229 min -12345678901 1 -> -12345678901 -mnmx230 min 1 -12345678901 -> -12345678901 -mnmx231 min -1234567896 1 -> -1234567896 -mnmx232 min 1 -1234567896 -> -1234567896 -mnmx233 min 1234567891 1 -> 1 -mnmx234 min 1 1234567891 -> 1 -mnmx235 min 12345678901 1 -> 1 -mnmx236 min 1 12345678901 -> 1 -mnmx237 min 1234567896 1 -> 1 -mnmx238 min 1 1234567896 -> 1 - --- from examples -mnmx280 min '3' '2' -> '2' -mnmx281 min '-10' '3' -> '-10' -mnmx282 min '1.0' '1' -> '1.0' -mnmx283 min '1' '1.0' -> '1.0' -mnmx284 min '7' 'NaN' -> '7' - --- overflow and underflow tests .. subnormal results [inputs] now allowed -maxExponent: 999999999 -minexponent: -999999999 -mnmx330 min -1.23456789012345E-0 -9E+999999999 -> -9E+999999999 -mnmx331 min -9E+999999999 -1.23456789012345E-0 -> -9E+999999999 -mnmx332 min -0.100 -9E-999999999 -> -0.100 -mnmx333 min -9E-999999999 -0.100 -> -0.100 -mnmx335 min +1.23456789012345E-0 -9E+999999999 -> -9E+999999999 -mnmx336 min -9E+999999999 1.23456789012345E-0 -> -9E+999999999 -mnmx337 min +0.100 -9E-999999999 -> -9E-999999999 -mnmx338 min -9E-999999999 0.100 -> -9E-999999999 - -mnmx339 min -1e-599999999 -1e-400000001 -> -1E-400000001 -mnmx340 min -1e-599999999 -1e-400000000 -> -1E-400000000 -mnmx341 min -1e-600000000 -1e-400000000 -> -1E-400000000 -mnmx342 min -9e-999999998 -0.01 -> -0.01 -mnmx343 min -9e-999999998 -0.1 -> -0.1 -mnmx344 min -0.01 -9e-999999998 -> -0.01 -mnmx345 min -1e599999999 -1e400000001 -> -1E+599999999 -mnmx346 min -1e599999999 -1e400000000 -> -1E+599999999 -mnmx347 min -1e600000000 -1e400000000 -> -1E+600000000 -mnmx348 min -9e999999998 -100 -> -9E+999999998 -mnmx349 min -9e999999998 -10 -> -9E+999999998 -mnmx350 min -100 -9e999999998 -> -9E+999999998 --- signs -mnmx351 min -1e+777777777 -1e+411111111 -> -1E+777777777 -mnmx352 min -1e+777777777 +1e+411111111 -> -1E+777777777 -mnmx353 min +1e+777777777 -1e+411111111 -> -1E+411111111 -mnmx354 min +1e+777777777 +1e+411111111 -> 1E+411111111 -mnmx355 min -1e-777777777 -1e-411111111 -> -1E-411111111 -mnmx356 min -1e-777777777 +1e-411111111 -> -1E-777777777 -mnmx357 min +1e-777777777 -1e-411111111 -> -1E-411111111 -mnmx358 min +1e-777777777 +1e-411111111 -> 1E-777777777 - --- expanded list from min/max 754r purple prose --- [explicit tests for exponent ordering] -mnmx401 min Inf 1.1 -> 1.1 -mnmx402 min 1.1 1 -> 1 -mnmx403 min 1 1.0 -> 1.0 -mnmx404 min 1.0 0.1 -> 0.1 -mnmx405 min 0.1 0.10 -> 0.10 -mnmx406 min 0.10 0.100 -> 0.100 -mnmx407 min 0.10 0 -> 0 -mnmx408 min 0 0.0 -> 0.0 -mnmx409 min 0.0 -0 -> -0 -mnmx410 min 0.0 -0.0 -> -0.0 -mnmx411 min 0.00 -0.0 -> -0.0 -mnmx412 min 0.0 -0.00 -> -0.00 -mnmx413 min 0 -0.0 -> -0.0 -mnmx414 min 0 -0 -> -0 -mnmx415 min -0.0 -0 -> -0 -mnmx416 min -0 -0.100 -> -0.100 -mnmx417 min -0.100 -0.10 -> -0.10 -mnmx418 min -0.10 -0.1 -> -0.1 -mnmx419 min -0.1 -1.0 -> -1.0 -mnmx420 min -1.0 -1 -> -1 -mnmx421 min -1 -1.1 -> -1.1 -mnmx423 min -1.1 -Inf -> -Infinity --- same with operands reversed -mnmx431 min 1.1 Inf -> 1.1 -mnmx432 min 1 1.1 -> 1 -mnmx433 min 1.0 1 -> 1.0 -mnmx434 min 0.1 1.0 -> 0.1 -mnmx435 min 0.10 0.1 -> 0.10 -mnmx436 min 0.100 0.10 -> 0.100 -mnmx437 min 0 0.10 -> 0 -mnmx438 min 0.0 0 -> 0.0 -mnmx439 min -0 0.0 -> -0 -mnmx440 min -0.0 0.0 -> -0.0 -mnmx441 min -0.0 0.00 -> -0.0 -mnmx442 min -0.00 0.0 -> -0.00 -mnmx443 min -0.0 0 -> -0.0 -mnmx444 min -0 0 -> -0 -mnmx445 min -0 -0.0 -> -0 -mnmx446 min -0.100 -0 -> -0.100 -mnmx447 min -0.10 -0.100 -> -0.10 -mnmx448 min -0.1 -0.10 -> -0.1 -mnmx449 min -1.0 -0.1 -> -1.0 -mnmx450 min -1 -1.0 -> -1 -mnmx451 min -1.1 -1 -> -1.1 -mnmx453 min -Inf -1.1 -> -Infinity --- largies -mnmx460 min 1000 1E+3 -> 1000 -mnmx461 min 1E+3 1000 -> 1000 -mnmx462 min 1000 -1E+3 -> -1E+3 -mnmx463 min 1E+3 -1000 -> -1000 -mnmx464 min -1000 1E+3 -> -1000 -mnmx465 min -1E+3 1000 -> -1E+3 -mnmx466 min -1000 -1E+3 -> -1E+3 -mnmx467 min -1E+3 -1000 -> -1E+3 - - --- overflow tests -maxexponent: 999999999 -minexponent: -999999999 -precision: 3 -mnmx500 min 9.999E+999999999 0 -> 0 -mnmx501 min -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded - --- subnormals and underflow -precision: 3 -maxexponent: 999 -minexponent: -999 -mnmx510 min 1.00E-999 0 -> 0 -mnmx511 min 0.1E-999 0 -> 0 -mnmx512 min 0.10E-999 0 -> 0 -mnmx513 min 0.100E-999 0 -> 0 -mnmx514 min 0.01E-999 0 -> 0 -mnmx515 min 0.999E-999 0 -> 0 -mnmx516 min 0.099E-999 0 -> 0 -mnmx517 min 0.009E-999 0 -> 0 -mnmx518 min 0.001E-999 0 -> 0 -mnmx519 min 0.0009E-999 0 -> 0 -mnmx520 min 0.0001E-999 0 -> 0 - -mnmx530 min -1.00E-999 0 -> -1.00E-999 -mnmx531 min -0.1E-999 0 -> -1E-1000 Subnormal -mnmx532 min -0.10E-999 0 -> -1.0E-1000 Subnormal -mnmx533 min -0.100E-999 0 -> -1.0E-1000 Subnormal Rounded -mnmx534 min -0.01E-999 0 -> -1E-1001 Subnormal --- next is rounded to Emin -mnmx535 min -0.999E-999 0 -> -1.00E-999 Inexact Rounded Subnormal Underflow -mnmx536 min -0.099E-999 0 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -mnmx537 min -0.009E-999 0 -> -1E-1001 Inexact Rounded Subnormal Underflow -mnmx538 min -0.001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow -mnmx539 min -0.0009E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow -mnmx540 min -0.0001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow - - --- Null tests -mnm900 min 10 # -> NaN Invalid_operation -mnm901 min # 10 -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/minus.decTest b/sys/lib/python/test/decimaltestdata/minus.decTest deleted file mode 100644 index d21af839e..000000000 --- a/sys/lib/python/test/decimaltestdata/minus.decTest +++ /dev/null @@ -1,182 +0,0 @@ ------------------------------------------------------------------------- --- minus.decTest -- decimal negation -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- This set of tests primarily tests the existence of the operator. --- Subtraction, rounding, and more overflows are tested elsewhere. - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - -minx001 minus '1' -> '-1' -minx002 minus '-1' -> '1' -minx003 minus '1.00' -> '-1.00' -minx004 minus '-1.00' -> '1.00' -minx005 minus '0' -> '0' -minx006 minus '0.00' -> '0.00' -minx007 minus '00.0' -> '0.0' -minx008 minus '00.00' -> '0.00' -minx009 minus '00' -> '0' - -minx010 minus '-2' -> '2' -minx011 minus '2' -> '-2' -minx012 minus '-2.00' -> '2.00' -minx013 minus '2.00' -> '-2.00' -minx014 minus '-0' -> '0' -minx015 minus '-0.00' -> '0.00' -minx016 minus '-00.0' -> '0.0' -minx017 minus '-00.00' -> '0.00' -minx018 minus '-00' -> '0' - --- "lhs" zeros in plus and minus have exponent = operand -minx020 minus '-0E3' -> '0E+3' -minx021 minus '-0E2' -> '0E+2' -minx022 minus '-0E1' -> '0E+1' -minx023 minus '-0E0' -> '0' -minx024 minus '+0E0' -> '0' -minx025 minus '+0E1' -> '0E+1' -minx026 minus '+0E2' -> '0E+2' -minx027 minus '+0E3' -> '0E+3' - -minx030 minus '-5E3' -> '5E+3' -minx031 minus '-5E8' -> '5E+8' -minx032 minus '-5E13' -> '5E+13' -minx033 minus '-5E18' -> '5E+18' -minx034 minus '+5E3' -> '-5E+3' -minx035 minus '+5E8' -> '-5E+8' -minx036 minus '+5E13' -> '-5E+13' -minx037 minus '+5E18' -> '-5E+18' - -minx050 minus '-2000000' -> '2000000' -minx051 minus '2000000' -> '-2000000' -precision: 7 -minx052 minus '-2000000' -> '2000000' -minx053 minus '2000000' -> '-2000000' -precision: 6 -minx054 minus '-2000000' -> '2.00000E+6' Rounded -minx055 minus '2000000' -> '-2.00000E+6' Rounded -precision: 3 -minx056 minus '-2000000' -> '2.00E+6' Rounded -minx057 minus '2000000' -> '-2.00E+6' Rounded - --- more fixed, potential LHS swaps/overlays if done by 0 subtract x -precision: 9 -minx060 minus '56267E-10' -> '-0.0000056267' -minx061 minus '56267E-5' -> '-0.56267' -minx062 minus '56267E-2' -> '-562.67' -minx063 minus '56267E-1' -> '-5626.7' -minx065 minus '56267E-0' -> '-56267' -minx066 minus '56267E+0' -> '-56267' -minx067 minus '56267E+1' -> '-5.6267E+5' -minx068 minus '56267E+2' -> '-5.6267E+6' -minx069 minus '56267E+3' -> '-5.6267E+7' -minx070 minus '56267E+4' -> '-5.6267E+8' -minx071 minus '56267E+5' -> '-5.6267E+9' -minx072 minus '56267E+6' -> '-5.6267E+10' -minx080 minus '-56267E-10' -> '0.0000056267' -minx081 minus '-56267E-5' -> '0.56267' -minx082 minus '-56267E-2' -> '562.67' -minx083 minus '-56267E-1' -> '5626.7' -minx085 minus '-56267E-0' -> '56267' -minx086 minus '-56267E+0' -> '56267' -minx087 minus '-56267E+1' -> '5.6267E+5' -minx088 minus '-56267E+2' -> '5.6267E+6' -minx089 minus '-56267E+3' -> '5.6267E+7' -minx090 minus '-56267E+4' -> '5.6267E+8' -minx091 minus '-56267E+5' -> '5.6267E+9' -minx092 minus '-56267E+6' -> '5.6267E+10' - - --- overflow tests -maxexponent: 999999999 -minexponent: -999999999 -precision: 3 -minx100 minus 9.999E+999999999 -> -Infinity Inexact Overflow Rounded -minx101 minus -9.999E+999999999 -> Infinity Inexact Overflow Rounded - --- subnormals and underflow -precision: 3 -maxexponent: 999 -minexponent: -999 -minx110 minus 1.00E-999 -> -1.00E-999 -minx111 minus 0.1E-999 -> -1E-1000 Subnormal -minx112 minus 0.10E-999 -> -1.0E-1000 Subnormal -minx113 minus 0.100E-999 -> -1.0E-1000 Subnormal Rounded -minx114 minus 0.01E-999 -> -1E-1001 Subnormal --- next is rounded to Emin -minx115 minus 0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow -minx116 minus 0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -minx117 minus 0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow -minx118 minus 0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow -minx119 minus 0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow -minx120 minus 0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow - -minx130 minus -1.00E-999 -> 1.00E-999 -minx131 minus -0.1E-999 -> 1E-1000 Subnormal -minx132 minus -0.10E-999 -> 1.0E-1000 Subnormal -minx133 minus -0.100E-999 -> 1.0E-1000 Subnormal Rounded -minx134 minus -0.01E-999 -> 1E-1001 Subnormal --- next is rounded to Emin -minx135 minus -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow -minx136 minus -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -minx137 minus -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow -minx138 minus -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -minx139 minus -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -minx140 minus -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow - - --- long operand checks -maxexponent: 999 -minexponent: -999 -precision: 9 -minx301 minus 12345678000 -> -1.23456780E+10 Rounded -minx302 minus 1234567800 -> -1.23456780E+9 Rounded -minx303 minus 1234567890 -> -1.23456789E+9 Rounded -minx304 minus 1234567891 -> -1.23456789E+9 Inexact Rounded -minx305 minus 12345678901 -> -1.23456789E+10 Inexact Rounded -minx306 minus 1234567896 -> -1.23456790E+9 Inexact Rounded - -precision: 15 --- still checking -minx321 minus 12345678000 -> -12345678000 -minx322 minus 1234567800 -> -1234567800 -minx323 minus 1234567890 -> -1234567890 -minx324 minus 1234567891 -> -1234567891 -minx325 minus 12345678901 -> -12345678901 -minx326 minus 1234567896 -> -1234567896 - --- specials -minx420 minus 'Inf' -> '-Infinity' -minx421 minus '-Inf' -> 'Infinity' -minx422 minus NaN -> NaN -minx423 minus sNaN -> NaN Invalid_operation -minx424 minus NaN255 -> NaN255 -minx425 minus sNaN256 -> NaN256 Invalid_operation -minx426 minus -NaN -> -NaN -minx427 minus -sNaN -> -NaN Invalid_operation -minx428 minus -NaN255 -> -NaN255 -minx429 minus -sNaN256 -> -NaN256 Invalid_operation - --- Null tests -minx900 minus # -> NaN Invalid_operation - diff --git a/sys/lib/python/test/decimaltestdata/multiply.decTest b/sys/lib/python/test/decimaltestdata/multiply.decTest deleted file mode 100644 index f65015052..000000000 --- a/sys/lib/python/test/decimaltestdata/multiply.decTest +++ /dev/null @@ -1,651 +0,0 @@ ------------------------------------------------------------------------- --- multiply.decTest -- decimal multiplication -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - --- sanity checks (as base, above) -mulx000 multiply 2 2 -> 4 -mulx001 multiply 2 3 -> 6 -mulx002 multiply 5 1 -> 5 -mulx003 multiply 5 2 -> 10 -mulx004 multiply 1.20 2 -> 2.40 -mulx005 multiply 1.20 0 -> 0.00 -mulx006 multiply 1.20 -2 -> -2.40 -mulx007 multiply -1.20 2 -> -2.40 -mulx008 multiply -1.20 0 -> -0.00 -mulx009 multiply -1.20 -2 -> 2.40 -mulx010 multiply 5.09 7.1 -> 36.139 -mulx011 multiply 2.5 4 -> 10.0 -mulx012 multiply 2.50 4 -> 10.00 -mulx013 multiply 1.23456789 1.00000000 -> 1.23456789 Rounded -mulx014 multiply 9.999999999 9.999999999 -> 100.000000 Inexact Rounded -mulx015 multiply 2.50 4 -> 10.00 -precision: 6 -mulx016 multiply 2.50 4 -> 10.00 -mulx017 multiply 9.999999999 9.999999999 -> 100.000 Inexact Rounded - --- 1999.12.21: next one is a edge case if intermediate longs are used -precision: 15 -mulx019 multiply 999999999999 9765625 -> 9.76562499999023E+18 Inexact Rounded -precision: 30 -mulx160 multiply 999999999999 9765625 -> 9765624999990234375 -precision: 9 ------ - --- zeros, etc. -mulx020 multiply 0 0 -> 0 -mulx021 multiply 0 -0 -> -0 -mulx022 multiply -0 0 -> -0 -mulx023 multiply -0 -0 -> 0 -mulx030 multiply 5.00 1E-3 -> 0.00500 -mulx031 multiply 00.00 0.000 -> 0.00000 -mulx032 multiply 00.00 0E-3 -> 0.00000 -- rhs is 0 -mulx033 multiply 0E-3 00.00 -> 0.00000 -- lhs is 0 -mulx034 multiply -5.00 1E-3 -> -0.00500 -mulx035 multiply -00.00 0.000 -> -0.00000 -mulx036 multiply -00.00 0E-3 -> -0.00000 -- rhs is 0 -mulx037 multiply -0E-3 00.00 -> -0.00000 -- lhs is 0 -mulx038 multiply 5.00 -1E-3 -> -0.00500 -mulx039 multiply 00.00 -0.000 -> -0.00000 -mulx040 multiply 00.00 -0E-3 -> -0.00000 -- rhs is 0 -mulx041 multiply 0E-3 -00.00 -> -0.00000 -- lhs is 0 -mulx042 multiply -5.00 -1E-3 -> 0.00500 -mulx043 multiply -00.00 -0.000 -> 0.00000 -mulx044 multiply -00.00 -0E-3 -> 0.00000 -- rhs is 0 -mulx045 multiply -0E-3 -00.00 -> 0.00000 -- lhs is 0 - --- examples from decarith -mulx050 multiply 1.20 3 -> 3.60 -mulx051 multiply 7 3 -> 21 -mulx052 multiply 0.9 0.8 -> 0.72 -mulx053 multiply 0.9 -0 -> -0.0 -mulx054 multiply 654321 654321 -> 4.28135971E+11 Inexact Rounded - -mulx060 multiply 123.45 1e7 -> 1.2345E+9 -mulx061 multiply 123.45 1e8 -> 1.2345E+10 -mulx062 multiply 123.45 1e+9 -> 1.2345E+11 -mulx063 multiply 123.45 1e10 -> 1.2345E+12 -mulx064 multiply 123.45 1e11 -> 1.2345E+13 -mulx065 multiply 123.45 1e12 -> 1.2345E+14 -mulx066 multiply 123.45 1e13 -> 1.2345E+15 - - --- test some intermediate lengths -precision: 9 -mulx080 multiply 0.1 123456789 -> 12345678.9 -mulx081 multiply 0.1 1234567891 -> 123456789 Inexact Rounded -mulx082 multiply 0.1 12345678912 -> 1.23456789E+9 Inexact Rounded -mulx083 multiply 0.1 12345678912345 -> 1.23456789E+12 Inexact Rounded -mulx084 multiply 0.1 123456789 -> 12345678.9 -precision: 8 -mulx085 multiply 0.1 12345678912 -> 1.2345679E+9 Inexact Rounded -mulx086 multiply 0.1 12345678912345 -> 1.2345679E+12 Inexact Rounded -precision: 7 -mulx087 multiply 0.1 12345678912 -> 1.234568E+9 Inexact Rounded -mulx088 multiply 0.1 12345678912345 -> 1.234568E+12 Inexact Rounded - -precision: 9 -mulx090 multiply 123456789 0.1 -> 12345678.9 -mulx091 multiply 1234567891 0.1 -> 123456789 Inexact Rounded -mulx092 multiply 12345678912 0.1 -> 1.23456789E+9 Inexact Rounded -mulx093 multiply 12345678912345 0.1 -> 1.23456789E+12 Inexact Rounded -mulx094 multiply 123456789 0.1 -> 12345678.9 -precision: 8 -mulx095 multiply 12345678912 0.1 -> 1.2345679E+9 Inexact Rounded -mulx096 multiply 12345678912345 0.1 -> 1.2345679E+12 Inexact Rounded -precision: 7 -mulx097 multiply 12345678912 0.1 -> 1.234568E+9 Inexact Rounded -mulx098 multiply 12345678912345 0.1 -> 1.234568E+12 Inexact Rounded - --- test some more edge cases and carries -maxexponent: 9999 -minexponent: -9999 -precision: 33 -mulx101 multiply 9 9 -> 81 -mulx102 multiply 9 90 -> 810 -mulx103 multiply 9 900 -> 8100 -mulx104 multiply 9 9000 -> 81000 -mulx105 multiply 9 90000 -> 810000 -mulx106 multiply 9 900000 -> 8100000 -mulx107 multiply 9 9000000 -> 81000000 -mulx108 multiply 9 90000000 -> 810000000 -mulx109 multiply 9 900000000 -> 8100000000 -mulx110 multiply 9 9000000000 -> 81000000000 -mulx111 multiply 9 90000000000 -> 810000000000 -mulx112 multiply 9 900000000000 -> 8100000000000 -mulx113 multiply 9 9000000000000 -> 81000000000000 -mulx114 multiply 9 90000000000000 -> 810000000000000 -mulx115 multiply 9 900000000000000 -> 8100000000000000 -mulx116 multiply 9 9000000000000000 -> 81000000000000000 -mulx117 multiply 9 90000000000000000 -> 810000000000000000 -mulx118 multiply 9 900000000000000000 -> 8100000000000000000 -mulx119 multiply 9 9000000000000000000 -> 81000000000000000000 -mulx120 multiply 9 90000000000000000000 -> 810000000000000000000 -mulx121 multiply 9 900000000000000000000 -> 8100000000000000000000 -mulx122 multiply 9 9000000000000000000000 -> 81000000000000000000000 -mulx123 multiply 9 90000000000000000000000 -> 810000000000000000000000 --- test some more edge cases without carries -mulx131 multiply 3 3 -> 9 -mulx132 multiply 3 30 -> 90 -mulx133 multiply 3 300 -> 900 -mulx134 multiply 3 3000 -> 9000 -mulx135 multiply 3 30000 -> 90000 -mulx136 multiply 3 300000 -> 900000 -mulx137 multiply 3 3000000 -> 9000000 -mulx138 multiply 3 30000000 -> 90000000 -mulx139 multiply 3 300000000 -> 900000000 -mulx140 multiply 3 3000000000 -> 9000000000 -mulx141 multiply 3 30000000000 -> 90000000000 -mulx142 multiply 3 300000000000 -> 900000000000 -mulx143 multiply 3 3000000000000 -> 9000000000000 -mulx144 multiply 3 30000000000000 -> 90000000000000 -mulx145 multiply 3 300000000000000 -> 900000000000000 -mulx146 multiply 3 3000000000000000 -> 9000000000000000 -mulx147 multiply 3 30000000000000000 -> 90000000000000000 -mulx148 multiply 3 300000000000000000 -> 900000000000000000 -mulx149 multiply 3 3000000000000000000 -> 9000000000000000000 -mulx150 multiply 3 30000000000000000000 -> 90000000000000000000 -mulx151 multiply 3 300000000000000000000 -> 900000000000000000000 -mulx152 multiply 3 3000000000000000000000 -> 9000000000000000000000 -mulx153 multiply 3 30000000000000000000000 -> 90000000000000000000000 - -maxexponent: 999999999 -minexponent: -999999999 -precision: 9 --- test some cases that are close to exponent overflow/underflow -mulx170 multiply 1 9e999999999 -> 9E+999999999 -mulx171 multiply 1 9.9e999999999 -> 9.9E+999999999 -mulx172 multiply 1 9.99e999999999 -> 9.99E+999999999 -mulx173 multiply 9e999999999 1 -> 9E+999999999 -mulx174 multiply 9.9e999999999 1 -> 9.9E+999999999 -mulx176 multiply 9.99e999999999 1 -> 9.99E+999999999 -mulx177 multiply 1 9.99999999e999999999 -> 9.99999999E+999999999 -mulx178 multiply 9.99999999e999999999 1 -> 9.99999999E+999999999 - -mulx180 multiply 0.1 9e-999999998 -> 9E-999999999 -mulx181 multiply 0.1 99e-999999998 -> 9.9E-999999998 -mulx182 multiply 0.1 999e-999999998 -> 9.99E-999999997 - -mulx183 multiply 0.1 9e-999999998 -> 9E-999999999 -mulx184 multiply 0.1 99e-999999998 -> 9.9E-999999998 -mulx185 multiply 0.1 999e-999999998 -> 9.99E-999999997 -mulx186 multiply 0.1 999e-999999997 -> 9.99E-999999996 -mulx187 multiply 0.1 9999e-999999997 -> 9.999E-999999995 -mulx188 multiply 0.1 99999e-999999997 -> 9.9999E-999999994 - -mulx190 multiply 1 9e-999999998 -> 9E-999999998 -mulx191 multiply 1 99e-999999998 -> 9.9E-999999997 -mulx192 multiply 1 999e-999999998 -> 9.99E-999999996 -mulx193 multiply 9e-999999998 1 -> 9E-999999998 -mulx194 multiply 99e-999999998 1 -> 9.9E-999999997 -mulx195 multiply 999e-999999998 1 -> 9.99E-999999996 - -mulx196 multiply 1e-599999999 1e-400000000 -> 1E-999999999 -mulx197 multiply 1e-600000000 1e-399999999 -> 1E-999999999 -mulx198 multiply 1.2e-599999999 1.2e-400000000 -> 1.44E-999999999 -mulx199 multiply 1.2e-600000000 1.2e-399999999 -> 1.44E-999999999 - -mulx201 multiply 1e599999999 1e400000000 -> 1E+999999999 -mulx202 multiply 1e600000000 1e399999999 -> 1E+999999999 -mulx203 multiply 1.2e599999999 1.2e400000000 -> 1.44E+999999999 -mulx204 multiply 1.2e600000000 1.2e399999999 -> 1.44E+999999999 - --- long operand triangle -precision: 33 -mulx246 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369671916511992830 Inexact Rounded -precision: 32 -mulx247 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967191651199283 Inexact Rounded -precision: 31 -mulx248 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933696719165119928 Inexact Rounded -precision: 30 -mulx249 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369671916511993 Inexact Rounded -precision: 29 -mulx250 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967191651199 Inexact Rounded -precision: 28 -mulx251 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933696719165120 Inexact Rounded -precision: 27 -mulx252 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369671916512 Inexact Rounded -precision: 26 -mulx253 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967191651 Inexact Rounded -precision: 25 -mulx254 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933696719165 Inexact Rounded -precision: 24 -mulx255 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369671917 Inexact Rounded -precision: 23 -mulx256 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967192 Inexact Rounded -precision: 22 -mulx257 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933696719 Inexact Rounded -precision: 21 -mulx258 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369672 Inexact Rounded -precision: 20 -mulx259 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967 Inexact Rounded -precision: 19 -mulx260 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933697 Inexact Rounded -precision: 18 -mulx261 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193370 Inexact Rounded -precision: 17 -mulx262 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119337 Inexact Rounded -precision: 16 -mulx263 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011934 Inexact Rounded -precision: 15 -mulx264 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193 Inexact Rounded -precision: 14 -mulx265 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119 Inexact Rounded -precision: 13 -mulx266 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908012 Inexact Rounded -precision: 12 -mulx267 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801 Inexact Rounded -precision: 11 -mulx268 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080 Inexact Rounded -precision: 10 -mulx269 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908 Inexact Rounded -precision: 9 -mulx270 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.291 Inexact Rounded -precision: 8 -mulx271 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29 Inexact Rounded -precision: 7 -mulx272 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.3 Inexact Rounded -precision: 6 -mulx273 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433 Inexact Rounded -precision: 5 -mulx274 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1.4543E+5 Inexact Rounded -precision: 4 -mulx275 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1.454E+5 Inexact Rounded -precision: 3 -mulx276 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1.45E+5 Inexact Rounded -precision: 2 -mulx277 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1.5E+5 Inexact Rounded -precision: 1 -mulx278 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1E+5 Inexact Rounded - --- tryzeros cases -precision: 7 -rounding: half_up -maxExponent: 92 -minexponent: -92 -mulx504 multiply 0E-60 1000E-60 -> 0E-98 Clamped -mulx505 multiply 100E+60 0E+60 -> 0E+92 Clamped - --- mixed with zeros -maxexponent: 999999999 -minexponent: -999999999 -precision: 9 -mulx541 multiply 0 -1 -> -0 -mulx542 multiply -0 -1 -> 0 -mulx543 multiply 0 1 -> 0 -mulx544 multiply -0 1 -> -0 -mulx545 multiply -1 0 -> -0 -mulx546 multiply -1 -0 -> 0 -mulx547 multiply 1 0 -> 0 -mulx548 multiply 1 -0 -> -0 - -mulx551 multiply 0.0 -1 -> -0.0 -mulx552 multiply -0.0 -1 -> 0.0 -mulx553 multiply 0.0 1 -> 0.0 -mulx554 multiply -0.0 1 -> -0.0 -mulx555 multiply -1.0 0 -> -0.0 -mulx556 multiply -1.0 -0 -> 0.0 -mulx557 multiply 1.0 0 -> 0.0 -mulx558 multiply 1.0 -0 -> -0.0 - -mulx561 multiply 0 -1.0 -> -0.0 -mulx562 multiply -0 -1.0 -> 0.0 -mulx563 multiply 0 1.0 -> 0.0 -mulx564 multiply -0 1.0 -> -0.0 -mulx565 multiply -1 0.0 -> -0.0 -mulx566 multiply -1 -0.0 -> 0.0 -mulx567 multiply 1 0.0 -> 0.0 -mulx568 multiply 1 -0.0 -> -0.0 - -mulx571 multiply 0.0 -1.0 -> -0.00 -mulx572 multiply -0.0 -1.0 -> 0.00 -mulx573 multiply 0.0 1.0 -> 0.00 -mulx574 multiply -0.0 1.0 -> -0.00 -mulx575 multiply -1.0 0.0 -> -0.00 -mulx576 multiply -1.0 -0.0 -> 0.00 -mulx577 multiply 1.0 0.0 -> 0.00 -mulx578 multiply 1.0 -0.0 -> -0.00 - - --- Specials -mulx580 multiply Inf -Inf -> -Infinity -mulx581 multiply Inf -1000 -> -Infinity -mulx582 multiply Inf -1 -> -Infinity -mulx583 multiply Inf -0 -> NaN Invalid_operation -mulx584 multiply Inf 0 -> NaN Invalid_operation -mulx585 multiply Inf 1 -> Infinity -mulx586 multiply Inf 1000 -> Infinity -mulx587 multiply Inf Inf -> Infinity -mulx588 multiply -1000 Inf -> -Infinity -mulx589 multiply -Inf Inf -> -Infinity -mulx590 multiply -1 Inf -> -Infinity -mulx591 multiply -0 Inf -> NaN Invalid_operation -mulx592 multiply 0 Inf -> NaN Invalid_operation -mulx593 multiply 1 Inf -> Infinity -mulx594 multiply 1000 Inf -> Infinity -mulx595 multiply Inf Inf -> Infinity - -mulx600 multiply -Inf -Inf -> Infinity -mulx601 multiply -Inf -1000 -> Infinity -mulx602 multiply -Inf -1 -> Infinity -mulx603 multiply -Inf -0 -> NaN Invalid_operation -mulx604 multiply -Inf 0 -> NaN Invalid_operation -mulx605 multiply -Inf 1 -> -Infinity -mulx606 multiply -Inf 1000 -> -Infinity -mulx607 multiply -Inf Inf -> -Infinity -mulx608 multiply -1000 Inf -> -Infinity -mulx609 multiply -Inf -Inf -> Infinity -mulx610 multiply -1 -Inf -> Infinity -mulx611 multiply -0 -Inf -> NaN Invalid_operation -mulx612 multiply 0 -Inf -> NaN Invalid_operation -mulx613 multiply 1 -Inf -> -Infinity -mulx614 multiply 1000 -Inf -> -Infinity -mulx615 multiply Inf -Inf -> -Infinity - -mulx621 multiply NaN -Inf -> NaN -mulx622 multiply NaN -1000 -> NaN -mulx623 multiply NaN -1 -> NaN -mulx624 multiply NaN -0 -> NaN -mulx625 multiply NaN 0 -> NaN -mulx626 multiply NaN 1 -> NaN -mulx627 multiply NaN 1000 -> NaN -mulx628 multiply NaN Inf -> NaN -mulx629 multiply NaN NaN -> NaN -mulx630 multiply -Inf NaN -> NaN -mulx631 multiply -1000 NaN -> NaN -mulx632 multiply -1 NaN -> NaN -mulx633 multiply -0 NaN -> NaN -mulx634 multiply 0 NaN -> NaN -mulx635 multiply 1 NaN -> NaN -mulx636 multiply 1000 NaN -> NaN -mulx637 multiply Inf NaN -> NaN - -mulx641 multiply sNaN -Inf -> NaN Invalid_operation -mulx642 multiply sNaN -1000 -> NaN Invalid_operation -mulx643 multiply sNaN -1 -> NaN Invalid_operation -mulx644 multiply sNaN -0 -> NaN Invalid_operation -mulx645 multiply sNaN 0 -> NaN Invalid_operation -mulx646 multiply sNaN 1 -> NaN Invalid_operation -mulx647 multiply sNaN 1000 -> NaN Invalid_operation -mulx648 multiply sNaN NaN -> NaN Invalid_operation -mulx649 multiply sNaN sNaN -> NaN Invalid_operation -mulx650 multiply NaN sNaN -> NaN Invalid_operation -mulx651 multiply -Inf sNaN -> NaN Invalid_operation -mulx652 multiply -1000 sNaN -> NaN Invalid_operation -mulx653 multiply -1 sNaN -> NaN Invalid_operation -mulx654 multiply -0 sNaN -> NaN Invalid_operation -mulx655 multiply 0 sNaN -> NaN Invalid_operation -mulx656 multiply 1 sNaN -> NaN Invalid_operation -mulx657 multiply 1000 sNaN -> NaN Invalid_operation -mulx658 multiply Inf sNaN -> NaN Invalid_operation -mulx659 multiply NaN sNaN -> NaN Invalid_operation - --- propagating NaNs -mulx661 multiply NaN9 -Inf -> NaN9 -mulx662 multiply NaN8 999 -> NaN8 -mulx663 multiply NaN71 Inf -> NaN71 -mulx664 multiply NaN6 NaN5 -> NaN6 -mulx665 multiply -Inf NaN4 -> NaN4 -mulx666 multiply -999 NaN33 -> NaN33 -mulx667 multiply Inf NaN2 -> NaN2 - -mulx671 multiply sNaN99 -Inf -> NaN99 Invalid_operation -mulx672 multiply sNaN98 -11 -> NaN98 Invalid_operation -mulx673 multiply sNaN97 NaN -> NaN97 Invalid_operation -mulx674 multiply sNaN16 sNaN94 -> NaN16 Invalid_operation -mulx675 multiply NaN95 sNaN93 -> NaN93 Invalid_operation -mulx676 multiply -Inf sNaN92 -> NaN92 Invalid_operation -mulx677 multiply 088 sNaN91 -> NaN91 Invalid_operation -mulx678 multiply Inf sNaN90 -> NaN90 Invalid_operation -mulx679 multiply NaN sNaN89 -> NaN89 Invalid_operation - -mulx681 multiply -NaN9 -Inf -> -NaN9 -mulx682 multiply -NaN8 999 -> -NaN8 -mulx683 multiply -NaN71 Inf -> -NaN71 -mulx684 multiply -NaN6 -NaN5 -> -NaN6 -mulx685 multiply -Inf -NaN4 -> -NaN4 -mulx686 multiply -999 -NaN33 -> -NaN33 -mulx687 multiply Inf -NaN2 -> -NaN2 - -mulx691 multiply -sNaN99 -Inf -> -NaN99 Invalid_operation -mulx692 multiply -sNaN98 -11 -> -NaN98 Invalid_operation -mulx693 multiply -sNaN97 NaN -> -NaN97 Invalid_operation -mulx694 multiply -sNaN16 -sNaN94 -> -NaN16 Invalid_operation -mulx695 multiply -NaN95 -sNaN93 -> -NaN93 Invalid_operation -mulx696 multiply -Inf -sNaN92 -> -NaN92 Invalid_operation -mulx697 multiply 088 -sNaN91 -> -NaN91 Invalid_operation -mulx698 multiply Inf -sNaN90 -> -NaN90 Invalid_operation -mulx699 multiply -NaN -sNaN89 -> -NaN89 Invalid_operation - -mulx701 multiply -NaN -Inf -> -NaN -mulx702 multiply -NaN 999 -> -NaN -mulx703 multiply -NaN Inf -> -NaN -mulx704 multiply -NaN -NaN -> -NaN -mulx705 multiply -Inf -NaN0 -> -NaN -mulx706 multiply -999 -NaN -> -NaN -mulx707 multiply Inf -NaN -> -NaN - -mulx711 multiply -sNaN -Inf -> -NaN Invalid_operation -mulx712 multiply -sNaN -11 -> -NaN Invalid_operation -mulx713 multiply -sNaN00 NaN -> -NaN Invalid_operation -mulx714 multiply -sNaN -sNaN -> -NaN Invalid_operation -mulx715 multiply -NaN -sNaN -> -NaN Invalid_operation -mulx716 multiply -Inf -sNaN -> -NaN Invalid_operation -mulx717 multiply 088 -sNaN -> -NaN Invalid_operation -mulx718 multiply Inf -sNaN -> -NaN Invalid_operation -mulx719 multiply -NaN -sNaN -> -NaN Invalid_operation - --- overflow and underflow tests .. note subnormal results -maxexponent: 999999999 -minexponent: -999999999 -mulx730 multiply +1.23456789012345E-0 9E+999999999 -> Infinity Inexact Overflow Rounded -mulx731 multiply 9E+999999999 +1.23456789012345E-0 -> Infinity Inexact Overflow Rounded -mulx732 multiply +0.100 9E-999999999 -> 9.00E-1000000000 Subnormal -mulx733 multiply 9E-999999999 +0.100 -> 9.00E-1000000000 Subnormal -mulx735 multiply -1.23456789012345E-0 9E+999999999 -> -Infinity Inexact Overflow Rounded -mulx736 multiply 9E+999999999 -1.23456789012345E-0 -> -Infinity Inexact Overflow Rounded -mulx737 multiply -0.100 9E-999999999 -> -9.00E-1000000000 Subnormal -mulx738 multiply 9E-999999999 -0.100 -> -9.00E-1000000000 Subnormal - -mulx739 multiply 1e-599999999 1e-400000001 -> 1E-1000000000 Subnormal -mulx740 multiply 1e-599999999 1e-400000000 -> 1E-999999999 -mulx741 multiply 1e-600000000 1e-400000000 -> 1E-1000000000 Subnormal -mulx742 multiply 9e-999999998 0.01 -> 9E-1000000000 Subnormal -mulx743 multiply 9e-999999998 0.1 -> 9E-999999999 -mulx744 multiply 0.01 9e-999999998 -> 9E-1000000000 Subnormal -mulx745 multiply 1e599999999 1e400000001 -> Infinity Overflow Inexact Rounded -mulx746 multiply 1e599999999 1e400000000 -> 1E+999999999 -mulx747 multiply 1e600000000 1e400000000 -> Infinity Overflow Inexact Rounded -mulx748 multiply 9e999999998 100 -> Infinity Overflow Inexact Rounded -mulx749 multiply 9e999999998 10 -> 9.0E+999999999 -mulx750 multiply 100 9e999999998 -> Infinity Overflow Inexact Rounded --- signs -mulx751 multiply 1e+777777777 1e+411111111 -> Infinity Overflow Inexact Rounded -mulx752 multiply 1e+777777777 -1e+411111111 -> -Infinity Overflow Inexact Rounded -mulx753 multiply -1e+777777777 1e+411111111 -> -Infinity Overflow Inexact Rounded -mulx754 multiply -1e+777777777 -1e+411111111 -> Infinity Overflow Inexact Rounded -mulx755 multiply 1e-777777777 1e-411111111 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -mulx756 multiply 1e-777777777 -1e-411111111 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -mulx757 multiply -1e-777777777 1e-411111111 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -mulx758 multiply -1e-777777777 -1e-411111111 -> 0E-1000000007 Underflow Subnormal Inexact Rounded - --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) -precision: 9 -mulx760 multiply 1e-600000000 1e-400000001 -> 1E-1000000001 Subnormal -mulx761 multiply 1e-600000000 1e-400000002 -> 1E-1000000002 Subnormal -mulx762 multiply 1e-600000000 1e-400000003 -> 1E-1000000003 Subnormal -mulx763 multiply 1e-600000000 1e-400000004 -> 1E-1000000004 Subnormal -mulx764 multiply 1e-600000000 1e-400000005 -> 1E-1000000005 Subnormal -mulx765 multiply 1e-600000000 1e-400000006 -> 1E-1000000006 Subnormal -mulx766 multiply 1e-600000000 1e-400000007 -> 1E-1000000007 Subnormal -mulx767 multiply 1e-600000000 1e-400000008 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -mulx768 multiply 1e-600000000 1e-400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -mulx769 multiply 1e-600000000 1e-400000010 -> 0E-1000000007 Underflow Subnormal Inexact Rounded --- [no equivalent of 'subnormal' for overflow] -mulx770 multiply 1e+600000000 1e+400000001 -> Infinity Overflow Inexact Rounded -mulx771 multiply 1e+600000000 1e+400000002 -> Infinity Overflow Inexact Rounded -mulx772 multiply 1e+600000000 1e+400000003 -> Infinity Overflow Inexact Rounded -mulx773 multiply 1e+600000000 1e+400000004 -> Infinity Overflow Inexact Rounded -mulx774 multiply 1e+600000000 1e+400000005 -> Infinity Overflow Inexact Rounded -mulx775 multiply 1e+600000000 1e+400000006 -> Infinity Overflow Inexact Rounded -mulx776 multiply 1e+600000000 1e+400000007 -> Infinity Overflow Inexact Rounded -mulx777 multiply 1e+600000000 1e+400000008 -> Infinity Overflow Inexact Rounded -mulx778 multiply 1e+600000000 1e+400000009 -> Infinity Overflow Inexact Rounded -mulx779 multiply 1e+600000000 1e+400000010 -> Infinity Overflow Inexact Rounded - --- 'subnormal' test edge condition at higher precisions -precision: 99 -mulx780 multiply 1e-600000000 1e-400000007 -> 1E-1000000007 Subnormal -mulx781 multiply 1e-600000000 1e-400000008 -> 1E-1000000008 Subnormal -mulx782 multiply 1e-600000000 1e-400000097 -> 1E-1000000097 Subnormal -mulx783 multiply 1e-600000000 1e-400000098 -> 0E-1000000097 Underflow Subnormal Inexact Rounded -precision: 999 -mulx784 multiply 1e-600000000 1e-400000997 -> 1E-1000000997 Subnormal -mulx785 multiply 1e-600000000 1e-400000998 -> 0E-1000000997 Underflow Subnormal Inexact Rounded - --- following testcases [through mulx800] not yet run against code -precision: 9999 -mulx786 multiply 1e-600000000 1e-400009997 -> 1E-1000009997 Subnormal -mulx787 multiply 1e-600000000 1e-400009998 -> 0E-1000009997 Underflow Subnormal Inexact Rounded -precision: 99999 -mulx788 multiply 1e-600000000 1e-400099997 -> 1E-1000099997 Subnormal -mulx789 multiply 1e-600000000 1e-400099998 -> 0E-1000099997 Underflow Subnormal Inexact Rounded -precision: 999999 -mulx790 multiply 1e-600000000 1e-400999997 -> 1E-1000999997 Subnormal -mulx791 multiply 1e-600000000 1e-400999998 -> 0E-1000999997 Underflow Subnormal Inexact Rounded -precision: 9999999 -mulx792 multiply 1e-600000000 1e-409999997 -> 1E-1009999997 Subnormal -mulx793 multiply 1e-600000000 1e-409999998 -> 0E-1009999997 Underflow Subnormal Inexact Rounded -precision: 99999999 -mulx794 multiply 1e-600000000 1e-499999997 -> 1E-1099999997 Subnormal -mulx795 multiply 1e-600000000 1e-499999998 -> 0E-1099999997 Underflow Subnormal Inexact Rounded -precision: 999999999 -mulx796 multiply 1e-999999999 1e-999999997 -> 1E-1999999996 Subnormal -mulx797 multiply 1e-999999999 1e-999999998 -> 1E-1999999997 Subnormal -mulx798 multiply 1e-999999999 1e-999999999 -> 0E-1999999997 Underflow Subnormal Inexact Rounded -mulx799 multiply 1e-600000000 1e-400000007 -> 1E-1000000007 Subnormal -mulx800 multiply 1e-600000000 1e-400000008 -> 1E-1000000008 Subnormal - --- test subnormals rounding -precision: 5 -maxExponent: 999 -minexponent: -999 -rounding: half_even - -mulx801 multiply 1.0000E-999 1 -> 1.0000E-999 -mulx802 multiply 1.000E-999 1e-1 -> 1.000E-1000 Subnormal -mulx803 multiply 1.00E-999 1e-2 -> 1.00E-1001 Subnormal -mulx804 multiply 1.0E-999 1e-3 -> 1.0E-1002 Subnormal -mulx805 multiply 1.0E-999 1e-4 -> 1E-1003 Subnormal Rounded -mulx806 multiply 1.3E-999 1e-4 -> 1E-1003 Underflow Subnormal Inexact Rounded -mulx807 multiply 1.5E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded -mulx808 multiply 1.7E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded -mulx809 multiply 2.3E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded -mulx810 multiply 2.5E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded -mulx811 multiply 2.7E-999 1e-4 -> 3E-1003 Underflow Subnormal Inexact Rounded -mulx812 multiply 1.49E-999 1e-4 -> 1E-1003 Underflow Subnormal Inexact Rounded -mulx813 multiply 1.50E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded -mulx814 multiply 1.51E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded -mulx815 multiply 2.49E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded -mulx816 multiply 2.50E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded -mulx817 multiply 2.51E-999 1e-4 -> 3E-1003 Underflow Subnormal Inexact Rounded - -mulx818 multiply 1E-999 1e-4 -> 1E-1003 Subnormal -mulx819 multiply 3E-999 1e-5 -> 0E-1003 Underflow Subnormal Inexact Rounded -mulx820 multiply 5E-999 1e-5 -> 0E-1003 Underflow Subnormal Inexact Rounded -mulx821 multiply 7E-999 1e-5 -> 1E-1003 Underflow Subnormal Inexact Rounded -mulx822 multiply 9E-999 1e-5 -> 1E-1003 Underflow Subnormal Inexact Rounded -mulx823 multiply 9.9E-999 1e-5 -> 1E-1003 Underflow Subnormal Inexact Rounded - -mulx824 multiply 1E-999 -1e-4 -> -1E-1003 Subnormal -mulx825 multiply 3E-999 -1e-5 -> -0E-1003 Underflow Subnormal Inexact Rounded -mulx826 multiply -5E-999 1e-5 -> -0E-1003 Underflow Subnormal Inexact Rounded -mulx827 multiply 7E-999 -1e-5 -> -1E-1003 Underflow Subnormal Inexact Rounded -mulx828 multiply -9E-999 1e-5 -> -1E-1003 Underflow Subnormal Inexact Rounded -mulx829 multiply 9.9E-999 -1e-5 -> -1E-1003 Underflow Subnormal Inexact Rounded -mulx830 multiply 3.0E-999 -1e-5 -> -0E-1003 Underflow Subnormal Inexact Rounded - -mulx831 multiply 1.0E-501 1e-501 -> 1.0E-1002 Subnormal -mulx832 multiply 2.0E-501 2e-501 -> 4.0E-1002 Subnormal -mulx833 multiply 4.0E-501 4e-501 -> 1.60E-1001 Subnormal -mulx834 multiply 10.0E-501 10e-501 -> 1.000E-1000 Subnormal -mulx835 multiply 30.0E-501 30e-501 -> 9.000E-1000 Subnormal -mulx836 multiply 40.0E-501 40e-501 -> 1.6000E-999 - --- squares -mulx840 multiply 1E-502 1e-502 -> 0E-1003 Underflow Subnormal Inexact Rounded -mulx841 multiply 1E-501 1e-501 -> 1E-1002 Subnormal -mulx842 multiply 2E-501 2e-501 -> 4E-1002 Subnormal -mulx843 multiply 4E-501 4e-501 -> 1.6E-1001 Subnormal -mulx844 multiply 10E-501 10e-501 -> 1.00E-1000 Subnormal -mulx845 multiply 30E-501 30e-501 -> 9.00E-1000 Subnormal -mulx846 multiply 40E-501 40e-501 -> 1.600E-999 - --- cubes -mulx850 multiply 1E-670 1e-335 -> 0E-1003 Underflow Subnormal Inexact Rounded -mulx851 multiply 1E-668 1e-334 -> 1E-1002 Subnormal -mulx852 multiply 4E-668 2e-334 -> 8E-1002 Subnormal -mulx853 multiply 9E-668 3e-334 -> 2.7E-1001 Subnormal -mulx854 multiply 16E-668 4e-334 -> 6.4E-1001 Subnormal -mulx855 multiply 25E-668 5e-334 -> 1.25E-1000 Subnormal -mulx856 multiply 10E-668 100e-334 -> 1.000E-999 - --- test from 0.099 ** 999 at 15 digits -precision: 19 -mulx860 multiply 6636851557994578716E-520 6636851557994578716E-520 -> 4.40477986028551E-1003 Underflow Subnormal Inexact Rounded - --- Long operand overflow may be a different path -precision: 3 -maxExponent: 999999999 -minexponent: -999999999 -mulx870 multiply 1 9.999E+999999999 -> Infinity Inexact Overflow Rounded -mulx871 multiply 1 -9.999E+999999999 -> -Infinity Inexact Overflow Rounded -mulx872 multiply 9.999E+999999999 1 -> Infinity Inexact Overflow Rounded -mulx873 multiply -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded - --- check for double-rounded subnormals -precision: 5 -maxexponent: 79 -minexponent: -79 -mulx881 multiply 1.2347E-40 1.2347E-40 -> 1.524E-80 Inexact Rounded Subnormal Underflow -mulx882 multiply 1.234E-40 1.234E-40 -> 1.523E-80 Inexact Rounded Subnormal Underflow -mulx883 multiply 1.23E-40 1.23E-40 -> 1.513E-80 Inexact Rounded Subnormal Underflow -mulx884 multiply 1.2E-40 1.2E-40 -> 1.44E-80 Subnormal -mulx885 multiply 1.2E-40 1.2E-41 -> 1.44E-81 Subnormal -mulx886 multiply 1.2E-40 1.2E-42 -> 1.4E-82 Subnormal Inexact Rounded Underflow -mulx887 multiply 1.2E-40 1.3E-42 -> 1.6E-82 Subnormal Inexact Rounded Underflow -mulx888 multiply 1.3E-40 1.3E-42 -> 1.7E-82 Subnormal Inexact Rounded Underflow - -mulx891 multiply 1.2345E-39 1.234E-40 -> 1.5234E-79 Inexact Rounded -mulx892 multiply 1.23456E-39 1.234E-40 -> 1.5234E-79 Inexact Rounded -mulx893 multiply 1.2345E-40 1.234E-40 -> 1.523E-80 Inexact Rounded Subnormal Underflow -mulx894 multiply 1.23456E-40 1.234E-40 -> 1.523E-80 Inexact Rounded Subnormal Underflow -mulx895 multiply 1.2345E-41 1.234E-40 -> 1.52E-81 Inexact Rounded Subnormal Underflow -mulx896 multiply 1.23456E-41 1.234E-40 -> 1.52E-81 Inexact Rounded Subnormal Underflow - --- Null tests -mulx900 multiply 10 # -> NaN Invalid_operation -mulx901 multiply # 10 -> NaN Invalid_operation - diff --git a/sys/lib/python/test/decimaltestdata/normalize.decTest b/sys/lib/python/test/decimaltestdata/normalize.decTest deleted file mode 100644 index 570883911..000000000 --- a/sys/lib/python/test/decimaltestdata/normalize.decTest +++ /dev/null @@ -1,225 +0,0 @@ ------------------------------------------------------------------------- --- normalize.decTest -- remove trailing zeros -- --- Copyright (c) IBM Corporation, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 999 -minexponent: -999 - -nrmx001 normalize '1' -> '1' -nrmx002 normalize '-1' -> '-1' -nrmx003 normalize '1.00' -> '1' -nrmx004 normalize '-1.00' -> '-1' -nrmx005 normalize '0' -> '0' -nrmx006 normalize '0.00' -> '0' -nrmx007 normalize '00.0' -> '0' -nrmx008 normalize '00.00' -> '0' -nrmx009 normalize '00' -> '0' -nrmx010 normalize '0E+1' -> '0' -nrmx011 normalize '0E+5' -> '0' - -nrmx012 normalize '-2' -> '-2' -nrmx013 normalize '2' -> '2' -nrmx014 normalize '-2.00' -> '-2' -nrmx015 normalize '2.00' -> '2' -nrmx016 normalize '-0' -> '-0' -nrmx017 normalize '-0.00' -> '-0' -nrmx018 normalize '-00.0' -> '-0' -nrmx019 normalize '-00.00' -> '-0' -nrmx020 normalize '-00' -> '-0' -nrmx021 normalize '-0E+5' -> '-0' -nrmx022 normalize '-0E+1' -> '-0' - -nrmx030 normalize '+0.1' -> '0.1' -nrmx031 normalize '-0.1' -> '-0.1' -nrmx032 normalize '+0.01' -> '0.01' -nrmx033 normalize '-0.01' -> '-0.01' -nrmx034 normalize '+0.001' -> '0.001' -nrmx035 normalize '-0.001' -> '-0.001' -nrmx036 normalize '+0.000001' -> '0.000001' -nrmx037 normalize '-0.000001' -> '-0.000001' -nrmx038 normalize '+0.000000000001' -> '1E-12' -nrmx039 normalize '-0.000000000001' -> '-1E-12' - -nrmx041 normalize 1.1 -> 1.1 -nrmx042 normalize 1.10 -> 1.1 -nrmx043 normalize 1.100 -> 1.1 -nrmx044 normalize 1.110 -> 1.11 -nrmx045 normalize -1.1 -> -1.1 -nrmx046 normalize -1.10 -> -1.1 -nrmx047 normalize -1.100 -> -1.1 -nrmx048 normalize -1.110 -> -1.11 -nrmx049 normalize 9.9 -> 9.9 -nrmx050 normalize 9.90 -> 9.9 -nrmx051 normalize 9.900 -> 9.9 -nrmx052 normalize 9.990 -> 9.99 -nrmx053 normalize -9.9 -> -9.9 -nrmx054 normalize -9.90 -> -9.9 -nrmx055 normalize -9.900 -> -9.9 -nrmx056 normalize -9.990 -> -9.99 - --- some trailing fractional zeros with zeros in units -nrmx060 normalize 10.0 -> 1E+1 -nrmx061 normalize 10.00 -> 1E+1 -nrmx062 normalize 100.0 -> 1E+2 -nrmx063 normalize 100.00 -> 1E+2 -nrmx064 normalize 1.1000E+3 -> 1.1E+3 -nrmx065 normalize 1.10000E+3 -> 1.1E+3 -nrmx066 normalize -10.0 -> -1E+1 -nrmx067 normalize -10.00 -> -1E+1 -nrmx068 normalize -100.0 -> -1E+2 -nrmx069 normalize -100.00 -> -1E+2 -nrmx070 normalize -1.1000E+3 -> -1.1E+3 -nrmx071 normalize -1.10000E+3 -> -1.1E+3 - --- some insignificant trailing zeros with positive exponent -nrmx080 normalize 10E+1 -> 1E+2 -nrmx081 normalize 100E+1 -> 1E+3 -nrmx082 normalize 1.0E+2 -> 1E+2 -nrmx083 normalize 1.0E+3 -> 1E+3 -nrmx084 normalize 1.1E+3 -> 1.1E+3 -nrmx085 normalize 1.00E+3 -> 1E+3 -nrmx086 normalize 1.10E+3 -> 1.1E+3 -nrmx087 normalize -10E+1 -> -1E+2 -nrmx088 normalize -100E+1 -> -1E+3 -nrmx089 normalize -1.0E+2 -> -1E+2 -nrmx090 normalize -1.0E+3 -> -1E+3 -nrmx091 normalize -1.1E+3 -> -1.1E+3 -nrmx092 normalize -1.00E+3 -> -1E+3 -nrmx093 normalize -1.10E+3 -> -1.1E+3 - --- some significant trailing zeros, were we to be trimming -nrmx100 normalize 11 -> 11 -nrmx101 normalize 10 -> 1E+1 -nrmx102 normalize 10. -> 1E+1 -nrmx103 normalize 1.1E+1 -> 11 -nrmx104 normalize 1.0E+1 -> 1E+1 -nrmx105 normalize 1.10E+2 -> 1.1E+2 -nrmx106 normalize 1.00E+2 -> 1E+2 -nrmx107 normalize 1.100E+3 -> 1.1E+3 -nrmx108 normalize 1.000E+3 -> 1E+3 -nrmx109 normalize 1.000000E+6 -> 1E+6 -nrmx110 normalize -11 -> -11 -nrmx111 normalize -10 -> -1E+1 -nrmx112 normalize -10. -> -1E+1 -nrmx113 normalize -1.1E+1 -> -11 -nrmx114 normalize -1.0E+1 -> -1E+1 -nrmx115 normalize -1.10E+2 -> -1.1E+2 -nrmx116 normalize -1.00E+2 -> -1E+2 -nrmx117 normalize -1.100E+3 -> -1.1E+3 -nrmx118 normalize -1.000E+3 -> -1E+3 -nrmx119 normalize -1.00000E+5 -> -1E+5 -nrmx120 normalize -1.000000E+6 -> -1E+6 -nrmx121 normalize -10.00000E+6 -> -1E+7 -nrmx122 normalize -100.0000E+6 -> -1E+8 -nrmx123 normalize -1000.000E+6 -> -1E+9 -nrmx124 normalize -10000.00E+6 -> -1E+10 -nrmx125 normalize -100000.0E+6 -> -1E+11 -nrmx126 normalize -1000000.E+6 -> -1E+12 - --- examples from decArith -nrmx140 normalize '2.1' -> '2.1' -nrmx141 normalize '-2.0' -> '-2' -nrmx142 normalize '1.200' -> '1.2' -nrmx143 normalize '-120' -> '-1.2E+2' -nrmx144 normalize '120.00' -> '1.2E+2' -nrmx145 normalize '0.00' -> '0' - --- overflow tests -maxexponent: 999999999 -minexponent: -999999999 -precision: 3 -nrmx160 normalize 9.999E+999999999 -> Infinity Inexact Overflow Rounded -nrmx161 normalize -9.999E+999999999 -> -Infinity Inexact Overflow Rounded - --- subnormals and underflow -precision: 3 -maxexponent: 999 -minexponent: -999 -nrmx210 normalize 1.00E-999 -> 1E-999 -nrmx211 normalize 0.1E-999 -> 1E-1000 Subnormal -nrmx212 normalize 0.10E-999 -> 1E-1000 Subnormal -nrmx213 normalize 0.100E-999 -> 1E-1000 Subnormal Rounded -nrmx214 normalize 0.01E-999 -> 1E-1001 Subnormal --- next is rounded to Emin -nrmx215 normalize 0.999E-999 -> 1E-999 Inexact Rounded Subnormal Underflow -nrmx216 normalize 0.099E-999 -> 1E-1000 Inexact Rounded Subnormal Underflow -nrmx217 normalize 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow -nrmx218 normalize 0.001E-999 -> 0 Inexact Rounded Subnormal Underflow -nrmx219 normalize 0.0009E-999 -> 0 Inexact Rounded Subnormal Underflow -nrmx220 normalize 0.0001E-999 -> 0 Inexact Rounded Subnormal Underflow - -nrmx230 normalize -1.00E-999 -> -1E-999 -nrmx231 normalize -0.1E-999 -> -1E-1000 Subnormal -nrmx232 normalize -0.10E-999 -> -1E-1000 Subnormal -nrmx233 normalize -0.100E-999 -> -1E-1000 Subnormal Rounded -nrmx234 normalize -0.01E-999 -> -1E-1001 Subnormal --- next is rounded to Emin -nrmx235 normalize -0.999E-999 -> -1E-999 Inexact Rounded Subnormal Underflow -nrmx236 normalize -0.099E-999 -> -1E-1000 Inexact Rounded Subnormal Underflow -nrmx237 normalize -0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow -nrmx238 normalize -0.001E-999 -> -0 Inexact Rounded Subnormal Underflow -nrmx239 normalize -0.0009E-999 -> -0 Inexact Rounded Subnormal Underflow -nrmx240 normalize -0.0001E-999 -> -0 Inexact Rounded Subnormal Underflow - --- more reshaping -precision: 9 -nrmx260 normalize '56260E-10' -> '0.000005626' -nrmx261 normalize '56260E-5' -> '0.5626' -nrmx262 normalize '56260E-2' -> '562.6' -nrmx263 normalize '56260E-1' -> '5626' -nrmx265 normalize '56260E-0' -> '5.626E+4' -nrmx266 normalize '56260E+0' -> '5.626E+4' -nrmx267 normalize '56260E+1' -> '5.626E+5' -nrmx268 normalize '56260E+2' -> '5.626E+6' -nrmx269 normalize '56260E+3' -> '5.626E+7' -nrmx270 normalize '56260E+4' -> '5.626E+8' -nrmx271 normalize '56260E+5' -> '5.626E+9' -nrmx272 normalize '56260E+6' -> '5.626E+10' -nrmx280 normalize '-56260E-10' -> '-0.000005626' -nrmx281 normalize '-56260E-5' -> '-0.5626' -nrmx282 normalize '-56260E-2' -> '-562.6' -nrmx283 normalize '-56260E-1' -> '-5626' -nrmx285 normalize '-56260E-0' -> '-5.626E+4' -nrmx286 normalize '-56260E+0' -> '-5.626E+4' -nrmx287 normalize '-56260E+1' -> '-5.626E+5' -nrmx288 normalize '-56260E+2' -> '-5.626E+6' -nrmx289 normalize '-56260E+3' -> '-5.626E+7' -nrmx290 normalize '-56260E+4' -> '-5.626E+8' -nrmx291 normalize '-56260E+5' -> '-5.626E+9' -nrmx292 normalize '-56260E+6' -> '-5.626E+10' - - --- specials -nrmx820 normalize 'Inf' -> 'Infinity' -nrmx821 normalize '-Inf' -> '-Infinity' -nrmx822 normalize NaN -> NaN -nrmx823 normalize sNaN -> NaN Invalid_operation -nrmx824 normalize NaN101 -> NaN101 -nrmx825 normalize sNaN010 -> NaN10 Invalid_operation -nrmx827 normalize -NaN -> -NaN -nrmx828 normalize -sNaN -> -NaN Invalid_operation -nrmx829 normalize -NaN101 -> -NaN101 -nrmx830 normalize -sNaN010 -> -NaN10 Invalid_operation - --- Null test -nrmx900 normalize # -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/plus.decTest b/sys/lib/python/test/decimaltestdata/plus.decTest deleted file mode 100644 index a6d8e58c3..000000000 --- a/sys/lib/python/test/decimaltestdata/plus.decTest +++ /dev/null @@ -1,181 +0,0 @@ ------------------------------------------------------------------------- --- plus.decTest -- decimal monadic addition -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- This set of tests primarily tests the existence of the operator. --- Addition and rounding, and most overflows, are tested elsewhere. - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - -plux001 plus '1' -> '1' -plux002 plus '-1' -> '-1' -plux003 plus '1.00' -> '1.00' -plux004 plus '-1.00' -> '-1.00' -plux005 plus '0' -> '0' -plux006 plus '0.00' -> '0.00' -plux007 plus '00.0' -> '0.0' -plux008 plus '00.00' -> '0.00' -plux009 plus '00' -> '0' - -plux010 plus '-2' -> '-2' -plux011 plus '2' -> '2' -plux012 plus '-2.00' -> '-2.00' -plux013 plus '2.00' -> '2.00' -plux014 plus '-0' -> '0' -plux015 plus '-0.00' -> '0.00' -plux016 plus '-00.0' -> '0.0' -plux017 plus '-00.00' -> '0.00' -plux018 plus '-00' -> '0' - -plux020 plus '-2000000' -> '-2000000' -plux021 plus '2000000' -> '2000000' -precision: 7 -plux022 plus '-2000000' -> '-2000000' -plux023 plus '2000000' -> '2000000' -precision: 6 -plux024 plus '-2000000' -> '-2.00000E+6' Rounded -plux025 plus '2000000' -> '2.00000E+6' Rounded -precision: 3 -plux026 plus '-2000000' -> '-2.00E+6' Rounded -plux027 plus '2000000' -> '2.00E+6' Rounded - --- more fixed, potential LHS swaps if done by add 0 -precision: 9 -plux060 plus '56267E-10' -> '0.0000056267' -plux061 plus '56267E-5' -> '0.56267' -plux062 plus '56267E-2' -> '562.67' -plux063 plus '56267E-1' -> '5626.7' -plux065 plus '56267E-0' -> '56267' -plux066 plus '56267E+0' -> '56267' -plux067 plus '56267E+1' -> '5.6267E+5' -plux068 plus '56267E+2' -> '5.6267E+6' -plux069 plus '56267E+3' -> '5.6267E+7' -plux070 plus '56267E+4' -> '5.6267E+8' -plux071 plus '56267E+5' -> '5.6267E+9' -plux072 plus '56267E+6' -> '5.6267E+10' -plux080 plus '-56267E-10' -> '-0.0000056267' -plux081 plus '-56267E-5' -> '-0.56267' -plux082 plus '-56267E-2' -> '-562.67' -plux083 plus '-56267E-1' -> '-5626.7' -plux085 plus '-56267E-0' -> '-56267' -plux086 plus '-56267E+0' -> '-56267' -plux087 plus '-56267E+1' -> '-5.6267E+5' -plux088 plus '-56267E+2' -> '-5.6267E+6' -plux089 plus '-56267E+3' -> '-5.6267E+7' -plux090 plus '-56267E+4' -> '-5.6267E+8' -plux091 plus '-56267E+5' -> '-5.6267E+9' -plux092 plus '-56267E+6' -> '-5.6267E+10' - --- "lhs" zeros in plus and minus have exponent = operand -plux120 plus '-0E3' -> '0E+3' -plux121 plus '-0E2' -> '0E+2' -plux122 plus '-0E1' -> '0E+1' -plux123 plus '-0E0' -> '0' -plux124 plus '+0E0' -> '0' -plux125 plus '+0E1' -> '0E+1' -plux126 plus '+0E2' -> '0E+2' -plux127 plus '+0E3' -> '0E+3' - -plux130 plus '-5E3' -> '-5E+3' -plux131 plus '-5E8' -> '-5E+8' -plux132 plus '-5E13' -> '-5E+13' -plux133 plus '-5E18' -> '-5E+18' -plux134 plus '+5E3' -> '5E+3' -plux135 plus '+5E8' -> '5E+8' -plux136 plus '+5E13' -> '5E+13' -plux137 plus '+5E18' -> '5E+18' - --- specials -plux150 plus 'Inf' -> 'Infinity' -plux151 plus '-Inf' -> '-Infinity' -plux152 plus NaN -> NaN -plux153 plus sNaN -> NaN Invalid_operation -plux154 plus NaN77 -> NaN77 -plux155 plus sNaN88 -> NaN88 Invalid_operation -plux156 plus -NaN -> -NaN -plux157 plus -sNaN -> -NaN Invalid_operation -plux158 plus -NaN77 -> -NaN77 -plux159 plus -sNaN88 -> -NaN88 Invalid_operation - --- overflow tests -maxexponent: 999999999 -minexponent: -999999999 -precision: 3 -plux160 plus 9.999E+999999999 -> Infinity Inexact Overflow Rounded -plux161 plus -9.999E+999999999 -> -Infinity Inexact Overflow Rounded - --- subnormals and underflow -precision: 3 -maxexponent: 999 -minexponent: -999 -plux210 plus 1.00E-999 -> 1.00E-999 -plux211 plus 0.1E-999 -> 1E-1000 Subnormal -plux212 plus 0.10E-999 -> 1.0E-1000 Subnormal -plux213 plus 0.100E-999 -> 1.0E-1000 Subnormal Rounded -plux214 plus 0.01E-999 -> 1E-1001 Subnormal --- next is rounded to Emin -plux215 plus 0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow -plux216 plus 0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -plux217 plus 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow -plux218 plus 0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -plux219 plus 0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -plux220 plus 0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow - -plux230 plus -1.00E-999 -> -1.00E-999 -plux231 plus -0.1E-999 -> -1E-1000 Subnormal -plux232 plus -0.10E-999 -> -1.0E-1000 Subnormal -plux233 plus -0.100E-999 -> -1.0E-1000 Subnormal Rounded -plux234 plus -0.01E-999 -> -1E-1001 Subnormal --- next is rounded to Emin -plux235 plus -0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow -plux236 plus -0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -plux237 plus -0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow -plux238 plus -0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow -plux239 plus -0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow -plux240 plus -0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow - --- long operand checks -maxexponent: 999 -minexponent: -999 -precision: 9 -plux301 plus 12345678000 -> 1.23456780E+10 Rounded -plux302 plus 1234567800 -> 1.23456780E+9 Rounded -plux303 plus 1234567890 -> 1.23456789E+9 Rounded -plux304 plus 1234567891 -> 1.23456789E+9 Inexact Rounded -plux305 plus 12345678901 -> 1.23456789E+10 Inexact Rounded -plux306 plus 1234567896 -> 1.23456790E+9 Inexact Rounded - --- still checking -precision: 15 -plux321 plus 12345678000 -> 12345678000 -plux322 plus 1234567800 -> 1234567800 -plux323 plus 1234567890 -> 1234567890 -plux324 plus 1234567891 -> 1234567891 -plux325 plus 12345678901 -> 12345678901 -plux326 plus 1234567896 -> 1234567896 -precision: 9 - --- Null tests -plu900 plus # -> NaN Invalid_operation - diff --git a/sys/lib/python/test/decimaltestdata/power.decTest b/sys/lib/python/test/decimaltestdata/power.decTest deleted file mode 100644 index 748d66a3e..000000000 --- a/sys/lib/python/test/decimaltestdata/power.decTest +++ /dev/null @@ -1,651 +0,0 @@ ----------------------------------------------------------------------- --- power.decTest -- decimal exponentiation -- --- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- This set of testcases tests raising numbers to an integer power only. --- If arbitrary powers were supported, 1 ulp differences would be --- permitted. - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 999 -minexponent: -999 - --- base checks. Note 0**0 is an error. -powx001 power '0' '0' -> NaN Invalid_operation -powx002 power '0' '1' -> '0' -powx003 power '0' '2' -> '0' -powx004 power '1' '0' -> '1' -powx005 power '1' '1' -> '1' -powx006 power '1' '2' -> '1' - -powx010 power '2' '0' -> '1' -powx011 power '2' '1' -> '2' -powx012 power '2' '2' -> '4' -powx013 power '2' '3' -> '8' -powx014 power '2' '4' -> '16' -powx015 power '2' '5' -> '32' -powx016 power '2' '6' -> '64' -powx017 power '2' '7' -> '128' -powx018 power '2' '8' -> '256' -powx019 power '2' '9' -> '512' -powx020 power '2' '10' -> '1024' -powx021 power '2' '11' -> '2048' -powx022 power '2' '12' -> '4096' -powx023 power '2' '15' -> '32768' -powx024 power '2' '16' -> '65536' -powx025 power '2' '31' -> '2.14748365E+9' Inexact Rounded --- NB 0 not stripped in next -powx026 power '2' '32' -> '4.29496730E+9' Inexact Rounded -precision: 10 -powx027 power '2' '31' -> '2147483648' -powx028 power '2' '32' -> '4294967296' -precision: 9 - -powx030 power '3' '2' -> 9 -powx031 power '4' '2' -> 16 -powx032 power '5' '2' -> 25 -powx033 power '6' '2' -> 36 -powx034 power '7' '2' -> 49 -powx035 power '8' '2' -> 64 -powx036 power '9' '2' -> 81 -powx037 power '10' '2' -> 100 -powx038 power '11' '2' -> 121 -powx039 power '12' '2' -> 144 - -powx040 power '3' '3' -> 27 -powx041 power '4' '3' -> 64 -powx042 power '5' '3' -> 125 -powx043 power '6' '3' -> 216 -powx044 power '7' '3' -> 343 - -powx050 power '10' '0' -> 1 -powx051 power '10' '1' -> 10 -powx052 power '10' '2' -> 100 -powx053 power '10' '3' -> 1000 -powx054 power '10' '4' -> 10000 -powx055 power '10' '5' -> 100000 -powx056 power '10' '6' -> 1000000 -powx057 power '10' '7' -> 10000000 -powx058 power '10' '8' -> 100000000 -powx059 power '10' '9' -> 1.00000000E+9 Rounded -powx060 power '10' '22' -> 1.00000000E+22 Rounded -powx061 power '10' '77' -> 1.00000000E+77 Rounded -powx062 power '10' '99' -> 1.00000000E+99 Rounded - -maxexponent: 999999999 -minexponent: -999999999 -powx063 power '10' '999999999' -> '1.00000000E+999999999' Rounded -powx064 power '10' '999999998' -> '1.00000000E+999999998' Rounded -powx065 power '10' '999999997' -> '1.00000000E+999999997' Rounded -powx066 power '10' '333333333' -> '1.00000000E+333333333' Rounded - -powx070 power '0.3' '0' -> '1' -powx071 power '0.3' '1' -> '0.3' -powx072 power '0.3' '1.00' -> '0.3' -powx073 power '0.3' '2.00' -> '0.09' -powx074 power '0.3' '2.000000000' -> '0.09' -powx075 power '6.0' '1' -> '6.0' -- NB zeros not stripped -powx076 power '6.0' '2' -> '36.00' -- .. -powx077 power '-3' '2' -> '9' -- from NetRexx book -powx078 power '4' '3' -> '64' -- .. (sort of) - -powx080 power 0.1 0 -> 1 -powx081 power 0.1 1 -> 0.1 -powx082 power 0.1 2 -> 0.01 -powx083 power 0.1 3 -> 0.001 -powx084 power 0.1 4 -> 0.0001 -powx085 power 0.1 5 -> 0.00001 -powx086 power 0.1 6 -> 0.000001 -powx087 power 0.1 7 -> 1E-7 -powx088 power 0.1 8 -> 1E-8 -powx089 power 0.1 9 -> 1E-9 - -powx090 power 101 2 -> 10201 -powx091 power 101 3 -> 1030301 -powx092 power 101 4 -> 104060401 -powx093 power 101 5 -> 1.05101005E+10 Inexact Rounded -powx094 power 101 6 -> 1.06152015E+12 Inexact Rounded -powx095 power 101 7 -> 1.07213535E+14 Inexact Rounded - --- negative powers -powx101 power '2' '-1' -> 0.5 -powx102 power '2' '-2' -> 0.25 -powx103 power '2' '-4' -> 0.0625 -powx104 power '2' '-8' -> 0.00390625 -powx105 power '2' '-16' -> 0.0000152587891 Inexact Rounded -powx106 power '2' '-32' -> 2.32830644E-10 Inexact Rounded -powx108 power '2' '-64' -> 5.42101086E-20 Inexact Rounded -powx110 power '10' '-8' -> 1E-8 -powx111 power '10' '-7' -> 1E-7 -powx112 power '10' '-6' -> 0.000001 -powx113 power '10' '-5' -> 0.00001 -powx114 power '10' '-4' -> 0.0001 -powx115 power '10' '-3' -> 0.001 -powx116 power '10' '-2' -> 0.01 -powx117 power '10' '-1' -> 0.1 - -powx118 power '10' '-333333333' -> 1E-333333333 -powx119 power '10' '-999999998' -> 1E-999999998 -powx120 power '10' '-999999999' -> 1E-999999999 -powx121 power '10' '-77' -> '1E-77' -powx122 power '10' '-22' -> '1E-22' - -powx123 power '2' '-1' -> '0.5' -powx124 power '2' '-2' -> '0.25' -powx125 power '2' '-4' -> '0.0625' -powx126 power '0' '-1' -> Infinity Division_by_zero -powx127 power '0' '-2' -> Infinity Division_by_zero -powx128 power -0 '-1' -> -Infinity Division_by_zero -powx129 power -0 '-2' -> Infinity Division_by_zero - --- out-of-range edge cases -powx181 power '7' '999999998' -> 2.10892313E+845098038 Inexact Rounded -powx182 power '7' '999999999' -> 1.47624619E+845098039 Inexact Rounded -powx183 power '7' '1000000000' -> NaN Invalid_operation -powx184 power '7' '1000000001' -> NaN Invalid_operation -powx185 power '7' '10000000000' -> NaN Invalid_operation -powx186 power '7' '-1000000001' -> NaN Invalid_operation -powx187 power '7' '-1000000000' -> NaN Invalid_operation -powx189 power '7' '-999999999' -> 6.77393787E-845098040 Inexact Rounded -powx190 power '7' '-999999998' -> 4.74175651E-845098039 Inexact Rounded - --- some baddies [more below] -powx191 power '2' '2.000001' -> NaN Invalid_operation -powx192 power '2' '2.00000000' -> 4 -powx193 power '2' '2.000000001' -> NaN Invalid_operation -powx194 power '2' '2.0000000001' -> NaN Invalid_operation - --- "0.5" tests from original Rexx diagnostics [loop unrolled] -powx200 power 0.5 0 -> 1 -powx201 power 0.5 1 -> 0.5 -powx202 power 0.5 2 -> 0.25 -powx203 power 0.5 3 -> 0.125 -powx204 power 0.5 4 -> 0.0625 -powx205 power 0.5 5 -> 0.03125 -powx206 power 0.5 6 -> 0.015625 -powx207 power 0.5 7 -> 0.0078125 -powx208 power 0.5 8 -> 0.00390625 -powx209 power 0.5 9 -> 0.001953125 -powx210 power 0.5 10 -> 0.0009765625 - --- A (rare) case where the last digit is not within 0.5 ULP -precision: 9 -powx215 power "-21971575.0E+31454441" "-7" -> "-4.04549503E-220181139" Inexact Rounded -precision: 20 -powx216 power "-21971575.0E+31454441" "-7" -> "-4.0454950249324891788E-220181139" Inexact Rounded - --- The Vienna case. Checks both setup and 1/acc working precision --- Modified 1998.12.14 as RHS no longer rounded before use (must fit) --- Modified 1990.02.04 as LHS is now rounded (instead of truncated to guard) --- '123456789E+10' -- lhs .. rounded to 1.23E+18 --- '-1.23000e+2' -- rhs .. [was: -1.23455e+2, rounds to -123] --- Modified 2002.10.06 -- finally, no input rounding --- With input rounding, result would be 8.74E-2226 -precision: 3 -powx219 power '123456789E+10' '-1.23000e+2' -> '5.54E-2226' Inexact Rounded - --- whole number checks -precision: 9 -powx221 power 1 1234 -> 1 -precision: 4 -powx222 power 1 1234 -> 1 -precision: 3 -powx223 power 1 1234 -> 1 -powx224 power 1 12.34e+2 -> 1 -powx225 power 1 12.3 -> NaN Invalid_operation -powx226 power 1 12.0 -> 1 -powx227 power 1 1.01 -> NaN Invalid_operation -powx228 power 2 1.00 -> 2 -powx229 power 2 2.00 -> 4 -precision: 9 -powx230 power 1 1.0001 -> NaN Invalid_operation -powx231 power 1 1.0000001 -> NaN Invalid_operation -powx232 power 1 1.0000000001 -> NaN Invalid_operation -powx233 power 1 1.0000000000001 -> NaN Invalid_operation -precision: 5 -powx234 power 1 1.0001 -> NaN Invalid_operation -powx235 power 1 1.0000001 -> NaN Invalid_operation -powx236 power 1 1.0000000001 -> NaN Invalid_operation -powx237 power 1 1.0000000000001 -> NaN Invalid_operation -powx238 power 1 1.0000000000001 -> NaN Invalid_operation - -maxexponent: 999999999 -minexponent: -999999999 -powx239 power 1 5.67E-987654321 -> NaN Invalid_operation - -powx240 power 1 100000000 -> 1 -powx241 power 1 999999998 -> 1 -powx242 power 1 999999999 -> 1 -powx243 power 1 1000000000 -> NaN Invalid_operation -powx244 power 1 9999999999 -> NaN Invalid_operation - --- Checks for 'Too much precision needed' --- For x^12, digits+elength+1 = digits+3 -precision: 999999999 -powx249 add 1 1 -> 2 -- check basic operation at this precision -powx250 power 2 12 -> Infinity Overflow -precision: 999999998 -powx251 power 2 12 -> Infinity Overflow -precision: 999999997 -powx252 power 2 12 -> Infinity Overflow -precision: 999999996 -powx253 power 2 12 -> 4096 -precision: 999999995 -powx254 power 2 12 -> 4096 - --- zeros -maxexponent: +96 -minexponent: -95 -precision: 7 -powx260 power 0E-34 3 -> 0E-101 Clamped -powx261 power 0E-33 3 -> 0E-99 -powx262 power 0E-32 3 -> 0E-96 -powx263 power 0E-30 3 -> 0E-90 -powx264 power 0E-10 3 -> 0E-30 -powx265 power 0E-1 3 -> 0.000 -powx266 power 0E+0 3 -> 0 -powx267 power 0 3 -> 0 -powx268 power 0E+1 3 -> 0E+3 -powx269 power 0E+10 3 -> 0E+30 -powx270 power 0E+30 3 -> 0E+90 -powx271 power 0E+32 3 -> 0E+96 -powx272 power 0E+33 3 -> 0E+96 Clamped - --- overflow and underflow tests -maxexponent: 999999999 -minexponent: -999999999 -precision: 9 -powx280 power 9 999999999 -> 3.05550054E+954242508 Inexact Rounded -powx281 power 10 999999999 -> 1.00000000E+999999999 Rounded -powx282 power 10.0001 999999999 -> Infinity Overflow Inexact Rounded -powx283 power 10.1 999999999 -> Infinity Overflow Inexact Rounded -powx284 power 11 999999999 -> Infinity Overflow Inexact Rounded -powx285 power 12 999999999 -> Infinity Overflow Inexact Rounded -powx286 power 999 999999999 -> Infinity Overflow Inexact Rounded -powx287 power 999999 999999999 -> Infinity Overflow Inexact Rounded -powx288 power 999999999 999999999 -> Infinity Overflow Inexact Rounded -powx289 power 9.9E999999999 999999999 -> Infinity Overflow Inexact Rounded - -powx290 power 0.5 999999999 -> 4.33559594E-301029996 Inexact Rounded -powx291 power 0.1 999999999 -> 1E-999999999 -- unrounded -powx292 power 0.09 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx293 power 0.05 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx294 power 0.01 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx295 power 0.0001 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx297 power 0.0000001 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx298 power 0.0000000001 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx299 power 1E-999999999 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped - -powx310 power -9 999999999 -> -3.05550054E+954242508 Inexact Rounded -powx311 power -10 999999999 -> -1.00000000E+999999999 Rounded -powx312 power -10.0001 999999999 -> -Infinity Overflow Inexact Rounded -powx313 power -10.1 999999999 -> -Infinity Overflow Inexact Rounded -powx314 power -11 999999999 -> -Infinity Overflow Inexact Rounded -powx315 power -12 999999999 -> -Infinity Overflow Inexact Rounded -powx316 power -999 999999999 -> -Infinity Overflow Inexact Rounded -powx317 power -999999 999999999 -> -Infinity Overflow Inexact Rounded -powx318 power -999999999 999999999 -> -Infinity Overflow Inexact Rounded -powx319 power -9.9E999999999 999999999 -> -Infinity Overflow Inexact Rounded - -powx320 power -0.5 999999999 -> -4.33559594E-301029996 Inexact Rounded -powx321 power -0.1 999999999 -> -1E-999999999 -powx322 power -0.09 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx323 power -0.05 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx324 power -0.01 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx325 power -0.0001 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx327 power -0.0000001 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx328 power -0.0000000001 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx329 power -1E-999999999 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped - --- note no trim of next result -powx330 power -9 999999998 -> 3.39500060E+954242507 Inexact Rounded -powx331 power -10 999999998 -> 1.00000000E+999999998 Rounded -powx332 power -10.0001 999999998 -> Infinity Overflow Inexact Rounded -powx333 power -10.1 999999998 -> Infinity Overflow Inexact Rounded -powx334 power -11 999999998 -> Infinity Overflow Inexact Rounded -powx335 power -12 999999998 -> Infinity Overflow Inexact Rounded -powx336 power -999 999999998 -> Infinity Overflow Inexact Rounded -powx337 power -999999 999999998 -> Infinity Overflow Inexact Rounded -powx338 power -999999999 999999998 -> Infinity Overflow Inexact Rounded -powx339 power -9.9E999999999 999999998 -> Infinity Overflow Inexact Rounded - -powx340 power -0.5 999999998 -> 8.67119187E-301029996 Inexact Rounded -powx341 power -0.1 999999998 -> 1E-999999998 -- NB exact unrounded -powx342 power -0.09 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx343 power -0.05 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx344 power -0.01 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx345 power -0.0001 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx347 power -0.0000001 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx348 power -0.0000000001 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx349 power -1E-999999999 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped - --- some subnormals -precision: 9 --- [precision is 9, so smallest exponent is -1000000007 -powx350 power 1e-1 500000000 -> 1E-500000000 -powx351 power 1e-2 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -powx352 power 1e-2 500000000 -> 1E-1000000000 Subnormal -powx353 power 1e-2 500000001 -> 1E-1000000002 Subnormal -powx354 power 1e-2 500000002 -> 1E-1000000004 Subnormal -powx355 power 1e-2 500000003 -> 1E-1000000006 Subnormal -powx356 power 1e-2 500000004 -> 0E-1000000007 Underflow Subnormal Inexact Rounded - -powx360 power 0.010001 500000000 -> 4.34941988E-999978287 Inexact Rounded -powx361 power 0.010000001 500000000 -> 5.18469257E-999999979 Inexact Rounded -powx362 power 0.010000001 500000001 -> 5.18469309E-999999981 Inexact Rounded -powx363 power 0.0100000009 500000000 -> 3.49342003E-999999981 Inexact Rounded -powx364 power 0.0100000001 500000000 -> 1.48413155E-999999998 Inexact Rounded -powx365 power 0.01 500000000 -> 1E-1000000000 Subnormal -powx366 power 0.0099999999 500000000 -> 6.7379E-1000000003 Underflow Subnormal Inexact Rounded -powx367 power 0.0099999998 500000000 -> 4.54E-1000000005 Underflow Subnormal Inexact Rounded -powx368 power 0.0099999997 500000000 -> 3E-1000000007 Underflow Subnormal Inexact Rounded -powx369 power 0.0099999996 500000000 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -powx370 power 0.009 500000000 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped - --- 1/subnormal -> overflow -powx371 power 1e-1 -500000000 -> 1E+500000000 -powx372 power 1e-2 -999999999 -> Infinity Overflow Inexact Rounded -powx373 power 1e-2 -500000000 -> Infinity Overflow Inexact Rounded -powx374 power 1e-2 -500000001 -> Infinity Overflow Inexact Rounded -powx375 power 1e-2 -500000002 -> Infinity Overflow Inexact Rounded -powx376 power 1e-2 -500000003 -> Infinity Overflow Inexact Rounded -powx377 power 1e-2 -500000004 -> Infinity Overflow Inexact Rounded - -powx381 power 0.010001 -500000000 -> 2.29915719E+999978286 Inexact Rounded -powx382 power 0.010000001 -500000000 -> 1.92875467E+999999978 Inexact Rounded -powx383 power 0.010000001 -500000001 -> 1.92875448E+999999980 Inexact Rounded -powx384 power 0.0100000009 -500000000 -> 2.86252438E+999999980 Inexact Rounded -powx385 power 0.0100000001 -500000000 -> 6.73794717E+999999997 Inexact Rounded -powx386 power 0.01 -500000000 -> Infinity Overflow Inexact Rounded -powx387 power 0.009999 -500000000 -> Infinity Overflow Inexact Rounded - --- negative power giving subnormal -powx388 power 100.000001 -500000000 -> 6.7379E-1000000003 Underflow Subnormal Inexact Rounded - --- some more edge cases -precision: 15 -maxExponent: 999 -minexponent: -999 -powx391 power 0.1 999 -> 1E-999 -powx392 power 0.099 999 -> 4.360732062E-1004 Underflow Subnormal Inexact Rounded -powx393 power 0.098 999 -> 1.71731E-1008 Underflow Subnormal Inexact Rounded -powx394 power 0.097 999 -> 6E-1013 Underflow Subnormal Inexact Rounded -powx395 power 0.096 999 -> 0E-1013 Underflow Subnormal Inexact Rounded -powx396 power 0.01 999 -> 0E-1013 Underflow Subnormal Inexact Rounded Clamped - --- multiply tests are here to aid checking and test for consistent handling --- of underflow -precision: 5 -maxexponent: 999 -minexponent: -999 - --- squares -mulx400 multiply 1E-502 1e-502 -> 0E-1003 Subnormal Inexact Underflow Rounded -mulx401 multiply 1E-501 1e-501 -> 1E-1002 Subnormal -mulx402 multiply 2E-501 2e-501 -> 4E-1002 Subnormal -mulx403 multiply 4E-501 4e-501 -> 1.6E-1001 Subnormal -mulx404 multiply 10E-501 10e-501 -> 1.00E-1000 Subnormal -mulx405 multiply 30E-501 30e-501 -> 9.00E-1000 Subnormal -mulx406 multiply 40E-501 40e-501 -> 1.600E-999 - -powx400 power 1E-502 2 -> 0E-1003 Underflow Subnormal Inexact Rounded -powx401 power 1E-501 2 -> 1E-1002 Subnormal -powx402 power 2E-501 2 -> 4E-1002 Subnormal -powx403 power 4E-501 2 -> 1.6E-1001 Subnormal -powx404 power 10E-501 2 -> 1.00E-1000 Subnormal -powx405 power 30E-501 2 -> 9.00E-1000 Subnormal -powx406 power 40E-501 2 -> 1.600E-999 - --- cubes -mulx410 multiply 1E-670 1e-335 -> 0E-1003 Underflow Subnormal Inexact Rounded -mulx411 multiply 1E-668 1e-334 -> 1E-1002 Subnormal -mulx412 multiply 4E-668 2e-334 -> 8E-1002 Subnormal -mulx413 multiply 9E-668 3e-334 -> 2.7E-1001 Subnormal -mulx414 multiply 16E-668 4e-334 -> 6.4E-1001 Subnormal -mulx415 multiply 25E-668 5e-334 -> 1.25E-1000 Subnormal -mulx416 multiply 10E-668 100e-334 -> 1.000E-999 - -powx410 power 1E-335 3 -> 0E-1003 Underflow Subnormal Inexact Rounded -powx411 power 1E-334 3 -> 1E-1002 Subnormal -powx412 power 2E-334 3 -> 8E-1002 Subnormal -powx413 power 3E-334 3 -> 2.7E-1001 Subnormal -powx414 power 4E-334 3 -> 6.4E-1001 Subnormal -powx415 power 5E-334 3 -> 1.25E-1000 Subnormal -powx416 power 10E-334 3 -> 1.000E-999 - --- negative powers, testing subnormals -precision: 5 -maxExponent: 999 -minexponent: -999 -powx421 power 2.5E-501 -2 -> Infinity Overflow Inexact Rounded -powx422 power 2.5E-500 -2 -> 1.6E+999 - -powx423 power 2.5E+499 -2 -> 1.6E-999 -powx424 power 2.5E+500 -2 -> 1.6E-1001 Subnormal -powx425 power 2.5E+501 -2 -> 2E-1003 Underflow Subnormal Inexact Rounded -powx426 power 2.5E+502 -2 -> 0E-1003 Underflow Subnormal Inexact Rounded - -powx427 power 0.25E+499 -2 -> 1.6E-997 -powx428 power 0.25E+500 -2 -> 1.6E-999 -powx429 power 0.25E+501 -2 -> 1.6E-1001 Subnormal -powx430 power 0.25E+502 -2 -> 2E-1003 Underflow Subnormal Inexact Rounded -powx431 power 0.25E+503 -2 -> 0E-1003 Underflow Subnormal Inexact Rounded - -powx432 power 0.04E+499 -2 -> 6.25E-996 -powx433 power 0.04E+500 -2 -> 6.25E-998 -powx434 power 0.04E+501 -2 -> 6.25E-1000 Subnormal -powx435 power 0.04E+502 -2 -> 6.3E-1002 Underflow Subnormal Inexact Rounded -powx436 power 0.04E+503 -2 -> 1E-1003 Underflow Subnormal Inexact Rounded -powx437 power 0.04E+504 -2 -> 0E-1003 Underflow Subnormal Inexact Rounded - -powx441 power 0.04E+334 -3 -> 1.5625E-998 -powx442 power 0.04E+335 -3 -> 1.56E-1001 Underflow Subnormal Inexact Rounded -powx443 power 0.04E+336 -3 -> 0E-1003 Underflow Subnormal Inexact Rounded -powx444 power 0.25E+333 -3 -> 6.4E-998 -powx445 power 0.25E+334 -3 -> 6.4E-1001 Subnormal -powx446 power 0.25E+335 -3 -> 1E-1003 Underflow Subnormal Inexact Rounded -powx447 power 0.25E+336 -3 -> 0E-1003 Underflow Subnormal Inexact Rounded Clamped --- check sign for cubes and a few squares -powx448 power -0.04E+334 -3 -> -1.5625E-998 -powx449 power -0.04E+335 -3 -> -1.56E-1001 Underflow Subnormal Inexact Rounded -powx450 power -0.04E+336 -3 -> -0E-1003 Underflow Subnormal Inexact Rounded -powx451 power -0.25E+333 -3 -> -6.4E-998 -powx452 power -0.25E+334 -3 -> -6.4E-1001 Subnormal -powx453 power -0.25E+335 -3 -> -1E-1003 Underflow Subnormal Inexact Rounded -powx454 power -0.25E+336 -3 -> -0E-1003 Underflow Subnormal Inexact Rounded Clamped -powx455 power -0.04E+499 -2 -> 6.25E-996 -powx456 power -0.04E+500 -2 -> 6.25E-998 -powx457 power -0.04E+501 -2 -> 6.25E-1000 Subnormal -powx458 power -0.04E+502 -2 -> 6.3E-1002 Underflow Subnormal Inexact Rounded - --- test -0s -precision: 9 -powx560 power 0 0 -> NaN Invalid_operation -powx561 power 0 -0 -> NaN Invalid_operation -powx562 power -0 0 -> NaN Invalid_operation -powx563 power -0 -0 -> NaN Invalid_operation -powx564 power 1 0 -> 1 -powx565 power 1 -0 -> 1 -powx566 power -1 0 -> 1 -powx567 power -1 -0 -> 1 -powx568 power 0 1 -> 0 -powx569 power 0 -1 -> Infinity Division_by_zero -powx570 power -0 1 -> -0 -powx571 power -0 -1 -> -Infinity Division_by_zero -powx572 power 0 2 -> 0 -powx573 power 0 -2 -> Infinity Division_by_zero -powx574 power -0 2 -> 0 -powx575 power -0 -2 -> Infinity Division_by_zero -powx576 power 0 3 -> 0 -powx577 power 0 -3 -> Infinity Division_by_zero -powx578 power -0 3 -> -0 -powx579 power -0 -3 -> -Infinity Division_by_zero - --- Specials -powx580 power Inf -Inf -> NaN Invalid_operation -powx581 power Inf -1000 -> 0 -powx582 power Inf -1 -> 0 -powx583 power Inf -0 -> 1 -powx584 power Inf 0 -> 1 -powx585 power Inf 1 -> Infinity -powx586 power Inf 1000 -> Infinity -powx587 power Inf Inf -> NaN Invalid_operation -powx588 power -1000 Inf -> NaN Invalid_operation -powx589 power -Inf Inf -> NaN Invalid_operation -powx590 power -1 Inf -> NaN Invalid_operation -powx591 power -0 Inf -> NaN Invalid_operation -powx592 power 0 Inf -> NaN Invalid_operation -powx593 power 1 Inf -> NaN Invalid_operation -powx594 power 1000 Inf -> NaN Invalid_operation -powx595 power Inf Inf -> NaN Invalid_operation - -powx600 power -Inf -Inf -> NaN Invalid_operation -powx601 power -Inf -1000 -> 0 -powx602 power -Inf -1 -> -0 -powx603 power -Inf -0 -> 1 -powx604 power -Inf 0 -> 1 -powx605 power -Inf 1 -> -Infinity -powx606 power -Inf 1000 -> Infinity -powx607 power -Inf Inf -> NaN Invalid_operation -powx608 power -1000 Inf -> NaN Invalid_operation -powx609 power -Inf -Inf -> NaN Invalid_operation -powx610 power -1 -Inf -> NaN Invalid_operation -powx611 power -0 -Inf -> NaN Invalid_operation -powx612 power 0 -Inf -> NaN Invalid_operation -powx613 power 1 -Inf -> NaN Invalid_operation -powx614 power 1000 -Inf -> NaN Invalid_operation -powx615 power Inf -Inf -> NaN Invalid_operation - -powx621 power NaN -Inf -> NaN Invalid_operation -powx622 power NaN -1000 -> NaN -powx623 power NaN -1 -> NaN -powx624 power NaN -0 -> NaN -powx625 power NaN 0 -> NaN -powx626 power NaN 1 -> NaN -powx627 power NaN 1000 -> NaN -powx628 power NaN Inf -> NaN Invalid_operation -powx629 power NaN NaN -> NaN -powx630 power -Inf NaN -> NaN -powx631 power -1000 NaN -> NaN -powx632 power -1 NaN -> NaN -powx633 power -0 NaN -> NaN -powx634 power 0 NaN -> NaN -powx635 power 1 NaN -> NaN -powx636 power 1000 NaN -> NaN -powx637 power Inf NaN -> NaN - -powx641 power sNaN -Inf -> NaN Invalid_operation -powx642 power sNaN -1000 -> NaN Invalid_operation -powx643 power sNaN -1 -> NaN Invalid_operation -powx644 power sNaN -0 -> NaN Invalid_operation -powx645 power sNaN 0 -> NaN Invalid_operation -powx646 power sNaN 1 -> NaN Invalid_operation -powx647 power sNaN 1000 -> NaN Invalid_operation -powx648 power sNaN NaN -> NaN Invalid_operation -powx649 power sNaN sNaN -> NaN Invalid_operation -powx650 power NaN sNaN -> NaN Invalid_operation -powx651 power -Inf sNaN -> NaN Invalid_operation -powx652 power -1000 sNaN -> NaN Invalid_operation -powx653 power -1 sNaN -> NaN Invalid_operation -powx654 power -0 sNaN -> NaN Invalid_operation -powx655 power 0 sNaN -> NaN Invalid_operation -powx656 power 1 sNaN -> NaN Invalid_operation -powx657 power 1000 sNaN -> NaN Invalid_operation -powx658 power Inf sNaN -> NaN Invalid_operation -powx659 power NaN sNaN -> NaN Invalid_operation - --- NaN propagation -powx660 power NaN3 sNaN7 -> NaN7 Invalid_operation -powx661 power sNaN8 NaN6 -> NaN8 Invalid_operation -powx662 power 1 sNaN7 -> NaN7 Invalid_operation -powx663 power sNaN8 1 -> NaN8 Invalid_operation -powx664 power Inf sNaN7 -> NaN7 Invalid_operation -powx665 power sNaN8 Inf -> NaN Invalid_operation -powx666 power Inf NaN9 -> NaN9 -powx667 power NaN6 Inf -> NaN Invalid_operation -powx668 power 1 NaN5 -> NaN5 -powx669 power NaN2 1 -> NaN2 -powx670 power NaN2 Nan4 -> NaN2 -powx671 power NaN Nan4 -> NaN -powx672 power NaN345 Nan -> NaN345 -powx673 power Inf -sNaN7 -> -NaN7 Invalid_operation -powx674 power -sNaN8 Inf -> NaN Invalid_operation -powx675 power Inf -NaN9 -> -NaN9 -powx676 power -NaN6 Inf -> NaN Invalid_operation -powx677 power -NaN2 -Nan4 -> -NaN2 - --- Examples from extended specification -powx690 power Inf -2 -> 0 -powx691 power Inf -1 -> 0 -powx692 power Inf 0 -> 1 -powx693 power Inf 1 -> Infinity -powx694 power Inf 2 -> Infinity -powx695 power -Inf -2 -> 0 -powx696 power -Inf -1 -> -0 -powx697 power -Inf 0 -> 1 -powx698 power -Inf 1 -> -Infinity -powx699 power -Inf 2 -> Infinity -powx700 power 0 0 -> NaN Invalid_operation - --- long operand and RHS range checks -maxexponent: 999 -minexponent: -999 -precision: 9 -powx701 power 12345678000 1 -> 1.23456780E+10 Rounded -powx702 power 1234567800 1 -> 1.23456780E+9 Rounded -powx703 power 1234567890 1 -> 1.23456789E+9 Rounded -powx704 power 1234567891 1 -> 1.23456789E+9 Inexact Rounded -powx705 power 12345678901 1 -> 1.23456789E+10 Inexact Rounded -powx706 power 1234567896 1 -> 1.23456790E+9 Inexact Rounded -powx707 power 1 12345678000 -> NaN Invalid_operation -powx708 power 1 1234567800 -> NaN Invalid_operation -powx709 power 1 1234567890 -> NaN Invalid_operation -powx710 power 1 11234567891 -> NaN Invalid_operation -powx711 power 1 12345678901 -> NaN Invalid_operation -powx712 power 1 1234567896 -> NaN Invalid_operation -powx713 power 1 -1234567896 -> NaN Invalid_operation -powx714 power 1 1000000000 -> NaN Invalid_operation -powx715 power 1 -1000000000 -> NaN Invalid_operation - -precision: 15 --- still checking -powx741 power 12345678000 1 -> 12345678000 -powx742 power 1234567800 1 -> 1234567800 -powx743 power 1234567890 1 -> 1234567890 -powx744 power 1234567891 1 -> 1234567891 -powx745 power 12345678901 1 -> 12345678901 -powx746 power 1234567896 1 -> 1234567896 -powx747 power 1 12345678000 -> NaN Invalid_operation -powx748 power 1 -1234567896 -> NaN Invalid_operation -powx749 power 1 1000000000 -> NaN Invalid_operation -powx740 power 1 -1000000000 -> NaN Invalid_operation - --- check for double-rounded subnormals -precision: 5 -maxexponent: 79 -minexponent: -79 -powx750 power 1.2347E-40 2 -> 1.524E-80 Inexact Rounded Subnormal Underflow - --- Null tests -powx900 power 1 # -> NaN Invalid_operation -powx901 power # 1 -> NaN Invalid_operation - diff --git a/sys/lib/python/test/decimaltestdata/quantize.decTest b/sys/lib/python/test/decimaltestdata/quantize.decTest deleted file mode 100644 index dc1b13018..000000000 --- a/sys/lib/python/test/decimaltestdata/quantize.decTest +++ /dev/null @@ -1,780 +0,0 @@ ------------------------------------------------------------------------- --- quantize.decTest -- decimal quantize operation -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- Most of the tests here assume a "regular pattern", where the --- sign and coefficient are +1. --- 2004.03.15 Underflow for quantize is suppressed - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 999 -minexponent: -999 - --- sanity checks -quax001 quantize 0 1e0 -> 0 -quax002 quantize 1 1e0 -> 1 -quax003 quantize 0.1 1e+2 -> 0E+2 Inexact Rounded -quax005 quantize 0.1 1e+1 -> 0E+1 Inexact Rounded -quax006 quantize 0.1 1e0 -> 0 Inexact Rounded -quax007 quantize 0.1 1e-1 -> 0.1 -quax008 quantize 0.1 1e-2 -> 0.10 -quax009 quantize 0.1 1e-3 -> 0.100 -quax010 quantize 0.9 1e+2 -> 0E+2 Inexact Rounded -quax011 quantize 0.9 1e+1 -> 0E+1 Inexact Rounded -quax012 quantize 0.9 1e+0 -> 1 Inexact Rounded -quax013 quantize 0.9 1e-1 -> 0.9 -quax014 quantize 0.9 1e-2 -> 0.90 -quax015 quantize 0.9 1e-3 -> 0.900 --- negatives -quax021 quantize -0 1e0 -> -0 -quax022 quantize -1 1e0 -> -1 -quax023 quantize -0.1 1e+2 -> -0E+2 Inexact Rounded -quax025 quantize -0.1 1e+1 -> -0E+1 Inexact Rounded -quax026 quantize -0.1 1e0 -> -0 Inexact Rounded -quax027 quantize -0.1 1e-1 -> -0.1 -quax028 quantize -0.1 1e-2 -> -0.10 -quax029 quantize -0.1 1e-3 -> -0.100 -quax030 quantize -0.9 1e+2 -> -0E+2 Inexact Rounded -quax031 quantize -0.9 1e+1 -> -0E+1 Inexact Rounded -quax032 quantize -0.9 1e+0 -> -1 Inexact Rounded -quax033 quantize -0.9 1e-1 -> -0.9 -quax034 quantize -0.9 1e-2 -> -0.90 -quax035 quantize -0.9 1e-3 -> -0.900 -quax036 quantize -0.5 1e+2 -> -0E+2 Inexact Rounded -quax037 quantize -0.5 1e+1 -> -0E+1 Inexact Rounded -quax038 quantize -0.5 1e+0 -> -1 Inexact Rounded -quax039 quantize -0.5 1e-1 -> -0.5 -quax040 quantize -0.5 1e-2 -> -0.50 -quax041 quantize -0.5 1e-3 -> -0.500 -quax042 quantize -0.9 1e+2 -> -0E+2 Inexact Rounded -quax043 quantize -0.9 1e+1 -> -0E+1 Inexact Rounded -quax044 quantize -0.9 1e+0 -> -1 Inexact Rounded -quax045 quantize -0.9 1e-1 -> -0.9 -quax046 quantize -0.9 1e-2 -> -0.90 -quax047 quantize -0.9 1e-3 -> -0.900 - --- examples from Specification -quax060 quantize 2.17 0.001 -> 2.170 -quax061 quantize 2.17 0.01 -> 2.17 -quax062 quantize 2.17 0.1 -> 2.2 Inexact Rounded -quax063 quantize 2.17 1e+0 -> 2 Inexact Rounded -quax064 quantize 2.17 1e+1 -> 0E+1 Inexact Rounded -quax065 quantize -Inf Inf -> -Infinity -quax066 quantize 2 Inf -> NaN Invalid_operation -quax067 quantize -0.1 1 -> -0 Inexact Rounded -quax068 quantize -0 1e+5 -> -0E+5 -quax069 quantize +35236450.6 1e-2 -> NaN Invalid_operation -quax070 quantize -35236450.6 1e-2 -> NaN Invalid_operation -quax071 quantize 217 1e-1 -> 217.0 -quax072 quantize 217 1e+0 -> 217 -quax073 quantize 217 1e+1 -> 2.2E+2 Inexact Rounded -quax074 quantize 217 1e+2 -> 2E+2 Inexact Rounded - --- general tests .. -quax089 quantize 12 1e+4 -> 0E+4 Inexact Rounded -quax090 quantize 12 1e+3 -> 0E+3 Inexact Rounded -quax091 quantize 12 1e+2 -> 0E+2 Inexact Rounded -quax092 quantize 12 1e+1 -> 1E+1 Inexact Rounded -quax093 quantize 1.2345 1e-2 -> 1.23 Inexact Rounded -quax094 quantize 1.2355 1e-2 -> 1.24 Inexact Rounded -quax095 quantize 1.2345 1e-6 -> 1.234500 -quax096 quantize 9.9999 1e-2 -> 10.00 Inexact Rounded -quax097 quantize 0.0001 1e-2 -> 0.00 Inexact Rounded -quax098 quantize 0.001 1e-2 -> 0.00 Inexact Rounded -quax099 quantize 0.009 1e-2 -> 0.01 Inexact Rounded -quax100 quantize 92 1e+2 -> 1E+2 Inexact Rounded - -quax101 quantize -1 1e0 -> -1 -quax102 quantize -1 1e-1 -> -1.0 -quax103 quantize -1 1e-2 -> -1.00 -quax104 quantize 0 1e0 -> 0 -quax105 quantize 0 1e-1 -> 0.0 -quax106 quantize 0 1e-2 -> 0.00 -quax107 quantize 0.00 1e0 -> 0 -quax108 quantize 0 1e+1 -> 0E+1 -quax109 quantize 0 1e+2 -> 0E+2 -quax110 quantize +1 1e0 -> 1 -quax111 quantize +1 1e-1 -> 1.0 -quax112 quantize +1 1e-2 -> 1.00 - -quax120 quantize 1.04 1e-3 -> 1.040 -quax121 quantize 1.04 1e-2 -> 1.04 -quax122 quantize 1.04 1e-1 -> 1.0 Inexact Rounded -quax123 quantize 1.04 1e0 -> 1 Inexact Rounded -quax124 quantize 1.05 1e-3 -> 1.050 -quax125 quantize 1.05 1e-2 -> 1.05 -quax126 quantize 1.05 1e-1 -> 1.1 Inexact Rounded -quax127 quantize 1.05 1e0 -> 1 Inexact Rounded -quax128 quantize 1.05 1e-3 -> 1.050 -quax129 quantize 1.05 1e-2 -> 1.05 -quax130 quantize 1.05 1e-1 -> 1.1 Inexact Rounded -quax131 quantize 1.05 1e0 -> 1 Inexact Rounded -quax132 quantize 1.06 1e-3 -> 1.060 -quax133 quantize 1.06 1e-2 -> 1.06 -quax134 quantize 1.06 1e-1 -> 1.1 Inexact Rounded -quax135 quantize 1.06 1e0 -> 1 Inexact Rounded - -quax140 quantize -10 1e-2 -> -10.00 -quax141 quantize +1 1e-2 -> 1.00 -quax142 quantize +10 1e-2 -> 10.00 -quax143 quantize 1E+10 1e-2 -> NaN Invalid_operation -quax144 quantize 1E-10 1e-2 -> 0.00 Inexact Rounded -quax145 quantize 1E-3 1e-2 -> 0.00 Inexact Rounded -quax146 quantize 1E-2 1e-2 -> 0.01 -quax147 quantize 1E-1 1e-2 -> 0.10 -quax148 quantize 0E-10 1e-2 -> 0.00 - -quax150 quantize 1.0600 1e-5 -> 1.06000 -quax151 quantize 1.0600 1e-4 -> 1.0600 -quax152 quantize 1.0600 1e-3 -> 1.060 Rounded -quax153 quantize 1.0600 1e-2 -> 1.06 Rounded -quax154 quantize 1.0600 1e-1 -> 1.1 Inexact Rounded -quax155 quantize 1.0600 1e0 -> 1 Inexact Rounded - --- base tests with non-1 coefficients -quax161 quantize 0 -9e0 -> 0 -quax162 quantize 1 -7e0 -> 1 -quax163 quantize 0.1 -1e+2 -> 0E+2 Inexact Rounded -quax165 quantize 0.1 0e+1 -> 0E+1 Inexact Rounded -quax166 quantize 0.1 2e0 -> 0 Inexact Rounded -quax167 quantize 0.1 3e-1 -> 0.1 -quax168 quantize 0.1 44e-2 -> 0.10 -quax169 quantize 0.1 555e-3 -> 0.100 -quax170 quantize 0.9 6666e+2 -> 0E+2 Inexact Rounded -quax171 quantize 0.9 -777e+1 -> 0E+1 Inexact Rounded -quax172 quantize 0.9 -88e+0 -> 1 Inexact Rounded -quax173 quantize 0.9 -9e-1 -> 0.9 -quax174 quantize 0.9 0e-2 -> 0.90 -quax175 quantize 0.9 1.1e-3 -> 0.9000 --- negatives -quax181 quantize -0 1.1e0 -> -0.0 -quax182 quantize -1 -1e0 -> -1 -quax183 quantize -0.1 11e+2 -> -0E+2 Inexact Rounded -quax185 quantize -0.1 111e+1 -> -0E+1 Inexact Rounded -quax186 quantize -0.1 71e0 -> -0 Inexact Rounded -quax187 quantize -0.1 -91e-1 -> -0.1 -quax188 quantize -0.1 -.1e-2 -> -0.100 -quax189 quantize -0.1 -1e-3 -> -0.100 -quax190 quantize -0.9 0e+2 -> -0E+2 Inexact Rounded -quax191 quantize -0.9 -0e+1 -> -0E+1 Inexact Rounded -quax192 quantize -0.9 -10e+0 -> -1 Inexact Rounded -quax193 quantize -0.9 100e-1 -> -0.9 -quax194 quantize -0.9 999e-2 -> -0.90 - --- +ve exponents .. -quax201 quantize -1 1e+0 -> -1 -quax202 quantize -1 1e+1 -> -0E+1 Inexact Rounded -quax203 quantize -1 1e+2 -> -0E+2 Inexact Rounded -quax204 quantize 0 1e+0 -> 0 -quax205 quantize 0 1e+1 -> 0E+1 -quax206 quantize 0 1e+2 -> 0E+2 -quax207 quantize +1 1e+0 -> 1 -quax208 quantize +1 1e+1 -> 0E+1 Inexact Rounded -quax209 quantize +1 1e+2 -> 0E+2 Inexact Rounded - -quax220 quantize 1.04 1e+3 -> 0E+3 Inexact Rounded -quax221 quantize 1.04 1e+2 -> 0E+2 Inexact Rounded -quax222 quantize 1.04 1e+1 -> 0E+1 Inexact Rounded -quax223 quantize 1.04 1e+0 -> 1 Inexact Rounded -quax224 quantize 1.05 1e+3 -> 0E+3 Inexact Rounded -quax225 quantize 1.05 1e+2 -> 0E+2 Inexact Rounded -quax226 quantize 1.05 1e+1 -> 0E+1 Inexact Rounded -quax227 quantize 1.05 1e+0 -> 1 Inexact Rounded -quax228 quantize 1.05 1e+3 -> 0E+3 Inexact Rounded -quax229 quantize 1.05 1e+2 -> 0E+2 Inexact Rounded -quax230 quantize 1.05 1e+1 -> 0E+1 Inexact Rounded -quax231 quantize 1.05 1e+0 -> 1 Inexact Rounded -quax232 quantize 1.06 1e+3 -> 0E+3 Inexact Rounded -quax233 quantize 1.06 1e+2 -> 0E+2 Inexact Rounded -quax234 quantize 1.06 1e+1 -> 0E+1 Inexact Rounded -quax235 quantize 1.06 1e+0 -> 1 Inexact Rounded - -quax240 quantize -10 1e+1 -> -1E+1 Rounded -quax241 quantize +1 1e+1 -> 0E+1 Inexact Rounded -quax242 quantize +10 1e+1 -> 1E+1 Rounded -quax243 quantize 1E+1 1e+1 -> 1E+1 -- underneath this is E+1 -quax244 quantize 1E+2 1e+1 -> 1.0E+2 -- underneath this is E+1 -quax245 quantize 1E+3 1e+1 -> 1.00E+3 -- underneath this is E+1 -quax246 quantize 1E+4 1e+1 -> 1.000E+4 -- underneath this is E+1 -quax247 quantize 1E+5 1e+1 -> 1.0000E+5 -- underneath this is E+1 -quax248 quantize 1E+6 1e+1 -> 1.00000E+6 -- underneath this is E+1 -quax249 quantize 1E+7 1e+1 -> 1.000000E+7 -- underneath this is E+1 -quax250 quantize 1E+8 1e+1 -> 1.0000000E+8 -- underneath this is E+1 -quax251 quantize 1E+9 1e+1 -> 1.00000000E+9 -- underneath this is E+1 --- next one tries to add 9 zeros -quax252 quantize 1E+10 1e+1 -> NaN Invalid_operation -quax253 quantize 1E-10 1e+1 -> 0E+1 Inexact Rounded -quax254 quantize 1E-2 1e+1 -> 0E+1 Inexact Rounded -quax255 quantize 0E-10 1e+1 -> 0E+1 -quax256 quantize -0E-10 1e+1 -> -0E+1 -quax257 quantize -0E-1 1e+1 -> -0E+1 -quax258 quantize -0 1e+1 -> -0E+1 -quax259 quantize -0E+1 1e+1 -> -0E+1 - -quax260 quantize -10 1e+2 -> -0E+2 Inexact Rounded -quax261 quantize +1 1e+2 -> 0E+2 Inexact Rounded -quax262 quantize +10 1e+2 -> 0E+2 Inexact Rounded -quax263 quantize 1E+1 1e+2 -> 0E+2 Inexact Rounded -quax264 quantize 1E+2 1e+2 -> 1E+2 -quax265 quantize 1E+3 1e+2 -> 1.0E+3 -quax266 quantize 1E+4 1e+2 -> 1.00E+4 -quax267 quantize 1E+5 1e+2 -> 1.000E+5 -quax268 quantize 1E+6 1e+2 -> 1.0000E+6 -quax269 quantize 1E+7 1e+2 -> 1.00000E+7 -quax270 quantize 1E+8 1e+2 -> 1.000000E+8 -quax271 quantize 1E+9 1e+2 -> 1.0000000E+9 -quax272 quantize 1E+10 1e+2 -> 1.00000000E+10 -quax273 quantize 1E-10 1e+2 -> 0E+2 Inexact Rounded -quax274 quantize 1E-2 1e+2 -> 0E+2 Inexact Rounded -quax275 quantize 0E-10 1e+2 -> 0E+2 - -quax280 quantize -10 1e+3 -> -0E+3 Inexact Rounded -quax281 quantize +1 1e+3 -> 0E+3 Inexact Rounded -quax282 quantize +10 1e+3 -> 0E+3 Inexact Rounded -quax283 quantize 1E+1 1e+3 -> 0E+3 Inexact Rounded -quax284 quantize 1E+2 1e+3 -> 0E+3 Inexact Rounded -quax285 quantize 1E+3 1e+3 -> 1E+3 -quax286 quantize 1E+4 1e+3 -> 1.0E+4 -quax287 quantize 1E+5 1e+3 -> 1.00E+5 -quax288 quantize 1E+6 1e+3 -> 1.000E+6 -quax289 quantize 1E+7 1e+3 -> 1.0000E+7 -quax290 quantize 1E+8 1e+3 -> 1.00000E+8 -quax291 quantize 1E+9 1e+3 -> 1.000000E+9 -quax292 quantize 1E+10 1e+3 -> 1.0000000E+10 -quax293 quantize 1E-10 1e+3 -> 0E+3 Inexact Rounded -quax294 quantize 1E-2 1e+3 -> 0E+3 Inexact Rounded -quax295 quantize 0E-10 1e+3 -> 0E+3 - --- round up from below [sign wrong in JIT compiler once] -quax300 quantize 0.0078 1e-5 -> 0.00780 -quax301 quantize 0.0078 1e-4 -> 0.0078 -quax302 quantize 0.0078 1e-3 -> 0.008 Inexact Rounded -quax303 quantize 0.0078 1e-2 -> 0.01 Inexact Rounded -quax304 quantize 0.0078 1e-1 -> 0.0 Inexact Rounded -quax305 quantize 0.0078 1e0 -> 0 Inexact Rounded -quax306 quantize 0.0078 1e+1 -> 0E+1 Inexact Rounded -quax307 quantize 0.0078 1e+2 -> 0E+2 Inexact Rounded - -quax310 quantize -0.0078 1e-5 -> -0.00780 -quax311 quantize -0.0078 1e-4 -> -0.0078 -quax312 quantize -0.0078 1e-3 -> -0.008 Inexact Rounded -quax313 quantize -0.0078 1e-2 -> -0.01 Inexact Rounded -quax314 quantize -0.0078 1e-1 -> -0.0 Inexact Rounded -quax315 quantize -0.0078 1e0 -> -0 Inexact Rounded -quax316 quantize -0.0078 1e+1 -> -0E+1 Inexact Rounded -quax317 quantize -0.0078 1e+2 -> -0E+2 Inexact Rounded - -quax320 quantize 0.078 1e-5 -> 0.07800 -quax321 quantize 0.078 1e-4 -> 0.0780 -quax322 quantize 0.078 1e-3 -> 0.078 -quax323 quantize 0.078 1e-2 -> 0.08 Inexact Rounded -quax324 quantize 0.078 1e-1 -> 0.1 Inexact Rounded -quax325 quantize 0.078 1e0 -> 0 Inexact Rounded -quax326 quantize 0.078 1e+1 -> 0E+1 Inexact Rounded -quax327 quantize 0.078 1e+2 -> 0E+2 Inexact Rounded - -quax330 quantize -0.078 1e-5 -> -0.07800 -quax331 quantize -0.078 1e-4 -> -0.0780 -quax332 quantize -0.078 1e-3 -> -0.078 -quax333 quantize -0.078 1e-2 -> -0.08 Inexact Rounded -quax334 quantize -0.078 1e-1 -> -0.1 Inexact Rounded -quax335 quantize -0.078 1e0 -> -0 Inexact Rounded -quax336 quantize -0.078 1e+1 -> -0E+1 Inexact Rounded -quax337 quantize -0.078 1e+2 -> -0E+2 Inexact Rounded - -quax340 quantize 0.78 1e-5 -> 0.78000 -quax341 quantize 0.78 1e-4 -> 0.7800 -quax342 quantize 0.78 1e-3 -> 0.780 -quax343 quantize 0.78 1e-2 -> 0.78 -quax344 quantize 0.78 1e-1 -> 0.8 Inexact Rounded -quax345 quantize 0.78 1e0 -> 1 Inexact Rounded -quax346 quantize 0.78 1e+1 -> 0E+1 Inexact Rounded -quax347 quantize 0.78 1e+2 -> 0E+2 Inexact Rounded - -quax350 quantize -0.78 1e-5 -> -0.78000 -quax351 quantize -0.78 1e-4 -> -0.7800 -quax352 quantize -0.78 1e-3 -> -0.780 -quax353 quantize -0.78 1e-2 -> -0.78 -quax354 quantize -0.78 1e-1 -> -0.8 Inexact Rounded -quax355 quantize -0.78 1e0 -> -1 Inexact Rounded -quax356 quantize -0.78 1e+1 -> -0E+1 Inexact Rounded -quax357 quantize -0.78 1e+2 -> -0E+2 Inexact Rounded - -quax360 quantize 7.8 1e-5 -> 7.80000 -quax361 quantize 7.8 1e-4 -> 7.8000 -quax362 quantize 7.8 1e-3 -> 7.800 -quax363 quantize 7.8 1e-2 -> 7.80 -quax364 quantize 7.8 1e-1 -> 7.8 -quax365 quantize 7.8 1e0 -> 8 Inexact Rounded -quax366 quantize 7.8 1e+1 -> 1E+1 Inexact Rounded -quax367 quantize 7.8 1e+2 -> 0E+2 Inexact Rounded -quax368 quantize 7.8 1e+3 -> 0E+3 Inexact Rounded - -quax370 quantize -7.8 1e-5 -> -7.80000 -quax371 quantize -7.8 1e-4 -> -7.8000 -quax372 quantize -7.8 1e-3 -> -7.800 -quax373 quantize -7.8 1e-2 -> -7.80 -quax374 quantize -7.8 1e-1 -> -7.8 -quax375 quantize -7.8 1e0 -> -8 Inexact Rounded -quax376 quantize -7.8 1e+1 -> -1E+1 Inexact Rounded -quax377 quantize -7.8 1e+2 -> -0E+2 Inexact Rounded -quax378 quantize -7.8 1e+3 -> -0E+3 Inexact Rounded - --- some individuals -precision: 9 -quax380 quantize 352364.506 1e-2 -> 352364.51 Inexact Rounded -quax381 quantize 3523645.06 1e-2 -> 3523645.06 -quax382 quantize 35236450.6 1e-2 -> NaN Invalid_operation -quax383 quantize 352364506 1e-2 -> NaN Invalid_operation -quax384 quantize -352364.506 1e-2 -> -352364.51 Inexact Rounded -quax385 quantize -3523645.06 1e-2 -> -3523645.06 -quax386 quantize -35236450.6 1e-2 -> NaN Invalid_operation -quax387 quantize -352364506 1e-2 -> NaN Invalid_operation - -rounding: down -quax389 quantize 35236450.6 1e-2 -> NaN Invalid_operation --- ? should that one instead have been: --- quax389 quantize 35236450.6 1e-2 -> NaN Invalid_operation -rounding: half_up - --- and a few more from e-mail discussions -precision: 7 -quax391 quantize 12.34567 1e-3 -> 12.346 Inexact Rounded -quax392 quantize 123.4567 1e-3 -> 123.457 Inexact Rounded -quax393 quantize 1234.567 1e-3 -> 1234.567 -quax394 quantize 12345.67 1e-3 -> NaN Invalid_operation -quax395 quantize 123456.7 1e-3 -> NaN Invalid_operation -quax396 quantize 1234567. 1e-3 -> NaN Invalid_operation - --- some 9999 round-up cases -precision: 9 -quax400 quantize 9.999 1e-5 -> 9.99900 -quax401 quantize 9.999 1e-4 -> 9.9990 -quax402 quantize 9.999 1e-3 -> 9.999 -quax403 quantize 9.999 1e-2 -> 10.00 Inexact Rounded -quax404 quantize 9.999 1e-1 -> 10.0 Inexact Rounded -quax405 quantize 9.999 1e0 -> 10 Inexact Rounded -quax406 quantize 9.999 1e1 -> 1E+1 Inexact Rounded -quax407 quantize 9.999 1e2 -> 0E+2 Inexact Rounded - -quax410 quantize 0.999 1e-5 -> 0.99900 -quax411 quantize 0.999 1e-4 -> 0.9990 -quax412 quantize 0.999 1e-3 -> 0.999 -quax413 quantize 0.999 1e-2 -> 1.00 Inexact Rounded -quax414 quantize 0.999 1e-1 -> 1.0 Inexact Rounded -quax415 quantize 0.999 1e0 -> 1 Inexact Rounded -quax416 quantize 0.999 1e1 -> 0E+1 Inexact Rounded - -quax420 quantize 0.0999 1e-5 -> 0.09990 -quax421 quantize 0.0999 1e-4 -> 0.0999 -quax422 quantize 0.0999 1e-3 -> 0.100 Inexact Rounded -quax423 quantize 0.0999 1e-2 -> 0.10 Inexact Rounded -quax424 quantize 0.0999 1e-1 -> 0.1 Inexact Rounded -quax425 quantize 0.0999 1e0 -> 0 Inexact Rounded -quax426 quantize 0.0999 1e1 -> 0E+1 Inexact Rounded - -quax430 quantize 0.00999 1e-5 -> 0.00999 -quax431 quantize 0.00999 1e-4 -> 0.0100 Inexact Rounded -quax432 quantize 0.00999 1e-3 -> 0.010 Inexact Rounded -quax433 quantize 0.00999 1e-2 -> 0.01 Inexact Rounded -quax434 quantize 0.00999 1e-1 -> 0.0 Inexact Rounded -quax435 quantize 0.00999 1e0 -> 0 Inexact Rounded -quax436 quantize 0.00999 1e1 -> 0E+1 Inexact Rounded - -quax440 quantize 0.000999 1e-5 -> 0.00100 Inexact Rounded -quax441 quantize 0.000999 1e-4 -> 0.0010 Inexact Rounded -quax442 quantize 0.000999 1e-3 -> 0.001 Inexact Rounded -quax443 quantize 0.000999 1e-2 -> 0.00 Inexact Rounded -quax444 quantize 0.000999 1e-1 -> 0.0 Inexact Rounded -quax445 quantize 0.000999 1e0 -> 0 Inexact Rounded -quax446 quantize 0.000999 1e1 -> 0E+1 Inexact Rounded - -precision: 8 -quax449 quantize 9.999E-15 1e-23 -> NaN Invalid_operation -quax450 quantize 9.999E-15 1e-22 -> 9.9990000E-15 -quax451 quantize 9.999E-15 1e-21 -> 9.999000E-15 -quax452 quantize 9.999E-15 1e-20 -> 9.99900E-15 -quax453 quantize 9.999E-15 1e-19 -> 9.9990E-15 -quax454 quantize 9.999E-15 1e-18 -> 9.999E-15 -quax455 quantize 9.999E-15 1e-17 -> 1.000E-14 Inexact Rounded -quax456 quantize 9.999E-15 1e-16 -> 1.00E-14 Inexact Rounded -quax457 quantize 9.999E-15 1e-15 -> 1.0E-14 Inexact Rounded -quax458 quantize 9.999E-15 1e-14 -> 1E-14 Inexact Rounded -quax459 quantize 9.999E-15 1e-13 -> 0E-13 Inexact Rounded -quax460 quantize 9.999E-15 1e-12 -> 0E-12 Inexact Rounded -quax461 quantize 9.999E-15 1e-11 -> 0E-11 Inexact Rounded -quax462 quantize 9.999E-15 1e-10 -> 0E-10 Inexact Rounded -quax463 quantize 9.999E-15 1e-9 -> 0E-9 Inexact Rounded -quax464 quantize 9.999E-15 1e-8 -> 0E-8 Inexact Rounded -quax465 quantize 9.999E-15 1e-7 -> 0E-7 Inexact Rounded -quax466 quantize 9.999E-15 1e-6 -> 0.000000 Inexact Rounded -quax467 quantize 9.999E-15 1e-5 -> 0.00000 Inexact Rounded -quax468 quantize 9.999E-15 1e-4 -> 0.0000 Inexact Rounded -quax469 quantize 9.999E-15 1e-3 -> 0.000 Inexact Rounded -quax470 quantize 9.999E-15 1e-2 -> 0.00 Inexact Rounded -quax471 quantize 9.999E-15 1e-1 -> 0.0 Inexact Rounded -quax472 quantize 9.999E-15 1e0 -> 0 Inexact Rounded -quax473 quantize 9.999E-15 1e1 -> 0E+1 Inexact Rounded - --- long operand checks [rhs checks removed] -maxexponent: 999 -minexponent: -999 -precision: 9 -quax481 quantize 12345678000 1e+3 -> 1.2345678E+10 Rounded -quax482 quantize 1234567800 1e+1 -> 1.23456780E+9 Rounded -quax483 quantize 1234567890 1e+1 -> 1.23456789E+9 Rounded -quax484 quantize 1234567891 1e+1 -> 1.23456789E+9 Inexact Rounded -quax485 quantize 12345678901 1e+2 -> 1.23456789E+10 Inexact Rounded -quax486 quantize 1234567896 1e+1 -> 1.23456790E+9 Inexact Rounded --- a potential double-round -quax487 quantize 1234.987643 1e-4 -> 1234.9876 Inexact Rounded -quax488 quantize 1234.987647 1e-4 -> 1234.9876 Inexact Rounded - -precision: 15 -quax491 quantize 12345678000 1e+3 -> 1.2345678E+10 Rounded -quax492 quantize 1234567800 1e+1 -> 1.23456780E+9 Rounded -quax493 quantize 1234567890 1e+1 -> 1.23456789E+9 Rounded -quax494 quantize 1234567891 1e+1 -> 1.23456789E+9 Inexact Rounded -quax495 quantize 12345678901 1e+2 -> 1.23456789E+10 Inexact Rounded -quax496 quantize 1234567896 1e+1 -> 1.23456790E+9 Inexact Rounded -quax497 quantize 1234.987643 1e-4 -> 1234.9876 Inexact Rounded -quax498 quantize 1234.987647 1e-4 -> 1234.9876 Inexact Rounded - --- Zeros -quax500 quantize 0 1e1 -> 0E+1 -quax501 quantize 0 1e0 -> 0 -quax502 quantize 0 1e-1 -> 0.0 -quax503 quantize 0.0 1e-1 -> 0.0 -quax504 quantize 0.0 1e0 -> 0 -quax505 quantize 0.0 1e+1 -> 0E+1 -quax506 quantize 0E+1 1e-1 -> 0.0 -quax507 quantize 0E+1 1e0 -> 0 -quax508 quantize 0E+1 1e+1 -> 0E+1 -quax509 quantize -0 1e1 -> -0E+1 -quax510 quantize -0 1e0 -> -0 -quax511 quantize -0 1e-1 -> -0.0 -quax512 quantize -0.0 1e-1 -> -0.0 -quax513 quantize -0.0 1e0 -> -0 -quax514 quantize -0.0 1e+1 -> -0E+1 -quax515 quantize -0E+1 1e-1 -> -0.0 -quax516 quantize -0E+1 1e0 -> -0 -quax517 quantize -0E+1 1e+1 -> -0E+1 - --- Suspicious RHS values -maxexponent: 999999999 -minexponent: -999999999 -precision: 15 -quax520 quantize 1.234 1e999999000 -> 0E+999999000 Inexact Rounded -quax521 quantize 123.456 1e999999000 -> 0E+999999000 Inexact Rounded -quax522 quantize 1.234 1e999999999 -> 0E+999999999 Inexact Rounded -quax523 quantize 123.456 1e999999999 -> 0E+999999999 Inexact Rounded -quax524 quantize 123.456 1e1000000000 -> NaN Invalid_operation -quax525 quantize 123.456 1e12345678903 -> NaN Invalid_operation --- next four are "won't fit" overflows -quax526 quantize 1.234 1e-999999000 -> NaN Invalid_operation -quax527 quantize 123.456 1e-999999000 -> NaN Invalid_operation -quax528 quantize 1.234 1e-999999999 -> NaN Invalid_operation -quax529 quantize 123.456 1e-999999999 -> NaN Invalid_operation -quax530 quantize 123.456 1e-1000000014 -> NaN Invalid_operation -quax531 quantize 123.456 1e-12345678903 -> NaN Invalid_operation - -maxexponent: 999 -minexponent: -999 -precision: 15 -quax532 quantize 1.234E+999 1e999 -> 1E+999 Inexact Rounded -quax533 quantize 1.234E+998 1e999 -> 0E+999 Inexact Rounded -quax534 quantize 1.234 1e999 -> 0E+999 Inexact Rounded -quax535 quantize 1.234 1e1000 -> NaN Invalid_operation -quax536 quantize 1.234 1e5000 -> NaN Invalid_operation -quax537 quantize 0 1e-999 -> 0E-999 --- next two are "won't fit" overflows -quax538 quantize 1.234 1e-999 -> NaN Invalid_operation -quax539 quantize 1.234 1e-1000 -> NaN Invalid_operation -quax540 quantize 1.234 1e-5000 -> NaN Invalid_operation --- [more below] - --- check bounds (lhs maybe out of range for destination, etc.) -precision: 7 -quax541 quantize 1E+999 1e+999 -> 1E+999 -quax542 quantize 1E+1000 1e+999 -> NaN Invalid_operation -quax543 quantize 1E+999 1e+1000 -> NaN Invalid_operation -quax544 quantize 1E-999 1e-999 -> 1E-999 -quax545 quantize 1E-1000 1e-999 -> 0E-999 Inexact Rounded -quax546 quantize 1E-999 1e-1000 -> 1.0E-999 -quax547 quantize 1E-1005 1e-999 -> 0E-999 Inexact Rounded -quax548 quantize 1E-1006 1e-999 -> 0E-999 Inexact Rounded -quax549 quantize 1E-1007 1e-999 -> 0E-999 Inexact Rounded -quax550 quantize 1E-998 1e-1005 -> NaN Invalid_operation -- won't fit -quax551 quantize 1E-999 1e-1005 -> 1.000000E-999 -quax552 quantize 1E-1000 1e-1005 -> 1.00000E-1000 Subnormal -quax553 quantize 1E-999 1e-1006 -> NaN Invalid_operation -quax554 quantize 1E-999 1e-1007 -> NaN Invalid_operation --- related subnormal rounding -quax555 quantize 1.666666E-999 1e-1005 -> 1.666666E-999 -quax556 quantize 1.666666E-1000 1e-1005 -> 1.66667E-1000 Subnormal Inexact Rounded -quax557 quantize 1.666666E-1001 1e-1005 -> 1.6667E-1001 Subnormal Inexact Rounded -quax558 quantize 1.666666E-1002 1e-1005 -> 1.667E-1002 Subnormal Inexact Rounded -quax559 quantize 1.666666E-1003 1e-1005 -> 1.67E-1003 Subnormal Inexact Rounded -quax560 quantize 1.666666E-1004 1e-1005 -> 1.7E-1004 Subnormal Inexact Rounded -quax561 quantize 1.666666E-1005 1e-1005 -> 2E-1005 Subnormal Inexact Rounded -quax562 quantize 1.666666E-1006 1e-1005 -> 0E-1005 Inexact Rounded -quax563 quantize 1.666666E-1007 1e-1005 -> 0E-1005 Inexact Rounded - --- Specials -quax580 quantize Inf -Inf -> Infinity -quax581 quantize Inf 1e-1000 -> NaN Invalid_operation -quax582 quantize Inf 1e-1 -> NaN Invalid_operation -quax583 quantize Inf 1e0 -> NaN Invalid_operation -quax584 quantize Inf 1e1 -> NaN Invalid_operation -quax585 quantize Inf 1e1000 -> NaN Invalid_operation -quax586 quantize Inf Inf -> Infinity -quax587 quantize -1000 Inf -> NaN Invalid_operation -quax588 quantize -Inf Inf -> -Infinity -quax589 quantize -1 Inf -> NaN Invalid_operation -quax590 quantize 0 Inf -> NaN Invalid_operation -quax591 quantize 1 Inf -> NaN Invalid_operation -quax592 quantize 1000 Inf -> NaN Invalid_operation -quax593 quantize Inf Inf -> Infinity -quax594 quantize Inf 1e-0 -> NaN Invalid_operation -quax595 quantize -0 Inf -> NaN Invalid_operation - -quax600 quantize -Inf -Inf -> -Infinity -quax601 quantize -Inf 1e-1000 -> NaN Invalid_operation -quax602 quantize -Inf 1e-1 -> NaN Invalid_operation -quax603 quantize -Inf 1e0 -> NaN Invalid_operation -quax604 quantize -Inf 1e1 -> NaN Invalid_operation -quax605 quantize -Inf 1e1000 -> NaN Invalid_operation -quax606 quantize -Inf Inf -> -Infinity -quax607 quantize -1000 Inf -> NaN Invalid_operation -quax608 quantize -Inf -Inf -> -Infinity -quax609 quantize -1 -Inf -> NaN Invalid_operation -quax610 quantize 0 -Inf -> NaN Invalid_operation -quax611 quantize 1 -Inf -> NaN Invalid_operation -quax612 quantize 1000 -Inf -> NaN Invalid_operation -quax613 quantize Inf -Inf -> Infinity -quax614 quantize -Inf 1e-0 -> NaN Invalid_operation -quax615 quantize -0 -Inf -> NaN Invalid_operation - -quax621 quantize NaN -Inf -> NaN -quax622 quantize NaN 1e-1000 -> NaN -quax623 quantize NaN 1e-1 -> NaN -quax624 quantize NaN 1e0 -> NaN -quax625 quantize NaN 1e1 -> NaN -quax626 quantize NaN 1e1000 -> NaN -quax627 quantize NaN Inf -> NaN -quax628 quantize NaN NaN -> NaN -quax629 quantize -Inf NaN -> NaN -quax630 quantize -1000 NaN -> NaN -quax631 quantize -1 NaN -> NaN -quax632 quantize 0 NaN -> NaN -quax633 quantize 1 NaN -> NaN -quax634 quantize 1000 NaN -> NaN -quax635 quantize Inf NaN -> NaN -quax636 quantize NaN 1e-0 -> NaN -quax637 quantize -0 NaN -> NaN - -quax641 quantize sNaN -Inf -> NaN Invalid_operation -quax642 quantize sNaN 1e-1000 -> NaN Invalid_operation -quax643 quantize sNaN 1e-1 -> NaN Invalid_operation -quax644 quantize sNaN 1e0 -> NaN Invalid_operation -quax645 quantize sNaN 1e1 -> NaN Invalid_operation -quax646 quantize sNaN 1e1000 -> NaN Invalid_operation -quax647 quantize sNaN NaN -> NaN Invalid_operation -quax648 quantize sNaN sNaN -> NaN Invalid_operation -quax649 quantize NaN sNaN -> NaN Invalid_operation -quax650 quantize -Inf sNaN -> NaN Invalid_operation -quax651 quantize -1000 sNaN -> NaN Invalid_operation -quax652 quantize -1 sNaN -> NaN Invalid_operation -quax653 quantize 0 sNaN -> NaN Invalid_operation -quax654 quantize 1 sNaN -> NaN Invalid_operation -quax655 quantize 1000 sNaN -> NaN Invalid_operation -quax656 quantize Inf sNaN -> NaN Invalid_operation -quax657 quantize NaN sNaN -> NaN Invalid_operation -quax658 quantize sNaN 1e-0 -> NaN Invalid_operation -quax659 quantize -0 sNaN -> NaN Invalid_operation - --- propagating NaNs -quax661 quantize NaN9 -Inf -> NaN9 -quax662 quantize NaN8 919 -> NaN8 -quax663 quantize NaN71 Inf -> NaN71 -quax664 quantize NaN6 NaN5 -> NaN6 -quax665 quantize -Inf NaN4 -> NaN4 -quax666 quantize -919 NaN31 -> NaN31 -quax667 quantize Inf NaN2 -> NaN2 - -quax671 quantize sNaN99 -Inf -> NaN99 Invalid_operation -quax672 quantize sNaN98 -11 -> NaN98 Invalid_operation -quax673 quantize sNaN97 NaN -> NaN97 Invalid_operation -quax674 quantize sNaN16 sNaN94 -> NaN16 Invalid_operation -quax675 quantize NaN95 sNaN93 -> NaN93 Invalid_operation -quax676 quantize -Inf sNaN92 -> NaN92 Invalid_operation -quax677 quantize 088 sNaN91 -> NaN91 Invalid_operation -quax678 quantize Inf sNaN90 -> NaN90 Invalid_operation -quax679 quantize NaN sNaN88 -> NaN88 Invalid_operation - -quax681 quantize -NaN9 -Inf -> -NaN9 -quax682 quantize -NaN8 919 -> -NaN8 -quax683 quantize -NaN71 Inf -> -NaN71 -quax684 quantize -NaN6 -NaN5 -> -NaN6 -quax685 quantize -Inf -NaN4 -> -NaN4 -quax686 quantize -919 -NaN31 -> -NaN31 -quax687 quantize Inf -NaN2 -> -NaN2 - -quax691 quantize -sNaN99 -Inf -> -NaN99 Invalid_operation -quax692 quantize -sNaN98 -11 -> -NaN98 Invalid_operation -quax693 quantize -sNaN97 NaN -> -NaN97 Invalid_operation -quax694 quantize -sNaN16 sNaN94 -> -NaN16 Invalid_operation -quax695 quantize -NaN95 -sNaN93 -> -NaN93 Invalid_operation -quax696 quantize -Inf -sNaN92 -> -NaN92 Invalid_operation -quax697 quantize 088 -sNaN91 -> -NaN91 Invalid_operation -quax698 quantize Inf -sNaN90 -> -NaN90 Invalid_operation -quax699 quantize NaN -sNaN88 -> -NaN88 Invalid_operation - --- subnormals and underflow -precision: 4 -maxexponent: 999 -minexponent: -999 -quax710 quantize 1.00E-999 1e-999 -> 1E-999 Rounded -quax711 quantize 0.1E-999 2e-1000 -> 1E-1000 Subnormal -quax712 quantize 0.10E-999 3e-1000 -> 1E-1000 Subnormal Rounded -quax713 quantize 0.100E-999 4e-1000 -> 1E-1000 Subnormal Rounded -quax714 quantize 0.01E-999 5e-1001 -> 1E-1001 Subnormal --- next is rounded to Emin -quax715 quantize 0.999E-999 1e-999 -> 1E-999 Inexact Rounded -quax716 quantize 0.099E-999 10e-1000 -> 1E-1000 Inexact Rounded Subnormal - -quax717 quantize 0.009E-999 1e-1001 -> 1E-1001 Inexact Rounded Subnormal -quax718 quantize 0.001E-999 1e-1001 -> 0E-1001 Inexact Rounded -quax719 quantize 0.0009E-999 1e-1001 -> 0E-1001 Inexact Rounded -quax720 quantize 0.0001E-999 1e-1001 -> 0E-1001 Inexact Rounded - -quax730 quantize -1.00E-999 1e-999 -> -1E-999 Rounded -quax731 quantize -0.1E-999 1e-999 -> -0E-999 Rounded Inexact -quax732 quantize -0.10E-999 1e-999 -> -0E-999 Rounded Inexact -quax733 quantize -0.100E-999 1e-999 -> -0E-999 Rounded Inexact -quax734 quantize -0.01E-999 1e-999 -> -0E-999 Inexact Rounded --- next is rounded to Emin -quax735 quantize -0.999E-999 90e-999 -> -1E-999 Inexact Rounded -quax736 quantize -0.099E-999 -1e-999 -> -0E-999 Inexact Rounded -quax737 quantize -0.009E-999 -1e-999 -> -0E-999 Inexact Rounded -quax738 quantize -0.001E-999 -0e-999 -> -0E-999 Inexact Rounded -quax739 quantize -0.0001E-999 0e-999 -> -0E-999 Inexact Rounded - -quax740 quantize -1.00E-999 1e-1000 -> -1.0E-999 Rounded -quax741 quantize -0.1E-999 1e-1000 -> -1E-1000 Subnormal -quax742 quantize -0.10E-999 1e-1000 -> -1E-1000 Subnormal Rounded -quax743 quantize -0.100E-999 1e-1000 -> -1E-1000 Subnormal Rounded -quax744 quantize -0.01E-999 1e-1000 -> -0E-1000 Inexact Rounded --- next is rounded to Emin -quax745 quantize -0.999E-999 1e-1000 -> -1.0E-999 Inexact Rounded -quax746 quantize -0.099E-999 1e-1000 -> -1E-1000 Inexact Rounded Subnormal -quax747 quantize -0.009E-999 1e-1000 -> -0E-1000 Inexact Rounded -quax748 quantize -0.001E-999 1e-1000 -> -0E-1000 Inexact Rounded -quax749 quantize -0.0001E-999 1e-1000 -> -0E-1000 Inexact Rounded - -quax750 quantize -1.00E-999 1e-1001 -> -1.00E-999 -quax751 quantize -0.1E-999 1e-1001 -> -1.0E-1000 Subnormal -quax752 quantize -0.10E-999 1e-1001 -> -1.0E-1000 Subnormal -quax753 quantize -0.100E-999 1e-1001 -> -1.0E-1000 Subnormal Rounded -quax754 quantize -0.01E-999 1e-1001 -> -1E-1001 Subnormal --- next is rounded to Emin -quax755 quantize -0.999E-999 1e-1001 -> -1.00E-999 Inexact Rounded -quax756 quantize -0.099E-999 1e-1001 -> -1.0E-1000 Inexact Rounded Subnormal -quax757 quantize -0.009E-999 1e-1001 -> -1E-1001 Inexact Rounded Subnormal -quax758 quantize -0.001E-999 1e-1001 -> -0E-1001 Inexact Rounded -quax759 quantize -0.0001E-999 1e-1001 -> -0E-1001 Inexact Rounded - -quax760 quantize -1.00E-999 1e-1002 -> -1.000E-999 -quax761 quantize -0.1E-999 1e-1002 -> -1.00E-1000 Subnormal -quax762 quantize -0.10E-999 1e-1002 -> -1.00E-1000 Subnormal -quax763 quantize -0.100E-999 1e-1002 -> -1.00E-1000 Subnormal -quax764 quantize -0.01E-999 1e-1002 -> -1.0E-1001 Subnormal -quax765 quantize -0.999E-999 1e-1002 -> -9.99E-1000 Subnormal -quax766 quantize -0.099E-999 1e-1002 -> -9.9E-1001 Subnormal -quax767 quantize -0.009E-999 1e-1002 -> -9E-1002 Subnormal -quax768 quantize -0.001E-999 1e-1002 -> -1E-1002 Subnormal -quax769 quantize -0.0001E-999 1e-1002 -> -0E-1002 Inexact Rounded - --- rhs must be no less than Etiny -quax770 quantize -1.00E-999 1e-1003 -> NaN Invalid_operation -quax771 quantize -0.1E-999 1e-1003 -> NaN Invalid_operation -quax772 quantize -0.10E-999 1e-1003 -> NaN Invalid_operation -quax773 quantize -0.100E-999 1e-1003 -> NaN Invalid_operation -quax774 quantize -0.01E-999 1e-1003 -> NaN Invalid_operation -quax775 quantize -0.999E-999 1e-1003 -> NaN Invalid_operation -quax776 quantize -0.099E-999 1e-1003 -> NaN Invalid_operation -quax777 quantize -0.009E-999 1e-1003 -> NaN Invalid_operation -quax778 quantize -0.001E-999 1e-1003 -> NaN Invalid_operation -quax779 quantize -0.0001E-999 1e-1003 -> NaN Invalid_operation -quax780 quantize -0.0001E-999 1e-1004 -> NaN Invalid_operation - -precision: 9 -maxExponent: 999999999 -minexponent: -999999999 - --- some extremes derived from Rescale testcases -quax801 quantize 0 1e1000000000 -> NaN Invalid_operation -quax802 quantize 0 1e-1000000000 -> 0E-1000000000 -quax803 quantize 0 1e2000000000 -> NaN Invalid_operation -quax804 quantize 0 1e-2000000000 -> NaN Invalid_operation -quax805 quantize 0 1e3000000000 -> NaN Invalid_operation -quax806 quantize 0 1e-3000000000 -> NaN Invalid_operation -quax807 quantize 0 1e4000000000 -> NaN Invalid_operation -quax808 quantize 0 1e-4000000000 -> NaN Invalid_operation -quax809 quantize 0 1e5000000000 -> NaN Invalid_operation -quax810 quantize 0 1e-5000000000 -> NaN Invalid_operation -quax811 quantize 0 1e6000000000 -> NaN Invalid_operation -quax812 quantize 0 1e-6000000000 -> NaN Invalid_operation -quax813 quantize 0 1e7000000000 -> NaN Invalid_operation -quax814 quantize 0 1e-7000000000 -> NaN Invalid_operation -quax815 quantize 0 1e8000000000 -> NaN Invalid_operation -quax816 quantize 0 1e-8000000000 -> NaN Invalid_operation -quax817 quantize 0 1e9000000000 -> NaN Invalid_operation -quax818 quantize 0 1e-9000000000 -> NaN Invalid_operation -quax819 quantize 0 1e9999999999 -> NaN Invalid_operation -quax820 quantize 0 1e-9999999999 -> NaN Invalid_operation -quax821 quantize 0 1e10000000000 -> NaN Invalid_operation -quax822 quantize 0 1e-10000000000 -> NaN Invalid_operation - -quax843 quantize 0 1e999999999 -> 0E+999999999 -quax844 quantize 0 1e1000000000 -> NaN Invalid_operation -quax845 quantize 0 1e-999999999 -> 0E-999999999 -quax846 quantize 0 1e-1000000000 -> 0E-1000000000 -quax847 quantize 0 1e-1000000001 -> 0E-1000000001 -quax848 quantize 0 1e-1000000002 -> 0E-1000000002 -quax849 quantize 0 1e-1000000003 -> 0E-1000000003 -quax850 quantize 0 1e-1000000004 -> 0E-1000000004 -quax851 quantize 0 1e-1000000005 -> 0E-1000000005 -quax852 quantize 0 1e-1000000006 -> 0E-1000000006 -quax853 quantize 0 1e-1000000007 -> 0E-1000000007 -quax854 quantize 0 1e-1000000008 -> NaN Invalid_operation - -quax861 quantize 1 1e+2147483649 -> NaN Invalid_operation -quax862 quantize 1 1e+2147483648 -> NaN Invalid_operation -quax863 quantize 1 1e+2147483647 -> NaN Invalid_operation -quax864 quantize 1 1e-2147483647 -> NaN Invalid_operation -quax865 quantize 1 1e-2147483648 -> NaN Invalid_operation -quax866 quantize 1 1e-2147483649 -> NaN Invalid_operation - --- Null tests -quax900 quantize 10 # -> NaN Invalid_operation -quax901 quantize # 1e10 -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/randomBound32.decTest b/sys/lib/python/test/decimaltestdata/randomBound32.decTest deleted file mode 100644 index 308589c14..000000000 --- a/sys/lib/python/test/decimaltestdata/randomBound32.decTest +++ /dev/null @@ -1,2443 +0,0 @@ ------------------------------------------------------------------------- --- randomBound32.decTest -- decimal testcases -- boundaries near 32 -- --- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- These testcases test calculations at precisions 31, 32, and 33, to --- exercise the boundaries around 2**5 - --- randomly generated testcases [26 Sep 2001] -extended: 1 -precision: 31 -rounding: half_up -maxExponent: 9999 -minexponent: -9999 - -addx3001 add 4953734675913.065314738743322579 0218.932010396534371704930714860E+797 -> 2.189320103965343717049307148600E+799 Inexact Rounded -comx3001 compare 4953734675913.065314738743322579 0218.932010396534371704930714860E+797 -> -1 -divx3001 divide 4953734675913.065314738743322579 0218.932010396534371704930714860E+797 -> 2.262681764507965005284080800438E-787 Inexact Rounded -dvix3001 divideint 4953734675913.065314738743322579 0218.932010396534371704930714860E+797 -> 0 -mulx3001 multiply 4953734675913.065314738743322579 0218.932010396534371704930714860E+797 -> 1.084531091568672041923151632066E+812 Inexact Rounded -powx3001 power 4953734675913.065314738743322579 2 -> 24539487239343522246155890.99495 Inexact Rounded -remx3001 remainder 4953734675913.065314738743322579 0218.932010396534371704930714860E+797 -> 4953734675913.065314738743322579 -subx3001 subtract 4953734675913.065314738743322579 0218.932010396534371704930714860E+797 -> -2.189320103965343717049307148600E+799 Inexact Rounded -addx3002 add 9641.684323386955881595490347910E-844 -78864532047.12287484430980636798E+934 -> -7.886453204712287484430980636798E+944 Inexact Rounded -comx3002 compare 9641.684323386955881595490347910E-844 -78864532047.12287484430980636798E+934 -> 1 -divx3002 divide 9641.684323386955881595490347910E-844 -78864532047.12287484430980636798E+934 -> -1.222562801441069667849402782716E-1785 Inexact Rounded -dvix3002 divideint 9641.684323386955881595490347910E-844 -78864532047.12287484430980636798E+934 -> -0 -mulx3002 multiply 9641.684323386955881595490347910E-844 -78864532047.12287484430980636798E+934 -> -7.603869223099928141659831589905E+104 Inexact Rounded -powx3002 power 9641.684323386955881595490347910E-844 -8 -> 1.338988152067180337738955757587E+6720 Inexact Rounded -remx3002 remainder 9641.684323386955881595490347910E-844 -78864532047.12287484430980636798E+934 -> 9.641684323386955881595490347910E-841 -subx3002 subtract 9641.684323386955881595490347910E-844 -78864532047.12287484430980636798E+934 -> 7.886453204712287484430980636798E+944 Inexact Rounded -addx3003 add -1.028048571628326871054964307774E+529 49200008645699.35577937582714739 -> -1.028048571628326871054964307774E+529 Inexact Rounded -comx3003 compare -1.028048571628326871054964307774E+529 49200008645699.35577937582714739 -> -1 -divx3003 divide -1.028048571628326871054964307774E+529 49200008645699.35577937582714739 -> -2.089529249946971482861843692465E+515 Inexact Rounded -dvix3003 divideint -1.028048571628326871054964307774E+529 49200008645699.35577937582714739 -> NaN Division_impossible -mulx3003 multiply -1.028048571628326871054964307774E+529 49200008645699.35577937582714739 -> -5.057999861231255549283737861207E+542 Inexact Rounded -powx3003 power -1.028048571628326871054964307774E+529 5 -> -1.148333858253704284232780819739E+2645 Inexact Rounded -remx3003 remainder -1.028048571628326871054964307774E+529 49200008645699.35577937582714739 -> NaN Division_impossible -subx3003 subtract -1.028048571628326871054964307774E+529 49200008645699.35577937582714739 -> -1.028048571628326871054964307774E+529 Inexact Rounded -addx3004 add 479084.8561808930525417735205519 084157571054.2691784660983989931 -> 84158050139.12535935915094076662 Inexact Rounded -comx3004 compare 479084.8561808930525417735205519 084157571054.2691784660983989931 -> -1 -divx3004 divide 479084.8561808930525417735205519 084157571054.2691784660983989931 -> 0.000005692712493709617905493710207969 Inexact Rounded -dvix3004 divideint 479084.8561808930525417735205519 084157571054.2691784660983989931 -> 0 -mulx3004 multiply 479084.8561808930525417735205519 084157571054.2691784660983989931 -> 40318617825067837.47317700523687 Inexact Rounded -powx3004 power 479084.8561808930525417735205519 8 -> 2.775233598021235973545933045837E+45 Inexact Rounded -remx3004 remainder 479084.8561808930525417735205519 084157571054.2691784660983989931 -> 479084.8561808930525417735205519 -subx3004 subtract 479084.8561808930525417735205519 084157571054.2691784660983989931 -> -84157091969.41299757304585721958 Inexact Rounded -addx3005 add -0363750788.573782205664349562931 -3172.080934464133691909905980096 -> -363753960.6547166697980414728370 Inexact Rounded -comx3005 compare -0363750788.573782205664349562931 -3172.080934464133691909905980096 -> -1 -divx3005 divide -0363750788.573782205664349562931 -3172.080934464133691909905980096 -> 114672.6064337420167096295290890 Inexact Rounded -dvix3005 divideint -0363750788.573782205664349562931 -3172.080934464133691909905980096 -> 114672 -mulx3005 multiply -0363750788.573782205664349562931 -3172.080934464133691909905980096 -> 1153846941331.188583292239230818 Inexact Rounded -powx3005 power -0363750788.573782205664349562931 -3172 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3005 remainder -0363750788.573782205664349562931 -3172.080934464133691909905980096 -> -1923.656911066945656824381431488 -subx3005 subtract -0363750788.573782205664349562931 -3172.080934464133691909905980096 -> -363747616.4928477415306576530250 Inexact Rounded -addx3006 add 1381026551423669919010191878449 -82.66614775445371254999357800739 -> 1381026551423669919010191878366 Inexact Rounded -comx3006 compare 1381026551423669919010191878449 -82.66614775445371254999357800739 -> 1 -divx3006 divide 1381026551423669919010191878449 -82.66614775445371254999357800739 -> -16706071214613552377376639557.90 Inexact Rounded -dvix3006 divideint 1381026551423669919010191878449 -82.66614775445371254999357800739 -> -16706071214613552377376639557 -mulx3006 multiply 1381026551423669919010191878449 -82.66614775445371254999357800739 -> -1.141641449528127656560770057228E+32 Inexact Rounded -powx3006 power 1381026551423669919010191878449 -83 -> 2.307977908106564299925193011052E-2502 Inexact Rounded -remx3006 remainder 1381026551423669919010191878449 -82.66614775445371254999357800739 -> 74.22115953553602036042168767377 -subx3006 subtract 1381026551423669919010191878449 -82.66614775445371254999357800739 -> 1381026551423669919010191878532 Inexact Rounded -addx3007 add 4627.026960423072127953556635585 -4410583132901.830017479741231131 -> -4410583128274.803057056669103177 Inexact Rounded -comx3007 compare 4627.026960423072127953556635585 -4410583132901.830017479741231131 -> 1 -divx3007 divide 4627.026960423072127953556635585 -4410583132901.830017479741231131 -> -1.049073743992404570569003129346E-9 Inexact Rounded -dvix3007 divideint 4627.026960423072127953556635585 -4410583132901.830017479741231131 -> -0 -mulx3007 multiply 4627.026960423072127953556635585 -4410583132901.830017479741231131 -> -20407887067124025.31576887565113 Inexact Rounded -powx3007 power 4627.026960423072127953556635585 -4 -> 2.181684167222334934221407781701E-15 Inexact Rounded -remx3007 remainder 4627.026960423072127953556635585 -4410583132901.830017479741231131 -> 4627.026960423072127953556635585 -subx3007 subtract 4627.026960423072127953556635585 -4410583132901.830017479741231131 -> 4410583137528.856977902813359085 Inexact Rounded -addx3008 add 75353574493.84484153484918212042 -8684111695095849922263044191221 -> -8684111695095849922187690616727 Inexact Rounded -comx3008 compare 75353574493.84484153484918212042 -8684111695095849922263044191221 -> 1 -divx3008 divide 75353574493.84484153484918212042 -8684111695095849922263044191221 -> -8.677177026223536475531592432118E-21 Inexact Rounded -dvix3008 divideint 75353574493.84484153484918212042 -8684111695095849922263044191221 -> -0 -mulx3008 multiply 75353574493.84484153484918212042 -8684111695095849922263044191221 -> -6.543788575292743281456830701127E+41 Inexact Rounded -powx3008 power 75353574493.84484153484918212042 -9 -> 1.276630670287906925570645490708E-98 Inexact Rounded -remx3008 remainder 75353574493.84484153484918212042 -8684111695095849922263044191221 -> 75353574493.84484153484918212042 -subx3008 subtract 75353574493.84484153484918212042 -8684111695095849922263044191221 -> 8684111695095849922338397765715 Inexact Rounded -addx3009 add 6907058.216435355874729592373011 2.857005446917670515662398741545 -> 6907061.073440802792400108035410 Inexact Rounded -comx3009 compare 6907058.216435355874729592373011 2.857005446917670515662398741545 -> 1 -divx3009 divide 6907058.216435355874729592373011 2.857005446917670515662398741545 -> 2417586.646146283856436864121104 Inexact Rounded -dvix3009 divideint 6907058.216435355874729592373011 2.857005446917670515662398741545 -> 2417586 -mulx3009 multiply 6907058.216435355874729592373011 2.857005446917670515662398741545 -> 19733502.94653326211623698034717 Inexact Rounded -powx3009 power 6907058.216435355874729592373011 3 -> 329518156646369505494.8971353240 Inexact Rounded -remx3009 remainder 6907058.216435355874729592373011 2.857005446917670515662398741545 -> 1.846043452483451396449034189630 -subx3009 subtract 6907058.216435355874729592373011 2.857005446917670515662398741545 -> 6907055.359429908957059076710612 Inexact Rounded -addx3010 add -38949530427253.24030680468677190 712168021.1265384466442576619064E-992 -> -38949530427253.24030680468677190 Inexact Rounded -comx3010 compare -38949530427253.24030680468677190 712168021.1265384466442576619064E-992 -> -1 -divx3010 divide -38949530427253.24030680468677190 712168021.1265384466442576619064E-992 -> -5.469149031100999700489221122509E+996 Inexact Rounded -dvix3010 divideint -38949530427253.24030680468677190 712168021.1265384466442576619064E-992 -> NaN Division_impossible -mulx3010 multiply -38949530427253.24030680468677190 712168021.1265384466442576619064E-992 -> -2.773861000818483769292240109417E-970 Inexact Rounded -powx3010 power -38949530427253.24030680468677190 7 -> -1.359926959823071332599817363877E+95 Inexact Rounded -remx3010 remainder -38949530427253.24030680468677190 712168021.1265384466442576619064E-992 -> NaN Division_impossible -subx3010 subtract -38949530427253.24030680468677190 712168021.1265384466442576619064E-992 -> -38949530427253.24030680468677190 Inexact Rounded -addx3011 add -0708069.025667471996378081482549 -562842.4701520787831018732202804 -> -1270911.495819550779479954702829 Inexact Rounded -comx3011 compare -0708069.025667471996378081482549 -562842.4701520787831018732202804 -> -1 -divx3011 divide -0708069.025667471996378081482549 -562842.4701520787831018732202804 -> 1.258023449218665608349145394069 Inexact Rounded -dvix3011 divideint -0708069.025667471996378081482549 -562842.4701520787831018732202804 -> 1 -mulx3011 multiply -0708069.025667471996378081482549 -562842.4701520787831018732202804 -> 398531319444.8556128729086112205 Inexact Rounded -powx3011 power -0708069.025667471996378081482549 -562842 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3011 remainder -0708069.025667471996378081482549 -562842.4701520787831018732202804 -> -145226.5555153932132762082622686 -subx3011 subtract -0708069.025667471996378081482549 -562842.4701520787831018732202804 -> -145226.5555153932132762082622686 -addx3012 add 4055087.246994644709729942673976 -43183146921897.67383476104084575E+211 -> -4.318314692189767383476104084575E+224 Inexact Rounded -comx3012 compare 4055087.246994644709729942673976 -43183146921897.67383476104084575E+211 -> 1 -divx3012 divide 4055087.246994644709729942673976 -43183146921897.67383476104084575E+211 -> -9.390439409913307906923909630247E-219 Inexact Rounded -dvix3012 divideint 4055087.246994644709729942673976 -43183146921897.67383476104084575E+211 -> -0 -mulx3012 multiply 4055087.246994644709729942673976 -43183146921897.67383476104084575E+211 -> -1.751114283680833039197637874453E+231 Inexact Rounded -powx3012 power 4055087.246994644709729942673976 -4 -> 3.698274893849241116195795515302E-27 Inexact Rounded -remx3012 remainder 4055087.246994644709729942673976 -43183146921897.67383476104084575E+211 -> 4055087.246994644709729942673976 -subx3012 subtract 4055087.246994644709729942673976 -43183146921897.67383476104084575E+211 -> 4.318314692189767383476104084575E+224 Inexact Rounded -addx3013 add 4502895892520.396581348110906909E-512 -815.9047305921862348263521876034 -> -815.9047305921862348263521876034 Inexact Rounded -comx3013 compare 4502895892520.396581348110906909E-512 -815.9047305921862348263521876034 -> 1 -divx3013 divide 4502895892520.396581348110906909E-512 -815.9047305921862348263521876034 -> -5.518899111238367862234798433551E-503 Inexact Rounded -dvix3013 divideint 4502895892520.396581348110906909E-512 -815.9047305921862348263521876034 -> -0 -mulx3013 multiply 4502895892520.396581348110906909E-512 -815.9047305921862348263521876034 -> -3.673934060071516156604453756541E-497 Inexact Rounded -powx3013 power 4502895892520.396581348110906909E-512 -816 -> Infinity Overflow Inexact Rounded -remx3013 remainder 4502895892520.396581348110906909E-512 -815.9047305921862348263521876034 -> 4.502895892520396581348110906909E-500 -subx3013 subtract 4502895892520.396581348110906909E-512 -815.9047305921862348263521876034 -> 815.9047305921862348263521876034 Inexact Rounded -addx3014 add 467.6721295072628100260239179865 -02.07155073395573569852316073025 -> 465.6005787733070743275007572563 Inexact Rounded -comx3014 compare 467.6721295072628100260239179865 -02.07155073395573569852316073025 -> 1 -divx3014 divide 467.6721295072628100260239179865 -02.07155073395573569852316073025 -> -225.7594380101027705997496045999 Inexact Rounded -dvix3014 divideint 467.6721295072628100260239179865 -02.07155073395573569852316073025 -> -225 -mulx3014 multiply 467.6721295072628100260239179865 -02.07155073395573569852316073025 -> -968.8065431314121523074875069807 Inexact Rounded -powx3014 power 467.6721295072628100260239179865 -2 -> 0.000004572113694193221810609836080931 Inexact Rounded -remx3014 remainder 467.6721295072628100260239179865 -02.07155073395573569852316073025 -> 1.57321436722227785831275368025 -subx3014 subtract 467.6721295072628100260239179865 -02.07155073395573569852316073025 -> 469.7436802412185457245470787168 Inexact Rounded -addx3015 add 2.156795313311150143949997552501E-571 -8677147.586389401682712180146855 -> -8677147.586389401682712180146855 Inexact Rounded -comx3015 compare 2.156795313311150143949997552501E-571 -8677147.586389401682712180146855 -> 1 -divx3015 divide 2.156795313311150143949997552501E-571 -8677147.586389401682712180146855 -> -2.485604044230163799604243529005E-578 Inexact Rounded -dvix3015 divideint 2.156795313311150143949997552501E-571 -8677147.586389401682712180146855 -> -0 -mulx3015 multiply 2.156795313311150143949997552501E-571 -8677147.586389401682712180146855 -> -1.871483124723381986272837942577E-564 Inexact Rounded -powx3015 power 2.156795313311150143949997552501E-571 -8677148 -> Infinity Overflow Inexact Rounded -remx3015 remainder 2.156795313311150143949997552501E-571 -8677147.586389401682712180146855 -> 2.156795313311150143949997552501E-571 -subx3015 subtract 2.156795313311150143949997552501E-571 -8677147.586389401682712180146855 -> 8677147.586389401682712180146855 Inexact Rounded -addx3016 add -974953.2801637208368002585822457 -693095793.3667578067802698191246 -> -694070746.6469215276170700777068 Inexact Rounded -comx3016 compare -974953.2801637208368002585822457 -693095793.3667578067802698191246 -> 1 -divx3016 divide -974953.2801637208368002585822457 -693095793.3667578067802698191246 -> 0.001406664546942092941961075608769 Inexact Rounded -dvix3016 divideint -974953.2801637208368002585822457 -693095793.3667578067802698191246 -> 0 -mulx3016 multiply -974953.2801637208368002585822457 -693095793.3667578067802698191246 -> 675736017210596.9899587749991363 Inexact Rounded -powx3016 power -974953.2801637208368002585822457 -693095793 -> -0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3016 remainder -974953.2801637208368002585822457 -693095793.3667578067802698191246 -> -974953.2801637208368002585822457 -subx3016 subtract -974953.2801637208368002585822457 -693095793.3667578067802698191246 -> 692120840.0865940859434695605424 Inexact Rounded -addx3017 add -7634680140009571846155654339781 3009630949502.035852433434214413E-490 -> -7634680140009571846155654339781 Inexact Rounded -comx3017 compare -7634680140009571846155654339781 3009630949502.035852433434214413E-490 -> -1 -divx3017 divide -7634680140009571846155654339781 3009630949502.035852433434214413E-490 -> -2.536749610869326753741024659948E+508 Inexact Rounded -dvix3017 divideint -7634680140009571846155654339781 3009630949502.035852433434214413E-490 -> NaN Division_impossible -mulx3017 multiply -7634680140009571846155654339781 3009630949502.035852433434214413E-490 -> -2.297756963892134373657544025107E-447 Inexact Rounded -powx3017 power -7634680140009571846155654339781 3 -> -4.450128382072157170207584847831E+92 Inexact Rounded -remx3017 remainder -7634680140009571846155654339781 3009630949502.035852433434214413E-490 -> NaN Division_impossible -subx3017 subtract -7634680140009571846155654339781 3009630949502.035852433434214413E-490 -> -7634680140009571846155654339781 Inexact Rounded -addx3018 add 262273.0222851186523650889896428E-624 74177.21073338090843145838835480 -> 74177.21073338090843145838835480 Inexact Rounded -comx3018 compare 262273.0222851186523650889896428E-624 74177.21073338090843145838835480 -> -1 -divx3018 divide 262273.0222851186523650889896428E-624 74177.21073338090843145838835480 -> 3.535762799545274329358292065343E-624 Inexact Rounded -dvix3018 divideint 262273.0222851186523650889896428E-624 74177.21073338090843145838835480 -> 0 -mulx3018 multiply 262273.0222851186523650889896428E-624 74177.21073338090843145838835480 -> 1.945468124372395349192665031675E-614 Inexact Rounded -powx3018 power 262273.0222851186523650889896428E-624 74177 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3018 remainder 262273.0222851186523650889896428E-624 74177.21073338090843145838835480 -> 2.622730222851186523650889896428E-619 -subx3018 subtract 262273.0222851186523650889896428E-624 74177.21073338090843145838835480 -> -74177.21073338090843145838835480 Inexact Rounded -addx3019 add -8036052748815903177624716581732 -066677357.4438809548850966167573 -> -8036052748815903177624783259089 Inexact Rounded -comx3019 compare -8036052748815903177624716581732 -066677357.4438809548850966167573 -> -1 -divx3019 divide -8036052748815903177624716581732 -066677357.4438809548850966167573 -> 120521464210387351732732.6271469 Inexact Rounded -dvix3019 divideint -8036052748815903177624716581732 -066677357.4438809548850966167573 -> 120521464210387351732732 -mulx3019 multiply -8036052748815903177624716581732 -066677357.4438809548850966167573 -> 5.358227615706800711033262124598E+38 Inexact Rounded -powx3019 power -8036052748815903177624716581732 -66677357 -> -0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3019 remainder -8036052748815903177624716581732 -066677357.4438809548850966167573 -> -41816499.5048993028288978900564 -subx3019 subtract -8036052748815903177624716581732 -066677357.4438809548850966167573 -> -8036052748815903177624649904375 Inexact Rounded -addx3020 add 883429.5928031498103637713570166E+765 -43978.97283712939198111043032726 -> 8.834295928031498103637713570166E+770 Inexact Rounded -comx3020 compare 883429.5928031498103637713570166E+765 -43978.97283712939198111043032726 -> 1 -divx3020 divide 883429.5928031498103637713570166E+765 -43978.97283712939198111043032726 -> -2.008754492913739633208672455025E+766 Inexact Rounded -dvix3020 divideint 883429.5928031498103637713570166E+765 -43978.97283712939198111043032726 -> NaN Division_impossible -mulx3020 multiply 883429.5928031498103637713570166E+765 -43978.97283712939198111043032726 -> -3.885232606540600490321438191516E+775 Inexact Rounded -powx3020 power 883429.5928031498103637713570166E+765 -43979 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3020 remainder 883429.5928031498103637713570166E+765 -43978.97283712939198111043032726 -> NaN Division_impossible -subx3020 subtract 883429.5928031498103637713570166E+765 -43978.97283712939198111043032726 -> 8.834295928031498103637713570166E+770 Inexact Rounded -addx3021 add 24791301060.37938360567775506973 -5613327866480.322649080205877564 -> -5588536565419.943265474528122494 Inexact Rounded -comx3021 compare 24791301060.37938360567775506973 -5613327866480.322649080205877564 -> 1 -divx3021 divide 24791301060.37938360567775506973 -5613327866480.322649080205877564 -> -0.004416506865458415275182120038399 Inexact Rounded -dvix3021 divideint 24791301060.37938360567775506973 -5613327866480.322649080205877564 -> -0 -mulx3021 multiply 24791301060.37938360567775506973 -5613327866480.322649080205877564 -> -139161701088530765925120.8408852 Inexact Rounded -powx3021 power 24791301060.37938360567775506973 -6 -> 4.307289712375673028996126249656E-63 Inexact Rounded -remx3021 remainder 24791301060.37938360567775506973 -5613327866480.322649080205877564 -> 24791301060.37938360567775506973 -subx3021 subtract 24791301060.37938360567775506973 -5613327866480.322649080205877564 -> 5638119167540.702032685883632634 Inexact Rounded -addx3022 add -930711443.9474781586162910776139 -740.3860979292775472622798348030 -> -930712184.3335760878938383398937 Inexact Rounded -comx3022 compare -930711443.9474781586162910776139 -740.3860979292775472622798348030 -> -1 -divx3022 divide -930711443.9474781586162910776139 -740.3860979292775472622798348030 -> 1257062.290270583507131602958799 Inexact Rounded -dvix3022 divideint -930711443.9474781586162910776139 -740.3860979292775472622798348030 -> 1257062 -mulx3022 multiply -930711443.9474781586162910776139 -740.3860979292775472622798348030 -> 689085814282.3968746911100154133 Inexact Rounded -powx3022 power -930711443.9474781586162910776139 -740 -> 1.193603394165051899997226995178E-6637 Inexact Rounded -remx3022 remainder -930711443.9474781586162910776139 -740.3860979292775472622798348030 -> -214.9123046664996750639167712140 -subx3022 subtract -930711443.9474781586162910776139 -740.3860979292775472622798348030 -> -930710703.5613802293387438153341 Inexact Rounded -addx3023 add 2358276428765.064191082773385539 214.3589796082328665878602304469 -> 2358276428979.423170691006252127 Inexact Rounded -comx3023 compare 2358276428765.064191082773385539 214.3589796082328665878602304469 -> 1 -divx3023 divide 2358276428765.064191082773385539 214.3589796082328665878602304469 -> 11001528525.07089502152736489473 Inexact Rounded -dvix3023 divideint 2358276428765.064191082773385539 214.3589796082328665878602304469 -> 11001528525 -mulx3023 multiply 2358276428765.064191082773385539 214.3589796082328665878602304469 -> 505517728904226.6233443209659001 Inexact Rounded -powx3023 power 2358276428765.064191082773385539 214 -> 5.435856480782850080741276939256E+2647 Inexact Rounded -remx3023 remainder 2358276428765.064191082773385539 214.3589796082328665878602304469 -> 15.1969844739096415643561521775 -subx3023 subtract 2358276428765.064191082773385539 214.3589796082328665878602304469 -> 2358276428550.705211474540518951 Inexact Rounded -addx3024 add -3.868744449795653651638308926987E+750 8270.472492965559872384018329418 -> -3.868744449795653651638308926987E+750 Inexact Rounded -comx3024 compare -3.868744449795653651638308926987E+750 8270.472492965559872384018329418 -> -1 -divx3024 divide -3.868744449795653651638308926987E+750 8270.472492965559872384018329418 -> -4.677779235812959233092739433453E+746 Inexact Rounded -dvix3024 divideint -3.868744449795653651638308926987E+750 8270.472492965559872384018329418 -> NaN Division_impossible -mulx3024 multiply -3.868744449795653651638308926987E+750 8270.472492965559872384018329418 -> -3.199634455434813294426505526063E+754 Inexact Rounded -powx3024 power -3.868744449795653651638308926987E+750 8270 -> Infinity Overflow Inexact Rounded -remx3024 remainder -3.868744449795653651638308926987E+750 8270.472492965559872384018329418 -> NaN Division_impossible -subx3024 subtract -3.868744449795653651638308926987E+750 8270.472492965559872384018329418 -> -3.868744449795653651638308926987E+750 Inexact Rounded -addx3025 add 140422069.5863246490180206814374E-447 -567195652586.2454217069003186487 -> -567195652586.2454217069003186487 Inexact Rounded -comx3025 compare 140422069.5863246490180206814374E-447 -567195652586.2454217069003186487 -> 1 -divx3025 divide 140422069.5863246490180206814374E-447 -567195652586.2454217069003186487 -> -2.475725421131866851190640203633E-451 Inexact Rounded -dvix3025 divideint 140422069.5863246490180206814374E-447 -567195652586.2454217069003186487 -> -0 -mulx3025 multiply 140422069.5863246490180206814374E-447 -567195652586.2454217069003186487 -> -7.964678739652657498503799559950E-428 Inexact Rounded -powx3025 power 140422069.5863246490180206814374E-447 -6 -> 1.304330899731988395473578425854E+2633 Inexact Rounded -remx3025 remainder 140422069.5863246490180206814374E-447 -567195652586.2454217069003186487 -> 1.404220695863246490180206814374E-439 -subx3025 subtract 140422069.5863246490180206814374E-447 -567195652586.2454217069003186487 -> 567195652586.2454217069003186487 Inexact Rounded -addx3026 add 75929096475.63450425339472559646E+153 -0945260193.503803519572604151290E+459 -> -9.452601935038035195726041512900E+467 Inexact Rounded -comx3026 compare 75929096475.63450425339472559646E+153 -0945260193.503803519572604151290E+459 -> 1 -divx3026 divide 75929096475.63450425339472559646E+153 -0945260193.503803519572604151290E+459 -> -8.032613347885465805613265604973E-305 Inexact Rounded -dvix3026 divideint 75929096475.63450425339472559646E+153 -0945260193.503803519572604151290E+459 -> -0 -mulx3026 multiply 75929096475.63450425339472559646E+153 -0945260193.503803519572604151290E+459 -> -7.177275242712723733041569606882E+631 Inexact Rounded -powx3026 power 75929096475.63450425339472559646E+153 -9 -> 1.192136299657177324051477375561E-1475 Inexact Rounded -remx3026 remainder 75929096475.63450425339472559646E+153 -0945260193.503803519572604151290E+459 -> 7.592909647563450425339472559646E+163 -subx3026 subtract 75929096475.63450425339472559646E+153 -0945260193.503803519572604151290E+459 -> 9.452601935038035195726041512900E+467 Inexact Rounded -addx3027 add 6312318309.142044953357460463732 -5641317823.202274083982487558514E+628 -> -5.641317823202274083982487558514E+637 Inexact Rounded -comx3027 compare 6312318309.142044953357460463732 -5641317823.202274083982487558514E+628 -> 1 -divx3027 divide 6312318309.142044953357460463732 -5641317823.202274083982487558514E+628 -> -1.118943925332481944765809682502E-628 Inexact Rounded -dvix3027 divideint 6312318309.142044953357460463732 -5641317823.202274083982487558514E+628 -> -0 -mulx3027 multiply 6312318309.142044953357460463732 -5641317823.202274083982487558514E+628 -> -3.560979378308906043783023726787E+647 Inexact Rounded -powx3027 power 6312318309.142044953357460463732 -6 -> 1.580762611512787720076533747265E-59 Inexact Rounded -remx3027 remainder 6312318309.142044953357460463732 -5641317823.202274083982487558514E+628 -> 6312318309.142044953357460463732 -subx3027 subtract 6312318309.142044953357460463732 -5641317823.202274083982487558514E+628 -> 5.641317823202274083982487558514E+637 Inexact Rounded -addx3028 add 93793652428100.52105928239469937 917.2571313109730433369594936416E-712 -> 93793652428100.52105928239469937 Inexact Rounded -comx3028 compare 93793652428100.52105928239469937 917.2571313109730433369594936416E-712 -> 1 -divx3028 divide 93793652428100.52105928239469937 917.2571313109730433369594936416E-712 -> 1.022544815694674972559924997256E+723 Inexact Rounded -dvix3028 divideint 93793652428100.52105928239469937 917.2571313109730433369594936416E-712 -> NaN Division_impossible -mulx3028 multiply 93793652428100.52105928239469937 917.2571313109730433369594936416E-712 -> 8.603289656137796526769786965341E-696 Inexact Rounded -powx3028 power 93793652428100.52105928239469937 9 -> 5.617732206663136654187263964365E+125 Inexact Rounded -remx3028 remainder 93793652428100.52105928239469937 917.2571313109730433369594936416E-712 -> NaN Division_impossible -subx3028 subtract 93793652428100.52105928239469937 917.2571313109730433369594936416E-712 -> 93793652428100.52105928239469937 Inexact Rounded -addx3029 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337115 Inexact Rounded -comx3029 compare 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 1 -divx3029 divide 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> -4103968.106336710126241266685434 Inexact Rounded -dvix3029 divideint 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> -4103968 -mulx3029 multiply 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> -2362732023235112.375960528304974 Inexact Rounded -powx3029 power 98471198160.56524417578665886060 -23994 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3029 remainder 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 2551.45824316125588493249246784 -subx3029 subtract 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471222154.70837811518409435005 Inexact Rounded -addx3030 add 329326552.0208398002250836592043 -02451.10065397010591546041034041 -> 329324100.9201858301191681987940 Inexact Rounded -comx3030 compare 329326552.0208398002250836592043 -02451.10065397010591546041034041 -> 1 -divx3030 divide 329326552.0208398002250836592043 -02451.10065397010591546041034041 -> -134358.6406732917173739187421978 Inexact Rounded -dvix3030 divideint 329326552.0208398002250836592043 -02451.10065397010591546041034041 -> -134358 -mulx3030 multiply 329326552.0208398002250836592043 -02451.10065397010591546041034041 -> -807212527028.0005401736893474430 Inexact Rounded -powx3030 power 329326552.0208398002250836592043 -2451 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3030 remainder 329326552.0208398002250836592043 -02451.10065397010591546041034041 -> 1570.35472430963565384668749322 -subx3030 subtract 329326552.0208398002250836592043 -02451.10065397010591546041034041 -> 329329003.1214937703309991196146 Inexact Rounded -addx3031 add -92980.68431371090354435763218439 -2282178507046019721925800997065 -> -2282178507046019721925801090046 Inexact Rounded -comx3031 compare -92980.68431371090354435763218439 -2282178507046019721925800997065 -> 1 -divx3031 divide -92980.68431371090354435763218439 -2282178507046019721925800997065 -> 4.074207342968196863070496994457E-26 Inexact Rounded -dvix3031 divideint -92980.68431371090354435763218439 -2282178507046019721925800997065 -> 0 -mulx3031 multiply -92980.68431371090354435763218439 -2282178507046019721925800997065 -> 2.121985193111820147170707717938E+35 Inexact Rounded -powx3031 power -92980.68431371090354435763218439 -2 -> 1.156683455371909793870207184337E-10 Inexact Rounded -remx3031 remainder -92980.68431371090354435763218439 -2282178507046019721925800997065 -> -92980.68431371090354435763218439 -subx3031 subtract -92980.68431371090354435763218439 -2282178507046019721925800997065 -> 2282178507046019721925800904084 Inexact Rounded -addx3032 add 12135817762.27858606259822256987E+738 98.35649167872356132249561021910E-902 -> 1.213581776227858606259822256987E+748 Inexact Rounded -comx3032 compare 12135817762.27858606259822256987E+738 98.35649167872356132249561021910E-902 -> 1 -divx3032 divide 12135817762.27858606259822256987E+738 98.35649167872356132249561021910E-902 -> 1.233860374149945561886955398724E+1648 Inexact Rounded -dvix3032 divideint 12135817762.27858606259822256987E+738 98.35649167872356132249561021910E-902 -> NaN Division_impossible -mulx3032 multiply 12135817762.27858606259822256987E+738 98.35649167872356132249561021910E-902 -> 1.193636458750059340733188876015E-152 Inexact Rounded -powx3032 power 12135817762.27858606259822256987E+738 10 -> 6.929317520577437720457517499936E+7480 Inexact Rounded -remx3032 remainder 12135817762.27858606259822256987E+738 98.35649167872356132249561021910E-902 -> NaN Division_impossible -subx3032 subtract 12135817762.27858606259822256987E+738 98.35649167872356132249561021910E-902 -> 1.213581776227858606259822256987E+748 Inexact Rounded -addx3033 add 37.27457578793521166809739140081 -392550.4790095035979998355569916 -> -392513.2044337156627881674596002 Inexact Rounded -comx3033 compare 37.27457578793521166809739140081 -392550.4790095035979998355569916 -> 1 -divx3033 divide 37.27457578793521166809739140081 -392550.4790095035979998355569916 -> -0.00009495486002714264641177211062199 Inexact Rounded -dvix3033 divideint 37.27457578793521166809739140081 -392550.4790095035979998355569916 -> -0 -mulx3033 multiply 37.27457578793521166809739140081 -392550.4790095035979998355569916 -> -14632152.58043001234518095997140 Inexact Rounded -powx3033 power 37.27457578793521166809739140081 -392550 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3033 remainder 37.27457578793521166809739140081 -392550.4790095035979998355569916 -> 37.27457578793521166809739140081 -subx3033 subtract 37.27457578793521166809739140081 -392550.4790095035979998355569916 -> 392587.7535852915332115036543830 Inexact Rounded -addx3034 add -2787.980590304199878755265273703 7117631179305319208210387565324 -> 7117631179305319208210387562536 Inexact Rounded -comx3034 compare -2787.980590304199878755265273703 7117631179305319208210387565324 -> -1 -divx3034 divide -2787.980590304199878755265273703 7117631179305319208210387565324 -> -3.917006262435063093475140250870E-28 Inexact Rounded -dvix3034 divideint -2787.980590304199878755265273703 7117631179305319208210387565324 -> -0 -mulx3034 multiply -2787.980590304199878755265273703 7117631179305319208210387565324 -> -1.984381757684722217801410305714E+34 Inexact Rounded -powx3034 power -2787.980590304199878755265273703 7 -> -1309266999233099220127139.440082 Inexact Rounded -remx3034 remainder -2787.980590304199878755265273703 7117631179305319208210387565324 -> -2787.980590304199878755265273703 -subx3034 subtract -2787.980590304199878755265273703 7117631179305319208210387565324 -> -7117631179305319208210387568112 Inexact Rounded -addx3035 add -9890633.854609434943559831911276E+971 -1939985729.436827777055699361237 -> -9.890633854609434943559831911276E+977 Inexact Rounded -comx3035 compare -9890633.854609434943559831911276E+971 -1939985729.436827777055699361237 -> -1 -divx3035 divide -9890633.854609434943559831911276E+971 -1939985729.436827777055699361237 -> 5.098302376420396260404821158158E+968 Inexact Rounded -dvix3035 divideint -9890633.854609434943559831911276E+971 -1939985729.436827777055699361237 -> NaN Division_impossible -mulx3035 multiply -9890633.854609434943559831911276E+971 -1939985729.436827777055699361237 -> 1.918768853302706825964087702307E+987 Inexact Rounded -powx3035 power -9890633.854609434943559831911276E+971 -2 -> 1.022237362667592867768511487814E-1956 Inexact Rounded -remx3035 remainder -9890633.854609434943559831911276E+971 -1939985729.436827777055699361237 -> NaN Division_impossible -subx3035 subtract -9890633.854609434943559831911276E+971 -1939985729.436827777055699361237 -> -9.890633854609434943559831911276E+977 Inexact Rounded -addx3036 add 3944570323.331121750661920475191 -17360722.28878145641394962484366 -> 3927209601.042340294247970850347 Inexact Rounded -comx3036 compare 3944570323.331121750661920475191 -17360722.28878145641394962484366 -> 1 -divx3036 divide 3944570323.331121750661920475191 -17360722.28878145641394962484366 -> -227.2123393091837706827708196101 Inexact Rounded -dvix3036 divideint 3944570323.331121750661920475191 -17360722.28878145641394962484366 -> -227 -mulx3036 multiply 3944570323.331121750661920475191 -17360722.28878145641394962484366 -> -68480589931920481.56020043213767 Inexact Rounded -powx3036 power 3944570323.331121750661920475191 -17360722 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3036 remainder 3944570323.331121750661920475191 -17360722.28878145641394962484366 -> 3686363.77773114469535563568018 -subx3036 subtract 3944570323.331121750661920475191 -17360722.28878145641394962484366 -> 3961931045.619903207075870100035 Inexact Rounded -addx3037 add 19544.14018503427029002552872707 1786697762.885178994182133839546 -> 1786717307.025364028452423865075 Inexact Rounded -comx3037 compare 19544.14018503427029002552872707 1786697762.885178994182133839546 -> -1 -divx3037 divide 19544.14018503427029002552872707 1786697762.885178994182133839546 -> 0.00001093869404832867759234359871991 Inexact Rounded -dvix3037 divideint 19544.14018503427029002552872707 1786697762.885178994182133839546 -> 0 -mulx3037 multiply 19544.14018503427029002552872707 1786697762.885178994182133839546 -> 34919471546115.05897163496162290 Inexact Rounded -powx3037 power 19544.14018503427029002552872707 2 -> 381973415.5722714009298802557940 Inexact Rounded -remx3037 remainder 19544.14018503427029002552872707 1786697762.885178994182133839546 -> 19544.14018503427029002552872707 -subx3037 subtract 19544.14018503427029002552872707 1786697762.885178994182133839546 -> -1786678218.744993959911843814017 Inexact Rounded -addx3038 add -05.75485957937617757983513662981 5564476875.989640431173694372083 -> 5564476870.234780851797516792248 Inexact Rounded -comx3038 compare -05.75485957937617757983513662981 5564476875.989640431173694372083 -> -1 -divx3038 divide -05.75485957937617757983513662981 5564476875.989640431173694372083 -> -1.034213944568271324841608825136E-9 Inexact Rounded -dvix3038 divideint -05.75485957937617757983513662981 5564476875.989640431173694372083 -> -0 -mulx3038 multiply -05.75485957937617757983513662981 5564476875.989640431173694372083 -> -32022783054.00620878436398990135 Inexact Rounded -powx3038 power -05.75485957937617757983513662981 6 -> 36325.23118223611421303238908472 Inexact Rounded -remx3038 remainder -05.75485957937617757983513662981 5564476875.989640431173694372083 -> -5.75485957937617757983513662981 -subx3038 subtract -05.75485957937617757983513662981 5564476875.989640431173694372083 -> -5564476881.744500010549871951918 Inexact Rounded -addx3039 add -4208820.898718069194008526302746 626887.7553774705678201112845462E+206 -> 6.268877553774705678201112845462E+211 Inexact Rounded -comx3039 compare -4208820.898718069194008526302746 626887.7553774705678201112845462E+206 -> -1 -divx3039 divide -4208820.898718069194008526302746 626887.7553774705678201112845462E+206 -> -6.713834913211527184907421856434E-206 Inexact Rounded -dvix3039 divideint -4208820.898718069194008526302746 626887.7553774705678201112845462E+206 -> -0 -mulx3039 multiply -4208820.898718069194008526302746 626887.7553774705678201112845462E+206 -> -2.638458285983158789458925170267E+218 Inexact Rounded -powx3039 power -4208820.898718069194008526302746 6 -> 5.558564783291260359142223337994E+39 Inexact Rounded -remx3039 remainder -4208820.898718069194008526302746 626887.7553774705678201112845462E+206 -> -4208820.898718069194008526302746 -subx3039 subtract -4208820.898718069194008526302746 626887.7553774705678201112845462E+206 -> -6.268877553774705678201112845462E+211 Inexact Rounded -addx3040 add -70077195478066.30896979085821269E+549 4607.163248554155483681430013073 -> -7.007719547806630896979085821269E+562 Inexact Rounded -comx3040 compare -70077195478066.30896979085821269E+549 4607.163248554155483681430013073 -> -1 -divx3040 divide -70077195478066.30896979085821269E+549 4607.163248554155483681430013073 -> -1.521048673498997627360230078306E+559 Inexact Rounded -dvix3040 divideint -70077195478066.30896979085821269E+549 4607.163248554155483681430013073 -> NaN Division_impossible -mulx3040 multiply -70077195478066.30896979085821269E+549 4607.163248554155483681430013073 -> -3.228570795682925509478191397878E+566 Inexact Rounded -powx3040 power -70077195478066.30896979085821269E+549 4607 -> -Infinity Overflow Inexact Rounded -remx3040 remainder -70077195478066.30896979085821269E+549 4607.163248554155483681430013073 -> NaN Division_impossible -subx3040 subtract -70077195478066.30896979085821269E+549 4607.163248554155483681430013073 -> -7.007719547806630896979085821269E+562 Inexact Rounded -addx3041 add -442941.7541811527940918244383454 -068126768.0563559819156379151016 -> -68569709.81053713470972973953995 Inexact Rounded -comx3041 compare -442941.7541811527940918244383454 -068126768.0563559819156379151016 -> 1 -divx3041 divide -442941.7541811527940918244383454 -068126768.0563559819156379151016 -> 0.006501728568934042143913111768557 Inexact Rounded -dvix3041 divideint -442941.7541811527940918244383454 -068126768.0563559819156379151016 -> 0 -mulx3041 multiply -442941.7541811527940918244383454 -068126768.0563559819156379151016 -> 30176190149574.84386395947593970 Inexact Rounded -powx3041 power -442941.7541811527940918244383454 -68126768 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3041 remainder -442941.7541811527940918244383454 -068126768.0563559819156379151016 -> -442941.7541811527940918244383454 -subx3041 subtract -442941.7541811527940918244383454 -068126768.0563559819156379151016 -> 67683826.30217482912154609066325 Inexact Rounded -addx3042 add -040726778711.8677615616711676159 299691.9430345259174614997064916 -> -40726479019.92472703575370611619 Inexact Rounded -comx3042 compare -040726778711.8677615616711676159 299691.9430345259174614997064916 -> -1 -divx3042 divide -040726778711.8677615616711676159 299691.9430345259174614997064916 -> -135895.4741975690872548233111888 Inexact Rounded -dvix3042 divideint -040726778711.8677615616711676159 299691.9430345259174614997064916 -> -135895 -mulx3042 multiply -040726778711.8677615616711676159 299691.9430345259174614997064916 -> -12205487445696816.02175665622242 Inexact Rounded -powx3042 power -040726778711.8677615616711676159 299692 -> Infinity Overflow Inexact Rounded -remx3042 remainder -040726778711.8677615616711676159 299691.9430345259174614997064916 -> -142113.1908620082406650022240180 -subx3042 subtract -040726778711.8677615616711676159 299691.9430345259174614997064916 -> -40727078403.81079608758862911561 Inexact Rounded -addx3043 add -1934197520.738366912179143085955 3.810751422515178400293693371519 -> -1934197516.927615489663964685661 Inexact Rounded -comx3043 compare -1934197520.738366912179143085955 3.810751422515178400293693371519 -> -1 -divx3043 divide -1934197520.738366912179143085955 3.810751422515178400293693371519 -> -507563287.7312566071537233697473 Inexact Rounded -dvix3043 divideint -1934197520.738366912179143085955 3.810751422515178400293693371519 -> -507563287 -mulx3043 multiply -1934197520.738366912179143085955 3.810751422515178400293693371519 -> -7370745953.579062985130438309023 Inexact Rounded -powx3043 power -1934197520.738366912179143085955 4 -> 1.399597922275400947497855539475E+37 Inexact Rounded -remx3043 remainder -1934197520.738366912179143085955 3.810751422515178400293693371519 -> -2.786637155934674312936704177047 -subx3043 subtract -1934197520.738366912179143085955 3.810751422515178400293693371519 -> -1934197524.549118334694321486249 Inexact Rounded -addx3044 add 813262.7723533833038829559646830 -303284822716.8282178131118185907 -> -303284009454.0558644298079356347 Inexact Rounded -comx3044 compare 813262.7723533833038829559646830 -303284822716.8282178131118185907 -> 1 -divx3044 divide 813262.7723533833038829559646830 -303284822716.8282178131118185907 -> -0.000002681514904267770294213381485108 Inexact Rounded -dvix3044 divideint 813262.7723533833038829559646830 -303284822716.8282178131118185907 -> -0 -mulx3044 multiply 813262.7723533833038829559646830 -303284822716.8282178131118185907 -> -246650255735392080.1357404280431 Inexact Rounded -powx3044 power 813262.7723533833038829559646830 -3 -> 1.859119568310997605545914895133E-18 Inexact Rounded -remx3044 remainder 813262.7723533833038829559646830 -303284822716.8282178131118185907 -> 813262.7723533833038829559646830 -subx3044 subtract 813262.7723533833038829559646830 -303284822716.8282178131118185907 -> 303285635979.6005711964157015467 Inexact Rounded -addx3045 add 36105954884.94621434979365589311 745558205.7692397481313005659523E-952 -> 36105954884.94621434979365589311 Inexact Rounded -comx3045 compare 36105954884.94621434979365589311 745558205.7692397481313005659523E-952 -> 1 -divx3045 divide 36105954884.94621434979365589311 745558205.7692397481313005659523E-952 -> 4.842808328786805821411674302686E+953 Inexact Rounded -dvix3045 divideint 36105954884.94621434979365589311 745558205.7692397481313005659523E-952 -> NaN Division_impossible -mulx3045 multiply 36105954884.94621434979365589311 745558205.7692397481313005659523E-952 -> 2.691909094160561673391352743869E-933 Inexact Rounded -powx3045 power 36105954884.94621434979365589311 7 -> 7.999297449713301719582732447386E+73 Inexact Rounded -remx3045 remainder 36105954884.94621434979365589311 745558205.7692397481313005659523E-952 -> NaN Division_impossible -subx3045 subtract 36105954884.94621434979365589311 745558205.7692397481313005659523E-952 -> 36105954884.94621434979365589311 Inexact Rounded -addx3046 add -075537177538.1814516621962185490 26980775255.51542856483122484898 -> -48556402282.66602309736499370002 -comx3046 compare -075537177538.1814516621962185490 26980775255.51542856483122484898 -> -1 -divx3046 divide -075537177538.1814516621962185490 26980775255.51542856483122484898 -> -2.799666682029089956269018541649 Inexact Rounded -dvix3046 divideint -075537177538.1814516621962185490 26980775255.51542856483122484898 -> -2 -mulx3046 multiply -075537177538.1814516621962185490 26980775255.51542856483122484898 -> -2038051610593641947717.268652175 Inexact Rounded -powx3046 power -075537177538.1814516621962185490 3 -> -4.310049518987988084595264617727E+32 Inexact Rounded -remx3046 remainder -075537177538.1814516621962185490 26980775255.51542856483122484898 -> -21575627027.15059453253376885104 -subx3046 subtract -075537177538.1814516621962185490 26980775255.51542856483122484898 -> -102517952793.6968802270274433980 Inexact Rounded -addx3047 add -4223765.415319564898840040697647 -2590590305497454185455459149918E-215 -> -4223765.415319564898840040697647 Inexact Rounded -comx3047 compare -4223765.415319564898840040697647 -2590590305497454185455459149918E-215 -> -1 -divx3047 divide -4223765.415319564898840040697647 -2590590305497454185455459149918E-215 -> 1.630425855588347356570076909053E+191 Inexact Rounded -dvix3047 divideint -4223765.415319564898840040697647 -2590590305497454185455459149918E-215 -> NaN Division_impossible -mulx3047 multiply -4223765.415319564898840040697647 -2590590305497454185455459149918E-215 -> 1.094204573762229308798604845395E-178 Inexact Rounded -powx3047 power -4223765.415319564898840040697647 -3 -> -1.327090775863616939309569791138E-20 Inexact Rounded -remx3047 remainder -4223765.415319564898840040697647 -2590590305497454185455459149918E-215 -> NaN Division_impossible -subx3047 subtract -4223765.415319564898840040697647 -2590590305497454185455459149918E-215 -> -4223765.415319564898840040697647 Inexact Rounded -addx3048 add -6468.903738522951259063099946195 -7877.324314273694312164407794939E+267 -> -7.877324314273694312164407794939E+270 Inexact Rounded -comx3048 compare -6468.903738522951259063099946195 -7877.324314273694312164407794939E+267 -> 1 -divx3048 divide -6468.903738522951259063099946195 -7877.324314273694312164407794939E+267 -> 8.212057140774706874666307246628E-268 Inexact Rounded -dvix3048 divideint -6468.903738522951259063099946195 -7877.324314273694312164407794939E+267 -> 0 -mulx3048 multiply -6468.903738522951259063099946195 -7877.324314273694312164407794939E+267 -> 5.095765270616284455922747530676E+274 Inexact Rounded -powx3048 power -6468.903738522951259063099946195 -8 -> 3.261027724982089298030362367616E-31 Inexact Rounded -remx3048 remainder -6468.903738522951259063099946195 -7877.324314273694312164407794939E+267 -> -6468.903738522951259063099946195 -subx3048 subtract -6468.903738522951259063099946195 -7877.324314273694312164407794939E+267 -> 7.877324314273694312164407794939E+270 Inexact Rounded -addx3049 add -9567221.183663236817239254783372E-203 1650.198961256061165362319471264 -> 1650.198961256061165362319471264 Inexact Rounded -comx3049 compare -9567221.183663236817239254783372E-203 1650.198961256061165362319471264 -> -1 -divx3049 divide -9567221.183663236817239254783372E-203 1650.198961256061165362319471264 -> -5.797616777301250711985729776957E-200 Inexact Rounded -dvix3049 divideint -9567221.183663236817239254783372E-203 1650.198961256061165362319471264 -> -0 -mulx3049 multiply -9567221.183663236817239254783372E-203 1650.198961256061165362319471264 -> -1.578781845938805737527304303976E-193 Inexact Rounded -powx3049 power -9567221.183663236817239254783372E-203 1650 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3049 remainder -9567221.183663236817239254783372E-203 1650.198961256061165362319471264 -> -9.567221183663236817239254783372E-197 -subx3049 subtract -9567221.183663236817239254783372E-203 1650.198961256061165362319471264 -> -1650.198961256061165362319471264 Inexact Rounded -addx3050 add 8812306098770.200752139142033569E-428 26790.17380163975186972720427030E+568 -> 2.679017380163975186972720427030E+572 Inexact Rounded -comx3050 compare 8812306098770.200752139142033569E-428 26790.17380163975186972720427030E+568 -> -1 -divx3050 divide 8812306098770.200752139142033569E-428 26790.17380163975186972720427030E+568 -> 3.289379965960065573444140749635E-988 Inexact Rounded -dvix3050 divideint 8812306098770.200752139142033569E-428 26790.17380163975186972720427030E+568 -> 0 -mulx3050 multiply 8812306098770.200752139142033569E-428 26790.17380163975186972720427030E+568 -> 2.360832119793036398127652187732E+157 Inexact Rounded -powx3050 power 8812306098770.200752139142033569E-428 3 -> 6.843349527476967274129043949969E-1246 Inexact Rounded -remx3050 remainder 8812306098770.200752139142033569E-428 26790.17380163975186972720427030E+568 -> 8.812306098770200752139142033569E-416 -subx3050 subtract 8812306098770.200752139142033569E-428 26790.17380163975186972720427030E+568 -> -2.679017380163975186972720427030E+572 Inexact Rounded -addx3051 add 80108033.12724838718736922500904 -706207255092.7645192310078892869 -> -706127147059.6372708438205200619 Inexact Rounded -comx3051 compare 80108033.12724838718736922500904 -706207255092.7645192310078892869 -> 1 -divx3051 divide 80108033.12724838718736922500904 -706207255092.7645192310078892869 -> -0.0001134341690057060105325397863996 Inexact Rounded -dvix3051 divideint 80108033.12724838718736922500904 -706207255092.7645192310078892869 -> -0 -mulx3051 multiply 80108033.12724838718736922500904 -706207255092.7645192310078892869 -> -56572874185674332398.36004114372 Inexact Rounded -powx3051 power 80108033.12724838718736922500904 -7 -> 4.723539145042336483008674060324E-56 Inexact Rounded -remx3051 remainder 80108033.12724838718736922500904 -706207255092.7645192310078892869 -> 80108033.12724838718736922500904 -subx3051 subtract 80108033.12724838718736922500904 -706207255092.7645192310078892869 -> 706287363125.8917676181952585119 Inexact Rounded -addx3052 add -37942846282.76101663789059003505 -5.649456053942850351313869983197 -> -37942846288.41047269183344038636 Inexact Rounded -comx3052 compare -37942846282.76101663789059003505 -5.649456053942850351313869983197 -> -1 -divx3052 divide -37942846282.76101663789059003505 -5.649456053942850351313869983197 -> 6716194607.139224735032566328960 Inexact Rounded -dvix3052 divideint -37942846282.76101663789059003505 -5.649456053942850351313869983197 -> 6716194607 -mulx3052 multiply -37942846282.76101663789059003505 -5.649456053942850351313869983197 -> 214356442635.9672009449140933366 Inexact Rounded -powx3052 power -37942846282.76101663789059003505 -6 -> 3.351355986382646046773008753885E-64 Inexact Rounded -remx3052 remainder -37942846282.76101663789059003505 -5.649456053942850351313869983197 -> -0.786544022188321089603127981421 -subx3052 subtract -37942846282.76101663789059003505 -5.649456053942850351313869983197 -> -37942846277.11156058394773968374 Inexact Rounded -addx3053 add 92659632115305.13735437728445541 6483438.317862851676468094261410E-139 -> 92659632115305.13735437728445541 Inexact Rounded -comx3053 compare 92659632115305.13735437728445541 6483438.317862851676468094261410E-139 -> 1 -divx3053 divide 92659632115305.13735437728445541 6483438.317862851676468094261410E-139 -> 1.429174267919135710410529211791E+146 Inexact Rounded -dvix3053 divideint 92659632115305.13735437728445541 6483438.317862851676468094261410E-139 -> NaN Division_impossible -mulx3053 multiply 92659632115305.13735437728445541 6483438.317862851676468094261410E-139 -> 6.007530093754446085819255987878E-119 Inexact Rounded -powx3053 power 92659632115305.13735437728445541 6 -> 6.329121451953461546696051563323E+83 Inexact Rounded -remx3053 remainder 92659632115305.13735437728445541 6483438.317862851676468094261410E-139 -> NaN Division_impossible -subx3053 subtract 92659632115305.13735437728445541 6483438.317862851676468094261410E-139 -> 92659632115305.13735437728445541 Inexact Rounded -addx3054 add 2838948.589837595494152150647194 569547026247.5469563701415715960 -> 569549865196.1367939656357237466 Inexact Rounded -comx3054 compare 2838948.589837595494152150647194 569547026247.5469563701415715960 -> -1 -divx3054 divide 2838948.589837595494152150647194 569547026247.5469563701415715960 -> 0.000004984572755198057481907281080406 Inexact Rounded -dvix3054 divideint 2838948.589837595494152150647194 569547026247.5469563701415715960 -> 0 -mulx3054 multiply 2838948.589837595494152150647194 569547026247.5469563701415715960 -> 1616914727011669419.390959984273 Inexact Rounded -powx3054 power 2838948.589837595494152150647194 6 -> 5.235343334986059753096884080673E+38 Inexact Rounded -remx3054 remainder 2838948.589837595494152150647194 569547026247.5469563701415715960 -> 2838948.589837595494152150647194 -subx3054 subtract 2838948.589837595494152150647194 569547026247.5469563701415715960 -> -569544187298.9571187746474194454 Inexact Rounded -addx3055 add 524995204523.6053307941775794287E+694 1589600879689517100527293028553 -> 5.249952045236053307941775794287E+705 Inexact Rounded -comx3055 compare 524995204523.6053307941775794287E+694 1589600879689517100527293028553 -> 1 -divx3055 divide 524995204523.6053307941775794287E+694 1589600879689517100527293028553 -> 3.302685669286670708554753139233E+675 Inexact Rounded -dvix3055 divideint 524995204523.6053307941775794287E+694 1589600879689517100527293028553 -> NaN Division_impossible -mulx3055 multiply 524995204523.6053307941775794287E+694 1589600879689517100527293028553 -> 8.345328389435009812933599889447E+735 Inexact Rounded -powx3055 power 524995204523.6053307941775794287E+694 2 -> 2.756199647727821911857160230849E+1411 Inexact Rounded -remx3055 remainder 524995204523.6053307941775794287E+694 1589600879689517100527293028553 -> NaN Division_impossible -subx3055 subtract 524995204523.6053307941775794287E+694 1589600879689517100527293028553 -> 5.249952045236053307941775794287E+705 Inexact Rounded -addx3056 add -57131573677452.15449921725097290 4669681430736.326858508715643769 -> -52461892246715.82764070853532913 Inexact Rounded -comx3056 compare -57131573677452.15449921725097290 4669681430736.326858508715643769 -> -1 -divx3056 divide -57131573677452.15449921725097290 4669681430736.326858508715643769 -> -12.23457628210057733643575143694 Inexact Rounded -dvix3056 divideint -57131573677452.15449921725097290 4669681430736.326858508715643769 -> -12 -mulx3056 multiply -57131573677452.15449921725097290 4669681430736.326858508715643769 -> -266786248710342647746063322.0544 Inexact Rounded -powx3056 power -57131573677452.15449921725097290 5 -> -6.086686503752679375430019503679E+68 Inexact Rounded -remx3056 remainder -57131573677452.15449921725097290 4669681430736.326858508715643769 -> -1095396508616.232197112663247672 -subx3056 subtract -57131573677452.15449921725097290 4669681430736.326858508715643769 -> -61801255108188.48135772596661667 Inexact Rounded -addx3057 add 90794826.55528018781830463383411 -5.471502270351231110027647216128 -> 90794821.08377791746707352380646 Inexact Rounded -comx3057 compare 90794826.55528018781830463383411 -5.471502270351231110027647216128 -> 1 -divx3057 divide 90794826.55528018781830463383411 -5.471502270351231110027647216128 -> -16594131.20365054928428313232246 Inexact Rounded -dvix3057 divideint 90794826.55528018781830463383411 -5.471502270351231110027647216128 -> -16594131 -mulx3057 multiply 90794826.55528018781830463383411 -5.471502270351231110027647216128 -> -496784099.6333617958496589124964 Inexact Rounded -powx3057 power 90794826.55528018781830463383411 -5 -> 1.620669590532856523565742953997E-40 Inexact Rounded -remx3057 remainder 90794826.55528018781830463383411 -5.471502270351231110027647216128 -> 1.114274442767230442307896655232 -subx3057 subtract 90794826.55528018781830463383411 -5.471502270351231110027647216128 -> 90794832.02678245816953574386176 Inexact Rounded -addx3058 add 58508794729.35191160840980489138 -47060867.24988279680824397447551 -> 58461733862.10202881160156091690 Inexact Rounded -comx3058 compare 58508794729.35191160840980489138 -47060867.24988279680824397447551 -> 1 -divx3058 divide 58508794729.35191160840980489138 -47060867.24988279680824397447551 -> -1243.257894477021678809337875304 Inexact Rounded -dvix3058 divideint 58508794729.35191160840980489138 -47060867.24988279680824397447551 -> -1243 -mulx3058 multiply 58508794729.35191160840980489138 -47060867.24988279680824397447551 -> -2753474621708672573.249029643967 Inexact Rounded -powx3058 power 58508794729.35191160840980489138 -47060867 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3058 remainder 58508794729.35191160840980489138 -47060867.24988279680824397447551 -> 12136737.74759517576254461832107 -subx3058 subtract 58508794729.35191160840980489138 -47060867.24988279680824397447551 -> 58555855596.60179440521804886586 Inexact Rounded -addx3059 add -746104.0768078474426464219416332E+006 9595418.300613754556671852801667E+385 -> 9.595418300613754556671852801667E+391 Inexact Rounded -comx3059 compare -746104.0768078474426464219416332E+006 9595418.300613754556671852801667E+385 -> -1 -divx3059 divide -746104.0768078474426464219416332E+006 9595418.300613754556671852801667E+385 -> -7.775628465932789700547872511745E-381 Inexact Rounded -dvix3059 divideint -746104.0768078474426464219416332E+006 9595418.300613754556671852801667E+385 -> -0 -mulx3059 multiply -746104.0768078474426464219416332E+006 9595418.300613754556671852801667E+385 -> -7.159180712764549711669939947084E+403 Inexact Rounded -powx3059 power -746104.0768078474426464219416332E+006 10 -> 5.345571346302582882805035996696E+118 Inexact Rounded -remx3059 remainder -746104.0768078474426464219416332E+006 9595418.300613754556671852801667E+385 -> -746104076807.8474426464219416332 -subx3059 subtract -746104.0768078474426464219416332E+006 9595418.300613754556671852801667E+385 -> -9.595418300613754556671852801667E+391 Inexact Rounded -addx3060 add 55.99427632688387400403789659459E+119 -9.170530450881612853998489340127 -> 5.599427632688387400403789659459E+120 Inexact Rounded -comx3060 compare 55.99427632688387400403789659459E+119 -9.170530450881612853998489340127 -> 1 -divx3060 divide 55.99427632688387400403789659459E+119 -9.170530450881612853998489340127 -> -6.105892851759828176655685111491E+119 Inexact Rounded -dvix3060 divideint 55.99427632688387400403789659459E+119 -9.170530450881612853998489340127 -> NaN Division_impossible -mulx3060 multiply 55.99427632688387400403789659459E+119 -9.170530450881612853998489340127 -> -5.134972161307679939281170944556E+121 Inexact Rounded -powx3060 power 55.99427632688387400403789659459E+119 -9 -> 1.848022584764384077672041056396E-1087 Inexact Rounded -remx3060 remainder 55.99427632688387400403789659459E+119 -9.170530450881612853998489340127 -> NaN Division_impossible -subx3060 subtract 55.99427632688387400403789659459E+119 -9.170530450881612853998489340127 -> 5.599427632688387400403789659459E+120 Inexact Rounded -addx3061 add -41214265628.83801241467317270595 1015336323798389903361978271354 -> 1015336323798389903320764005725 Inexact Rounded -comx3061 compare -41214265628.83801241467317270595 1015336323798389903361978271354 -> -1 -divx3061 divide -41214265628.83801241467317270595 1015336323798389903361978271354 -> -4.059173759750342247620706384027E-20 Inexact Rounded -dvix3061 divideint -41214265628.83801241467317270595 1015336323798389903361978271354 -> -0 -mulx3061 multiply -41214265628.83801241467317270595 1015336323798389903361978271354 -> -4.184634095163472384028549378392E+40 Inexact Rounded -powx3061 power -41214265628.83801241467317270595 1 -> -41214265628.83801241467317270595 -remx3061 remainder -41214265628.83801241467317270595 1015336323798389903361978271354 -> -41214265628.83801241467317270595 -subx3061 subtract -41214265628.83801241467317270595 1015336323798389903361978271354 -> -1015336323798389903403192536983 Inexact Rounded -addx3062 add 89937.39749201095570357557430822 82351554210093.60879476027800331 -> 82351554300031.00628677123370689 Inexact Rounded -comx3062 compare 89937.39749201095570357557430822 82351554210093.60879476027800331 -> -1 -divx3062 divide 89937.39749201095570357557430822 82351554210093.60879476027800331 -> 1.092115362662913415592930982129E-9 Inexact Rounded -dvix3062 divideint 89937.39749201095570357557430822 82351554210093.60879476027800331 -> 0 -mulx3062 multiply 89937.39749201095570357557430822 82351554210093.60879476027800331 -> 7406484465078077191.920015793662 Inexact Rounded -powx3062 power 89937.39749201095570357557430822 8 -> 4.280776267723913043050100934291E+39 Inexact Rounded -remx3062 remainder 89937.39749201095570357557430822 82351554210093.60879476027800331 -> 89937.39749201095570357557430822 -subx3062 subtract 89937.39749201095570357557430822 82351554210093.60879476027800331 -> -82351554120156.21130274932229973 Inexact Rounded -addx3063 add 01712661.64677082156284125486943E+359 57932.78435529483241552042115837E-037 -> 1.712661646770821562841254869430E+365 Inexact Rounded -comx3063 compare 01712661.64677082156284125486943E+359 57932.78435529483241552042115837E-037 -> 1 -divx3063 divide 01712661.64677082156284125486943E+359 57932.78435529483241552042115837E-037 -> 2.956290925475414185960999788848E+397 Inexact Rounded -dvix3063 divideint 01712661.64677082156284125486943E+359 57932.78435529483241552042115837E-037 -> NaN Division_impossible -mulx3063 multiply 01712661.64677082156284125486943E+359 57932.78435529483241552042115837E-037 -> 9.921925785595813587655312307930E+332 Inexact Rounded -powx3063 power 01712661.64677082156284125486943E+359 6 -> 2.523651803323047711735501944959E+2191 Inexact Rounded -remx3063 remainder 01712661.64677082156284125486943E+359 57932.78435529483241552042115837E-037 -> NaN Division_impossible -subx3063 subtract 01712661.64677082156284125486943E+359 57932.78435529483241552042115837E-037 -> 1.712661646770821562841254869430E+365 Inexact Rounded -addx3064 add -2647593306.528617691373470059213 -655531558709.4582168930191014461 -> -658179152015.9868345843925715053 Inexact Rounded -comx3064 compare -2647593306.528617691373470059213 -655531558709.4582168930191014461 -> 1 -divx3064 divide -2647593306.528617691373470059213 -655531558709.4582168930191014461 -> 0.004038849497560303158639192895544 Inexact Rounded -dvix3064 divideint -2647593306.528617691373470059213 -655531558709.4582168930191014461 -> 0 -mulx3064 multiply -2647593306.528617691373470059213 -655531558709.4582168930191014461 -> 1735580967057433153120.099643641 Inexact Rounded -powx3064 power -2647593306.528617691373470059213 -7 -> -1.096581914005902583413810201571E-66 Inexact Rounded -remx3064 remainder -2647593306.528617691373470059213 -655531558709.4582168930191014461 -> -2647593306.528617691373470059213 -subx3064 subtract -2647593306.528617691373470059213 -655531558709.4582168930191014461 -> 652883965402.9295992016456313869 Inexact Rounded -addx3065 add 2904078690665765116603253099668E-329 -71.45586619176091599264717047885E+787 -> -7.145586619176091599264717047885E+788 Inexact Rounded -comx3065 compare 2904078690665765116603253099668E-329 -71.45586619176091599264717047885E+787 -> 1 -divx3065 divide 2904078690665765116603253099668E-329 -71.45586619176091599264717047885E+787 -> -4.064157144036712325084472022316E-1088 Inexact Rounded -dvix3065 divideint 2904078690665765116603253099668E-329 -71.45586619176091599264717047885E+787 -> -0 -mulx3065 multiply 2904078690665765116603253099668E-329 -71.45586619176091599264717047885E+787 -> -2.075134583305571527962710017262E+490 Inexact Rounded -powx3065 power 2904078690665765116603253099668E-329 -7 -> 5.740389208842895561250128407803E+2089 Inexact Rounded -remx3065 remainder 2904078690665765116603253099668E-329 -71.45586619176091599264717047885E+787 -> 2.904078690665765116603253099668E-299 -subx3065 subtract 2904078690665765116603253099668E-329 -71.45586619176091599264717047885E+787 -> 7.145586619176091599264717047885E+788 Inexact Rounded -addx3066 add 22094338972.39109726522477999515 -409846549371.3900805039668417203E-499 -> 22094338972.39109726522477999515 Inexact Rounded -comx3066 compare 22094338972.39109726522477999515 -409846549371.3900805039668417203E-499 -> 1 -divx3066 divide 22094338972.39109726522477999515 -409846549371.3900805039668417203E-499 -> -5.390880808019174194010224736965E+497 Inexact Rounded -dvix3066 divideint 22094338972.39109726522477999515 -409846549371.3900805039668417203E-499 -> NaN Division_impossible -mulx3066 multiply 22094338972.39109726522477999515 -409846549371.3900805039668417203E-499 -> -9.055288588476315822113975426730E-478 Inexact Rounded -powx3066 power 22094338972.39109726522477999515 -4 -> 4.196391022354122686725315209967E-42 Inexact Rounded -remx3066 remainder 22094338972.39109726522477999515 -409846549371.3900805039668417203E-499 -> NaN Division_impossible -subx3066 subtract 22094338972.39109726522477999515 -409846549371.3900805039668417203E-499 -> 22094338972.39109726522477999515 Inexact Rounded -addx3067 add -3374988581607586061255542201048 82293895124.90045271504836568681 -> -3374988581607586061173248305923 Inexact Rounded -comx3067 compare -3374988581607586061255542201048 82293895124.90045271504836568681 -> -1 -divx3067 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81310977038 Inexact Rounded -dvix3067 divideint -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797 -mulx3067 multiply -3374988581607586061255542201048 82293895124.90045271504836568681 -> -2.777409563825512202793336132310E+41 Inexact Rounded -powx3067 power -3374988581607586061255542201048 8 -> 1.683365657238878057620634207267E+244 Inexact Rounded -remx3067 remainder -3374988581607586061255542201048 82293895124.90045271504836568681 -> -66913970168.62046257175566384243 -subx3067 subtract -3374988581607586061255542201048 82293895124.90045271504836568681 -> -3374988581607586061337836096173 Inexact Rounded -addx3068 add -84172558160661.35863831029352323 -11271.58916600931155937291904890 -> -84172558171932.94780431960508260 Inexact Rounded -comx3068 compare -84172558160661.35863831029352323 -11271.58916600931155937291904890 -> -1 -divx3068 divide -84172558160661.35863831029352323 -11271.58916600931155937291904890 -> 7467674426.467986736459678347587 Inexact Rounded -dvix3068 divideint -84172558160661.35863831029352323 -11271.58916600931155937291904890 -> 7467674426 -mulx3068 multiply -84172558160661.35863831029352323 -11271.58916600931155937291904890 -> 948758494638999235.1953022970755 Inexact Rounded -powx3068 power -84172558160661.35863831029352323 -11272 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3068 remainder -84172558160661.35863831029352323 -11271.58916600931155937291904890 -> -5274.95422851496534479122656860 -subx3068 subtract -84172558160661.35863831029352323 -11271.58916600931155937291904890 -> -84172558149389.76947230098196386 Inexact Rounded -addx3069 add -70046932324614.90596396237508541E-568 33.63163964004608865836577297698E-918 -> -7.004693232461490596396237508541E-555 Inexact Rounded -comx3069 compare -70046932324614.90596396237508541E-568 33.63163964004608865836577297698E-918 -> -1 -divx3069 divide -70046932324614.90596396237508541E-568 33.63163964004608865836577297698E-918 -> -2.082768876995463487926920072359E+362 Inexact Rounded -dvix3069 divideint -70046932324614.90596396237508541E-568 33.63163964004608865836577297698E-918 -> NaN Division_impossible -mulx3069 multiply -70046932324614.90596396237508541E-568 33.63163964004608865836577297698E-918 -> -2.355793185832144388285949021738E-1471 Inexact Rounded -powx3069 power -70046932324614.90596396237508541E-568 3 -> -3.436903678302639677280508409829E-1663 Inexact Rounded -remx3069 remainder -70046932324614.90596396237508541E-568 33.63163964004608865836577297698E-918 -> NaN Division_impossible -subx3069 subtract -70046932324614.90596396237508541E-568 33.63163964004608865836577297698E-918 -> -7.004693232461490596396237508541E-555 Inexact Rounded -addx3070 add 0004125384407.053782660115680886 -391429084.5847321402514385603223E-648 -> 4125384407.053782660115680886000 Inexact Rounded -comx3070 compare 0004125384407.053782660115680886 -391429084.5847321402514385603223E-648 -> 1 -divx3070 divide 0004125384407.053782660115680886 -391429084.5847321402514385603223E-648 -> -1.053928941287132717250540955457E+649 Inexact Rounded -dvix3070 divideint 0004125384407.053782660115680886 -391429084.5847321402514385603223E-648 -> NaN Division_impossible -mulx3070 multiply 0004125384407.053782660115680886 -391429084.5847321402514385603223E-648 -> -1.614795442013190139080634449273E-630 Inexact Rounded -powx3070 power 0004125384407.053782660115680886 -4 -> 3.452568541597450106266555783362E-39 Inexact Rounded -remx3070 remainder 0004125384407.053782660115680886 -391429084.5847321402514385603223E-648 -> NaN Division_impossible -subx3070 subtract 0004125384407.053782660115680886 -391429084.5847321402514385603223E-648 -> 4125384407.053782660115680886000 Inexact Rounded -addx3071 add -31823131.15691583393820628480997E-440 92913.91582947237200286427030028E+771 -> 9.291391582947237200286427030028E+775 Inexact Rounded -comx3071 compare -31823131.15691583393820628480997E-440 92913.91582947237200286427030028E+771 -> -1 -divx3071 divide -31823131.15691583393820628480997E-440 92913.91582947237200286427030028E+771 -> -3.425012375468251447194400841658E-1209 Inexact Rounded -dvix3071 divideint -31823131.15691583393820628480997E-440 92913.91582947237200286427030028E+771 -> -0 -mulx3071 multiply -31823131.15691583393820628480997E-440 92913.91582947237200286427030028E+771 -> -2.956811729743937541973845029816E+343 Inexact Rounded -powx3071 power -31823131.15691583393820628480997E-440 9 -> -3.347234803487575870321338308655E-3893 Inexact Rounded -remx3071 remainder -31823131.15691583393820628480997E-440 92913.91582947237200286427030028E+771 -> -3.182313115691583393820628480997E-433 -subx3071 subtract -31823131.15691583393820628480997E-440 92913.91582947237200286427030028E+771 -> -9.291391582947237200286427030028E+775 Inexact Rounded -addx3072 add 55573867888.91575330563698128150 599.5231614736232188354393212234 -> 55573868488.43891477926020011694 Inexact Rounded -comx3072 compare 55573867888.91575330563698128150 599.5231614736232188354393212234 -> 1 -divx3072 divide 55573867888.91575330563698128150 599.5231614736232188354393212234 -> 92696782.14318796763098335498657 Inexact Rounded -dvix3072 divideint 55573867888.91575330563698128150 599.5231614736232188354393212234 -> 92696782 -mulx3072 multiply 55573867888.91575330563698128150 599.5231614736232188354393212234 -> 33317820972080.24347717542221477 Inexact Rounded -powx3072 power 55573867888.91575330563698128150 600 -> 8.363240671070136278221965616973E+6446 Inexact Rounded -remx3072 remainder 55573867888.91575330563698128150 599.5231614736232188354393212234 -> 85.8445030391099686478265169012 -subx3072 subtract 55573867888.91575330563698128150 599.5231614736232188354393212234 -> 55573867289.39259183201376244606 Inexact Rounded -addx3073 add -5447727448431680878699555714796E-800 5487207.142687001607026665515349E-362 -> 5.487207142687001607026665515349E-356 Inexact Rounded -comx3073 compare -5447727448431680878699555714796E-800 5487207.142687001607026665515349E-362 -> -1 -divx3073 divide -5447727448431680878699555714796E-800 5487207.142687001607026665515349E-362 -> -9.928051387110587327889009363069E-415 Inexact Rounded -dvix3073 divideint -5447727448431680878699555714796E-800 5487207.142687001607026665515349E-362 -> -0 -mulx3073 multiply -5447727448431680878699555714796E-800 5487207.142687001607026665515349E-362 -> -2.989280896644635352838087864373E-1125 Inexact Rounded -powx3073 power -5447727448431680878699555714796E-800 5 -> -4.798183553278543065204833300725E-3847 Inexact Rounded -remx3073 remainder -5447727448431680878699555714796E-800 5487207.142687001607026665515349E-362 -> -5.447727448431680878699555714796E-770 -subx3073 subtract -5447727448431680878699555714796E-800 5487207.142687001607026665515349E-362 -> -5.487207142687001607026665515349E-356 Inexact Rounded -addx3074 add 0418349404834.547110239542290134 09819915.92405288066606124554841 -> 418359224750.4711631202083513795 Inexact Rounded -comx3074 compare 0418349404834.547110239542290134 09819915.92405288066606124554841 -> 1 -divx3074 divide 0418349404834.547110239542290134 09819915.92405288066606124554841 -> 42602.13713335803513874339309132 Inexact Rounded -dvix3074 divideint 0418349404834.547110239542290134 09819915.92405288066606124554841 -> 42602 -mulx3074 multiply 0418349404834.547110239542290134 09819915.92405288066606124554841 -> 4108155982352814348.343441299082 Inexact Rounded -powx3074 power 0418349404834.547110239542290134 9819916 -> Infinity Overflow Inexact Rounded -remx3074 remainder 0418349404834.547110239542290134 09819915.92405288066606124554841 -> 1346638.04628810400110728063718 -subx3074 subtract 0418349404834.547110239542290134 09819915.92405288066606124554841 -> 418339584918.6230573588762288885 Inexact Rounded -addx3075 add -262021.7565194737396448014286436 -7983992600094836304387324162042E+390 -> -7.983992600094836304387324162042E+420 Inexact Rounded -comx3075 compare -262021.7565194737396448014286436 -7983992600094836304387324162042E+390 -> 1 -divx3075 divide -262021.7565194737396448014286436 -7983992600094836304387324162042E+390 -> 3.281838669494274896180376328433E-416 Inexact Rounded -dvix3075 divideint -262021.7565194737396448014286436 -7983992600094836304387324162042E+390 -> 0 -mulx3075 multiply -262021.7565194737396448014286436 -7983992600094836304387324162042E+390 -> 2.091979765115329268275803385534E+426 Inexact Rounded -powx3075 power -262021.7565194737396448014286436 -8 -> 4.500918721033033032706782304195E-44 Inexact Rounded -remx3075 remainder -262021.7565194737396448014286436 -7983992600094836304387324162042E+390 -> -262021.7565194737396448014286436 -subx3075 subtract -262021.7565194737396448014286436 -7983992600094836304387324162042E+390 -> 7.983992600094836304387324162042E+420 Inexact Rounded -addx3076 add 48696050631.42565380301204592392E-505 -33868752339.85057267609967806187E+821 -> -3.386875233985057267609967806187E+831 Inexact Rounded -comx3076 compare 48696050631.42565380301204592392E-505 -33868752339.85057267609967806187E+821 -> 1 -divx3076 divide 48696050631.42565380301204592392E-505 -33868752339.85057267609967806187E+821 -> -1.437786964892976582009952172420E-1326 Inexact Rounded -dvix3076 divideint 48696050631.42565380301204592392E-505 -33868752339.85057267609967806187E+821 -> -0 -mulx3076 multiply 48696050631.42565380301204592392E-505 -33868752339.85057267609967806187E+821 -> -1.649274478764579569246425611629E+337 Inexact Rounded -powx3076 power 48696050631.42565380301204592392E-505 -3 -> 8.660017688773759463020340778853E+1482 Inexact Rounded -remx3076 remainder 48696050631.42565380301204592392E-505 -33868752339.85057267609967806187E+821 -> 4.869605063142565380301204592392E-495 -subx3076 subtract 48696050631.42565380301204592392E-505 -33868752339.85057267609967806187E+821 -> 3.386875233985057267609967806187E+831 Inexact Rounded -addx3077 add 95316999.19440144356471126680708 -60791.33805057402845885978390435 -> 95256207.85635086953625240702318 Inexact Rounded -comx3077 compare 95316999.19440144356471126680708 -60791.33805057402845885978390435 -> 1 -divx3077 divide 95316999.19440144356471126680708 -60791.33805057402845885978390435 -> -1567.937180706641856870286122623 Inexact Rounded -dvix3077 divideint 95316999.19440144356471126680708 -60791.33805057402845885978390435 -> -1567 -mulx3077 multiply 95316999.19440144356471126680708 -60791.33805057402845885978390435 -> -5794447919993.150493301061195714 Inexact Rounded -powx3077 power 95316999.19440144356471126680708 -60791 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3077 remainder 95316999.19440144356471126680708 -60791.33805057402845885978390435 -> 56972.46915194096967798542896355 -subx3077 subtract 95316999.19440144356471126680708 -60791.33805057402845885978390435 -> 95377790.53245201759317012659098 Inexact Rounded -addx3078 add -5326702296402708234722215224979E-136 8032459.450998820205916538543258 -> 8032459.450998820205916538543258 Inexact Rounded -comx3078 compare -5326702296402708234722215224979E-136 8032459.450998820205916538543258 -> -1 -divx3078 divide -5326702296402708234722215224979E-136 8032459.450998820205916538543258 -> -6.631471131473117487839243582873E-113 Inexact Rounded -dvix3078 divideint -5326702296402708234722215224979E-136 8032459.450998820205916538543258 -> -0 -mulx3078 multiply -5326702296402708234722215224979E-136 8032459.450998820205916538543258 -> -4.278652020339705265013632757349E-99 Inexact Rounded -powx3078 power -5326702296402708234722215224979E-136 8032459 -> -0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3078 remainder -5326702296402708234722215224979E-136 8032459.450998820205916538543258 -> -5.326702296402708234722215224979E-106 -subx3078 subtract -5326702296402708234722215224979E-136 8032459.450998820205916538543258 -> -8032459.450998820205916538543258 Inexact Rounded -addx3079 add 67.18750684079501575335482615780E-281 734.1168841683438410314843011541E-854 -> 6.718750684079501575335482615780E-280 Inexact Rounded -comx3079 compare 67.18750684079501575335482615780E-281 734.1168841683438410314843011541E-854 -> 1 -divx3079 divide 67.18750684079501575335482615780E-281 734.1168841683438410314843011541E-854 -> 9.152153872187460598958616592442E+571 Inexact Rounded -dvix3079 divideint 67.18750684079501575335482615780E-281 734.1168841683438410314843011541E-854 -> NaN Division_impossible -mulx3079 multiply 67.18750684079501575335482615780E-281 734.1168841683438410314843011541E-854 -> 4.932348317700372401849231767007E-1131 Inexact Rounded -powx3079 power 67.18750684079501575335482615780E-281 7 -> 6.180444071023111300817518409550E-1955 Inexact Rounded -remx3079 remainder 67.18750684079501575335482615780E-281 734.1168841683438410314843011541E-854 -> NaN Division_impossible -subx3079 subtract 67.18750684079501575335482615780E-281 734.1168841683438410314843011541E-854 -> 6.718750684079501575335482615780E-280 Inexact Rounded -addx3080 add -8739299372114.092482914139281669 507610074.7343577029345077385838 -> -8738791762039.358125211204773930 Inexact Rounded -comx3080 compare -8739299372114.092482914139281669 507610074.7343577029345077385838 -> -1 -divx3080 divide -8739299372114.092482914139281669 507610074.7343577029345077385838 -> -17216.56012577673731612130068130 Inexact Rounded -dvix3080 divideint -8739299372114.092482914139281669 507610074.7343577029345077385838 -> -17216 -mulx3080 multiply -8739299372114.092482914139281669 507610074.7343577029345077385838 -> -4436156407404759833857.580707024 Inexact Rounded -powx3080 power -8739299372114.092482914139281669 507610075 -> -Infinity Overflow Inexact Rounded -remx3080 remainder -8739299372114.092482914139281669 507610074.7343577029345077385838 -> -284325487.3902691936540542102992 -subx3080 subtract -8739299372114.092482914139281669 507610074.7343577029345077385838 -> -8739806982188.826840617073789408 Inexact Rounded -addx3081 add 2454.002078468928665008217727731 583546039.6233842869119950982009E-147 -> 2454.002078468928665008217727731 Inexact Rounded -comx3081 compare 2454.002078468928665008217727731 583546039.6233842869119950982009E-147 -> 1 -divx3081 divide 2454.002078468928665008217727731 583546039.6233842869119950982009E-147 -> 4.205327278123112611006652533618E+141 Inexact Rounded -dvix3081 divideint 2454.002078468928665008217727731 583546039.6233842869119950982009E-147 -> NaN Division_impossible -mulx3081 multiply 2454.002078468928665008217727731 583546039.6233842869119950982009E-147 -> 1.432023194118096842806010293027E-135 Inexact Rounded -powx3081 power 2454.002078468928665008217727731 6 -> 218398452792293853786.9263054420 Inexact Rounded -remx3081 remainder 2454.002078468928665008217727731 583546039.6233842869119950982009E-147 -> NaN Division_impossible -subx3081 subtract 2454.002078468928665008217727731 583546039.6233842869119950982009E-147 -> 2454.002078468928665008217727731 Inexact Rounded -addx3082 add 764578.5204849936912066033177429 64603.13571259164812609436832506 -> 829181.6561975853393326976860680 Inexact Rounded -comx3082 compare 764578.5204849936912066033177429 64603.13571259164812609436832506 -> 1 -divx3082 divide 764578.5204849936912066033177429 64603.13571259164812609436832506 -> 11.83500633601553578851124281417 Inexact Rounded -dvix3082 divideint 764578.5204849936912066033177429 64603.13571259164812609436832506 -> 11 -mulx3082 multiply 764578.5204849936912066033177429 64603.13571259164812609436832506 -> 49394169921.82458094138096628957 Inexact Rounded -powx3082 power 764578.5204849936912066033177429 64603 -> Infinity Overflow Inexact Rounded -remx3082 remainder 764578.5204849936912066033177429 64603.13571259164812609436832506 -> 53944.02764648556181956526616724 -subx3082 subtract 764578.5204849936912066033177429 64603.13571259164812609436832506 -> 699975.3847724020430805089494178 Inexact Rounded -addx3083 add 079203.7330103777716903518367560 846388934347.6324036132959664705 -> 846389013551.3654139910676568223 Inexact Rounded -comx3083 compare 079203.7330103777716903518367560 846388934347.6324036132959664705 -> -1 -divx3083 divide 079203.7330103777716903518367560 846388934347.6324036132959664705 -> 9.357841270860339858146471876044E-8 Inexact Rounded -dvix3083 divideint 079203.7330103777716903518367560 846388934347.6324036132959664705 -> 0 -mulx3083 multiply 079203.7330103777716903518367560 846388934347.6324036132959664705 -> 67037163179008037.19983564789203 Inexact Rounded -powx3083 power 079203.7330103777716903518367560 8 -> 1.548692549503356788115682996756E+39 Inexact Rounded -remx3083 remainder 079203.7330103777716903518367560 846388934347.6324036132959664705 -> 79203.7330103777716903518367560 -subx3083 subtract 079203.7330103777716903518367560 846388934347.6324036132959664705 -> -846388855143.8993932355242761187 Inexact Rounded -addx3084 add -4278.581514688669249247007127899E-329 5.474973992953902631890208360829 -> 5.474973992953902631890208360829 Inexact Rounded -comx3084 compare -4278.581514688669249247007127899E-329 5.474973992953902631890208360829 -> -1 -divx3084 divide -4278.581514688669249247007127899E-329 5.474973992953902631890208360829 -> -7.814797878848469282033896969532E-327 Inexact Rounded -dvix3084 divideint -4278.581514688669249247007127899E-329 5.474973992953902631890208360829 -> -0 -mulx3084 multiply -4278.581514688669249247007127899E-329 5.474973992953902631890208360829 -> -2.342512251965378028433584538870E-325 Inexact Rounded -powx3084 power -4278.581514688669249247007127899E-329 5 -> -1.433834587801771244104676682986E-1627 Inexact Rounded -remx3084 remainder -4278.581514688669249247007127899E-329 5.474973992953902631890208360829 -> -4.278581514688669249247007127899E-326 -subx3084 subtract -4278.581514688669249247007127899E-329 5.474973992953902631890208360829 -> -5.474973992953902631890208360829 Inexact Rounded -addx3085 add 60867019.81764798845468445196869E+651 6.149612565404080501157093851895E+817 -> 6.149612565404080501157093851895E+817 Inexact Rounded -comx3085 compare 60867019.81764798845468445196869E+651 6.149612565404080501157093851895E+817 -> -1 -divx3085 divide 60867019.81764798845468445196869E+651 6.149612565404080501157093851895E+817 -> 9.897699923417617920996187420968E-160 Inexact Rounded -dvix3085 divideint 60867019.81764798845468445196869E+651 6.149612565404080501157093851895E+817 -> 0 -mulx3085 multiply 60867019.81764798845468445196869E+651 6.149612565404080501157093851895E+817 -> 3.743085898893072544197564013497E+1476 Inexact Rounded -powx3085 power 60867019.81764798845468445196869E+651 6 -> 5.085014897388871736767602086646E+3952 Inexact Rounded -remx3085 remainder 60867019.81764798845468445196869E+651 6.149612565404080501157093851895E+817 -> 6.086701981764798845468445196869E+658 -subx3085 subtract 60867019.81764798845468445196869E+651 6.149612565404080501157093851895E+817 -> -6.149612565404080501157093851895E+817 Inexact Rounded -addx3086 add 18554417738217.62218590965803605E-382 -0894505909529.052378474618435782E+527 -> -8.945059095290523784746184357820E+538 Inexact Rounded -comx3086 compare 18554417738217.62218590965803605E-382 -0894505909529.052378474618435782E+527 -> 1 -divx3086 divide 18554417738217.62218590965803605E-382 -0894505909529.052378474618435782E+527 -> -2.074264411286709228674841672954E-908 Inexact Rounded -dvix3086 divideint 18554417738217.62218590965803605E-382 -0894505909529.052378474618435782E+527 -> -0 -mulx3086 multiply 18554417738217.62218590965803605E-382 -0894505909529.052378474618435782E+527 -> -1.659703631470633700884136887614E+170 Inexact Rounded -powx3086 power 18554417738217.62218590965803605E-382 -9 -> 3.836842998295531899082688721531E+3318 Inexact Rounded -remx3086 remainder 18554417738217.62218590965803605E-382 -0894505909529.052378474618435782E+527 -> 1.855441773821762218590965803605E-369 -subx3086 subtract 18554417738217.62218590965803605E-382 -0894505909529.052378474618435782E+527 -> 8.945059095290523784746184357820E+538 Inexact Rounded -addx3087 add 69073355517144.36356688642213839 997784782535.6104634823627327033E+116 -> 9.977847825356104634823627327033E+127 Inexact Rounded -comx3087 compare 69073355517144.36356688642213839 997784782535.6104634823627327033E+116 -> -1 -divx3087 divide 69073355517144.36356688642213839 997784782535.6104634823627327033E+116 -> 6.922670772910807388395384866884E-115 Inexact Rounded -dvix3087 divideint 69073355517144.36356688642213839 997784782535.6104634823627327033E+116 -> 0 -mulx3087 multiply 69073355517144.36356688642213839 997784782535.6104634823627327033E+116 -> 6.892034301367879802693422066425E+141 Inexact Rounded -powx3087 power 69073355517144.36356688642213839 10 -> 2.472324890841334302628435461516E+138 Inexact Rounded -remx3087 remainder 69073355517144.36356688642213839 997784782535.6104634823627327033E+116 -> 69073355517144.36356688642213839 -subx3087 subtract 69073355517144.36356688642213839 997784782535.6104634823627327033E+116 -> -9.977847825356104634823627327033E+127 Inexact Rounded -addx3088 add 450282259072.8657099359104277477 -1791307965314309175477911369824 -> -1791307965314309175027629110751 Inexact Rounded -comx3088 compare 450282259072.8657099359104277477 -1791307965314309175477911369824 -> 1 -divx3088 divide 450282259072.8657099359104277477 -1791307965314309175477911369824 -> -2.513706564096350714213771006483E-19 Inexact Rounded -dvix3088 divideint 450282259072.8657099359104277477 -1791307965314309175477911369824 -> -0 -mulx3088 multiply 450282259072.8657099359104277477 -1791307965314309175477911369824 -> -8.065941973169457071650996861677E+41 Inexact Rounded -powx3088 power 450282259072.8657099359104277477 -2 -> 4.932082442194544671633570348838E-24 Inexact Rounded -remx3088 remainder 450282259072.8657099359104277477 -1791307965314309175477911369824 -> 450282259072.8657099359104277477 -subx3088 subtract 450282259072.8657099359104277477 -1791307965314309175477911369824 -> 1791307965314309175928193628897 Inexact Rounded -addx3089 add 954678411.7838149266455177850037 142988.7096204254529284334278794 -> 954821400.4934353520984462184316 Inexact Rounded -comx3089 compare 954678411.7838149266455177850037 142988.7096204254529284334278794 -> 1 -divx3089 divide 954678411.7838149266455177850037 142988.7096204254529284334278794 -> 6676.599951968811589335427770046 Inexact Rounded -dvix3089 divideint 954678411.7838149266455177850037 142988.7096204254529284334278794 -> 6676 -mulx3089 multiply 954678411.7838149266455177850037 142988.7096204254529284334278794 -> 136508234203444.8694879431412375 Inexact Rounded -powx3089 power 954678411.7838149266455177850037 142989 -> Infinity Overflow Inexact Rounded -remx3089 remainder 954678411.7838149266455177850037 142988.7096204254529284334278794 -> 85786.3578546028952962204808256 -subx3089 subtract 954678411.7838149266455177850037 142988.7096204254529284334278794 -> 954535423.0741945011925893515758 Inexact Rounded -addx3090 add -9244530976.220812127155852389807E+557 541089.4715446858896619078627941 -> -9.244530976220812127155852389807E+566 Inexact Rounded -comx3090 compare -9244530976.220812127155852389807E+557 541089.4715446858896619078627941 -> -1 -divx3090 divide -9244530976.220812127155852389807E+557 541089.4715446858896619078627941 -> -1.708503207395591002370649848757E+561 Inexact Rounded -dvix3090 divideint -9244530976.220812127155852389807E+557 541089.4715446858896619078627941 -> NaN Division_impossible -mulx3090 multiply -9244530976.220812127155852389807E+557 541089.4715446858896619078627941 -> -5.002118380601798392363043558941E+572 Inexact Rounded -powx3090 power -9244530976.220812127155852389807E+557 541089 -> -Infinity Overflow Inexact Rounded -remx3090 remainder -9244530976.220812127155852389807E+557 541089.4715446858896619078627941 -> NaN Division_impossible -subx3090 subtract -9244530976.220812127155852389807E+557 541089.4715446858896619078627941 -> -9.244530976220812127155852389807E+566 Inexact Rounded -addx3091 add -75492024.20990197005974241975449 -14760421311348.35269044633000927 -> -14760496803372.56259241638975169 Inexact Rounded -comx3091 compare -75492024.20990197005974241975449 -14760421311348.35269044633000927 -> 1 -divx3091 divide -75492024.20990197005974241975449 -14760421311348.35269044633000927 -> 0.000005114489797920668836278344635108 Inexact Rounded -dvix3091 divideint -75492024.20990197005974241975449 -14760421311348.35269044633000927 -> 0 -mulx3091 multiply -75492024.20990197005974241975449 -14760421311348.35269044633000927 -> 1114294082984662825831.464787487 Inexact Rounded -powx3091 power -75492024.20990197005974241975449 -1 -> -1.324643246046162082348970735576E-8 Inexact Rounded -remx3091 remainder -75492024.20990197005974241975449 -14760421311348.35269044633000927 -> -75492024.20990197005974241975449 -subx3091 subtract -75492024.20990197005974241975449 -14760421311348.35269044633000927 -> 14760345819324.14278847627026685 Inexact Rounded -addx3092 add 317747.6972215715434186596178036E-452 24759763.33144824613591228097330E+092 -> 2.475976333144824613591228097330E+99 Inexact Rounded -comx3092 compare 317747.6972215715434186596178036E-452 24759763.33144824613591228097330E+092 -> -1 -divx3092 divide 317747.6972215715434186596178036E-452 24759763.33144824613591228097330E+092 -> 1.283322837007852247594216151634E-546 Inexact Rounded -dvix3092 divideint 317747.6972215715434186596178036E-452 24759763.33144824613591228097330E+092 -> 0 -mulx3092 multiply 317747.6972215715434186596178036E-452 24759763.33144824613591228097330E+092 -> 7.867357782318786860404997647513E-348 Inexact Rounded -powx3092 power 317747.6972215715434186596178036E-452 2 -> 1.009635990896115043331231496209E-893 Inexact Rounded -remx3092 remainder 317747.6972215715434186596178036E-452 24759763.33144824613591228097330E+092 -> 3.177476972215715434186596178036E-447 -subx3092 subtract 317747.6972215715434186596178036E-452 24759763.33144824613591228097330E+092 -> -2.475976333144824613591228097330E+99 Inexact Rounded -addx3093 add -8.153334430358647134334545353427 -9.717872025814596548462854853522 -> -17.87120645617324368279740020695 Inexact Rounded -comx3093 compare -8.153334430358647134334545353427 -9.717872025814596548462854853522 -> 1 -divx3093 divide -8.153334430358647134334545353427 -9.717872025814596548462854853522 -> 0.8390040956188859972044344532019 Inexact Rounded -dvix3093 divideint -8.153334430358647134334545353427 -9.717872025814596548462854853522 -> 0 -mulx3093 multiply -8.153334430358647134334545353427 -9.717872025814596548462854853522 -> 79.23306057789328578902960605222 Inexact Rounded -powx3093 power -8.153334430358647134334545353427 -10 -> 7.702778966876727056635952801162E-10 Inexact Rounded -remx3093 remainder -8.153334430358647134334545353427 -9.717872025814596548462854853522 -> -8.153334430358647134334545353427 -subx3093 subtract -8.153334430358647134334545353427 -9.717872025814596548462854853522 -> 1.564537595455949414128309500095 -addx3094 add 7.267345197492967332320456062961E-478 5054015481833.263541189916208065 -> 5054015481833.263541189916208065 Inexact Rounded -comx3094 compare 7.267345197492967332320456062961E-478 5054015481833.263541189916208065 -> -1 -divx3094 divide 7.267345197492967332320456062961E-478 5054015481833.263541189916208065 -> 1.437934890309606594895299558654E-490 Inexact Rounded -dvix3094 divideint 7.267345197492967332320456062961E-478 5054015481833.263541189916208065 -> 0 -mulx3094 multiply 7.267345197492967332320456062961E-478 5054015481833.263541189916208065 -> 3.672927513995607308048737751972E-465 Inexact Rounded -powx3094 power 7.267345197492967332320456062961E-478 5 -> 2.027117616846668568108096583897E-2386 Inexact Rounded -remx3094 remainder 7.267345197492967332320456062961E-478 5054015481833.263541189916208065 -> 7.267345197492967332320456062961E-478 -subx3094 subtract 7.267345197492967332320456062961E-478 5054015481833.263541189916208065 -> -5054015481833.263541189916208065 Inexact Rounded -addx3095 add -1223354029.862567054230912271171 8135774223401322785475014855625 -> 8135774223401322785473791501595 Inexact Rounded -comx3095 compare -1223354029.862567054230912271171 8135774223401322785475014855625 -> -1 -divx3095 divide -1223354029.862567054230912271171 8135774223401322785475014855625 -> -1.503672540892020337688277553692E-22 Inexact Rounded -dvix3095 divideint -1223354029.862567054230912271171 8135774223401322785475014855625 -> -0 -mulx3095 multiply -1223354029.862567054230912271171 8135774223401322785475014855625 -> -9.952932182250005119307429060894E+39 Inexact Rounded -powx3095 power -1223354029.862567054230912271171 8 -> 5.016689887192830666848068841227E+72 Inexact Rounded -remx3095 remainder -1223354029.862567054230912271171 8135774223401322785475014855625 -> -1223354029.862567054230912271171 -subx3095 subtract -1223354029.862567054230912271171 8135774223401322785475014855625 -> -8135774223401322785476238209655 Inexact Rounded -addx3096 add 285397644111.5655679961211349982E+645 -2479499427613157519359627280704 -> 2.853976441115655679961211349982E+656 Inexact Rounded -comx3096 compare 285397644111.5655679961211349982E+645 -2479499427613157519359627280704 -> 1 -divx3096 divide 285397644111.5655679961211349982E+645 -2479499427613157519359627280704 -> -1.151029280076495626421134733122E+626 Inexact Rounded -dvix3096 divideint 285397644111.5655679961211349982E+645 -2479499427613157519359627280704 -> NaN Division_impossible -mulx3096 multiply 285397644111.5655679961211349982E+645 -2479499427613157519359627280704 -> -7.076432952167704614138411740001E+686 Inexact Rounded -powx3096 power 285397644111.5655679961211349982E+645 -2 -> 1.227719722087860401233030479451E-1313 Inexact Rounded -remx3096 remainder 285397644111.5655679961211349982E+645 -2479499427613157519359627280704 -> NaN Division_impossible -subx3096 subtract 285397644111.5655679961211349982E+645 -2479499427613157519359627280704 -> 2.853976441115655679961211349982E+656 Inexact Rounded -addx3097 add -4673112.663442366293812346653429 -3429.998403142546001438238460958 -> -4676542.661845508839813784891890 Inexact Rounded -comx3097 compare -4673112.663442366293812346653429 -3429.998403142546001438238460958 -> -1 -divx3097 divide -4673112.663442366293812346653429 -3429.998403142546001438238460958 -> 1362.424151323477505064686589716 Inexact Rounded -dvix3097 divideint -4673112.663442366293812346653429 -3429.998403142546001438238460958 -> 1362 -mulx3097 multiply -4673112.663442366293812346653429 -3429.998403142546001438238460958 -> 16028768973.31252639476148371361 Inexact Rounded -powx3097 power -4673112.663442366293812346653429 -3430 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3097 remainder -4673112.663442366293812346653429 -3429.998403142546001438238460958 -> -1454.838362218639853465869604204 -subx3097 subtract -4673112.663442366293812346653429 -3429.998403142546001438238460958 -> -4669682.665039223747810908414968 Inexact Rounded -addx3098 add 88.96492479681278079861456051103 386939.4621006514751889096510923E+139 -> 3.869394621006514751889096510923E+144 Inexact Rounded -comx3098 compare 88.96492479681278079861456051103 386939.4621006514751889096510923E+139 -> -1 -divx3098 divide 88.96492479681278079861456051103 386939.4621006514751889096510923E+139 -> 2.299194926095985647821385937618E-143 Inexact Rounded -dvix3098 divideint 88.96492479681278079861456051103 386939.4621006514751889096510923E+139 -> 0 -mulx3098 multiply 88.96492479681278079861456051103 386939.4621006514751889096510923E+139 -> 3.442404014670364763780946297856E+146 Inexact Rounded -powx3098 power 88.96492479681278079861456051103 4 -> 62643391.73078290226474758858970 Inexact Rounded -remx3098 remainder 88.96492479681278079861456051103 386939.4621006514751889096510923E+139 -> 88.96492479681278079861456051103 -subx3098 subtract 88.96492479681278079861456051103 386939.4621006514751889096510923E+139 -> -3.869394621006514751889096510923E+144 Inexact Rounded -addx3099 add 064326846.4286437304788069444326E-942 92.23649942010862087149015091350 -> 92.23649942010862087149015091350 Inexact Rounded -comx3099 compare 064326846.4286437304788069444326E-942 92.23649942010862087149015091350 -> -1 -divx3099 divide 064326846.4286437304788069444326E-942 92.23649942010862087149015091350 -> 6.974120530708230229344349531719E-937 Inexact Rounded -dvix3099 divideint 064326846.4286437304788069444326E-942 92.23649942010862087149015091350 -> 0 -mulx3099 multiply 064326846.4286437304788069444326E-942 92.23649942010862087149015091350 -> 5.933283133313013755814405436342E-933 Inexact Rounded -powx3099 power 064326846.4286437304788069444326E-942 92 -> 0E-10029 Underflow Subnormal Inexact Rounded Clamped -remx3099 remainder 064326846.4286437304788069444326E-942 92.23649942010862087149015091350 -> 6.43268464286437304788069444326E-935 -subx3099 subtract 064326846.4286437304788069444326E-942 92.23649942010862087149015091350 -> -92.23649942010862087149015091350 Inexact Rounded -addx3100 add 504507.0043949324433170405699360 605387.7175522955344659311072099 -> 1109894.721947227977782971677146 Inexact Rounded -comx3100 compare 504507.0043949324433170405699360 605387.7175522955344659311072099 -> -1 -divx3100 divide 504507.0043949324433170405699360 605387.7175522955344659311072099 -> 0.8333618105678718895216067463832 Inexact Rounded -dvix3100 divideint 504507.0043949324433170405699360 605387.7175522955344659311072099 -> 0 -mulx3100 multiply 504507.0043949324433170405699360 605387.7175522955344659311072099 -> 305422343879.7940838630401656585 Inexact Rounded -powx3100 power 504507.0043949324433170405699360 605388 -> Infinity Overflow Inexact Rounded -remx3100 remainder 504507.0043949324433170405699360 605387.7175522955344659311072099 -> 504507.0043949324433170405699360 -subx3100 subtract 504507.0043949324433170405699360 605387.7175522955344659311072099 -> -100880.7131573630911488905372739 - --- randomly generated testcases [26 Sep 2001] -precision: 32 -rounding: half_up -maxExponent: 9999 - -addx3201 add 1.5283550163839789319142430253644 -1.6578158484822969520405291379492 -> -0.1294608320983180201262861125848 -comx3201 compare 1.5283550163839789319142430253644 -1.6578158484822969520405291379492 -> 1 -divx3201 divide 1.5283550163839789319142430253644 -1.6578158484822969520405291379492 -> -0.92190879812324313630282980110280 Inexact Rounded -dvix3201 divideint 1.5283550163839789319142430253644 -1.6578158484822969520405291379492 -> -0 -mulx3201 multiply 1.5283550163839789319142430253644 -1.6578158484822969520405291379492 -> -2.5337311682687808926633910761614 Inexact Rounded -powx3201 power 1.5283550163839789319142430253644 -2 -> 0.42810618916584924451466691603128 Inexact Rounded -remx3201 remainder 1.5283550163839789319142430253644 -1.6578158484822969520405291379492 -> 1.5283550163839789319142430253644 -subx3201 subtract 1.5283550163839789319142430253644 -1.6578158484822969520405291379492 -> 3.1861708648662758839547721633136 -addx3202 add -622903030605.2867503937836507326 6519388607.1331855704471328795821 -> -616383641998.15356482333651785302 Inexact Rounded -comx3202 compare -622903030605.2867503937836507326 6519388607.1331855704471328795821 -> -1 -divx3202 divide -622903030605.2867503937836507326 6519388607.1331855704471328795821 -> -95.546234185785110491676894153510 Inexact Rounded -dvix3202 divideint -622903030605.2867503937836507326 6519388607.1331855704471328795821 -> -95 -mulx3202 multiply -622903030605.2867503937836507326 6519388607.1331855704471328795821 -> -4060946921076840449949.6988828486 Inexact Rounded -powx3202 power -622903030605.2867503937836507326 7 -> -3.6386736597702404352813308064300E+82 Inexact Rounded -remx3202 remainder -622903030605.2867503937836507326 6519388607.1331855704471328795821 -> -3561112927.6341212013060271723005 -subx3202 subtract -622903030605.2867503937836507326 6519388607.1331855704471328795821 -> -629422419212.41993596423078361218 Inexact Rounded -addx3203 add -5675915.2465457487632250245209054 73913909880.381367895205086027416 -> 73908233965.134822146441861002895 Inexact Rounded -comx3203 compare -5675915.2465457487632250245209054 73913909880.381367895205086027416 -> -1 -divx3203 divide -5675915.2465457487632250245209054 73913909880.381367895205086027416 -> -0.000076790894376056827552388054657082 Inexact Rounded -dvix3203 divideint -5675915.2465457487632250245209054 73913909880.381367895205086027416 -> -0 -mulx3203 multiply -5675915.2465457487632250245209054 73913909880.381367895205086027416 -> -419529088021865067.23307352973589 Inexact Rounded -powx3203 power -5675915.2465457487632250245209054 7 -> -1.8978038060207777231389234721908E+47 Inexact Rounded -remx3203 remainder -5675915.2465457487632250245209054 73913909880.381367895205086027416 -> -5675915.2465457487632250245209054 -subx3203 subtract -5675915.2465457487632250245209054 73913909880.381367895205086027416 -> -73919585795.627913643968311051937 Inexact Rounded -addx3204 add 97.647321172555144900685605318635 4.8620911587547548751209841570885 -> 102.50941233130989977580658947572 Inexact Rounded -comx3204 compare 97.647321172555144900685605318635 4.8620911587547548751209841570885 -> 1 -divx3204 divide 97.647321172555144900685605318635 4.8620911587547548751209841570885 -> 20.083399916665466374741708949621 Inexact Rounded -dvix3204 divideint 97.647321172555144900685605318635 4.8620911587547548751209841570885 -> 20 -mulx3204 multiply 97.647321172555144900685605318635 4.8620911587547548751209841570885 -> 474.77017694916635398652276042175 Inexact Rounded -powx3204 power 97.647321172555144900685605318635 5 -> 8877724578.7935312939231828719842 Inexact Rounded -remx3204 remainder 97.647321172555144900685605318635 4.8620911587547548751209841570885 -> 0.4054979974600473982659221768650 -subx3204 subtract 97.647321172555144900685605318635 4.8620911587547548751209841570885 -> 92.785230013800390025564621161547 Inexact Rounded -addx3205 add -9717253267024.5380651435435603552 -2669.2539695193820424002013488480E+363 -> -2.6692539695193820424002013488480E+366 Inexact Rounded -comx3205 compare -9717253267024.5380651435435603552 -2669.2539695193820424002013488480E+363 -> 1 -divx3205 divide -9717253267024.5380651435435603552 -2669.2539695193820424002013488480E+363 -> 3.6404378818903462695633337631098E-354 Inexact Rounded -dvix3205 divideint -9717253267024.5380651435435603552 -2669.2539695193820424002013488480E+363 -> 0 -mulx3205 multiply -9717253267024.5380651435435603552 -2669.2539695193820424002013488480E+363 -> 2.5937816855830431899123217912144E+379 Inexact Rounded -powx3205 power -9717253267024.5380651435435603552 -3 -> -1.0898567880085337780041328661330E-39 Inexact Rounded -remx3205 remainder -9717253267024.5380651435435603552 -2669.2539695193820424002013488480E+363 -> -9717253267024.5380651435435603552 -subx3205 subtract -9717253267024.5380651435435603552 -2669.2539695193820424002013488480E+363 -> 2.6692539695193820424002013488480E+366 Inexact Rounded -addx3206 add -4.0817391717190128506083001702335E-767 12772.807105920712660991033689206 -> 12772.807105920712660991033689206 Inexact Rounded -comx3206 compare -4.0817391717190128506083001702335E-767 12772.807105920712660991033689206 -> -1 -divx3206 divide -4.0817391717190128506083001702335E-767 12772.807105920712660991033689206 -> -3.1956477052150593175206769891434E-771 Inexact Rounded -dvix3206 divideint -4.0817391717190128506083001702335E-767 12772.807105920712660991033689206 -> -0 -mulx3206 multiply -4.0817391717190128506083001702335E-767 12772.807105920712660991033689206 -> -5.2135267097047531336100750110314E-763 Inexact Rounded -powx3206 power -4.0817391717190128506083001702335E-767 12773 -> -0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3206 remainder -4.0817391717190128506083001702335E-767 12772.807105920712660991033689206 -> -4.0817391717190128506083001702335E-767 -subx3206 subtract -4.0817391717190128506083001702335E-767 12772.807105920712660991033689206 -> -12772.807105920712660991033689206 Inexact Rounded -addx3207 add 68625322655934146845003028928647 -59.634169944840280159782488098700 -> 68625322655934146845003028928587 Inexact Rounded -comx3207 compare 68625322655934146845003028928647 -59.634169944840280159782488098700 -> 1 -divx3207 divide 68625322655934146845003028928647 -59.634169944840280159782488098700 -> -1150771826276954946844322988192.5 Inexact Rounded -dvix3207 divideint 68625322655934146845003028928647 -59.634169944840280159782488098700 -> -1150771826276954946844322988192 -mulx3207 multiply 68625322655934146845003028928647 -59.634169944840280159782488098700 -> -4.0924141537834748501140151997778E+33 Inexact Rounded -powx3207 power 68625322655934146845003028928647 -60 -> 6.4704731111943370171711131942603E-1911 Inexact Rounded -remx3207 remainder 68625322655934146845003028928647 -59.634169944840280159782488098700 -> 28.201254004897257552939369449600 -subx3207 subtract 68625322655934146845003028928647 -59.634169944840280159782488098700 -> 68625322655934146845003028928707 Inexact Rounded -addx3208 add 732515.76532049290815665856727641 -92134479835821.319619827023729829 -> -92134479103305.554299334115573170 Inexact Rounded -comx3208 compare 732515.76532049290815665856727641 -92134479835821.319619827023729829 -> 1 -divx3208 divide 732515.76532049290815665856727641 -92134479835821.319619827023729829 -> -7.9505063318943846655593887991914E-9 Inexact Rounded -dvix3208 divideint 732515.76532049290815665856727641 -92134479835821.319619827023729829 -> -0 -mulx3208 multiply 732515.76532049290815665856727641 -92134479835821.319619827023729829 -> -67489959009342175728.710494356322 Inexact Rounded -powx3208 power 732515.76532049290815665856727641 -9 -> 1.6468241050443471359358016585877E-53 Inexact Rounded -remx3208 remainder 732515.76532049290815665856727641 -92134479835821.319619827023729829 -> 732515.76532049290815665856727641 -subx3208 subtract 732515.76532049290815665856727641 -92134479835821.319619827023729829 -> 92134480568337.084940319931886488 Inexact Rounded -addx3209 add -30.458011942978338421676454778733 -5023372024597665102336430410403E+831 -> -5.0233720245976651023364304104030E+861 Inexact Rounded -comx3209 compare -30.458011942978338421676454778733 -5023372024597665102336430410403E+831 -> 1 -divx3209 divide -30.458011942978338421676454778733 -5023372024597665102336430410403E+831 -> 6.0632602550311410821483001305010E-861 Inexact Rounded -dvix3209 divideint -30.458011942978338421676454778733 -5023372024597665102336430410403E+831 -> 0 -mulx3209 multiply -30.458011942978338421676454778733 -5023372024597665102336430410403E+831 -> 1.5300192511921895929031818638961E+863 Inexact Rounded -powx3209 power -30.458011942978338421676454778733 -5 -> -3.8149797481405136042487643253109E-8 Inexact Rounded -remx3209 remainder -30.458011942978338421676454778733 -5023372024597665102336430410403E+831 -> -30.458011942978338421676454778733 -subx3209 subtract -30.458011942978338421676454778733 -5023372024597665102336430410403E+831 -> 5.0233720245976651023364304104030E+861 Inexact Rounded -addx3210 add -89640.094149414644660480286430462 -58703419758.800889903227509215474 -> -58703509398.895039317872169695760 Inexact Rounded -comx3210 compare -89640.094149414644660480286430462 -58703419758.800889903227509215474 -> 1 -divx3210 divide -89640.094149414644660480286430462 -58703419758.800889903227509215474 -> 0.0000015269995260536025237167199970238 Inexact Rounded -dvix3210 divideint -89640.094149414644660480286430462 -58703419758.800889903227509215474 -> 0 -mulx3210 multiply -89640.094149414644660480286430462 -58703419758.800889903227509215474 -> 5262180074071519.7018252171579753 Inexact Rounded -powx3210 power -89640.094149414644660480286430462 -6 -> 1.9274635591165405888724595165741E-30 Inexact Rounded -remx3210 remainder -89640.094149414644660480286430462 -58703419758.800889903227509215474 -> -89640.094149414644660480286430462 -subx3210 subtract -89640.094149414644660480286430462 -58703419758.800889903227509215474 -> 58703330118.706740488582848735188 Inexact Rounded -addx3211 add 458653.1567870081810052917714259 18353106238.516235116080449814053E-038 -> 458653.15678700818100529177142590 Inexact Rounded -comx3211 compare 458653.1567870081810052917714259 18353106238.516235116080449814053E-038 -> 1 -divx3211 divide 458653.1567870081810052917714259 18353106238.516235116080449814053E-038 -> 2.4990492117594160215641311760498E+33 Inexact Rounded -dvix3211 divideint 458653.1567870081810052917714259 18353106238.516235116080449814053E-038 -> NaN Division_impossible -mulx3211 multiply 458653.1567870081810052917714259 18353106238.516235116080449814053E-038 -> 8.4177101131428047497998594379593E-23 Inexact Rounded -powx3211 power 458653.1567870081810052917714259 2 -> 210362718230.68790865117452429990 Inexact Rounded -remx3211 remainder 458653.1567870081810052917714259 18353106238.516235116080449814053E-038 -> NaN Division_impossible -subx3211 subtract 458653.1567870081810052917714259 18353106238.516235116080449814053E-038 -> 458653.15678700818100529177142590 Inexact Rounded -addx3212 add 913391.42744224458216174967853722 -21051638.816432817393202262710630E+432 -> -2.1051638816432817393202262710630E+439 Inexact Rounded -comx3212 compare 913391.42744224458216174967853722 -21051638.816432817393202262710630E+432 -> 1 -divx3212 divide 913391.42744224458216174967853722 -21051638.816432817393202262710630E+432 -> -4.3388138824102151127273259092613E-434 Inexact Rounded -dvix3212 divideint 913391.42744224458216174967853722 -21051638.816432817393202262710630E+432 -> -0 -mulx3212 multiply 913391.42744224458216174967853722 -21051638.816432817393202262710630E+432 -> -1.9228386428540135340600836707270E+445 Inexact Rounded -powx3212 power 913391.42744224458216174967853722 -2 -> 1.1986327439971532470297300128074E-12 Inexact Rounded -remx3212 remainder 913391.42744224458216174967853722 -21051638.816432817393202262710630E+432 -> 913391.42744224458216174967853722 -subx3212 subtract 913391.42744224458216174967853722 -21051638.816432817393202262710630E+432 -> 2.1051638816432817393202262710630E+439 Inexact Rounded -addx3213 add -917591456829.12109027484399536567 -28892177726858026955513438843371E+708 -> -2.8892177726858026955513438843371E+739 Inexact Rounded -comx3213 compare -917591456829.12109027484399536567 -28892177726858026955513438843371E+708 -> 1 -divx3213 divide -917591456829.12109027484399536567 -28892177726858026955513438843371E+708 -> 3.1759165595057674196644927106447E-728 Inexact Rounded -dvix3213 divideint -917591456829.12109027484399536567 -28892177726858026955513438843371E+708 -> 0 -mulx3213 multiply -917591456829.12109027484399536567 -28892177726858026955513438843371E+708 -> 2.6511215451353541156703914721725E+751 Inexact Rounded -powx3213 power -917591456829.12109027484399536567 -3 -> -1.2943505591853739240003453341911E-36 Inexact Rounded -remx3213 remainder -917591456829.12109027484399536567 -28892177726858026955513438843371E+708 -> -917591456829.12109027484399536567 -subx3213 subtract -917591456829.12109027484399536567 -28892177726858026955513438843371E+708 -> 2.8892177726858026955513438843371E+739 Inexact Rounded -addx3214 add 34938410840645.913399699219228218 30.818220393242402846077755480548 -> 34938410840676.731620092461631064 Inexact Rounded -comx3214 compare 34938410840645.913399699219228218 30.818220393242402846077755480548 -> 1 -divx3214 divide 34938410840645.913399699219228218 30.818220393242402846077755480548 -> 1133693327999.7879503260098666966 Inexact Rounded -dvix3214 divideint 34938410840645.913399699219228218 30.818220393242402846077755480548 -> 1133693327999 -mulx3214 multiply 34938410840645.913399699219228218 30.818220393242402846077755480548 -> 1076739645476675.3318519289128961 Inexact Rounded -powx3214 power 34938410840645.913399699219228218 31 -> 6.9566085958798732786509909683267E+419 Inexact Rounded -remx3214 remainder 34938410840645.913399699219228218 30.818220393242402846077755480548 -> 24.283226805899273551376371736548 -subx3214 subtract 34938410840645.913399699219228218 30.818220393242402846077755480548 -> 34938410840615.095179305976825372 Inexact Rounded -addx3215 add 6034.7374411022598081745006769023E-517 29771833428054709077850588904653 -> 29771833428054709077850588904653 Inexact Rounded -comx3215 compare 6034.7374411022598081745006769023E-517 29771833428054709077850588904653 -> -1 -divx3215 divide 6034.7374411022598081745006769023E-517 29771833428054709077850588904653 -> 2.0269955680376683526099444523691E-545 Inexact Rounded -dvix3215 divideint 6034.7374411022598081745006769023E-517 29771833428054709077850588904653 -> 0 -mulx3215 multiply 6034.7374411022598081745006769023E-517 29771833428054709077850588904653 -> 1.7966519787854159464382359411642E-482 Inexact Rounded -powx3215 power 6034.7374411022598081745006769023E-517 3 -> 2.1977340597301840681528507640032E-1540 Inexact Rounded -remx3215 remainder 6034.7374411022598081745006769023E-517 29771833428054709077850588904653 -> 6.0347374411022598081745006769023E-514 -subx3215 subtract 6034.7374411022598081745006769023E-517 29771833428054709077850588904653 -> -29771833428054709077850588904653 Inexact Rounded -addx3216 add -5565747671734.1686009705574503152 -490.30899494881071282787487030303 -> -5565747672224.4775959193681631431 Inexact Rounded -comx3216 compare -5565747671734.1686009705574503152 -490.30899494881071282787487030303 -> -1 -divx3216 divide -5565747671734.1686009705574503152 -490.30899494881071282787487030303 -> 11351510433.365074871574519756245 Inexact Rounded -dvix3216 divideint -5565747671734.1686009705574503152 -490.30899494881071282787487030303 -> 11351510433 -mulx3216 multiply -5565747671734.1686009705574503152 -490.30899494881071282787487030303 -> 2728936147066663.4580064428639745 Inexact Rounded -powx3216 power -5565747671734.1686009705574503152 -490 -> 4.9371745297619526113991728953197E-6246 Inexact Rounded -remx3216 remainder -5565747671734.1686009705574503152 -490.30899494881071282787487030303 -> -178.99949336276892685183308348801 -subx3216 subtract -5565747671734.1686009705574503152 -490.30899494881071282787487030303 -> -5565747671243.8596060217467374873 Inexact Rounded -addx3217 add 319545511.89203495546689273564728E+036 -2955943533943321899150310192061 -> 3.1954551189203199952335879232538E+44 Inexact Rounded -comx3217 compare 319545511.89203495546689273564728E+036 -2955943533943321899150310192061 -> 1 -divx3217 divide 319545511.89203495546689273564728E+036 -2955943533943321899150310192061 -> -108102711781422.68663084859902931 Inexact Rounded -dvix3217 divideint 319545511.89203495546689273564728E+036 -2955943533943321899150310192061 -> -108102711781422 -mulx3217 multiply 319545511.89203495546689273564728E+036 -2955943533943321899150310192061 -> -9.4455848967786959996525702197139E+74 Inexact Rounded -powx3217 power 319545511.89203495546689273564728E+036 -3 -> 3.0647978448946294457985223953472E-134 Inexact Rounded -remx3217 remainder 319545511.89203495546689273564728E+036 -2955943533943321899150310192061 -> 2029642017122316721531728309258 -subx3217 subtract 319545511.89203495546689273564728E+036 -2955943533943321899150310192061 -> 3.1954551189203791141042667896918E+44 Inexact Rounded -addx3218 add -36852134.84194296250843579428931 -5830629.8347085025808716360357940 -> -42682764.676651465089307430325104 Rounded -comx3218 compare -36852134.84194296250843579428931 -5830629.8347085025808716360357940 -> -1 -divx3218 divide -36852134.84194296250843579428931 -5830629.8347085025808716360357940 -> 6.3204380807318655475459047410160 Inexact Rounded -dvix3218 divideint -36852134.84194296250843579428931 -5830629.8347085025808716360357940 -> 6 -mulx3218 multiply -36852134.84194296250843579428931 -5830629.8347085025808716360357940 -> 214871156882133.34437417534873098 Inexact Rounded -powx3218 power -36852134.84194296250843579428931 -5830630 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3218 remainder -36852134.84194296250843579428931 -5830629.8347085025808716360357940 -> -1868355.8336919470232059780745460 -subx3218 subtract -36852134.84194296250843579428931 -5830629.8347085025808716360357940 -> -31021505.007234459927564158253516 Rounded -addx3219 add 8.6021905001798578659275880018221E-374 -39505285344943.729681835377530908 -> -39505285344943.729681835377530908 Inexact Rounded -comx3219 compare 8.6021905001798578659275880018221E-374 -39505285344943.729681835377530908 -> 1 -divx3219 divide 8.6021905001798578659275880018221E-374 -39505285344943.729681835377530908 -> -2.1774783867700502002511486885272E-387 Inexact Rounded -dvix3219 divideint 8.6021905001798578659275880018221E-374 -39505285344943.729681835377530908 -> -0 -mulx3219 multiply 8.6021905001798578659275880018221E-374 -39505285344943.729681835377530908 -> -3.3983199030116951081865430362053E-360 Inexact Rounded -powx3219 power 8.6021905001798578659275880018221E-374 -4 -> 1.8262649155820433126240754123257E+1492 Inexact Rounded -remx3219 remainder 8.6021905001798578659275880018221E-374 -39505285344943.729681835377530908 -> 8.6021905001798578659275880018221E-374 -subx3219 subtract 8.6021905001798578659275880018221E-374 -39505285344943.729681835377530908 -> 39505285344943.729681835377530908 Inexact Rounded -addx3220 add -54863165.152174109720312887805017 736.1398476560169141105328256628 -> -54862429.012326453703398777272191 Inexact Rounded -comx3220 compare -54863165.152174109720312887805017 736.1398476560169141105328256628 -> -1 -divx3220 divide -54863165.152174109720312887805017 736.1398476560169141105328256628 -> -74528.182826764384088602813142847 Inexact Rounded -dvix3220 divideint -54863165.152174109720312887805017 736.1398476560169141105328256628 -> -74528 -mulx3220 multiply -54863165.152174109720312887805017 736.1398476560169141105328256628 -> -40386962037.048345148338122539405 Inexact Rounded -powx3220 power -54863165.152174109720312887805017 736 -> 1.2903643981679111625370174573639E+5696 Inexact Rounded -remx3220 remainder -54863165.152174109720312887805017 736.1398476560169141105328256628 -> -134.5860664811454830973740198416 -subx3220 subtract -54863165.152174109720312887805017 736.1398476560169141105328256628 -> -54863901.292021765737226998337843 Inexact Rounded -addx3221 add -3263743464517851012531708810307 2457206.2471248382136273643208109 -> -3263743464517851012531706353100.8 Inexact Rounded -comx3221 compare -3263743464517851012531708810307 2457206.2471248382136273643208109 -> -1 -divx3221 divide -3263743464517851012531708810307 2457206.2471248382136273643208109 -> -1328233422952076975055082.5768082 Inexact Rounded -dvix3221 divideint -3263743464517851012531708810307 2457206.2471248382136273643208109 -> -1328233422952076975055082 -mulx3221 multiply -3263743464517851012531708810307 2457206.2471248382136273643208109 -> -8.0196908300261262548565838031943E+36 Inexact Rounded -powx3221 power -3263743464517851012531708810307 2457206 -> Infinity Overflow Inexact Rounded -remx3221 remainder -3263743464517851012531708810307 2457206.2471248382136273643208109 -> -1417336.7573398366062994535940062 -subx3221 subtract -3263743464517851012531708810307 2457206.2471248382136273643208109 -> -3263743464517851012531711267513.2 Inexact Rounded -addx3222 add 2856586744.0548637797291151154902E-895 953545637646.57694835860339582821E+080 -> 9.5354563764657694835860339582821E+91 Inexact Rounded -comx3222 compare 2856586744.0548637797291151154902E-895 953545637646.57694835860339582821E+080 -> -1 -divx3222 divide 2856586744.0548637797291151154902E-895 953545637646.57694835860339582821E+080 -> 2.9957525170007980008712828968300E-978 Inexact Rounded -dvix3222 divideint 2856586744.0548637797291151154902E-895 953545637646.57694835860339582821E+080 -> 0 -mulx3222 multiply 2856586744.0548637797291151154902E-895 953545637646.57694835860339582821E+080 -> 2.7238858283525541854826594343954E-794 Inexact Rounded -powx3222 power 2856586744.0548637797291151154902E-895 10 -> 3.6180466753307072256807593988336E-8856 Inexact Rounded -remx3222 remainder 2856586744.0548637797291151154902E-895 953545637646.57694835860339582821E+080 -> 2.8565867440548637797291151154902E-886 -subx3222 subtract 2856586744.0548637797291151154902E-895 953545637646.57694835860339582821E+080 -> -9.5354563764657694835860339582821E+91 Inexact Rounded -addx3223 add 5624157233.3433661009203529937625 626098409265.93738586750090160638 -> 631722566499.28075196842125460014 Inexact Rounded -comx3223 compare 5624157233.3433661009203529937625 626098409265.93738586750090160638 -> -1 -divx3223 divide 5624157233.3433661009203529937625 626098409265.93738586750090160638 -> 0.0089828645946207580492752544218316 Inexact Rounded -dvix3223 divideint 5624157233.3433661009203529937625 626098409265.93738586750090160638 -> 0 -mulx3223 multiply 5624157233.3433661009203529937625 626098409265.93738586750090160638 -> 3521275897257796938833.8975037909 Inexact Rounded -powx3223 power 5624157233.3433661009203529937625 6 -> 3.1647887196303262540158328459030E+58 Inexact Rounded -remx3223 remainder 5624157233.3433661009203529937625 626098409265.93738586750090160638 -> 5624157233.3433661009203529937625 -subx3223 subtract 5624157233.3433661009203529937625 626098409265.93738586750090160638 -> -620474252032.59401976658054861262 Inexact Rounded -addx3224 add -213499362.91476998701834067092611 419272438.02555757699863022643444 -> 205773075.11078758998028955550833 -comx3224 compare -213499362.91476998701834067092611 419272438.02555757699863022643444 -> -1 -divx3224 divide -213499362.91476998701834067092611 419272438.02555757699863022643444 -> -0.50921392286166855779828061147786 Inexact Rounded -dvix3224 divideint -213499362.91476998701834067092611 419272438.02555757699863022643444 -> -0 -mulx3224 multiply -213499362.91476998701834067092611 419272438.02555757699863022643444 -> -89514398406178925.073260776410672 Inexact Rounded -powx3224 power -213499362.91476998701834067092611 419272438 -> Infinity Overflow Inexact Rounded -remx3224 remainder -213499362.91476998701834067092611 419272438.02555757699863022643444 -> -213499362.91476998701834067092611 -subx3224 subtract -213499362.91476998701834067092611 419272438.02555757699863022643444 -> -632771800.94032756401697089736055 -addx3225 add 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 30274.392356614101238316845401518 Inexact Rounded -comx3225 compare 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1 -divx3225 divide 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 6300.1252178837655359831527173832 Inexact Rounded -dvix3225 divideint 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 6300 -mulx3225 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967191651199283 Inexact Rounded -powx3225 power 30269.587755640502150977251770554 5 -> 25411630481547464128383.220368208 Inexact Rounded -remx3225 remainder 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 0.6016219662519115373766970119100 -subx3225 subtract 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 30264.783154666903063637658139590 Inexact Rounded -addx3226 add 47.525676459351505682005359699680E+704 -58631943508436657383369760970210 -> 4.7525676459351505682005359699680E+705 Inexact Rounded -comx3226 compare 47.525676459351505682005359699680E+704 -58631943508436657383369760970210 -> 1 -divx3226 divide 47.525676459351505682005359699680E+704 -58631943508436657383369760970210 -> -8.1057651538555854520994438038537E+673 Inexact Rounded -dvix3226 divideint 47.525676459351505682005359699680E+704 -58631943508436657383369760970210 -> NaN Division_impossible -mulx3226 multiply 47.525676459351505682005359699680E+704 -58631943508436657383369760970210 -> -2.7865227773649353769876975366506E+737 Inexact Rounded -powx3226 power 47.525676459351505682005359699680E+704 -6 -> 8.6782100393941226535150385475463E-4235 Inexact Rounded -remx3226 remainder 47.525676459351505682005359699680E+704 -58631943508436657383369760970210 -> NaN Division_impossible -subx3226 subtract 47.525676459351505682005359699680E+704 -58631943508436657383369760970210 -> 4.7525676459351505682005359699680E+705 Inexact Rounded -addx3227 add -74396862273800.625679130772935550 -115616605.52826981284183992013157 -> -74396977890406.153948943614775470 Inexact Rounded -comx3227 compare -74396862273800.625679130772935550 -115616605.52826981284183992013157 -> -1 -divx3227 divide -74396862273800.625679130772935550 -115616605.52826981284183992013157 -> 643479.03948459716424778005613112 Inexact Rounded -dvix3227 divideint -74396862273800.625679130772935550 -115616605.52826981284183992013157 -> 643479 -mulx3227 multiply -74396862273800.625679130772935550 -115616605.52826981284183992013157 -> 8601512678051025297297.7169654467 Inexact Rounded -powx3227 power -74396862273800.625679130772935550 -115616606 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3227 remainder -74396862273800.625679130772935550 -115616605.52826981284183992013157 -> -4565075.09478147646296920746797 -subx3227 subtract -74396862273800.625679130772935550 -115616605.52826981284183992013157 -> -74396746657195.097409317931095630 Inexact Rounded -addx3228 add 67585560.562561229497720955705979 826.96290288608566737177503451613 -> 67586387.525464115583388327481014 Inexact Rounded -comx3228 compare 67585560.562561229497720955705979 826.96290288608566737177503451613 -> 1 -divx3228 divide 67585560.562561229497720955705979 826.96290288608566737177503451613 -> 81727.439437354248789852715586510 Inexact Rounded -dvix3228 divideint 67585560.562561229497720955705979 826.96290288608566737177503451613 -> 81727 -mulx3228 multiply 67585560.562561229497720955705979 826.96290288608566737177503451613 -> 55890751355.998983433895910295596 Inexact Rounded -powx3228 power 67585560.562561229497720955705979 827 -> 1.9462204583352191108781197788255E+6475 Inexact Rounded -remx3228 remainder 67585560.562561229497720955705979 826.96290288608566737177503451613 -> 363.39839010616042789746007924349 -subx3228 subtract 67585560.562561229497720955705979 826.96290288608566737177503451613 -> 67584733.599658343412053583930944 Inexact Rounded -addx3229 add 6877386868.9498051860742298735156E-232 390.3154289860643509393769754551 -> 390.31542898606435093937697545510 Inexact Rounded -comx3229 compare 6877386868.9498051860742298735156E-232 390.3154289860643509393769754551 -> -1 -divx3229 divide 6877386868.9498051860742298735156E-232 390.3154289860643509393769754551 -> 1.7620074325054038174571564409871E-225 Inexact Rounded -dvix3229 divideint 6877386868.9498051860742298735156E-232 390.3154289860643509393769754551 -> 0 -mulx3229 multiply 6877386868.9498051860742298735156E-232 390.3154289860643509393769754551 -> 2.6843502060572691408091663822732E-220 Inexact Rounded -powx3229 power 6877386868.9498051860742298735156E-232 390 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3229 remainder 6877386868.9498051860742298735156E-232 390.3154289860643509393769754551 -> 6.8773868689498051860742298735156E-223 -subx3229 subtract 6877386868.9498051860742298735156E-232 390.3154289860643509393769754551 -> -390.31542898606435093937697545510 Inexact Rounded -addx3230 add -1647335.201144609256134925838937 -186654823782.50459802235024230856 -> -186656471117.70574263160637723440 Inexact Rounded -comx3230 compare -1647335.201144609256134925838937 -186654823782.50459802235024230856 -> 1 -divx3230 divide -1647335.201144609256134925838937 -186654823782.50459802235024230856 -> 0.0000088255699357876233458660331146583 Inexact Rounded -dvix3230 divideint -1647335.201144609256134925838937 -186654823782.50459802235024230856 -> 0 -mulx3230 multiply -1647335.201144609256134925838937 -186654823782.50459802235024230856 -> 307483061680363807.48775619333285 Inexact Rounded -powx3230 power -1647335.201144609256134925838937 -2 -> 3.6849876990439502152784389237891E-13 Inexact Rounded -remx3230 remainder -1647335.201144609256134925838937 -186654823782.50459802235024230856 -> -1647335.201144609256134925838937 -subx3230 subtract -1647335.201144609256134925838937 -186654823782.50459802235024230856 -> 186653176447.30345341309410738272 Inexact Rounded -addx3231 add 41407818140948.866630923934138155 -5156.7624534000311342310106671627E-963 -> 41407818140948.866630923934138155 Inexact Rounded -comx3231 compare 41407818140948.866630923934138155 -5156.7624534000311342310106671627E-963 -> 1 -divx3231 divide 41407818140948.866630923934138155 -5156.7624534000311342310106671627E-963 -> -8.0298091128179204076796507697517E+972 Inexact Rounded -dvix3231 divideint 41407818140948.866630923934138155 -5156.7624534000311342310106671627E-963 -> NaN Division_impossible -mulx3231 multiply 41407818140948.866630923934138155 -5156.7624534000311342310106671627E-963 -> -2.1353028186646179369220834691156E-946 Inexact Rounded -powx3231 power 41407818140948.866630923934138155 -5 -> 8.2146348556648547525693528004081E-69 Inexact Rounded -remx3231 remainder 41407818140948.866630923934138155 -5156.7624534000311342310106671627E-963 -> NaN Division_impossible -subx3231 subtract 41407818140948.866630923934138155 -5156.7624534000311342310106671627E-963 -> 41407818140948.866630923934138155 Inexact Rounded -addx3232 add -6.6547424012516834662011706165297 -574454585580.06215974139884746441 -> -574454585586.71690214265053093061 Inexact Rounded -comx3232 compare -6.6547424012516834662011706165297 -574454585580.06215974139884746441 -> 1 -divx3232 divide -6.6547424012516834662011706165297 -574454585580.06215974139884746441 -> 1.1584453442097568745411568037078E-11 Inexact Rounded -dvix3232 divideint -6.6547424012516834662011706165297 -574454585580.06215974139884746441 -> 0 -mulx3232 multiply -6.6547424012516834662011706165297 -574454585580.06215974139884746441 -> 3822847288253.1035559206691532826 Inexact Rounded -powx3232 power -6.6547424012516834662011706165297 -6 -> 0.000011513636283388791488128239232906 Inexact Rounded -remx3232 remainder -6.6547424012516834662011706165297 -574454585580.06215974139884746441 -> -6.6547424012516834662011706165297 -subx3232 subtract -6.6547424012516834662011706165297 -574454585580.06215974139884746441 -> 574454585573.40741734014716399821 Inexact Rounded -addx3233 add -27627.758745381267780885067447671 -23385972189441.709586433758111062 -> -23385972217069.468331815025891947 Inexact Rounded -comx3233 compare -27627.758745381267780885067447671 -23385972189441.709586433758111062 -> 1 -divx3233 divide -27627.758745381267780885067447671 -23385972189441.709586433758111062 -> 1.1813816642548920194709898111624E-9 Inexact Rounded -dvix3233 divideint -27627.758745381267780885067447671 -23385972189441.709586433758111062 -> 0 -mulx3233 multiply -27627.758745381267780885067447671 -23385972189441.709586433758111062 -> 646101997676091306.41485393678655 Inexact Rounded -powx3233 power -27627.758745381267780885067447671 -2 -> 1.3101128009560812529198521922269E-9 Inexact Rounded -remx3233 remainder -27627.758745381267780885067447671 -23385972189441.709586433758111062 -> -27627.758745381267780885067447671 -subx3233 subtract -27627.758745381267780885067447671 -23385972189441.709586433758111062 -> 23385972161813.950841052490330177 Inexact Rounded -addx3234 add 209819.74379099914752963711944307E-228 -440230.6700989532467831370320266E-960 -> 2.0981974379099914752963711944307E-223 Inexact Rounded -comx3234 compare 209819.74379099914752963711944307E-228 -440230.6700989532467831370320266E-960 -> 1 -divx3234 divide 209819.74379099914752963711944307E-228 -440230.6700989532467831370320266E-960 -> -4.7661318949867060595545765053187E+731 Inexact Rounded -dvix3234 divideint 209819.74379099914752963711944307E-228 -440230.6700989532467831370320266E-960 -> NaN Division_impossible -mulx3234 multiply 209819.74379099914752963711944307E-228 -440230.6700989532467831370320266E-960 -> -9.2369086409102239573726316593648E-1178 Inexact Rounded -powx3234 power 209819.74379099914752963711944307E-228 -4 -> 5.1595828494111690910650919776705E+890 Inexact Rounded -remx3234 remainder 209819.74379099914752963711944307E-228 -440230.6700989532467831370320266E-960 -> NaN Division_impossible -subx3234 subtract 209819.74379099914752963711944307E-228 -440230.6700989532467831370320266E-960 -> 2.0981974379099914752963711944307E-223 Inexact Rounded -addx3235 add 2.3488457600415474270259330865184 9182434.6660212482500376220508605E-612 -> 2.3488457600415474270259330865184 Inexact Rounded -comx3235 compare 2.3488457600415474270259330865184 9182434.6660212482500376220508605E-612 -> 1 -divx3235 divide 2.3488457600415474270259330865184 9182434.6660212482500376220508605E-612 -> 2.5579771002708402753412266574941E+605 Inexact Rounded -dvix3235 divideint 2.3488457600415474270259330865184 9182434.6660212482500376220508605E-612 -> NaN Division_impossible -mulx3235 multiply 2.3488457600415474270259330865184 9182434.6660212482500376220508605E-612 -> 2.1568122732142531556215204459407E-605 Inexact Rounded -powx3235 power 2.3488457600415474270259330865184 9 -> 2176.1583446147511579113022622255 Inexact Rounded -remx3235 remainder 2.3488457600415474270259330865184 9182434.6660212482500376220508605E-612 -> NaN Division_impossible -subx3235 subtract 2.3488457600415474270259330865184 9182434.6660212482500376220508605E-612 -> 2.3488457600415474270259330865184 Inexact Rounded -addx3236 add -5107586300197.9703941034404557409 56609.05486055057838678039496686E-768 -> -5107586300197.9703941034404557409 Inexact Rounded -comx3236 compare -5107586300197.9703941034404557409 56609.05486055057838678039496686E-768 -> -1 -divx3236 divide -5107586300197.9703941034404557409 56609.05486055057838678039496686E-768 -> -9.0225606358909877855326357402242E+775 Inexact Rounded -dvix3236 divideint -5107586300197.9703941034404557409 56609.05486055057838678039496686E-768 -> NaN Division_impossible -mulx3236 multiply -5107586300197.9703941034404557409 56609.05486055057838678039496686E-768 -> -2.8913563307290346152596212593532E-751 Inexact Rounded -powx3236 power -5107586300197.9703941034404557409 6 -> 1.7753920894188022125919559565029E+76 Inexact Rounded -remx3236 remainder -5107586300197.9703941034404557409 56609.05486055057838678039496686E-768 -> NaN Division_impossible -subx3236 subtract -5107586300197.9703941034404557409 56609.05486055057838678039496686E-768 -> -5107586300197.9703941034404557409 Inexact Rounded -addx3237 add -70454070095869.70717871212601390 -6200178.370249260009168888392406 -> -70454076296048.077427972135182788 Inexact Rounded -comx3237 compare -70454070095869.70717871212601390 -6200178.370249260009168888392406 -> -1 -divx3237 divide -70454070095869.70717871212601390 -6200178.370249260009168888392406 -> 11363232.779549422490548997517194 Inexact Rounded -dvix3237 divideint -70454070095869.70717871212601390 -6200178.370249260009168888392406 -> 11363232 -mulx3237 multiply -70454070095869.70717871212601390 -6200178.370249260009168888392406 -> 436827801504436566945.76663687924 Inexact Rounded -powx3237 power -70454070095869.70717871212601390 -6200178 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3237 remainder -70454070095869.70717871212601390 -6200178.370249260009168888392406 -> -4833345.467866203920028883583808 -subx3237 subtract -70454070095869.70717871212601390 -6200178.370249260009168888392406 -> -70454063895691.336929452116845012 Inexact Rounded -addx3238 add 29119.220621511046558757900645228 3517612.8810761470018676311863010E-222 -> 29119.220621511046558757900645228 Inexact Rounded -comx3238 compare 29119.220621511046558757900645228 3517612.8810761470018676311863010E-222 -> 1 -divx3238 divide 29119.220621511046558757900645228 3517612.8810761470018676311863010E-222 -> 8.2781197380089684063239752337467E+219 Inexact Rounded -dvix3238 divideint 29119.220621511046558757900645228 3517612.8810761470018676311863010E-222 -> NaN Division_impossible -mulx3238 multiply 29119.220621511046558757900645228 3517612.8810761470018676311863010E-222 -> 1.0243014554512542440592768088600E-211 Inexact Rounded -powx3238 power 29119.220621511046558757900645228 4 -> 718983605328417461.32835984217255 Inexact Rounded -remx3238 remainder 29119.220621511046558757900645228 3517612.8810761470018676311863010E-222 -> NaN Division_impossible -subx3238 subtract 29119.220621511046558757900645228 3517612.8810761470018676311863010E-222 -> 29119.220621511046558757900645228 Inexact Rounded -addx3239 add -5168.2214111091132913776042214525 -5690274.0971173476527123568627720 -> -5695442.3185284567660037344669935 Inexact Rounded -comx3239 compare -5168.2214111091132913776042214525 -5690274.0971173476527123568627720 -> 1 -divx3239 divide -5168.2214111091132913776042214525 -5690274.0971173476527123568627720 -> 0.00090825526554639915580539316714451 Inexact Rounded -dvix3239 divideint -5168.2214111091132913776042214525 -5690274.0971173476527123568627720 -> 0 -mulx3239 multiply -5168.2214111091132913776042214525 -5690274.0971173476527123568627720 -> 29408596423.801454053855793898323 Inexact Rounded -powx3239 power -5168.2214111091132913776042214525 -5690274 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3239 remainder -5168.2214111091132913776042214525 -5690274.0971173476527123568627720 -> -5168.2214111091132913776042214525 -subx3239 subtract -5168.2214111091132913776042214525 -5690274.0971173476527123568627720 -> 5685105.8757062385394209792585505 Inexact Rounded -addx3240 add 33783.060857197067391462144517964 -2070.0806959465088198508322815406 -> 31712.980161250558571611312236423 Inexact Rounded -comx3240 compare 33783.060857197067391462144517964 -2070.0806959465088198508322815406 -> 1 -divx3240 divide 33783.060857197067391462144517964 -2070.0806959465088198508322815406 -> -16.319683055519892881394358449220 Inexact Rounded -dvix3240 divideint 33783.060857197067391462144517964 -2070.0806959465088198508322815406 -> -16 -mulx3240 multiply 33783.060857197067391462144517964 -2070.0806959465088198508322815406 -> -69933662.130469766080574235843448 Inexact Rounded -powx3240 power 33783.060857197067391462144517964 -2070 -> 3.9181336001803008597293818984406E-9375 Inexact Rounded -remx3240 remainder 33783.060857197067391462144517964 -2070.0806959465088198508322815406 -> 661.7697220529262738488280133144 -subx3240 subtract 33783.060857197067391462144517964 -2070.0806959465088198508322815406 -> 35853.141553143576211312976799505 Inexact Rounded -addx3241 add 42207435091050.840296353874733169E-905 73330633078.828216018536326743325E+976 -> 7.3330633078828216018536326743325E+986 Inexact Rounded -comx3241 compare 42207435091050.840296353874733169E-905 73330633078.828216018536326743325E+976 -> -1 -divx3241 divide 42207435091050.840296353874733169E-905 73330633078.828216018536326743325E+976 -> 5.7557712676064206636178247554056E-1879 Inexact Rounded -dvix3241 divideint 42207435091050.840296353874733169E-905 73330633078.828216018536326743325E+976 -> 0 -mulx3241 multiply 42207435091050.840296353874733169E-905 73330633078.828216018536326743325E+976 -> 3.0950979358603075650592433398939E+95 Inexact Rounded -powx3241 power 42207435091050.840296353874733169E-905 7 -> 2.3862872940615283599573082966642E-6240 Inexact Rounded -remx3241 remainder 42207435091050.840296353874733169E-905 73330633078.828216018536326743325E+976 -> 4.2207435091050840296353874733169E-892 -subx3241 subtract 42207435091050.840296353874733169E-905 73330633078.828216018536326743325E+976 -> -7.3330633078828216018536326743325E+986 Inexact Rounded -addx3242 add -71800.806700868784841045406679641 -39617456964250697902519150526701 -> -39617456964250697902519150598502 Inexact Rounded -comx3242 compare -71800.806700868784841045406679641 -39617456964250697902519150526701 -> 1 -divx3242 divide -71800.806700868784841045406679641 -39617456964250697902519150526701 -> 1.8123527405017220178579049964126E-27 Inexact Rounded -dvix3242 divideint -71800.806700868784841045406679641 -39617456964250697902519150526701 -> 0 -mulx3242 multiply -71800.806700868784841045406679641 -39617456964250697902519150526701 -> 2.8445653694701522164901827524538E+36 Inexact Rounded -powx3242 power -71800.806700868784841045406679641 -4 -> 3.7625536850895480882178599428774E-20 Inexact Rounded -remx3242 remainder -71800.806700868784841045406679641 -39617456964250697902519150526701 -> -71800.806700868784841045406679641 -subx3242 subtract -71800.806700868784841045406679641 -39617456964250697902519150526701 -> 39617456964250697902519150454900 Inexact Rounded -addx3243 add 53627480801.631504892310016062160 328259.56947661049313311983109503 -> 53627809061.200981502803149181991 Inexact Rounded -comx3243 compare 53627480801.631504892310016062160 328259.56947661049313311983109503 -> 1 -divx3243 divide 53627480801.631504892310016062160 328259.56947661049313311983109503 -> 163369.13159039717901500465109839 Inexact Rounded -dvix3243 divideint 53627480801.631504892310016062160 328259.56947661049313311983109503 -> 163369 -mulx3243 multiply 53627480801.631504892310016062160 328259.56947661049313311983109503 -> 17603733760058752.363123585224369 Inexact Rounded -powx3243 power 53627480801.631504892310016062160 328260 -> Infinity Overflow Inexact Rounded -remx3243 remainder 53627480801.631504892310016062160 328259.56947661049313311983109503 -> 43195.80712523964536237599604393 -subx3243 subtract 53627480801.631504892310016062160 328259.56947661049313311983109503 -> 53627152542.062028281816882942329 Inexact Rounded -addx3244 add -5052601598.5559371338428368438728 -97855372.224321664785314782556064 -> -5150456970.7802587986281516264289 Inexact Rounded -comx3244 compare -5052601598.5559371338428368438728 -97855372.224321664785314782556064 -> -1 -divx3244 divide -5052601598.5559371338428368438728 -97855372.224321664785314782556064 -> 51.633359351732432283879274192947 Inexact Rounded -dvix3244 divideint -5052601598.5559371338428368438728 -97855372.224321664785314782556064 -> 51 -mulx3244 multiply -5052601598.5559371338428368438728 -97855372.224321664785314782556064 -> 494424210127893893.12581512954787 Inexact Rounded -powx3244 power -5052601598.5559371338428368438728 -97855372 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3244 remainder -5052601598.5559371338428368438728 -97855372.224321664785314782556064 -> -61977615.115532229791782933513536 -subx3244 subtract -5052601598.5559371338428368438728 -97855372.224321664785314782556064 -> -4954746226.3316154690575220613167 Inexact Rounded -addx3245 add 4208134320733.7069742988228068191E+146 4270869.1760149477598920960628392E+471 -> 4.2708691760149477598920960628392E+477 Inexact Rounded -comx3245 compare 4208134320733.7069742988228068191E+146 4270869.1760149477598920960628392E+471 -> -1 -divx3245 divide 4208134320733.7069742988228068191E+146 4270869.1760149477598920960628392E+471 -> 9.8531098643021951048744078027283E-320 Inexact Rounded -dvix3245 divideint 4208134320733.7069742988228068191E+146 4270869.1760149477598920960628392E+471 -> 0 -mulx3245 multiply 4208134320733.7069742988228068191E+146 4270869.1760149477598920960628392E+471 -> 1.7972391158952189002169082753183E+636 Inexact Rounded -powx3245 power 4208134320733.7069742988228068191E+146 4 -> 3.1358723439830872127129821963857E+634 Inexact Rounded -remx3245 remainder 4208134320733.7069742988228068191E+146 4270869.1760149477598920960628392E+471 -> 4.2081343207337069742988228068191E+158 -subx3245 subtract 4208134320733.7069742988228068191E+146 4270869.1760149477598920960628392E+471 -> -4.2708691760149477598920960628392E+477 Inexact Rounded -addx3246 add -8.5077009657942581515590471189084E+308 9652145155.374217047842114042376E-250 -> -8.5077009657942581515590471189084E+308 Inexact Rounded -comx3246 compare -8.5077009657942581515590471189084E+308 9652145155.374217047842114042376E-250 -> -1 -divx3246 divide -8.5077009657942581515590471189084E+308 9652145155.374217047842114042376E-250 -> -8.8143110457236089978070419047970E+548 Inexact Rounded -dvix3246 divideint -8.5077009657942581515590471189084E+308 9652145155.374217047842114042376E-250 -> NaN Division_impossible -mulx3246 multiply -8.5077009657942581515590471189084E+308 9652145155.374217047842114042376E-250 -> -8.2117564660363596283732942091852E+68 Inexact Rounded -powx3246 power -8.5077009657942581515590471189084E+308 10 -> 1.9866536812573207868350640760678E+3089 Inexact Rounded -remx3246 remainder -8.5077009657942581515590471189084E+308 9652145155.374217047842114042376E-250 -> NaN Division_impossible -subx3246 subtract -8.5077009657942581515590471189084E+308 9652145155.374217047842114042376E-250 -> -8.5077009657942581515590471189084E+308 Inexact Rounded -addx3247 add -9504.9703032286960790904181078063E+619 -86.245956949049186533469206485003 -> -9.5049703032286960790904181078063E+622 Inexact Rounded -comx3247 compare -9504.9703032286960790904181078063E+619 -86.245956949049186533469206485003 -> -1 -divx3247 divide -9504.9703032286960790904181078063E+619 -86.245956949049186533469206485003 -> 1.1020772033225707125391212519421E+621 Inexact Rounded -dvix3247 divideint -9504.9703032286960790904181078063E+619 -86.245956949049186533469206485003 -> NaN Division_impossible -mulx3247 multiply -9504.9703032286960790904181078063E+619 -86.245956949049186533469206485003 -> 8.1976525957425311427858087117655E+624 Inexact Rounded -powx3247 power -9504.9703032286960790904181078063E+619 -86 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3247 remainder -9504.9703032286960790904181078063E+619 -86.245956949049186533469206485003 -> NaN Division_impossible -subx3247 subtract -9504.9703032286960790904181078063E+619 -86.245956949049186533469206485003 -> -9.5049703032286960790904181078063E+622 Inexact Rounded -addx3248 add -440220916.66716743026896931194749 -102725.01594377871560564824358775 -> -440323641.68311120898457496019108 Inexact Rounded -comx3248 compare -440220916.66716743026896931194749 -102725.01594377871560564824358775 -> -1 -divx3248 divide -440220916.66716743026896931194749 -102725.01594377871560564824358775 -> 4285.4305022264473269770246126234 Inexact Rounded -dvix3248 divideint -440220916.66716743026896931194749 -102725.01594377871560564824358775 -> 4285 -mulx3248 multiply -440220916.66716743026896931194749 -102725.01594377871560564824358775 -> 45221700683419.655596771711603505 Inexact Rounded -powx3248 power -440220916.66716743026896931194749 -102725 -> -0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3248 remainder -440220916.66716743026896931194749 -102725.01594377871560564824358775 -> -44223.34807563389876658817398125 -subx3248 subtract -440220916.66716743026896931194749 -102725.01594377871560564824358775 -> -440118191.65122365155336366370390 Inexact Rounded -addx3249 add -46.250735086006350517943464758019 14656357555174.263295266074908024 -> 14656357555128.012560180068557506 Inexact Rounded -comx3249 compare -46.250735086006350517943464758019 14656357555174.263295266074908024 -> -1 -divx3249 divide -46.250735086006350517943464758019 14656357555174.263295266074908024 -> -3.1556773169523313932207725522866E-12 Inexact Rounded -dvix3249 divideint -46.250735086006350517943464758019 14656357555174.263295266074908024 -> -0 -mulx3249 multiply -46.250735086006350517943464758019 14656357555174.263295266074908024 -> -677867310610152.55569620459788530 Inexact Rounded -powx3249 power -46.250735086006350517943464758019 1 -> -46.250735086006350517943464758019 -remx3249 remainder -46.250735086006350517943464758019 14656357555174.263295266074908024 -> -46.250735086006350517943464758019 -subx3249 subtract -46.250735086006350517943464758019 14656357555174.263295266074908024 -> -14656357555220.514030352081258542 Inexact Rounded -addx3250 add -61641121299391.316420647102699627E+763 -91896469863.461006903590004188187E+474 -> -6.1641121299391316420647102699627E+776 Inexact Rounded -comx3250 compare -61641121299391.316420647102699627E+763 -91896469863.461006903590004188187E+474 -> -1 -divx3250 divide -61641121299391.316420647102699627E+763 -91896469863.461006903590004188187E+474 -> 6.7076702065897819604716946852581E+291 Inexact Rounded -dvix3250 divideint -61641121299391.316420647102699627E+763 -91896469863.461006903590004188187E+474 -> NaN Division_impossible -mulx3250 multiply -61641121299391.316420647102699627E+763 -91896469863.461006903590004188187E+474 -> 5.6646014458394584921579417504939E+1261 Inexact Rounded -powx3250 power -61641121299391.316420647102699627E+763 -9 -> -7.7833261179975532508748150708605E-6992 Inexact Rounded -remx3250 remainder -61641121299391.316420647102699627E+763 -91896469863.461006903590004188187E+474 -> NaN Division_impossible -subx3250 subtract -61641121299391.316420647102699627E+763 -91896469863.461006903590004188187E+474 -> -6.1641121299391316420647102699627E+776 Inexact Rounded -addx3251 add 96668419802749.555738010239087449E-838 -19498732131365824921639467044927E-542 -> -1.9498732131365824921639467044927E-511 Inexact Rounded -comx3251 compare 96668419802749.555738010239087449E-838 -19498732131365824921639467044927E-542 -> 1 -divx3251 divide 96668419802749.555738010239087449E-838 -19498732131365824921639467044927E-542 -> -4.9576772044192514715453215933704E-314 Inexact Rounded -dvix3251 divideint 96668419802749.555738010239087449E-838 -19498732131365824921639467044927E-542 -> -0 -mulx3251 multiply 96668419802749.555738010239087449E-838 -19498732131365824921639467044927E-542 -> -1.8849116232962331617140676274611E-1335 Inexact Rounded -powx3251 power 96668419802749.555738010239087449E-838 -2 -> 1.0701157625268896323611633350003E+1648 Inexact Rounded -remx3251 remainder 96668419802749.555738010239087449E-838 -19498732131365824921639467044927E-542 -> 9.6668419802749555738010239087449E-825 -subx3251 subtract 96668419802749.555738010239087449E-838 -19498732131365824921639467044927E-542 -> 1.9498732131365824921639467044927E-511 Inexact Rounded -addx3252 add -8534543911197995906031245719519E+124 16487117050031.594886541650897974 -> -8.5345439111979959060312457195190E+154 Inexact Rounded -comx3252 compare -8534543911197995906031245719519E+124 16487117050031.594886541650897974 -> -1 -divx3252 divide -8534543911197995906031245719519E+124 16487117050031.594886541650897974 -> -5.1764925822381062287959523371316E+141 Inexact Rounded -dvix3252 divideint -8534543911197995906031245719519E+124 16487117050031.594886541650897974 -> NaN Division_impossible -mulx3252 multiply -8534543911197995906031245719519E+124 16487117050031.594886541650897974 -> -1.4071002443255581217471698731240E+168 Inexact Rounded -powx3252 power -8534543911197995906031245719519E+124 2 -> 7.2838439772166785429482995041337E+309 Inexact Rounded -remx3252 remainder -8534543911197995906031245719519E+124 16487117050031.594886541650897974 -> NaN Division_impossible -subx3252 subtract -8534543911197995906031245719519E+124 16487117050031.594886541650897974 -> -8.5345439111979959060312457195190E+154 Inexact Rounded -addx3253 add -62663404777.352508979582846931050 9.2570938837239134052589184917186E+916 -> 9.2570938837239134052589184917186E+916 Inexact Rounded -comx3253 compare -62663404777.352508979582846931050 9.2570938837239134052589184917186E+916 -> -1 -divx3253 divide -62663404777.352508979582846931050 9.2570938837239134052589184917186E+916 -> -6.7692307720384142592597124956951E-907 Inexact Rounded -dvix3253 divideint -62663404777.352508979582846931050 9.2570938837239134052589184917186E+916 -> -0 -mulx3253 multiply -62663404777.352508979582846931050 9.2570938837239134052589184917186E+916 -> -5.8008102109774576654709018012876E+927 Inexact Rounded -powx3253 power -62663404777.352508979582846931050 9 -> -1.4897928814133059615670462753825E+97 Inexact Rounded -remx3253 remainder -62663404777.352508979582846931050 9.2570938837239134052589184917186E+916 -> -62663404777.352508979582846931050 -subx3253 subtract -62663404777.352508979582846931050 9.2570938837239134052589184917186E+916 -> -9.2570938837239134052589184917186E+916 Inexact Rounded -addx3254 add 1.744601214474560992754529320172E-827 -17.353669504253419489494030651507E-631 -> -1.7353669504253419489494030651507E-630 Inexact Rounded -comx3254 compare 1.744601214474560992754529320172E-827 -17.353669504253419489494030651507E-631 -> 1 -divx3254 divide 1.744601214474560992754529320172E-827 -17.353669504253419489494030651507E-631 -> -1.0053212169604565230497117966004E-197 Inexact Rounded -dvix3254 divideint 1.744601214474560992754529320172E-827 -17.353669504253419489494030651507E-631 -> -0 -mulx3254 multiply 1.744601214474560992754529320172E-827 -17.353669504253419489494030651507E-631 -> -3.0275232892710668432895049546233E-1457 Inexact Rounded -powx3254 power 1.744601214474560992754529320172E-827 -2 -> 3.2855468099615282394992542515980E+1653 Inexact Rounded -remx3254 remainder 1.744601214474560992754529320172E-827 -17.353669504253419489494030651507E-631 -> 1.744601214474560992754529320172E-827 -subx3254 subtract 1.744601214474560992754529320172E-827 -17.353669504253419489494030651507E-631 -> 1.7353669504253419489494030651507E-630 Inexact Rounded -addx3255 add 0367191549036702224827734853471 4410320662415266533763143837742E+721 -> 4.4103206624152665337631438377420E+751 Inexact Rounded -comx3255 compare 0367191549036702224827734853471 4410320662415266533763143837742E+721 -> -1 -divx3255 divide 0367191549036702224827734853471 4410320662415266533763143837742E+721 -> 8.3257335949720619093963917942525E-723 Inexact Rounded -dvix3255 divideint 0367191549036702224827734853471 4410320662415266533763143837742E+721 -> 0 -mulx3255 multiply 0367191549036702224827734853471 4410320662415266533763143837742E+721 -> 1.6194324757808363802947192054966E+781 Inexact Rounded -powx3255 power 0367191549036702224827734853471 4 -> 1.8179030119354318182493703269258E+118 Inexact Rounded -remx3255 remainder 0367191549036702224827734853471 4410320662415266533763143837742E+721 -> 367191549036702224827734853471 -subx3255 subtract 0367191549036702224827734853471 4410320662415266533763143837742E+721 -> -4.4103206624152665337631438377420E+751 Inexact Rounded -addx3256 add 097704116.4492566721965710365073 -96736.400939809433556067504289145 -> 97607380.048316862763014969003011 Inexact Rounded -comx3256 compare 097704116.4492566721965710365073 -96736.400939809433556067504289145 -> 1 -divx3256 divide 097704116.4492566721965710365073 -96736.400939809433556067504289145 -> -1010.0036335861757252324592571874 Inexact Rounded -dvix3256 divideint 097704116.4492566721965710365073 -96736.400939809433556067504289145 -> -1010 -mulx3256 multiply 097704116.4492566721965710365073 -96736.400939809433556067504289145 -> -9451544582305.1234805483449772252 Inexact Rounded -powx3256 power 097704116.4492566721965710365073 -96736 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3256 remainder 097704116.4492566721965710365073 -96736.400939809433556067504289145 -> 351.500049144304942857175263550 -subx3256 subtract 097704116.4492566721965710365073 -96736.400939809433556067504289145 -> 97800852.850196481630127104011589 Inexact Rounded -addx3257 add 19533298.147150158931958733807878 80.141668338350708476637377647025E-641 -> 19533298.147150158931958733807878 Inexact Rounded -comx3257 compare 19533298.147150158931958733807878 80.141668338350708476637377647025E-641 -> 1 -divx3257 divide 19533298.147150158931958733807878 80.141668338350708476637377647025E-641 -> 2.4373460837728485395672882395171E+646 Inexact Rounded -dvix3257 divideint 19533298.147150158931958733807878 80.141668338350708476637377647025E-641 -> NaN Division_impossible -mulx3257 multiply 19533298.147150158931958733807878 80.141668338350708476637377647025E-641 -> 1.5654311016630284502459158971272E-632 Inexact Rounded -powx3257 power 19533298.147150158931958733807878 8 -> 2.1193595047638230427530063654613E+58 Inexact Rounded -remx3257 remainder 19533298.147150158931958733807878 80.141668338350708476637377647025E-641 -> NaN Division_impossible -subx3257 subtract 19533298.147150158931958733807878 80.141668338350708476637377647025E-641 -> 19533298.147150158931958733807878 Inexact Rounded -addx3258 add -23765003221220177430797028997378 -15203369569.373411506379096871224E-945 -> -23765003221220177430797028997378 Inexact Rounded -comx3258 compare -23765003221220177430797028997378 -15203369569.373411506379096871224E-945 -> -1 -divx3258 divide -23765003221220177430797028997378 -15203369569.373411506379096871224E-945 -> 1.5631405336020930064824135669541E+966 Inexact Rounded -dvix3258 divideint -23765003221220177430797028997378 -15203369569.373411506379096871224E-945 -> NaN Division_impossible -mulx3258 multiply -23765003221220177430797028997378 -15203369569.373411506379096871224E-945 -> 3.6130812678955994625210007005216E-904 Inexact Rounded -powx3258 power -23765003221220177430797028997378 -2 -> 1.7706154318483481190364979209436E-63 Inexact Rounded -remx3258 remainder -23765003221220177430797028997378 -15203369569.373411506379096871224E-945 -> NaN Division_impossible -subx3258 subtract -23765003221220177430797028997378 -15203369569.373411506379096871224E-945 -> -23765003221220177430797028997378 Inexact Rounded -addx3259 add 129255.41937932433359193338910552E+932 -281253953.38990382799508873560320 -> 1.2925541937932433359193338910552E+937 Inexact Rounded -comx3259 compare 129255.41937932433359193338910552E+932 -281253953.38990382799508873560320 -> 1 -divx3259 divide 129255.41937932433359193338910552E+932 -281253953.38990382799508873560320 -> -4.5956836453828213050223260551064E+928 Inexact Rounded -dvix3259 divideint 129255.41937932433359193338910552E+932 -281253953.38990382799508873560320 -> NaN Division_impossible -mulx3259 multiply 129255.41937932433359193338910552E+932 -281253953.38990382799508873560320 -> -3.6353597697504958096931088780367E+945 Inexact Rounded -powx3259 power 129255.41937932433359193338910552E+932 -281253953 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3259 remainder 129255.41937932433359193338910552E+932 -281253953.38990382799508873560320 -> NaN Division_impossible -subx3259 subtract 129255.41937932433359193338910552E+932 -281253953.38990382799508873560320 -> 1.2925541937932433359193338910552E+937 Inexact Rounded -addx3260 add -86863.276249466008289214762980838 531.50602652732088208397655484476 -> -86331.770222938687407130786425993 Inexact Rounded -comx3260 compare -86863.276249466008289214762980838 531.50602652732088208397655484476 -> -1 -divx3260 divide -86863.276249466008289214762980838 531.50602652732088208397655484476 -> -163.42858201815891408475902229649 Inexact Rounded -dvix3260 divideint -86863.276249466008289214762980838 531.50602652732088208397655484476 -> -163 -mulx3260 multiply -86863.276249466008289214762980838 531.50602652732088208397655484476 -> -46168354.810498682140456143534524 Inexact Rounded -powx3260 power -86863.276249466008289214762980838 532 -> 2.8897579184173839519859710217510E+2627 Inexact Rounded -remx3260 remainder -86863.276249466008289214762980838 531.50602652732088208397655484476 -> -227.79392551270450952658454114212 -subx3260 subtract -86863.276249466008289214762980838 531.50602652732088208397655484476 -> -87394.782275993329171298739535683 Inexact Rounded -addx3261 add -40707.169006771111855573524157083 -68795521421321853333274411827749 -> -68795521421321853333274411868456 Inexact Rounded -comx3261 compare -40707.169006771111855573524157083 -68795521421321853333274411827749 -> 1 -divx3261 divide -40707.169006771111855573524157083 -68795521421321853333274411827749 -> 5.9171248601300236694386185513139E-28 Inexact Rounded -dvix3261 divideint -40707.169006771111855573524157083 -68795521421321853333274411827749 -> 0 -mulx3261 multiply -40707.169006771111855573524157083 -68795521421321853333274411827749 -> 2.8004709174066910577370895499575E+36 Inexact Rounded -powx3261 power -40707.169006771111855573524157083 -7 -> -5.3988802915897595722440392884051E-33 Inexact Rounded -remx3261 remainder -40707.169006771111855573524157083 -68795521421321853333274411827749 -> -40707.169006771111855573524157083 -subx3261 subtract -40707.169006771111855573524157083 -68795521421321853333274411827749 -> 68795521421321853333274411787042 Inexact Rounded -addx3262 add -90838752568673.728630494658778003E+095 -738.01370301217606577533107981431 -> -9.0838752568673728630494658778003E+108 Inexact Rounded -comx3262 compare -90838752568673.728630494658778003E+095 -738.01370301217606577533107981431 -> -1 -divx3262 divide -90838752568673.728630494658778003E+095 -738.01370301217606577533107981431 -> 1.2308545518588430875268553851424E+106 Inexact Rounded -dvix3262 divideint -90838752568673.728630494658778003E+095 -738.01370301217606577533107981431 -> NaN Division_impossible -mulx3262 multiply -90838752568673.728630494658778003E+095 -738.01370301217606577533107981431 -> 6.7040244160213718891633678248127E+111 Inexact Rounded -powx3262 power -90838752568673.728630494658778003E+095 -738 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3262 remainder -90838752568673.728630494658778003E+095 -738.01370301217606577533107981431 -> NaN Division_impossible -subx3262 subtract -90838752568673.728630494658778003E+095 -738.01370301217606577533107981431 -> -9.0838752568673728630494658778003E+108 Inexact Rounded -addx3263 add -4245360967593.9206771555839718158E-682 -3.119606239042530207103203508057 -> -3.1196062390425302071032035080570 Inexact Rounded -comx3263 compare -4245360967593.9206771555839718158E-682 -3.119606239042530207103203508057 -> 1 -divx3263 divide -4245360967593.9206771555839718158E-682 -3.119606239042530207103203508057 -> 1.3608643662980066356437236081969E-670 Inexact Rounded -dvix3263 divideint -4245360967593.9206771555839718158E-682 -3.119606239042530207103203508057 -> 0 -mulx3263 multiply -4245360967593.9206771555839718158E-682 -3.119606239042530207103203508057 -> 1.3243854561493627844105290415330E-669 Inexact Rounded -powx3263 power -4245360967593.9206771555839718158E-682 -3 -> -1.3069414504933253288042820429894E+2008 Inexact Rounded -remx3263 remainder -4245360967593.9206771555839718158E-682 -3.119606239042530207103203508057 -> -4.2453609675939206771555839718158E-670 -subx3263 subtract -4245360967593.9206771555839718158E-682 -3.119606239042530207103203508057 -> 3.1196062390425302071032035080570 Inexact Rounded -addx3264 add -3422145405774.0800213000547612240E-023 -60810.964656409650839011321706310 -> -60810.964656409685060465379447110 Inexact Rounded -comx3264 compare -3422145405774.0800213000547612240E-023 -60810.964656409650839011321706310 -> 1 -divx3264 divide -3422145405774.0800213000547612240E-023 -60810.964656409650839011321706310 -> 5.6275137635287882875914124742650E-16 Inexact Rounded -dvix3264 divideint -3422145405774.0800213000547612240E-023 -60810.964656409650839011321706310 -> 0 -mulx3264 multiply -3422145405774.0800213000547612240E-023 -60810.964656409650839011321706310 -> 0.0000020810396331962224323288744910607 Inexact Rounded -powx3264 power -3422145405774.0800213000547612240E-023 -60811 -> -Infinity Overflow Inexact Rounded -remx3264 remainder -3422145405774.0800213000547612240E-023 -60810.964656409650839011321706310 -> -3.4221454057740800213000547612240E-11 -subx3264 subtract -3422145405774.0800213000547612240E-023 -60810.964656409650839011321706310 -> 60810.964656409616617557263965510 Inexact Rounded -addx3265 add -24521811.07649485796598387627478E-661 -94860846133404815410816234000694 -> -94860846133404815410816234000694 Inexact Rounded -comx3265 compare -24521811.07649485796598387627478E-661 -94860846133404815410816234000694 -> 1 -divx3265 divide -24521811.07649485796598387627478E-661 -94860846133404815410816234000694 -> 2.5850297647576657819483988845904E-686 Inexact Rounded -dvix3265 divideint -24521811.07649485796598387627478E-661 -94860846133404815410816234000694 -> 0 -mulx3265 multiply -24521811.07649485796598387627478E-661 -94860846133404815410816234000694 -> 2.3261597474398006215017751785104E-622 Inexact Rounded -powx3265 power -24521811.07649485796598387627478E-661 -9 -> -3.1190843559949184618590264246586E+5882 Inexact Rounded -remx3265 remainder -24521811.07649485796598387627478E-661 -94860846133404815410816234000694 -> -2.452181107649485796598387627478E-654 -subx3265 subtract -24521811.07649485796598387627478E-661 -94860846133404815410816234000694 -> 94860846133404815410816234000694 Inexact Rounded -addx3266 add -5042529937498.8944492248538951438 3891904674.4549170968807145612549 -> -5038638032824.4395321279731805825 Inexact Rounded -comx3266 compare -5042529937498.8944492248538951438 3891904674.4549170968807145612549 -> -1 -divx3266 divide -5042529937498.8944492248538951438 3891904674.4549170968807145612549 -> -1295.6457979549894351378127413283 Inexact Rounded -dvix3266 divideint -5042529937498.8944492248538951438 3891904674.4549170968807145612549 -> -1295 -mulx3266 multiply -5042529937498.8944492248538951438 3891904674.4549170968807145612549 -> -19625045834830808256871.952659048 Inexact Rounded -powx3266 power -5042529937498.8944492248538951438 4 -> 6.4653782991800009492580180960839E+50 Inexact Rounded -remx3266 remainder -5042529937498.8944492248538951438 3891904674.4549170968807145612549 -> -2513384079.7768087643285383187045 -subx3266 subtract -5042529937498.8944492248538951438 3891904674.4549170968807145612549 -> -5046421842173.3493663217346097051 Inexact Rounded -addx3267 add -535824163.54531747646293693868651E-665 2732988.5891363639325008206099712 -> 2732988.5891363639325008206099712 Inexact Rounded -comx3267 compare -535824163.54531747646293693868651E-665 2732988.5891363639325008206099712 -> -1 -divx3267 divide -535824163.54531747646293693868651E-665 2732988.5891363639325008206099712 -> -1.9605795855687791246611683328346E-663 Inexact Rounded -dvix3267 divideint -535824163.54531747646293693868651E-665 2732988.5891363639325008206099712 -> -0 -mulx3267 multiply -535824163.54531747646293693868651E-665 2732988.5891363639325008206099712 -> -1.4644013247528895376254850705597E-650 Inexact Rounded -powx3267 power -535824163.54531747646293693868651E-665 2732989 -> -0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3267 remainder -535824163.54531747646293693868651E-665 2732988.5891363639325008206099712 -> -5.3582416354531747646293693868651E-657 -subx3267 subtract -535824163.54531747646293693868651E-665 2732988.5891363639325008206099712 -> -2732988.5891363639325008206099712 Inexact Rounded -addx3268 add 24032.702008553084252925140858134E-509 52864854.899420632375589206704068 -> 52864854.899420632375589206704068 Inexact Rounded -comx3268 compare 24032.702008553084252925140858134E-509 52864854.899420632375589206704068 -> -1 -divx3268 divide 24032.702008553084252925140858134E-509 52864854.899420632375589206704068 -> 4.5460641203455697917573431961511E-513 Inexact Rounded -dvix3268 divideint 24032.702008553084252925140858134E-509 52864854.899420632375589206704068 -> 0 -mulx3268 multiply 24032.702008553084252925140858134E-509 52864854.899420632375589206704068 -> 1.2704853045231735885074945710576E-497 Inexact Rounded -powx3268 power 24032.702008553084252925140858134E-509 52864855 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3268 remainder 24032.702008553084252925140858134E-509 52864854.899420632375589206704068 -> 2.4032702008553084252925140858134E-505 -subx3268 subtract 24032.702008553084252925140858134E-509 52864854.899420632375589206704068 -> -52864854.899420632375589206704068 Inexact Rounded -addx3269 add 71553220259.938950698030519906727E-496 754.44220417415325444943566016062 -> 754.44220417415325444943566016062 Inexact Rounded -comx3269 compare 71553220259.938950698030519906727E-496 754.44220417415325444943566016062 -> -1 -divx3269 divide 71553220259.938950698030519906727E-496 754.44220417415325444943566016062 -> 9.4842547068617879794218050008353E-489 Inexact Rounded -dvix3269 divideint 71553220259.938950698030519906727E-496 754.44220417415325444943566016062 -> 0 -mulx3269 multiply 71553220259.938950698030519906727E-496 754.44220417415325444943566016062 -> 5.3982769208667021044675146787248E-483 Inexact Rounded -powx3269 power 71553220259.938950698030519906727E-496 754 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3269 remainder 71553220259.938950698030519906727E-496 754.44220417415325444943566016062 -> 7.1553220259938950698030519906727E-486 -subx3269 subtract 71553220259.938950698030519906727E-496 754.44220417415325444943566016062 -> -754.44220417415325444943566016062 Inexact Rounded -addx3270 add 35572.960284795962697740953932508 520.39506364687594082725754878910E-731 -> 35572.960284795962697740953932508 Inexact Rounded -comx3270 compare 35572.960284795962697740953932508 520.39506364687594082725754878910E-731 -> 1 -divx3270 divide 35572.960284795962697740953932508 520.39506364687594082725754878910E-731 -> 6.8357605153869556504869061469852E+732 Inexact Rounded -dvix3270 divideint 35572.960284795962697740953932508 520.39506364687594082725754878910E-731 -> NaN Division_impossible -mulx3270 multiply 35572.960284795962697740953932508 520.39506364687594082725754878910E-731 -> 1.8511992931514185102474609686066E-724 Inexact Rounded -powx3270 power 35572.960284795962697740953932508 5 -> 56963942247985404337401.149353169 Inexact Rounded -remx3270 remainder 35572.960284795962697740953932508 520.39506364687594082725754878910E-731 -> NaN Division_impossible -subx3270 subtract 35572.960284795962697740953932508 520.39506364687594082725754878910E-731 -> 35572.960284795962697740953932508 Inexact Rounded -addx3271 add 53035405018123760598334895413057E+818 -9558464247240.4476790042911379151 -> 5.3035405018123760598334895413057E+849 Inexact Rounded -comx3271 compare 53035405018123760598334895413057E+818 -9558464247240.4476790042911379151 -> 1 -divx3271 divide 53035405018123760598334895413057E+818 -9558464247240.4476790042911379151 -> -5.5485278436266802470202487233285E+836 Inexact Rounded -dvix3271 divideint 53035405018123760598334895413057E+818 -9558464247240.4476790042911379151 -> NaN Division_impossible -mulx3271 multiply 53035405018123760598334895413057E+818 -9558464247240.4476790042911379151 -> -5.0693702270365259274203181894613E+862 Inexact Rounded -powx3271 power 53035405018123760598334895413057E+818 -10 -> 5.6799053935427267944455848135618E-8498 Inexact Rounded -remx3271 remainder 53035405018123760598334895413057E+818 -9558464247240.4476790042911379151 -> NaN Division_impossible -subx3271 subtract 53035405018123760598334895413057E+818 -9558464247240.4476790042911379151 -> 5.3035405018123760598334895413057E+849 Inexact Rounded -addx3272 add 95.490751127249945886828257312118 987.01498316307365714167410690192E+133 -> 9.8701498316307365714167410690192E+135 Inexact Rounded -comx3272 compare 95.490751127249945886828257312118 987.01498316307365714167410690192E+133 -> -1 -divx3272 divide 95.490751127249945886828257312118 987.01498316307365714167410690192E+133 -> 9.6747012716293341927566515915016E-135 Inexact Rounded -dvix3272 divideint 95.490751127249945886828257312118 987.01498316307365714167410690192E+133 -> 0 -mulx3272 multiply 95.490751127249945886828257312118 987.01498316307365714167410690192E+133 -> 9.4250802116091862185764800227004E+137 Inexact Rounded -powx3272 power 95.490751127249945886828257312118 10 -> 63039548646186864162.847491534337 Inexact Rounded -remx3272 remainder 95.490751127249945886828257312118 987.01498316307365714167410690192E+133 -> 95.490751127249945886828257312118 -subx3272 subtract 95.490751127249945886828257312118 987.01498316307365714167410690192E+133 -> -9.8701498316307365714167410690192E+135 Inexact Rounded -addx3273 add 69434850287.460788550936730296153 -35119136549015044241569827542264 -> -35119136549015044241500392691977 Inexact Rounded -comx3273 compare 69434850287.460788550936730296153 -35119136549015044241569827542264 -> 1 -divx3273 divide 69434850287.460788550936730296153 -35119136549015044241569827542264 -> -1.9771229338327273644129394734299E-21 Inexact Rounded -dvix3273 divideint 69434850287.460788550936730296153 -35119136549015044241569827542264 -> -0 -mulx3273 multiply 69434850287.460788550936730296153 -35119136549015044241569827542264 -> -2.4384919885057519302646522425980E+42 Inexact Rounded -powx3273 power 69434850287.460788550936730296153 -4 -> 4.3021939605842038995370443743844E-44 Inexact Rounded -remx3273 remainder 69434850287.460788550936730296153 -35119136549015044241569827542264 -> 69434850287.460788550936730296153 -subx3273 subtract 69434850287.460788550936730296153 -35119136549015044241569827542264 -> 35119136549015044241639262392551 Inexact Rounded -addx3274 add -392.22739924621965621739098725407 -65551274.987160998195282109612136 -> -65551667.214560244414938327003123 Inexact Rounded -comx3274 compare -392.22739924621965621739098725407 -65551274.987160998195282109612136 -> 1 -divx3274 divide -392.22739924621965621739098725407 -65551274.987160998195282109612136 -> 0.0000059835205237890809449684317245033 Inexact Rounded -dvix3274 divideint -392.22739924621965621739098725407 -65551274.987160998195282109612136 -> 0 -mulx3274 multiply -392.22739924621965621739098725407 -65551274.987160998195282109612136 -> 25711006105.487929108329637701882 Inexact Rounded -powx3274 power -392.22739924621965621739098725407 -65551275 -> -0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3274 remainder -392.22739924621965621739098725407 -65551274.987160998195282109612136 -> -392.22739924621965621739098725407 -subx3274 subtract -392.22739924621965621739098725407 -65551274.987160998195282109612136 -> 65550882.759761751975625892221149 Inexact Rounded -addx3275 add 6413265.4423561191792972085539457 24514.222704714139350026165721146 -> 6437779.6650608333186472347196668 Inexact Rounded -comx3275 compare 6413265.4423561191792972085539457 24514.222704714139350026165721146 -> 1 -divx3275 divide 6413265.4423561191792972085539457 24514.222704714139350026165721146 -> 261.61406460270241498757868681883 Inexact Rounded -dvix3275 divideint 6413265.4423561191792972085539457 24514.222704714139350026165721146 -> 261 -mulx3275 multiply 6413265.4423561191792972085539457 24514.222704714139350026165721146 -> 157216217318.36494525300694583138 Inexact Rounded -powx3275 power 6413265.4423561191792972085539457 24514 -> Infinity Overflow Inexact Rounded -remx3275 remainder 6413265.4423561191792972085539457 24514.222704714139350026165721146 -> 15053.316425728808940379300726594 -subx3275 subtract 6413265.4423561191792972085539457 24514.222704714139350026165721146 -> 6388751.2196514050399471823882246 Inexact Rounded -addx3276 add -6.9667706389122107760046184064057E+487 32.405810703971538278419625527234 -> -6.9667706389122107760046184064057E+487 Inexact Rounded -comx3276 compare -6.9667706389122107760046184064057E+487 32.405810703971538278419625527234 -> -1 -divx3276 divide -6.9667706389122107760046184064057E+487 32.405810703971538278419625527234 -> -2.1498522911689997341347293419761E+486 Inexact Rounded -dvix3276 divideint -6.9667706389122107760046184064057E+487 32.405810703971538278419625527234 -> NaN Division_impossible -mulx3276 multiply -6.9667706389122107760046184064057E+487 32.405810703971538278419625527234 -> -2.2576385054257595259511556258470E+489 Inexact Rounded -powx3276 power -6.9667706389122107760046184064057E+487 32 -> Infinity Overflow Inexact Rounded -remx3276 remainder -6.9667706389122107760046184064057E+487 32.405810703971538278419625527234 -> NaN Division_impossible -subx3276 subtract -6.9667706389122107760046184064057E+487 32.405810703971538278419625527234 -> -6.9667706389122107760046184064057E+487 Inexact Rounded -addx3277 add 378204716633.40024100602896057615 -0300218714378.322231269606216516 -> 77986002255.07800973642274406015 -comx3277 compare 378204716633.40024100602896057615 -0300218714378.322231269606216516 -> 1 -divx3277 divide 378204716633.40024100602896057615 -0300218714378.322231269606216516 -> -1.2597639604731753284599748820876 Inexact Rounded -dvix3277 divideint 378204716633.40024100602896057615 -0300218714378.322231269606216516 -> -1 -mulx3277 multiply 378204716633.40024100602896057615 -0300218714378.322231269606216516 -> -113544133799497082075557.21180430 Inexact Rounded -powx3277 power 378204716633.40024100602896057615 -3 -> 1.8484988212401886887562779996737E-35 Inexact Rounded -remx3277 remainder 378204716633.40024100602896057615 -0300218714378.322231269606216516 -> 77986002255.07800973642274406015 -subx3277 subtract 378204716633.40024100602896057615 -0300218714378.322231269606216516 -> 678423431011.72247227563517709215 -addx3278 add -44234.512012457148027685282969235E+501 2132572.4571987908375002100894927 -> -4.4234512012457148027685282969235E+505 Inexact Rounded -comx3278 compare -44234.512012457148027685282969235E+501 2132572.4571987908375002100894927 -> -1 -divx3278 divide -44234.512012457148027685282969235E+501 2132572.4571987908375002100894927 -> -2.0742325477916347193181603963257E+499 Inexact Rounded -dvix3278 divideint -44234.512012457148027685282969235E+501 2132572.4571987908375002100894927 -> NaN Division_impossible -mulx3278 multiply -44234.512012457148027685282969235E+501 2132572.4571987908375002100894927 -> -9.4333301975395170465982968019915E+511 Inexact Rounded -powx3278 power -44234.512012457148027685282969235E+501 2132572 -> Infinity Overflow Inexact Rounded -remx3278 remainder -44234.512012457148027685282969235E+501 2132572.4571987908375002100894927 -> NaN Division_impossible -subx3278 subtract -44234.512012457148027685282969235E+501 2132572.4571987908375002100894927 -> -4.4234512012457148027685282969235E+505 Inexact Rounded -addx3279 add -3554.5895974968741465654022772100E-073 9752.0428746722497621936998533848E+516 -> 9.7520428746722497621936998533848E+519 Inexact Rounded -comx3279 compare -3554.5895974968741465654022772100E-073 9752.0428746722497621936998533848E+516 -> -1 -divx3279 divide -3554.5895974968741465654022772100E-073 9752.0428746722497621936998533848E+516 -> -3.6449692061227100572768330912162E-590 Inexact Rounded -dvix3279 divideint -3554.5895974968741465654022772100E-073 9752.0428746722497621936998533848E+516 -> -0 -mulx3279 multiply -3554.5895974968741465654022772100E-073 9752.0428746722497621936998533848E+516 -> -3.4664510156653491769901435777060E+450 Inexact Rounded -powx3279 power -3554.5895974968741465654022772100E-073 10 -> 3.2202875716019266933215387456197E-695 Inexact Rounded -remx3279 remainder -3554.5895974968741465654022772100E-073 9752.0428746722497621936998533848E+516 -> -3.5545895974968741465654022772100E-70 -subx3279 subtract -3554.5895974968741465654022772100E-073 9752.0428746722497621936998533848E+516 -> -9.7520428746722497621936998533848E+519 Inexact Rounded -addx3280 add 750187685.63632608923397234391668 4633194252863.6730625972669246025 -> 4633944440549.3093886865008969464 Inexact Rounded -comx3280 compare 750187685.63632608923397234391668 4633194252863.6730625972669246025 -> -1 -divx3280 divide 750187685.63632608923397234391668 4633194252863.6730625972669246025 -> 0.00016191587157664541463871807382759 Inexact Rounded -dvix3280 divideint 750187685.63632608923397234391668 4633194252863.6730625972669246025 -> 0 -mulx3280 multiply 750187685.63632608923397234391668 4633194252863.6730625972669246025 -> 3475765273659325895012.7612107556 Inexact Rounded -powx3280 power 750187685.63632608923397234391668 5 -> 2.3760176068829529745152188798557E+44 Inexact Rounded -remx3280 remainder 750187685.63632608923397234391668 4633194252863.6730625972669246025 -> 750187685.63632608923397234391668 -subx3280 subtract 750187685.63632608923397234391668 4633194252863.6730625972669246025 -> -4632444065178.0367365080329522586 Inexact Rounded -addx3281 add 30190034242853.251165951457589386E-028 8038885676.3204238322976087799751E+018 -> 8038885676320423832297608779.9751 Inexact Rounded -comx3281 compare 30190034242853.251165951457589386E-028 8038885676.3204238322976087799751E+018 -> -1 -divx3281 divide 30190034242853.251165951457589386E-028 8038885676.3204238322976087799751E+018 -> 3.7554998862319807295903348960280E-43 Inexact Rounded -dvix3281 divideint 30190034242853.251165951457589386E-028 8038885676.3204238322976087799751E+018 -> 0 -mulx3281 multiply 30190034242853.251165951457589386E-028 8038885676.3204238322976087799751E+018 -> 24269423384249.611263728854793731 Inexact Rounded -powx3281 power 30190034242853.251165951457589386E-028 8 -> 6.9009494305612589578332690692113E-117 Inexact Rounded -remx3281 remainder 30190034242853.251165951457589386E-028 8038885676.3204238322976087799751E+018 -> 3.0190034242853251165951457589386E-15 -subx3281 subtract 30190034242853.251165951457589386E-028 8038885676.3204238322976087799751E+018 -> -8038885676320423832297608779.9751 Inexact Rounded -addx3282 add 65.537942676774715953400768803539 125946917260.87536506197191782198 -> 125946917326.41330773874663377538 Inexact Rounded -comx3282 compare 65.537942676774715953400768803539 125946917260.87536506197191782198 -> -1 -divx3282 divide 65.537942676774715953400768803539 125946917260.87536506197191782198 -> 5.2036162616846894920389414735878E-10 Inexact Rounded -dvix3282 divideint 65.537942676774715953400768803539 125946917260.87536506197191782198 -> 0 -mulx3282 multiply 65.537942676774715953400768803539 125946917260.87536506197191782198 -> 8254301843759.7376990957355411370 Inexact Rounded -powx3282 power 65.537942676774715953400768803539 1 -> 65.537942676774715953400768803539 -remx3282 remainder 65.537942676774715953400768803539 125946917260.87536506197191782198 -> 65.537942676774715953400768803539 -subx3282 subtract 65.537942676774715953400768803539 125946917260.87536506197191782198 -> -125946917195.33742238519720186858 Inexact Rounded -addx3283 add 8015272348677.5489394183881813700 949.23027111499779258284877920022 -> 8015272349626.7792105333859739528 Inexact Rounded -comx3283 compare 8015272348677.5489394183881813700 949.23027111499779258284877920022 -> 1 -divx3283 divide 8015272348677.5489394183881813700 949.23027111499779258284877920022 -> 8443970438.5560107978790084430110 Inexact Rounded -dvix3283 divideint 8015272348677.5489394183881813700 949.23027111499779258284877920022 -> 8443970438 -mulx3283 multiply 8015272348677.5489394183881813700 949.23027111499779258284877920022 -> 7608339144595734.8984281431471741 Inexact Rounded -powx3283 power 8015272348677.5489394183881813700 949 -> Infinity Overflow Inexact Rounded -remx3283 remainder 8015272348677.5489394183881813700 949.23027111499779258284877920022 -> 527.78228041355742397895303690364 -subx3283 subtract 8015272348677.5489394183881813700 949.23027111499779258284877920022 -> 8015272347728.3186683033903887872 Inexact Rounded -addx3284 add -32595333982.67068622120451804225 69130.052233649808750113141502465E-862 -> -32595333982.670686221204518042250 Inexact Rounded -comx3284 compare -32595333982.67068622120451804225 69130.052233649808750113141502465E-862 -> -1 -divx3284 divide -32595333982.67068622120451804225 69130.052233649808750113141502465E-862 -> -4.7150744038935574574681609457727E+867 Inexact Rounded -dvix3284 divideint -32595333982.67068622120451804225 69130.052233649808750113141502465E-862 -> NaN Division_impossible -mulx3284 multiply -32595333982.67068622120451804225 69130.052233649808750113141502465E-862 -> -2.2533171407952851885446213697715E-847 Inexact Rounded -powx3284 power -32595333982.67068622120451804225 7 -> -3.9092014148031739666525606093306E+73 Inexact Rounded -remx3284 remainder -32595333982.67068622120451804225 69130.052233649808750113141502465E-862 -> NaN Division_impossible -subx3284 subtract -32595333982.67068622120451804225 69130.052233649808750113141502465E-862 -> -32595333982.670686221204518042250 Inexact Rounded -addx3285 add -17544189017145.710117633021800426E-537 292178000.06450804618299520094843 -> 292178000.06450804618299520094843 Inexact Rounded -comx3285 compare -17544189017145.710117633021800426E-537 292178000.06450804618299520094843 -> -1 -divx3285 divide -17544189017145.710117633021800426E-537 292178000.06450804618299520094843 -> -6.0046235559392715334668277026896E-533 Inexact Rounded -dvix3285 divideint -17544189017145.710117633021800426E-537 292178000.06450804618299520094843 -> -0 -mulx3285 multiply -17544189017145.710117633021800426E-537 292178000.06450804618299520094843 -> -5.1260260597833406461110136952456E-516 Inexact Rounded -powx3285 power -17544189017145.710117633021800426E-537 292178000 -> 0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3285 remainder -17544189017145.710117633021800426E-537 292178000.06450804618299520094843 -> -1.7544189017145710117633021800426E-524 -subx3285 subtract -17544189017145.710117633021800426E-537 292178000.06450804618299520094843 -> -292178000.06450804618299520094843 Inexact Rounded -addx3286 add -506650.99395649907139204052441630 11.018427502031650148962067367158 -> -506639.97552899703974189156234893 Inexact Rounded -comx3286 compare -506650.99395649907139204052441630 11.018427502031650148962067367158 -> -1 -divx3286 divide -506650.99395649907139204052441630 11.018427502031650148962067367158 -> -45982.150707356329027698717189104 Inexact Rounded -dvix3286 divideint -506650.99395649907139204052441630 11.018427502031650148962067367158 -> -45982 -mulx3286 multiply -506650.99395649907139204052441630 11.018427502031650148962067367158 -> -5582497.2457419607392940234271222 Inexact Rounded -powx3286 power -506650.99395649907139204052441630 11 -> -5.6467412678809885333313818078829E+62 Inexact Rounded -remx3286 remainder -506650.99395649907139204052441630 11.018427502031650148962067367158 -> -1.660558079734242466742739640844 -subx3286 subtract -506650.99395649907139204052441630 11.018427502031650148962067367158 -> -506662.01238400110304218948648367 Inexact Rounded -addx3287 add 4846835159.5922372307656000769395E-241 -84.001893040865864590122330800768 -> -84.001893040865864590122330800768 Inexact Rounded -comx3287 compare 4846835159.5922372307656000769395E-241 -84.001893040865864590122330800768 -> 1 -divx3287 divide 4846835159.5922372307656000769395E-241 -84.001893040865864590122330800768 -> -5.7699118247660357814641813260524E-234 Inexact Rounded -dvix3287 divideint 4846835159.5922372307656000769395E-241 -84.001893040865864590122330800768 -> -0 -mulx3287 multiply 4846835159.5922372307656000769395E-241 -84.001893040865864590122330800768 -> -4.0714332866277514481192856925775E-230 Inexact Rounded -powx3287 power 4846835159.5922372307656000769395E-241 -84 -> Infinity Overflow Inexact Rounded -remx3287 remainder 4846835159.5922372307656000769395E-241 -84.001893040865864590122330800768 -> 4.8468351595922372307656000769395E-232 -subx3287 subtract 4846835159.5922372307656000769395E-241 -84.001893040865864590122330800768 -> 84.001893040865864590122330800768 Inexact Rounded -addx3288 add -35.029311013822259358116556164908 -3994308878.1994645313414534209127 -> -3994308913.2287755451637127790293 Inexact Rounded -comx3288 compare -35.029311013822259358116556164908 -3994308878.1994645313414534209127 -> 1 -divx3288 divide -35.029311013822259358116556164908 -3994308878.1994645313414534209127 -> 8.7698052609323004543538163061774E-9 Inexact Rounded -dvix3288 divideint -35.029311013822259358116556164908 -3994308878.1994645313414534209127 -> 0 -mulx3288 multiply -35.029311013822259358116556164908 -3994308878.1994645313414534209127 -> 139917887979.72053637272961120639 Inexact Rounded -powx3288 power -35.029311013822259358116556164908 -4 -> 6.6416138040522124693495178218096E-7 Inexact Rounded -remx3288 remainder -35.029311013822259358116556164908 -3994308878.1994645313414534209127 -> -35.029311013822259358116556164908 -subx3288 subtract -35.029311013822259358116556164908 -3994308878.1994645313414534209127 -> 3994308843.1701535175191940627961 Inexact Rounded -addx3289 add 7606663750.6735265233044420887018E+166 -5491814639.4484565418284686127552E+365 -> -5.4918146394484565418284686127552E+374 Inexact Rounded -comx3289 compare 7606663750.6735265233044420887018E+166 -5491814639.4484565418284686127552E+365 -> 1 -divx3289 divide 7606663750.6735265233044420887018E+166 -5491814639.4484565418284686127552E+365 -> -1.3850911310869487895947733090204E-199 Inexact Rounded -dvix3289 divideint 7606663750.6735265233044420887018E+166 -5491814639.4484565418284686127552E+365 -> -0 -mulx3289 multiply 7606663750.6735265233044420887018E+166 -5491814639.4484565418284686127552E+365 -> -4.1774387343310777190917128006589E+550 Inexact Rounded -powx3289 power 7606663750.6735265233044420887018E+166 -5 -> 3.9267106978887346373957314818178E-880 Inexact Rounded -remx3289 remainder 7606663750.6735265233044420887018E+166 -5491814639.4484565418284686127552E+365 -> 7.6066637506735265233044420887018E+175 -subx3289 subtract 7606663750.6735265233044420887018E+166 -5491814639.4484565418284686127552E+365 -> 5.4918146394484565418284686127552E+374 Inexact Rounded -addx3290 add -25677.829660831741274207326697052E-163 -94135395124193048560172705082029E-862 -> -2.5677829660831741274207326697052E-159 Inexact Rounded -comx3290 compare -25677.829660831741274207326697052E-163 -94135395124193048560172705082029E-862 -> -1 -divx3290 divide -25677.829660831741274207326697052E-163 -94135395124193048560172705082029E-862 -> 2.7277550199853009708493167299838E+671 Inexact Rounded -dvix3290 divideint -25677.829660831741274207326697052E-163 -94135395124193048560172705082029E-862 -> NaN Division_impossible -mulx3290 multiply -25677.829660831741274207326697052E-163 -94135395124193048560172705082029E-862 -> 2.4171926410541199393728294762559E-989 Inexact Rounded -powx3290 power -25677.829660831741274207326697052E-163 -9 -> -2.0605121420682764897867221992174E+1427 Inexact Rounded -remx3290 remainder -25677.829660831741274207326697052E-163 -94135395124193048560172705082029E-862 -> NaN Division_impossible -subx3290 subtract -25677.829660831741274207326697052E-163 -94135395124193048560172705082029E-862 -> -2.5677829660831741274207326697052E-159 Inexact Rounded -addx3291 add 97271576094.456406729671729224827 -1.5412563837540810793697955063295E+554 -> -1.5412563837540810793697955063295E+554 Inexact Rounded -comx3291 compare 97271576094.456406729671729224827 -1.5412563837540810793697955063295E+554 -> 1 -divx3291 divide 97271576094.456406729671729224827 -1.5412563837540810793697955063295E+554 -> -6.3111872313890646144473652645030E-544 Inexact Rounded -dvix3291 divideint 97271576094.456406729671729224827 -1.5412563837540810793697955063295E+554 -> -0 -mulx3291 multiply 97271576094.456406729671729224827 -1.5412563837540810793697955063295E+554 -> -1.4992043761340180288065959300090E+565 Inexact Rounded -powx3291 power 97271576094.456406729671729224827 -2 -> 1.0568858765852073181352309401343E-22 Inexact Rounded -remx3291 remainder 97271576094.456406729671729224827 -1.5412563837540810793697955063295E+554 -> 97271576094.456406729671729224827 -subx3291 subtract 97271576094.456406729671729224827 -1.5412563837540810793697955063295E+554 -> 1.5412563837540810793697955063295E+554 Inexact Rounded -addx3292 add 41139789894.401826915757391777563 -1.8729920305671057957156159690823E-020 -> 41139789894.401826915757391777544 Inexact Rounded -comx3292 compare 41139789894.401826915757391777563 -1.8729920305671057957156159690823E-020 -> 1 -divx3292 divide 41139789894.401826915757391777563 -1.8729920305671057957156159690823E-020 -> -2196474369511625389289506461551.0 Inexact Rounded -dvix3292 divideint 41139789894.401826915757391777563 -1.8729920305671057957156159690823E-020 -> -2196474369511625389289506461551 -mulx3292 multiply 41139789894.401826915757391777563 -1.8729920305671057957156159690823E-020 -> -7.7054498611419776714291080928601E-10 Inexact Rounded -powx3292 power 41139789894.401826915757391777563 -2 -> 5.9084812442741091550891451069919E-22 Inexact Rounded -remx3292 remainder 41139789894.401826915757391777563 -1.8729920305671057957156159690823E-020 -> 6.98141022640544018935102953527E-22 -subx3292 subtract 41139789894.401826915757391777563 -1.8729920305671057957156159690823E-020 -> 41139789894.401826915757391777582 Inexact Rounded -addx3293 add -83310831287241.777598696853498149 -54799825033.797100418162985103519E-330 -> -83310831287241.777598696853498149 Inexact Rounded -comx3293 compare -83310831287241.777598696853498149 -54799825033.797100418162985103519E-330 -> -1 -divx3293 divide -83310831287241.777598696853498149 -54799825033.797100418162985103519E-330 -> 1.5202754978845438636605170857478E+333 Inexact Rounded -dvix3293 divideint -83310831287241.777598696853498149 -54799825033.797100418162985103519E-330 -> NaN Division_impossible -mulx3293 multiply -83310831287241.777598696853498149 -54799825033.797100418162985103519E-330 -> 4.5654189779610386760330527839588E-306 Inexact Rounded -powx3293 power -83310831287241.777598696853498149 -5 -> -2.4916822606682624827900581728387E-70 Inexact Rounded -remx3293 remainder -83310831287241.777598696853498149 -54799825033.797100418162985103519E-330 -> NaN Division_impossible -subx3293 subtract -83310831287241.777598696853498149 -54799825033.797100418162985103519E-330 -> -83310831287241.777598696853498149 Inexact Rounded -addx3294 add 4506653461.4414974233678331771169 -74955470.977653038010031457181957E-887 -> 4506653461.4414974233678331771169 Inexact Rounded -comx3294 compare 4506653461.4414974233678331771169 -74955470.977653038010031457181957E-887 -> 1 -divx3294 divide 4506653461.4414974233678331771169 -74955470.977653038010031457181957E-887 -> -6.0124409901781490054438220048629E+888 Inexact Rounded -dvix3294 divideint 4506653461.4414974233678331771169 -74955470.977653038010031457181957E-887 -> NaN Division_impossible -mulx3294 multiply 4506653461.4414974233678331771169 -74955470.977653038010031457181957E-887 -> -3.3779833273541776470902903512949E-870 Inexact Rounded -powx3294 power 4506653461.4414974233678331771169 -7 -> 2.6486272911486461102735412463189E-68 Inexact Rounded -remx3294 remainder 4506653461.4414974233678331771169 -74955470.977653038010031457181957E-887 -> NaN Division_impossible -subx3294 subtract 4506653461.4414974233678331771169 -74955470.977653038010031457181957E-887 -> 4506653461.4414974233678331771169 Inexact Rounded -addx3295 add 23777.857951114967684767609401626 720760.03897144157012301385227528 -> 744537.89692255653780778146167691 Inexact Rounded -comx3295 compare 23777.857951114967684767609401626 720760.03897144157012301385227528 -> -1 -divx3295 divide 23777.857951114967684767609401626 720760.03897144157012301385227528 -> 0.032989978169498808275308039034795 Inexact Rounded -dvix3295 divideint 23777.857951114967684767609401626 720760.03897144157012301385227528 -> 0 -mulx3295 multiply 23777.857951114967684767609401626 720760.03897144157012301385227528 -> 17138129823.503025913034987537096 Inexact Rounded -powx3295 power 23777.857951114967684767609401626 720760 -> Infinity Overflow Inexact Rounded -remx3295 remainder 23777.857951114967684767609401626 720760.03897144157012301385227528 -> 23777.857951114967684767609401626 -subx3295 subtract 23777.857951114967684767609401626 720760.03897144157012301385227528 -> -696982.18102032660243824624287365 Inexact Rounded -addx3296 add -21337853323980858055292469611948 6080272840.3071490445256786982100E+532 -> 6.0802728403071490445256786982100E+541 Inexact Rounded -comx3296 compare -21337853323980858055292469611948 6080272840.3071490445256786982100E+532 -> -1 -divx3296 divide -21337853323980858055292469611948 6080272840.3071490445256786982100E+532 -> -3.5093578667274020123788514069885E-511 Inexact Rounded -dvix3296 divideint -21337853323980858055292469611948 6080272840.3071490445256786982100E+532 -> -0 -mulx3296 multiply -21337853323980858055292469611948 6080272840.3071490445256786982100E+532 -> -1.2973997003625843317417981902198E+573 Inexact Rounded -powx3296 power -21337853323980858055292469611948 6 -> 9.4385298321304970306180652097874E+187 Inexact Rounded -remx3296 remainder -21337853323980858055292469611948 6080272840.3071490445256786982100E+532 -> -21337853323980858055292469611948 -subx3296 subtract -21337853323980858055292469611948 6080272840.3071490445256786982100E+532 -> -6.0802728403071490445256786982100E+541 Inexact Rounded -addx3297 add -818409238.0423893439849743856947 756.39156265972753259267069158760 -> -818408481.65082668425744179302401 Inexact Rounded -comx3297 compare -818409238.0423893439849743856947 756.39156265972753259267069158760 -> -1 -divx3297 divide -818409238.0423893439849743856947 756.39156265972753259267069158760 -> -1081991.4954690752676494129493403 Inexact Rounded -dvix3297 divideint -818409238.0423893439849743856947 756.39156265972753259267069158760 -> -1081991 -mulx3297 multiply -818409238.0423893439849743856947 756.39156265972753259267069158760 -> -619037842458.03980537370328252817 Inexact Rounded -powx3297 power -818409238.0423893439849743856947 756 -> 1.6058883946373232750995543573461E+6738 Inexact Rounded -remx3297 remainder -818409238.0423893439849743856947 756.39156265972753259267069158760 -> -374.76862809126749803143314108840 -subx3297 subtract -818409238.0423893439849743856947 756.39156265972753259267069158760 -> -818409994.43395200371250697836539 Inexact Rounded -addx3298 add 47567380384943.87013600286155046 65.084709374908275826942076480326 -> 47567380385008.954845377769826287 Inexact Rounded -comx3298 compare 47567380384943.87013600286155046 65.084709374908275826942076480326 -> 1 -divx3298 divide 47567380384943.87013600286155046 65.084709374908275826942076480326 -> 730853388480.86247690474303493972 Inexact Rounded -dvix3298 divideint 47567380384943.87013600286155046 65.084709374908275826942076480326 -> 730853388480 -mulx3298 multiply 47567380384943.87013600286155046 65.084709374908275826942076480326 -> 3095909128079784.3348591472999468 Inexact Rounded -powx3298 power 47567380384943.87013600286155046 65 -> 1.0594982876763214301042437482634E+889 Inexact Rounded -remx3298 remainder 47567380384943.87013600286155046 65.084709374908275826942076480326 -> 56.134058687770878126430844955520 -subx3298 subtract 47567380384943.87013600286155046 65.084709374908275826942076480326 -> 47567380384878.785426627953274633 Inexact Rounded -addx3299 add -296615544.05897984545127115290251 -5416115.4315053536014016450973264 -> -302031659.49048519905267279799984 Inexact Rounded -comx3299 compare -296615544.05897984545127115290251 -5416115.4315053536014016450973264 -> -1 -divx3299 divide -296615544.05897984545127115290251 -5416115.4315053536014016450973264 -> 54.765366028496664530688259272591 Inexact Rounded -dvix3299 divideint -296615544.05897984545127115290251 -5416115.4315053536014016450973264 -> 54 -mulx3299 multiply -296615544.05897984545127115290251 -5416115.4315053536014016450973264 -> 1606504025402196.8484885386501478 Inexact Rounded -powx3299 power -296615544.05897984545127115290251 -5416115 -> -0E-10030 Underflow Subnormal Inexact Rounded Clamped -remx3299 remainder -296615544.05897984545127115290251 -5416115.4315053536014016450973264 -> -4145310.7576907509755823176468844 -subx3299 subtract -296615544.05897984545127115290251 -5416115.4315053536014016450973264 -> -291199428.62747449184986950780518 Inexact Rounded -addx3300 add 61391705914.046707180652185247584E+739 -675982087721.91856456125242297346 -> 6.1391705914046707180652185247584E+749 Inexact Rounded -comx3300 compare 61391705914.046707180652185247584E+739 -675982087721.91856456125242297346 -> 1 -divx3300 divide 61391705914.046707180652185247584E+739 -675982087721.91856456125242297346 -> -9.0818539468906248593699700040068E+737 Inexact Rounded -dvix3300 divideint 61391705914.046707180652185247584E+739 -675982087721.91856456125242297346 -> NaN Division_impossible -mulx3300 multiply 61391705914.046707180652185247584E+739 -675982087721.91856456125242297346 -> -4.1499693532587347944890300176290E+761 Inexact Rounded -powx3300 power 61391705914.046707180652185247584E+739 -7 -> 3.0425105291210947473420999890124E-5249 Inexact Rounded -remx3300 remainder 61391705914.046707180652185247584E+739 -675982087721.91856456125242297346 -> NaN Division_impossible -subx3300 subtract 61391705914.046707180652185247584E+739 -675982087721.91856456125242297346 -> 6.1391705914046707180652185247584E+749 Inexact Rounded - --- randomly generated testcases [26 Sep 2001] -precision: 33 -rounding: half_up -maxExponent: 9999 - -addx3401 add 042.668056830485571428877212944418 -01364112374639.4941124016455321071 -> -1364112374596.82605557115996067822 Inexact Rounded -comx3401 compare 042.668056830485571428877212944418 -01364112374639.4941124016455321071 -> 1 -divx3401 divide 042.668056830485571428877212944418 -01364112374639.4941124016455321071 -> -3.12789896373176963160811150593867E-11 Inexact Rounded -dvix3401 divideint 042.668056830485571428877212944418 -01364112374639.4941124016455321071 -> -0 -mulx3401 multiply 042.668056830485571428877212944418 -01364112374639.4941124016455321071 -> -58204024324286.5595453066065234923 Inexact Rounded -powx3401 power 042.668056830485571428877212944418 -1 -> 0.0234367363850869744523417227148909 Inexact Rounded -remx3401 remainder 042.668056830485571428877212944418 -01364112374639.4941124016455321071 -> 42.668056830485571428877212944418 -subx3401 subtract 042.668056830485571428877212944418 -01364112374639.4941124016455321071 -> 1364112374682.16216923213110353598 Inexact Rounded -addx3402 add -327.179426341653256363531809227344E+453 759067457.107518663444899356760793 -> -3.27179426341653256363531809227344E+455 Inexact Rounded -comx3402 compare -327.179426341653256363531809227344E+453 759067457.107518663444899356760793 -> -1 -divx3402 divide -327.179426341653256363531809227344E+453 759067457.107518663444899356760793 -> -4.31028129684803083255704680611589E+446 Inexact Rounded -dvix3402 divideint -327.179426341653256363531809227344E+453 759067457.107518663444899356760793 -> NaN Division_impossible -mulx3402 multiply -327.179426341653256363531809227344E+453 759067457.107518663444899356760793 -> -2.48351255171055445110558613627379E+464 Inexact Rounded -powx3402 power -327.179426341653256363531809227344E+453 759067457 -> -Infinity Overflow Inexact Rounded -remx3402 remainder -327.179426341653256363531809227344E+453 759067457.107518663444899356760793 -> NaN Division_impossible -subx3402 subtract -327.179426341653256363531809227344E+453 759067457.107518663444899356760793 -> -3.27179426341653256363531809227344E+455 Inexact Rounded -addx3403 add 81721.5803096185422787702538493471 900099473.245809628076790757217328 -> 900181194.826119246619069527471177 Inexact Rounded -comx3403 compare 81721.5803096185422787702538493471 900099473.245809628076790757217328 -> -1 -divx3403 divide 81721.5803096185422787702538493471 900099473.245809628076790757217328 -> 0.0000907917210693679220610511319812826 Inexact Rounded -dvix3403 divideint 81721.5803096185422787702538493471 900099473.245809628076790757217328 -> 0 -mulx3403 multiply 81721.5803096185422787702538493471 900099473.245809628076790757217328 -> 73557551389502.7779979042453102926 Inexact Rounded -powx3403 power 81721.5803096185422787702538493471 900099473 -> Infinity Overflow Inexact Rounded -remx3403 remainder 81721.5803096185422787702538493471 900099473.245809628076790757217328 -> 81721.5803096185422787702538493471 -subx3403 subtract 81721.5803096185422787702538493471 900099473.245809628076790757217328 -> -900017751.665500009534511986963479 Inexact Rounded -addx3404 add 3991.56734635183403814636354392163E-807 72.3239822255871305731314565069132 -> 72.3239822255871305731314565069132 Inexact Rounded -comx3404 compare 3991.56734635183403814636354392163E-807 72.3239822255871305731314565069132 -> -1 -divx3404 divide 3991.56734635183403814636354392163E-807 72.3239822255871305731314565069132 -> 5.51900935695390664984598248115290E-806 Inexact Rounded -dvix3404 divideint 3991.56734635183403814636354392163E-807 72.3239822255871305731314565069132 -> 0 -mulx3404 multiply 3991.56734635183403814636354392163E-807 72.3239822255871305731314565069132 -> 2.88686045809784034794803928177854E-802 Inexact Rounded -powx3404 power 3991.56734635183403814636354392163E-807 72 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3404 remainder 3991.56734635183403814636354392163E-807 72.3239822255871305731314565069132 -> 3.99156734635183403814636354392163E-804 -subx3404 subtract 3991.56734635183403814636354392163E-807 72.3239822255871305731314565069132 -> -72.3239822255871305731314565069132 Inexact Rounded -addx3405 add -66.3393308595957726456416979163306 5.08486573050459213864684589662559 -> -61.2544651290911805069948520197050 Inexact Rounded -comx3405 compare -66.3393308595957726456416979163306 5.08486573050459213864684589662559 -> -1 -divx3405 divide -66.3393308595957726456416979163306 5.08486573050459213864684589662559 -> -13.0464272560079276694749924915850 Inexact Rounded -dvix3405 divideint -66.3393308595957726456416979163306 5.08486573050459213864684589662559 -> -13 -mulx3405 multiply -66.3393308595957726456416979163306 5.08486573050459213864684589662559 -> -337.326590072564290813539036280205 Inexact Rounded -powx3405 power -66.3393308595957726456416979163306 5 -> -1284858888.27285822259184896667990 Inexact Rounded -remx3405 remainder -66.3393308595957726456416979163306 5.08486573050459213864684589662559 -> -0.23607636303607484323270126019793 -subx3405 subtract -66.3393308595957726456416979163306 5.08486573050459213864684589662559 -> -71.4241965901003647842885438129562 Inexact Rounded -addx3406 add -393606.873703567753255097095208112E+111 -2124339550.86891093200758095660557 -> -3.93606873703567753255097095208112E+116 Inexact Rounded -comx3406 compare -393606.873703567753255097095208112E+111 -2124339550.86891093200758095660557 -> -1 -divx3406 divide -393606.873703567753255097095208112E+111 -2124339550.86891093200758095660557 -> 1.85284350396137075010428736564737E+107 Inexact Rounded -dvix3406 divideint -393606.873703567753255097095208112E+111 -2124339550.86891093200758095660557 -> NaN Division_impossible -mulx3406 multiply -393606.873703567753255097095208112E+111 -2124339550.86891093200758095660557 -> 8.36154649302353269818801263275941E+125 Inexact Rounded -powx3406 power -393606.873703567753255097095208112E+111 -2 -> 6.45467904123103560528919747688443E-234 Inexact Rounded -remx3406 remainder -393606.873703567753255097095208112E+111 -2124339550.86891093200758095660557 -> NaN Division_impossible -subx3406 subtract -393606.873703567753255097095208112E+111 -2124339550.86891093200758095660557 -> -3.93606873703567753255097095208112E+116 Inexact Rounded -addx3407 add -019133598.609812524622150421584346 -858439846.628367734642622922030051 -> -877573445.238180259264773343614397 -comx3407 compare -019133598.609812524622150421584346 -858439846.628367734642622922030051 -> 1 -divx3407 divide -019133598.609812524622150421584346 -858439846.628367734642622922030051 -> 0.0222888053076312565797460650311070 Inexact Rounded -dvix3407 divideint -019133598.609812524622150421584346 -858439846.628367734642622922030051 -> 0 -mulx3407 multiply -019133598.609812524622150421584346 -858439846.628367734642622922030051 -> 16425043456056213.7395191514029288 Inexact Rounded -powx3407 power -019133598.609812524622150421584346 -858439847 -> -0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3407 remainder -019133598.609812524622150421584346 -858439846.628367734642622922030051 -> -19133598.609812524622150421584346 -subx3407 subtract -019133598.609812524622150421584346 -858439846.628367734642622922030051 -> 839306248.018555210020472500445705 -addx3408 add 465.351982159046525762715549761814 240444.975944666924657629172844780 -> 240910.327926825971183391888394542 Inexact Rounded -comx3408 compare 465.351982159046525762715549761814 240444.975944666924657629172844780 -> -1 -divx3408 divide 465.351982159046525762715549761814 240444.975944666924657629172844780 -> 0.00193537827243326122782974132829095 Inexact Rounded -dvix3408 divideint 465.351982159046525762715549761814 240444.975944666924657629172844780 -> 0 -mulx3408 multiply 465.351982159046525762715549761814 240444.975944666924657629172844780 -> 111891546.156035013780371395668674 Inexact Rounded -powx3408 power 465.351982159046525762715549761814 240445 -> Infinity Overflow Inexact Rounded -remx3408 remainder 465.351982159046525762715549761814 240444.975944666924657629172844780 -> 465.351982159046525762715549761814 -subx3408 subtract 465.351982159046525762715549761814 240444.975944666924657629172844780 -> -239979.623962507878131866457295018 Inexact Rounded -addx3409 add 28066955004783.1076824222873384828 571699969.220753535758504907561016E-718 -> 28066955004783.1076824222873384828 Inexact Rounded -comx3409 compare 28066955004783.1076824222873384828 571699969.220753535758504907561016E-718 -> 1 -divx3409 divide 28066955004783.1076824222873384828 571699969.220753535758504907561016E-718 -> 4.90938543219432390013656968123815E+722 Inexact Rounded -dvix3409 divideint 28066955004783.1076824222873384828 571699969.220753535758504907561016E-718 -> NaN Division_impossible -mulx3409 multiply 28066955004783.1076824222873384828 571699969.220753535758504907561016E-718 -> 1.60458773123547770690452195569223E-696 Inexact Rounded -powx3409 power 28066955004783.1076824222873384828 6 -> 4.88845689938951583020171325568218E+80 Inexact Rounded -remx3409 remainder 28066955004783.1076824222873384828 571699969.220753535758504907561016E-718 -> NaN Division_impossible -subx3409 subtract 28066955004783.1076824222873384828 571699969.220753535758504907561016E-718 -> 28066955004783.1076824222873384828 Inexact Rounded -addx3410 add 28275236927392.4960902824105246047 28212038.4825243127096613158419270E+422 -> 2.82120384825243127096613158419270E+429 Inexact Rounded -comx3410 compare 28275236927392.4960902824105246047 28212038.4825243127096613158419270E+422 -> -1 -divx3410 divide 28275236927392.4960902824105246047 28212038.4825243127096613158419270E+422 -> 1.00224012330435927467559203688861E-416 Inexact Rounded -dvix3410 divideint 28275236927392.4960902824105246047 28212038.4825243127096613158419270E+422 -> 0 -mulx3410 multiply 28275236927392.4960902824105246047 28212038.4825243127096613158419270E+422 -> 7.97702072298089605706798770013561E+442 Inexact Rounded -powx3410 power 28275236927392.4960902824105246047 3 -> 2.26057415546622161347322061281516E+40 Inexact Rounded -remx3410 remainder 28275236927392.4960902824105246047 28212038.4825243127096613158419270E+422 -> 28275236927392.4960902824105246047 -subx3410 subtract 28275236927392.4960902824105246047 28212038.4825243127096613158419270E+422 -> -2.82120384825243127096613158419270E+429 Inexact Rounded -addx3411 add 11791.8644211874630234271801789996 -8.45457275930363860982261343159741 -> 11783.4098484281593848173575655680 Inexact Rounded -comx3411 compare 11791.8644211874630234271801789996 -8.45457275930363860982261343159741 -> 1 -divx3411 divide 11791.8644211874630234271801789996 -8.45457275930363860982261343159741 -> -1394.73214754836418731335761858151 Inexact Rounded -dvix3411 divideint 11791.8644211874630234271801789996 -8.45457275930363860982261343159741 -> -1394 -mulx3411 multiply 11791.8644211874630234271801789996 -8.45457275930363860982261343159741 -> -99695.1757167732926302533138186716 Inexact Rounded -powx3411 power 11791.8644211874630234271801789996 -8 -> 2.67510099318723516565332928253711E-33 Inexact Rounded -remx3411 remainder 11791.8644211874630234271801789996 -8.45457275930363860982261343159741 -> 6.18999471819080133445705535281046 -subx3411 subtract 11791.8644211874630234271801789996 -8.45457275930363860982261343159741 -> 11800.3189939467666620370027924312 Inexact Rounded -addx3412 add 44.7085340739581668975502342787578 -9337.05408133023920640485556647937 -> -9292.34554725628103950730533220061 Inexact Rounded -comx3412 compare 44.7085340739581668975502342787578 -9337.05408133023920640485556647937 -> 1 -divx3412 divide 44.7085340739581668975502342787578 -9337.05408133023920640485556647937 -> -0.00478829121953512281527242631775613 Inexact Rounded -dvix3412 divideint 44.7085340739581668975502342787578 -9337.05408133023920640485556647937 -> -0 -mulx3412 multiply 44.7085340739581668975502342787578 -9337.05408133023920640485556647937 -> -417446.000545543168866158913077419 Inexact Rounded -powx3412 power 44.7085340739581668975502342787578 -9337 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3412 remainder 44.7085340739581668975502342787578 -9337.05408133023920640485556647937 -> 44.7085340739581668975502342787578 -subx3412 subtract 44.7085340739581668975502342787578 -9337.05408133023920640485556647937 -> 9381.76261540419737330240580075813 Inexact Rounded -addx3413 add 93354527428804.5458053295581965867E+576 -856525909852.318790321300941615314 -> 9.33545274288045458053295581965867E+589 Inexact Rounded -comx3413 compare 93354527428804.5458053295581965867E+576 -856525909852.318790321300941615314 -> 1 -divx3413 divide 93354527428804.5458053295581965867E+576 -856525909852.318790321300941615314 -> -1.08992064752484400353231056271614E+578 Inexact Rounded -dvix3413 divideint 93354527428804.5458053295581965867E+576 -856525909852.318790321300941615314 -> NaN Division_impossible -mulx3413 multiply 93354527428804.5458053295581965867E+576 -856525909852.318790321300941615314 -> -7.99605715447900642683774360731254E+601 Inexact Rounded -powx3413 power 93354527428804.5458053295581965867E+576 -9 -> 1.85687015691763406448005521221518E-5310 Inexact Rounded -remx3413 remainder 93354527428804.5458053295581965867E+576 -856525909852.318790321300941615314 -> NaN Division_impossible -subx3413 subtract 93354527428804.5458053295581965867E+576 -856525909852.318790321300941615314 -> 9.33545274288045458053295581965867E+589 Inexact Rounded -addx3414 add -367399415798804503177950040443482 -54845683.9691776397285506712812754 -> -367399415798804503177950095289166 Inexact Rounded -comx3414 compare -367399415798804503177950040443482 -54845683.9691776397285506712812754 -> -1 -divx3414 divide -367399415798804503177950040443482 -54845683.9691776397285506712812754 -> 6698784465980529140072174.30474769 Inexact Rounded -dvix3414 divideint -367399415798804503177950040443482 -54845683.9691776397285506712812754 -> 6698784465980529140072174 -mulx3414 multiply -367399415798804503177950040443482 -54845683.9691776397285506712812754 -> 2.01502722493617222018040789291414E+40 Inexact Rounded -powx3414 power -367399415798804503177950040443482 -54845684 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3414 remainder -367399415798804503177950040443482 -54845683.9691776397285506712812754 -> -16714095.6549657189177857892292804 -subx3414 subtract -367399415798804503177950040443482 -54845683.9691776397285506712812754 -> -367399415798804503177949985597798 Inexact Rounded -addx3415 add -2.87155919781024108503670175443740 89529730130.6427881332776797193807 -> 89529730127.7712289354674386343440 Inexact Rounded -comx3415 compare -2.87155919781024108503670175443740 89529730130.6427881332776797193807 -> -1 -divx3415 divide -2.87155919781024108503670175443740 89529730130.6427881332776797193807 -> -3.20738060264454013174835928754430E-11 Inexact Rounded -dvix3415 divideint -2.87155919781024108503670175443740 89529730130.6427881332776797193807 -> -0 -mulx3415 multiply -2.87155919781024108503670175443740 89529730130.6427881332776797193807 -> -257089920034.115975469931085527642 Inexact Rounded -powx3415 power -2.87155919781024108503670175443740 9 -> -13275.7774683251354527310820885737 Inexact Rounded -remx3415 remainder -2.87155919781024108503670175443740 89529730130.6427881332776797193807 -> -2.87155919781024108503670175443740 -subx3415 subtract -2.87155919781024108503670175443740 89529730130.6427881332776797193807 -> -89529730133.5143473310879208044174 Inexact Rounded -addx3416 add -010.693934338179479652178057279204E+188 26484.8887731973153745666514260684 -> -1.06939343381794796521780572792040E+189 Inexact Rounded -comx3416 compare -010.693934338179479652178057279204E+188 26484.8887731973153745666514260684 -> -1 -divx3416 divide -010.693934338179479652178057279204E+188 26484.8887731973153745666514260684 -> -4.03774938598259547575707503087638E+184 Inexact Rounded -dvix3416 divideint -010.693934338179479652178057279204E+188 26484.8887731973153745666514260684 -> NaN Division_impossible -mulx3416 multiply -010.693934338179479652178057279204E+188 26484.8887731973153745666514260684 -> -2.83227661494558963558481633880647E+193 Inexact Rounded -powx3416 power -010.693934338179479652178057279204E+188 26485 -> -Infinity Overflow Inexact Rounded -remx3416 remainder -010.693934338179479652178057279204E+188 26484.8887731973153745666514260684 -> NaN Division_impossible -subx3416 subtract -010.693934338179479652178057279204E+188 26484.8887731973153745666514260684 -> -1.06939343381794796521780572792040E+189 Inexact Rounded -addx3417 add 611655569568.832698912762075889186 010182743219.475839030505966016982 -> 621838312788.308537943268041906168 -comx3417 compare 611655569568.832698912762075889186 010182743219.475839030505966016982 -> 1 -divx3417 divide 611655569568.832698912762075889186 010182743219.475839030505966016982 -> 60.0678575886074367081836436812959 Inexact Rounded -dvix3417 divideint 611655569568.832698912762075889186 010182743219.475839030505966016982 -> 60 -mulx3417 multiply 611655569568.832698912762075889186 010182743219.475839030505966016982 -> 6228331603681663511826.60450280350 Inexact Rounded -powx3417 power 611655569568.832698912762075889186 1 -> 611655569568.832698912762075889186 -remx3417 remainder 611655569568.832698912762075889186 010182743219.475839030505966016982 -> 690976400.282357082404114870266 -subx3417 subtract 611655569568.832698912762075889186 010182743219.475839030505966016982 -> 601472826349.356859882256109872204 -addx3418 add 3457947.39062863674882672518304442 -01.9995218868908849056866549811425 -> 3457945.39110674985794181949638944 Inexact Rounded -comx3418 compare 3457947.39062863674882672518304442 -01.9995218868908849056866549811425 -> 1 -divx3418 divide 3457947.39062863674882672518304442 -01.9995218868908849056866549811425 -> -1729387.11663991852426428263230475 Inexact Rounded -dvix3418 divideint 3457947.39062863674882672518304442 -01.9995218868908849056866549811425 -> -1729387 -mulx3418 multiply 3457947.39062863674882672518304442 -01.9995218868908849056866549811425 -> -6914241.49127918361259252956576654 Inexact Rounded -powx3418 power 3457947.39062863674882672518304442 -2 -> 8.36302195229701913376802373659526E-14 Inexact Rounded -remx3418 remainder 3457947.39062863674882672518304442 -01.9995218868908849056866549811425 -> 0.2332240699744359979851713353525 -subx3418 subtract 3457947.39062863674882672518304442 -01.9995218868908849056866549811425 -> 3457949.39015052363971163086969940 Inexact Rounded -addx3419 add -53308666960535.7393391289364591513 -6527.00547629475578694521436764596E-442 -> -53308666960535.7393391289364591513 Inexact Rounded -comx3419 compare -53308666960535.7393391289364591513 -6527.00547629475578694521436764596E-442 -> -1 -divx3419 divide -53308666960535.7393391289364591513 -6527.00547629475578694521436764596E-442 -> 8.16740037282731870883136714441204E+451 Inexact Rounded -dvix3419 divideint -53308666960535.7393391289364591513 -6527.00547629475578694521436764596E-442 -> NaN Division_impossible -mulx3419 multiply -53308666960535.7393391289364591513 -6527.00547629475578694521436764596E-442 -> 3.47945961185390084641156250100085E-425 Inexact Rounded -powx3419 power -53308666960535.7393391289364591513 -7 -> -8.17363502380497033342380498988958E-97 Inexact Rounded -remx3419 remainder -53308666960535.7393391289364591513 -6527.00547629475578694521436764596E-442 -> NaN Division_impossible -subx3419 subtract -53308666960535.7393391289364591513 -6527.00547629475578694521436764596E-442 -> -53308666960535.7393391289364591513 Inexact Rounded -addx3420 add -5568057.17870139549478277980540034 -407906443.141342175740471849723638 -> -413474500.320043571235254629529038 Inexact Rounded -comx3420 compare -5568057.17870139549478277980540034 -407906443.141342175740471849723638 -> 1 -divx3420 divide -5568057.17870139549478277980540034 -407906443.141342175740471849723638 -> 0.0136503290701197094953429018013146 Inexact Rounded -dvix3420 divideint -5568057.17870139549478277980540034 -407906443.141342175740471849723638 -> 0 -mulx3420 multiply -5568057.17870139549478277980540034 -407906443.141342175740471849723638 -> 2271246398971702.91169807728132089 Inexact Rounded -powx3420 power -5568057.17870139549478277980540034 -407906443 -> -0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3420 remainder -5568057.17870139549478277980540034 -407906443.141342175740471849723638 -> -5568057.17870139549478277980540034 -subx3420 subtract -5568057.17870139549478277980540034 -407906443.141342175740471849723638 -> 402338385.962640780245689069918238 Inexact Rounded -addx3421 add 9804385273.49533524416415189990857 84.1433929743544659553964804646569 -> 9804385357.63872821851861785530505 Inexact Rounded -comx3421 compare 9804385273.49533524416415189990857 84.1433929743544659553964804646569 -> 1 -divx3421 divide 9804385273.49533524416415189990857 84.1433929743544659553964804646569 -> 116519965.821719977402398190558439 Inexact Rounded -dvix3421 divideint 9804385273.49533524416415189990857 84.1433929743544659553964804646569 -> 116519965 -mulx3421 multiply 9804385273.49533524416415189990857 84.1433929743544659553964804646569 -> 824974242939.691780798621180901714 Inexact Rounded -powx3421 power 9804385273.49533524416415189990857 84 -> 1.90244010779692739037080418507909E+839 Inexact Rounded -remx3421 remainder 9804385273.49533524416415189990857 84.1433929743544659553964804646569 -> 69.1423069734476624350435642749915 -subx3421 subtract 9804385273.49533524416415189990857 84.1433929743544659553964804646569 -> 9804385189.35194226980968594451209 Inexact Rounded -addx3422 add -5234910986592.18801727046580014273E-547 -5874220715892.91440069210512515154 -> -5874220715892.91440069210512515154 Inexact Rounded -comx3422 compare -5234910986592.18801727046580014273E-547 -5874220715892.91440069210512515154 -> 1 -divx3422 divide -5234910986592.18801727046580014273E-547 -5874220715892.91440069210512515154 -> 8.91166886601477021757439826903776E-548 Inexact Rounded -dvix3422 divideint -5234910986592.18801727046580014273E-547 -5874220715892.91440069210512515154 -> 0 -mulx3422 multiply -5234910986592.18801727046580014273E-547 -5874220715892.91440069210512515154 -> 3.07510225632952455144944282925583E-522 Inexact Rounded -powx3422 power -5234910986592.18801727046580014273E-547 -6 -> 4.85896970703117149235935037271084E+3205 Inexact Rounded -remx3422 remainder -5234910986592.18801727046580014273E-547 -5874220715892.91440069210512515154 -> -5.23491098659218801727046580014273E-535 -subx3422 subtract -5234910986592.18801727046580014273E-547 -5874220715892.91440069210512515154 -> 5874220715892.91440069210512515154 Inexact Rounded -addx3423 add 698416560151955285929747633786867E-495 51754681.6784872628933218985216916E-266 -> 5.17546816784872628933218985216916E-259 Inexact Rounded -comx3423 compare 698416560151955285929747633786867E-495 51754681.6784872628933218985216916E-266 -> -1 -divx3423 divide 698416560151955285929747633786867E-495 51754681.6784872628933218985216916E-266 -> 1.34947513442491971488363250398908E-204 Inexact Rounded -dvix3423 divideint 698416560151955285929747633786867E-495 51754681.6784872628933218985216916E-266 -> 0 -mulx3423 multiply 698416560151955285929747633786867E-495 51754681.6784872628933218985216916E-266 -> 3.61463267496484976064271305679796E-721 Inexact Rounded -powx3423 power 698416560151955285929747633786867E-495 5 -> 1.66177661007189430761396979787413E-2311 Inexact Rounded -remx3423 remainder 698416560151955285929747633786867E-495 51754681.6784872628933218985216916E-266 -> 6.98416560151955285929747633786867E-463 -subx3423 subtract 698416560151955285929747633786867E-495 51754681.6784872628933218985216916E-266 -> -5.17546816784872628933218985216916E-259 Inexact Rounded -addx3424 add 107635.497735316515080720330536027 -3972075.83989512668362609609006425E-605 -> 107635.497735316515080720330536027 Inexact Rounded -comx3424 compare 107635.497735316515080720330536027 -3972075.83989512668362609609006425E-605 -> 1 -divx3424 divide 107635.497735316515080720330536027 -3972075.83989512668362609609006425E-605 -> -2.70980469844599888443309571235597E+603 Inexact Rounded -dvix3424 divideint 107635.497735316515080720330536027 -3972075.83989512668362609609006425E-605 -> NaN Division_impossible -mulx3424 multiply 107635.497735316515080720330536027 -3972075.83989512668362609609006425E-605 -> -4.27536360069537352698066408021773E-594 Inexact Rounded -powx3424 power 107635.497735316515080720330536027 -4 -> 7.45037111502910487803432806334714E-21 Inexact Rounded -remx3424 remainder 107635.497735316515080720330536027 -3972075.83989512668362609609006425E-605 -> NaN Division_impossible -subx3424 subtract 107635.497735316515080720330536027 -3972075.83989512668362609609006425E-605 -> 107635.497735316515080720330536027 Inexact Rounded -addx3425 add -32174291345686.5371446616670961807 79518863759385.5925052747867099091E+408 -> 7.95188637593855925052747867099091E+421 Inexact Rounded -comx3425 compare -32174291345686.5371446616670961807 79518863759385.5925052747867099091E+408 -> -1 -divx3425 divide -32174291345686.5371446616670961807 79518863759385.5925052747867099091E+408 -> -4.04612060894658007715621807881076E-409 Inexact Rounded -dvix3425 divideint -32174291345686.5371446616670961807 79518863759385.5925052747867099091E+408 -> -0 -mulx3425 multiply -32174291345686.5371446616670961807 79518863759385.5925052747867099091E+408 -> -2.55846309007242668513226814043593E+435 Inexact Rounded -powx3425 power -32174291345686.5371446616670961807 8 -> 1.14834377656109143210058690590666E+108 Inexact Rounded -remx3425 remainder -32174291345686.5371446616670961807 79518863759385.5925052747867099091E+408 -> -32174291345686.5371446616670961807 -subx3425 subtract -32174291345686.5371446616670961807 79518863759385.5925052747867099091E+408 -> -7.95188637593855925052747867099091E+421 Inexact Rounded -addx3426 add -8151730494.53190523620899410544099E+688 -93173.0631474527142307644239919480E+900 -> -9.31730631474527142307644239919480E+904 Inexact Rounded -comx3426 compare -8151730494.53190523620899410544099E+688 -93173.0631474527142307644239919480E+900 -> 1 -divx3426 divide -8151730494.53190523620899410544099E+688 -93173.0631474527142307644239919480E+900 -> 8.74902060655796717043678441884283E-208 Inexact Rounded -dvix3426 divideint -8151730494.53190523620899410544099E+688 -93173.0631474527142307644239919480E+900 -> 0 -mulx3426 multiply -8151730494.53190523620899410544099E+688 -93173.0631474527142307644239919480E+900 -> 7.59521700128037149179751467730962E+1602 Inexact Rounded -powx3426 power -8151730494.53190523620899410544099E+688 -9 -> -6.29146352774842448375275282183700E-6282 Inexact Rounded -remx3426 remainder -8151730494.53190523620899410544099E+688 -93173.0631474527142307644239919480E+900 -> -8.15173049453190523620899410544099E+697 -subx3426 subtract -8151730494.53190523620899410544099E+688 -93173.0631474527142307644239919480E+900 -> 9.31730631474527142307644239919480E+904 Inexact Rounded -addx3427 add 1.33649801345976199708341799505220 -56623.0530039528969825480755159562E+459 -> -5.66230530039528969825480755159562E+463 Inexact Rounded -comx3427 compare 1.33649801345976199708341799505220 -56623.0530039528969825480755159562E+459 -> 1 -divx3427 divide 1.33649801345976199708341799505220 -56623.0530039528969825480755159562E+459 -> -2.36034255052700900395787131334608E-464 Inexact Rounded -dvix3427 divideint 1.33649801345976199708341799505220 -56623.0530039528969825480755159562E+459 -> -0 -mulx3427 multiply 1.33649801345976199708341799505220 -56623.0530039528969825480755159562E+459 -> -7.56765978558098558928268129700052E+463 Inexact Rounded -powx3427 power 1.33649801345976199708341799505220 -6 -> 0.175464835912284900180305028965188 Inexact Rounded -remx3427 remainder 1.33649801345976199708341799505220 -56623.0530039528969825480755159562E+459 -> 1.33649801345976199708341799505220 -subx3427 subtract 1.33649801345976199708341799505220 -56623.0530039528969825480755159562E+459 -> 5.66230530039528969825480755159562E+463 Inexact Rounded -addx3428 add 67762238162788.6551061476018185196 -6140.75837959248100352788853809376E-822 -> 67762238162788.6551061476018185196 Inexact Rounded -comx3428 compare 67762238162788.6551061476018185196 -6140.75837959248100352788853809376E-822 -> 1 -divx3428 divide 67762238162788.6551061476018185196 -6140.75837959248100352788853809376E-822 -> -1.10348321777294157014941951870409E+832 Inexact Rounded -dvix3428 divideint 67762238162788.6551061476018185196 -6140.75837959248100352788853809376E-822 -> NaN Division_impossible -mulx3428 multiply 67762238162788.6551061476018185196 -6140.75837959248100352788853809376E-822 -> -4.16111531818085838717201828773857E-805 Inexact Rounded -powx3428 power 67762238162788.6551061476018185196 -6 -> 1.03293631708006509074972764670281E-83 Inexact Rounded -remx3428 remainder 67762238162788.6551061476018185196 -6140.75837959248100352788853809376E-822 -> NaN Division_impossible -subx3428 subtract 67762238162788.6551061476018185196 -6140.75837959248100352788853809376E-822 -> 67762238162788.6551061476018185196 Inexact Rounded -addx3429 add 4286562.76568866751577306056498271 6286.77291578497580015557979349893E+820 -> 6.28677291578497580015557979349893E+823 Inexact Rounded -comx3429 compare 4286562.76568866751577306056498271 6286.77291578497580015557979349893E+820 -> -1 -divx3429 divide 4286562.76568866751577306056498271 6286.77291578497580015557979349893E+820 -> 6.81838333133660025740681459349372E-818 Inexact Rounded -dvix3429 divideint 4286562.76568866751577306056498271 6286.77291578497580015557979349893E+820 -> 0 -mulx3429 multiply 4286562.76568866751577306056498271 6286.77291578497580015557979349893E+820 -> 2.69486466971438542975159893306219E+830 Inexact Rounded -powx3429 power 4286562.76568866751577306056498271 6 -> 6.20376193064412081058181881805108E+39 Inexact Rounded -remx3429 remainder 4286562.76568866751577306056498271 6286.77291578497580015557979349893E+820 -> 4286562.76568866751577306056498271 -subx3429 subtract 4286562.76568866751577306056498271 6286.77291578497580015557979349893E+820 -> -6.28677291578497580015557979349893E+823 Inexact Rounded -addx3430 add -765782.827432642697305644096365566 67.1634368459576834692758114618652 -> -765715.663995796739622174820554104 Inexact Rounded -comx3430 compare -765782.827432642697305644096365566 67.1634368459576834692758114618652 -> -1 -divx3430 divide -765782.827432642697305644096365566 67.1634368459576834692758114618652 -> -11401.7814363639478774761697650867 Inexact Rounded -dvix3430 divideint -765782.827432642697305644096365566 67.1634368459576834692758114618652 -> -11401 -mulx3430 multiply -765782.827432642697305644096365566 67.1634368459576834692758114618652 -> -51432606.5679912088468256122315944 Inexact Rounded -powx3430 power -765782.827432642697305644096365566 67 -> -1.71821200770749773595473594136582E+394 Inexact Rounded -remx3430 remainder -765782.827432642697305644096365566 67.1634368459576834692758114618652 -> -52.4839518791480724305698888408548 -subx3430 subtract -765782.827432642697305644096365566 67.1634368459576834692758114618652 -> -765849.990869488654989113372177028 Inexact Rounded -addx3431 add 46.2835931916106252756465724211276 59.2989237834093118332826617957791 -> 105.582516975019937108929234216907 Inexact Rounded -comx3431 compare 46.2835931916106252756465724211276 59.2989237834093118332826617957791 -> -1 -divx3431 divide 46.2835931916106252756465724211276 59.2989237834093118332826617957791 -> 0.780513207299722975882416995140701 Inexact Rounded -dvix3431 divideint 46.2835931916106252756465724211276 59.2989237834093118332826617957791 -> 0 -mulx3431 multiply 46.2835931916106252756465724211276 59.2989237834093118332826617957791 -> 2744.56726509164060561370653286614 Inexact Rounded -powx3431 power 46.2835931916106252756465724211276 59 -> 1.82052645780601002671007943923993E+98 Inexact Rounded -remx3431 remainder 46.2835931916106252756465724211276 59.2989237834093118332826617957791 -> 46.2835931916106252756465724211276 -subx3431 subtract 46.2835931916106252756465724211276 59.2989237834093118332826617957791 -> -13.0153305917986865576360893746515 -addx3432 add -3029555.82298840234029474459694644 857535844655004737373089601128532 -> 857535844655004737373089598098976 Inexact Rounded -comx3432 compare -3029555.82298840234029474459694644 857535844655004737373089601128532 -> -1 -divx3432 divide -3029555.82298840234029474459694644 857535844655004737373089601128532 -> -3.53286202771759704502126811323937E-27 Inexact Rounded -dvix3432 divideint -3029555.82298840234029474459694644 857535844655004737373089601128532 -> -0 -mulx3432 multiply -3029555.82298840234029474459694644 857535844655004737373089601128532 -> -2.59795271159584761928986181925721E+39 Inexact Rounded -powx3432 power -3029555.82298840234029474459694644 9 -> -2.14986224790431302561340100746360E+58 Inexact Rounded -remx3432 remainder -3029555.82298840234029474459694644 857535844655004737373089601128532 -> -3029555.82298840234029474459694644 -subx3432 subtract -3029555.82298840234029474459694644 857535844655004737373089601128532 -> -857535844655004737373089604158088 Inexact Rounded -addx3433 add -0138466789523.10694176543700501945E-948 481026979918882487383654367924619 -> 481026979918882487383654367924619 Inexact Rounded -comx3433 compare -0138466789523.10694176543700501945E-948 481026979918882487383654367924619 -> -1 -divx3433 divide -0138466789523.10694176543700501945E-948 481026979918882487383654367924619 -> -2.87856597038397207797777811199804E-970 Inexact Rounded -dvix3433 divideint -0138466789523.10694176543700501945E-948 481026979918882487383654367924619 -> -0 -mulx3433 multiply -0138466789523.10694176543700501945E-948 481026979918882487383654367924619 -> -6.66062615833636908683785283687416E-905 Inexact Rounded -powx3433 power -0138466789523.10694176543700501945E-948 5 -> -5.09012109092637525843636056746667E-4685 Inexact Rounded -remx3433 remainder -0138466789523.10694176543700501945E-948 481026979918882487383654367924619 -> -1.3846678952310694176543700501945E-937 -subx3433 subtract -0138466789523.10694176543700501945E-948 481026979918882487383654367924619 -> -481026979918882487383654367924619 Inexact Rounded -addx3434 add -9593566466.96690575714244442109870 -87632034347.4845477961976776833770E+769 -> -8.76320343474845477961976776833770E+779 Inexact Rounded -comx3434 compare -9593566466.96690575714244442109870 -87632034347.4845477961976776833770E+769 -> 1 -divx3434 divide -9593566466.96690575714244442109870 -87632034347.4845477961976776833770E+769 -> 1.09475564939253134070730299863765E-770 Inexact Rounded -dvix3434 divideint -9593566466.96690575714244442109870 -87632034347.4845477961976776833770E+769 -> 0 -mulx3434 multiply -9593566466.96690575714244442109870 -87632034347.4845477961976776833770E+769 -> 8.40703746148119867711463485065336E+789 Inexact Rounded -powx3434 power -9593566466.96690575714244442109870 -9 -> -1.45271091841882960010964421066745E-90 Inexact Rounded -remx3434 remainder -9593566466.96690575714244442109870 -87632034347.4845477961976776833770E+769 -> -9593566466.96690575714244442109870 -subx3434 subtract -9593566466.96690575714244442109870 -87632034347.4845477961976776833770E+769 -> 8.76320343474845477961976776833770E+779 Inexact Rounded -addx3435 add -3189.30765477670526823106100241863E-898 565688889.355241946154894311253202E-466 -> 5.65688889355241946154894311253202E-458 Inexact Rounded -comx3435 compare -3189.30765477670526823106100241863E-898 565688889.355241946154894311253202E-466 -> -1 -divx3435 divide -3189.30765477670526823106100241863E-898 565688889.355241946154894311253202E-466 -> -5.63791814686655486612569970629128E-438 Inexact Rounded -dvix3435 divideint -3189.30765477670526823106100241863E-898 565688889.355241946154894311253202E-466 -> -0 -mulx3435 multiply -3189.30765477670526823106100241863E-898 565688889.355241946154894311253202E-466 -> -1.80415590504280580443565448126548E-1352 Inexact Rounded -powx3435 power -3189.30765477670526823106100241863E-898 6 -> 1.05239431027683904514311527228736E-5367 Inexact Rounded -remx3435 remainder -3189.30765477670526823106100241863E-898 565688889.355241946154894311253202E-466 -> -3.18930765477670526823106100241863E-895 -subx3435 subtract -3189.30765477670526823106100241863E-898 565688889.355241946154894311253202E-466 -> -5.65688889355241946154894311253202E-458 Inexact Rounded -addx3436 add -17084552395.6714834680088150543965 -631925802672.685034379197328370812E+527 -> -6.31925802672685034379197328370812E+538 Inexact Rounded -comx3436 compare -17084552395.6714834680088150543965 -631925802672.685034379197328370812E+527 -> 1 -divx3436 divide -17084552395.6714834680088150543965 -631925802672.685034379197328370812E+527 -> 2.70356936263934622050341328519534E-529 Inexact Rounded -dvix3436 divideint -17084552395.6714834680088150543965 -631925802672.685034379197328370812E+527 -> 0 -mulx3436 multiply -17084552395.6714834680088150543965 -631925802672.685034379197328370812E+527 -> 1.07961694859382462346866817306769E+549 Inexact Rounded -powx3436 power -17084552395.6714834680088150543965 -6 -> 4.02141014977177984123011868387622E-62 Inexact Rounded -remx3436 remainder -17084552395.6714834680088150543965 -631925802672.685034379197328370812E+527 -> -17084552395.6714834680088150543965 -subx3436 subtract -17084552395.6714834680088150543965 -631925802672.685034379197328370812E+527 -> 6.31925802672685034379197328370812E+538 Inexact Rounded -addx3437 add 034956830.349823306815911887469760 -61600816.0672274126966042956781665E-667 -> 34956830.3498233068159118874697600 Inexact Rounded -comx3437 compare 034956830.349823306815911887469760 -61600816.0672274126966042956781665E-667 -> 1 -divx3437 divide 034956830.349823306815911887469760 -61600816.0672274126966042956781665E-667 -> -5.67473494371787737607169979602343E+666 Inexact Rounded -dvix3437 divideint 034956830.349823306815911887469760 -61600816.0672274126966042956781665E-667 -> NaN Division_impossible -mulx3437 multiply 034956830.349823306815911887469760 -61600816.0672274126966042956781665E-667 -> -2.15336927667273841617128781173293E-652 Inexact Rounded -powx3437 power 034956830.349823306815911887469760 -6 -> 5.48034272566098493462169431762597E-46 Inexact Rounded -remx3437 remainder 034956830.349823306815911887469760 -61600816.0672274126966042956781665E-667 -> NaN Division_impossible -subx3437 subtract 034956830.349823306815911887469760 -61600816.0672274126966042956781665E-667 -> 34956830.3498233068159118874697600 Inexact Rounded -addx3438 add -763.440067781256632695791981893608 19.9263811350611007833220620745413 -> -743.513686646195531912469919819067 Inexact Rounded -comx3438 compare -763.440067781256632695791981893608 19.9263811350611007833220620745413 -> -1 -divx3438 divide -763.440067781256632695791981893608 19.9263811350611007833220620745413 -> -38.3130314835722766807703585435688 Inexact Rounded -dvix3438 divideint -763.440067781256632695791981893608 19.9263811350611007833220620745413 -> -38 -mulx3438 multiply -763.440067781256632695791981893608 19.9263811350611007833220620745413 -> -15212.5977643862002585039364868883 Inexact Rounded -powx3438 power -763.440067781256632695791981893608 20 -> 4.52375407727336769552481661250924E+57 Inexact Rounded -remx3438 remainder -763.440067781256632695791981893608 19.9263811350611007833220620745413 -> -6.2375846489348029295536230610386 -subx3438 subtract -763.440067781256632695791981893608 19.9263811350611007833220620745413 -> -783.366448916317733479114043968149 Inexact Rounded -addx3439 add -510472027868440667684575147556654E+789 834872378550801889983927148587909 -> -5.10472027868440667684575147556654E+821 Inexact Rounded -comx3439 compare -510472027868440667684575147556654E+789 834872378550801889983927148587909 -> -1 -divx3439 divide -510472027868440667684575147556654E+789 834872378550801889983927148587909 -> -6.11437198047603754107526874071737E+788 Inexact Rounded -dvix3439 divideint -510472027868440667684575147556654E+789 834872378550801889983927148587909 -> NaN Division_impossible -mulx3439 multiply -510472027868440667684575147556654E+789 834872378550801889983927148587909 -> -4.26178996090176289115594057419892E+854 Inexact Rounded -powx3439 power -510472027868440667684575147556654E+789 8 -> 4.61079266619522147262600755274182E+6573 Inexact Rounded -remx3439 remainder -510472027868440667684575147556654E+789 834872378550801889983927148587909 -> NaN Division_impossible -subx3439 subtract -510472027868440667684575147556654E+789 834872378550801889983927148587909 -> -5.10472027868440667684575147556654E+821 Inexact Rounded -addx3440 add 070304761.560517086676993503034828E-094 -17773.7446959771077104057845273992E-761 -> 7.03047615605170866769935030348280E-87 Inexact Rounded -comx3440 compare 070304761.560517086676993503034828E-094 -17773.7446959771077104057845273992E-761 -> 1 -divx3440 divide 070304761.560517086676993503034828E-094 -17773.7446959771077104057845273992E-761 -> -3.95554019499502537743883483402608E+670 Inexact Rounded -dvix3440 divideint 070304761.560517086676993503034828E-094 -17773.7446959771077104057845273992E-761 -> NaN Division_impossible -mulx3440 multiply 070304761.560517086676993503034828E-094 -17773.7446959771077104057845273992E-761 -> -1.24957888288817581538108991453732E-843 Inexact Rounded -powx3440 power 070304761.560517086676993503034828E-094 -2 -> 2.02316135427631488479902919959627E+172 Inexact Rounded -remx3440 remainder 070304761.560517086676993503034828E-094 -17773.7446959771077104057845273992E-761 -> NaN Division_impossible -subx3440 subtract 070304761.560517086676993503034828E-094 -17773.7446959771077104057845273992E-761 -> 7.03047615605170866769935030348280E-87 Inexact Rounded -addx3441 add -0970725697662.27605454336231195463 -4541.41897546697187157913886433474 -> -970725702203.695030010334183533769 Inexact Rounded -comx3441 compare -0970725697662.27605454336231195463 -4541.41897546697187157913886433474 -> -1 -divx3441 divide -0970725697662.27605454336231195463 -4541.41897546697187157913886433474 -> 213749425.654447811698884007553614 Inexact Rounded -dvix3441 divideint -0970725697662.27605454336231195463 -4541.41897546697187157913886433474 -> 213749425 -mulx3441 multiply -0970725697662.27605454336231195463 -4541.41897546697187157913886433474 -> 4408472103336875.21161867891724392 Inexact Rounded -powx3441 power -0970725697662.27605454336231195463 -4541 -> -0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3441 remainder -0970725697662.27605454336231195463 -4541.41897546697187157913886433474 -> -2972.12171050214753770792631747550 -subx3441 subtract -0970725697662.27605454336231195463 -4541.41897546697187157913886433474 -> -970725693120.857079076390440375491 Inexact Rounded -addx3442 add -808178238631844268316111259558675 -598400.265108644514211244980426520 -> -808178238631844268316111260157075 Inexact Rounded -comx3442 compare -808178238631844268316111259558675 -598400.265108644514211244980426520 -> -1 -divx3442 divide -808178238631844268316111259558675 -598400.265108644514211244980426520 -> 1350564640015847635178945884.97836 Inexact Rounded -dvix3442 divideint -808178238631844268316111259558675 -598400.265108644514211244980426520 -> 1350564640015847635178945884 -mulx3442 multiply -808178238631844268316111259558675 -598400.265108644514211244980426520 -> 4.83614072252332979731348423145208E+38 Inexact Rounded -powx3442 power -808178238631844268316111259558675 -598400 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3442 remainder -808178238631844268316111259558675 -598400.265108644514211244980426520 -> -585452.097764536570956813681556320 -subx3442 subtract -808178238631844268316111259558675 -598400.265108644514211244980426520 -> -808178238631844268316111258960275 Inexact Rounded -addx3443 add -9.90826595069053564311371766315200 -031.625916781307847864872329806646 -> -41.5341827319983835079860474697980 Rounded -comx3443 compare -9.90826595069053564311371766315200 -031.625916781307847864872329806646 -> 1 -divx3443 divide -9.90826595069053564311371766315200 -031.625916781307847864872329806646 -> 0.313295770023233218639213140599856 Inexact Rounded -dvix3443 divideint -9.90826595069053564311371766315200 -031.625916781307847864872329806646 -> 0 -mulx3443 multiply -9.90826595069053564311371766315200 -031.625916781307847864872329806646 -> 313.357994403604968250936036978086 Inexact Rounded -powx3443 power -9.90826595069053564311371766315200 -32 -> 1.34299698259038003011439568004625E-32 Inexact Rounded -remx3443 remainder -9.90826595069053564311371766315200 -031.625916781307847864872329806646 -> -9.90826595069053564311371766315200 -subx3443 subtract -9.90826595069053564311371766315200 -031.625916781307847864872329806646 -> 21.7176508306173122217586121434940 Rounded -addx3444 add -196925.469891897719160698483752907 -41268.9975444533794067723958739778 -> -238194.467436351098567470879626885 Inexact Rounded -comx3444 compare -196925.469891897719160698483752907 -41268.9975444533794067723958739778 -> -1 -divx3444 divide -196925.469891897719160698483752907 -41268.9975444533794067723958739778 -> 4.77175317088274715226553516820589 Inexact Rounded -dvix3444 divideint -196925.469891897719160698483752907 -41268.9975444533794067723958739778 -> 4 -mulx3444 multiply -196925.469891897719160698483752907 -41268.9975444533794067723958739778 -> 8126916733.40905487026003135987472 Inexact Rounded -powx3444 power -196925.469891897719160698483752907 -41269 -> -0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3444 remainder -196925.469891897719160698483752907 -41268.9975444533794067723958739778 -> -31849.4797140842015336089002569958 -subx3444 subtract -196925.469891897719160698483752907 -41268.9975444533794067723958739778 -> -155656.472347444339753926087878929 Inexact Rounded -addx3445 add 421071135212152225162086005824310 1335320330.08964354845796510145246E-604 -> 421071135212152225162086005824310 Inexact Rounded -comx3445 compare 421071135212152225162086005824310 1335320330.08964354845796510145246E-604 -> 1 -divx3445 divide 421071135212152225162086005824310 1335320330.08964354845796510145246E-604 -> 3.15333426537349744281860005497304E+627 Inexact Rounded -dvix3445 divideint 421071135212152225162086005824310 1335320330.08964354845796510145246E-604 -> NaN Division_impossible -mulx3445 multiply 421071135212152225162086005824310 1335320330.08964354845796510145246E-604 -> 5.62264847262712040027311932121460E-563 Inexact Rounded -powx3445 power 421071135212152225162086005824310 1 -> 421071135212152225162086005824310 -remx3445 remainder 421071135212152225162086005824310 1335320330.08964354845796510145246E-604 -> NaN Division_impossible -subx3445 subtract 421071135212152225162086005824310 1335320330.08964354845796510145246E-604 -> 421071135212152225162086005824310 Inexact Rounded -addx3446 add 1249441.46421514282301182772247227 -0289848.71208912281976374705180836E-676 -> 1249441.46421514282301182772247227 Inexact Rounded -comx3446 compare 1249441.46421514282301182772247227 -0289848.71208912281976374705180836E-676 -> 1 -divx3446 divide 1249441.46421514282301182772247227 -0289848.71208912281976374705180836E-676 -> -4.31066764178328992440635387255816E+676 Inexact Rounded -dvix3446 divideint 1249441.46421514282301182772247227 -0289848.71208912281976374705180836E-676 -> NaN Division_impossible -mulx3446 multiply 1249441.46421514282301182772247227 -0289848.71208912281976374705180836E-676 -> -3.62148999233506984566620611700349E-665 Inexact Rounded -powx3446 power 1249441.46421514282301182772247227 -3 -> 5.12686942572191282348415024932322E-19 Inexact Rounded -remx3446 remainder 1249441.46421514282301182772247227 -0289848.71208912281976374705180836E-676 -> NaN Division_impossible -subx3446 subtract 1249441.46421514282301182772247227 -0289848.71208912281976374705180836E-676 -> 1249441.46421514282301182772247227 Inexact Rounded -addx3447 add 74815000.4716875558358937279052903 -690425401708167622194241915195001E+891 -> -6.90425401708167622194241915195001E+923 Inexact Rounded -comx3447 compare 74815000.4716875558358937279052903 -690425401708167622194241915195001E+891 -> 1 -divx3447 divide 74815000.4716875558358937279052903 -690425401708167622194241915195001E+891 -> -1.08360729901578455109968388309079E-916 Inexact Rounded -dvix3447 divideint 74815000.4716875558358937279052903 -690425401708167622194241915195001E+891 -> -0 -mulx3447 multiply 74815000.4716875558358937279052903 -690425401708167622194241915195001E+891 -> -5.16541767544616308732028810026275E+931 Inexact Rounded -powx3447 power 74815000.4716875558358937279052903 -7 -> 7.62218032252683815537906972439985E-56 Inexact Rounded -remx3447 remainder 74815000.4716875558358937279052903 -690425401708167622194241915195001E+891 -> 74815000.4716875558358937279052903 -subx3447 subtract 74815000.4716875558358937279052903 -690425401708167622194241915195001E+891 -> 6.90425401708167622194241915195001E+923 Inexact Rounded -addx3448 add -1683993.51210241555668790556759021 -72394384927344.8402585228267493374 -> -72394386611338.3523609383834372430 Inexact Rounded -comx3448 compare -1683993.51210241555668790556759021 -72394384927344.8402585228267493374 -> 1 -divx3448 divide -1683993.51210241555668790556759021 -72394384927344.8402585228267493374 -> 2.32613829621244113284301004158794E-8 Inexact Rounded -dvix3448 divideint -1683993.51210241555668790556759021 -72394384927344.8402585228267493374 -> 0 -mulx3448 multiply -1683993.51210241555668790556759021 -72394384927344.8402585228267493374 -> 121911674530293613615.441384822381 Inexact Rounded -powx3448 power -1683993.51210241555668790556759021 -7 -> -2.60385683509956889000676113860292E-44 Inexact Rounded -remx3448 remainder -1683993.51210241555668790556759021 -72394384927344.8402585228267493374 -> -1683993.51210241555668790556759021 -subx3448 subtract -1683993.51210241555668790556759021 -72394384927344.8402585228267493374 -> 72394383243351.3281561072700614318 Inexact Rounded -addx3449 add -763.148530974741766171756970448158 517370.808956957601473642272664647 -> 516607.660425982859707470515694199 Inexact Rounded -comx3449 compare -763.148530974741766171756970448158 517370.808956957601473642272664647 -> -1 -divx3449 divide -763.148530974741766171756970448158 517370.808956957601473642272664647 -> -0.00147505139014951946381155525173867 Inexact Rounded -dvix3449 divideint -763.148530974741766171756970448158 517370.808956957601473642272664647 -> -0 -mulx3449 multiply -763.148530974741766171756970448158 517370.808956957601473642272664647 -> -394830772.824715962925351447322187 Inexact Rounded -powx3449 power -763.148530974741766171756970448158 517371 -> -Infinity Overflow Inexact Rounded -remx3449 remainder -763.148530974741766171756970448158 517370.808956957601473642272664647 -> -763.148530974741766171756970448158 -subx3449 subtract -763.148530974741766171756970448158 517370.808956957601473642272664647 -> -518133.957487932343239814029635095 Inexact Rounded -addx3450 add -77.5841338812312523460591226178754 -927540422.641025050968830154578151E+524 -> -9.27540422641025050968830154578151E+532 Inexact Rounded -comx3450 compare -77.5841338812312523460591226178754 -927540422.641025050968830154578151E+524 -> 1 -divx3450 divide -77.5841338812312523460591226178754 -927540422.641025050968830154578151E+524 -> 8.36450164191471769978415758342237E-532 Inexact Rounded -dvix3450 divideint -77.5841338812312523460591226178754 -927540422.641025050968830154578151E+524 -> 0 -mulx3450 multiply -77.5841338812312523460591226178754 -927540422.641025050968830154578151E+524 -> 7.19624203304351070562409746475943E+534 Inexact Rounded -powx3450 power -77.5841338812312523460591226178754 -9 -> -9.81846856873938549466341693997829E-18 Inexact Rounded -remx3450 remainder -77.5841338812312523460591226178754 -927540422.641025050968830154578151E+524 -> -77.5841338812312523460591226178754 -subx3450 subtract -77.5841338812312523460591226178754 -927540422.641025050968830154578151E+524 -> 9.27540422641025050968830154578151E+532 Inexact Rounded -addx3451 add 5176295309.89943746236102209837813 -129733.103628797477167908698565465 -> 5176165576.79580866488385418967956 Inexact Rounded -comx3451 compare 5176295309.89943746236102209837813 -129733.103628797477167908698565465 -> 1 -divx3451 divide 5176295309.89943746236102209837813 -129733.103628797477167908698565465 -> -39899.5720067736855444089432524094 Inexact Rounded -dvix3451 divideint 5176295309.89943746236102209837813 -129733.103628797477167908698565465 -> -39899 -mulx3451 multiply 5176295309.89943746236102209837813 -129733.103628797477167908698565465 -> -671536855852442.071887385512001794 Inexact Rounded -powx3451 power 5176295309.89943746236102209837813 -129733 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3451 remainder 5176295309.89943746236102209837813 -129733.103628797477167908698565465 -> 74208.214046920838632934314641965 -subx3451 subtract 5176295309.89943746236102209837813 -129733.103628797477167908698565465 -> 5176425043.00306625983819000707670 Inexact Rounded -addx3452 add 4471634841166.90197229286530307326E+172 31511104397.8671727003201890825879E-955 -> 4.47163484116690197229286530307326E+184 Inexact Rounded -comx3452 compare 4471634841166.90197229286530307326E+172 31511104397.8671727003201890825879E-955 -> 1 -divx3452 divide 4471634841166.90197229286530307326E+172 31511104397.8671727003201890825879E-955 -> 1.41906636616314987705536737025932E+1129 Inexact Rounded -dvix3452 divideint 4471634841166.90197229286530307326E+172 31511104397.8671727003201890825879E-955 -> NaN Division_impossible -mulx3452 multiply 4471634841166.90197229286530307326E+172 31511104397.8671727003201890825879E-955 -> 1.40906152309150441010046222214810E-760 Inexact Rounded -powx3452 power 4471634841166.90197229286530307326E+172 3 -> 8.94126556389673498386397569249516E+553 Inexact Rounded -remx3452 remainder 4471634841166.90197229286530307326E+172 31511104397.8671727003201890825879E-955 -> NaN Division_impossible -subx3452 subtract 4471634841166.90197229286530307326E+172 31511104397.8671727003201890825879E-955 -> 4.47163484116690197229286530307326E+184 Inexact Rounded -addx3453 add -8189130.15945231049670285726774317 2.57912402871404325831670923864936E-366 -> -8189130.15945231049670285726774317 Inexact Rounded -comx3453 compare -8189130.15945231049670285726774317 2.57912402871404325831670923864936E-366 -> -1 -divx3453 divide -8189130.15945231049670285726774317 2.57912402871404325831670923864936E-366 -> -3.17515949922556778343526099830093E+372 Inexact Rounded -dvix3453 divideint -8189130.15945231049670285726774317 2.57912402871404325831670923864936E-366 -> NaN Division_impossible -mulx3453 multiply -8189130.15945231049670285726774317 2.57912402871404325831670923864936E-366 -> -2.11207823685103185039979144161848E-359 Inexact Rounded -powx3453 power -8189130.15945231049670285726774317 3 -> -549178241054875982731.000937875885 Inexact Rounded -remx3453 remainder -8189130.15945231049670285726774317 2.57912402871404325831670923864936E-366 -> NaN Division_impossible -subx3453 subtract -8189130.15945231049670285726774317 2.57912402871404325831670923864936E-366 -> -8189130.15945231049670285726774317 Inexact Rounded -addx3454 add -254346232981353293392888785643245 -764.416902486152093758287929678445 -> -254346232981353293392888785644009 Inexact Rounded -comx3454 compare -254346232981353293392888785643245 -764.416902486152093758287929678445 -> -1 -divx3454 divide -254346232981353293392888785643245 -764.416902486152093758287929678445 -> 332732350833857889204406356900.665 Inexact Rounded -dvix3454 divideint -254346232981353293392888785643245 -764.416902486152093758287929678445 -> 332732350833857889204406356900 -mulx3454 multiply -254346232981353293392888785643245 -764.416902486152093758287929678445 -> 1.94426559574627262006307326336289E+35 Inexact Rounded -powx3454 power -254346232981353293392888785643245 -764 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3454 remainder -254346232981353293392888785643245 -764.416902486152093758287929678445 -> -508.299323962538610580669092979500 -subx3454 subtract -254346232981353293392888785643245 -764.416902486152093758287929678445 -> -254346232981353293392888785642481 Inexact Rounded -addx3455 add -2875.36745499544177964804277329726 -13187.8492045054802205691248267638 -> -16063.2166595009220002171676000611 Inexact Rounded -comx3455 compare -2875.36745499544177964804277329726 -13187.8492045054802205691248267638 -> 1 -divx3455 divide -2875.36745499544177964804277329726 -13187.8492045054802205691248267638 -> 0.218031569091122520391599541575615 Inexact Rounded -dvix3455 divideint -2875.36745499544177964804277329726 -13187.8492045054802205691248267638 -> 0 -mulx3455 multiply -2875.36745499544177964804277329726 -13187.8492045054802205691248267638 -> 37919912.4040225840727281633024665 Inexact Rounded -powx3455 power -2875.36745499544177964804277329726 -13188 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3455 remainder -2875.36745499544177964804277329726 -13187.8492045054802205691248267638 -> -2875.36745499544177964804277329726 -subx3455 subtract -2875.36745499544177964804277329726 -13187.8492045054802205691248267638 -> 10312.4817495100384409210820534665 Inexact Rounded -addx3456 add -7.26927570984219944693602140223103 0160883021541.32275286769110003971E-438 -> -7.26927570984219944693602140223103 Inexact Rounded -comx3456 compare -7.26927570984219944693602140223103 0160883021541.32275286769110003971E-438 -> -1 -divx3456 divide -7.26927570984219944693602140223103 0160883021541.32275286769110003971E-438 -> -4.51836100553039917574557235275173E+427 Inexact Rounded -dvix3456 divideint -7.26927570984219944693602140223103 0160883021541.32275286769110003971E-438 -> NaN Division_impossible -mulx3456 multiply -7.26927570984219944693602140223103 0160883021541.32275286769110003971E-438 -> -1.16950304061635681891361504442479E-426 Inexact Rounded -powx3456 power -7.26927570984219944693602140223103 2 -> 52.8423693457018126451998096211036 Inexact Rounded -remx3456 remainder -7.26927570984219944693602140223103 0160883021541.32275286769110003971E-438 -> NaN Division_impossible -subx3456 subtract -7.26927570984219944693602140223103 0160883021541.32275286769110003971E-438 -> -7.26927570984219944693602140223103 Inexact Rounded -addx3457 add -28567151.6868762752241056540028515E+498 -4470.15455137546427645290210989675 -> -2.85671516868762752241056540028515E+505 Inexact Rounded -comx3457 compare -28567151.6868762752241056540028515E+498 -4470.15455137546427645290210989675 -> -1 -divx3457 divide -28567151.6868762752241056540028515E+498 -4470.15455137546427645290210989675 -> 6.39064071690455919792707589054106E+501 Inexact Rounded -dvix3457 divideint -28567151.6868762752241056540028515E+498 -4470.15455137546427645290210989675 -> NaN Division_impossible -mulx3457 multiply -28567151.6868762752241056540028515E+498 -4470.15455137546427645290210989675 -> 1.27699583132923253605397736797000E+509 Inexact Rounded -powx3457 power -28567151.6868762752241056540028515E+498 -4470 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3457 remainder -28567151.6868762752241056540028515E+498 -4470.15455137546427645290210989675 -> NaN Division_impossible -subx3457 subtract -28567151.6868762752241056540028515E+498 -4470.15455137546427645290210989675 -> -2.85671516868762752241056540028515E+505 Inexact Rounded -addx3458 add 7191753.79974136447257468282073718 81.3878426176038487948375777384429 -> 7191835.18758398207642347765831492 Inexact Rounded -comx3458 compare 7191753.79974136447257468282073718 81.3878426176038487948375777384429 -> 1 -divx3458 divide 7191753.79974136447257468282073718 81.3878426176038487948375777384429 -> 88363.9812586188186733935569874100 Inexact Rounded -dvix3458 divideint 7191753.79974136447257468282073718 81.3878426176038487948375777384429 -> 88363 -mulx3458 multiply 7191753.79974136447257468282073718 81.3878426176038487948375777384429 -> 585321326.397904638863485891524555 Inexact Rounded -powx3458 power 7191753.79974136447257468282073718 81 -> 2.53290983138561482612557404148760E+555 Inexact Rounded -remx3458 remainder 7191753.79974136447257468282073718 81.3878426176038487948375777384429 -> 79.8625220355815164499390351500273 -subx3458 subtract 7191753.79974136447257468282073718 81.3878426176038487948375777384429 -> 7191672.41189874686872588798315944 Inexact Rounded -addx3459 add 502975804.069864536104621700404770 684.790028432074527960269515227243 -> 502976488.859892968179149660674285 Inexact Rounded -comx3459 compare 502975804.069864536104621700404770 684.790028432074527960269515227243 -> 1 -divx3459 divide 502975804.069864536104621700404770 684.790028432074527960269515227243 -> 734496.390406706323899801641278933 Inexact Rounded -dvix3459 divideint 502975804.069864536104621700404770 684.790028432074527960269515227243 -> 734496 -mulx3459 multiply 502975804.069864536104621700404770 684.790028432074527960269515227243 -> 344432815169.648082754214631086270 Inexact Rounded -powx3459 power 502975804.069864536104621700404770 685 -> 3.62876716573623552761739177592677E+5960 Inexact Rounded -remx3459 remainder 502975804.069864536104621700404770 684.790028432074527960269515227243 -> 267.346619523615915582548420925472 -subx3459 subtract 502975804.069864536104621700404770 684.790028432074527960269515227243 -> 502975119.279836104030093740135255 Inexact Rounded -addx3460 add 1505368.42063731861590460453659570 -465242.678439951462767630022819105 -> 1040125.74219736715313697451377660 Inexact Rounded -comx3460 compare 1505368.42063731861590460453659570 -465242.678439951462767630022819105 -> 1 -divx3460 divide 1505368.42063731861590460453659570 -465242.678439951462767630022819105 -> -3.23566278503319947059213001405065 Inexact Rounded -dvix3460 divideint 1505368.42063731861590460453659570 -465242.678439951462767630022819105 -> -3 -mulx3460 multiply 1505368.42063731861590460453659570 -465242.678439951462767630022819105 -> -700361636056.225618266296899048765 Inexact Rounded -powx3460 power 1505368.42063731861590460453659570 -465243 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3460 remainder 1505368.42063731861590460453659570 -465242.678439951462767630022819105 -> 109640.385317464227601714468138385 -subx3460 subtract 1505368.42063731861590460453659570 -465242.678439951462767630022819105 -> 1970611.09907727007867223455941481 Inexact Rounded -addx3461 add 69225023.2850142784063416137144829 8584050.06648191798834819995325693 -> 77809073.3514961963946898136677398 Inexact Rounded -comx3461 compare 69225023.2850142784063416137144829 8584050.06648191798834819995325693 -> 1 -divx3461 divide 69225023.2850142784063416137144829 8584050.06648191798834819995325693 -> 8.06437785764050431295652411163382 Inexact Rounded -dvix3461 divideint 69225023.2850142784063416137144829 8584050.06648191798834819995325693 -> 8 -mulx3461 multiply 69225023.2850142784063416137144829 8584050.06648191798834819995325693 -> 594231065731939.137329770485497261 Inexact Rounded -powx3461 power 69225023.2850142784063416137144829 8584050 -> Infinity Overflow Inexact Rounded -remx3461 remainder 69225023.2850142784063416137144829 8584050.06648191798834819995325693 -> 552622.75315893449955601408842746 -subx3461 subtract 69225023.2850142784063416137144829 8584050.06648191798834819995325693 -> 60640973.2185323604179934137612260 Inexact Rounded -addx3462 add -55669501853.7751006841940471339310E+614 061400538.186044693233816566977189 -> -5.56695018537751006841940471339310E+624 Inexact Rounded -comx3462 compare -55669501853.7751006841940471339310E+614 061400538.186044693233816566977189 -> -1 -divx3462 divide -55669501853.7751006841940471339310E+614 061400538.186044693233816566977189 -> -9.06661464189378059067792554300676E+616 Inexact Rounded -dvix3462 divideint -55669501853.7751006841940471339310E+614 061400538.186044693233816566977189 -> NaN Division_impossible -mulx3462 multiply -55669501853.7751006841940471339310E+614 061400538.186044693233816566977189 -> -3.41813737437080390787865389703565E+632 Inexact Rounded -powx3462 power -55669501853.7751006841940471339310E+614 61400538 -> Infinity Overflow Inexact Rounded -remx3462 remainder -55669501853.7751006841940471339310E+614 061400538.186044693233816566977189 -> NaN Division_impossible -subx3462 subtract -55669501853.7751006841940471339310E+614 061400538.186044693233816566977189 -> -5.56695018537751006841940471339310E+624 Inexact Rounded -addx3463 add -527566.521273992424649346837337602E-408 -834662.599983953345718523807123972 -> -834662.599983953345718523807123972 Inexact Rounded -comx3463 compare -527566.521273992424649346837337602E-408 -834662.599983953345718523807123972 -> 1 -divx3463 divide -527566.521273992424649346837337602E-408 -834662.599983953345718523807123972 -> 6.32071595497552015656909892339226E-409 Inexact Rounded -dvix3463 divideint -527566.521273992424649346837337602E-408 -834662.599983953345718523807123972 -> 0 -mulx3463 multiply -527566.521273992424649346837337602E-408 -834662.599983953345718523807123972 -> 4.40340044311040151960763108019957E-397 Inexact Rounded -powx3463 power -527566.521273992424649346837337602E-408 -834663 -> -Infinity Overflow Inexact Rounded -remx3463 remainder -527566.521273992424649346837337602E-408 -834662.599983953345718523807123972 -> -5.27566521273992424649346837337602E-403 -subx3463 subtract -527566.521273992424649346837337602E-408 -834662.599983953345718523807123972 -> 834662.599983953345718523807123972 Inexact Rounded -addx3464 add 69065510.0459653699418083455335366 694848643848212520086960886818157E-853 -> 69065510.0459653699418083455335366 Inexact Rounded -comx3464 compare 69065510.0459653699418083455335366 694848643848212520086960886818157E-853 -> 1 -divx3464 divide 69065510.0459653699418083455335366 694848643848212520086960886818157E-853 -> 9.93964810285396646889830919492683E+827 Inexact Rounded -dvix3464 divideint 69065510.0459653699418083455335366 694848643848212520086960886818157E-853 -> NaN Division_impossible -mulx3464 multiply 69065510.0459653699418083455335366 694848643848212520086960886818157E-853 -> 4.79900759921241352562381181332720E-813 Inexact Rounded -powx3464 power 69065510.0459653699418083455335366 7 -> 7.49598249763416483824919118973567E+54 Inexact Rounded -remx3464 remainder 69065510.0459653699418083455335366 694848643848212520086960886818157E-853 -> NaN Division_impossible -subx3464 subtract 69065510.0459653699418083455335366 694848643848212520086960886818157E-853 -> 69065510.0459653699418083455335366 Inexact Rounded -addx3465 add -2921982.82411285505229122890041841 -72994.6523840298017471962569778803E-763 -> -2921982.82411285505229122890041841 Inexact Rounded -comx3465 compare -2921982.82411285505229122890041841 -72994.6523840298017471962569778803E-763 -> -1 -divx3465 divide -2921982.82411285505229122890041841 -72994.6523840298017471962569778803E-763 -> 4.00300943792444663467732029501716E+764 Inexact Rounded -dvix3465 divideint -2921982.82411285505229122890041841 -72994.6523840298017471962569778803E-763 -> NaN Division_impossible -mulx3465 multiply -2921982.82411285505229122890041841 -72994.6523840298017471962569778803E-763 -> 2.13289120518223547921212412642411E-752 Inexact Rounded -powx3465 power -2921982.82411285505229122890041841 -7 -> -5.49865394870631248479668782154131E-46 Inexact Rounded -remx3465 remainder -2921982.82411285505229122890041841 -72994.6523840298017471962569778803E-763 -> NaN Division_impossible -subx3465 subtract -2921982.82411285505229122890041841 -72994.6523840298017471962569778803E-763 -> -2921982.82411285505229122890041841 Inexact Rounded -addx3466 add 4.51117459466491451401835756593793 3873385.19981811640063144338087230 -> 3873389.71099271106554595739922987 Inexact Rounded -comx3466 compare 4.51117459466491451401835756593793 3873385.19981811640063144338087230 -> -1 -divx3466 divide 4.51117459466491451401835756593793 3873385.19981811640063144338087230 -> 0.00000116465942888322776753062580106351 Inexact Rounded -dvix3466 divideint 4.51117459466491451401835756593793 3873385.19981811640063144338087230 -> 0 -mulx3466 multiply 4.51117459466491451401835756593793 3873385.19981811640063144338087230 -> 17473516.9087705701652062546164705 Inexact Rounded -powx3466 power 4.51117459466491451401835756593793 3873385 -> Infinity Overflow Inexact Rounded -remx3466 remainder 4.51117459466491451401835756593793 3873385.19981811640063144338087230 -> 4.51117459466491451401835756593793 -subx3466 subtract 4.51117459466491451401835756593793 3873385.19981811640063144338087230 -> -3873380.68864352173571692936251473 Inexact Rounded -addx3467 add 49553763474698.8118661758811091120 36.1713861293896216593840817950781E+410 -> 3.61713861293896216593840817950781E+411 Inexact Rounded -comx3467 compare 49553763474698.8118661758811091120 36.1713861293896216593840817950781E+410 -> -1 -divx3467 divide 49553763474698.8118661758811091120 36.1713861293896216593840817950781E+410 -> 1.36997137177543416190811827685231E-398 Inexact Rounded -dvix3467 divideint 49553763474698.8118661758811091120 36.1713861293896216593840817950781E+410 -> 0 -mulx3467 multiply 49553763474698.8118661758811091120 36.1713861293896216593840817950781E+410 -> 1.79242831280777466554271332425735E+425 Inexact Rounded -powx3467 power 49553763474698.8118661758811091120 4 -> 6.02985091099730236635954801474802E+54 Inexact Rounded -remx3467 remainder 49553763474698.8118661758811091120 36.1713861293896216593840817950781E+410 -> 49553763474698.8118661758811091120 -subx3467 subtract 49553763474698.8118661758811091120 36.1713861293896216593840817950781E+410 -> -3.61713861293896216593840817950781E+411 Inexact Rounded -addx3468 add 755985583344.379951506071499170749E+956 746921095569971477373643487285780 -> 7.55985583344379951506071499170749E+967 Inexact Rounded -comx3468 compare 755985583344.379951506071499170749E+956 746921095569971477373643487285780 -> 1 -divx3468 divide 755985583344.379951506071499170749E+956 746921095569971477373643487285780 -> 1.01213580367212873025671916758669E+935 Inexact Rounded -dvix3468 divideint 755985583344.379951506071499170749E+956 746921095569971477373643487285780 -> NaN Division_impossible -mulx3468 multiply 755985583344.379951506071499170749E+956 746921095569971477373643487285780 -> 5.64661580146688255286933753616580E+1000 Inexact Rounded -powx3468 power 755985583344.379951506071499170749E+956 7 -> 1.41121958516547725677142981375469E+6775 Inexact Rounded -remx3468 remainder 755985583344.379951506071499170749E+956 746921095569971477373643487285780 -> NaN Division_impossible -subx3468 subtract 755985583344.379951506071499170749E+956 746921095569971477373643487285780 -> 7.55985583344379951506071499170749E+967 Inexact Rounded -addx3469 add -20101668541.7472260497594230105456 -395562148.345003931161532101109964 -> -20497230690.0922299809209551116556 Inexact Rounded -comx3469 compare -20101668541.7472260497594230105456 -395562148.345003931161532101109964 -> -1 -divx3469 divide -20101668541.7472260497594230105456 -395562148.345003931161532101109964 -> 50.8179779735012053661447873666816 Inexact Rounded -dvix3469 divideint -20101668541.7472260497594230105456 -395562148.345003931161532101109964 -> 50 -mulx3469 multiply -20101668541.7472260497594230105456 -395562148.345003931161532101109964 -> 7951459193692715079.09328760016914 Inexact Rounded -powx3469 power -20101668541.7472260497594230105456 -395562148 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3469 remainder -20101668541.7472260497594230105456 -395562148.345003931161532101109964 -> -323561124.497029491682817955047400 -subx3469 subtract -20101668541.7472260497594230105456 -395562148.345003931161532101109964 -> -19706106393.4022221185978909094356 Inexact Rounded -addx3470 add 5583903.18072100716072011264668631 460868914694.088387067451312500723 -> 460874498597.269108074612032613370 Inexact Rounded -comx3470 compare 5583903.18072100716072011264668631 460868914694.088387067451312500723 -> -1 -divx3470 divide 5583903.18072100716072011264668631 460868914694.088387067451312500723 -> 0.0000121160334374633240168068405467307 Inexact Rounded -dvix3470 divideint 5583903.18072100716072011264668631 460868914694.088387067451312500723 -> 0 -mulx3470 multiply 5583903.18072100716072011264668631 460868914694.088387067451312500723 -> 2573447398655758659.39475672905225 Inexact Rounded -powx3470 power 5583903.18072100716072011264668631 5 -> 5.42861943589418603298670454702901E+33 Inexact Rounded -remx3470 remainder 5583903.18072100716072011264668631 460868914694.088387067451312500723 -> 5583903.18072100716072011264668631 -subx3470 subtract 5583903.18072100716072011264668631 460868914694.088387067451312500723 -> -460863330790.907666060290592388076 Inexact Rounded -addx3471 add -955638397975240685017992436116257E+020 -508580.148958769104511751975720470E+662 -> -5.08580148958769104511751975720470E+667 Inexact Rounded -comx3471 compare -955638397975240685017992436116257E+020 -508580.148958769104511751975720470E+662 -> 1 -divx3471 divide -955638397975240685017992436116257E+020 -508580.148958769104511751975720470E+662 -> 1.87903204624039476408191264564568E-615 Inexact Rounded -dvix3471 divideint -955638397975240685017992436116257E+020 -508580.148958769104511751975720470E+662 -> 0 -mulx3471 multiply -955638397975240685017992436116257E+020 -508580.148958769104511751975720470E+662 -> 4.86018718792967378985838739820108E+720 Inexact Rounded -powx3471 power -955638397975240685017992436116257E+020 -5 -> -1.25467730420304189161768408462414E-265 Inexact Rounded -remx3471 remainder -955638397975240685017992436116257E+020 -508580.148958769104511751975720470E+662 -> -9.55638397975240685017992436116257E+52 -subx3471 subtract -955638397975240685017992436116257E+020 -508580.148958769104511751975720470E+662 -> 5.08580148958769104511751975720470E+667 Inexact Rounded -addx3472 add -136243796098020983814115584402407E+796 6589108083.99750311651581032447390 -> -1.36243796098020983814115584402407E+828 Inexact Rounded -comx3472 compare -136243796098020983814115584402407E+796 6589108083.99750311651581032447390 -> -1 -divx3472 divide -136243796098020983814115584402407E+796 6589108083.99750311651581032447390 -> -2.06771226638255600634939371365920E+818 Inexact Rounded -dvix3472 divideint -136243796098020983814115584402407E+796 6589108083.99750311651581032447390 -> NaN Division_impossible -mulx3472 multiply -136243796098020983814115584402407E+796 6589108083.99750311651581032447390 -> -8.97725098263977535966921696143011E+837 Inexact Rounded -powx3472 power -136243796098020983814115584402407E+796 7 -> -8.71399185551742199752832286984005E+5796 Inexact Rounded -remx3472 remainder -136243796098020983814115584402407E+796 6589108083.99750311651581032447390 -> NaN Division_impossible -subx3472 subtract -136243796098020983814115584402407E+796 6589108083.99750311651581032447390 -> -1.36243796098020983814115584402407E+828 Inexact Rounded -addx3473 add -808498.482718304598213092937543934E+521 48005.1465097914355096301483788905 -> -8.08498482718304598213092937543934E+526 Inexact Rounded -comx3473 compare -808498.482718304598213092937543934E+521 48005.1465097914355096301483788905 -> -1 -divx3473 divide -808498.482718304598213092937543934E+521 48005.1465097914355096301483788905 -> -1.68419126177106468565397017107736E+522 Inexact Rounded -dvix3473 divideint -808498.482718304598213092937543934E+521 48005.1465097914355096301483788905 -> NaN Division_impossible -mulx3473 multiply -808498.482718304598213092937543934E+521 48005.1465097914355096301483788905 -> -3.88120881158362912220132691803539E+531 Inexact Rounded -powx3473 power -808498.482718304598213092937543934E+521 48005 -> -Infinity Overflow Inexact Rounded -remx3473 remainder -808498.482718304598213092937543934E+521 48005.1465097914355096301483788905 -> NaN Division_impossible -subx3473 subtract -808498.482718304598213092937543934E+521 48005.1465097914355096301483788905 -> -8.08498482718304598213092937543934E+526 Inexact Rounded -addx3474 add -812.266340554281305985524813074211E+396 -3195.63111559114001594257448970812E+986 -> -3.19563111559114001594257448970812E+989 Inexact Rounded -comx3474 compare -812.266340554281305985524813074211E+396 -3195.63111559114001594257448970812E+986 -> 1 -divx3474 divide -812.266340554281305985524813074211E+396 -3195.63111559114001594257448970812E+986 -> 2.54180257724779721448484781056040E-591 Inexact Rounded -dvix3474 divideint -812.266340554281305985524813074211E+396 -3195.63111559114001594257448970812E+986 -> 0 -mulx3474 multiply -812.266340554281305985524813074211E+396 -3195.63111559114001594257448970812E+986 -> 2.59570359202261082537505332325404E+1388 Inexact Rounded -powx3474 power -812.266340554281305985524813074211E+396 -3 -> -1.86596988030914616216741808216469E-1197 Inexact Rounded -remx3474 remainder -812.266340554281305985524813074211E+396 -3195.63111559114001594257448970812E+986 -> -8.12266340554281305985524813074211E+398 -subx3474 subtract -812.266340554281305985524813074211E+396 -3195.63111559114001594257448970812E+986 -> 3.19563111559114001594257448970812E+989 Inexact Rounded -addx3475 add -929889.720905183397678866648217793E+134 -280300190774.057595671079264841349 -> -9.29889720905183397678866648217793E+139 Inexact Rounded -comx3475 compare -929889.720905183397678866648217793E+134 -280300190774.057595671079264841349 -> -1 -divx3475 divide -929889.720905183397678866648217793E+134 -280300190774.057595671079264841349 -> 3.31747801646964399331556971055197E+128 Inexact Rounded -dvix3475 divideint -929889.720905183397678866648217793E+134 -280300190774.057595671079264841349 -> NaN Division_impossible -mulx3475 multiply -929889.720905183397678866648217793E+134 -280300190774.057595671079264841349 -> 2.60648266168558079957349074609920E+151 Inexact Rounded -powx3475 power -929889.720905183397678866648217793E+134 -3 -> -1.24367143370300189518778505830181E-420 Inexact Rounded -remx3475 remainder -929889.720905183397678866648217793E+134 -280300190774.057595671079264841349 -> NaN Division_impossible -subx3475 subtract -929889.720905183397678866648217793E+134 -280300190774.057595671079264841349 -> -9.29889720905183397678866648217793E+139 Inexact Rounded -addx3476 add 83946.0157801953636255078996185540 492670373.235391665758701500314473 -> 492754319.251171861122327008214092 Inexact Rounded -comx3476 compare 83946.0157801953636255078996185540 492670373.235391665758701500314473 -> -1 -divx3476 divide 83946.0157801953636255078996185540 492670373.235391665758701500314473 -> 0.000170389819117633485695890041185782 Inexact Rounded -dvix3476 divideint 83946.0157801953636255078996185540 492670373.235391665758701500314473 -> 0 -mulx3476 multiply 83946.0157801953636255078996185540 492670373.235391665758701500314473 -> 41357714926052.9282985560380064649 Inexact Rounded -powx3476 power 83946.0157801953636255078996185540 492670373 -> Infinity Overflow Inexact Rounded -remx3476 remainder 83946.0157801953636255078996185540 492670373.235391665758701500314473 -> 83946.0157801953636255078996185540 -subx3476 subtract 83946.0157801953636255078996185540 492670373.235391665758701500314473 -> -492586427.219611470395075992414854 Inexact Rounded -addx3477 add 7812758113817.99135851825223122508 3037492.36716301443309571918002123E-157 -> 7812758113817.99135851825223122508 Inexact Rounded -comx3477 compare 7812758113817.99135851825223122508 3037492.36716301443309571918002123E-157 -> 1 -divx3477 divide 7812758113817.99135851825223122508 3037492.36716301443309571918002123E-157 -> 2.57210790001590171809512871857381E+163 Inexact Rounded -dvix3477 divideint 7812758113817.99135851825223122508 3037492.36716301443309571918002123E-157 -> NaN Division_impossible -mulx3477 multiply 7812758113817.99135851825223122508 3037492.36716301443309571918002123E-157 -> 2.37311931372130583136091717093935E-138 Inexact Rounded -powx3477 power 7812758113817.99135851825223122508 3 -> 4.76884421816246896090414314934253E+38 Inexact Rounded -remx3477 remainder 7812758113817.99135851825223122508 3037492.36716301443309571918002123E-157 -> NaN Division_impossible -subx3477 subtract 7812758113817.99135851825223122508 3037492.36716301443309571918002123E-157 -> 7812758113817.99135851825223122508 Inexact Rounded -addx3478 add 489191747.148674326757767356626016 01136942.1182277580093027768490545 -> 490328689.266902084767070133475071 Inexact Rounded -comx3478 compare 489191747.148674326757767356626016 01136942.1182277580093027768490545 -> 1 -divx3478 divide 489191747.148674326757767356626016 01136942.1182277580093027768490545 -> 430.269702657525223124148258641358 Inexact Rounded -dvix3478 divideint 489191747.148674326757767356626016 01136942.1182277580093027768490545 -> 430 -mulx3478 multiply 489191747.148674326757767356626016 01136942.1182277580093027768490545 -> 556182701222751.588454129518830550 Inexact Rounded -powx3478 power 489191747.148674326757767356626016 1136942 -> Infinity Overflow Inexact Rounded -remx3478 remainder 489191747.148674326757767356626016 01136942.1182277580093027768490545 -> 306636.3107383827575733115325810 -subx3478 subtract 489191747.148674326757767356626016 01136942.1182277580093027768490545 -> 488054805.030446568748464579776962 Inexact Rounded -addx3479 add -599369540.373174482335865567937853E+289 -38288383205.6749439588707955585209 -> -5.99369540373174482335865567937853E+297 Inexact Rounded -comx3479 compare -599369540.373174482335865567937853E+289 -38288383205.6749439588707955585209 -> -1 -divx3479 divide -599369540.373174482335865567937853E+289 -38288383205.6749439588707955585209 -> 1.56540833065089684132688143737586E+287 Inexact Rounded -dvix3479 divideint -599369540.373174482335865567937853E+289 -38288383205.6749439588707955585209 -> NaN Division_impossible -mulx3479 multiply -599369540.373174482335865567937853E+289 -38288383205.6749439588707955585209 -> 2.29488906436173641324091638963715E+308 Inexact Rounded -powx3479 power -599369540.373174482335865567937853E+289 -4 -> 7.74856580646291366270329165540958E-1192 Inexact Rounded -remx3479 remainder -599369540.373174482335865567937853E+289 -38288383205.6749439588707955585209 -> NaN Division_impossible -subx3479 subtract -599369540.373174482335865567937853E+289 -38288383205.6749439588707955585209 -> -5.99369540373174482335865567937853E+297 Inexact Rounded -addx3480 add -3376883870.85961692148022521960139 -65247489449.7334589731171980408284 -> -68624373320.5930758945974232604298 Inexact Rounded -comx3480 compare -3376883870.85961692148022521960139 -65247489449.7334589731171980408284 -> 1 -divx3480 divide -3376883870.85961692148022521960139 -65247489449.7334589731171980408284 -> 0.0517550008335747813596332404664731 Inexact Rounded -dvix3480 divideint -3376883870.85961692148022521960139 -65247489449.7334589731171980408284 -> 0 -mulx3480 multiply -3376883870.85961692148022521960139 -65247489449.7334589731171980408284 -> 220333194736887939420.719579906257 Inexact Rounded -powx3480 power -3376883870.85961692148022521960139 -7 -> -1.99704163718361153125735756179280E-67 Inexact Rounded -remx3480 remainder -3376883870.85961692148022521960139 -65247489449.7334589731171980408284 -> -3376883870.85961692148022521960139 -subx3480 subtract -3376883870.85961692148022521960139 -65247489449.7334589731171980408284 -> 61870605578.8738420516369728212270 Inexact Rounded -addx3481 add 58.6776780370008364590621772421025 01.5925518866529044494309229975160 -> 60.2702299236537409084931002396185 -comx3481 compare 58.6776780370008364590621772421025 01.5925518866529044494309229975160 -> 1 -divx3481 divide 58.6776780370008364590621772421025 01.5925518866529044494309229975160 -> 36.8450651616286048437498576613622 Inexact Rounded -dvix3481 divideint 58.6776780370008364590621772421025 01.5925518866529044494309229975160 -> 36 -mulx3481 multiply 58.6776780370008364590621772421025 01.5925518866529044494309229975160 -> 93.4472468622373769590900258060029 Inexact Rounded -powx3481 power 58.6776780370008364590621772421025 2 -> 3443.06989981393033632008313505230 Inexact Rounded -remx3481 remainder 58.6776780370008364590621772421025 01.5925518866529044494309229975160 -> 1.3458101174962762795489493315265 -subx3481 subtract 58.6776780370008364590621772421025 01.5925518866529044494309229975160 -> 57.0851261503479320096312542445865 -addx3482 add 4099616339.96249499552808575717579 290.795187361072489816791525139895 -> 4099616630.75768235660057557396732 Inexact Rounded -comx3482 compare 4099616339.96249499552808575717579 290.795187361072489816791525139895 -> 1 -divx3482 divide 4099616339.96249499552808575717579 290.795187361072489816791525139895 -> 14097951.1289920788134209002390834 Inexact Rounded -dvix3482 divideint 4099616339.96249499552808575717579 290.795187361072489816791525139895 -> 14097951 -mulx3482 multiply 4099616339.96249499552808575717579 290.795187361072489816791525139895 -> 1192148701687.90798437501397900174 Inexact Rounded -powx3482 power 4099616339.96249499552808575717579 291 -> 2.03364757877800497409765979877258E+2797 Inexact Rounded -remx3482 remainder 4099616339.96249499552808575717579 290.795187361072489816791525139895 -> 37.510275726642959858538282144855 -subx3482 subtract 4099616339.96249499552808575717579 290.795187361072489816791525139895 -> 4099616049.16730763445559594038426 Inexact Rounded -addx3483 add 85870777.2282833141709970713739108 -2140392861153.69401346398478113715 -> -2140306990376.46573014981378406578 Inexact Rounded -comx3483 compare 85870777.2282833141709970713739108 -2140392861153.69401346398478113715 -> 1 -divx3483 divide 85870777.2282833141709970713739108 -2140392861153.69401346398478113715 -> -0.0000401191663393971853092748263233128 Inexact Rounded -dvix3483 divideint 85870777.2282833141709970713739108 -2140392861153.69401346398478113715 -> -0 -mulx3483 multiply 85870777.2282833141709970713739108 -2140392861153.69401346398478113715 -> -183797198561136797328.508878254848 Inexact Rounded -powx3483 power 85870777.2282833141709970713739108 -2 -> 1.35615463448707573424578785973269E-16 Inexact Rounded -remx3483 remainder 85870777.2282833141709970713739108 -2140392861153.69401346398478113715 -> 85870777.2282833141709970713739108 -subx3483 subtract 85870777.2282833141709970713739108 -2140392861153.69401346398478113715 -> 2140478731930.92229677815577820852 Inexact Rounded -addx3484 add 20900.9693761555165742010339929779 -38.7546147649523793463260940289585 -> 20862.2147613905641948547078989489 Inexact Rounded -comx3484 compare 20900.9693761555165742010339929779 -38.7546147649523793463260940289585 -> 1 -divx3484 divide 20900.9693761555165742010339929779 -38.7546147649523793463260940289585 -> -539.315627388386430188627412639767 Inexact Rounded -dvix3484 divideint 20900.9693761555165742010339929779 -38.7546147649523793463260940289585 -> -539 -mulx3484 multiply 20900.9693761555165742010339929779 -38.7546147649523793463260940289585 -> -810009.016386974103738622793670566 Inexact Rounded -powx3484 power 20900.9693761555165742010339929779 -39 -> 3.26219014701526335296044439989665E-169 Inexact Rounded -remx3484 remainder 20900.9693761555165742010339929779 -38.7546147649523793463260940289585 -> 12.2320178461841065312693113692685 -subx3484 subtract 20900.9693761555165742010339929779 -38.7546147649523793463260940289585 -> 20939.7239909204689535473600870069 Inexact Rounded -addx3485 add 448.827596155587910947511170319456 379130153.382794042652974596286062 -> 379130602.210390198240885543797232 Inexact Rounded -comx3485 compare 448.827596155587910947511170319456 379130153.382794042652974596286062 -> -1 -divx3485 divide 448.827596155587910947511170319456 379130153.382794042652974596286062 -> 0.00000118383513458615061394140895596979 Inexact Rounded -dvix3485 divideint 448.827596155587910947511170319456 379130153.382794042652974596286062 -> 0 -mulx3485 multiply 448.827596155587910947511170319456 379130153.382794042652974596286062 -> 170164075372.898786469094460692097 Inexact Rounded -powx3485 power 448.827596155587910947511170319456 379130153 -> Infinity Overflow Inexact Rounded -remx3485 remainder 448.827596155587910947511170319456 379130153.382794042652974596286062 -> 448.827596155587910947511170319456 -subx3485 subtract 448.827596155587910947511170319456 379130153.382794042652974596286062 -> -379129704.555197887065063648774892 Inexact Rounded -addx3486 add 98.4134807921002817357000140482039 3404725543.77032945444654351546779 -> 3404725642.18381024654682525116780 Inexact Rounded -comx3486 compare 98.4134807921002817357000140482039 3404725543.77032945444654351546779 -> -1 -divx3486 divide 98.4134807921002817357000140482039 3404725543.77032945444654351546779 -> 2.89049673833970863420201979291523E-8 Inexact Rounded -dvix3486 divideint 98.4134807921002817357000140482039 3404725543.77032945444654351546779 -> 0 -mulx3486 multiply 98.4134807921002817357000140482039 3404725543.77032945444654351546779 -> 335070891904.214504811798212040413 Inexact Rounded -powx3486 power 98.4134807921002817357000140482039 3 -> 953155.543384739667965055839894682 Inexact Rounded -remx3486 remainder 98.4134807921002817357000140482039 3404725543.77032945444654351546779 -> 98.4134807921002817357000140482039 -subx3486 subtract 98.4134807921002817357000140482039 3404725543.77032945444654351546779 -> -3404725445.35684866234626177976778 Inexact Rounded -addx3487 add 545746433.649359734136476718176330E-787 -5149957099709.12830072802043560650E-437 -> -5.14995709970912830072802043560650E-425 Inexact Rounded -comx3487 compare 545746433.649359734136476718176330E-787 -5149957099709.12830072802043560650E-437 -> 1 -divx3487 divide 545746433.649359734136476718176330E-787 -5149957099709.12830072802043560650E-437 -> -1.05971064046375011086850722752614E-354 Inexact Rounded -dvix3487 divideint 545746433.649359734136476718176330E-787 -5149957099709.12830072802043560650E-437 -> -0 -mulx3487 multiply 545746433.649359734136476718176330E-787 -5149957099709.12830072802043560650E-437 -> -2.81057072061345688074304873033317E-1203 Inexact Rounded -powx3487 power 545746433.649359734136476718176330E-787 -5 -> 2.06559640092667166976186801348662E+3891 Inexact Rounded -remx3487 remainder 545746433.649359734136476718176330E-787 -5149957099709.12830072802043560650E-437 -> 5.45746433649359734136476718176330E-779 -subx3487 subtract 545746433.649359734136476718176330E-787 -5149957099709.12830072802043560650E-437 -> 5.14995709970912830072802043560650E-425 Inexact Rounded -addx3488 add 741304513547.273820525801608231737 0396.22823128272584928019323186355E-830 -> 741304513547.273820525801608231737 Inexact Rounded -comx3488 compare 741304513547.273820525801608231737 0396.22823128272584928019323186355E-830 -> 1 -divx3488 divide 741304513547.273820525801608231737 0396.22823128272584928019323186355E-830 -> 1.87090281565101612623398174727653E+839 Inexact Rounded -dvix3488 divideint 741304513547.273820525801608231737 0396.22823128272584928019323186355E-830 -> NaN Division_impossible -mulx3488 multiply 741304513547.273820525801608231737 0396.22823128272584928019323186355E-830 -> 2.93725776244737788947443361076095E-816 Inexact Rounded -powx3488 power 741304513547.273820525801608231737 4 -> 3.01985838652892073903194846668712E+47 Inexact Rounded -remx3488 remainder 741304513547.273820525801608231737 0396.22823128272584928019323186355E-830 -> NaN Division_impossible -subx3488 subtract 741304513547.273820525801608231737 0396.22823128272584928019323186355E-830 -> 741304513547.273820525801608231737 Inexact Rounded -addx3489 add -706.145005094292315613907254240553 4739.82486195739758308735946332234 -> 4033.67985686310526747345220908179 Inexact Rounded -comx3489 compare -706.145005094292315613907254240553 4739.82486195739758308735946332234 -> -1 -divx3489 divide -706.145005094292315613907254240553 4739.82486195739758308735946332234 -> -0.148981244172527671907534117771626 Inexact Rounded -dvix3489 divideint -706.145005094292315613907254240553 4739.82486195739758308735946332234 -> -0 -mulx3489 multiply -706.145005094292315613907254240553 4739.82486195739758308735946332234 -> -3347003.65129295988793454267973464 Inexact Rounded -powx3489 power -706.145005094292315613907254240553 4740 -> Infinity Overflow Inexact Rounded -remx3489 remainder -706.145005094292315613907254240553 4739.82486195739758308735946332234 -> -706.145005094292315613907254240553 -subx3489 subtract -706.145005094292315613907254240553 4739.82486195739758308735946332234 -> -5445.96986705168989870126671756289 Inexact Rounded -addx3490 add -769925786.823099083228795187975893 -31201.9980469760239870067820594790 -> -769956988.821146059252782194757952 Inexact Rounded -comx3490 compare -769925786.823099083228795187975893 -31201.9980469760239870067820594790 -> -1 -divx3490 divide -769925786.823099083228795187975893 -31201.9980469760239870067820594790 -> 24675.5283319978698932292028650803 Inexact Rounded -dvix3490 divideint -769925786.823099083228795187975893 -31201.9980469760239870067820594790 -> 24675 -mulx3490 multiply -769925786.823099083228795187975893 -31201.9980469760239870067820594790 -> 24023222896770.8161787236737395477 Inexact Rounded -powx3490 power -769925786.823099083228795187975893 -31202 -> 0E-10031 Underflow Subnormal Inexact Rounded Clamped -remx3490 remainder -769925786.823099083228795187975893 -31201.9980469760239870067820594790 -> -16485.0139656913494028406582486750 -subx3490 subtract -769925786.823099083228795187975893 -31201.9980469760239870067820594790 -> -769894584.825052107204808181193834 Inexact Rounded -addx3491 add 84438610546049.7256507419289692857E+906 052604240766736461898844111790311 -> 8.44386105460497256507419289692857E+919 Inexact Rounded -comx3491 compare 84438610546049.7256507419289692857E+906 052604240766736461898844111790311 -> 1 -divx3491 divide 84438610546049.7256507419289692857E+906 052604240766736461898844111790311 -> 1.60516736512701978695559003341922E+888 Inexact Rounded -dvix3491 divideint 84438610546049.7256507419289692857E+906 052604240766736461898844111790311 -> NaN Division_impossible -mulx3491 multiply 84438610546049.7256507419289692857E+906 052604240766736461898844111790311 -> 4.44182899917309231779837668210610E+951 Inexact Rounded -powx3491 power 84438610546049.7256507419289692857E+906 5 -> 4.29245144719689283247342866988213E+4599 Inexact Rounded -remx3491 remainder 84438610546049.7256507419289692857E+906 052604240766736461898844111790311 -> NaN Division_impossible -subx3491 subtract 84438610546049.7256507419289692857E+906 052604240766736461898844111790311 -> 8.44386105460497256507419289692857E+919 Inexact Rounded -addx3492 add 549760.911304725795164589619286514 165.160089615604924207754883953484 -> 549926.071394341400088797374170467 Inexact Rounded -comx3492 compare 549760.911304725795164589619286514 165.160089615604924207754883953484 -> 1 -divx3492 divide 549760.911304725795164589619286514 165.160089615604924207754883953484 -> 3328.65471667062107598395714348089 Inexact Rounded -dvix3492 divideint 549760.911304725795164589619286514 165.160089615604924207754883953484 -> 3328 -mulx3492 multiply 549760.911304725795164589619286514 165.160089615604924207754883953484 -> 90798561.3782451425861113694732484 Inexact Rounded -powx3492 power 549760.911304725795164589619286514 165 -> 1.34488925442386544028875603347654E+947 Inexact Rounded -remx3492 remainder 549760.911304725795164589619286514 165.160089615604924207754883953484 -> 108.133063992607401181365489319248 -subx3492 subtract 549760.911304725795164589619286514 165.160089615604924207754883953484 -> 549595.751215110190240381864402561 Inexact Rounded -addx3493 add 3650514.18649737956855828939662794 08086721.4036886948248274834735629 -> 11737235.5901860743933857728701908 Inexact Rounded -comx3493 compare 3650514.18649737956855828939662794 08086721.4036886948248274834735629 -> -1 -divx3493 divide 3650514.18649737956855828939662794 08086721.4036886948248274834735629 -> 0.451420792712387250865423208234291 Inexact Rounded -dvix3493 divideint 3650514.18649737956855828939662794 08086721.4036886948248274834735629 -> 0 -mulx3493 multiply 3650514.18649737956855828939662794 08086721.4036886948248274834735629 -> 29520691206417.5831886752808745421 Inexact Rounded -powx3493 power 3650514.18649737956855828939662794 8086721 -> Infinity Overflow Inexact Rounded -remx3493 remainder 3650514.18649737956855828939662794 08086721.4036886948248274834735629 -> 3650514.18649737956855828939662794 -subx3493 subtract 3650514.18649737956855828939662794 08086721.4036886948248274834735629 -> -4436207.21719131525626919407693496 -addx3494 add 55067723881950.1346958179604099594 -8.90481481687182931431054785192083 -> 55067723881941.2298810010885806451 Inexact Rounded -comx3494 compare 55067723881950.1346958179604099594 -8.90481481687182931431054785192083 -> 1 -divx3494 divide 55067723881950.1346958179604099594 -8.90481481687182931431054785192083 -> -6184039198391.19853088419484117054 Inexact Rounded -dvix3494 divideint 55067723881950.1346958179604099594 -8.90481481687182931431054785192083 -> -6184039198391 -mulx3494 multiply 55067723881950.1346958179604099594 -8.90481481687182931431054785192083 -> -490367883555396.250365158593373279 Inexact Rounded -powx3494 power 55067723881950.1346958179604099594 -9 -> 2.14746386538529270173788457887121E-124 Inexact Rounded -remx3494 remainder 55067723881950.1346958179604099594 -8.90481481687182931431054785192083 -> 1.76788075918488693086347720461547 -subx3494 subtract 55067723881950.1346958179604099594 -8.90481481687182931431054785192083 -> 55067723881959.0395106348322392737 Inexact Rounded -addx3495 add 868251123.413992653362860637541060E+019 5579665045.37858308541154858567656E+131 -> 5.57966504537858308541154858567656E+140 Inexact Rounded -comx3495 compare 868251123.413992653362860637541060E+019 5579665045.37858308541154858567656E+131 -> -1 -divx3495 divide 868251123.413992653362860637541060E+019 5579665045.37858308541154858567656E+131 -> 1.55609900657590706155251902725027E-113 Inexact Rounded -dvix3495 divideint 868251123.413992653362860637541060E+019 5579665045.37858308541154858567656E+131 -> 0 -mulx3495 multiply 868251123.413992653362860637541060E+019 5579665045.37858308541154858567656E+131 -> 4.84455044392374106106966779322483E+168 Inexact Rounded -powx3495 power 868251123.413992653362860637541060E+019 6 -> 4.28422354304291884802690733853227E+167 Inexact Rounded -remx3495 remainder 868251123.413992653362860637541060E+019 5579665045.37858308541154858567656E+131 -> 8682511234139926533628606375.41060 -subx3495 subtract 868251123.413992653362860637541060E+019 5579665045.37858308541154858567656E+131 -> -5.57966504537858308541154858567656E+140 Inexact Rounded -addx3496 add -646.464431574014407536004990059069 -798.679560020414523841321724649594E-037 -> -646.464431574014407536004990059069 Inexact Rounded -comx3496 compare -646.464431574014407536004990059069 -798.679560020414523841321724649594E-037 -> -1 -divx3496 divide -646.464431574014407536004990059069 -798.679560020414523841321724649594E-037 -> 8.09416521887063886613527228353543E+36 Inexact Rounded -dvix3496 divideint -646.464431574014407536004990059069 -798.679560020414523841321724649594E-037 -> NaN Division_impossible -mulx3496 multiply -646.464431574014407536004990059069 -798.679560020414523841321724649594E-037 -> 5.16317927778381197995451363439626E-32 Inexact Rounded -powx3496 power -646.464431574014407536004990059069 -8 -> 3.27825641569860861774700548035691E-23 Inexact Rounded -remx3496 remainder -646.464431574014407536004990059069 -798.679560020414523841321724649594E-037 -> NaN Division_impossible -subx3496 subtract -646.464431574014407536004990059069 -798.679560020414523841321724649594E-037 -> -646.464431574014407536004990059069 Inexact Rounded -addx3497 add 354.546679975219753598558273421556 -7039.46386812239015144581761752927E-448 -> 354.546679975219753598558273421556 Inexact Rounded -comx3497 compare 354.546679975219753598558273421556 -7039.46386812239015144581761752927E-448 -> 1 -divx3497 divide 354.546679975219753598558273421556 -7039.46386812239015144581761752927E-448 -> -5.03655799102477192579414523352028E+446 Inexact Rounded -dvix3497 divideint 354.546679975219753598558273421556 -7039.46386812239015144581761752927E-448 -> NaN Division_impossible -mulx3497 multiply 354.546679975219753598558273421556 -7039.46386812239015144581761752927E-448 -> -2.49581854324831161267369292071408E-442 Inexact Rounded -powx3497 power 354.546679975219753598558273421556 -7 -> 1.41999246365875617298270414304233E-18 Inexact Rounded -remx3497 remainder 354.546679975219753598558273421556 -7039.46386812239015144581761752927E-448 -> NaN Division_impossible -subx3497 subtract 354.546679975219753598558273421556 -7039.46386812239015144581761752927E-448 -> 354.546679975219753598558273421556 Inexact Rounded -addx3498 add 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> 91936087917435.5974889495278215874 Inexact Rounded -comx3498 compare 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> 1 -divx3498 divide 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> -1.37052712434303366569304688993783E+760 Inexact Rounded -dvix3498 divideint 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> NaN Division_impossible -mulx3498 multiply 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> -6.16714847260980448099292763939423E-733 Inexact Rounded -powx3498 power 91936087917435.5974889495278215874 -7 -> 1.80134899939035708719659065082630E-98 Inexact Rounded -remx3498 remainder 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> NaN Division_impossible -subx3498 subtract 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> 91936087917435.5974889495278215874 Inexact Rounded -addx3499 add -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -7.34564225185285561365214172598110E-597 Inexact Rounded -comx3499 compare -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -1 -divx3499 divide -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -1.78342822299163842247184303878022E+159 Inexact Rounded -dvix3499 divideint -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> NaN Division_impossible -mulx3499 multiply -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -3.02554705575380338274126867655676E-1352 Inexact Rounded -powx3499 power -07345.6422518528556136521417259811E-600 4 -> 2.91151541552217582082937236255996E-2385 Inexact Rounded -remx3499 remainder -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> NaN Division_impossible -subx3499 subtract -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -7.34564225185285561365214172598110E-597 Inexact Rounded -addx3500 add -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> 6.16988426425908872398170896375634E+401 Inexact Rounded -comx3500 compare -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -1 -divx3500 divide -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -4.10511306357337753351655511866170E-394 Inexact Rounded -dvix3500 divideint -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -0 -mulx3500 multiply -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -1.56271275924409657991913620522315E+410 Inexact Rounded -powx3500 power -253280724.939458021588167965038184 6 -> 2.64005420221406808782284459794424E+50 Inexact Rounded -remx3500 remainder -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -253280724.939458021588167965038184 -subx3500 subtract -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -6.16988426425908872398170896375634E+401 Inexact Rounded diff --git a/sys/lib/python/test/decimaltestdata/randoms.decTest b/sys/lib/python/test/decimaltestdata/randoms.decTest deleted file mode 100644 index 5493f0c95..000000000 --- a/sys/lib/python/test/decimaltestdata/randoms.decTest +++ /dev/null @@ -1,4029 +0,0 @@ ------------------------------------------------------------------------- --- randoms.decTest -- decimal random testcases -- --- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -maxexponent: 999999999 -minexponent: -999999999 -precision: 9 -rounding: half_up - --- Randomly generated testcases [31 Dec 2000, with results defined for --- all cases [27 Oct 2001], and no trim/finish [9 Jun 2002] -xadd001 add 905.67402 -202896611.E-780472620 -> 905.674020 Inexact Rounded -xcom001 compare 905.67402 -202896611.E-780472620 -> 1 -xdiv001 divide 905.67402 -202896611.E-780472620 -> -4.46372177E+780472614 Inexact Rounded -xdvi001 divideint 905.67402 -202896611.E-780472620 -> NaN Division_impossible -xmul001 multiply 905.67402 -202896611.E-780472620 -> -1.83758189E-780472609 Inexact Rounded -xpow001 power 905.67402 -2 -> 0.00000121914730 Inexact Rounded -xrem001 remainder 905.67402 -202896611.E-780472620 -> NaN Division_impossible -xsub001 subtract 905.67402 -202896611.E-780472620 -> 905.674020 Inexact Rounded -xadd002 add 3915134.7 -597164907. -> -593249772 Inexact Rounded -xcom002 compare 3915134.7 -597164907. -> 1 -xdiv002 divide 3915134.7 -597164907. -> -0.00655620358 Inexact Rounded -xdvi002 divideint 3915134.7 -597164907. -> -0 -xmul002 multiply 3915134.7 -597164907. -> -2.33798105E+15 Inexact Rounded -xpow002 power 3915134.7 -597164907 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem002 remainder 3915134.7 -597164907. -> 3915134.7 -xsub002 subtract 3915134.7 -597164907. -> 601080042 Inexact Rounded -xadd003 add 309759261 62663.487 -> 309821924 Inexact Rounded -xcom003 compare 309759261 62663.487 -> 1 -xdiv003 divide 309759261 62663.487 -> 4943.21775 Inexact Rounded -xdvi003 divideint 309759261 62663.487 -> 4943 -xmul003 multiply 309759261 62663.487 -> 1.94105954E+13 Inexact Rounded -xpow003 power 309759261 62663 -> 1.13679199E+532073 Inexact Rounded -xrem003 remainder 309759261 62663.487 -> 13644.759 -xsub003 subtract 309759261 62663.487 -> 309696598 Inexact Rounded -xadd004 add 3.93591888E-236595626 7242375.00 -> 7242375.00 Inexact Rounded -xcom004 compare 3.93591888E-236595626 7242375.00 -> -1 -xdiv004 divide 3.93591888E-236595626 7242375.00 -> 5.43456930E-236595633 Inexact Rounded -xdvi004 divideint 3.93591888E-236595626 7242375.00 -> 0 -xmul004 multiply 3.93591888E-236595626 7242375.00 -> 2.85054005E-236595619 Inexact Rounded -xpow004 power 3.93591888E-236595626 7242375 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem004 remainder 3.93591888E-236595626 7242375.00 -> 3.93591888E-236595626 -xsub004 subtract 3.93591888E-236595626 7242375.00 -> -7242375.00 Inexact Rounded -xadd005 add 323902.714 -608669.607E-657060568 -> 323902.714 Inexact Rounded -xcom005 compare 323902.714 -608669.607E-657060568 -> 1 -xdiv005 divide 323902.714 -608669.607E-657060568 -> -5.32148657E+657060567 Inexact Rounded -xdvi005 divideint 323902.714 -608669.607E-657060568 -> NaN Division_impossible -xmul005 multiply 323902.714 -608669.607E-657060568 -> -1.97149738E-657060557 Inexact Rounded -xpow005 power 323902.714 -6 -> 8.65989204E-34 Inexact Rounded -xrem005 remainder 323902.714 -608669.607E-657060568 -> NaN Division_impossible -xsub005 subtract 323902.714 -608669.607E-657060568 -> 323902.714 Inexact Rounded -xadd006 add 5.11970092 -8807.22036 -> -8802.10066 Inexact Rounded -xcom006 compare 5.11970092 -8807.22036 -> 1 -xdiv006 divide 5.11970092 -8807.22036 -> -0.000581307236 Inexact Rounded -xdvi006 divideint 5.11970092 -8807.22036 -> -0 -xmul006 multiply 5.11970092 -8807.22036 -> -45090.3342 Inexact Rounded -xpow006 power 5.11970092 -8807 -> 4.81819262E-6247 Inexact Rounded -xrem006 remainder 5.11970092 -8807.22036 -> 5.11970092 -xsub006 subtract 5.11970092 -8807.22036 -> 8812.34006 Inexact Rounded -xadd007 add -7.99874516 4561.83758 -> 4553.83883 Inexact Rounded -xcom007 compare -7.99874516 4561.83758 -> -1 -xdiv007 divide -7.99874516 4561.83758 -> -0.00175340420 Inexact Rounded -xdvi007 divideint -7.99874516 4561.83758 -> -0 -xmul007 multiply -7.99874516 4561.83758 -> -36488.9763 Inexact Rounded -xpow007 power -7.99874516 4562 -> 3.85236199E+4119 Inexact Rounded -xrem007 remainder -7.99874516 4561.83758 -> -7.99874516 -xsub007 subtract -7.99874516 4561.83758 -> -4569.83633 Inexact Rounded -xadd008 add 297802878 -927206.324 -> 296875672 Inexact Rounded -xcom008 compare 297802878 -927206.324 -> 1 -xdiv008 divide 297802878 -927206.324 -> -321.182967 Inexact Rounded -xdvi008 divideint 297802878 -927206.324 -> -321 -xmul008 multiply 297802878 -927206.324 -> -2.76124712E+14 Inexact Rounded -xpow008 power 297802878 -927206 -> 1.94602810E-7857078 Inexact Rounded -xrem008 remainder 297802878 -927206.324 -> 169647.996 -xsub008 subtract 297802878 -927206.324 -> 298730084 Inexact Rounded -xadd009 add -766.651824 31300.3619 -> 30533.7101 Inexact Rounded -xcom009 compare -766.651824 31300.3619 -> -1 -xdiv009 divide -766.651824 31300.3619 -> -0.0244933853 Inexact Rounded -xdvi009 divideint -766.651824 31300.3619 -> -0 -xmul009 multiply -766.651824 31300.3619 -> -23996479.5 Inexact Rounded -xpow009 power -766.651824 31300 -> 8.37189011E+90287 Inexact Rounded -xrem009 remainder -766.651824 31300.3619 -> -766.651824 -xsub009 subtract -766.651824 31300.3619 -> -32067.0137 Inexact Rounded -xadd010 add -56746.8689E+934981942 471002521. -> -5.67468689E+934981946 Inexact Rounded -xcom010 compare -56746.8689E+934981942 471002521. -> -1 -xdiv010 divide -56746.8689E+934981942 471002521. -> -1.20481030E+934981938 Inexact Rounded -xdvi010 divideint -56746.8689E+934981942 471002521. -> NaN Division_impossible -xmul010 multiply -56746.8689E+934981942 471002521. -> -2.67279183E+934981955 Inexact Rounded -xpow010 power -56746.8689E+934981942 471002521 -> -Infinity Overflow Inexact Rounded -xrem010 remainder -56746.8689E+934981942 471002521. -> NaN Division_impossible -xsub010 subtract -56746.8689E+934981942 471002521. -> -5.67468689E+934981946 Inexact Rounded -xadd011 add 456417160 -41346.1024 -> 456375814 Inexact Rounded -xcom011 compare 456417160 -41346.1024 -> 1 -xdiv011 divide 456417160 -41346.1024 -> -11038.9404 Inexact Rounded -xdvi011 divideint 456417160 -41346.1024 -> -11038 -xmul011 multiply 456417160 -41346.1024 -> -1.88710706E+13 Inexact Rounded -xpow011 power 456417160 -41346 -> 1.04766863E-358030 Inexact Rounded -xrem011 remainder 456417160 -41346.1024 -> 38881.7088 -xsub011 subtract 456417160 -41346.1024 -> 456458506 Inexact Rounded -xadd012 add 102895.722 -2.62214826 -> 102893.100 Inexact Rounded -xcom012 compare 102895.722 -2.62214826 -> 1 -xdiv012 divide 102895.722 -2.62214826 -> -39241.0008 Inexact Rounded -xdvi012 divideint 102895.722 -2.62214826 -> -39241 -xmul012 multiply 102895.722 -2.62214826 -> -269807.838 Inexact Rounded -xpow012 power 102895.722 -3 -> 9.17926786E-16 Inexact Rounded -xrem012 remainder 102895.722 -2.62214826 -> 0.00212934 -xsub012 subtract 102895.722 -2.62214826 -> 102898.344 Inexact Rounded -xadd013 add 61.3033331E+157644141 -567740.918E-893439456 -> 6.13033331E+157644142 Inexact Rounded -xcom013 compare 61.3033331E+157644141 -567740.918E-893439456 -> 1 -xdiv013 divide 61.3033331E+157644141 -567740.918E-893439456 -> -Infinity Inexact Overflow Rounded -xdvi013 divideint 61.3033331E+157644141 -567740.918E-893439456 -> NaN Division_impossible -xmul013 multiply 61.3033331E+157644141 -567740.918E-893439456 -> -3.48044106E-735795308 Inexact Rounded -xpow013 power 61.3033331E+157644141 -6 -> 1.88406322E-945864857 Inexact Rounded -xrem013 remainder 61.3033331E+157644141 -567740.918E-893439456 -> NaN Division_impossible -xsub013 subtract 61.3033331E+157644141 -567740.918E-893439456 -> 6.13033331E+157644142 Inexact Rounded -xadd014 add 80223.3897 73921.0383E-467772675 -> 80223.3897 Inexact Rounded -xcom014 compare 80223.3897 73921.0383E-467772675 -> 1 -xdiv014 divide 80223.3897 73921.0383E-467772675 -> 1.08525789E+467772675 Inexact Rounded -xdvi014 divideint 80223.3897 73921.0383E-467772675 -> NaN Division_impossible -xmul014 multiply 80223.3897 73921.0383E-467772675 -> 5.93019626E-467772666 Inexact Rounded -xpow014 power 80223.3897 7 -> 2.13848919E+34 Inexact Rounded -xrem014 remainder 80223.3897 73921.0383E-467772675 -> NaN Division_impossible -xsub014 subtract 80223.3897 73921.0383E-467772675 -> 80223.3897 Inexact Rounded -xadd015 add -654645.954 -9.12535752 -> -654655.079 Inexact Rounded -xcom015 compare -654645.954 -9.12535752 -> -1 -xdiv015 divide -654645.954 -9.12535752 -> 71739.2116 Inexact Rounded -xdvi015 divideint -654645.954 -9.12535752 -> 71739 -xmul015 multiply -654645.954 -9.12535752 -> 5973878.38 Inexact Rounded -xpow015 power -654645.954 -9 -> -4.52836690E-53 Inexact Rounded -xrem015 remainder -654645.954 -9.12535752 -> -1.93087272 -xsub015 subtract -654645.954 -9.12535752 -> -654636.829 Inexact Rounded -xadd016 add 63.1917772E-706014634 -7.56253257E-138579234 -> -7.56253257E-138579234 Inexact Rounded -xcom016 compare 63.1917772E-706014634 -7.56253257E-138579234 -> 1 -xdiv016 divide 63.1917772E-706014634 -7.56253257E-138579234 -> -8.35590149E-567435400 Inexact Rounded -xdvi016 divideint 63.1917772E-706014634 -7.56253257E-138579234 -> -0 -xmul016 multiply 63.1917772E-706014634 -7.56253257E-138579234 -> -4.77889873E-844593866 Inexact Rounded -xpow016 power 63.1917772E-706014634 -8 -> Infinity Overflow Inexact Rounded -xrem016 remainder 63.1917772E-706014634 -7.56253257E-138579234 -> 6.31917772E-706014633 -xsub016 subtract 63.1917772E-706014634 -7.56253257E-138579234 -> 7.56253257E-138579234 Inexact Rounded -xadd017 add -39674.7190 2490607.78 -> 2450933.06 Inexact Rounded -xcom017 compare -39674.7190 2490607.78 -> -1 -xdiv017 divide -39674.7190 2490607.78 -> -0.0159297338 Inexact Rounded -xdvi017 divideint -39674.7190 2490607.78 -> -0 -xmul017 multiply -39674.7190 2490607.78 -> -9.88141638E+10 Inexact Rounded -xpow017 power -39674.7190 2490608 -> 2.55032329E+11453095 Inexact Rounded -xrem017 remainder -39674.7190 2490607.78 -> -39674.7190 -xsub017 subtract -39674.7190 2490607.78 -> -2530282.50 Inexact Rounded -xadd018 add -3364.59737E-600363681 896487.451 -> 896487.451 Inexact Rounded -xcom018 compare -3364.59737E-600363681 896487.451 -> -1 -xdiv018 divide -3364.59737E-600363681 896487.451 -> -3.75308920E-600363684 Inexact Rounded -xdvi018 divideint -3364.59737E-600363681 896487.451 -> -0 -xmul018 multiply -3364.59737E-600363681 896487.451 -> -3.01631932E-600363672 Inexact Rounded -xpow018 power -3364.59737E-600363681 896487 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem018 remainder -3364.59737E-600363681 896487.451 -> -3.36459737E-600363678 -xsub018 subtract -3364.59737E-600363681 896487.451 -> -896487.451 Inexact Rounded -xadd019 add -64138.0578 31759011.3E+697488342 -> 3.17590113E+697488349 Inexact Rounded -xcom019 compare -64138.0578 31759011.3E+697488342 -> -1 -xdiv019 divide -64138.0578 31759011.3E+697488342 -> -2.01952313E-697488345 Inexact Rounded -xdvi019 divideint -64138.0578 31759011.3E+697488342 -> -0 -xmul019 multiply -64138.0578 31759011.3E+697488342 -> -2.03696130E+697488354 Inexact Rounded -xpow019 power -64138.0578 3 -> -2.63844116E+14 Inexact Rounded -xrem019 remainder -64138.0578 31759011.3E+697488342 -> -64138.0578 -xsub019 subtract -64138.0578 31759011.3E+697488342 -> -3.17590113E+697488349 Inexact Rounded -xadd020 add 61399.8527 -64344484.5 -> -64283084.6 Inexact Rounded -xcom020 compare 61399.8527 -64344484.5 -> 1 -xdiv020 divide 61399.8527 -64344484.5 -> -0.000954236454 Inexact Rounded -xdvi020 divideint 61399.8527 -64344484.5 -> -0 -xmul020 multiply 61399.8527 -64344484.5 -> -3.95074187E+12 Inexact Rounded -xpow020 power 61399.8527 -64344485 -> 1.27378842E-308092161 Inexact Rounded -xrem020 remainder 61399.8527 -64344484.5 -> 61399.8527 -xsub020 subtract 61399.8527 -64344484.5 -> 64405884.4 Inexact Rounded -xadd021 add -722960.204 -26154599.8 -> -26877560.0 Inexact Rounded -xcom021 compare -722960.204 -26154599.8 -> 1 -xdiv021 divide -722960.204 -26154599.8 -> 0.0276417995 Inexact Rounded -xdvi021 divideint -722960.204 -26154599.8 -> 0 -xmul021 multiply -722960.204 -26154599.8 -> 1.89087348E+13 Inexact Rounded -xpow021 power -722960.204 -26154600 -> 5.34236139E-153242794 Inexact Rounded -xrem021 remainder -722960.204 -26154599.8 -> -722960.204 -xsub021 subtract -722960.204 -26154599.8 -> 25431639.6 Inexact Rounded -xadd022 add 9.47109959E+230565093 73354723.2 -> 9.47109959E+230565093 Inexact Rounded -xcom022 compare 9.47109959E+230565093 73354723.2 -> 1 -xdiv022 divide 9.47109959E+230565093 73354723.2 -> 1.29113698E+230565086 Inexact Rounded -xdvi022 divideint 9.47109959E+230565093 73354723.2 -> NaN Division_impossible -xmul022 multiply 9.47109959E+230565093 73354723.2 -> 6.94749889E+230565101 Inexact Rounded -xpow022 power 9.47109959E+230565093 73354723 -> Infinity Overflow Inexact Rounded -xrem022 remainder 9.47109959E+230565093 73354723.2 -> NaN Division_impossible -xsub022 subtract 9.47109959E+230565093 73354723.2 -> 9.47109959E+230565093 Inexact Rounded -xadd023 add 43.7456245 547441956. -> 547442000 Inexact Rounded -xcom023 compare 43.7456245 547441956. -> -1 -xdiv023 divide 43.7456245 547441956. -> 7.99091557E-8 Inexact Rounded -xdvi023 divideint 43.7456245 547441956. -> 0 -xmul023 multiply 43.7456245 547441956. -> 2.39481902E+10 Inexact Rounded -xpow023 power 43.7456245 547441956 -> 2.91742391E+898316458 Inexact Rounded -xrem023 remainder 43.7456245 547441956. -> 43.7456245 -xsub023 subtract 43.7456245 547441956. -> -547441912 Inexact Rounded -xadd024 add -73150542E-242017390 -8.15869954 -> -8.15869954 Inexact Rounded -xcom024 compare -73150542E-242017390 -8.15869954 -> 1 -xdiv024 divide -73150542E-242017390 -8.15869954 -> 8.96595611E-242017384 Inexact Rounded -xdvi024 divideint -73150542E-242017390 -8.15869954 -> 0 -xmul024 multiply -73150542E-242017390 -8.15869954 -> 5.96813293E-242017382 Inexact Rounded -xpow024 power -73150542E-242017390 -8 -> Infinity Overflow Inexact Rounded -xrem024 remainder -73150542E-242017390 -8.15869954 -> -7.3150542E-242017383 -xsub024 subtract -73150542E-242017390 -8.15869954 -> 8.15869954 Inexact Rounded -xadd025 add 2015.62109E+299897596 -11788916.1 -> 2.01562109E+299897599 Inexact Rounded -xcom025 compare 2015.62109E+299897596 -11788916.1 -> 1 -xdiv025 divide 2015.62109E+299897596 -11788916.1 -> -1.70975947E+299897592 Inexact Rounded -xdvi025 divideint 2015.62109E+299897596 -11788916.1 -> NaN Division_impossible -xmul025 multiply 2015.62109E+299897596 -11788916.1 -> -2.37619879E+299897606 Inexact Rounded -xpow025 power 2015.62109E+299897596 -11788916 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem025 remainder 2015.62109E+299897596 -11788916.1 -> NaN Division_impossible -xsub025 subtract 2015.62109E+299897596 -11788916.1 -> 2.01562109E+299897599 Inexact Rounded -xadd026 add 29.498114 -26486451 -> -26486421.5 Inexact Rounded -xcom026 compare 29.498114 -26486451 -> 1 -xdiv026 divide 29.498114 -26486451 -> -0.00000111370580 Inexact Rounded -xdvi026 divideint 29.498114 -26486451 -> -0 -xmul026 multiply 29.498114 -26486451 -> -781300351 Inexact Rounded -xpow026 power 29.498114 -26486451 -> 4.22252513E-38929634 Inexact Rounded -xrem026 remainder 29.498114 -26486451 -> 29.498114 -xsub026 subtract 29.498114 -26486451 -> 26486480.5 Inexact Rounded -xadd027 add 244375043.E+130840878 -9.44522029 -> 2.44375043E+130840886 Inexact Rounded -xcom027 compare 244375043.E+130840878 -9.44522029 -> 1 -xdiv027 divide 244375043.E+130840878 -9.44522029 -> -2.58728791E+130840885 Inexact Rounded -xdvi027 divideint 244375043.E+130840878 -9.44522029 -> NaN Division_impossible -xmul027 multiply 244375043.E+130840878 -9.44522029 -> -2.30817611E+130840887 Inexact Rounded -xpow027 power 244375043.E+130840878 -9 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem027 remainder 244375043.E+130840878 -9.44522029 -> NaN Division_impossible -xsub027 subtract 244375043.E+130840878 -9.44522029 -> 2.44375043E+130840886 Inexact Rounded -xadd028 add -349388.759 -196215.776 -> -545604.535 -xcom028 compare -349388.759 -196215.776 -> -1 -xdiv028 divide -349388.759 -196215.776 -> 1.78063541 Inexact Rounded -xdvi028 divideint -349388.759 -196215.776 -> 1 -xmul028 multiply -349388.759 -196215.776 -> 6.85555865E+10 Inexact Rounded -xpow028 power -349388.759 -196216 -> 1.24551752E-1087686 Inexact Rounded -xrem028 remainder -349388.759 -196215.776 -> -153172.983 -xsub028 subtract -349388.759 -196215.776 -> -153172.983 -xadd029 add -70905112.4 -91353968.8 -> -162259081 Inexact Rounded -xcom029 compare -70905112.4 -91353968.8 -> 1 -xdiv029 divide -70905112.4 -91353968.8 -> 0.776157986 Inexact Rounded -xdvi029 divideint -70905112.4 -91353968.8 -> 0 -xmul029 multiply -70905112.4 -91353968.8 -> 6.47746343E+15 Inexact Rounded -xpow029 power -70905112.4 -91353969 -> -3.05944741E-717190554 Inexact Rounded -xrem029 remainder -70905112.4 -91353968.8 -> -70905112.4 -xsub029 subtract -70905112.4 -91353968.8 -> 20448856.4 -xadd030 add -225094.28 -88.7723542 -> -225183.052 Inexact Rounded -xcom030 compare -225094.28 -88.7723542 -> -1 -xdiv030 divide -225094.28 -88.7723542 -> 2535.63491 Inexact Rounded -xdvi030 divideint -225094.28 -88.7723542 -> 2535 -xmul030 multiply -225094.28 -88.7723542 -> 19982149.2 Inexact Rounded -xpow030 power -225094.28 -89 -> -4.36076964E-477 Inexact Rounded -xrem030 remainder -225094.28 -88.7723542 -> -56.3621030 -xsub030 subtract -225094.28 -88.7723542 -> -225005.508 Inexact Rounded -xadd031 add 50.4442340 82.7952169E+880120759 -> 8.27952169E+880120760 Inexact Rounded -xcom031 compare 50.4442340 82.7952169E+880120759 -> -1 -xdiv031 divide 50.4442340 82.7952169E+880120759 -> 6.09265075E-880120760 Inexact Rounded -xdvi031 divideint 50.4442340 82.7952169E+880120759 -> 0 -xmul031 multiply 50.4442340 82.7952169E+880120759 -> 4.17654130E+880120762 Inexact Rounded -xpow031 power 50.4442340 8 -> 4.19268518E+13 Inexact Rounded -xrem031 remainder 50.4442340 82.7952169E+880120759 -> 50.4442340 -xsub031 subtract 50.4442340 82.7952169E+880120759 -> -8.27952169E+880120760 Inexact Rounded -xadd032 add -32311.9037 8.36379449 -> -32303.5399 Inexact Rounded -xcom032 compare -32311.9037 8.36379449 -> -1 -xdiv032 divide -32311.9037 8.36379449 -> -3863.30675 Inexact Rounded -xdvi032 divideint -32311.9037 8.36379449 -> -3863 -xmul032 multiply -32311.9037 8.36379449 -> -270250.122 Inexact Rounded -xpow032 power -32311.9037 8 -> 1.18822960E+36 Inexact Rounded -xrem032 remainder -32311.9037 8.36379449 -> -2.56558513 -xsub032 subtract -32311.9037 8.36379449 -> -32320.2675 Inexact Rounded -xadd033 add 615396156.E+549895291 -29530247.4 -> 6.15396156E+549895299 Inexact Rounded -xcom033 compare 615396156.E+549895291 -29530247.4 -> 1 -xdiv033 divide 615396156.E+549895291 -29530247.4 -> -2.08395191E+549895292 Inexact Rounded -xdvi033 divideint 615396156.E+549895291 -29530247.4 -> NaN Division_impossible -xmul033 multiply 615396156.E+549895291 -29530247.4 -> -1.81728007E+549895307 Inexact Rounded -xpow033 power 615396156.E+549895291 -29530247 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem033 remainder 615396156.E+549895291 -29530247.4 -> NaN Division_impossible -xsub033 subtract 615396156.E+549895291 -29530247.4 -> 6.15396156E+549895299 Inexact Rounded -xadd034 add 592.142173E-419941416 -3.46079109E-844011845 -> 5.92142173E-419941414 Inexact Rounded -xcom034 compare 592.142173E-419941416 -3.46079109E-844011845 -> 1 -xdiv034 divide 592.142173E-419941416 -3.46079109E-844011845 -> -1.71100236E+424070431 Inexact Rounded -xdvi034 divideint 592.142173E-419941416 -3.46079109E-844011845 -> NaN Division_impossible -xmul034 multiply 592.142173E-419941416 -3.46079109E-844011845 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow034 power 592.142173E-419941416 -3 -> Infinity Overflow Inexact Rounded -xrem034 remainder 592.142173E-419941416 -3.46079109E-844011845 -> NaN Division_impossible -xsub034 subtract 592.142173E-419941416 -3.46079109E-844011845 -> 5.92142173E-419941414 Inexact Rounded -xadd035 add 849.515993E-878446473 -1039.08778 -> -1039.08778 Inexact Rounded -xcom035 compare 849.515993E-878446473 -1039.08778 -> 1 -xdiv035 divide 849.515993E-878446473 -1039.08778 -> -8.17559411E-878446474 Inexact Rounded -xdvi035 divideint 849.515993E-878446473 -1039.08778 -> -0 -xmul035 multiply 849.515993E-878446473 -1039.08778 -> -8.82721687E-878446468 Inexact Rounded -xpow035 power 849.515993E-878446473 -1039 -> Infinity Overflow Inexact Rounded -xrem035 remainder 849.515993E-878446473 -1039.08778 -> 8.49515993E-878446471 -xsub035 subtract 849.515993E-878446473 -1039.08778 -> 1039.08778 Inexact Rounded -xadd036 add 213361789 -599.644851 -> 213361189 Inexact Rounded -xcom036 compare 213361789 -599.644851 -> 1 -xdiv036 divide 213361789 -599.644851 -> -355813.593 Inexact Rounded -xdvi036 divideint 213361789 -599.644851 -> -355813 -xmul036 multiply 213361789 -599.644851 -> -1.27941298E+11 Inexact Rounded -xpow036 power 213361789 -600 -> 3.38854684E-4998 Inexact Rounded -xrem036 remainder 213361789 -599.644851 -> 355.631137 -xsub036 subtract 213361789 -599.644851 -> 213362389 Inexact Rounded -xadd037 add -795522555. -298.037702 -> -795522853 Inexact Rounded -xcom037 compare -795522555. -298.037702 -> -1 -xdiv037 divide -795522555. -298.037702 -> 2669201.08 Inexact Rounded -xdvi037 divideint -795522555. -298.037702 -> 2669201 -xmul037 multiply -795522555. -298.037702 -> 2.37095714E+11 Inexact Rounded -xpow037 power -795522555. -298 -> 4.03232712E-2653 Inexact Rounded -xrem037 remainder -795522555. -298.037702 -> -22.783898 -xsub037 subtract -795522555. -298.037702 -> -795522257 Inexact Rounded -xadd038 add -501260651. -8761893.0E-689281479 -> -501260651 Inexact Rounded -xcom038 compare -501260651. -8761893.0E-689281479 -> -1 -xdiv038 divide -501260651. -8761893.0E-689281479 -> 5.72091728E+689281480 Inexact Rounded -xdvi038 divideint -501260651. -8761893.0E-689281479 -> NaN Division_impossible -xmul038 multiply -501260651. -8761893.0E-689281479 -> 4.39199219E-689281464 Inexact Rounded -xpow038 power -501260651. -9 -> -5.00526961E-79 Inexact Rounded -xrem038 remainder -501260651. -8761893.0E-689281479 -> NaN Division_impossible -xsub038 subtract -501260651. -8761893.0E-689281479 -> -501260651 Inexact Rounded -xadd039 add -1.70781105E-848889023 36504769.4 -> 36504769.4 Inexact Rounded -xcom039 compare -1.70781105E-848889023 36504769.4 -> -1 -xdiv039 divide -1.70781105E-848889023 36504769.4 -> -4.67832307E-848889031 Inexact Rounded -xdvi039 divideint -1.70781105E-848889023 36504769.4 -> -0 -xmul039 multiply -1.70781105E-848889023 36504769.4 -> -6.23432486E-848889016 Inexact Rounded -xpow039 power -1.70781105E-848889023 36504769 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem039 remainder -1.70781105E-848889023 36504769.4 -> -1.70781105E-848889023 -xsub039 subtract -1.70781105E-848889023 36504769.4 -> -36504769.4 Inexact Rounded -xadd040 add -5290.54984E-490626676 842535254 -> 842535254 Inexact Rounded -xcom040 compare -5290.54984E-490626676 842535254 -> -1 -xdiv040 divide -5290.54984E-490626676 842535254 -> -6.27932162E-490626682 Inexact Rounded -xdvi040 divideint -5290.54984E-490626676 842535254 -> -0 -xmul040 multiply -5290.54984E-490626676 842535254 -> -4.45747475E-490626664 Inexact Rounded -xpow040 power -5290.54984E-490626676 842535254 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem040 remainder -5290.54984E-490626676 842535254 -> -5.29054984E-490626673 -xsub040 subtract -5290.54984E-490626676 842535254 -> -842535254 Inexact Rounded -xadd041 add 608.31825E+535268120 -59609.0993 -> 6.08318250E+535268122 Inexact Rounded -xcom041 compare 608.31825E+535268120 -59609.0993 -> 1 -xdiv041 divide 608.31825E+535268120 -59609.0993 -> -1.02051240E+535268118 Inexact Rounded -xdvi041 divideint 608.31825E+535268120 -59609.0993 -> NaN Division_impossible -xmul041 multiply 608.31825E+535268120 -59609.0993 -> -3.62613030E+535268127 Inexact Rounded -xpow041 power 608.31825E+535268120 -59609 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem041 remainder 608.31825E+535268120 -59609.0993 -> NaN Division_impossible -xsub041 subtract 608.31825E+535268120 -59609.0993 -> 6.08318250E+535268122 Inexact Rounded -xadd042 add -4629035.31 -167.884398 -> -4629203.19 Inexact Rounded -xcom042 compare -4629035.31 -167.884398 -> -1 -xdiv042 divide -4629035.31 -167.884398 -> 27572.7546 Inexact Rounded -xdvi042 divideint -4629035.31 -167.884398 -> 27572 -xmul042 multiply -4629035.31 -167.884398 -> 777142806 Inexact Rounded -xpow042 power -4629035.31 -168 -> 1.57614831E-1120 Inexact Rounded -xrem042 remainder -4629035.31 -167.884398 -> -126.688344 -xsub042 subtract -4629035.31 -167.884398 -> -4628867.43 Inexact Rounded -xadd043 add -66527378. -706400268. -> -772927646 -xcom043 compare -66527378. -706400268. -> 1 -xdiv043 divide -66527378. -706400268. -> 0.0941780192 Inexact Rounded -xdvi043 divideint -66527378. -706400268. -> 0 -xmul043 multiply -66527378. -706400268. -> 4.69949576E+16 Inexact Rounded -xpow043 power -66527378. -706400268 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem043 remainder -66527378. -706400268. -> -66527378 -xsub043 subtract -66527378. -706400268. -> 639872890 -xadd044 add -2510497.53 372882462. -> 370371964 Inexact Rounded -xcom044 compare -2510497.53 372882462. -> -1 -xdiv044 divide -2510497.53 372882462. -> -0.00673267795 Inexact Rounded -xdvi044 divideint -2510497.53 372882462. -> -0 -xmul044 multiply -2510497.53 372882462. -> -9.36120500E+14 Inexact Rounded -xpow044 power -2510497.53 372882462 -> Infinity Overflow Inexact Rounded -xrem044 remainder -2510497.53 372882462. -> -2510497.53 -xsub044 subtract -2510497.53 372882462. -> -375392960 Inexact Rounded -xadd045 add 136.255393E+53329961 -53494.7201E+720058060 -> -5.34947201E+720058064 Inexact Rounded -xcom045 compare 136.255393E+53329961 -53494.7201E+720058060 -> 1 -xdiv045 divide 136.255393E+53329961 -53494.7201E+720058060 -> -2.54708115E-666728102 Inexact Rounded -xdvi045 divideint 136.255393E+53329961 -53494.7201E+720058060 -> -0 -xmul045 multiply 136.255393E+53329961 -53494.7201E+720058060 -> -7.28894411E+773388027 Inexact Rounded -xpow045 power 136.255393E+53329961 -5 -> 2.12927373E-266649816 Inexact Rounded -xrem045 remainder 136.255393E+53329961 -53494.7201E+720058060 -> 1.36255393E+53329963 -xsub045 subtract 136.255393E+53329961 -53494.7201E+720058060 -> 5.34947201E+720058064 Inexact Rounded -xadd046 add -876673.100 -6150.92266 -> -882824.023 Inexact Rounded -xcom046 compare -876673.100 -6150.92266 -> -1 -xdiv046 divide -876673.100 -6150.92266 -> 142.527089 Inexact Rounded -xdvi046 divideint -876673.100 -6150.92266 -> 142 -xmul046 multiply -876673.100 -6150.92266 -> 5.39234844E+9 Inexact Rounded -xpow046 power -876673.100 -6151 -> -4.03111774E-36555 Inexact Rounded -xrem046 remainder -876673.100 -6150.92266 -> -3242.08228 -xsub046 subtract -876673.100 -6150.92266 -> -870522.177 Inexact Rounded -xadd047 add -2.45151797E+911306117 27235771 -> -2.45151797E+911306117 Inexact Rounded -xcom047 compare -2.45151797E+911306117 27235771 -> -1 -xdiv047 divide -2.45151797E+911306117 27235771 -> -9.00109628E+911306109 Inexact Rounded -xdvi047 divideint -2.45151797E+911306117 27235771 -> NaN Division_impossible -xmul047 multiply -2.45151797E+911306117 27235771 -> -6.67689820E+911306124 Inexact Rounded -xpow047 power -2.45151797E+911306117 27235771 -> -Infinity Overflow Inexact Rounded -xrem047 remainder -2.45151797E+911306117 27235771 -> NaN Division_impossible -xsub047 subtract -2.45151797E+911306117 27235771 -> -2.45151797E+911306117 Inexact Rounded -xadd048 add -9.15117551 -4.95100733E-314511326 -> -9.15117551 Inexact Rounded -xcom048 compare -9.15117551 -4.95100733E-314511326 -> -1 -xdiv048 divide -9.15117551 -4.95100733E-314511326 -> 1.84834618E+314511326 Inexact Rounded -xdvi048 divideint -9.15117551 -4.95100733E-314511326 -> NaN Division_impossible -xmul048 multiply -9.15117551 -4.95100733E-314511326 -> 4.53075370E-314511325 Inexact Rounded -xpow048 power -9.15117551 -5 -> -0.0000155817265 Inexact Rounded -xrem048 remainder -9.15117551 -4.95100733E-314511326 -> NaN Division_impossible -xsub048 subtract -9.15117551 -4.95100733E-314511326 -> -9.15117551 Inexact Rounded -xadd049 add 3.61890453E-985606128 30664416. -> 30664416.0 Inexact Rounded -xcom049 compare 3.61890453E-985606128 30664416. -> -1 -xdiv049 divide 3.61890453E-985606128 30664416. -> 1.18016418E-985606135 Inexact Rounded -xdvi049 divideint 3.61890453E-985606128 30664416. -> 0 -xmul049 multiply 3.61890453E-985606128 30664416. -> 1.10971594E-985606120 Inexact Rounded -xpow049 power 3.61890453E-985606128 30664416 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem049 remainder 3.61890453E-985606128 30664416. -> 3.61890453E-985606128 -xsub049 subtract 3.61890453E-985606128 30664416. -> -30664416.0 Inexact Rounded -xadd050 add -257674602E+216723382 -70820959.4 -> -2.57674602E+216723390 Inexact Rounded -xcom050 compare -257674602E+216723382 -70820959.4 -> -1 -xdiv050 divide -257674602E+216723382 -70820959.4 -> 3.63839468E+216723382 Inexact Rounded -xdvi050 divideint -257674602E+216723382 -70820959.4 -> NaN Division_impossible -xmul050 multiply -257674602E+216723382 -70820959.4 -> 1.82487625E+216723398 Inexact Rounded -xpow050 power -257674602E+216723382 -70820959 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem050 remainder -257674602E+216723382 -70820959.4 -> NaN Division_impossible -xsub050 subtract -257674602E+216723382 -70820959.4 -> -2.57674602E+216723390 Inexact Rounded -xadd051 add 218699.206 556944241. -> 557162940 Inexact Rounded -xcom051 compare 218699.206 556944241. -> -1 -xdiv051 divide 218699.206 556944241. -> 0.000392677022 Inexact Rounded -xdvi051 divideint 218699.206 556944241. -> 0 -xmul051 multiply 218699.206 556944241. -> 1.21803263E+14 Inexact Rounded -xpow051 power 218699.206 556944241 -> Infinity Overflow Inexact Rounded -xrem051 remainder 218699.206 556944241. -> 218699.206 -xsub051 subtract 218699.206 556944241. -> -556725542 Inexact Rounded -xadd052 add 106211716. -3456793.74 -> 102754922 Inexact Rounded -xcom052 compare 106211716. -3456793.74 -> 1 -xdiv052 divide 106211716. -3456793.74 -> -30.7255000 Inexact Rounded -xdvi052 divideint 106211716. -3456793.74 -> -30 -xmul052 multiply 106211716. -3456793.74 -> -3.67151995E+14 Inexact Rounded -xpow052 power 106211716. -3456794 -> 2.07225581E-27744825 Inexact Rounded -xrem052 remainder 106211716. -3456793.74 -> 2507903.80 -xsub052 subtract 106211716. -3456793.74 -> 109668510 Inexact Rounded -xadd053 add 1.25018078 399856.763E-726816740 -> 1.25018078 Inexact Rounded -xcom053 compare 1.25018078 399856.763E-726816740 -> 1 -xdiv053 divide 1.25018078 399856.763E-726816740 -> 3.12657155E+726816734 Inexact Rounded -xdvi053 divideint 1.25018078 399856.763E-726816740 -> NaN Division_impossible -xmul053 multiply 1.25018078 399856.763E-726816740 -> 4.99893240E-726816735 Inexact Rounded -xpow053 power 1.25018078 4 -> 2.44281890 Inexact Rounded -xrem053 remainder 1.25018078 399856.763E-726816740 -> NaN Division_impossible -xsub053 subtract 1.25018078 399856.763E-726816740 -> 1.25018078 Inexact Rounded -xadd054 add 364.99811 -46222.0505 -> -45857.0524 Inexact Rounded -xcom054 compare 364.99811 -46222.0505 -> 1 -xdiv054 divide 364.99811 -46222.0505 -> -0.00789662306 Inexact Rounded -xdvi054 divideint 364.99811 -46222.0505 -> -0 -xmul054 multiply 364.99811 -46222.0505 -> -16870961.1 Inexact Rounded -xpow054 power 364.99811 -46222 -> 6.35570856E-118435 Inexact Rounded -xrem054 remainder 364.99811 -46222.0505 -> 364.99811 -xsub054 subtract 364.99811 -46222.0505 -> 46587.0486 Inexact Rounded -xadd055 add -392217576. -958364096 -> -1.35058167E+9 Inexact Rounded -xcom055 compare -392217576. -958364096 -> 1 -xdiv055 divide -392217576. -958364096 -> 0.409257377 Inexact Rounded -xdvi055 divideint -392217576. -958364096 -> 0 -xmul055 multiply -392217576. -958364096 -> 3.75887243E+17 Inexact Rounded -xpow055 power -392217576. -958364096 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem055 remainder -392217576. -958364096 -> -392217576 -xsub055 subtract -392217576. -958364096 -> 566146520 -xadd056 add 169601285 714526.639 -> 170315812 Inexact Rounded -xcom056 compare 169601285 714526.639 -> 1 -xdiv056 divide 169601285 714526.639 -> 237.361738 Inexact Rounded -xdvi056 divideint 169601285 714526.639 -> 237 -xmul056 multiply 169601285 714526.639 -> 1.21184636E+14 Inexact Rounded -xpow056 power 169601285 714527 -> 2.06052444E+5880149 Inexact Rounded -xrem056 remainder 169601285 714526.639 -> 258471.557 -xsub056 subtract 169601285 714526.639 -> 168886758 Inexact Rounded -xadd057 add -674.094552E+586944319 6354.2668E+589657266 -> 6.35426680E+589657269 Inexact Rounded -xcom057 compare -674.094552E+586944319 6354.2668E+589657266 -> -1 -xdiv057 divide -674.094552E+586944319 6354.2668E+589657266 -> -1.06085340E-2712948 Inexact Rounded -xdvi057 divideint -674.094552E+586944319 6354.2668E+589657266 -> -0 -xmul057 multiply -674.094552E+586944319 6354.2668E+589657266 -> -Infinity Inexact Overflow Rounded -xpow057 power -674.094552E+586944319 6 -> Infinity Overflow Inexact Rounded -xrem057 remainder -674.094552E+586944319 6354.2668E+589657266 -> -6.74094552E+586944321 -xsub057 subtract -674.094552E+586944319 6354.2668E+589657266 -> -6.35426680E+589657269 Inexact Rounded -xadd058 add 151795163E-371727182 -488.09788E-738852245 -> 1.51795163E-371727174 Inexact Rounded -xcom058 compare 151795163E-371727182 -488.09788E-738852245 -> 1 -xdiv058 divide 151795163E-371727182 -488.09788E-738852245 -> -3.10993285E+367125068 Inexact Rounded -xdvi058 divideint 151795163E-371727182 -488.09788E-738852245 -> NaN Division_impossible -xmul058 multiply 151795163E-371727182 -488.09788E-738852245 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow058 power 151795163E-371727182 -5 -> Infinity Overflow Inexact Rounded -xrem058 remainder 151795163E-371727182 -488.09788E-738852245 -> NaN Division_impossible -xsub058 subtract 151795163E-371727182 -488.09788E-738852245 -> 1.51795163E-371727174 Inexact Rounded -xadd059 add -746.293386 927749.647 -> 927003.354 Inexact Rounded -xcom059 compare -746.293386 927749.647 -> -1 -xdiv059 divide -746.293386 927749.647 -> -0.000804412471 Inexact Rounded -xdvi059 divideint -746.293386 927749.647 -> -0 -xmul059 multiply -746.293386 927749.647 -> -692373425 Inexact Rounded -xpow059 power -746.293386 927750 -> 7.49278741E+2665341 Inexact Rounded -xrem059 remainder -746.293386 927749.647 -> -746.293386 -xsub059 subtract -746.293386 927749.647 -> -928495.940 Inexact Rounded -xadd060 add 888946471E+241331592 -235739.595 -> 8.88946471E+241331600 Inexact Rounded -xcom060 compare 888946471E+241331592 -235739.595 -> 1 -xdiv060 divide 888946471E+241331592 -235739.595 -> -3.77088317E+241331595 Inexact Rounded -xdvi060 divideint 888946471E+241331592 -235739.595 -> NaN Division_impossible -xmul060 multiply 888946471E+241331592 -235739.595 -> -2.09559881E+241331606 Inexact Rounded -xpow060 power 888946471E+241331592 -235740 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem060 remainder 888946471E+241331592 -235739.595 -> NaN Division_impossible -xsub060 subtract 888946471E+241331592 -235739.595 -> 8.88946471E+241331600 Inexact Rounded -xadd061 add 6.64377249 79161.1070E+619453776 -> 7.91611070E+619453780 Inexact Rounded -xcom061 compare 6.64377249 79161.1070E+619453776 -> -1 -xdiv061 divide 6.64377249 79161.1070E+619453776 -> 8.39272307E-619453781 Inexact Rounded -xdvi061 divideint 6.64377249 79161.1070E+619453776 -> 0 -xmul061 multiply 6.64377249 79161.1070E+619453776 -> 5.25928385E+619453781 Inexact Rounded -xpow061 power 6.64377249 8 -> 3795928.44 Inexact Rounded -xrem061 remainder 6.64377249 79161.1070E+619453776 -> 6.64377249 -xsub061 subtract 6.64377249 79161.1070E+619453776 -> -7.91611070E+619453780 Inexact Rounded -xadd062 add 3146.66571E-313373366 88.5282010 -> 88.5282010 Inexact Rounded -xcom062 compare 3146.66571E-313373366 88.5282010 -> -1 -xdiv062 divide 3146.66571E-313373366 88.5282010 -> 3.55442184E-313373365 Inexact Rounded -xdvi062 divideint 3146.66571E-313373366 88.5282010 -> 0 -xmul062 multiply 3146.66571E-313373366 88.5282010 -> 2.78568654E-313373361 Inexact Rounded -xpow062 power 3146.66571E-313373366 89 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem062 remainder 3146.66571E-313373366 88.5282010 -> 3.14666571E-313373363 -xsub062 subtract 3146.66571E-313373366 88.5282010 -> -88.5282010 Inexact Rounded -xadd063 add 6.44693097 -87195.8711 -> -87189.4242 Inexact Rounded -xcom063 compare 6.44693097 -87195.8711 -> 1 -xdiv063 divide 6.44693097 -87195.8711 -> -0.0000739361955 Inexact Rounded -xdvi063 divideint 6.44693097 -87195.8711 -> -0 -xmul063 multiply 6.44693097 -87195.8711 -> -562145.762 Inexact Rounded -xpow063 power 6.44693097 -87196 -> 4.50881730E-70573 Inexact Rounded -xrem063 remainder 6.44693097 -87195.8711 -> 6.44693097 -xsub063 subtract 6.44693097 -87195.8711 -> 87202.3180 Inexact Rounded -xadd064 add -2113132.56E+577957840 981125821 -> -2.11313256E+577957846 Inexact Rounded -xcom064 compare -2113132.56E+577957840 981125821 -> -1 -xdiv064 divide -2113132.56E+577957840 981125821 -> -2.15378345E+577957837 Inexact Rounded -xdvi064 divideint -2113132.56E+577957840 981125821 -> NaN Division_impossible -xmul064 multiply -2113132.56E+577957840 981125821 -> -2.07324892E+577957855 Inexact Rounded -xpow064 power -2113132.56E+577957840 981125821 -> -Infinity Overflow Inexact Rounded -xrem064 remainder -2113132.56E+577957840 981125821 -> NaN Division_impossible -xsub064 subtract -2113132.56E+577957840 981125821 -> -2.11313256E+577957846 Inexact Rounded -xadd065 add -7701.42814 72667.5181 -> 64966.0900 Inexact Rounded -xcom065 compare -7701.42814 72667.5181 -> -1 -xdiv065 divide -7701.42814 72667.5181 -> -0.105981714 Inexact Rounded -xdvi065 divideint -7701.42814 72667.5181 -> -0 -xmul065 multiply -7701.42814 72667.5181 -> -559643669 Inexact Rounded -xpow065 power -7701.42814 72668 -> 2.29543837E+282429 Inexact Rounded -xrem065 remainder -7701.42814 72667.5181 -> -7701.42814 -xsub065 subtract -7701.42814 72667.5181 -> -80368.9462 Inexact Rounded -xadd066 add -851.754789 -582659.149 -> -583510.904 Inexact Rounded -xcom066 compare -851.754789 -582659.149 -> 1 -xdiv066 divide -851.754789 -582659.149 -> 0.00146184058 Inexact Rounded -xdvi066 divideint -851.754789 -582659.149 -> 0 -xmul066 multiply -851.754789 -582659.149 -> 496282721 Inexact Rounded -xpow066 power -851.754789 -582659 -> -6.83532593E-1707375 Inexact Rounded -xrem066 remainder -851.754789 -582659.149 -> -851.754789 -xsub066 subtract -851.754789 -582659.149 -> 581807.394 Inexact Rounded -xadd067 add -5.01992943 7852.16531 -> 7847.14538 Inexact Rounded -xcom067 compare -5.01992943 7852.16531 -> -1 -xdiv067 divide -5.01992943 7852.16531 -> -0.000639305113 Inexact Rounded -xdvi067 divideint -5.01992943 7852.16531 -> -0 -xmul067 multiply -5.01992943 7852.16531 -> -39417.3157 Inexact Rounded -xpow067 power -5.01992943 7852 -> 7.54481448E+5501 Inexact Rounded -xrem067 remainder -5.01992943 7852.16531 -> -5.01992943 -xsub067 subtract -5.01992943 7852.16531 -> -7857.18524 Inexact Rounded -xadd068 add -12393257.2 76803689E+949125770 -> 7.68036890E+949125777 Inexact Rounded -xcom068 compare -12393257.2 76803689E+949125770 -> -1 -xdiv068 divide -12393257.2 76803689E+949125770 -> -1.61362786E-949125771 Inexact Rounded -xdvi068 divideint -12393257.2 76803689E+949125770 -> -0 -xmul068 multiply -12393257.2 76803689E+949125770 -> -9.51847872E+949125784 Inexact Rounded -xpow068 power -12393257.2 8 -> 5.56523750E+56 Inexact Rounded -xrem068 remainder -12393257.2 76803689E+949125770 -> -12393257.2 -xsub068 subtract -12393257.2 76803689E+949125770 -> -7.68036890E+949125777 Inexact Rounded -xadd069 add -754771634.E+716555026 -292336.311 -> -7.54771634E+716555034 Inexact Rounded -xcom069 compare -754771634.E+716555026 -292336.311 -> -1 -xdiv069 divide -754771634.E+716555026 -292336.311 -> 2.58186070E+716555029 Inexact Rounded -xdvi069 divideint -754771634.E+716555026 -292336.311 -> NaN Division_impossible -xmul069 multiply -754771634.E+716555026 -292336.311 -> 2.20647155E+716555040 Inexact Rounded -xpow069 power -754771634.E+716555026 -292336 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem069 remainder -754771634.E+716555026 -292336.311 -> NaN Division_impossible -xsub069 subtract -754771634.E+716555026 -292336.311 -> -7.54771634E+716555034 Inexact Rounded -xadd070 add -915006.171E+614548652 -314086965. -> -9.15006171E+614548657 Inexact Rounded -xcom070 compare -915006.171E+614548652 -314086965. -> -1 -xdiv070 divide -915006.171E+614548652 -314086965. -> 2.91322555E+614548649 Inexact Rounded -xdvi070 divideint -915006.171E+614548652 -314086965. -> NaN Division_impossible -xmul070 multiply -915006.171E+614548652 -314086965. -> 2.87391511E+614548666 Inexact Rounded -xpow070 power -915006.171E+614548652 -314086965 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem070 remainder -915006.171E+614548652 -314086965. -> NaN Division_impossible -xsub070 subtract -915006.171E+614548652 -314086965. -> -9.15006171E+614548657 Inexact Rounded -xadd071 add -296590035 -481734529 -> -778324564 -xcom071 compare -296590035 -481734529 -> 1 -xdiv071 divide -296590035 -481734529 -> 0.615671116 Inexact Rounded -xdvi071 divideint -296590035 -481734529 -> 0 -xmul071 multiply -296590035 -481734529 -> 1.42877661E+17 Inexact Rounded -xpow071 power -296590035 -481734529 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem071 remainder -296590035 -481734529 -> -296590035 -xsub071 subtract -296590035 -481734529 -> 185144494 -xadd072 add 8.27822605 9241557.19 -> 9241565.47 Inexact Rounded -xcom072 compare 8.27822605 9241557.19 -> -1 -xdiv072 divide 8.27822605 9241557.19 -> 8.95760950E-7 Inexact Rounded -xdvi072 divideint 8.27822605 9241557.19 -> 0 -xmul072 multiply 8.27822605 9241557.19 -> 76503699.5 Inexact Rounded -xpow072 power 8.27822605 9241557 -> 5.10219969E+8483169 Inexact Rounded -xrem072 remainder 8.27822605 9241557.19 -> 8.27822605 -xsub072 subtract 8.27822605 9241557.19 -> -9241548.91 Inexact Rounded -xadd073 add -1.43581098 7286313.54 -> 7286312.10 Inexact Rounded -xcom073 compare -1.43581098 7286313.54 -> -1 -xdiv073 divide -1.43581098 7286313.54 -> -1.97055887E-7 Inexact Rounded -xdvi073 divideint -1.43581098 7286313.54 -> -0 -xmul073 multiply -1.43581098 7286313.54 -> -10461769.0 Inexact Rounded -xpow073 power -1.43581098 7286314 -> 1.09389741E+1144660 Inexact Rounded -xrem073 remainder -1.43581098 7286313.54 -> -1.43581098 -xsub073 subtract -1.43581098 7286313.54 -> -7286314.98 Inexact Rounded -xadd074 add -699036193. 759263.509E+533543625 -> 7.59263509E+533543630 Inexact Rounded -xcom074 compare -699036193. 759263.509E+533543625 -> -1 -xdiv074 divide -699036193. 759263.509E+533543625 -> -9.20676662E-533543623 Inexact Rounded -xdvi074 divideint -699036193. 759263.509E+533543625 -> -0 -xmul074 multiply -699036193. 759263.509E+533543625 -> -5.30752673E+533543639 Inexact Rounded -xpow074 power -699036193. 8 -> 5.70160724E+70 Inexact Rounded -xrem074 remainder -699036193. 759263.509E+533543625 -> -699036193 -xsub074 subtract -699036193. 759263.509E+533543625 -> -7.59263509E+533543630 Inexact Rounded -xadd075 add -83.7273615E-305281957 -287779593.E+458777774 -> -2.87779593E+458777782 Inexact Rounded -xcom075 compare -83.7273615E-305281957 -287779593.E+458777774 -> 1 -xdiv075 divide -83.7273615E-305281957 -287779593.E+458777774 -> 2.90942664E-764059738 Inexact Rounded -xdvi075 divideint -83.7273615E-305281957 -287779593.E+458777774 -> 0 -xmul075 multiply -83.7273615E-305281957 -287779593.E+458777774 -> 2.40950260E+153495827 Inexact Rounded -xpow075 power -83.7273615E-305281957 -3 -> -1.70371828E+915845865 Inexact Rounded -xrem075 remainder -83.7273615E-305281957 -287779593.E+458777774 -> -8.37273615E-305281956 -xsub075 subtract -83.7273615E-305281957 -287779593.E+458777774 -> 2.87779593E+458777782 Inexact Rounded -xadd076 add 8.48503224 6522.03316 -> 6530.51819 Inexact Rounded -xcom076 compare 8.48503224 6522.03316 -> -1 -xdiv076 divide 8.48503224 6522.03316 -> 0.00130097962 Inexact Rounded -xdvi076 divideint 8.48503224 6522.03316 -> 0 -xmul076 multiply 8.48503224 6522.03316 -> 55339.6616 Inexact Rounded -xpow076 power 8.48503224 6522 -> 4.76547542E+6056 Inexact Rounded -xrem076 remainder 8.48503224 6522.03316 -> 8.48503224 -xsub076 subtract 8.48503224 6522.03316 -> -6513.54813 Inexact Rounded -xadd077 add 527916091 -809.054070 -> 527915282 Inexact Rounded -xcom077 compare 527916091 -809.054070 -> 1 -xdiv077 divide 527916091 -809.054070 -> -652510.272 Inexact Rounded -xdvi077 divideint 527916091 -809.054070 -> -652510 -xmul077 multiply 527916091 -809.054070 -> -4.27112662E+11 Inexact Rounded -xpow077 power 527916091 -809 -> 2.78609697E-7057 Inexact Rounded -xrem077 remainder 527916091 -809.054070 -> 219.784300 -xsub077 subtract 527916091 -809.054070 -> 527916900 Inexact Rounded -xadd078 add 3857058.60 5792997.58E+881077409 -> 5.79299758E+881077415 Inexact Rounded -xcom078 compare 3857058.60 5792997.58E+881077409 -> -1 -xdiv078 divide 3857058.60 5792997.58E+881077409 -> 6.65813950E-881077410 Inexact Rounded -xdvi078 divideint 3857058.60 5792997.58E+881077409 -> 0 -xmul078 multiply 3857058.60 5792997.58E+881077409 -> 2.23439311E+881077422 Inexact Rounded -xpow078 power 3857058.60 6 -> 3.29258824E+39 Inexact Rounded -xrem078 remainder 3857058.60 5792997.58E+881077409 -> 3857058.60 -xsub078 subtract 3857058.60 5792997.58E+881077409 -> -5.79299758E+881077415 Inexact Rounded -xadd079 add -66587363.E+556538173 -551902402E+357309146 -> -6.65873630E+556538180 Inexact Rounded -xcom079 compare -66587363.E+556538173 -551902402E+357309146 -> -1 -xdiv079 divide -66587363.E+556538173 -551902402E+357309146 -> 1.20650613E+199229026 Inexact Rounded -xdvi079 divideint -66587363.E+556538173 -551902402E+357309146 -> NaN Division_impossible -xmul079 multiply -66587363.E+556538173 -551902402E+357309146 -> 3.67497256E+913847335 Inexact Rounded -xpow079 power -66587363.E+556538173 -6 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem079 remainder -66587363.E+556538173 -551902402E+357309146 -> NaN Division_impossible -xsub079 subtract -66587363.E+556538173 -551902402E+357309146 -> -6.65873630E+556538180 Inexact Rounded -xadd080 add -580.502955 38125521.7 -> 38124941.2 Inexact Rounded -xcom080 compare -580.502955 38125521.7 -> -1 -xdiv080 divide -580.502955 38125521.7 -> -0.0000152260987 Inexact Rounded -xdvi080 divideint -580.502955 38125521.7 -> -0 -xmul080 multiply -580.502955 38125521.7 -> -2.21319780E+10 Inexact Rounded -xpow080 power -580.502955 38125522 -> 6.07262078E+105371486 Inexact Rounded -xrem080 remainder -580.502955 38125521.7 -> -580.502955 -xsub080 subtract -580.502955 38125521.7 -> -38126102.2 Inexact Rounded -xadd081 add -9627363.00 -80616885E-749891394 -> -9627363.00 Inexact Rounded -xcom081 compare -9627363.00 -80616885E-749891394 -> -1 -xdiv081 divide -9627363.00 -80616885E-749891394 -> 1.19421173E+749891393 Inexact Rounded -xdvi081 divideint -9627363.00 -80616885E-749891394 -> NaN Division_impossible -xmul081 multiply -9627363.00 -80616885E-749891394 -> 7.76128016E-749891380 Inexact Rounded -xpow081 power -9627363.00 -8 -> 1.35500601E-56 Inexact Rounded -xrem081 remainder -9627363.00 -80616885E-749891394 -> NaN Division_impossible -xsub081 subtract -9627363.00 -80616885E-749891394 -> -9627363.00 Inexact Rounded -xadd082 add -526.594855E+803110107 -64.5451639 -> -5.26594855E+803110109 Inexact Rounded -xcom082 compare -526.594855E+803110107 -64.5451639 -> -1 -xdiv082 divide -526.594855E+803110107 -64.5451639 -> 8.15854858E+803110107 Inexact Rounded -xdvi082 divideint -526.594855E+803110107 -64.5451639 -> NaN Division_impossible -xmul082 multiply -526.594855E+803110107 -64.5451639 -> 3.39891512E+803110111 Inexact Rounded -xpow082 power -526.594855E+803110107 -65 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem082 remainder -526.594855E+803110107 -64.5451639 -> NaN Division_impossible -xsub082 subtract -526.594855E+803110107 -64.5451639 -> -5.26594855E+803110109 Inexact Rounded -xadd083 add -8378.55499 760.131257 -> -7618.42373 Inexact Rounded -xcom083 compare -8378.55499 760.131257 -> -1 -xdiv083 divide -8378.55499 760.131257 -> -11.0225108 Inexact Rounded -xdvi083 divideint -8378.55499 760.131257 -> -11 -xmul083 multiply -8378.55499 760.131257 -> -6368801.54 Inexact Rounded -xpow083 power -8378.55499 760 -> 4.06007928E+2981 Inexact Rounded -xrem083 remainder -8378.55499 760.131257 -> -17.111163 -xsub083 subtract -8378.55499 760.131257 -> -9138.68625 Inexact Rounded -xadd084 add -717.697718 984304413 -> 984303695 Inexact Rounded -xcom084 compare -717.697718 984304413 -> -1 -xdiv084 divide -717.697718 984304413 -> -7.29142030E-7 Inexact Rounded -xdvi084 divideint -717.697718 984304413 -> -0 -xmul084 multiply -717.697718 984304413 -> -7.06433031E+11 Inexact Rounded -xpow084 power -717.697718 984304413 -> -Infinity Overflow Inexact Rounded -xrem084 remainder -717.697718 984304413 -> -717.697718 -xsub084 subtract -717.697718 984304413 -> -984305131 Inexact Rounded -xadd085 add -76762243.4E-741100094 -273.706674 -> -273.706674 Inexact Rounded -xcom085 compare -76762243.4E-741100094 -273.706674 -> 1 -xdiv085 divide -76762243.4E-741100094 -273.706674 -> 2.80454409E-741100089 Inexact Rounded -xdvi085 divideint -76762243.4E-741100094 -273.706674 -> 0 -xmul085 multiply -76762243.4E-741100094 -273.706674 -> 2.10103383E-741100084 Inexact Rounded -xpow085 power -76762243.4E-741100094 -274 -> Infinity Overflow Inexact Rounded -xrem085 remainder -76762243.4E-741100094 -273.706674 -> -7.67622434E-741100087 -xsub085 subtract -76762243.4E-741100094 -273.706674 -> 273.706674 Inexact Rounded -xadd086 add -701.518354E+786274918 8822750.68E+243052107 -> -7.01518354E+786274920 Inexact Rounded -xcom086 compare -701.518354E+786274918 8822750.68E+243052107 -> -1 -xdiv086 divide -701.518354E+786274918 8822750.68E+243052107 -> -7.95124309E+543222806 Inexact Rounded -xdvi086 divideint -701.518354E+786274918 8822750.68E+243052107 -> NaN Division_impossible -xmul086 multiply -701.518354E+786274918 8822750.68E+243052107 -> -Infinity Inexact Overflow Rounded -xpow086 power -701.518354E+786274918 9 -> -Infinity Overflow Inexact Rounded -xrem086 remainder -701.518354E+786274918 8822750.68E+243052107 -> NaN Division_impossible -xsub086 subtract -701.518354E+786274918 8822750.68E+243052107 -> -7.01518354E+786274920 Inexact Rounded -xadd087 add -359866845. -4.57434117 -> -359866850 Inexact Rounded -xcom087 compare -359866845. -4.57434117 -> -1 -xdiv087 divide -359866845. -4.57434117 -> 78670748.8 Inexact Rounded -xdvi087 divideint -359866845. -4.57434117 -> 78670748 -xmul087 multiply -359866845. -4.57434117 -> 1.64615372E+9 Inexact Rounded -xpow087 power -359866845. -5 -> -1.65687909E-43 Inexact Rounded -xrem087 remainder -359866845. -4.57434117 -> -3.54890484 -xsub087 subtract -359866845. -4.57434117 -> -359866840 Inexact Rounded -xadd088 add 779934536. -76562645.7 -> 703371890 Inexact Rounded -xcom088 compare 779934536. -76562645.7 -> 1 -xdiv088 divide 779934536. -76562645.7 -> -10.1868807 Inexact Rounded -xdvi088 divideint 779934536. -76562645.7 -> -10 -xmul088 multiply 779934536. -76562645.7 -> -5.97138515E+16 Inexact Rounded -xpow088 power 779934536. -76562646 -> 3.36739063E-680799501 Inexact Rounded -xrem088 remainder 779934536. -76562645.7 -> 14308079.0 -xsub088 subtract 779934536. -76562645.7 -> 856497182 Inexact Rounded -xadd089 add -4820.95451 3516234.99E+303303176 -> 3.51623499E+303303182 Inexact Rounded -xcom089 compare -4820.95451 3516234.99E+303303176 -> -1 -xdiv089 divide -4820.95451 3516234.99E+303303176 -> -1.37105584E-303303179 Inexact Rounded -xdvi089 divideint -4820.95451 3516234.99E+303303176 -> -0 -xmul089 multiply -4820.95451 3516234.99E+303303176 -> -1.69516089E+303303186 Inexact Rounded -xpow089 power -4820.95451 4 -> 5.40172082E+14 Inexact Rounded -xrem089 remainder -4820.95451 3516234.99E+303303176 -> -4820.95451 -xsub089 subtract -4820.95451 3516234.99E+303303176 -> -3.51623499E+303303182 Inexact Rounded -xadd090 add 69355976.9 -9.57838562E+758804984 -> -9.57838562E+758804984 Inexact Rounded -xcom090 compare 69355976.9 -9.57838562E+758804984 -> 1 -xdiv090 divide 69355976.9 -9.57838562E+758804984 -> -7.24088376E-758804978 Inexact Rounded -xdvi090 divideint 69355976.9 -9.57838562E+758804984 -> -0 -xmul090 multiply 69355976.9 -9.57838562E+758804984 -> -6.64318292E+758804992 Inexact Rounded -xpow090 power 69355976.9 -10 -> 3.88294346E-79 Inexact Rounded -xrem090 remainder 69355976.9 -9.57838562E+758804984 -> 69355976.9 -xsub090 subtract 69355976.9 -9.57838562E+758804984 -> 9.57838562E+758804984 Inexact Rounded -xadd091 add -12672093.1 8569.78255E-382866025 -> -12672093.1 Inexact Rounded -xcom091 compare -12672093.1 8569.78255E-382866025 -> -1 -xdiv091 divide -12672093.1 8569.78255E-382866025 -> -1.47869482E+382866028 Inexact Rounded -xdvi091 divideint -12672093.1 8569.78255E-382866025 -> NaN Division_impossible -xmul091 multiply -12672093.1 8569.78255E-382866025 -> -1.08597082E-382866014 Inexact Rounded -xpow091 power -12672093.1 9 -> -8.42626658E+63 Inexact Rounded -xrem091 remainder -12672093.1 8569.78255E-382866025 -> NaN Division_impossible -xsub091 subtract -12672093.1 8569.78255E-382866025 -> -12672093.1 Inexact Rounded -xadd092 add -5910750.2 66150383E-662459241 -> -5910750.20 Inexact Rounded -xcom092 compare -5910750.2 66150383E-662459241 -> -1 -xdiv092 divide -5910750.2 66150383E-662459241 -> -8.93532272E+662459239 Inexact Rounded -xdvi092 divideint -5910750.2 66150383E-662459241 -> NaN Division_impossible -xmul092 multiply -5910750.2 66150383E-662459241 -> -3.90998390E-662459227 Inexact Rounded -xpow092 power -5910750.2 7 -> -2.52056696E+47 Inexact Rounded -xrem092 remainder -5910750.2 66150383E-662459241 -> NaN Division_impossible -xsub092 subtract -5910750.2 66150383E-662459241 -> -5910750.20 Inexact Rounded -xadd093 add -532577268.E-163806629 -240650398E-650110558 -> -5.32577268E-163806621 Inexact Rounded -xcom093 compare -532577268.E-163806629 -240650398E-650110558 -> -1 -xdiv093 divide -532577268.E-163806629 -240650398E-650110558 -> 2.21307454E+486303929 Inexact Rounded -xdvi093 divideint -532577268.E-163806629 -240650398E-650110558 -> NaN Division_impossible -xmul093 multiply -532577268.E-163806629 -240650398E-650110558 -> 1.28164932E-813917170 Inexact Rounded -xpow093 power -532577268.E-163806629 -2 -> 3.52561389E+327613240 Inexact Rounded -xrem093 remainder -532577268.E-163806629 -240650398E-650110558 -> NaN Division_impossible -xsub093 subtract -532577268.E-163806629 -240650398E-650110558 -> -5.32577268E-163806621 Inexact Rounded -xadd094 add -671.507198E-908587890 3057429.32E-555230623 -> 3.05742932E-555230617 Inexact Rounded -xcom094 compare -671.507198E-908587890 3057429.32E-555230623 -> -1 -xdiv094 divide -671.507198E-908587890 3057429.32E-555230623 -> -2.19631307E-353357271 Inexact Rounded -xdvi094 divideint -671.507198E-908587890 3057429.32E-555230623 -> -0 -xmul094 multiply -671.507198E-908587890 3057429.32E-555230623 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow094 power -671.507198E-908587890 3 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem094 remainder -671.507198E-908587890 3057429.32E-555230623 -> -6.71507198E-908587888 -xsub094 subtract -671.507198E-908587890 3057429.32E-555230623 -> -3.05742932E-555230617 Inexact Rounded -xadd095 add -294.994352E+346452027 -6061853.0 -> -2.94994352E+346452029 Inexact Rounded -xcom095 compare -294.994352E+346452027 -6061853.0 -> -1 -xdiv095 divide -294.994352E+346452027 -6061853.0 -> 4.86640557E+346452022 Inexact Rounded -xdvi095 divideint -294.994352E+346452027 -6061853.0 -> NaN Division_impossible -xmul095 multiply -294.994352E+346452027 -6061853.0 -> 1.78821240E+346452036 Inexact Rounded -xpow095 power -294.994352E+346452027 -6061853 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem095 remainder -294.994352E+346452027 -6061853.0 -> NaN Division_impossible -xsub095 subtract -294.994352E+346452027 -6061853.0 -> -2.94994352E+346452029 Inexact Rounded -xadd096 add 329579114 146780548. -> 476359662 -xcom096 compare 329579114 146780548. -> 1 -xdiv096 divide 329579114 146780548. -> 2.24538686 Inexact Rounded -xdvi096 divideint 329579114 146780548. -> 2 -xmul096 multiply 329579114 146780548. -> 4.83758030E+16 Inexact Rounded -xpow096 power 329579114 146780548 -> Infinity Overflow Inexact Rounded -xrem096 remainder 329579114 146780548. -> 36018018 -xsub096 subtract 329579114 146780548. -> 182798566 -xadd097 add -789904.686E-217225000 -1991.07181E-84080059 -> -1.99107181E-84080056 Inexact Rounded -xcom097 compare -789904.686E-217225000 -1991.07181E-84080059 -> 1 -xdiv097 divide -789904.686E-217225000 -1991.07181E-84080059 -> 3.96723354E-133144939 Inexact Rounded -xdvi097 divideint -789904.686E-217225000 -1991.07181E-84080059 -> 0 -xmul097 multiply -789904.686E-217225000 -1991.07181E-84080059 -> 1.57275695E-301305050 Inexact Rounded -xpow097 power -789904.686E-217225000 -2 -> 1.60269403E+434449988 Inexact Rounded -xrem097 remainder -789904.686E-217225000 -1991.07181E-84080059 -> -7.89904686E-217224995 -xsub097 subtract -789904.686E-217225000 -1991.07181E-84080059 -> 1.99107181E-84080056 Inexact Rounded -xadd098 add 59893.3544 -408595868 -> -408535975 Inexact Rounded -xcom098 compare 59893.3544 -408595868 -> 1 -xdiv098 divide 59893.3544 -408595868 -> -0.000146583358 Inexact Rounded -xdvi098 divideint 59893.3544 -408595868 -> -0 -xmul098 multiply 59893.3544 -408595868 -> -2.44721771E+13 Inexact Rounded -xpow098 power 59893.3544 -408595868 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem098 remainder 59893.3544 -408595868 -> 59893.3544 -xsub098 subtract 59893.3544 -408595868 -> 408655761 Inexact Rounded -xadd099 add 129.878613 -54652.7288E-963564940 -> 129.878613 Inexact Rounded -xcom099 compare 129.878613 -54652.7288E-963564940 -> 1 -xdiv099 divide 129.878613 -54652.7288E-963564940 -> -2.37643418E+963564937 Inexact Rounded -xdvi099 divideint 129.878613 -54652.7288E-963564940 -> NaN Division_impossible -xmul099 multiply 129.878613 -54652.7288E-963564940 -> -7.09822061E-963564934 Inexact Rounded -xpow099 power 129.878613 -5 -> 2.70590029E-11 Inexact Rounded -xrem099 remainder 129.878613 -54652.7288E-963564940 -> NaN Division_impossible -xsub099 subtract 129.878613 -54652.7288E-963564940 -> 129.878613 Inexact Rounded -xadd100 add 9866.99208 708756501. -> 708766368 Inexact Rounded -xcom100 compare 9866.99208 708756501. -> -1 -xdiv100 divide 9866.99208 708756501. -> 0.0000139215543 Inexact Rounded -xdvi100 divideint 9866.99208 708756501. -> 0 -xmul100 multiply 9866.99208 708756501. -> 6.99329478E+12 Inexact Rounded -xpow100 power 9866.99208 708756501 -> Infinity Overflow Inexact Rounded -xrem100 remainder 9866.99208 708756501. -> 9866.99208 -xsub100 subtract 9866.99208 708756501. -> -708746634 Inexact Rounded -xadd101 add -78810.6297 -399884.68 -> -478695.310 Inexact Rounded -xcom101 compare -78810.6297 -399884.68 -> 1 -xdiv101 divide -78810.6297 -399884.68 -> 0.197083393 Inexact Rounded -xdvi101 divideint -78810.6297 -399884.68 -> 0 -xmul101 multiply -78810.6297 -399884.68 -> 3.15151634E+10 Inexact Rounded -xpow101 power -78810.6297 -399885 -> -1.54252408E-1958071 Inexact Rounded -xrem101 remainder -78810.6297 -399884.68 -> -78810.6297 -xsub101 subtract -78810.6297 -399884.68 -> 321074.050 Inexact Rounded -xadd102 add 409189761 -771.471460 -> 409188990 Inexact Rounded -xcom102 compare 409189761 -771.471460 -> 1 -xdiv102 divide 409189761 -771.471460 -> -530401.683 Inexact Rounded -xdvi102 divideint 409189761 -771.471460 -> -530401 -xmul102 multiply 409189761 -771.471460 -> -3.15678222E+11 Inexact Rounded -xpow102 power 409189761 -771 -> 1.60698414E-6640 Inexact Rounded -xrem102 remainder 409189761 -771.471460 -> 527.144540 -xsub102 subtract 409189761 -771.471460 -> 409190532 Inexact Rounded -xadd103 add -1.68748838 460.46924 -> 458.781752 Inexact Rounded -xcom103 compare -1.68748838 460.46924 -> -1 -xdiv103 divide -1.68748838 460.46924 -> -0.00366471467 Inexact Rounded -xdvi103 divideint -1.68748838 460.46924 -> -0 -xmul103 multiply -1.68748838 460.46924 -> -777.036492 Inexact Rounded -xpow103 power -1.68748838 460 -> 3.39440648E+104 Inexact Rounded -xrem103 remainder -1.68748838 460.46924 -> -1.68748838 -xsub103 subtract -1.68748838 460.46924 -> -462.156728 Inexact Rounded -xadd104 add 553527296. -7924.40185 -> 553519372 Inexact Rounded -xcom104 compare 553527296. -7924.40185 -> 1 -xdiv104 divide 553527296. -7924.40185 -> -69850.9877 Inexact Rounded -xdvi104 divideint 553527296. -7924.40185 -> -69850 -xmul104 multiply 553527296. -7924.40185 -> -4.38637273E+12 Inexact Rounded -xpow104 power 553527296. -7924 -> 2.32397213E-69281 Inexact Rounded -xrem104 remainder 553527296. -7924.40185 -> 7826.77750 -xsub104 subtract 553527296. -7924.40185 -> 553535220 Inexact Rounded -xadd105 add -38.7465207 64936.2942 -> 64897.5477 Inexact Rounded -xcom105 compare -38.7465207 64936.2942 -> -1 -xdiv105 divide -38.7465207 64936.2942 -> -0.000596685123 Inexact Rounded -xdvi105 divideint -38.7465207 64936.2942 -> -0 -xmul105 multiply -38.7465207 64936.2942 -> -2516055.47 Inexact Rounded -xpow105 power -38.7465207 64936 -> 3.01500762E+103133 Inexact Rounded -xrem105 remainder -38.7465207 64936.2942 -> -38.7465207 -xsub105 subtract -38.7465207 64936.2942 -> -64975.0407 Inexact Rounded -xadd106 add -201075.248 845.663928 -> -200229.584 Inexact Rounded -xcom106 compare -201075.248 845.663928 -> -1 -xdiv106 divide -201075.248 845.663928 -> -237.772053 Inexact Rounded -xdvi106 divideint -201075.248 845.663928 -> -237 -xmul106 multiply -201075.248 845.663928 -> -170042084 Inexact Rounded -xpow106 power -201075.248 846 -> 4.37911767E+4486 Inexact Rounded -xrem106 remainder -201075.248 845.663928 -> -652.897064 -xsub106 subtract -201075.248 845.663928 -> -201920.912 Inexact Rounded -xadd107 add 91048.4559 75953609.3 -> 76044657.8 Inexact Rounded -xcom107 compare 91048.4559 75953609.3 -> -1 -xdiv107 divide 91048.4559 75953609.3 -> 0.00119873771 Inexact Rounded -xdvi107 divideint 91048.4559 75953609.3 -> 0 -xmul107 multiply 91048.4559 75953609.3 -> 6.91545885E+12 Inexact Rounded -xpow107 power 91048.4559 75953609 -> 6.94467746E+376674650 Inexact Rounded -xrem107 remainder 91048.4559 75953609.3 -> 91048.4559 -xsub107 subtract 91048.4559 75953609.3 -> -75862560.8 Inexact Rounded -xadd108 add 6898273.86E-252097460 15.3456196 -> 15.3456196 Inexact Rounded -xcom108 compare 6898273.86E-252097460 15.3456196 -> -1 -xdiv108 divide 6898273.86E-252097460 15.3456196 -> 4.49527229E-252097455 Inexact Rounded -xdvi108 divideint 6898273.86E-252097460 15.3456196 -> 0 -xmul108 multiply 6898273.86E-252097460 15.3456196 -> 1.05858287E-252097452 Inexact Rounded -xpow108 power 6898273.86E-252097460 15 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem108 remainder 6898273.86E-252097460 15.3456196 -> 6.89827386E-252097454 -xsub108 subtract 6898273.86E-252097460 15.3456196 -> -15.3456196 Inexact Rounded -xadd109 add 88.4370343 -980709105E-869899289 -> 88.4370343 Inexact Rounded -xcom109 compare 88.4370343 -980709105E-869899289 -> 1 -xdiv109 divide 88.4370343 -980709105E-869899289 -> -9.01766220E+869899281 Inexact Rounded -xdvi109 divideint 88.4370343 -980709105E-869899289 -> NaN Division_impossible -xmul109 multiply 88.4370343 -980709105E-869899289 -> -8.67310048E-869899279 Inexact Rounded -xpow109 power 88.4370343 -10 -> 3.41710479E-20 Inexact Rounded -xrem109 remainder 88.4370343 -980709105E-869899289 -> NaN Division_impossible -xsub109 subtract 88.4370343 -980709105E-869899289 -> 88.4370343 Inexact Rounded -xadd110 add -17643.39 2.0352568E+304871331 -> 2.03525680E+304871331 Inexact Rounded -xcom110 compare -17643.39 2.0352568E+304871331 -> -1 -xdiv110 divide -17643.39 2.0352568E+304871331 -> -8.66887658E-304871328 Inexact Rounded -xdvi110 divideint -17643.39 2.0352568E+304871331 -> -0 -xmul110 multiply -17643.39 2.0352568E+304871331 -> -3.59088295E+304871335 Inexact Rounded -xpow110 power -17643.39 2 -> 311289211 Inexact Rounded -xrem110 remainder -17643.39 2.0352568E+304871331 -> -17643.39 -xsub110 subtract -17643.39 2.0352568E+304871331 -> -2.03525680E+304871331 Inexact Rounded -xadd111 add 4589785.16 7459.04237 -> 4597244.20 Inexact Rounded -xcom111 compare 4589785.16 7459.04237 -> 1 -xdiv111 divide 4589785.16 7459.04237 -> 615.331692 Inexact Rounded -xdvi111 divideint 4589785.16 7459.04237 -> 615 -xmul111 multiply 4589785.16 7459.04237 -> 3.42354020E+10 Inexact Rounded -xpow111 power 4589785.16 7459 -> 2.03795258E+49690 Inexact Rounded -xrem111 remainder 4589785.16 7459.04237 -> 2474.10245 -xsub111 subtract 4589785.16 7459.04237 -> 4582326.12 Inexact Rounded -xadd112 add -51.1632090E-753968082 8.96207471E-585797887 -> 8.96207471E-585797887 Inexact Rounded -xcom112 compare -51.1632090E-753968082 8.96207471E-585797887 -> -1 -xdiv112 divide -51.1632090E-753968082 8.96207471E-585797887 -> -5.70885768E-168170195 Inexact Rounded -xdvi112 divideint -51.1632090E-753968082 8.96207471E-585797887 -> -0 -xmul112 multiply -51.1632090E-753968082 8.96207471E-585797887 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow112 power -51.1632090E-753968082 9 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem112 remainder -51.1632090E-753968082 8.96207471E-585797887 -> -5.11632090E-753968081 -xsub112 subtract -51.1632090E-753968082 8.96207471E-585797887 -> -8.96207471E-585797887 Inexact Rounded -xadd113 add 982.217817 7224909.4E-45243816 -> 982.217817 Inexact Rounded -xcom113 compare 982.217817 7224909.4E-45243816 -> 1 -xdiv113 divide 982.217817 7224909.4E-45243816 -> 1.35948807E+45243812 Inexact Rounded -xdvi113 divideint 982.217817 7224909.4E-45243816 -> NaN Division_impossible -xmul113 multiply 982.217817 7224909.4E-45243816 -> 7.09643474E-45243807 Inexact Rounded -xpow113 power 982.217817 7 -> 8.81971709E+20 Inexact Rounded -xrem113 remainder 982.217817 7224909.4E-45243816 -> NaN Division_impossible -xsub113 subtract 982.217817 7224909.4E-45243816 -> 982.217817 Inexact Rounded -xadd114 add 503712056. -57490703.5E+924890183 -> -5.74907035E+924890190 Inexact Rounded -xcom114 compare 503712056. -57490703.5E+924890183 -> 1 -xdiv114 divide 503712056. -57490703.5E+924890183 -> -8.76162623E-924890183 Inexact Rounded -xdvi114 divideint 503712056. -57490703.5E+924890183 -> -0 -xmul114 multiply 503712056. -57490703.5E+924890183 -> -2.89587605E+924890199 Inexact Rounded -xpow114 power 503712056. -6 -> 6.12217764E-53 Inexact Rounded -xrem114 remainder 503712056. -57490703.5E+924890183 -> 503712056 -xsub114 subtract 503712056. -57490703.5E+924890183 -> 5.74907035E+924890190 Inexact Rounded -xadd115 add 883.849223 249259171 -> 249260055 Inexact Rounded -xcom115 compare 883.849223 249259171 -> -1 -xdiv115 divide 883.849223 249259171 -> 0.00000354590453 Inexact Rounded -xdvi115 divideint 883.849223 249259171 -> 0 -xmul115 multiply 883.849223 249259171 -> 2.20307525E+11 Inexact Rounded -xpow115 power 883.849223 249259171 -> 5.15642844E+734411783 Inexact Rounded -xrem115 remainder 883.849223 249259171 -> 883.849223 -xsub115 subtract 883.849223 249259171 -> -249258287 Inexact Rounded -xadd116 add 245.092853E+872642874 828195.152E+419771532 -> 2.45092853E+872642876 Inexact Rounded -xcom116 compare 245.092853E+872642874 828195.152E+419771532 -> 1 -xdiv116 divide 245.092853E+872642874 828195.152E+419771532 -> 2.95936112E+452871338 Inexact Rounded -xdvi116 divideint 245.092853E+872642874 828195.152E+419771532 -> NaN Division_impossible -xmul116 multiply 245.092853E+872642874 828195.152E+419771532 -> Infinity Inexact Overflow Rounded -xpow116 power 245.092853E+872642874 8 -> Infinity Overflow Inexact Rounded -xrem116 remainder 245.092853E+872642874 828195.152E+419771532 -> NaN Division_impossible -xsub116 subtract 245.092853E+872642874 828195.152E+419771532 -> 2.45092853E+872642876 Inexact Rounded -xadd117 add -83658638.6E+728551928 2952478.42 -> -8.36586386E+728551935 Inexact Rounded -xcom117 compare -83658638.6E+728551928 2952478.42 -> -1 -xdiv117 divide -83658638.6E+728551928 2952478.42 -> -2.83350551E+728551929 Inexact Rounded -xdvi117 divideint -83658638.6E+728551928 2952478.42 -> NaN Division_impossible -xmul117 multiply -83658638.6E+728551928 2952478.42 -> -2.47000325E+728551942 Inexact Rounded -xpow117 power -83658638.6E+728551928 2952478 -> Infinity Overflow Inexact Rounded -xrem117 remainder -83658638.6E+728551928 2952478.42 -> NaN Division_impossible -xsub117 subtract -83658638.6E+728551928 2952478.42 -> -8.36586386E+728551935 Inexact Rounded -xadd118 add -6291780.97 269967.394E-22000817 -> -6291780.97 Inexact Rounded -xcom118 compare -6291780.97 269967.394E-22000817 -> -1 -xdiv118 divide -6291780.97 269967.394E-22000817 -> -2.33057069E+22000818 Inexact Rounded -xdvi118 divideint -6291780.97 269967.394E-22000817 -> NaN Division_impossible -xmul118 multiply -6291780.97 269967.394E-22000817 -> -1.69857571E-22000805 Inexact Rounded -xpow118 power -6291780.97 3 -> -2.49069636E+20 Inexact Rounded -xrem118 remainder -6291780.97 269967.394E-22000817 -> NaN Division_impossible -xsub118 subtract -6291780.97 269967.394E-22000817 -> -6291780.97 Inexact Rounded -xadd119 add 978571348.E+222382547 6006.19370 -> 9.78571348E+222382555 Inexact Rounded -xcom119 compare 978571348.E+222382547 6006.19370 -> 1 -xdiv119 divide 978571348.E+222382547 6006.19370 -> 1.62927038E+222382552 Inexact Rounded -xdvi119 divideint 978571348.E+222382547 6006.19370 -> NaN Division_impossible -xmul119 multiply 978571348.E+222382547 6006.19370 -> 5.87748907E+222382559 Inexact Rounded -xpow119 power 978571348.E+222382547 6006 -> Infinity Overflow Inexact Rounded -xrem119 remainder 978571348.E+222382547 6006.19370 -> NaN Division_impossible -xsub119 subtract 978571348.E+222382547 6006.19370 -> 9.78571348E+222382555 Inexact Rounded -xadd120 add 14239029. -36527.2221 -> 14202501.8 Inexact Rounded -xcom120 compare 14239029. -36527.2221 -> 1 -xdiv120 divide 14239029. -36527.2221 -> -389.819652 Inexact Rounded -xdvi120 divideint 14239029. -36527.2221 -> -389 -xmul120 multiply 14239029. -36527.2221 -> -5.20112175E+11 Inexact Rounded -xpow120 power 14239029. -36527 -> 6.64292731E-261296 Inexact Rounded -xrem120 remainder 14239029. -36527.2221 -> 29939.6031 -xsub120 subtract 14239029. -36527.2221 -> 14275556.2 Inexact Rounded -xadd121 add 72333.2654E-544425548 -690.664836E+662155120 -> -6.90664836E+662155122 Inexact Rounded -xcom121 compare 72333.2654E-544425548 -690.664836E+662155120 -> 1 -xdiv121 divide 72333.2654E-544425548 -690.664836E+662155120 -> -0E-1000000007 Inexact Rounded Underflow Subnormal -xdvi121 divideint 72333.2654E-544425548 -690.664836E+662155120 -> -0 -xmul121 multiply 72333.2654E-544425548 -690.664836E+662155120 -> -4.99580429E+117729579 Inexact Rounded -xpow121 power 72333.2654E-544425548 -7 -> Infinity Overflow Inexact Rounded -xrem121 remainder 72333.2654E-544425548 -690.664836E+662155120 -> 7.23332654E-544425544 -xsub121 subtract 72333.2654E-544425548 -690.664836E+662155120 -> 6.90664836E+662155122 Inexact Rounded -xadd122 add -37721.1567E-115787341 -828949864E-76251747 -> -8.28949864E-76251739 Inexact Rounded -xcom122 compare -37721.1567E-115787341 -828949864E-76251747 -> 1 -xdiv122 divide -37721.1567E-115787341 -828949864E-76251747 -> 4.55047505E-39535599 Inexact Rounded -xdvi122 divideint -37721.1567E-115787341 -828949864E-76251747 -> 0 -xmul122 multiply -37721.1567E-115787341 -828949864E-76251747 -> 3.12689477E-192039075 Inexact Rounded -xpow122 power -37721.1567E-115787341 -8 -> 2.43960765E+926298691 Inexact Rounded -xrem122 remainder -37721.1567E-115787341 -828949864E-76251747 -> -3.77211567E-115787337 -xsub122 subtract -37721.1567E-115787341 -828949864E-76251747 -> 8.28949864E-76251739 Inexact Rounded -xadd123 add -2078852.83E-647080089 -119779858.E+734665461 -> -1.19779858E+734665469 Inexact Rounded -xcom123 compare -2078852.83E-647080089 -119779858.E+734665461 -> 1 -xdiv123 divide -2078852.83E-647080089 -119779858.E+734665461 -> 0E-1000000007 Inexact Rounded Underflow Subnormal -xdvi123 divideint -2078852.83E-647080089 -119779858.E+734665461 -> 0 -xmul123 multiply -2078852.83E-647080089 -119779858.E+734665461 -> 2.49004697E+87585386 Inexact Rounded -xpow123 power -2078852.83E-647080089 -1 -> -4.81034533E+647080082 Inexact Rounded -xrem123 remainder -2078852.83E-647080089 -119779858.E+734665461 -> -2.07885283E-647080083 -xsub123 subtract -2078852.83E-647080089 -119779858.E+734665461 -> 1.19779858E+734665469 Inexact Rounded -xadd124 add -79145.3625 -7718.57307 -> -86863.9356 Inexact Rounded -xcom124 compare -79145.3625 -7718.57307 -> -1 -xdiv124 divide -79145.3625 -7718.57307 -> 10.2538852 Inexact Rounded -xdvi124 divideint -79145.3625 -7718.57307 -> 10 -xmul124 multiply -79145.3625 -7718.57307 -> 610889264 Inexact Rounded -xpow124 power -79145.3625 -7719 -> -1.13181941E-37811 Inexact Rounded -xrem124 remainder -79145.3625 -7718.57307 -> -1959.63180 -xsub124 subtract -79145.3625 -7718.57307 -> -71426.7894 Inexact Rounded -xadd125 add 2103890.49E+959247237 20024.3017 -> 2.10389049E+959247243 Inexact Rounded -xcom125 compare 2103890.49E+959247237 20024.3017 -> 1 -xdiv125 divide 2103890.49E+959247237 20024.3017 -> 1.05066859E+959247239 Inexact Rounded -xdvi125 divideint 2103890.49E+959247237 20024.3017 -> NaN Division_impossible -xmul125 multiply 2103890.49E+959247237 20024.3017 -> 4.21289379E+959247247 Inexact Rounded -xpow125 power 2103890.49E+959247237 20024 -> Infinity Overflow Inexact Rounded -xrem125 remainder 2103890.49E+959247237 20024.3017 -> NaN Division_impossible -xsub125 subtract 2103890.49E+959247237 20024.3017 -> 2.10389049E+959247243 Inexact Rounded -xadd126 add 911249557 79810804.9 -> 991060362 Inexact Rounded -xcom126 compare 911249557 79810804.9 -> 1 -xdiv126 divide 911249557 79810804.9 -> 11.4176214 Inexact Rounded -xdvi126 divideint 911249557 79810804.9 -> 11 -xmul126 multiply 911249557 79810804.9 -> 7.27275606E+16 Inexact Rounded -xpow126 power 911249557 79810805 -> 6.77595741E+715075867 Inexact Rounded -xrem126 remainder 911249557 79810804.9 -> 33330703.1 -xsub126 subtract 911249557 79810804.9 -> 831438752 Inexact Rounded -xadd127 add 341134.994 3.37486292 -> 341138.369 Inexact Rounded -xcom127 compare 341134.994 3.37486292 -> 1 -xdiv127 divide 341134.994 3.37486292 -> 101081.141 Inexact Rounded -xdvi127 divideint 341134.994 3.37486292 -> 101081 -xmul127 multiply 341134.994 3.37486292 -> 1151283.84 Inexact Rounded -xpow127 power 341134.994 3 -> 3.96989314E+16 Inexact Rounded -xrem127 remainder 341134.994 3.37486292 -> 0.47518348 -xsub127 subtract 341134.994 3.37486292 -> 341131.619 Inexact Rounded -xadd128 add 244.23634 512706190E-341459836 -> 244.236340 Inexact Rounded -xcom128 compare 244.23634 512706190E-341459836 -> 1 -xdiv128 divide 244.23634 512706190E-341459836 -> 4.76367059E+341459829 Inexact Rounded -xdvi128 divideint 244.23634 512706190E-341459836 -> NaN Division_impossible -xmul128 multiply 244.23634 512706190E-341459836 -> 1.25221483E-341459825 Inexact Rounded -xpow128 power 244.23634 5 -> 8.69063312E+11 Inexact Rounded -xrem128 remainder 244.23634 512706190E-341459836 -> NaN Division_impossible -xsub128 subtract 244.23634 512706190E-341459836 -> 244.236340 Inexact Rounded -xadd129 add -9.22783849E+171585954 -99.0946800 -> -9.22783849E+171585954 Inexact Rounded -xcom129 compare -9.22783849E+171585954 -99.0946800 -> -1 -xdiv129 divide -9.22783849E+171585954 -99.0946800 -> 9.31214318E+171585952 Inexact Rounded -xdvi129 divideint -9.22783849E+171585954 -99.0946800 -> NaN Division_impossible -xmul129 multiply -9.22783849E+171585954 -99.0946800 -> 9.14429702E+171585956 Inexact Rounded -xpow129 power -9.22783849E+171585954 -99 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem129 remainder -9.22783849E+171585954 -99.0946800 -> NaN Division_impossible -xsub129 subtract -9.22783849E+171585954 -99.0946800 -> -9.22783849E+171585954 Inexact Rounded -xadd130 add 699631.893 -226.423958 -> 699405.469 Inexact Rounded -xcom130 compare 699631.893 -226.423958 -> 1 -xdiv130 divide 699631.893 -226.423958 -> -3089.91990 Inexact Rounded -xdvi130 divideint 699631.893 -226.423958 -> -3089 -xmul130 multiply 699631.893 -226.423958 -> -158413422 Inexact Rounded -xpow130 power 699631.893 -226 -> 1.14675511E-1321 Inexact Rounded -xrem130 remainder 699631.893 -226.423958 -> 208.286738 -xsub130 subtract 699631.893 -226.423958 -> 699858.317 Inexact Rounded -xadd131 add -249350139.E-571793673 775732428. -> 775732428 Inexact Rounded -xcom131 compare -249350139.E-571793673 775732428. -> -1 -xdiv131 divide -249350139.E-571793673 775732428. -> -3.21438334E-571793674 Inexact Rounded -xdvi131 divideint -249350139.E-571793673 775732428. -> -0 -xmul131 multiply -249350139.E-571793673 775732428. -> -1.93428989E-571793656 Inexact Rounded -xpow131 power -249350139.E-571793673 775732428 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem131 remainder -249350139.E-571793673 775732428. -> -2.49350139E-571793665 -xsub131 subtract -249350139.E-571793673 775732428. -> -775732428 Inexact Rounded -xadd132 add 5.11629020 -480.53194 -> -475.415650 Inexact Rounded -xcom132 compare 5.11629020 -480.53194 -> 1 -xdiv132 divide 5.11629020 -480.53194 -> -0.0106471387 Inexact Rounded -xdvi132 divideint 5.11629020 -480.53194 -> -0 -xmul132 multiply 5.11629020 -480.53194 -> -2458.54086 Inexact Rounded -xpow132 power 5.11629020 -481 -> 9.83021951E-342 Inexact Rounded -xrem132 remainder 5.11629020 -480.53194 -> 5.11629020 -xsub132 subtract 5.11629020 -480.53194 -> 485.648230 Inexact Rounded -xadd133 add -8.23352673E-446723147 -530710.866 -> -530710.866 Inexact Rounded -xcom133 compare -8.23352673E-446723147 -530710.866 -> 1 -xdiv133 divide -8.23352673E-446723147 -530710.866 -> 1.55141476E-446723152 Inexact Rounded -xdvi133 divideint -8.23352673E-446723147 -530710.866 -> 0 -xmul133 multiply -8.23352673E-446723147 -530710.866 -> 4.36962210E-446723141 Inexact Rounded -xpow133 power -8.23352673E-446723147 -530711 -> -Infinity Overflow Inexact Rounded -xrem133 remainder -8.23352673E-446723147 -530710.866 -> -8.23352673E-446723147 -xsub133 subtract -8.23352673E-446723147 -530710.866 -> 530710.866 Inexact Rounded -xadd134 add 7.0598608 -95908.35 -> -95901.2901 Inexact Rounded -xcom134 compare 7.0598608 -95908.35 -> 1 -xdiv134 divide 7.0598608 -95908.35 -> -0.0000736104917 Inexact Rounded -xdvi134 divideint 7.0598608 -95908.35 -> -0 -xmul134 multiply 7.0598608 -95908.35 -> -677099.601 Inexact Rounded -xpow134 power 7.0598608 -95908 -> 4.57073877E-81407 Inexact Rounded -xrem134 remainder 7.0598608 -95908.35 -> 7.0598608 -xsub134 subtract 7.0598608 -95908.35 -> 95915.4099 Inexact Rounded -xadd135 add -7.91189845E+207202706 1532.71847E+509944335 -> 1.53271847E+509944338 Inexact Rounded -xcom135 compare -7.91189845E+207202706 1532.71847E+509944335 -> -1 -xdiv135 divide -7.91189845E+207202706 1532.71847E+509944335 -> -5.16200372E-302741632 Inexact Rounded -xdvi135 divideint -7.91189845E+207202706 1532.71847E+509944335 -> -0 -xmul135 multiply -7.91189845E+207202706 1532.71847E+509944335 -> -1.21267129E+717147045 Inexact Rounded -xpow135 power -7.91189845E+207202706 2 -> 6.25981371E+414405413 Inexact Rounded -xrem135 remainder -7.91189845E+207202706 1532.71847E+509944335 -> -7.91189845E+207202706 -xsub135 subtract -7.91189845E+207202706 1532.71847E+509944335 -> -1.53271847E+509944338 Inexact Rounded -xadd136 add 208839370.E-215147432 -75.9420559 -> -75.9420559 Inexact Rounded -xcom136 compare 208839370.E-215147432 -75.9420559 -> 1 -xdiv136 divide 208839370.E-215147432 -75.9420559 -> -2.74998310E-215147426 Inexact Rounded -xdvi136 divideint 208839370.E-215147432 -75.9420559 -> -0 -xmul136 multiply 208839370.E-215147432 -75.9420559 -> -1.58596911E-215147422 Inexact Rounded -xpow136 power 208839370.E-215147432 -76 -> Infinity Overflow Inexact Rounded -xrem136 remainder 208839370.E-215147432 -75.9420559 -> 2.08839370E-215147424 -xsub136 subtract 208839370.E-215147432 -75.9420559 -> 75.9420559 Inexact Rounded -xadd137 add 427.754244E-353328369 4705.0796 -> 4705.07960 Inexact Rounded -xcom137 compare 427.754244E-353328369 4705.0796 -> -1 -xdiv137 divide 427.754244E-353328369 4705.0796 -> 9.09132853E-353328371 Inexact Rounded -xdvi137 divideint 427.754244E-353328369 4705.0796 -> 0 -xmul137 multiply 427.754244E-353328369 4705.0796 -> 2.01261777E-353328363 Inexact Rounded -xpow137 power 427.754244E-353328369 4705 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem137 remainder 427.754244E-353328369 4705.0796 -> 4.27754244E-353328367 -xsub137 subtract 427.754244E-353328369 4705.0796 -> -4705.07960 Inexact Rounded -xadd138 add 44911.089 -95.1733605E-313081848 -> 44911.0890 Inexact Rounded -xcom138 compare 44911.089 -95.1733605E-313081848 -> 1 -xdiv138 divide 44911.089 -95.1733605E-313081848 -> -4.71887183E+313081850 Inexact Rounded -xdvi138 divideint 44911.089 -95.1733605E-313081848 -> NaN Division_impossible -xmul138 multiply 44911.089 -95.1733605E-313081848 -> -4.27433926E-313081842 Inexact Rounded -xpow138 power 44911.089 -10 -> 2.99546425E-47 Inexact Rounded -xrem138 remainder 44911.089 -95.1733605E-313081848 -> NaN Division_impossible -xsub138 subtract 44911.089 -95.1733605E-313081848 -> 44911.0890 Inexact Rounded -xadd139 add 452371821. -4109709.19 -> 448262112 Inexact Rounded -xcom139 compare 452371821. -4109709.19 -> 1 -xdiv139 divide 452371821. -4109709.19 -> -110.073925 Inexact Rounded -xdvi139 divideint 452371821. -4109709.19 -> -110 -xmul139 multiply 452371821. -4109709.19 -> -1.85911663E+15 Inexact Rounded -xpow139 power 452371821. -4109709 -> 1.15528807E-35571568 Inexact Rounded -xrem139 remainder 452371821. -4109709.19 -> 303810.10 -xsub139 subtract 452371821. -4109709.19 -> 456481530 Inexact Rounded -xadd140 add 94007.4392 -9467725.5E+681898234 -> -9.46772550E+681898240 Inexact Rounded -xcom140 compare 94007.4392 -9467725.5E+681898234 -> 1 -xdiv140 divide 94007.4392 -9467725.5E+681898234 -> -9.92925272E-681898237 Inexact Rounded -xdvi140 divideint 94007.4392 -9467725.5E+681898234 -> -0 -xmul140 multiply 94007.4392 -9467725.5E+681898234 -> -8.90036629E+681898245 Inexact Rounded -xpow140 power 94007.4392 -9 -> 1.74397397E-45 Inexact Rounded -xrem140 remainder 94007.4392 -9467725.5E+681898234 -> 94007.4392 -xsub140 subtract 94007.4392 -9467725.5E+681898234 -> 9.46772550E+681898240 Inexact Rounded -xadd141 add 99147554.0E-751410586 38313.6423 -> 38313.6423 Inexact Rounded -xcom141 compare 99147554.0E-751410586 38313.6423 -> -1 -xdiv141 divide 99147554.0E-751410586 38313.6423 -> 2.58778722E-751410583 Inexact Rounded -xdvi141 divideint 99147554.0E-751410586 38313.6423 -> 0 -xmul141 multiply 99147554.0E-751410586 38313.6423 -> 3.79870392E-751410574 Inexact Rounded -xpow141 power 99147554.0E-751410586 38314 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem141 remainder 99147554.0E-751410586 38313.6423 -> 9.91475540E-751410579 -xsub141 subtract 99147554.0E-751410586 38313.6423 -> -38313.6423 Inexact Rounded -xadd142 add -7919.30254 -669.607854 -> -8588.91039 Inexact Rounded -xcom142 compare -7919.30254 -669.607854 -> -1 -xdiv142 divide -7919.30254 -669.607854 -> 11.8267767 Inexact Rounded -xdvi142 divideint -7919.30254 -669.607854 -> 11 -xmul142 multiply -7919.30254 -669.607854 -> 5302827.18 Inexact Rounded -xpow142 power -7919.30254 -670 -> 7.58147724E-2613 Inexact Rounded -xrem142 remainder -7919.30254 -669.607854 -> -553.616146 -xsub142 subtract -7919.30254 -669.607854 -> -7249.69469 Inexact Rounded -xadd143 add 461.58280E+136110821 710666052.E-383754231 -> 4.61582800E+136110823 Inexact Rounded -xcom143 compare 461.58280E+136110821 710666052.E-383754231 -> 1 -xdiv143 divide 461.58280E+136110821 710666052.E-383754231 -> 6.49507316E+519865045 Inexact Rounded -xdvi143 divideint 461.58280E+136110821 710666052.E-383754231 -> NaN Division_impossible -xmul143 multiply 461.58280E+136110821 710666052.E-383754231 -> 3.28031226E-247643399 Inexact Rounded -xpow143 power 461.58280E+136110821 7 -> 4.46423781E+952775765 Inexact Rounded -xrem143 remainder 461.58280E+136110821 710666052.E-383754231 -> NaN Division_impossible -xsub143 subtract 461.58280E+136110821 710666052.E-383754231 -> 4.61582800E+136110823 Inexact Rounded -xadd144 add 3455755.47E-112465506 771.674306 -> 771.674306 Inexact Rounded -xcom144 compare 3455755.47E-112465506 771.674306 -> -1 -xdiv144 divide 3455755.47E-112465506 771.674306 -> 4.47825649E-112465503 Inexact Rounded -xdvi144 divideint 3455755.47E-112465506 771.674306 -> 0 -xmul144 multiply 3455755.47E-112465506 771.674306 -> 2.66671770E-112465497 Inexact Rounded -xpow144 power 3455755.47E-112465506 772 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem144 remainder 3455755.47E-112465506 771.674306 -> 3.45575547E-112465500 -xsub144 subtract 3455755.47E-112465506 771.674306 -> -771.674306 Inexact Rounded -xadd145 add -477067757.E-961684940 7.70122608E-741072245 -> 7.70122608E-741072245 Inexact Rounded -xcom145 compare -477067757.E-961684940 7.70122608E-741072245 -> -1 -xdiv145 divide -477067757.E-961684940 7.70122608E-741072245 -> -6.19469877E-220612688 Inexact Rounded -xdvi145 divideint -477067757.E-961684940 7.70122608E-741072245 -> -0 -xmul145 multiply -477067757.E-961684940 7.70122608E-741072245 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow145 power -477067757.E-961684940 8 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem145 remainder -477067757.E-961684940 7.70122608E-741072245 -> -4.77067757E-961684932 -xsub145 subtract -477067757.E-961684940 7.70122608E-741072245 -> -7.70122608E-741072245 Inexact Rounded -xadd146 add 76482.352 8237806.8 -> 8314289.15 Inexact Rounded -xcom146 compare 76482.352 8237806.8 -> -1 -xdiv146 divide 76482.352 8237806.8 -> 0.00928430999 Inexact Rounded -xdvi146 divideint 76482.352 8237806.8 -> 0 -xmul146 multiply 76482.352 8237806.8 -> 6.30046839E+11 Inexact Rounded -xpow146 power 76482.352 8237807 -> 8.44216559E+40229834 Inexact Rounded -xrem146 remainder 76482.352 8237806.8 -> 76482.352 -xsub146 subtract 76482.352 8237806.8 -> -8161324.45 Inexact Rounded -xadd147 add 1.21505164E-565556504 9.26146573 -> 9.26146573 Inexact Rounded -xcom147 compare 1.21505164E-565556504 9.26146573 -> -1 -xdiv147 divide 1.21505164E-565556504 9.26146573 -> 1.31194314E-565556505 Inexact Rounded -xdvi147 divideint 1.21505164E-565556504 9.26146573 -> 0 -xmul147 multiply 1.21505164E-565556504 9.26146573 -> 1.12531591E-565556503 Inexact Rounded -xpow147 power 1.21505164E-565556504 9 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem147 remainder 1.21505164E-565556504 9.26146573 -> 1.21505164E-565556504 -xsub147 subtract 1.21505164E-565556504 9.26146573 -> -9.26146573 Inexact Rounded -xadd148 add -8303060.25E-169894883 901561.985 -> 901561.985 Inexact Rounded -xcom148 compare -8303060.25E-169894883 901561.985 -> -1 -xdiv148 divide -8303060.25E-169894883 901561.985 -> -9.20963881E-169894883 Inexact Rounded -xdvi148 divideint -8303060.25E-169894883 901561.985 -> -0 -xmul148 multiply -8303060.25E-169894883 901561.985 -> -7.48572348E-169894871 Inexact Rounded -xpow148 power -8303060.25E-169894883 901562 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem148 remainder -8303060.25E-169894883 901561.985 -> -8.30306025E-169894877 -xsub148 subtract -8303060.25E-169894883 901561.985 -> -901561.985 Inexact Rounded -xadd149 add -592464.92 71445510.7 -> 70853045.8 Inexact Rounded -xcom149 compare -592464.92 71445510.7 -> -1 -xdiv149 divide -592464.92 71445510.7 -> -0.00829254231 Inexact Rounded -xdvi149 divideint -592464.92 71445510.7 -> -0 -xmul149 multiply -592464.92 71445510.7 -> -4.23289588E+13 Inexact Rounded -xpow149 power -592464.92 71445511 -> -1.58269108E+412430832 Inexact Rounded -xrem149 remainder -592464.92 71445510.7 -> -592464.92 -xsub149 subtract -592464.92 71445510.7 -> -72037975.6 Inexact Rounded -xadd150 add -73774.4165 -39.8243027 -> -73814.2408 Inexact Rounded -xcom150 compare -73774.4165 -39.8243027 -> -1 -xdiv150 divide -73774.4165 -39.8243027 -> 1852.49738 Inexact Rounded -xdvi150 divideint -73774.4165 -39.8243027 -> 1852 -xmul150 multiply -73774.4165 -39.8243027 -> 2938014.69 Inexact Rounded -xpow150 power -73774.4165 -40 -> 1.92206765E-195 Inexact Rounded -xrem150 remainder -73774.4165 -39.8243027 -> -19.8078996 -xsub150 subtract -73774.4165 -39.8243027 -> -73734.5922 Inexact Rounded -xadd151 add -524724715. -55763.7937 -> -524780479 Inexact Rounded -xcom151 compare -524724715. -55763.7937 -> -1 -xdiv151 divide -524724715. -55763.7937 -> 9409.77434 Inexact Rounded -xdvi151 divideint -524724715. -55763.7937 -> 9409 -xmul151 multiply -524724715. -55763.7937 -> 2.92606408E+13 Inexact Rounded -xpow151 power -524724715. -55764 -> 5.47898351E-486259 Inexact Rounded -xrem151 remainder -524724715. -55763.7937 -> -43180.0767 -xsub151 subtract -524724715. -55763.7937 -> -524668951 Inexact Rounded -xadd152 add 7.53800427 784873768E-9981146 -> 7.53800427 Inexact Rounded -xcom152 compare 7.53800427 784873768E-9981146 -> 1 -xdiv152 divide 7.53800427 784873768E-9981146 -> 9.60409760E+9981137 Inexact Rounded -xdvi152 divideint 7.53800427 784873768E-9981146 -> NaN Division_impossible -xmul152 multiply 7.53800427 784873768E-9981146 -> 5.91638181E-9981137 Inexact Rounded -xpow152 power 7.53800427 8 -> 10424399.2 Inexact Rounded -xrem152 remainder 7.53800427 784873768E-9981146 -> NaN Division_impossible -xsub152 subtract 7.53800427 784873768E-9981146 -> 7.53800427 Inexact Rounded -xadd153 add 37.6027452 7.22454233 -> 44.8272875 Inexact Rounded -xcom153 compare 37.6027452 7.22454233 -> 1 -xdiv153 divide 37.6027452 7.22454233 -> 5.20486191 Inexact Rounded -xdvi153 divideint 37.6027452 7.22454233 -> 5 -xmul153 multiply 37.6027452 7.22454233 -> 271.662624 Inexact Rounded -xpow153 power 37.6027452 7 -> 1.06300881E+11 Inexact Rounded -xrem153 remainder 37.6027452 7.22454233 -> 1.48003355 -xsub153 subtract 37.6027452 7.22454233 -> 30.3782029 Inexact Rounded -xadd154 add 2447660.39 -36981.4253 -> 2410678.96 Inexact Rounded -xcom154 compare 2447660.39 -36981.4253 -> 1 -xdiv154 divide 2447660.39 -36981.4253 -> -66.1862102 Inexact Rounded -xdvi154 divideint 2447660.39 -36981.4253 -> -66 -xmul154 multiply 2447660.39 -36981.4253 -> -9.05179699E+10 Inexact Rounded -xpow154 power 2447660.39 -36981 -> 3.92066064E-236263 Inexact Rounded -xrem154 remainder 2447660.39 -36981.4253 -> 6886.3202 -xsub154 subtract 2447660.39 -36981.4253 -> 2484641.82 Inexact Rounded -xadd155 add 2160.36419 1418.33574E+656265382 -> 1.41833574E+656265385 Inexact Rounded -xcom155 compare 2160.36419 1418.33574E+656265382 -> -1 -xdiv155 divide 2160.36419 1418.33574E+656265382 -> 1.52316841E-656265382 Inexact Rounded -xdvi155 divideint 2160.36419 1418.33574E+656265382 -> 0 -xmul155 multiply 2160.36419 1418.33574E+656265382 -> 3.06412174E+656265388 Inexact Rounded -xpow155 power 2160.36419 1 -> 2160.36419 -xrem155 remainder 2160.36419 1418.33574E+656265382 -> 2160.36419 -xsub155 subtract 2160.36419 1418.33574E+656265382 -> -1.41833574E+656265385 Inexact Rounded -xadd156 add 8926.44939 54.9430027 -> 8981.39239 Inexact Rounded -xcom156 compare 8926.44939 54.9430027 -> 1 -xdiv156 divide 8926.44939 54.9430027 -> 162.467447 Inexact Rounded -xdvi156 divideint 8926.44939 54.9430027 -> 162 -xmul156 multiply 8926.44939 54.9430027 -> 490445.933 Inexact Rounded -xpow156 power 8926.44939 55 -> 1.93789877E+217 Inexact Rounded -xrem156 remainder 8926.44939 54.9430027 -> 25.6829526 -xsub156 subtract 8926.44939 54.9430027 -> 8871.50639 Inexact Rounded -xadd157 add 861588029 -41657398E+77955925 -> -4.16573980E+77955932 Inexact Rounded -xcom157 compare 861588029 -41657398E+77955925 -> 1 -xdiv157 divide 861588029 -41657398E+77955925 -> -2.06827135E-77955924 Inexact Rounded -xdvi157 divideint 861588029 -41657398E+77955925 -> -0 -xmul157 multiply 861588029 -41657398E+77955925 -> -3.58915154E+77955941 Inexact Rounded -xpow157 power 861588029 -4 -> 1.81468553E-36 Inexact Rounded -xrem157 remainder 861588029 -41657398E+77955925 -> 861588029 -xsub157 subtract 861588029 -41657398E+77955925 -> 4.16573980E+77955932 Inexact Rounded -xadd158 add -34.5253062 52.6722019 -> 18.1468957 -xcom158 compare -34.5253062 52.6722019 -> -1 -xdiv158 divide -34.5253062 52.6722019 -> -0.655474899 Inexact Rounded -xdvi158 divideint -34.5253062 52.6722019 -> -0 -xmul158 multiply -34.5253062 52.6722019 -> -1818.52390 Inexact Rounded -xpow158 power -34.5253062 53 -> -3.32115821E+81 Inexact Rounded -xrem158 remainder -34.5253062 52.6722019 -> -34.5253062 -xsub158 subtract -34.5253062 52.6722019 -> -87.1975081 -xadd159 add -18861647. 99794586.7 -> 80932939.7 -xcom159 compare -18861647. 99794586.7 -> -1 -xdiv159 divide -18861647. 99794586.7 -> -0.189004711 Inexact Rounded -xdvi159 divideint -18861647. 99794586.7 -> -0 -xmul159 multiply -18861647. 99794586.7 -> -1.88229027E+15 Inexact Rounded -xpow159 power -18861647. 99794587 -> -4.28957460E+726063462 Inexact Rounded -xrem159 remainder -18861647. 99794586.7 -> -18861647.0 -xsub159 subtract -18861647. 99794586.7 -> -118656234 Inexact Rounded -xadd160 add 322192.407 461.67044 -> 322654.077 Inexact Rounded -xcom160 compare 322192.407 461.67044 -> 1 -xdiv160 divide 322192.407 461.67044 -> 697.883986 Inexact Rounded -xdvi160 divideint 322192.407 461.67044 -> 697 -xmul160 multiply 322192.407 461.67044 -> 148746710 Inexact Rounded -xpow160 power 322192.407 462 -> 5.61395873E+2544 Inexact Rounded -xrem160 remainder 322192.407 461.67044 -> 408.11032 -xsub160 subtract 322192.407 461.67044 -> 321730.737 Inexact Rounded -xadd161 add -896298518E+61412314 78873.8049 -> -8.96298518E+61412322 Inexact Rounded -xcom161 compare -896298518E+61412314 78873.8049 -> -1 -xdiv161 divide -896298518E+61412314 78873.8049 -> -1.13637033E+61412318 Inexact Rounded -xdvi161 divideint -896298518E+61412314 78873.8049 -> NaN Division_impossible -xmul161 multiply -896298518E+61412314 78873.8049 -> -7.06944744E+61412327 Inexact Rounded -xpow161 power -896298518E+61412314 78874 -> Infinity Overflow Inexact Rounded -xrem161 remainder -896298518E+61412314 78873.8049 -> NaN Division_impossible -xsub161 subtract -896298518E+61412314 78873.8049 -> -8.96298518E+61412322 Inexact Rounded -xadd162 add 293.773732 479899052E+789950177 -> 4.79899052E+789950185 Inexact Rounded -xcom162 compare 293.773732 479899052E+789950177 -> -1 -xdiv162 divide 293.773732 479899052E+789950177 -> 6.12157350E-789950184 Inexact Rounded -xdvi162 divideint 293.773732 479899052E+789950177 -> 0 -xmul162 multiply 293.773732 479899052E+789950177 -> 1.40981735E+789950188 Inexact Rounded -xpow162 power 293.773732 5 -> 2.18808809E+12 Inexact Rounded -xrem162 remainder 293.773732 479899052E+789950177 -> 293.773732 -xsub162 subtract 293.773732 479899052E+789950177 -> -4.79899052E+789950185 Inexact Rounded -xadd163 add -103519362 51897955.3 -> -51621406.7 -xcom163 compare -103519362 51897955.3 -> -1 -xdiv163 divide -103519362 51897955.3 -> -1.99467130 Inexact Rounded -xdvi163 divideint -103519362 51897955.3 -> -1 -xmul163 multiply -103519362 51897955.3 -> -5.37244322E+15 Inexact Rounded -xpow163 power -103519362 51897955 -> -4.28858229E+415963229 Inexact Rounded -xrem163 remainder -103519362 51897955.3 -> -51621406.7 -xsub163 subtract -103519362 51897955.3 -> -155417317 Inexact Rounded -xadd164 add 37380.7802 -277719788. -> -277682407 Inexact Rounded -xcom164 compare 37380.7802 -277719788. -> 1 -xdiv164 divide 37380.7802 -277719788. -> -0.000134598908 Inexact Rounded -xdvi164 divideint 37380.7802 -277719788. -> -0 -xmul164 multiply 37380.7802 -277719788. -> -1.03813824E+13 Inexact Rounded -xpow164 power 37380.7802 -277719788 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem164 remainder 37380.7802 -277719788. -> 37380.7802 -xsub164 subtract 37380.7802 -277719788. -> 277757169 Inexact Rounded -xadd165 add 320133844. -977517477 -> -657383633 -xcom165 compare 320133844. -977517477 -> 1 -xdiv165 divide 320133844. -977517477 -> -0.327496798 Inexact Rounded -xdvi165 divideint 320133844. -977517477 -> -0 -xmul165 multiply 320133844. -977517477 -> -3.12936427E+17 Inexact Rounded -xpow165 power 320133844. -977517477 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem165 remainder 320133844. -977517477 -> 320133844 -xsub165 subtract 320133844. -977517477 -> 1.29765132E+9 Inexact Rounded -xadd166 add 721776701E+933646161 -5689279.64E+669903645 -> 7.21776701E+933646169 Inexact Rounded -xcom166 compare 721776701E+933646161 -5689279.64E+669903645 -> 1 -xdiv166 divide 721776701E+933646161 -5689279.64E+669903645 -> -1.26866097E+263742518 Inexact Rounded -xdvi166 divideint 721776701E+933646161 -5689279.64E+669903645 -> NaN Division_impossible -xmul166 multiply 721776701E+933646161 -5689279.64E+669903645 -> -Infinity Inexact Overflow Rounded -xpow166 power 721776701E+933646161 -6 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem166 remainder 721776701E+933646161 -5689279.64E+669903645 -> NaN Division_impossible -xsub166 subtract 721776701E+933646161 -5689279.64E+669903645 -> 7.21776701E+933646169 Inexact Rounded -xadd167 add -5409.00482 -2.16149386 -> -5411.16631 Inexact Rounded -xcom167 compare -5409.00482 -2.16149386 -> -1 -xdiv167 divide -5409.00482 -2.16149386 -> 2502.43821 Inexact Rounded -xdvi167 divideint -5409.00482 -2.16149386 -> 2502 -xmul167 multiply -5409.00482 -2.16149386 -> 11691.5307 Inexact Rounded -xpow167 power -5409.00482 -2 -> 3.41794652E-8 Inexact Rounded -xrem167 remainder -5409.00482 -2.16149386 -> -0.94718228 -xsub167 subtract -5409.00482 -2.16149386 -> -5406.84333 Inexact Rounded -xadd168 add -957960.367 322.858170 -> -957637.509 Inexact Rounded -xcom168 compare -957960.367 322.858170 -> -1 -xdiv168 divide -957960.367 322.858170 -> -2967.12444 Inexact Rounded -xdvi168 divideint -957960.367 322.858170 -> -2967 -xmul168 multiply -957960.367 322.858170 -> -309285331 Inexact Rounded -xpow168 power -957960.367 323 -> -9.44617460E+1931 Inexact Rounded -xrem168 remainder -957960.367 322.858170 -> -40.176610 -xsub168 subtract -957960.367 322.858170 -> -958283.225 Inexact Rounded -xadd169 add -11817.8754E+613893442 -3.84735082E+888333249 -> -3.84735082E+888333249 Inexact Rounded -xcom169 compare -11817.8754E+613893442 -3.84735082E+888333249 -> 1 -xdiv169 divide -11817.8754E+613893442 -3.84735082E+888333249 -> 3.07169165E-274439804 Inexact Rounded -xdvi169 divideint -11817.8754E+613893442 -3.84735082E+888333249 -> 0 -xmul169 multiply -11817.8754E+613893442 -3.84735082E+888333249 -> Infinity Inexact Overflow Rounded -xpow169 power -11817.8754E+613893442 -4 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem169 remainder -11817.8754E+613893442 -3.84735082E+888333249 -> -1.18178754E+613893446 -xsub169 subtract -11817.8754E+613893442 -3.84735082E+888333249 -> 3.84735082E+888333249 Inexact Rounded -xadd170 add 840258203 58363.980E-906584723 -> 840258203 Inexact Rounded -xcom170 compare 840258203 58363.980E-906584723 -> 1 -xdiv170 divide 840258203 58363.980E-906584723 -> 1.43968626E+906584727 Inexact Rounded -xdvi170 divideint 840258203 58363.980E-906584723 -> NaN Division_impossible -xmul170 multiply 840258203 58363.980E-906584723 -> 4.90408130E-906584710 Inexact Rounded -xpow170 power 840258203 6 -> 3.51946431E+53 Inexact Rounded -xrem170 remainder 840258203 58363.980E-906584723 -> NaN Division_impossible -xsub170 subtract 840258203 58363.980E-906584723 -> 840258203 Inexact Rounded -xadd171 add -205842096. -191342.721 -> -206033439 Inexact Rounded -xcom171 compare -205842096. -191342.721 -> -1 -xdiv171 divide -205842096. -191342.721 -> 1075.77699 Inexact Rounded -xdvi171 divideint -205842096. -191342.721 -> 1075 -xmul171 multiply -205842096. -191342.721 -> 3.93863867E+13 Inexact Rounded -xpow171 power -205842096. -191343 -> -2.66955553E-1590737 Inexact Rounded -xrem171 remainder -205842096. -191342.721 -> -148670.925 -xsub171 subtract -205842096. -191342.721 -> -205650753 Inexact Rounded -xadd172 add 42501124. 884.938498E+123341480 -> 8.84938498E+123341482 Inexact Rounded -xcom172 compare 42501124. 884.938498E+123341480 -> -1 -xdiv172 divide 42501124. 884.938498E+123341480 -> 4.80272065E-123341476 Inexact Rounded -xdvi172 divideint 42501124. 884.938498E+123341480 -> 0 -xmul172 multiply 42501124. 884.938498E+123341480 -> 3.76108808E+123341490 Inexact Rounded -xpow172 power 42501124. 9 -> 4.52484536E+68 Inexact Rounded -xrem172 remainder 42501124. 884.938498E+123341480 -> 42501124 -xsub172 subtract 42501124. 884.938498E+123341480 -> -8.84938498E+123341482 Inexact Rounded -xadd173 add -57809452. -620380746 -> -678190198 -xcom173 compare -57809452. -620380746 -> 1 -xdiv173 divide -57809452. -620380746 -> 0.0931838268 Inexact Rounded -xdvi173 divideint -57809452. -620380746 -> 0 -xmul173 multiply -57809452. -620380746 -> 3.58638710E+16 Inexact Rounded -xpow173 power -57809452. -620380746 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem173 remainder -57809452. -620380746 -> -57809452 -xsub173 subtract -57809452. -620380746 -> 562571294 -xadd174 add -8022370.31 9858581.6 -> 1836211.29 -xcom174 compare -8022370.31 9858581.6 -> -1 -xdiv174 divide -8022370.31 9858581.6 -> -0.813744881 Inexact Rounded -xdvi174 divideint -8022370.31 9858581.6 -> -0 -xmul174 multiply -8022370.31 9858581.6 -> -7.90891923E+13 Inexact Rounded -xpow174 power -8022370.31 9858582 -> 2.34458249E+68066634 Inexact Rounded -xrem174 remainder -8022370.31 9858581.6 -> -8022370.31 -xsub174 subtract -8022370.31 9858581.6 -> -17880951.9 Inexact Rounded -xadd175 add 2.49065060E+592139141 -5432.72014E-419965357 -> 2.49065060E+592139141 Inexact Rounded -xcom175 compare 2.49065060E+592139141 -5432.72014E-419965357 -> 1 -xdiv175 divide 2.49065060E+592139141 -5432.72014E-419965357 -> -Infinity Inexact Overflow Rounded -xdvi175 divideint 2.49065060E+592139141 -5432.72014E-419965357 -> NaN Division_impossible -xmul175 multiply 2.49065060E+592139141 -5432.72014E-419965357 -> -1.35310077E+172173788 Inexact Rounded -xpow175 power 2.49065060E+592139141 -5 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem175 remainder 2.49065060E+592139141 -5432.72014E-419965357 -> NaN Division_impossible -xsub175 subtract 2.49065060E+592139141 -5432.72014E-419965357 -> 2.49065060E+592139141 Inexact Rounded -xadd176 add -697273715E-242824870 -3.81757506 -> -3.81757506 Inexact Rounded -xcom176 compare -697273715E-242824870 -3.81757506 -> 1 -xdiv176 divide -697273715E-242824870 -3.81757506 -> 1.82648331E-242824862 Inexact Rounded -xdvi176 divideint -697273715E-242824870 -3.81757506 -> 0 -xmul176 multiply -697273715E-242824870 -3.81757506 -> 2.66189474E-242824861 Inexact Rounded -xpow176 power -697273715E-242824870 -4 -> 4.23045251E+971299444 Inexact Rounded -xrem176 remainder -697273715E-242824870 -3.81757506 -> -6.97273715E-242824862 -xsub176 subtract -697273715E-242824870 -3.81757506 -> 3.81757506 Inexact Rounded -xadd177 add -7.42204403E-315716280 -8156111.67E+283261636 -> -8.15611167E+283261642 Inexact Rounded -xcom177 compare -7.42204403E-315716280 -8156111.67E+283261636 -> 1 -xdiv177 divide -7.42204403E-315716280 -8156111.67E+283261636 -> 9.09997843E-598977923 Inexact Rounded -xdvi177 divideint -7.42204403E-315716280 -8156111.67E+283261636 -> 0 -xmul177 multiply -7.42204403E-315716280 -8156111.67E+283261636 -> 6.05350199E-32454637 Inexact Rounded -xpow177 power -7.42204403E-315716280 -8 -> Infinity Overflow Inexact Rounded -xrem177 remainder -7.42204403E-315716280 -8156111.67E+283261636 -> -7.42204403E-315716280 -xsub177 subtract -7.42204403E-315716280 -8156111.67E+283261636 -> 8.15611167E+283261642 Inexact Rounded -xadd178 add 738063892 89900467.8 -> 827964360 Inexact Rounded -xcom178 compare 738063892 89900467.8 -> 1 -xdiv178 divide 738063892 89900467.8 -> 8.20978923 Inexact Rounded -xdvi178 divideint 738063892 89900467.8 -> 8 -xmul178 multiply 738063892 89900467.8 -> 6.63522892E+16 Inexact Rounded -xpow178 power 738063892 89900468 -> 1.53166723E+797245797 Inexact Rounded -xrem178 remainder 738063892 89900467.8 -> 18860149.6 -xsub178 subtract 738063892 89900467.8 -> 648163424 Inexact Rounded -xadd179 add -630309366 -884783.338E-21595410 -> -630309366 Inexact Rounded -xcom179 compare -630309366 -884783.338E-21595410 -> -1 -xdiv179 divide -630309366 -884783.338E-21595410 -> 7.12388377E+21595412 Inexact Rounded -xdvi179 divideint -630309366 -884783.338E-21595410 -> NaN Division_impossible -xmul179 multiply -630309366 -884783.338E-21595410 -> 5.57687225E-21595396 Inexact Rounded -xpow179 power -630309366 -9 -> -6.36819210E-80 Inexact Rounded -xrem179 remainder -630309366 -884783.338E-21595410 -> NaN Division_impossible -xsub179 subtract -630309366 -884783.338E-21595410 -> -630309366 Inexact Rounded -xadd180 add 613.207774 -3007.78608 -> -2394.57831 Inexact Rounded -xcom180 compare 613.207774 -3007.78608 -> 1 -xdiv180 divide 613.207774 -3007.78608 -> -0.203873466 Inexact Rounded -xdvi180 divideint 613.207774 -3007.78608 -> -0 -xmul180 multiply 613.207774 -3007.78608 -> -1844397.81 Inexact Rounded -xpow180 power 613.207774 -3008 -> 7.51939160E-8386 Inexact Rounded -xrem180 remainder 613.207774 -3007.78608 -> 613.207774 -xsub180 subtract 613.207774 -3007.78608 -> 3620.99385 Inexact Rounded -xadd181 add -93006222.3 -3.08964619 -> -93006225.4 Inexact Rounded -xcom181 compare -93006222.3 -3.08964619 -> -1 -xdiv181 divide -93006222.3 -3.08964619 -> 30102547.9 Inexact Rounded -xdvi181 divideint -93006222.3 -3.08964619 -> 30102547 -xmul181 multiply -93006222.3 -3.08964619 -> 287356320 Inexact Rounded -xpow181 power -93006222.3 -3 -> -1.24297956E-24 Inexact Rounded -xrem181 remainder -93006222.3 -3.08964619 -> -2.65215407 -xsub181 subtract -93006222.3 -3.08964619 -> -93006219.2 Inexact Rounded -xadd182 add -18116.0621 34096.306E-270347092 -> -18116.0621 Inexact Rounded -xcom182 compare -18116.0621 34096.306E-270347092 -> -1 -xdiv182 divide -18116.0621 34096.306E-270347092 -> -5.31320375E+270347091 Inexact Rounded -xdvi182 divideint -18116.0621 34096.306E-270347092 -> NaN Division_impossible -xmul182 multiply -18116.0621 34096.306E-270347092 -> -6.17690797E-270347084 Inexact Rounded -xpow182 power -18116.0621 3 -> -5.94554133E+12 Inexact Rounded -xrem182 remainder -18116.0621 34096.306E-270347092 -> NaN Division_impossible -xsub182 subtract -18116.0621 34096.306E-270347092 -> -18116.0621 Inexact Rounded -xadd183 add 19272386.9 -410442379. -> -391169992 Inexact Rounded -xcom183 compare 19272386.9 -410442379. -> 1 -xdiv183 divide 19272386.9 -410442379. -> -0.0469551584 Inexact Rounded -xdvi183 divideint 19272386.9 -410442379. -> -0 -xmul183 multiply 19272386.9 -410442379. -> -7.91020433E+15 Inexact Rounded -xpow183 power 19272386.9 -410442379 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem183 remainder 19272386.9 -410442379. -> 19272386.9 -xsub183 subtract 19272386.9 -410442379. -> 429714766 Inexact Rounded -xadd184 add 4180.30821 -1.6439543E-624759104 -> 4180.30821 Inexact Rounded -xcom184 compare 4180.30821 -1.6439543E-624759104 -> 1 -xdiv184 divide 4180.30821 -1.6439543E-624759104 -> -2.54283724E+624759107 Inexact Rounded -xdvi184 divideint 4180.30821 -1.6439543E-624759104 -> NaN Division_impossible -xmul184 multiply 4180.30821 -1.6439543E-624759104 -> -6.87223566E-624759101 Inexact Rounded -xpow184 power 4180.30821 -2 -> 5.72246828E-8 Inexact Rounded -xrem184 remainder 4180.30821 -1.6439543E-624759104 -> NaN Division_impossible -xsub184 subtract 4180.30821 -1.6439543E-624759104 -> 4180.30821 Inexact Rounded -xadd185 add 571.536725 389.899220 -> 961.435945 -xcom185 compare 571.536725 389.899220 -> 1 -xdiv185 divide 571.536725 389.899220 -> 1.46585757 Inexact Rounded -xdvi185 divideint 571.536725 389.899220 -> 1 -xmul185 multiply 571.536725 389.899220 -> 222841.723 Inexact Rounded -xpow185 power 571.536725 390 -> 1.76691373E+1075 Inexact Rounded -xrem185 remainder 571.536725 389.899220 -> 181.637505 -xsub185 subtract 571.536725 389.899220 -> 181.637505 -xadd186 add -622007306.E+159924886 -126.971745 -> -6.22007306E+159924894 Inexact Rounded -xcom186 compare -622007306.E+159924886 -126.971745 -> -1 -xdiv186 divide -622007306.E+159924886 -126.971745 -> 4.89878521E+159924892 Inexact Rounded -xdvi186 divideint -622007306.E+159924886 -126.971745 -> NaN Division_impossible -xmul186 multiply -622007306.E+159924886 -126.971745 -> 7.89773530E+159924896 Inexact Rounded -xpow186 power -622007306.E+159924886 -127 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem186 remainder -622007306.E+159924886 -126.971745 -> NaN Division_impossible -xsub186 subtract -622007306.E+159924886 -126.971745 -> -6.22007306E+159924894 Inexact Rounded -xadd187 add -29.356551E-282816139 37141748E-903397821 -> -2.93565510E-282816138 Inexact Rounded -xcom187 compare -29.356551E-282816139 37141748E-903397821 -> -1 -xdiv187 divide -29.356551E-282816139 37141748E-903397821 -> -7.90392283E+620581675 Inexact Rounded -xdvi187 divideint -29.356551E-282816139 37141748E-903397821 -> NaN Division_impossible -xmul187 multiply -29.356551E-282816139 37141748E-903397821 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow187 power -29.356551E-282816139 4 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem187 remainder -29.356551E-282816139 37141748E-903397821 -> NaN Division_impossible -xsub187 subtract -29.356551E-282816139 37141748E-903397821 -> -2.93565510E-282816138 Inexact Rounded -xadd188 add 92427442.4 674334898. -> 766762340 Inexact Rounded -xcom188 compare 92427442.4 674334898. -> -1 -xdiv188 divide 92427442.4 674334898. -> 0.137064599 Inexact Rounded -xdvi188 divideint 92427442.4 674334898. -> 0 -xmul188 multiply 92427442.4 674334898. -> 6.23270499E+16 Inexact Rounded -xpow188 power 92427442.4 674334898 -> Infinity Overflow Inexact Rounded -xrem188 remainder 92427442.4 674334898. -> 92427442.4 -xsub188 subtract 92427442.4 674334898. -> -581907456 Inexact Rounded -xadd189 add 44651895.7 -910508.438 -> 43741387.3 Inexact Rounded -xcom189 compare 44651895.7 -910508.438 -> 1 -xdiv189 divide 44651895.7 -910508.438 -> -49.0406171 Inexact Rounded -xdvi189 divideint 44651895.7 -910508.438 -> -49 -xmul189 multiply 44651895.7 -910508.438 -> -4.06559278E+13 Inexact Rounded -xpow189 power 44651895.7 -910508 -> 3.72264277E-6965241 Inexact Rounded -xrem189 remainder 44651895.7 -910508.438 -> 36982.238 -xsub189 subtract 44651895.7 -910508.438 -> 45562404.1 Inexact Rounded -xadd190 add 647897872.E+374021790 -467.423029 -> 6.47897872E+374021798 Inexact Rounded -xcom190 compare 647897872.E+374021790 -467.423029 -> 1 -xdiv190 divide 647897872.E+374021790 -467.423029 -> -1.38610601E+374021796 Inexact Rounded -xdvi190 divideint 647897872.E+374021790 -467.423029 -> NaN Division_impossible -xmul190 multiply 647897872.E+374021790 -467.423029 -> -3.02842386E+374021801 Inexact Rounded -xpow190 power 647897872.E+374021790 -467 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem190 remainder 647897872.E+374021790 -467.423029 -> NaN Division_impossible -xsub190 subtract 647897872.E+374021790 -467.423029 -> 6.47897872E+374021798 Inexact Rounded -xadd191 add 25.2592149 59.0436981 -> 84.3029130 -xcom191 compare 25.2592149 59.0436981 -> -1 -xdiv191 divide 25.2592149 59.0436981 -> 0.427805434 Inexact Rounded -xdvi191 divideint 25.2592149 59.0436981 -> 0 -xmul191 multiply 25.2592149 59.0436981 -> 1491.39746 Inexact Rounded -xpow191 power 25.2592149 59 -> 5.53058435E+82 Inexact Rounded -xrem191 remainder 25.2592149 59.0436981 -> 25.2592149 -xsub191 subtract 25.2592149 59.0436981 -> -33.7844832 -xadd192 add -6.850835 -1273.48240 -> -1280.33324 Inexact Rounded -xcom192 compare -6.850835 -1273.48240 -> 1 -xdiv192 divide -6.850835 -1273.48240 -> 0.00537960713 Inexact Rounded -xdvi192 divideint -6.850835 -1273.48240 -> 0 -xmul192 multiply -6.850835 -1273.48240 -> 8724.41780 Inexact Rounded -xpow192 power -6.850835 -1273 -> -1.25462678E-1064 Inexact Rounded -xrem192 remainder -6.850835 -1273.48240 -> -6.850835 -xsub192 subtract -6.850835 -1273.48240 -> 1266.63157 Inexact Rounded -xadd193 add 174.272325 5638.16229 -> 5812.43462 Inexact Rounded -xcom193 compare 174.272325 5638.16229 -> -1 -xdiv193 divide 174.272325 5638.16229 -> 0.0309094198 Inexact Rounded -xdvi193 divideint 174.272325 5638.16229 -> 0 -xmul193 multiply 174.272325 5638.16229 -> 982575.651 Inexact Rounded -xpow193 power 174.272325 5638 -> 1.11137724E+12636 Inexact Rounded -xrem193 remainder 174.272325 5638.16229 -> 174.272325 -xsub193 subtract 174.272325 5638.16229 -> -5463.88997 Inexact Rounded -xadd194 add 3455629.76 -8.27332322 -> 3455621.49 Inexact Rounded -xcom194 compare 3455629.76 -8.27332322 -> 1 -xdiv194 divide 3455629.76 -8.27332322 -> -417683.399 Inexact Rounded -xdvi194 divideint 3455629.76 -8.27332322 -> -417683 -xmul194 multiply 3455629.76 -8.27332322 -> -28589541.9 Inexact Rounded -xpow194 power 3455629.76 -8 -> 4.91793015E-53 Inexact Rounded -xrem194 remainder 3455629.76 -8.27332322 -> 3.29750074 -xsub194 subtract 3455629.76 -8.27332322 -> 3455638.03 Inexact Rounded -xadd195 add -924337723E-640771235 86639377.1 -> 86639377.1 Inexact Rounded -xcom195 compare -924337723E-640771235 86639377.1 -> -1 -xdiv195 divide -924337723E-640771235 86639377.1 -> -1.06687947E-640771234 Inexact Rounded -xdvi195 divideint -924337723E-640771235 86639377.1 -> -0 -xmul195 multiply -924337723E-640771235 86639377.1 -> -8.00840446E-640771219 Inexact Rounded -xpow195 power -924337723E-640771235 86639377 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem195 remainder -924337723E-640771235 86639377.1 -> -9.24337723E-640771227 -xsub195 subtract -924337723E-640771235 86639377.1 -> -86639377.1 Inexact Rounded -xadd196 add -620236932.E+656823969 3364722.73 -> -6.20236932E+656823977 Inexact Rounded -xcom196 compare -620236932.E+656823969 3364722.73 -> -1 -xdiv196 divide -620236932.E+656823969 3364722.73 -> -1.84335228E+656823971 Inexact Rounded -xdvi196 divideint -620236932.E+656823969 3364722.73 -> NaN Division_impossible -xmul196 multiply -620236932.E+656823969 3364722.73 -> -2.08692530E+656823984 Inexact Rounded -xpow196 power -620236932.E+656823969 3364723 -> -Infinity Overflow Inexact Rounded -xrem196 remainder -620236932.E+656823969 3364722.73 -> NaN Division_impossible -xsub196 subtract -620236932.E+656823969 3364722.73 -> -6.20236932E+656823977 Inexact Rounded -xadd197 add 9.10025079 702777882E-8192234 -> 9.10025079 Inexact Rounded -xcom197 compare 9.10025079 702777882E-8192234 -> 1 -xdiv197 divide 9.10025079 702777882E-8192234 -> 1.29489715E+8192226 Inexact Rounded -xdvi197 divideint 9.10025079 702777882E-8192234 -> NaN Division_impossible -xmul197 multiply 9.10025079 702777882E-8192234 -> 6.39545498E-8192225 Inexact Rounded -xpow197 power 9.10025079 7 -> 5168607.19 Inexact Rounded -xrem197 remainder 9.10025079 702777882E-8192234 -> NaN Division_impossible -xsub197 subtract 9.10025079 702777882E-8192234 -> 9.10025079 Inexact Rounded -xadd198 add -18857539.9 813013129. -> 794155589 Inexact Rounded -xcom198 compare -18857539.9 813013129. -> -1 -xdiv198 divide -18857539.9 813013129. -> -0.0231946315 Inexact Rounded -xdvi198 divideint -18857539.9 813013129. -> -0 -xmul198 multiply -18857539.9 813013129. -> -1.53314275E+16 Inexact Rounded -xpow198 power -18857539.9 813013129 -> -Infinity Overflow Inexact Rounded -xrem198 remainder -18857539.9 813013129. -> -18857539.9 -xsub198 subtract -18857539.9 813013129. -> -831870669 Inexact Rounded -xadd199 add -8.29530327 3243419.57E+35688332 -> 3.24341957E+35688338 Inexact Rounded -xcom199 compare -8.29530327 3243419.57E+35688332 -> -1 -xdiv199 divide -8.29530327 3243419.57E+35688332 -> -2.55757946E-35688338 Inexact Rounded -xdvi199 divideint -8.29530327 3243419.57E+35688332 -> -0 -xmul199 multiply -8.29530327 3243419.57E+35688332 -> -2.69051490E+35688339 Inexact Rounded -xpow199 power -8.29530327 3 -> -570.816876 Inexact Rounded -xrem199 remainder -8.29530327 3243419.57E+35688332 -> -8.29530327 -xsub199 subtract -8.29530327 3243419.57E+35688332 -> -3.24341957E+35688338 Inexact Rounded -xadd200 add -57101683.5 763551341E+991491712 -> 7.63551341E+991491720 Inexact Rounded -xcom200 compare -57101683.5 763551341E+991491712 -> -1 -xdiv200 divide -57101683.5 763551341E+991491712 -> -7.47843405E-991491714 Inexact Rounded -xdvi200 divideint -57101683.5 763551341E+991491712 -> -0 -xmul200 multiply -57101683.5 763551341E+991491712 -> -4.36000670E+991491728 Inexact Rounded -xpow200 power -57101683.5 8 -> 1.13029368E+62 Inexact Rounded -xrem200 remainder -57101683.5 763551341E+991491712 -> -57101683.5 -xsub200 subtract -57101683.5 763551341E+991491712 -> -7.63551341E+991491720 Inexact Rounded -xadd201 add -603326.740 1710.95183 -> -601615.788 Inexact Rounded -xcom201 compare -603326.740 1710.95183 -> -1 -xdiv201 divide -603326.740 1710.95183 -> -352.626374 Inexact Rounded -xdvi201 divideint -603326.740 1710.95183 -> -352 -xmul201 multiply -603326.740 1710.95183 -> -1.03226299E+9 Inexact Rounded -xpow201 power -603326.740 1711 -> -3.35315976E+9890 Inexact Rounded -xrem201 remainder -603326.740 1710.95183 -> -1071.69584 -xsub201 subtract -603326.740 1710.95183 -> -605037.692 Inexact Rounded -xadd202 add -48142763.3 -943434114 -> -991576877 Inexact Rounded -xcom202 compare -48142763.3 -943434114 -> 1 -xdiv202 divide -48142763.3 -943434114 -> 0.0510292797 Inexact Rounded -xdvi202 divideint -48142763.3 -943434114 -> 0 -xmul202 multiply -48142763.3 -943434114 -> 4.54195252E+16 Inexact Rounded -xpow202 power -48142763.3 -943434114 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem202 remainder -48142763.3 -943434114 -> -48142763.3 -xsub202 subtract -48142763.3 -943434114 -> 895291351 Inexact Rounded -xadd203 add -204.586767 -235.531847 -> -440.118614 -xcom203 compare -204.586767 -235.531847 -> 1 -xdiv203 divide -204.586767 -235.531847 -> 0.868616154 Inexact Rounded -xdvi203 divideint -204.586767 -235.531847 -> 0 -xmul203 multiply -204.586767 -235.531847 -> 48186.6991 Inexact Rounded -xpow203 power -204.586767 -236 -> 4.29438222E-546 Inexact Rounded -xrem203 remainder -204.586767 -235.531847 -> -204.586767 -xsub203 subtract -204.586767 -235.531847 -> 30.945080 -xadd204 add -70.3805581 830137.913 -> 830067.532 Inexact Rounded -xcom204 compare -70.3805581 830137.913 -> -1 -xdiv204 divide -70.3805581 830137.913 -> -0.0000847817658 Inexact Rounded -xdvi204 divideint -70.3805581 830137.913 -> -0 -xmul204 multiply -70.3805581 830137.913 -> -58425569.6 Inexact Rounded -xpow204 power -70.3805581 830138 -> 4.95165841E+1533640 Inexact Rounded -xrem204 remainder -70.3805581 830137.913 -> -70.3805581 -xsub204 subtract -70.3805581 830137.913 -> -830208.294 Inexact Rounded -xadd205 add -8818.47606 -60766.4571 -> -69584.9332 Inexact Rounded -xcom205 compare -8818.47606 -60766.4571 -> 1 -xdiv205 divide -8818.47606 -60766.4571 -> 0.145120787 Inexact Rounded -xdvi205 divideint -8818.47606 -60766.4571 -> 0 -xmul205 multiply -8818.47606 -60766.4571 -> 535867547 Inexact Rounded -xpow205 power -8818.47606 -60766 -> 1.64487755E-239746 Inexact Rounded -xrem205 remainder -8818.47606 -60766.4571 -> -8818.47606 -xsub205 subtract -8818.47606 -60766.4571 -> 51947.9810 Inexact Rounded -xadd206 add 37060929.3E-168439509 -79576717.1 -> -79576717.1 Inexact Rounded -xcom206 compare 37060929.3E-168439509 -79576717.1 -> 1 -xdiv206 divide 37060929.3E-168439509 -79576717.1 -> -4.65725788E-168439510 Inexact Rounded -xdvi206 divideint 37060929.3E-168439509 -79576717.1 -> -0 -xmul206 multiply 37060929.3E-168439509 -79576717.1 -> -2.94918709E-168439494 Inexact Rounded -xpow206 power 37060929.3E-168439509 -79576717 -> Infinity Overflow Inexact Rounded -xrem206 remainder 37060929.3E-168439509 -79576717.1 -> 3.70609293E-168439502 -xsub206 subtract 37060929.3E-168439509 -79576717.1 -> 79576717.1 Inexact Rounded -xadd207 add -656285310. -107221462. -> -763506772 -xcom207 compare -656285310. -107221462. -> -1 -xdiv207 divide -656285310. -107221462. -> 6.12083904 Inexact Rounded -xdvi207 divideint -656285310. -107221462. -> 6 -xmul207 multiply -656285310. -107221462. -> 7.03678704E+16 Inexact Rounded -xpow207 power -656285310. -107221462 -> 8.05338080E-945381569 Inexact Rounded -xrem207 remainder -656285310. -107221462. -> -12956538 -xsub207 subtract -656285310. -107221462. -> -549063848 -xadd208 add 653397.125 7195.30990 -> 660592.435 Inexact Rounded -xcom208 compare 653397.125 7195.30990 -> 1 -xdiv208 divide 653397.125 7195.30990 -> 90.8087538 Inexact Rounded -xdvi208 divideint 653397.125 7195.30990 -> 90 -xmul208 multiply 653397.125 7195.30990 -> 4.70139480E+9 Inexact Rounded -xpow208 power 653397.125 7195 -> 1.58522983E+41840 Inexact Rounded -xrem208 remainder 653397.125 7195.30990 -> 5819.23400 -xsub208 subtract 653397.125 7195.30990 -> 646201.815 Inexact Rounded -xadd209 add 56221910.0E+857909374 -58.7247929 -> 5.62219100E+857909381 Inexact Rounded -xcom209 compare 56221910.0E+857909374 -58.7247929 -> 1 -xdiv209 divide 56221910.0E+857909374 -58.7247929 -> -9.57379451E+857909379 Inexact Rounded -xdvi209 divideint 56221910.0E+857909374 -58.7247929 -> NaN Division_impossible -xmul209 multiply 56221910.0E+857909374 -58.7247929 -> -3.30162002E+857909383 Inexact Rounded -xpow209 power 56221910.0E+857909374 -59 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem209 remainder 56221910.0E+857909374 -58.7247929 -> NaN Division_impossible -xsub209 subtract 56221910.0E+857909374 -58.7247929 -> 5.62219100E+857909381 Inexact Rounded -xadd210 add 809862859E+643769974 -5.06784016 -> 8.09862859E+643769982 Inexact Rounded -xcom210 compare 809862859E+643769974 -5.06784016 -> 1 -xdiv210 divide 809862859E+643769974 -5.06784016 -> -1.59804341E+643769982 Inexact Rounded -xdvi210 divideint 809862859E+643769974 -5.06784016 -> NaN Division_impossible -xmul210 multiply 809862859E+643769974 -5.06784016 -> -4.10425552E+643769983 Inexact Rounded -xpow210 power 809862859E+643769974 -5 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem210 remainder 809862859E+643769974 -5.06784016 -> NaN Division_impossible -xsub210 subtract 809862859E+643769974 -5.06784016 -> 8.09862859E+643769982 Inexact Rounded -xadd211 add -62011.4563E-117563240 -57.1731586E+115657204 -> -5.71731586E+115657205 Inexact Rounded -xcom211 compare -62011.4563E-117563240 -57.1731586E+115657204 -> 1 -xdiv211 divide -62011.4563E-117563240 -57.1731586E+115657204 -> 1.08462534E-233220441 Inexact Rounded -xdvi211 divideint -62011.4563E-117563240 -57.1731586E+115657204 -> 0 -xmul211 multiply -62011.4563E-117563240 -57.1731586E+115657204 -> 3.54539083E-1906030 Inexact Rounded -xpow211 power -62011.4563E-117563240 -6 -> 1.75860546E+705379411 Inexact Rounded -xrem211 remainder -62011.4563E-117563240 -57.1731586E+115657204 -> -6.20114563E-117563236 -xsub211 subtract -62011.4563E-117563240 -57.1731586E+115657204 -> 5.71731586E+115657205 Inexact Rounded -xadd212 add 315.33351 91588.837E-536020149 -> 315.333510 Inexact Rounded -xcom212 compare 315.33351 91588.837E-536020149 -> 1 -xdiv212 divide 315.33351 91588.837E-536020149 -> 3.44292515E+536020146 Inexact Rounded -xdvi212 divideint 315.33351 91588.837E-536020149 -> NaN Division_impossible -xmul212 multiply 315.33351 91588.837E-536020149 -> 2.88810294E-536020142 Inexact Rounded -xpow212 power 315.33351 9 -> 3.08269902E+22 Inexact Rounded -xrem212 remainder 315.33351 91588.837E-536020149 -> NaN Division_impossible -xsub212 subtract 315.33351 91588.837E-536020149 -> 315.333510 Inexact Rounded -xadd213 add 739.944710 202949.175 -> 203689.120 Inexact Rounded -xcom213 compare 739.944710 202949.175 -> -1 -xdiv213 divide 739.944710 202949.175 -> 0.00364596067 Inexact Rounded -xdvi213 divideint 739.944710 202949.175 -> 0 -xmul213 multiply 739.944710 202949.175 -> 150171168 Inexact Rounded -xpow213 power 739.944710 202949 -> 1.32611729E+582301 Inexact Rounded -xrem213 remainder 739.944710 202949.175 -> 739.944710 -xsub213 subtract 739.944710 202949.175 -> -202209.230 Inexact Rounded -xadd214 add 87686.8016 4204890.40 -> 4292577.20 Inexact Rounded -xcom214 compare 87686.8016 4204890.40 -> -1 -xdiv214 divide 87686.8016 4204890.40 -> 0.0208535285 Inexact Rounded -xdvi214 divideint 87686.8016 4204890.40 -> 0 -xmul214 multiply 87686.8016 4204890.40 -> 3.68713390E+11 Inexact Rounded -xpow214 power 87686.8016 4204890 -> 5.14846981E+20784494 Inexact Rounded -xrem214 remainder 87686.8016 4204890.40 -> 87686.8016 -xsub214 subtract 87686.8016 4204890.40 -> -4117203.60 Inexact Rounded -xadd215 add 987126721.E-725794834 4874166.23 -> 4874166.23 Inexact Rounded -xcom215 compare 987126721.E-725794834 4874166.23 -> -1 -xdiv215 divide 987126721.E-725794834 4874166.23 -> 2.02522170E-725794832 Inexact Rounded -xdvi215 divideint 987126721.E-725794834 4874166.23 -> 0 -xmul215 multiply 987126721.E-725794834 4874166.23 -> 4.81141973E-725794819 Inexact Rounded -xpow215 power 987126721.E-725794834 4874166 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem215 remainder 987126721.E-725794834 4874166.23 -> 9.87126721E-725794826 -xsub215 subtract 987126721.E-725794834 4874166.23 -> -4874166.23 Inexact Rounded -xadd216 add 728148726.E-661695938 32798.5202 -> 32798.5202 Inexact Rounded -xcom216 compare 728148726.E-661695938 32798.5202 -> -1 -xdiv216 divide 728148726.E-661695938 32798.5202 -> 2.22006579E-661695934 Inexact Rounded -xdvi216 divideint 728148726.E-661695938 32798.5202 -> 0 -xmul216 multiply 728148726.E-661695938 32798.5202 -> 2.38822007E-661695925 Inexact Rounded -xpow216 power 728148726.E-661695938 32799 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem216 remainder 728148726.E-661695938 32798.5202 -> 7.28148726E-661695930 -xsub216 subtract 728148726.E-661695938 32798.5202 -> -32798.5202 Inexact Rounded -xadd217 add 7428219.97 667.326760 -> 7428887.30 Inexact Rounded -xcom217 compare 7428219.97 667.326760 -> 1 -xdiv217 divide 7428219.97 667.326760 -> 11131.3084 Inexact Rounded -xdvi217 divideint 7428219.97 667.326760 -> 11131 -xmul217 multiply 7428219.97 667.326760 -> 4.95704997E+9 Inexact Rounded -xpow217 power 7428219.97 667 -> 7.58808510E+4582 Inexact Rounded -xrem217 remainder 7428219.97 667.326760 -> 205.804440 -xsub217 subtract 7428219.97 667.326760 -> 7427552.64 Inexact Rounded -xadd218 add -7291.19212 209.64966E-588526476 -> -7291.19212 Inexact Rounded -xcom218 compare -7291.19212 209.64966E-588526476 -> -1 -xdiv218 divide -7291.19212 209.64966E-588526476 -> -3.47779821E+588526477 Inexact Rounded -xdvi218 divideint -7291.19212 209.64966E-588526476 -> NaN Division_impossible -xmul218 multiply -7291.19212 209.64966E-588526476 -> -1.52859595E-588526470 Inexact Rounded -xpow218 power -7291.19212 2 -> 53161482.5 Inexact Rounded -xrem218 remainder -7291.19212 209.64966E-588526476 -> NaN Division_impossible -xsub218 subtract -7291.19212 209.64966E-588526476 -> -7291.19212 Inexact Rounded -xadd219 add -358.24550 -4447.78675E+601402509 -> -4.44778675E+601402512 Inexact Rounded -xcom219 compare -358.24550 -4447.78675E+601402509 -> 1 -xdiv219 divide -358.24550 -4447.78675E+601402509 -> 8.05446664E-601402511 Inexact Rounded -xdvi219 divideint -358.24550 -4447.78675E+601402509 -> 0 -xmul219 multiply -358.24550 -4447.78675E+601402509 -> 1.59339959E+601402515 Inexact Rounded -xpow219 power -358.24550 -4 -> 6.07123474E-11 Inexact Rounded -xrem219 remainder -358.24550 -4447.78675E+601402509 -> -358.24550 -xsub219 subtract -358.24550 -4447.78675E+601402509 -> 4.44778675E+601402512 Inexact Rounded -xadd220 add 118.621826 -2.72010038 -> 115.901726 Inexact Rounded -xcom220 compare 118.621826 -2.72010038 -> 1 -xdiv220 divide 118.621826 -2.72010038 -> -43.6093561 Inexact Rounded -xdvi220 divideint 118.621826 -2.72010038 -> -43 -xmul220 multiply 118.621826 -2.72010038 -> -322.663274 Inexact Rounded -xpow220 power 118.621826 -3 -> 5.99109471E-7 Inexact Rounded -xrem220 remainder 118.621826 -2.72010038 -> 1.65750966 -xsub220 subtract 118.621826 -2.72010038 -> 121.341926 Inexact Rounded -xadd221 add 8071961.94 -135533740.E-102451543 -> 8071961.94 Inexact Rounded -xcom221 compare 8071961.94 -135533740.E-102451543 -> 1 -xdiv221 divide 8071961.94 -135533740.E-102451543 -> -5.95568450E+102451541 Inexact Rounded -xdvi221 divideint 8071961.94 -135533740.E-102451543 -> NaN Division_impossible -xmul221 multiply 8071961.94 -135533740.E-102451543 -> -1.09402319E-102451528 Inexact Rounded -xpow221 power 8071961.94 -1 -> 1.23885619E-7 Inexact Rounded -xrem221 remainder 8071961.94 -135533740.E-102451543 -> NaN Division_impossible -xsub221 subtract 8071961.94 -135533740.E-102451543 -> 8071961.94 Inexact Rounded -xadd222 add 64262528.5E+812118682 -8692.94447E-732186947 -> 6.42625285E+812118689 Inexact Rounded -xcom222 compare 64262528.5E+812118682 -8692.94447E-732186947 -> 1 -xdiv222 divide 64262528.5E+812118682 -8692.94447E-732186947 -> -Infinity Inexact Overflow Rounded -xdvi222 divideint 64262528.5E+812118682 -8692.94447E-732186947 -> NaN Division_impossible -xmul222 multiply 64262528.5E+812118682 -8692.94447E-732186947 -> -5.58630592E+79931746 Inexact Rounded -xpow222 power 64262528.5E+812118682 -9 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem222 remainder 64262528.5E+812118682 -8692.94447E-732186947 -> NaN Division_impossible -xsub222 subtract 64262528.5E+812118682 -8692.94447E-732186947 -> 6.42625285E+812118689 Inexact Rounded -xadd223 add -35544.4029 -567830.130 -> -603374.533 Inexact Rounded -xcom223 compare -35544.4029 -567830.130 -> 1 -xdiv223 divide -35544.4029 -567830.130 -> 0.0625968948 Inexact Rounded -xdvi223 divideint -35544.4029 -567830.130 -> 0 -xmul223 multiply -35544.4029 -567830.130 -> 2.01831829E+10 Inexact Rounded -xpow223 power -35544.4029 -567830 -> 3.77069368E-2584065 Inexact Rounded -xrem223 remainder -35544.4029 -567830.130 -> -35544.4029 -xsub223 subtract -35544.4029 -567830.130 -> 532285.727 Inexact Rounded -xadd224 add -7.16513047E+59297103 87767.8211 -> -7.16513047E+59297103 Inexact Rounded -xcom224 compare -7.16513047E+59297103 87767.8211 -> -1 -xdiv224 divide -7.16513047E+59297103 87767.8211 -> -8.16373288E+59297098 Inexact Rounded -xdvi224 divideint -7.16513047E+59297103 87767.8211 -> NaN Division_impossible -xmul224 multiply -7.16513047E+59297103 87767.8211 -> -6.28867889E+59297108 Inexact Rounded -xpow224 power -7.16513047E+59297103 87768 -> Infinity Overflow Inexact Rounded -xrem224 remainder -7.16513047E+59297103 87767.8211 -> NaN Division_impossible -xsub224 subtract -7.16513047E+59297103 87767.8211 -> -7.16513047E+59297103 Inexact Rounded -xadd225 add -509.483395 -147242915. -> -147243424 Inexact Rounded -xcom225 compare -509.483395 -147242915. -> 1 -xdiv225 divide -509.483395 -147242915. -> 0.00000346015559 Inexact Rounded -xdvi225 divideint -509.483395 -147242915. -> 0 -xmul225 multiply -509.483395 -147242915. -> 7.50178202E+10 Inexact Rounded -xpow225 power -509.483395 -147242915 -> -3.10760519E-398605718 Inexact Rounded -xrem225 remainder -509.483395 -147242915. -> -509.483395 -xsub225 subtract -509.483395 -147242915. -> 147242406 Inexact Rounded -xadd226 add -7919047.28E+956041629 -367667329 -> -7.91904728E+956041635 Inexact Rounded -xcom226 compare -7919047.28E+956041629 -367667329 -> -1 -xdiv226 divide -7919047.28E+956041629 -367667329 -> 2.15386211E+956041627 Inexact Rounded -xdvi226 divideint -7919047.28E+956041629 -367667329 -> NaN Division_impossible -xmul226 multiply -7919047.28E+956041629 -367667329 -> 2.91157496E+956041644 Inexact Rounded -xpow226 power -7919047.28E+956041629 -367667329 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem226 remainder -7919047.28E+956041629 -367667329 -> NaN Division_impossible -xsub226 subtract -7919047.28E+956041629 -367667329 -> -7.91904728E+956041635 Inexact Rounded -xadd227 add 895612630. -36.4104040 -> 895612594 Inexact Rounded -xcom227 compare 895612630. -36.4104040 -> 1 -xdiv227 divide 895612630. -36.4104040 -> -24597712.0 Inexact Rounded -xdvi227 divideint 895612630. -36.4104040 -> -24597711 -xmul227 multiply 895612630. -36.4104040 -> -3.26096177E+10 Inexact Rounded -xpow227 power 895612630. -36 -> 5.29264130E-323 Inexact Rounded -xrem227 remainder 895612630. -36.4104040 -> 35.0147560 -xsub227 subtract 895612630. -36.4104040 -> 895612666 Inexact Rounded -xadd228 add 25455.4973 2955.00006E+528196218 -> 2.95500006E+528196221 Inexact Rounded -xcom228 compare 25455.4973 2955.00006E+528196218 -> -1 -xdiv228 divide 25455.4973 2955.00006E+528196218 -> 8.61438131E-528196218 Inexact Rounded -xdvi228 divideint 25455.4973 2955.00006E+528196218 -> 0 -xmul228 multiply 25455.4973 2955.00006E+528196218 -> 7.52209960E+528196225 Inexact Rounded -xpow228 power 25455.4973 3 -> 1.64947128E+13 Inexact Rounded -xrem228 remainder 25455.4973 2955.00006E+528196218 -> 25455.4973 -xsub228 subtract 25455.4973 2955.00006E+528196218 -> -2.95500006E+528196221 Inexact Rounded -xadd229 add -112.294144E+273414172 -71448007.7 -> -1.12294144E+273414174 Inexact Rounded -xcom229 compare -112.294144E+273414172 -71448007.7 -> -1 -xdiv229 divide -112.294144E+273414172 -71448007.7 -> 1.57169035E+273414166 Inexact Rounded -xdvi229 divideint -112.294144E+273414172 -71448007.7 -> NaN Division_impossible -xmul229 multiply -112.294144E+273414172 -71448007.7 -> 8.02319287E+273414181 Inexact Rounded -xpow229 power -112.294144E+273414172 -71448008 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem229 remainder -112.294144E+273414172 -71448007.7 -> NaN Division_impossible -xsub229 subtract -112.294144E+273414172 -71448007.7 -> -1.12294144E+273414174 Inexact Rounded -xadd230 add 62871.2202 2484.0382E+211662557 -> 2.48403820E+211662560 Inexact Rounded -xcom230 compare 62871.2202 2484.0382E+211662557 -> -1 -xdiv230 divide 62871.2202 2484.0382E+211662557 -> 2.53100859E-211662556 Inexact Rounded -xdvi230 divideint 62871.2202 2484.0382E+211662557 -> 0 -xmul230 multiply 62871.2202 2484.0382E+211662557 -> 1.56174513E+211662565 Inexact Rounded -xpow230 power 62871.2202 2 -> 3.95279033E+9 Inexact Rounded -xrem230 remainder 62871.2202 2484.0382E+211662557 -> 62871.2202 -xsub230 subtract 62871.2202 2484.0382E+211662557 -> -2.48403820E+211662560 Inexact Rounded -xadd231 add 71.9281575 -9810012.5 -> -9809940.57 Inexact Rounded -xcom231 compare 71.9281575 -9810012.5 -> 1 -xdiv231 divide 71.9281575 -9810012.5 -> -0.00000733211680 Inexact Rounded -xdvi231 divideint 71.9281575 -9810012.5 -> -0 -xmul231 multiply 71.9281575 -9810012.5 -> -705616124 Inexact Rounded -xpow231 power 71.9281575 -9810013 -> 2.00363798E-18216203 Inexact Rounded -xrem231 remainder 71.9281575 -9810012.5 -> 71.9281575 -xsub231 subtract 71.9281575 -9810012.5 -> 9810084.43 Inexact Rounded -xadd232 add -6388022. -88.042967 -> -6388110.04 Inexact Rounded -xcom232 compare -6388022. -88.042967 -> -1 -xdiv232 divide -6388022. -88.042967 -> 72555.7329 Inexact Rounded -xdvi232 divideint -6388022. -88.042967 -> 72555 -xmul232 multiply -6388022. -88.042967 -> 562420410 Inexact Rounded -xpow232 power -6388022. -88 -> 1.34201238E-599 Inexact Rounded -xrem232 remainder -6388022. -88.042967 -> -64.529315 -xsub232 subtract -6388022. -88.042967 -> -6387933.96 Inexact Rounded -xadd233 add 372567445. 96.0992141 -> 372567541 Inexact Rounded -xcom233 compare 372567445. 96.0992141 -> 1 -xdiv233 divide 372567445. 96.0992141 -> 3876904.18 Inexact Rounded -xdvi233 divideint 372567445. 96.0992141 -> 3876904 -xmul233 multiply 372567445. 96.0992141 -> 3.58034387E+10 Inexact Rounded -xpow233 power 372567445. 96 -> 6.84968715E+822 Inexact Rounded -xrem233 remainder 372567445. 96.0992141 -> 17.4588536 -xsub233 subtract 372567445. 96.0992141 -> 372567349 Inexact Rounded -xadd234 add 802.156517 -174409310.E-255338020 -> 802.156517 Inexact Rounded -xcom234 compare 802.156517 -174409310.E-255338020 -> 1 -xdiv234 divide 802.156517 -174409310.E-255338020 -> -4.59927579E+255338014 Inexact Rounded -xdvi234 divideint 802.156517 -174409310.E-255338020 -> NaN Division_impossible -xmul234 multiply 802.156517 -174409310.E-255338020 -> -1.39903565E-255338009 Inexact Rounded -xpow234 power 802.156517 -2 -> 0.00000155411005 Inexact Rounded -xrem234 remainder 802.156517 -174409310.E-255338020 -> NaN Division_impossible -xsub234 subtract 802.156517 -174409310.E-255338020 -> 802.156517 Inexact Rounded -xadd235 add -3.65207541 74501982.0 -> 74501978.3 Inexact Rounded -xcom235 compare -3.65207541 74501982.0 -> -1 -xdiv235 divide -3.65207541 74501982.0 -> -4.90198423E-8 Inexact Rounded -xdvi235 divideint -3.65207541 74501982.0 -> -0 -xmul235 multiply -3.65207541 74501982.0 -> -272086856 Inexact Rounded -xpow235 power -3.65207541 74501982 -> 2.10339452E+41910325 Inexact Rounded -xrem235 remainder -3.65207541 74501982.0 -> -3.65207541 -xsub235 subtract -3.65207541 74501982.0 -> -74501985.7 Inexact Rounded -xadd236 add -5297.76981 -859.719404 -> -6157.48921 Inexact Rounded -xcom236 compare -5297.76981 -859.719404 -> -1 -xdiv236 divide -5297.76981 -859.719404 -> 6.16220802 Inexact Rounded -xdvi236 divideint -5297.76981 -859.719404 -> 6 -xmul236 multiply -5297.76981 -859.719404 -> 4554595.50 Inexact Rounded -xpow236 power -5297.76981 -860 -> 1.90523108E-3203 Inexact Rounded -xrem236 remainder -5297.76981 -859.719404 -> -139.453386 -xsub236 subtract -5297.76981 -859.719404 -> -4438.05041 Inexact Rounded -xadd237 add -684172.592 766.448597E+288361959 -> 7.66448597E+288361961 Inexact Rounded -xcom237 compare -684172.592 766.448597E+288361959 -> -1 -xdiv237 divide -684172.592 766.448597E+288361959 -> -8.92652938E-288361957 Inexact Rounded -xdvi237 divideint -684172.592 766.448597E+288361959 -> -0 -xmul237 multiply -684172.592 766.448597E+288361959 -> -5.24383123E+288361967 Inexact Rounded -xpow237 power -684172.592 8 -> 4.80093005E+46 Inexact Rounded -xrem237 remainder -684172.592 766.448597E+288361959 -> -684172.592 -xsub237 subtract -684172.592 766.448597E+288361959 -> -7.66448597E+288361961 Inexact Rounded -xadd238 add 626919.219 57469.8727E+13188610 -> 5.74698727E+13188614 Inexact Rounded -xcom238 compare 626919.219 57469.8727E+13188610 -> -1 -xdiv238 divide 626919.219 57469.8727E+13188610 -> 1.09086586E-13188609 Inexact Rounded -xdvi238 divideint 626919.219 57469.8727E+13188610 -> 0 -xmul238 multiply 626919.219 57469.8727E+13188610 -> 3.60289677E+13188620 Inexact Rounded -xpow238 power 626919.219 6 -> 6.07112959E+34 Inexact Rounded -xrem238 remainder 626919.219 57469.8727E+13188610 -> 626919.219 -xsub238 subtract 626919.219 57469.8727E+13188610 -> -5.74698727E+13188614 Inexact Rounded -xadd239 add -77480.5840 893265.594E+287982552 -> 8.93265594E+287982557 Inexact Rounded -xcom239 compare -77480.5840 893265.594E+287982552 -> -1 -xdiv239 divide -77480.5840 893265.594E+287982552 -> -8.67385742E-287982554 Inexact Rounded -xdvi239 divideint -77480.5840 893265.594E+287982552 -> -0 -xmul239 multiply -77480.5840 893265.594E+287982552 -> -6.92107399E+287982562 Inexact Rounded -xpow239 power -77480.5840 9 -> -1.00631969E+44 Inexact Rounded -xrem239 remainder -77480.5840 893265.594E+287982552 -> -77480.5840 -xsub239 subtract -77480.5840 893265.594E+287982552 -> -8.93265594E+287982557 Inexact Rounded -xadd240 add -7177620.29 7786343.83 -> 608723.54 -xcom240 compare -7177620.29 7786343.83 -> -1 -xdiv240 divide -7177620.29 7786343.83 -> -0.921821647 Inexact Rounded -xdvi240 divideint -7177620.29 7786343.83 -> -0 -xmul240 multiply -7177620.29 7786343.83 -> -5.58874195E+13 Inexact Rounded -xpow240 power -7177620.29 7786344 -> 2.96037074E+53383022 Inexact Rounded -xrem240 remainder -7177620.29 7786343.83 -> -7177620.29 -xsub240 subtract -7177620.29 7786343.83 -> -14963964.1 Inexact Rounded -xadd241 add 9.6224130 4.50355112 -> 14.1259641 Inexact Rounded -xcom241 compare 9.6224130 4.50355112 -> 1 -xdiv241 divide 9.6224130 4.50355112 -> 2.13662791 Inexact Rounded -xdvi241 divideint 9.6224130 4.50355112 -> 2 -xmul241 multiply 9.6224130 4.50355112 -> 43.3350288 Inexact Rounded -xpow241 power 9.6224130 5 -> 82493.5448 Inexact Rounded -xrem241 remainder 9.6224130 4.50355112 -> 0.61531076 -xsub241 subtract 9.6224130 4.50355112 -> 5.11886188 -xadd242 add -66.6337347E-597410086 -818812885 -> -818812885 Inexact Rounded -xcom242 compare -66.6337347E-597410086 -818812885 -> 1 -xdiv242 divide -66.6337347E-597410086 -818812885 -> 8.13784638E-597410094 Inexact Rounded -xdvi242 divideint -66.6337347E-597410086 -818812885 -> 0 -xmul242 multiply -66.6337347E-597410086 -818812885 -> 5.45605605E-597410076 Inexact Rounded -xpow242 power -66.6337347E-597410086 -818812885 -> -Infinity Overflow Inexact Rounded -xrem242 remainder -66.6337347E-597410086 -818812885 -> -6.66337347E-597410085 -xsub242 subtract -66.6337347E-597410086 -818812885 -> 818812885 Inexact Rounded -xadd243 add 65587553.7 600574.736 -> 66188128.4 Inexact Rounded -xcom243 compare 65587553.7 600574.736 -> 1 -xdiv243 divide 65587553.7 600574.736 -> 109.207980 Inexact Rounded -xdvi243 divideint 65587553.7 600574.736 -> 109 -xmul243 multiply 65587553.7 600574.736 -> 3.93902277E+13 Inexact Rounded -xpow243 power 65587553.7 600575 -> 3.40404817E+4694587 Inexact Rounded -xrem243 remainder 65587553.7 600574.736 -> 124907.476 -xsub243 subtract 65587553.7 600574.736 -> 64986979.0 Inexact Rounded -xadd244 add -32401.939 -585200217. -> -585232619 Inexact Rounded -xcom244 compare -32401.939 -585200217. -> 1 -xdiv244 divide -32401.939 -585200217. -> 0.0000553689798 Inexact Rounded -xdvi244 divideint -32401.939 -585200217. -> 0 -xmul244 multiply -32401.939 -585200217. -> 1.89616217E+13 Inexact Rounded -xpow244 power -32401.939 -585200217 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem244 remainder -32401.939 -585200217. -> -32401.939 -xsub244 subtract -32401.939 -585200217. -> 585167815 Inexact Rounded -xadd245 add 69573.988 -9.77003465E+740933668 -> -9.77003465E+740933668 Inexact Rounded -xcom245 compare 69573.988 -9.77003465E+740933668 -> 1 -xdiv245 divide 69573.988 -9.77003465E+740933668 -> -7.12116082E-740933665 Inexact Rounded -xdvi245 divideint 69573.988 -9.77003465E+740933668 -> -0 -xmul245 multiply 69573.988 -9.77003465E+740933668 -> -6.79740273E+740933673 Inexact Rounded -xpow245 power 69573.988 -10 -> 3.76297229E-49 Inexact Rounded -xrem245 remainder 69573.988 -9.77003465E+740933668 -> 69573.988 -xsub245 subtract 69573.988 -9.77003465E+740933668 -> 9.77003465E+740933668 Inexact Rounded -xadd246 add 2362.06251 -433149546.E-152643629 -> 2362.06251 Inexact Rounded -xcom246 compare 2362.06251 -433149546.E-152643629 -> 1 -xdiv246 divide 2362.06251 -433149546.E-152643629 -> -5.45322633E+152643623 Inexact Rounded -xdvi246 divideint 2362.06251 -433149546.E-152643629 -> NaN Division_impossible -xmul246 multiply 2362.06251 -433149546.E-152643629 -> -1.02312630E-152643617 Inexact Rounded -xpow246 power 2362.06251 -4 -> 3.21243577E-14 Inexact Rounded -xrem246 remainder 2362.06251 -433149546.E-152643629 -> NaN Division_impossible -xsub246 subtract 2362.06251 -433149546.E-152643629 -> 2362.06251 Inexact Rounded -xadd247 add -615.23488E+249953452 -21437483.7 -> -6.15234880E+249953454 Inexact Rounded -xcom247 compare -615.23488E+249953452 -21437483.7 -> -1 -xdiv247 divide -615.23488E+249953452 -21437483.7 -> 2.86990250E+249953447 Inexact Rounded -xdvi247 divideint -615.23488E+249953452 -21437483.7 -> NaN Division_impossible -xmul247 multiply -615.23488E+249953452 -21437483.7 -> 1.31890877E+249953462 Inexact Rounded -xpow247 power -615.23488E+249953452 -21437484 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem247 remainder -615.23488E+249953452 -21437483.7 -> NaN Division_impossible -xsub247 subtract -615.23488E+249953452 -21437483.7 -> -6.15234880E+249953454 Inexact Rounded -xadd248 add 216741082. 250290244 -> 467031326 -xcom248 compare 216741082. 250290244 -> -1 -xdiv248 divide 216741082. 250290244 -> 0.865958970 Inexact Rounded -xdvi248 divideint 216741082. 250290244 -> 0 -xmul248 multiply 216741082. 250290244 -> 5.42481783E+16 Inexact Rounded -xpow248 power 216741082. 250290244 -> Infinity Overflow Inexact Rounded -xrem248 remainder 216741082. 250290244 -> 216741082 -xsub248 subtract 216741082. 250290244 -> -33549162 -xadd249 add -6364720.49 5539245.64 -> -825474.85 -xcom249 compare -6364720.49 5539245.64 -> -1 -xdiv249 divide -6364720.49 5539245.64 -> -1.14902297 Inexact Rounded -xdvi249 divideint -6364720.49 5539245.64 -> -1 -xmul249 multiply -6364720.49 5539245.64 -> -3.52557502E+13 Inexact Rounded -xpow249 power -6364720.49 5539246 -> 2.96894641E+37687807 Inexact Rounded -xrem249 remainder -6364720.49 5539245.64 -> -825474.85 -xsub249 subtract -6364720.49 5539245.64 -> -11903966.1 Inexact Rounded -xadd250 add -814599.475 -14.5431191 -> -814614.018 Inexact Rounded -xcom250 compare -814599.475 -14.5431191 -> -1 -xdiv250 divide -814599.475 -14.5431191 -> 56012.7074 Inexact Rounded -xdvi250 divideint -814599.475 -14.5431191 -> 56012 -xmul250 multiply -814599.475 -14.5431191 -> 11846817.2 Inexact Rounded -xpow250 power -814599.475 -15 -> -2.16689622E-89 Inexact Rounded -xrem250 remainder -814599.475 -14.5431191 -> -10.2879708 -xsub250 subtract -814599.475 -14.5431191 -> -814584.932 Inexact Rounded -xadd251 add -877498.755 507408724E-168628106 -> -877498.755 Inexact Rounded -xcom251 compare -877498.755 507408724E-168628106 -> -1 -xdiv251 divide -877498.755 507408724E-168628106 -> -1.72937262E+168628103 Inexact Rounded -xdvi251 divideint -877498.755 507408724E-168628106 -> NaN Division_impossible -xmul251 multiply -877498.755 507408724E-168628106 -> -4.45250524E-168628092 Inexact Rounded -xpow251 power -877498.755 5 -> -5.20274505E+29 Inexact Rounded -xrem251 remainder -877498.755 507408724E-168628106 -> NaN Division_impossible -xsub251 subtract -877498.755 507408724E-168628106 -> -877498.755 Inexact Rounded -xadd252 add 10634446.5E+475783861 50.7213056E+17807809 -> 1.06344465E+475783868 Inexact Rounded -xcom252 compare 10634446.5E+475783861 50.7213056E+17807809 -> 1 -xdiv252 divide 10634446.5E+475783861 50.7213056E+17807809 -> 2.09664289E+457976057 Inexact Rounded -xdvi252 divideint 10634446.5E+475783861 50.7213056E+17807809 -> NaN Division_impossible -xmul252 multiply 10634446.5E+475783861 50.7213056E+17807809 -> 5.39393011E+493591678 Inexact Rounded -xpow252 power 10634446.5E+475783861 5 -> Infinity Overflow Inexact Rounded -xrem252 remainder 10634446.5E+475783861 50.7213056E+17807809 -> NaN Division_impossible -xsub252 subtract 10634446.5E+475783861 50.7213056E+17807809 -> 1.06344465E+475783868 Inexact Rounded -xadd253 add -162726.257E-597285918 -4391.54799 -> -4391.54799 Inexact Rounded -xcom253 compare -162726.257E-597285918 -4391.54799 -> 1 -xdiv253 divide -162726.257E-597285918 -4391.54799 -> 3.70544185E-597285917 Inexact Rounded -xdvi253 divideint -162726.257E-597285918 -4391.54799 -> 0 -xmul253 multiply -162726.257E-597285918 -4391.54799 -> 7.14620167E-597285910 Inexact Rounded -xpow253 power -162726.257E-597285918 -4392 -> Infinity Overflow Inexact Rounded -xrem253 remainder -162726.257E-597285918 -4391.54799 -> -1.62726257E-597285913 -xsub253 subtract -162726.257E-597285918 -4391.54799 -> 4391.54799 Inexact Rounded -xadd254 add 700354586.E-99856707 7198.0493E+436250299 -> 7.19804930E+436250302 Inexact Rounded -xcom254 compare 700354586.E-99856707 7198.0493E+436250299 -> -1 -xdiv254 divide 700354586.E-99856707 7198.0493E+436250299 -> 9.72978312E-536107002 Inexact Rounded -xdvi254 divideint 700354586.E-99856707 7198.0493E+436250299 -> 0 -xmul254 multiply 700354586.E-99856707 7198.0493E+436250299 -> 5.04118684E+336393604 Inexact Rounded -xpow254 power 700354586.E-99856707 7 -> 8.26467610E-698996888 Inexact Rounded -xrem254 remainder 700354586.E-99856707 7198.0493E+436250299 -> 7.00354586E-99856699 -xsub254 subtract 700354586.E-99856707 7198.0493E+436250299 -> -7.19804930E+436250302 Inexact Rounded -xadd255 add 39617663E-463704664 -895.290346 -> -895.290346 Inexact Rounded -xcom255 compare 39617663E-463704664 -895.290346 -> 1 -xdiv255 divide 39617663E-463704664 -895.290346 -> -4.42511898E-463704660 Inexact Rounded -xdvi255 divideint 39617663E-463704664 -895.290346 -> -0 -xmul255 multiply 39617663E-463704664 -895.290346 -> -3.54693112E-463704654 Inexact Rounded -xpow255 power 39617663E-463704664 -895 -> Infinity Overflow Inexact Rounded -xrem255 remainder 39617663E-463704664 -895.290346 -> 3.9617663E-463704657 -xsub255 subtract 39617663E-463704664 -895.290346 -> 895.290346 Inexact Rounded -xadd256 add 5350882.59 -36329829 -> -30978946.4 Inexact Rounded -xcom256 compare 5350882.59 -36329829 -> 1 -xdiv256 divide 5350882.59 -36329829 -> -0.147286204 Inexact Rounded -xdvi256 divideint 5350882.59 -36329829 -> -0 -xmul256 multiply 5350882.59 -36329829 -> -1.94396649E+14 Inexact Rounded -xpow256 power 5350882.59 -36329829 -> 9.77006107E-244442546 Inexact Rounded -xrem256 remainder 5350882.59 -36329829 -> 5350882.59 -xsub256 subtract 5350882.59 -36329829 -> 41680711.6 Inexact Rounded -xadd257 add 91966.4084E+210382952 166740.46E-42001390 -> 9.19664084E+210382956 Inexact Rounded -xcom257 compare 91966.4084E+210382952 166740.46E-42001390 -> 1 -xdiv257 divide 91966.4084E+210382952 166740.46E-42001390 -> 5.51554244E+252384341 Inexact Rounded -xdvi257 divideint 91966.4084E+210382952 166740.46E-42001390 -> NaN Division_impossible -xmul257 multiply 91966.4084E+210382952 166740.46E-42001390 -> 1.53345212E+168381572 Inexact Rounded -xpow257 power 91966.4084E+210382952 2 -> 8.45782027E+420765913 Inexact Rounded -xrem257 remainder 91966.4084E+210382952 166740.46E-42001390 -> NaN Division_impossible -xsub257 subtract 91966.4084E+210382952 166740.46E-42001390 -> 9.19664084E+210382956 Inexact Rounded -xadd258 add 231899031.E-481759076 726.337100 -> 726.337100 Inexact Rounded -xcom258 compare 231899031.E-481759076 726.337100 -> -1 -xdiv258 divide 231899031.E-481759076 726.337100 -> 3.19271907E-481759071 Inexact Rounded -xdvi258 divideint 231899031.E-481759076 726.337100 -> 0 -xmul258 multiply 231899031.E-481759076 726.337100 -> 1.68436870E-481759065 Inexact Rounded -xpow258 power 231899031.E-481759076 726 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem258 remainder 231899031.E-481759076 726.337100 -> 2.31899031E-481759068 -xsub258 subtract 231899031.E-481759076 726.337100 -> -726.337100 Inexact Rounded -xadd259 add -9611312.33 22109735.9 -> 12498423.6 Inexact Rounded -xcom259 compare -9611312.33 22109735.9 -> -1 -xdiv259 divide -9611312.33 22109735.9 -> -0.434709504 Inexact Rounded -xdvi259 divideint -9611312.33 22109735.9 -> -0 -xmul259 multiply -9611312.33 22109735.9 -> -2.12503577E+14 Inexact Rounded -xpow259 power -9611312.33 22109736 -> 6.74530828E+154387481 Inexact Rounded -xrem259 remainder -9611312.33 22109735.9 -> -9611312.33 -xsub259 subtract -9611312.33 22109735.9 -> -31721048.2 Inexact Rounded -xadd260 add -5604938.15E-36812542 735937577. -> 735937577 Inexact Rounded -xcom260 compare -5604938.15E-36812542 735937577. -> -1 -xdiv260 divide -5604938.15E-36812542 735937577. -> -7.61605104E-36812545 Inexact Rounded -xdvi260 divideint -5604938.15E-36812542 735937577. -> -0 -xmul260 multiply -5604938.15E-36812542 735937577. -> -4.12488460E-36812527 Inexact Rounded -xpow260 power -5604938.15E-36812542 735937577 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem260 remainder -5604938.15E-36812542 735937577. -> -5.60493815E-36812536 -xsub260 subtract -5604938.15E-36812542 735937577. -> -735937577 Inexact Rounded -xadd261 add 693881413. 260547224E-480281418 -> 693881413 Inexact Rounded -xcom261 compare 693881413. 260547224E-480281418 -> 1 -xdiv261 divide 693881413. 260547224E-480281418 -> 2.66316947E+480281418 Inexact Rounded -xdvi261 divideint 693881413. 260547224E-480281418 -> NaN Division_impossible -xmul261 multiply 693881413. 260547224E-480281418 -> 1.80788876E-480281401 Inexact Rounded -xpow261 power 693881413. 3 -> 3.34084066E+26 Inexact Rounded -xrem261 remainder 693881413. 260547224E-480281418 -> NaN Division_impossible -xsub261 subtract 693881413. 260547224E-480281418 -> 693881413 Inexact Rounded -xadd262 add -34865.7378E-368768024 2297117.88 -> 2297117.88 Inexact Rounded -xcom262 compare -34865.7378E-368768024 2297117.88 -> -1 -xdiv262 divide -34865.7378E-368768024 2297117.88 -> -1.51780360E-368768026 Inexact Rounded -xdvi262 divideint -34865.7378E-368768024 2297117.88 -> -0 -xmul262 multiply -34865.7378E-368768024 2297117.88 -> -8.00907097E-368768014 Inexact Rounded -xpow262 power -34865.7378E-368768024 2297118 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem262 remainder -34865.7378E-368768024 2297117.88 -> -3.48657378E-368768020 -xsub262 subtract -34865.7378E-368768024 2297117.88 -> -2297117.88 Inexact Rounded -xadd263 add 1123.32456 7.86747918E+930888796 -> 7.86747918E+930888796 Inexact Rounded -xcom263 compare 1123.32456 7.86747918E+930888796 -> -1 -xdiv263 divide 1123.32456 7.86747918E+930888796 -> 1.42780748E-930888794 Inexact Rounded -xdvi263 divideint 1123.32456 7.86747918E+930888796 -> 0 -xmul263 multiply 1123.32456 7.86747918E+930888796 -> 8.83773259E+930888799 Inexact Rounded -xpow263 power 1123.32456 8 -> 2.53537401E+24 Inexact Rounded -xrem263 remainder 1123.32456 7.86747918E+930888796 -> 1123.32456 -xsub263 subtract 1123.32456 7.86747918E+930888796 -> -7.86747918E+930888796 Inexact Rounded -xadd264 add 56.6607465E+467812565 909552512E+764516200 -> 9.09552512E+764516208 Inexact Rounded -xcom264 compare 56.6607465E+467812565 909552512E+764516200 -> -1 -xdiv264 divide 56.6607465E+467812565 909552512E+764516200 -> 6.22951899E-296703643 Inexact Rounded -xdvi264 divideint 56.6607465E+467812565 909552512E+764516200 -> 0 -xmul264 multiply 56.6607465E+467812565 909552512E+764516200 -> Infinity Inexact Overflow Rounded -xpow264 power 56.6607465E+467812565 9 -> Infinity Overflow Inexact Rounded -xrem264 remainder 56.6607465E+467812565 909552512E+764516200 -> 5.66607465E+467812566 -xsub264 subtract 56.6607465E+467812565 909552512E+764516200 -> -9.09552512E+764516208 Inexact Rounded -xadd265 add -1.85771840E+365552540 -73028339.7 -> -1.85771840E+365552540 Inexact Rounded -xcom265 compare -1.85771840E+365552540 -73028339.7 -> -1 -xdiv265 divide -1.85771840E+365552540 -73028339.7 -> 2.54383217E+365552532 Inexact Rounded -xdvi265 divideint -1.85771840E+365552540 -73028339.7 -> NaN Division_impossible -xmul265 multiply -1.85771840E+365552540 -73028339.7 -> 1.35666090E+365552548 Inexact Rounded -xpow265 power -1.85771840E+365552540 -73028340 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem265 remainder -1.85771840E+365552540 -73028339.7 -> NaN Division_impossible -xsub265 subtract -1.85771840E+365552540 -73028339.7 -> -1.85771840E+365552540 Inexact Rounded -xadd266 add 34.1935525 -40767.6450 -> -40733.4514 Inexact Rounded -xcom266 compare 34.1935525 -40767.6450 -> 1 -xdiv266 divide 34.1935525 -40767.6450 -> -0.000838742402 Inexact Rounded -xdvi266 divideint 34.1935525 -40767.6450 -> -0 -xmul266 multiply 34.1935525 -40767.6450 -> -1393990.61 Inexact Rounded -xpow266 power 34.1935525 -40768 -> 1.45174210E-62536 Inexact Rounded -xrem266 remainder 34.1935525 -40767.6450 -> 34.1935525 -xsub266 subtract 34.1935525 -40767.6450 -> 40801.8386 Inexact Rounded -xadd267 add 26.0009168E+751618294 -304019.929 -> 2.60009168E+751618295 Inexact Rounded -xcom267 compare 26.0009168E+751618294 -304019.929 -> 1 -xdiv267 divide 26.0009168E+751618294 -304019.929 -> -8.55237250E+751618289 Inexact Rounded -xdvi267 divideint 26.0009168E+751618294 -304019.929 -> NaN Division_impossible -xmul267 multiply 26.0009168E+751618294 -304019.929 -> -7.90479688E+751618300 Inexact Rounded -xpow267 power 26.0009168E+751618294 -304020 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem267 remainder 26.0009168E+751618294 -304019.929 -> NaN Division_impossible -xsub267 subtract 26.0009168E+751618294 -304019.929 -> 2.60009168E+751618295 Inexact Rounded -xadd268 add -58.4853072E+588540055 -4647.3205 -> -5.84853072E+588540056 Inexact Rounded -xcom268 compare -58.4853072E+588540055 -4647.3205 -> -1 -xdiv268 divide -58.4853072E+588540055 -4647.3205 -> 1.25847372E+588540053 Inexact Rounded -xdvi268 divideint -58.4853072E+588540055 -4647.3205 -> NaN Division_impossible -xmul268 multiply -58.4853072E+588540055 -4647.3205 -> 2.71799967E+588540060 Inexact Rounded -xpow268 power -58.4853072E+588540055 -4647 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem268 remainder -58.4853072E+588540055 -4647.3205 -> NaN Division_impossible -xsub268 subtract -58.4853072E+588540055 -4647.3205 -> -5.84853072E+588540056 Inexact Rounded -xadd269 add 51.025101 -4467691.57 -> -4467640.54 Inexact Rounded -xcom269 compare 51.025101 -4467691.57 -> 1 -xdiv269 divide 51.025101 -4467691.57 -> -0.0000114209095 Inexact Rounded -xdvi269 divideint 51.025101 -4467691.57 -> -0 -xmul269 multiply 51.025101 -4467691.57 -> -227964414 Inexact Rounded -xpow269 power 51.025101 -4467692 -> 4.49462589E-7629853 Inexact Rounded -xrem269 remainder 51.025101 -4467691.57 -> 51.025101 -xsub269 subtract 51.025101 -4467691.57 -> 4467742.60 Inexact Rounded -xadd270 add -2214.76582 379785372E+223117572 -> 3.79785372E+223117580 Inexact Rounded -xcom270 compare -2214.76582 379785372E+223117572 -> -1 -xdiv270 divide -2214.76582 379785372E+223117572 -> -5.83162487E-223117578 Inexact Rounded -xdvi270 divideint -2214.76582 379785372E+223117572 -> -0 -xmul270 multiply -2214.76582 379785372E+223117572 -> -8.41135661E+223117583 Inexact Rounded -xpow270 power -2214.76582 4 -> 2.40608658E+13 Inexact Rounded -xrem270 remainder -2214.76582 379785372E+223117572 -> -2214.76582 -xsub270 subtract -2214.76582 379785372E+223117572 -> -3.79785372E+223117580 Inexact Rounded -xadd271 add -2564.75207E-841443929 -653498187 -> -653498187 Inexact Rounded -xcom271 compare -2564.75207E-841443929 -653498187 -> 1 -xdiv271 divide -2564.75207E-841443929 -653498187 -> 3.92465063E-841443935 Inexact Rounded -xdvi271 divideint -2564.75207E-841443929 -653498187 -> 0 -xmul271 multiply -2564.75207E-841443929 -653498187 -> 1.67606083E-841443917 Inexact Rounded -xpow271 power -2564.75207E-841443929 -653498187 -> -Infinity Overflow Inexact Rounded -xrem271 remainder -2564.75207E-841443929 -653498187 -> -2.56475207E-841443926 -xsub271 subtract -2564.75207E-841443929 -653498187 -> 653498187 Inexact Rounded -xadd272 add 513115529. 27775075.6E+217133352 -> 2.77750756E+217133359 Inexact Rounded -xcom272 compare 513115529. 27775075.6E+217133352 -> -1 -xdiv272 divide 513115529. 27775075.6E+217133352 -> 1.84739562E-217133351 Inexact Rounded -xdvi272 divideint 513115529. 27775075.6E+217133352 -> 0 -xmul272 multiply 513115529. 27775075.6E+217133352 -> 1.42518226E+217133368 Inexact Rounded -xpow272 power 513115529. 3 -> 1.35096929E+26 Inexact Rounded -xrem272 remainder 513115529. 27775075.6E+217133352 -> 513115529 -xsub272 subtract 513115529. 27775075.6E+217133352 -> -2.77750756E+217133359 Inexact Rounded -xadd273 add -247157.208 -532990.453 -> -780147.661 -xcom273 compare -247157.208 -532990.453 -> 1 -xdiv273 divide -247157.208 -532990.453 -> 0.463717890 Inexact Rounded -xdvi273 divideint -247157.208 -532990.453 -> 0 -xmul273 multiply -247157.208 -532990.453 -> 1.31732432E+11 Inexact Rounded -xpow273 power -247157.208 -532990 -> 1.48314033E-2874401 Inexact Rounded -xrem273 remainder -247157.208 -532990.453 -> -247157.208 -xsub273 subtract -247157.208 -532990.453 -> 285833.245 -xadd274 add 40.2490764E-339482253 7626.85442E+594264540 -> 7.62685442E+594264543 Inexact Rounded -xcom274 compare 40.2490764E-339482253 7626.85442E+594264540 -> -1 -xdiv274 divide 40.2490764E-339482253 7626.85442E+594264540 -> 5.27728395E-933746796 Inexact Rounded -xdvi274 divideint 40.2490764E-339482253 7626.85442E+594264540 -> 0 -xmul274 multiply 40.2490764E-339482253 7626.85442E+594264540 -> 3.06973846E+254782292 Inexact Rounded -xpow274 power 40.2490764E-339482253 8 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem274 remainder 40.2490764E-339482253 7626.85442E+594264540 -> 4.02490764E-339482252 -xsub274 subtract 40.2490764E-339482253 7626.85442E+594264540 -> -7.62685442E+594264543 Inexact Rounded -xadd275 add -1156008.8 -8870382.36 -> -10026391.2 Inexact Rounded -xcom275 compare -1156008.8 -8870382.36 -> 1 -xdiv275 divide -1156008.8 -8870382.36 -> 0.130322319 Inexact Rounded -xdvi275 divideint -1156008.8 -8870382.36 -> 0 -xmul275 multiply -1156008.8 -8870382.36 -> 1.02542401E+13 Inexact Rounded -xpow275 power -1156008.8 -8870382 -> 4.32494996E-53780782 Inexact Rounded -xrem275 remainder -1156008.8 -8870382.36 -> -1156008.80 -xsub275 subtract -1156008.8 -8870382.36 -> 7714373.56 -xadd276 add 880097928. -52455011.1E+204538218 -> -5.24550111E+204538225 Inexact Rounded -xcom276 compare 880097928. -52455011.1E+204538218 -> 1 -xdiv276 divide 880097928. -52455011.1E+204538218 -> -1.67781478E-204538217 Inexact Rounded -xdvi276 divideint 880097928. -52455011.1E+204538218 -> -0 -xmul276 multiply 880097928. -52455011.1E+204538218 -> -4.61655466E+204538234 Inexact Rounded -xpow276 power 880097928. -5 -> 1.89384751E-45 Inexact Rounded -xrem276 remainder 880097928. -52455011.1E+204538218 -> 880097928 -xsub276 subtract 880097928. -52455011.1E+204538218 -> 5.24550111E+204538225 Inexact Rounded -xadd277 add 5796.2524 34458329.7E+832129426 -> 3.44583297E+832129433 Inexact Rounded -xcom277 compare 5796.2524 34458329.7E+832129426 -> -1 -xdiv277 divide 5796.2524 34458329.7E+832129426 -> 1.68210486E-832129430 Inexact Rounded -xdvi277 divideint 5796.2524 34458329.7E+832129426 -> 0 -xmul277 multiply 5796.2524 34458329.7E+832129426 -> 1.99729176E+832129437 Inexact Rounded -xpow277 power 5796.2524 3 -> 1.94734037E+11 Inexact Rounded -xrem277 remainder 5796.2524 34458329.7E+832129426 -> 5796.2524 -xsub277 subtract 5796.2524 34458329.7E+832129426 -> -3.44583297E+832129433 Inexact Rounded -xadd278 add 27.1000923E-218032223 -45.0198341 -> -45.0198341 Inexact Rounded -xcom278 compare 27.1000923E-218032223 -45.0198341 -> 1 -xdiv278 divide 27.1000923E-218032223 -45.0198341 -> -6.01958955E-218032224 Inexact Rounded -xdvi278 divideint 27.1000923E-218032223 -45.0198341 -> -0 -xmul278 multiply 27.1000923E-218032223 -45.0198341 -> -1.22004166E-218032220 Inexact Rounded -xpow278 power 27.1000923E-218032223 -45 -> Infinity Overflow Inexact Rounded -xrem278 remainder 27.1000923E-218032223 -45.0198341 -> 2.71000923E-218032222 -xsub278 subtract 27.1000923E-218032223 -45.0198341 -> 45.0198341 Inexact Rounded -xadd279 add 42643477.8 26118465E-730390549 -> 42643477.8 Inexact Rounded -xcom279 compare 42643477.8 26118465E-730390549 -> 1 -xdiv279 divide 42643477.8 26118465E-730390549 -> 1.63269464E+730390549 Inexact Rounded -xdvi279 divideint 42643477.8 26118465E-730390549 -> NaN Division_impossible -xmul279 multiply 42643477.8 26118465E-730390549 -> 1.11378218E-730390534 Inexact Rounded -xpow279 power 42643477.8 3 -> 7.75457230E+22 Inexact Rounded -xrem279 remainder 42643477.8 26118465E-730390549 -> NaN Division_impossible -xsub279 subtract 42643477.8 26118465E-730390549 -> 42643477.8 Inexact Rounded -xadd280 add -31918.9176E-163031657 -21.5422824E-807317258 -> -3.19189176E-163031653 Inexact Rounded -xcom280 compare -31918.9176E-163031657 -21.5422824E-807317258 -> -1 -xdiv280 divide -31918.9176E-163031657 -21.5422824E-807317258 -> 1.48168690E+644285604 Inexact Rounded -xdvi280 divideint -31918.9176E-163031657 -21.5422824E-807317258 -> NaN Division_impossible -xmul280 multiply -31918.9176E-163031657 -21.5422824E-807317258 -> 6.87606337E-970348910 Inexact Rounded -xpow280 power -31918.9176E-163031657 -2 -> 9.81530250E+326063304 Inexact Rounded -xrem280 remainder -31918.9176E-163031657 -21.5422824E-807317258 -> NaN Division_impossible -xsub280 subtract -31918.9176E-163031657 -21.5422824E-807317258 -> -3.19189176E-163031653 Inexact Rounded -xadd281 add 84224841.0 2.62548255E+647087608 -> 2.62548255E+647087608 Inexact Rounded -xcom281 compare 84224841.0 2.62548255E+647087608 -> -1 -xdiv281 divide 84224841.0 2.62548255E+647087608 -> 3.20797565E-647087601 Inexact Rounded -xdvi281 divideint 84224841.0 2.62548255E+647087608 -> 0 -xmul281 multiply 84224841.0 2.62548255E+647087608 -> 2.21130850E+647087616 Inexact Rounded -xpow281 power 84224841.0 3 -> 5.97476185E+23 Inexact Rounded -xrem281 remainder 84224841.0 2.62548255E+647087608 -> 84224841.0 -xsub281 subtract 84224841.0 2.62548255E+647087608 -> -2.62548255E+647087608 Inexact Rounded -xadd282 add -64413698.9 -6674.1055E-701047852 -> -64413698.9 Inexact Rounded -xcom282 compare -64413698.9 -6674.1055E-701047852 -> -1 -xdiv282 divide -64413698.9 -6674.1055E-701047852 -> 9.65128569E+701047855 Inexact Rounded -xdvi282 divideint -64413698.9 -6674.1055E-701047852 -> NaN Division_impossible -xmul282 multiply -64413698.9 -6674.1055E-701047852 -> 4.29903822E-701047841 Inexact Rounded -xpow282 power -64413698.9 -7 -> -2.17346338E-55 Inexact Rounded -xrem282 remainder -64413698.9 -6674.1055E-701047852 -> NaN Division_impossible -xsub282 subtract -64413698.9 -6674.1055E-701047852 -> -64413698.9 Inexact Rounded -xadd283 add -62.5059208 9.5795779E-898350012 -> -62.5059208 Inexact Rounded -xcom283 compare -62.5059208 9.5795779E-898350012 -> -1 -xdiv283 divide -62.5059208 9.5795779E-898350012 -> -6.52491388E+898350012 Inexact Rounded -xdvi283 divideint -62.5059208 9.5795779E-898350012 -> NaN Division_impossible -xmul283 multiply -62.5059208 9.5795779E-898350012 -> -5.98780338E-898350010 Inexact Rounded -xpow283 power -62.5059208 10 -> 9.10356659E+17 Inexact Rounded -xrem283 remainder -62.5059208 9.5795779E-898350012 -> NaN Division_impossible -xsub283 subtract -62.5059208 9.5795779E-898350012 -> -62.5059208 Inexact Rounded -xadd284 add 9090950.80 436.400932 -> 9091387.20 Inexact Rounded -xcom284 compare 9090950.80 436.400932 -> 1 -xdiv284 divide 9090950.80 436.400932 -> 20831.6485 Inexact Rounded -xdvi284 divideint 9090950.80 436.400932 -> 20831 -xmul284 multiply 9090950.80 436.400932 -> 3.96729940E+9 Inexact Rounded -xpow284 power 9090950.80 436 -> 8.98789557E+3033 Inexact Rounded -xrem284 remainder 9090950.80 436.400932 -> 282.985508 -xsub284 subtract 9090950.80 436.400932 -> 9090514.40 Inexact Rounded -xadd285 add -89833825.7E+329205393 -779430.194 -> -8.98338257E+329205400 Inexact Rounded -xcom285 compare -89833825.7E+329205393 -779430.194 -> -1 -xdiv285 divide -89833825.7E+329205393 -779430.194 -> 1.15255768E+329205395 Inexact Rounded -xdvi285 divideint -89833825.7E+329205393 -779430.194 -> NaN Division_impossible -xmul285 multiply -89833825.7E+329205393 -779430.194 -> 7.00191962E+329205406 Inexact Rounded -xpow285 power -89833825.7E+329205393 -779430 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem285 remainder -89833825.7E+329205393 -779430.194 -> NaN Division_impossible -xsub285 subtract -89833825.7E+329205393 -779430.194 -> -8.98338257E+329205400 Inexact Rounded -xadd286 add -714562.019E+750205688 704079764 -> -7.14562019E+750205693 Inexact Rounded -xcom286 compare -714562.019E+750205688 704079764 -> -1 -xdiv286 divide -714562.019E+750205688 704079764 -> -1.01488788E+750205685 Inexact Rounded -xdvi286 divideint -714562.019E+750205688 704079764 -> NaN Division_impossible -xmul286 multiply -714562.019E+750205688 704079764 -> -5.03108658E+750205702 Inexact Rounded -xpow286 power -714562.019E+750205688 704079764 -> Infinity Overflow Inexact Rounded -xrem286 remainder -714562.019E+750205688 704079764 -> NaN Division_impossible -xsub286 subtract -714562.019E+750205688 704079764 -> -7.14562019E+750205693 Inexact Rounded -xadd287 add -584537670. 31139.7737E-146687560 -> -584537670 Inexact Rounded -xcom287 compare -584537670. 31139.7737E-146687560 -> -1 -xdiv287 divide -584537670. 31139.7737E-146687560 -> -1.87714168E+146687564 Inexact Rounded -xdvi287 divideint -584537670. 31139.7737E-146687560 -> NaN Division_impossible -xmul287 multiply -584537670. 31139.7737E-146687560 -> -1.82023708E-146687547 Inexact Rounded -xpow287 power -584537670. 3 -> -1.99727337E+26 Inexact Rounded -xrem287 remainder -584537670. 31139.7737E-146687560 -> NaN Division_impossible -xsub287 subtract -584537670. 31139.7737E-146687560 -> -584537670 Inexact Rounded -xadd288 add -4.18074650E-858746879 571035.277E-279409165 -> 5.71035277E-279409160 Inexact Rounded -xcom288 compare -4.18074650E-858746879 571035.277E-279409165 -> -1 -xdiv288 divide -4.18074650E-858746879 571035.277E-279409165 -> -7.32134540E-579337720 Inexact Rounded -xdvi288 divideint -4.18074650E-858746879 571035.277E-279409165 -> -0 -xmul288 multiply -4.18074650E-858746879 571035.277E-279409165 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow288 power -4.18074650E-858746879 6 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem288 remainder -4.18074650E-858746879 571035.277E-279409165 -> -4.18074650E-858746879 -xsub288 subtract -4.18074650E-858746879 571035.277E-279409165 -> -5.71035277E-279409160 Inexact Rounded -xadd289 add 5.15309635 -695649.219E+451948183 -> -6.95649219E+451948188 Inexact Rounded -xcom289 compare 5.15309635 -695649.219E+451948183 -> 1 -xdiv289 divide 5.15309635 -695649.219E+451948183 -> -7.40760747E-451948189 Inexact Rounded -xdvi289 divideint 5.15309635 -695649.219E+451948183 -> -0 -xmul289 multiply 5.15309635 -695649.219E+451948183 -> -3.58474745E+451948189 Inexact Rounded -xpow289 power 5.15309635 -7 -> 0.0000103638749 Inexact Rounded -xrem289 remainder 5.15309635 -695649.219E+451948183 -> 5.15309635 -xsub289 subtract 5.15309635 -695649.219E+451948183 -> 6.95649219E+451948188 Inexact Rounded -xadd290 add -940030153.E+83797657 -4.11510193 -> -9.40030153E+83797665 Inexact Rounded -xcom290 compare -940030153.E+83797657 -4.11510193 -> -1 -xdiv290 divide -940030153.E+83797657 -4.11510193 -> 2.28434233E+83797665 Inexact Rounded -xdvi290 divideint -940030153.E+83797657 -4.11510193 -> NaN Division_impossible -xmul290 multiply -940030153.E+83797657 -4.11510193 -> 3.86831990E+83797666 Inexact Rounded -xpow290 power -940030153.E+83797657 -4 -> 1.28065710E-335190664 Inexact Rounded -xrem290 remainder -940030153.E+83797657 -4.11510193 -> NaN Division_impossible -xsub290 subtract -940030153.E+83797657 -4.11510193 -> -9.40030153E+83797665 Inexact Rounded -xadd291 add 89088.9683E+587739290 1.31932110 -> 8.90889683E+587739294 Inexact Rounded -xcom291 compare 89088.9683E+587739290 1.31932110 -> 1 -xdiv291 divide 89088.9683E+587739290 1.31932110 -> 6.75263727E+587739294 Inexact Rounded -xdvi291 divideint 89088.9683E+587739290 1.31932110 -> NaN Division_impossible -xmul291 multiply 89088.9683E+587739290 1.31932110 -> 1.17536956E+587739295 Inexact Rounded -xpow291 power 89088.9683E+587739290 1 -> 8.90889683E+587739294 -xrem291 remainder 89088.9683E+587739290 1.31932110 -> NaN Division_impossible -xsub291 subtract 89088.9683E+587739290 1.31932110 -> 8.90889683E+587739294 Inexact Rounded -xadd292 add 3336750 6.47961126 -> 3336756.48 Inexact Rounded -xcom292 compare 3336750 6.47961126 -> 1 -xdiv292 divide 3336750 6.47961126 -> 514961.448 Inexact Rounded -xdvi292 divideint 3336750 6.47961126 -> 514961 -xmul292 multiply 3336750 6.47961126 -> 21620842.9 Inexact Rounded -xpow292 power 3336750 6 -> 1.38019997E+39 Inexact Rounded -xrem292 remainder 3336750 6.47961126 -> 2.90593914 -xsub292 subtract 3336750 6.47961126 -> 3336743.52 Inexact Rounded -xadd293 add 904654622. 692065270.E+329081915 -> 6.92065270E+329081923 Inexact Rounded -xcom293 compare 904654622. 692065270.E+329081915 -> -1 -xdiv293 divide 904654622. 692065270.E+329081915 -> 1.30718107E-329081915 Inexact Rounded -xdvi293 divideint 904654622. 692065270.E+329081915 -> 0 -xmul293 multiply 904654622. 692065270.E+329081915 -> 6.26080045E+329081932 Inexact Rounded -xpow293 power 904654622. 7 -> 4.95883485E+62 Inexact Rounded -xrem293 remainder 904654622. 692065270.E+329081915 -> 904654622 -xsub293 subtract 904654622. 692065270.E+329081915 -> -6.92065270E+329081923 Inexact Rounded -xadd294 add 304804380 -4681.23698 -> 304799699 Inexact Rounded -xcom294 compare 304804380 -4681.23698 -> 1 -xdiv294 divide 304804380 -4681.23698 -> -65111.9312 Inexact Rounded -xdvi294 divideint 304804380 -4681.23698 -> -65111 -xmul294 multiply 304804380 -4681.23698 -> -1.42686154E+12 Inexact Rounded -xpow294 power 304804380 -4681 -> 1.98037102E-39714 Inexact Rounded -xrem294 remainder 304804380 -4681.23698 -> 4358.99522 -xsub294 subtract 304804380 -4681.23698 -> 304809061 Inexact Rounded -xadd295 add 674.55569 -82981.2684E+852890752 -> -8.29812684E+852890756 Inexact Rounded -xcom295 compare 674.55569 -82981.2684E+852890752 -> 1 -xdiv295 divide 674.55569 -82981.2684E+852890752 -> -8.12901156E-852890755 Inexact Rounded -xdvi295 divideint 674.55569 -82981.2684E+852890752 -> -0 -xmul295 multiply 674.55569 -82981.2684E+852890752 -> -5.59754868E+852890759 Inexact Rounded -xpow295 power 674.55569 -8 -> 2.33269265E-23 Inexact Rounded -xrem295 remainder 674.55569 -82981.2684E+852890752 -> 674.55569 -xsub295 subtract 674.55569 -82981.2684E+852890752 -> 8.29812684E+852890756 Inexact Rounded -xadd296 add -5111.51025E-108006096 5448870.4E+279212255 -> 5.44887040E+279212261 Inexact Rounded -xcom296 compare -5111.51025E-108006096 5448870.4E+279212255 -> -1 -xdiv296 divide -5111.51025E-108006096 5448870.4E+279212255 -> -9.38086222E-387218355 Inexact Rounded -xdvi296 divideint -5111.51025E-108006096 5448870.4E+279212255 -> -0 -xmul296 multiply -5111.51025E-108006096 5448870.4E+279212255 -> -2.78519569E+171206169 Inexact Rounded -xpow296 power -5111.51025E-108006096 5 -> -3.48936323E-540030462 Inexact Rounded -xrem296 remainder -5111.51025E-108006096 5448870.4E+279212255 -> -5.11151025E-108006093 -xsub296 subtract -5111.51025E-108006096 5448870.4E+279212255 -> -5.44887040E+279212261 Inexact Rounded -xadd297 add -2623.45068 -466463938. -> -466466561 Inexact Rounded -xcom297 compare -2623.45068 -466463938. -> 1 -xdiv297 divide -2623.45068 -466463938. -> 0.00000562412325 Inexact Rounded -xdvi297 divideint -2623.45068 -466463938. -> 0 -xmul297 multiply -2623.45068 -466463938. -> 1.22374514E+12 Inexact Rounded -xpow297 power -2623.45068 -466463938 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem297 remainder -2623.45068 -466463938. -> -2623.45068 -xsub297 subtract -2623.45068 -466463938. -> 466461315 Inexact Rounded -xadd298 add 299350.435 3373.33551 -> 302723.771 Inexact Rounded -xcom298 compare 299350.435 3373.33551 -> 1 -xdiv298 divide 299350.435 3373.33551 -> 88.7401903 Inexact Rounded -xdvi298 divideint 299350.435 3373.33551 -> 88 -xmul298 multiply 299350.435 3373.33551 -> 1.00980945E+9 Inexact Rounded -xpow298 power 299350.435 3373 -> 1.42817370E+18471 Inexact Rounded -xrem298 remainder 299350.435 3373.33551 -> 2496.91012 -xsub298 subtract 299350.435 3373.33551 -> 295977.099 Inexact Rounded -xadd299 add -6589947.80 -2448.75933E-591549734 -> -6589947.80 Inexact Rounded -xcom299 compare -6589947.80 -2448.75933E-591549734 -> -1 -xdiv299 divide -6589947.80 -2448.75933E-591549734 -> 2.69113739E+591549737 Inexact Rounded -xdvi299 divideint -6589947.80 -2448.75933E-591549734 -> NaN Division_impossible -xmul299 multiply -6589947.80 -2448.75933E-591549734 -> 1.61371962E-591549724 Inexact Rounded -xpow299 power -6589947.80 -2 -> 2.30269305E-14 Inexact Rounded -xrem299 remainder -6589947.80 -2448.75933E-591549734 -> NaN Division_impossible -xsub299 subtract -6589947.80 -2448.75933E-591549734 -> -6589947.80 Inexact Rounded -xadd300 add 3774.5358E-491090520 173.060090 -> 173.060090 Inexact Rounded -xcom300 compare 3774.5358E-491090520 173.060090 -> -1 -xdiv300 divide 3774.5358E-491090520 173.060090 -> 2.18105503E-491090519 Inexact Rounded -xdvi300 divideint 3774.5358E-491090520 173.060090 -> 0 -xmul300 multiply 3774.5358E-491090520 173.060090 -> 6.53221505E-491090515 Inexact Rounded -xpow300 power 3774.5358E-491090520 173 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem300 remainder 3774.5358E-491090520 173.060090 -> 3.7745358E-491090517 -xsub300 subtract 3774.5358E-491090520 173.060090 -> -173.060090 Inexact Rounded -xadd301 add -13.6783690 -453.610117 -> -467.288486 Rounded -xcom301 compare -13.6783690 -453.610117 -> 1 -xdiv301 divide -13.6783690 -453.610117 -> 0.0301544619 Inexact Rounded -xdvi301 divideint -13.6783690 -453.610117 -> 0 -xmul301 multiply -13.6783690 -453.610117 -> 6204.64656 Inexact Rounded -xpow301 power -13.6783690 -454 -> 1.73948535E-516 Inexact Rounded -xrem301 remainder -13.6783690 -453.610117 -> -13.6783690 -xsub301 subtract -13.6783690 -453.610117 -> 439.931748 Rounded -xadd302 add -990100927.E-615244634 223801.421E+247632618 -> 2.23801421E+247632623 Inexact Rounded -xcom302 compare -990100927.E-615244634 223801.421E+247632618 -> -1 -xdiv302 divide -990100927.E-615244634 223801.421E+247632618 -> -4.42401537E-862877249 Inexact Rounded -xdvi302 divideint -990100927.E-615244634 223801.421E+247632618 -> -0 -xmul302 multiply -990100927.E-615244634 223801.421E+247632618 -> -2.21585994E-367612002 Inexact Rounded -xpow302 power -990100927.E-615244634 2 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem302 remainder -990100927.E-615244634 223801.421E+247632618 -> -9.90100927E-615244626 -xsub302 subtract -990100927.E-615244634 223801.421E+247632618 -> -2.23801421E+247632623 Inexact Rounded -xadd303 add 1275.10292 -667965353 -> -667964078 Inexact Rounded -xcom303 compare 1275.10292 -667965353 -> 1 -xdiv303 divide 1275.10292 -667965353 -> -0.00000190893572 Inexact Rounded -xdvi303 divideint 1275.10292 -667965353 -> -0 -xmul303 multiply 1275.10292 -667965353 -> -8.51724572E+11 Inexact Rounded -xpow303 power 1275.10292 -667965353 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem303 remainder 1275.10292 -667965353 -> 1275.10292 -xsub303 subtract 1275.10292 -667965353 -> 667966628 Inexact Rounded -xadd304 add -8.76375480E-596792197 992.077361 -> 992.077361 Inexact Rounded -xcom304 compare -8.76375480E-596792197 992.077361 -> -1 -xdiv304 divide -8.76375480E-596792197 992.077361 -> -8.83374134E-596792200 Inexact Rounded -xdvi304 divideint -8.76375480E-596792197 992.077361 -> -0 -xmul304 multiply -8.76375480E-596792197 992.077361 -> -8.69432273E-596792194 Inexact Rounded -xpow304 power -8.76375480E-596792197 992 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem304 remainder -8.76375480E-596792197 992.077361 -> -8.76375480E-596792197 -xsub304 subtract -8.76375480E-596792197 992.077361 -> -992.077361 Inexact Rounded -xadd305 add 953.976935E+385444720 96503.3378 -> 9.53976935E+385444722 Inexact Rounded -xcom305 compare 953.976935E+385444720 96503.3378 -> 1 -xdiv305 divide 953.976935E+385444720 96503.3378 -> 9.88542942E+385444717 Inexact Rounded -xdvi305 divideint 953.976935E+385444720 96503.3378 -> NaN Division_impossible -xmul305 multiply 953.976935E+385444720 96503.3378 -> 9.20619584E+385444727 Inexact Rounded -xpow305 power 953.976935E+385444720 96503 -> Infinity Overflow Inexact Rounded -xrem305 remainder 953.976935E+385444720 96503.3378 -> NaN Division_impossible -xsub305 subtract 953.976935E+385444720 96503.3378 -> 9.53976935E+385444722 Inexact Rounded -xadd306 add 213577152 -986710073E+31900046 -> -9.86710073E+31900054 Inexact Rounded -xcom306 compare 213577152 -986710073E+31900046 -> 1 -xdiv306 divide 213577152 -986710073E+31900046 -> -2.16453807E-31900047 Inexact Rounded -xdvi306 divideint 213577152 -986710073E+31900046 -> -0 -xmul306 multiply 213577152 -986710073E+31900046 -> -2.10738727E+31900063 Inexact Rounded -xpow306 power 213577152 -10 -> 5.06351487E-84 Inexact Rounded -xrem306 remainder 213577152 -986710073E+31900046 -> 213577152 -xsub306 subtract 213577152 -986710073E+31900046 -> 9.86710073E+31900054 Inexact Rounded -xadd307 add 91393.9398E-323439228 -135.701000 -> -135.701000 Inexact Rounded -xcom307 compare 91393.9398E-323439228 -135.701000 -> 1 -xdiv307 divide 91393.9398E-323439228 -135.701000 -> -6.73494962E-323439226 Inexact Rounded -xdvi307 divideint 91393.9398E-323439228 -135.701000 -> -0 -xmul307 multiply 91393.9398E-323439228 -135.701000 -> -1.24022490E-323439221 Inexact Rounded -xpow307 power 91393.9398E-323439228 -136 -> Infinity Overflow Inexact Rounded -xrem307 remainder 91393.9398E-323439228 -135.701000 -> 9.13939398E-323439224 -xsub307 subtract 91393.9398E-323439228 -135.701000 -> 135.701000 Inexact Rounded -xadd308 add -396.503557 45757264.E-254363788 -> -396.503557 Inexact Rounded -xcom308 compare -396.503557 45757264.E-254363788 -> -1 -xdiv308 divide -396.503557 45757264.E-254363788 -> -8.66536856E+254363782 Inexact Rounded -xdvi308 divideint -396.503557 45757264.E-254363788 -> NaN Division_impossible -xmul308 multiply -396.503557 45757264.E-254363788 -> -1.81429179E-254363778 Inexact Rounded -xpow308 power -396.503557 5 -> -9.80021128E+12 Inexact Rounded -xrem308 remainder -396.503557 45757264.E-254363788 -> NaN Division_impossible -xsub308 subtract -396.503557 45757264.E-254363788 -> -396.503557 Inexact Rounded -xadd309 add 59807846.1 1.53345254 -> 59807847.6 Inexact Rounded -xcom309 compare 59807846.1 1.53345254 -> 1 -xdiv309 divide 59807846.1 1.53345254 -> 39002084.9 Inexact Rounded -xdvi309 divideint 59807846.1 1.53345254 -> 39002084 -xmul309 multiply 59807846.1 1.53345254 -> 91712493.5 Inexact Rounded -xpow309 power 59807846.1 2 -> 3.57697846E+15 Inexact Rounded -xrem309 remainder 59807846.1 1.53345254 -> 1.32490664 -xsub309 subtract 59807846.1 1.53345254 -> 59807844.6 Inexact Rounded -xadd310 add -8046158.45 8.3635397 -> -8046150.09 Inexact Rounded -xcom310 compare -8046158.45 8.3635397 -> -1 -xdiv310 divide -8046158.45 8.3635397 -> -962051.803 Inexact Rounded -xdvi310 divideint -8046158.45 8.3635397 -> -962051 -xmul310 multiply -8046158.45 8.3635397 -> -67294365.6 Inexact Rounded -xpow310 power -8046158.45 8 -> 1.75674467E+55 Inexact Rounded -xrem310 remainder -8046158.45 8.3635397 -> -6.7180753 -xsub310 subtract -8046158.45 8.3635397 -> -8046166.81 Inexact Rounded -xadd311 add 55.1123381E+50627250 -94.0355047E-162540316 -> 5.51123381E+50627251 Inexact Rounded -xcom311 compare 55.1123381E+50627250 -94.0355047E-162540316 -> 1 -xdiv311 divide 55.1123381E+50627250 -94.0355047E-162540316 -> -5.86080101E+213167565 Inexact Rounded -xdvi311 divideint 55.1123381E+50627250 -94.0355047E-162540316 -> NaN Division_impossible -xmul311 multiply 55.1123381E+50627250 -94.0355047E-162540316 -> -5.18251653E-111913063 Inexact Rounded -xpow311 power 55.1123381E+50627250 -9 -> 2.13186881E-455645266 Inexact Rounded -xrem311 remainder 55.1123381E+50627250 -94.0355047E-162540316 -> NaN Division_impossible -xsub311 subtract 55.1123381E+50627250 -94.0355047E-162540316 -> 5.51123381E+50627251 Inexact Rounded -xadd312 add -948.038054 3580.84510 -> 2632.80705 Inexact Rounded -xcom312 compare -948.038054 3580.84510 -> -1 -xdiv312 divide -948.038054 3580.84510 -> -0.264752601 Inexact Rounded -xdvi312 divideint -948.038054 3580.84510 -> -0 -xmul312 multiply -948.038054 3580.84510 -> -3394777.42 Inexact Rounded -xpow312 power -948.038054 3581 -> -1.03058288E+10660 Inexact Rounded -xrem312 remainder -948.038054 3580.84510 -> -948.038054 -xsub312 subtract -948.038054 3580.84510 -> -4528.88315 Inexact Rounded -xadd313 add -6026.42752 -14.2286406E-334921364 -> -6026.42752 Inexact Rounded -xcom313 compare -6026.42752 -14.2286406E-334921364 -> -1 -xdiv313 divide -6026.42752 -14.2286406E-334921364 -> 4.23542044E+334921366 Inexact Rounded -xdvi313 divideint -6026.42752 -14.2286406E-334921364 -> NaN Division_impossible -xmul313 multiply -6026.42752 -14.2286406E-334921364 -> 8.57478713E-334921360 Inexact Rounded -xpow313 power -6026.42752 -1 -> -0.000165935788 Inexact Rounded -xrem313 remainder -6026.42752 -14.2286406E-334921364 -> NaN Division_impossible -xsub313 subtract -6026.42752 -14.2286406E-334921364 -> -6026.42752 Inexact Rounded -xadd314 add 79551.5014 -538.186229 -> 79013.3152 Inexact Rounded -xcom314 compare 79551.5014 -538.186229 -> 1 -xdiv314 divide 79551.5014 -538.186229 -> -147.814078 Inexact Rounded -xdvi314 divideint 79551.5014 -538.186229 -> -147 -xmul314 multiply 79551.5014 -538.186229 -> -42813522.5 Inexact Rounded -xpow314 power 79551.5014 -538 -> 2.82599389E-2637 Inexact Rounded -xrem314 remainder 79551.5014 -538.186229 -> 438.125737 -xsub314 subtract 79551.5014 -538.186229 -> 80089.6876 Inexact Rounded -xadd315 add 42706056.E+623578292 -690.327745 -> 4.27060560E+623578299 Inexact Rounded -xcom315 compare 42706056.E+623578292 -690.327745 -> 1 -xdiv315 divide 42706056.E+623578292 -690.327745 -> -6.18634501E+623578296 Inexact Rounded -xdvi315 divideint 42706056.E+623578292 -690.327745 -> NaN Division_impossible -xmul315 multiply 42706056.E+623578292 -690.327745 -> -2.94811753E+623578302 Inexact Rounded -xpow315 power 42706056.E+623578292 -690 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem315 remainder 42706056.E+623578292 -690.327745 -> NaN Division_impossible -xsub315 subtract 42706056.E+623578292 -690.327745 -> 4.27060560E+623578299 Inexact Rounded -xadd316 add 2454136.08E+502374077 856268.795E-356664934 -> 2.45413608E+502374083 Inexact Rounded -xcom316 compare 2454136.08E+502374077 856268.795E-356664934 -> 1 -xdiv316 divide 2454136.08E+502374077 856268.795E-356664934 -> 2.86608142E+859039011 Inexact Rounded -xdvi316 divideint 2454136.08E+502374077 856268.795E-356664934 -> NaN Division_impossible -xmul316 multiply 2454136.08E+502374077 856268.795E-356664934 -> 2.10140014E+145709155 Inexact Rounded -xpow316 power 2454136.08E+502374077 9 -> Infinity Overflow Inexact Rounded -xrem316 remainder 2454136.08E+502374077 856268.795E-356664934 -> NaN Division_impossible -xsub316 subtract 2454136.08E+502374077 856268.795E-356664934 -> 2.45413608E+502374083 Inexact Rounded -xadd317 add -3264204.54 -42704.501 -> -3306909.04 Inexact Rounded -xcom317 compare -3264204.54 -42704.501 -> -1 -xdiv317 divide -3264204.54 -42704.501 -> 76.4370140 Inexact Rounded -xdvi317 divideint -3264204.54 -42704.501 -> 76 -xmul317 multiply -3264204.54 -42704.501 -> 1.39396226E+11 Inexact Rounded -xpow317 power -3264204.54 -42705 -> -1.37293410E-278171 Inexact Rounded -xrem317 remainder -3264204.54 -42704.501 -> -18662.464 -xsub317 subtract -3264204.54 -42704.501 -> -3221500.04 Inexact Rounded -xadd318 add 1.21265492 44102.6073 -> 44103.8200 Inexact Rounded -xcom318 compare 1.21265492 44102.6073 -> -1 -xdiv318 divide 1.21265492 44102.6073 -> 0.0000274962183 Inexact Rounded -xdvi318 divideint 1.21265492 44102.6073 -> 0 -xmul318 multiply 1.21265492 44102.6073 -> 53481.2437 Inexact Rounded -xpow318 power 1.21265492 44103 -> 1.15662573E+3693 Inexact Rounded -xrem318 remainder 1.21265492 44102.6073 -> 1.21265492 -xsub318 subtract 1.21265492 44102.6073 -> -44101.3946 Inexact Rounded -xadd319 add -19.054711E+975514652 -22144.0822 -> -1.90547110E+975514653 Inexact Rounded -xcom319 compare -19.054711E+975514652 -22144.0822 -> -1 -xdiv319 divide -19.054711E+975514652 -22144.0822 -> 8.60487729E+975514648 Inexact Rounded -xdvi319 divideint -19.054711E+975514652 -22144.0822 -> NaN Division_impossible -xmul319 multiply -19.054711E+975514652 -22144.0822 -> 4.21949087E+975514657 Inexact Rounded -xpow319 power -19.054711E+975514652 -22144 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem319 remainder -19.054711E+975514652 -22144.0822 -> NaN Division_impossible -xsub319 subtract -19.054711E+975514652 -22144.0822 -> -1.90547110E+975514653 Inexact Rounded -xadd320 add 745.78452 -1922.00670E+375923302 -> -1.92200670E+375923305 Inexact Rounded -xcom320 compare 745.78452 -1922.00670E+375923302 -> 1 -xdiv320 divide 745.78452 -1922.00670E+375923302 -> -3.88023892E-375923303 Inexact Rounded -xdvi320 divideint 745.78452 -1922.00670E+375923302 -> -0 -xmul320 multiply 745.78452 -1922.00670E+375923302 -> -1.43340284E+375923308 Inexact Rounded -xpow320 power 745.78452 -2 -> 0.00000179793204 Inexact Rounded -xrem320 remainder 745.78452 -1922.00670E+375923302 -> 745.78452 -xsub320 subtract 745.78452 -1922.00670E+375923302 -> 1.92200670E+375923305 Inexact Rounded -xadd321 add -963717836 -823989308 -> -1.78770714E+9 Inexact Rounded -xcom321 compare -963717836 -823989308 -> -1 -xdiv321 divide -963717836 -823989308 -> 1.16957566 Inexact Rounded -xdvi321 divideint -963717836 -823989308 -> 1 -xmul321 multiply -963717836 -823989308 -> 7.94093193E+17 Inexact Rounded -xpow321 power -963717836 -823989308 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem321 remainder -963717836 -823989308 -> -139728528 -xsub321 subtract -963717836 -823989308 -> -139728528 -xadd322 add 82.4185291E-321919303 -215747737.E-995147400 -> 8.24185291E-321919302 Inexact Rounded -xcom322 compare 82.4185291E-321919303 -215747737.E-995147400 -> 1 -xdiv322 divide 82.4185291E-321919303 -215747737.E-995147400 -> -3.82013412E+673228090 Inexact Rounded -xdvi322 divideint 82.4185291E-321919303 -215747737.E-995147400 -> NaN Division_impossible -xmul322 multiply 82.4185291E-321919303 -215747737.E-995147400 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow322 power 82.4185291E-321919303 -2 -> 1.47214396E+643838602 Inexact Rounded -xrem322 remainder 82.4185291E-321919303 -215747737.E-995147400 -> NaN Division_impossible -xsub322 subtract 82.4185291E-321919303 -215747737.E-995147400 -> 8.24185291E-321919302 Inexact Rounded -xadd323 add -808328.607E-790810342 53075.7082 -> 53075.7082 Inexact Rounded -xcom323 compare -808328.607E-790810342 53075.7082 -> -1 -xdiv323 divide -808328.607E-790810342 53075.7082 -> -1.52297281E-790810341 Inexact Rounded -xdvi323 divideint -808328.607E-790810342 53075.7082 -> -0 -xmul323 multiply -808328.607E-790810342 53075.7082 -> -4.29026133E-790810332 Inexact Rounded -xpow323 power -808328.607E-790810342 53076 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem323 remainder -808328.607E-790810342 53075.7082 -> -8.08328607E-790810337 -xsub323 subtract -808328.607E-790810342 53075.7082 -> -53075.7082 Inexact Rounded -xadd324 add 700592.720 -698485.085 -> 2107.635 -xcom324 compare 700592.720 -698485.085 -> 1 -xdiv324 divide 700592.720 -698485.085 -> -1.00301744 Inexact Rounded -xdvi324 divideint 700592.720 -698485.085 -> -1 -xmul324 multiply 700592.720 -698485.085 -> -4.89353566E+11 Inexact Rounded -xpow324 power 700592.720 -698485 -> 8.83690000E-4082971 Inexact Rounded -xrem324 remainder 700592.720 -698485.085 -> 2107.635 -xsub324 subtract 700592.720 -698485.085 -> 1399077.81 Inexact Rounded -xadd325 add -80273928.0 661346.239 -> -79612581.8 Inexact Rounded -xcom325 compare -80273928.0 661346.239 -> -1 -xdiv325 divide -80273928.0 661346.239 -> -121.379579 Inexact Rounded -xdvi325 divideint -80273928.0 661346.239 -> -121 -xmul325 multiply -80273928.0 661346.239 -> -5.30888604E+13 Inexact Rounded -xpow325 power -80273928.0 661346 -> 5.45664856E+5227658 Inexact Rounded -xrem325 remainder -80273928.0 661346.239 -> -251033.081 -xsub325 subtract -80273928.0 661346.239 -> -80935274.2 Inexact Rounded -xadd326 add -24018251.0E+819786764 59141.9600E-167165065 -> -2.40182510E+819786771 Inexact Rounded -xcom326 compare -24018251.0E+819786764 59141.9600E-167165065 -> -1 -xdiv326 divide -24018251.0E+819786764 59141.9600E-167165065 -> -4.06111854E+986951831 Inexact Rounded -xdvi326 divideint -24018251.0E+819786764 59141.9600E-167165065 -> NaN Division_impossible -xmul326 multiply -24018251.0E+819786764 59141.9600E-167165065 -> -1.42048644E+652621711 Inexact Rounded -xpow326 power -24018251.0E+819786764 6 -> Infinity Overflow Inexact Rounded -xrem326 remainder -24018251.0E+819786764 59141.9600E-167165065 -> NaN Division_impossible -xsub326 subtract -24018251.0E+819786764 59141.9600E-167165065 -> -2.40182510E+819786771 Inexact Rounded -xadd327 add 2512953.3 -3769170.35E-993621645 -> 2512953.30 Inexact Rounded -xcom327 compare 2512953.3 -3769170.35E-993621645 -> 1 -xdiv327 divide 2512953.3 -3769170.35E-993621645 -> -6.66712583E+993621644 Inexact Rounded -xdvi327 divideint 2512953.3 -3769170.35E-993621645 -> NaN Division_impossible -xmul327 multiply 2512953.3 -3769170.35E-993621645 -> -9.47174907E-993621633 Inexact Rounded -xpow327 power 2512953.3 -4 -> 2.50762349E-26 Inexact Rounded -xrem327 remainder 2512953.3 -3769170.35E-993621645 -> NaN Division_impossible -xsub327 subtract 2512953.3 -3769170.35E-993621645 -> 2512953.30 Inexact Rounded -xadd328 add -682.796370 71131.0224 -> 70448.2260 Inexact Rounded -xcom328 compare -682.796370 71131.0224 -> -1 -xdiv328 divide -682.796370 71131.0224 -> -0.00959913617 Inexact Rounded -xdvi328 divideint -682.796370 71131.0224 -> -0 -xmul328 multiply -682.796370 71131.0224 -> -48568003.9 Inexact Rounded -xpow328 power -682.796370 71131 -> -9.28114741E+201605 Inexact Rounded -xrem328 remainder -682.796370 71131.0224 -> -682.796370 -xsub328 subtract -682.796370 71131.0224 -> -71813.8188 Inexact Rounded -xadd329 add 89.9997490 -4993.69831 -> -4903.69856 Inexact Rounded -xcom329 compare 89.9997490 -4993.69831 -> 1 -xdiv329 divide 89.9997490 -4993.69831 -> -0.0180226644 Inexact Rounded -xdvi329 divideint 89.9997490 -4993.69831 -> -0 -xmul329 multiply 89.9997490 -4993.69831 -> -449431.594 Inexact Rounded -xpow329 power 89.9997490 -4994 -> 3.30336526E-9760 Inexact Rounded -xrem329 remainder 89.9997490 -4993.69831 -> 89.9997490 -xsub329 subtract 89.9997490 -4993.69831 -> 5083.69806 Inexact Rounded -xadd330 add 76563354.6E-112338836 278271.585E-511481095 -> 7.65633546E-112338829 Inexact Rounded -xcom330 compare 76563354.6E-112338836 278271.585E-511481095 -> 1 -xdiv330 divide 76563354.6E-112338836 278271.585E-511481095 -> 2.75138960E+399142261 Inexact Rounded -xdvi330 divideint 76563354.6E-112338836 278271.585E-511481095 -> NaN Division_impossible -xmul330 multiply 76563354.6E-112338836 278271.585E-511481095 -> 2.13054060E-623819918 Inexact Rounded -xpow330 power 76563354.6E-112338836 3 -> 4.48810347E-337016485 Inexact Rounded -xrem330 remainder 76563354.6E-112338836 278271.585E-511481095 -> NaN Division_impossible -xsub330 subtract 76563354.6E-112338836 278271.585E-511481095 -> 7.65633546E-112338829 Inexact Rounded -xadd331 add -932499.010 873.377701E-502190452 -> -932499.010 Inexact Rounded -xcom331 compare -932499.010 873.377701E-502190452 -> -1 -xdiv331 divide -932499.010 873.377701E-502190452 -> -1.06769272E+502190455 Inexact Rounded -xdvi331 divideint -932499.010 873.377701E-502190452 -> NaN Division_impossible -xmul331 multiply -932499.010 873.377701E-502190452 -> -8.14423842E-502190444 Inexact Rounded -xpow331 power -932499.010 9 -> -5.33132815E+53 Inexact Rounded -xrem331 remainder -932499.010 873.377701E-502190452 -> NaN Division_impossible -xsub331 subtract -932499.010 873.377701E-502190452 -> -932499.010 Inexact Rounded -xadd332 add -7735918.21E+799514797 -7748.78023 -> -7.73591821E+799514803 Inexact Rounded -xcom332 compare -7735918.21E+799514797 -7748.78023 -> -1 -xdiv332 divide -7735918.21E+799514797 -7748.78023 -> 9.98340123E+799514799 Inexact Rounded -xdvi332 divideint -7735918.21E+799514797 -7748.78023 -> NaN Division_impossible -xmul332 multiply -7735918.21E+799514797 -7748.78023 -> 5.99439301E+799514807 Inexact Rounded -xpow332 power -7735918.21E+799514797 -7749 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem332 remainder -7735918.21E+799514797 -7748.78023 -> NaN Division_impossible -xsub332 subtract -7735918.21E+799514797 -7748.78023 -> -7.73591821E+799514803 Inexact Rounded -xadd333 add -3708780.75E+445232787 980.006567E-780728623 -> -3.70878075E+445232793 Inexact Rounded -xcom333 compare -3708780.75E+445232787 980.006567E-780728623 -> -1 -xdiv333 divide -3708780.75E+445232787 980.006567E-780728623 -> -Infinity Inexact Overflow Rounded -xdvi333 divideint -3708780.75E+445232787 980.006567E-780728623 -> NaN Division_impossible -xmul333 multiply -3708780.75E+445232787 980.006567E-780728623 -> -3.63462949E-335495827 Inexact Rounded -xpow333 power -3708780.75E+445232787 10 -> Infinity Overflow Inexact Rounded -xrem333 remainder -3708780.75E+445232787 980.006567E-780728623 -> NaN Division_impossible -xsub333 subtract -3708780.75E+445232787 980.006567E-780728623 -> -3.70878075E+445232793 Inexact Rounded -xadd334 add -5205124.44E-140588661 -495394029.E-620856313 -> -5.20512444E-140588655 Inexact Rounded -xcom334 compare -5205124.44E-140588661 -495394029.E-620856313 -> -1 -xdiv334 divide -5205124.44E-140588661 -495394029.E-620856313 -> 1.05070391E+480267650 Inexact Rounded -xdvi334 divideint -5205124.44E-140588661 -495394029.E-620856313 -> NaN Division_impossible -xmul334 multiply -5205124.44E-140588661 -495394029.E-620856313 -> 2.57858757E-761444959 Inexact Rounded -xpow334 power -5205124.44E-140588661 -5 -> -2.61724523E+702943271 Inexact Rounded -xrem334 remainder -5205124.44E-140588661 -495394029.E-620856313 -> NaN Division_impossible -xsub334 subtract -5205124.44E-140588661 -495394029.E-620856313 -> -5.20512444E-140588655 Inexact Rounded -xadd335 add -8868.72074 5592399.93 -> 5583531.21 Inexact Rounded -xcom335 compare -8868.72074 5592399.93 -> -1 -xdiv335 divide -8868.72074 5592399.93 -> -0.00158585238 Inexact Rounded -xdvi335 divideint -8868.72074 5592399.93 -> -0 -xmul335 multiply -8868.72074 5592399.93 -> -4.95974332E+10 Inexact Rounded -xpow335 power -8868.72074 5592400 -> 5.55074142E+22078017 Inexact Rounded -xrem335 remainder -8868.72074 5592399.93 -> -8868.72074 -xsub335 subtract -8868.72074 5592399.93 -> -5601268.65 Inexact Rounded -xadd336 add -74.7852037E-175205809 4.14316542 -> 4.14316542 Inexact Rounded -xcom336 compare -74.7852037E-175205809 4.14316542 -> -1 -xdiv336 divide -74.7852037E-175205809 4.14316542 -> -1.80502577E-175205808 Inexact Rounded -xdvi336 divideint -74.7852037E-175205809 4.14316542 -> -0 -xmul336 multiply -74.7852037E-175205809 4.14316542 -> -3.09847470E-175205807 Inexact Rounded -xpow336 power -74.7852037E-175205809 4 -> 3.12797104E-700823229 Inexact Rounded -xrem336 remainder -74.7852037E-175205809 4.14316542 -> -7.47852037E-175205808 -xsub336 subtract -74.7852037E-175205809 4.14316542 -> -4.14316542 Inexact Rounded -xadd337 add 84196.1091E+242628748 8.07523036E-288231467 -> 8.41961091E+242628752 Inexact Rounded -xcom337 compare 84196.1091E+242628748 8.07523036E-288231467 -> 1 -xdiv337 divide 84196.1091E+242628748 8.07523036E-288231467 -> 1.04264653E+530860219 Inexact Rounded -xdvi337 divideint 84196.1091E+242628748 8.07523036E-288231467 -> NaN Division_impossible -xmul337 multiply 84196.1091E+242628748 8.07523036E-288231467 -> 6.79902976E-45602714 Inexact Rounded -xpow337 power 84196.1091E+242628748 8 -> Infinity Overflow Inexact Rounded -xrem337 remainder 84196.1091E+242628748 8.07523036E-288231467 -> NaN Division_impossible -xsub337 subtract 84196.1091E+242628748 8.07523036E-288231467 -> 8.41961091E+242628752 Inexact Rounded -xadd338 add 38660103.1 -6671.73085E+900998477 -> -6.67173085E+900998480 Inexact Rounded -xcom338 compare 38660103.1 -6671.73085E+900998477 -> 1 -xdiv338 divide 38660103.1 -6671.73085E+900998477 -> -5.79461372E-900998474 Inexact Rounded -xdvi338 divideint 38660103.1 -6671.73085E+900998477 -> -0 -xmul338 multiply 38660103.1 -6671.73085E+900998477 -> -2.57929803E+900998488 Inexact Rounded -xpow338 power 38660103.1 -7 -> 7.74745290E-54 Inexact Rounded -xrem338 remainder 38660103.1 -6671.73085E+900998477 -> 38660103.1 -xsub338 subtract 38660103.1 -6671.73085E+900998477 -> 6.67173085E+900998480 Inexact Rounded -xadd339 add -52.2659460 -296404199E+372050476 -> -2.96404199E+372050484 Inexact Rounded -xcom339 compare -52.2659460 -296404199E+372050476 -> 1 -xdiv339 divide -52.2659460 -296404199E+372050476 -> 1.76333352E-372050483 Inexact Rounded -xdvi339 divideint -52.2659460 -296404199E+372050476 -> 0 -xmul339 multiply -52.2659460 -296404199E+372050476 -> 1.54918459E+372050486 Inexact Rounded -xpow339 power -52.2659460 -3 -> -0.00000700395833 Inexact Rounded -xrem339 remainder -52.2659460 -296404199E+372050476 -> -52.2659460 -xsub339 subtract -52.2659460 -296404199E+372050476 -> 2.96404199E+372050484 Inexact Rounded -xadd340 add 6.06625013 -276.359186 -> -270.292936 Inexact Rounded -xcom340 compare 6.06625013 -276.359186 -> 1 -xdiv340 divide 6.06625013 -276.359186 -> -0.0219506007 Inexact Rounded -xdvi340 divideint 6.06625013 -276.359186 -> -0 -xmul340 multiply 6.06625013 -276.359186 -> -1676.46395 Inexact Rounded -xpow340 power 6.06625013 -276 -> 8.20339149E-217 Inexact Rounded -xrem340 remainder 6.06625013 -276.359186 -> 6.06625013 -xsub340 subtract 6.06625013 -276.359186 -> 282.425436 Inexact Rounded -xadd341 add -62971617.5E-241444744 46266799.3 -> 46266799.3 Inexact Rounded -xcom341 compare -62971617.5E-241444744 46266799.3 -> -1 -xdiv341 divide -62971617.5E-241444744 46266799.3 -> -1.36105411E-241444744 Inexact Rounded -xdvi341 divideint -62971617.5E-241444744 46266799.3 -> -0 -xmul341 multiply -62971617.5E-241444744 46266799.3 -> -2.91349519E-241444729 Inexact Rounded -xpow341 power -62971617.5E-241444744 46266799 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem341 remainder -62971617.5E-241444744 46266799.3 -> -6.29716175E-241444737 -xsub341 subtract -62971617.5E-241444744 46266799.3 -> -46266799.3 Inexact Rounded -xadd342 add -5.36917800 -311124593.E-976066491 -> -5.36917800 Inexact Rounded -xcom342 compare -5.36917800 -311124593.E-976066491 -> -1 -xdiv342 divide -5.36917800 -311124593.E-976066491 -> 1.72573243E+976066483 Inexact Rounded -xdvi342 divideint -5.36917800 -311124593.E-976066491 -> NaN Division_impossible -xmul342 multiply -5.36917800 -311124593.E-976066491 -> 1.67048332E-976066482 Inexact Rounded -xpow342 power -5.36917800 -3 -> -0.00646065565 Inexact Rounded -xrem342 remainder -5.36917800 -311124593.E-976066491 -> NaN Division_impossible -xsub342 subtract -5.36917800 -311124593.E-976066491 -> -5.36917800 Inexact Rounded -xadd343 add 2467915.01 -92.5558322 -> 2467822.45 Inexact Rounded -xcom343 compare 2467915.01 -92.5558322 -> 1 -xdiv343 divide 2467915.01 -92.5558322 -> -26664.0681 Inexact Rounded -xdvi343 divideint 2467915.01 -92.5558322 -> -26664 -xmul343 multiply 2467915.01 -92.5558322 -> -228419928 Inexact Rounded -xpow343 power 2467915.01 -93 -> 3.26055444E-595 Inexact Rounded -xrem343 remainder 2467915.01 -92.5558322 -> 6.3002192 -xsub343 subtract 2467915.01 -92.5558322 -> 2468007.57 Inexact Rounded -xadd344 add 187.232671 -840.469347 -> -653.236676 -xcom344 compare 187.232671 -840.469347 -> 1 -xdiv344 divide 187.232671 -840.469347 -> -0.222771564 Inexact Rounded -xdvi344 divideint 187.232671 -840.469347 -> -0 -xmul344 multiply 187.232671 -840.469347 -> -157363.321 Inexact Rounded -xpow344 power 187.232671 -840 -> 1.58280862E-1909 Inexact Rounded -xrem344 remainder 187.232671 -840.469347 -> 187.232671 -xsub344 subtract 187.232671 -840.469347 -> 1027.70202 Inexact Rounded -xadd345 add 81233.6823 -5192.21666E+309315093 -> -5.19221666E+309315096 Inexact Rounded -xcom345 compare 81233.6823 -5192.21666E+309315093 -> 1 -xdiv345 divide 81233.6823 -5192.21666E+309315093 -> -1.56452798E-309315092 Inexact Rounded -xdvi345 divideint 81233.6823 -5192.21666E+309315093 -> -0 -xmul345 multiply 81233.6823 -5192.21666E+309315093 -> -4.21782879E+309315101 Inexact Rounded -xpow345 power 81233.6823 -5 -> 2.82695763E-25 Inexact Rounded -xrem345 remainder 81233.6823 -5192.21666E+309315093 -> 81233.6823 -xsub345 subtract 81233.6823 -5192.21666E+309315093 -> 5.19221666E+309315096 Inexact Rounded -xadd346 add -854.586113 -79.8715762E-853065103 -> -854.586113 Inexact Rounded -xcom346 compare -854.586113 -79.8715762E-853065103 -> -1 -xdiv346 divide -854.586113 -79.8715762E-853065103 -> 1.06995023E+853065104 Inexact Rounded -xdvi346 divideint -854.586113 -79.8715762E-853065103 -> NaN Division_impossible -xmul346 multiply -854.586113 -79.8715762E-853065103 -> 6.82571398E-853065099 Inexact Rounded -xpow346 power -854.586113 -8 -> 3.51522679E-24 Inexact Rounded -xrem346 remainder -854.586113 -79.8715762E-853065103 -> NaN Division_impossible -xsub346 subtract -854.586113 -79.8715762E-853065103 -> -854.586113 Inexact Rounded -xadd347 add 78872665.3 172.102119 -> 78872837.4 Inexact Rounded -xcom347 compare 78872665.3 172.102119 -> 1 -xdiv347 divide 78872665.3 172.102119 -> 458289.914 Inexact Rounded -xdvi347 divideint 78872665.3 172.102119 -> 458289 -xmul347 multiply 78872665.3 172.102119 -> 1.35741528E+10 Inexact Rounded -xpow347 power 78872665.3 172 -> 1.86793137E+1358 Inexact Rounded -xrem347 remainder 78872665.3 172.102119 -> 157.285609 -xsub347 subtract 78872665.3 172.102119 -> 78872493.2 Inexact Rounded -xadd348 add 328268.1E-436315617 -204.522245 -> -204.522245 Inexact Rounded -xcom348 compare 328268.1E-436315617 -204.522245 -> 1 -xdiv348 divide 328268.1E-436315617 -204.522245 -> -1.60504839E-436315614 Inexact Rounded -xdvi348 divideint 328268.1E-436315617 -204.522245 -> -0 -xmul348 multiply 328268.1E-436315617 -204.522245 -> -6.71381288E-436315610 Inexact Rounded -xpow348 power 328268.1E-436315617 -205 -> Infinity Overflow Inexact Rounded -xrem348 remainder 328268.1E-436315617 -204.522245 -> 3.282681E-436315612 -xsub348 subtract 328268.1E-436315617 -204.522245 -> 204.522245 Inexact Rounded -xadd349 add -4037911.02E+641367645 29.5713010 -> -4.03791102E+641367651 Inexact Rounded -xcom349 compare -4037911.02E+641367645 29.5713010 -> -1 -xdiv349 divide -4037911.02E+641367645 29.5713010 -> -1.36548305E+641367650 Inexact Rounded -xdvi349 divideint -4037911.02E+641367645 29.5713010 -> NaN Division_impossible -xmul349 multiply -4037911.02E+641367645 29.5713010 -> -1.19406282E+641367653 Inexact Rounded -xpow349 power -4037911.02E+641367645 30 -> Infinity Overflow Inexact Rounded -xrem349 remainder -4037911.02E+641367645 29.5713010 -> NaN Division_impossible -xsub349 subtract -4037911.02E+641367645 29.5713010 -> -4.03791102E+641367651 Inexact Rounded -xadd350 add -688755561.E-95301699 978.275312E+913812609 -> 9.78275312E+913812611 Inexact Rounded -xcom350 compare -688755561.E-95301699 978.275312E+913812609 -> -1 -xdiv350 divide -688755561.E-95301699 978.275312E+913812609 -> -0E-1000000007 Inexact Rounded Underflow Subnormal -xdvi350 divideint -688755561.E-95301699 978.275312E+913812609 -> -0 -xmul350 multiply -688755561.E-95301699 978.275312E+913812609 -> -6.73792561E+818510921 Inexact Rounded -xpow350 power -688755561.E-95301699 10 -> 2.40243244E-953016902 Inexact Rounded -xrem350 remainder -688755561.E-95301699 978.275312E+913812609 -> -6.88755561E-95301691 -xsub350 subtract -688755561.E-95301699 978.275312E+913812609 -> -9.78275312E+913812611 Inexact Rounded -xadd351 add -5.47345502 59818.7580 -> 59813.2845 Inexact Rounded -xcom351 compare -5.47345502 59818.7580 -> -1 -xdiv351 divide -5.47345502 59818.7580 -> -0.0000915006463 Inexact Rounded -xdvi351 divideint -5.47345502 59818.7580 -> -0 -xmul351 multiply -5.47345502 59818.7580 -> -327415.281 Inexact Rounded -xpow351 power -5.47345502 59819 -> -1.16914146E+44162 Inexact Rounded -xrem351 remainder -5.47345502 59818.7580 -> -5.47345502 -xsub351 subtract -5.47345502 59818.7580 -> -59824.2315 Inexact Rounded -xadd352 add 563891620E-361354567 -845900362. -> -845900362 Inexact Rounded -xcom352 compare 563891620E-361354567 -845900362. -> 1 -xdiv352 divide 563891620E-361354567 -845900362. -> -6.66617069E-361354568 Inexact Rounded -xdvi352 divideint 563891620E-361354567 -845900362. -> -0 -xmul352 multiply 563891620E-361354567 -845900362. -> -4.76996125E-361354550 Inexact Rounded -xpow352 power 563891620E-361354567 -845900362 -> Infinity Overflow Inexact Rounded -xrem352 remainder 563891620E-361354567 -845900362. -> 5.63891620E-361354559 -xsub352 subtract 563891620E-361354567 -845900362. -> 845900362 Inexact Rounded -xadd353 add -69.7231286 85773.7504 -> 85704.0273 Inexact Rounded -xcom353 compare -69.7231286 85773.7504 -> -1 -xdiv353 divide -69.7231286 85773.7504 -> -0.000812872566 Inexact Rounded -xdvi353 divideint -69.7231286 85773.7504 -> -0 -xmul353 multiply -69.7231286 85773.7504 -> -5980414.23 Inexact Rounded -xpow353 power -69.7231286 85774 -> 6.41714261E+158113 Inexact Rounded -xrem353 remainder -69.7231286 85773.7504 -> -69.7231286 -xsub353 subtract -69.7231286 85773.7504 -> -85843.4735 Inexact Rounded -xadd354 add 5125.51188 73814638.4E-500934741 -> 5125.51188 Inexact Rounded -xcom354 compare 5125.51188 73814638.4E-500934741 -> 1 -xdiv354 divide 5125.51188 73814638.4E-500934741 -> 6.94376074E+500934736 Inexact Rounded -xdvi354 divideint 5125.51188 73814638.4E-500934741 -> NaN Division_impossible -xmul354 multiply 5125.51188 73814638.4E-500934741 -> 3.78337806E-500934730 Inexact Rounded -xpow354 power 5125.51188 7 -> 9.29310216E+25 Inexact Rounded -xrem354 remainder 5125.51188 73814638.4E-500934741 -> NaN Division_impossible -xsub354 subtract 5125.51188 73814638.4E-500934741 -> 5125.51188 Inexact Rounded -xadd355 add -54.6254096 -332921899. -> -332921954 Inexact Rounded -xcom355 compare -54.6254096 -332921899. -> 1 -xdiv355 divide -54.6254096 -332921899. -> 1.64078752E-7 Inexact Rounded -xdvi355 divideint -54.6254096 -332921899. -> 0 -xmul355 multiply -54.6254096 -332921899. -> 1.81859951E+10 Inexact Rounded -xpow355 power -54.6254096 -332921899 -> -1.01482569E-578416745 Inexact Rounded -xrem355 remainder -54.6254096 -332921899. -> -54.6254096 -xsub355 subtract -54.6254096 -332921899. -> 332921844 Inexact Rounded -xadd356 add -9.04778095E-591874079 8719.40286 -> 8719.40286 Inexact Rounded -xcom356 compare -9.04778095E-591874079 8719.40286 -> -1 -xdiv356 divide -9.04778095E-591874079 8719.40286 -> -1.03766062E-591874082 Inexact Rounded -xdvi356 divideint -9.04778095E-591874079 8719.40286 -> -0 -xmul356 multiply -9.04778095E-591874079 8719.40286 -> -7.88912471E-591874075 Inexact Rounded -xpow356 power -9.04778095E-591874079 8719 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem356 remainder -9.04778095E-591874079 8719.40286 -> -9.04778095E-591874079 -xsub356 subtract -9.04778095E-591874079 8719.40286 -> -8719.40286 Inexact Rounded -xadd357 add -21006.1733E+884684431 -48872.9175 -> -2.10061733E+884684435 Inexact Rounded -xcom357 compare -21006.1733E+884684431 -48872.9175 -> -1 -xdiv357 divide -21006.1733E+884684431 -48872.9175 -> 4.29812141E+884684430 Inexact Rounded -xdvi357 divideint -21006.1733E+884684431 -48872.9175 -> NaN Division_impossible -xmul357 multiply -21006.1733E+884684431 -48872.9175 -> 1.02663297E+884684440 Inexact Rounded -xpow357 power -21006.1733E+884684431 -48873 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem357 remainder -21006.1733E+884684431 -48872.9175 -> NaN Division_impossible -xsub357 subtract -21006.1733E+884684431 -48872.9175 -> -2.10061733E+884684435 Inexact Rounded -xadd358 add -1546783 -51935370.4 -> -53482153.4 -xcom358 compare -1546783 -51935370.4 -> 1 -xdiv358 divide -1546783 -51935370.4 -> 0.0297828433 Inexact Rounded -xdvi358 divideint -1546783 -51935370.4 -> 0 -xmul358 multiply -1546783 -51935370.4 -> 8.03327480E+13 Inexact Rounded -xpow358 power -1546783 -51935370 -> 3.36022461E-321450306 Inexact Rounded -xrem358 remainder -1546783 -51935370.4 -> -1546783.0 -xsub358 subtract -1546783 -51935370.4 -> 50388587.4 -xadd359 add 61302486.8 205.490417 -> 61302692.3 Inexact Rounded -xcom359 compare 61302486.8 205.490417 -> 1 -xdiv359 divide 61302486.8 205.490417 -> 298322.850 Inexact Rounded -xdvi359 divideint 61302486.8 205.490417 -> 298322 -xmul359 multiply 61302486.8 205.490417 -> 1.25970736E+10 Inexact Rounded -xpow359 power 61302486.8 205 -> 2.71024755E+1596 Inexact Rounded -xrem359 remainder 61302486.8 205.490417 -> 174.619726 -xsub359 subtract 61302486.8 205.490417 -> 61302281.3 Inexact Rounded -xadd360 add -318180109. -54008744.6E-170931002 -> -318180109 Inexact Rounded -xcom360 compare -318180109. -54008744.6E-170931002 -> -1 -xdiv360 divide -318180109. -54008744.6E-170931002 -> 5.89127023E+170931002 Inexact Rounded -xdvi360 divideint -318180109. -54008744.6E-170931002 -> NaN Division_impossible -xmul360 multiply -318180109. -54008744.6E-170931002 -> 1.71845082E-170930986 Inexact Rounded -xpow360 power -318180109. -5 -> -3.06644280E-43 Inexact Rounded -xrem360 remainder -318180109. -54008744.6E-170931002 -> NaN Division_impossible -xsub360 subtract -318180109. -54008744.6E-170931002 -> -318180109 Inexact Rounded -xadd361 add -28486137.1E+901441714 -42454.940 -> -2.84861371E+901441721 Inexact Rounded -xcom361 compare -28486137.1E+901441714 -42454.940 -> -1 -xdiv361 divide -28486137.1E+901441714 -42454.940 -> 6.70973439E+901441716 Inexact Rounded -xdvi361 divideint -28486137.1E+901441714 -42454.940 -> NaN Division_impossible -xmul361 multiply -28486137.1E+901441714 -42454.940 -> 1.20937724E+901441726 Inexact Rounded -xpow361 power -28486137.1E+901441714 -42455 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem361 remainder -28486137.1E+901441714 -42454.940 -> NaN Division_impossible -xsub361 subtract -28486137.1E+901441714 -42454.940 -> -2.84861371E+901441721 Inexact Rounded -xadd362 add -546398328. -27.9149712 -> -546398356 Inexact Rounded -xcom362 compare -546398328. -27.9149712 -> -1 -xdiv362 divide -546398328. -27.9149712 -> 19573666.2 Inexact Rounded -xdvi362 divideint -546398328. -27.9149712 -> 19573666 -xmul362 multiply -546398328. -27.9149712 -> 1.52526936E+10 Inexact Rounded -xpow362 power -546398328. -28 -> 2.23737032E-245 Inexact Rounded -xrem362 remainder -546398328. -27.9149712 -> -5.3315808 -xsub362 subtract -546398328. -27.9149712 -> -546398300 Inexact Rounded -xadd363 add 5402066.1E-284978216 622.751128 -> 622.751128 Inexact Rounded -xcom363 compare 5402066.1E-284978216 622.751128 -> -1 -xdiv363 divide 5402066.1E-284978216 622.751128 -> 8.67451837E-284978213 Inexact Rounded -xdvi363 divideint 5402066.1E-284978216 622.751128 -> 0 -xmul363 multiply 5402066.1E-284978216 622.751128 -> 3.36414276E-284978207 Inexact Rounded -xpow363 power 5402066.1E-284978216 623 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem363 remainder 5402066.1E-284978216 622.751128 -> 5.4020661E-284978210 -xsub363 subtract 5402066.1E-284978216 622.751128 -> -622.751128 Inexact Rounded -xadd364 add 18845620 3129.43753 -> 18848749.4 Inexact Rounded -xcom364 compare 18845620 3129.43753 -> 1 -xdiv364 divide 18845620 3129.43753 -> 6022.04704 Inexact Rounded -xdvi364 divideint 18845620 3129.43753 -> 6022 -xmul364 multiply 18845620 3129.43753 -> 5.89761905E+10 Inexact Rounded -xpow364 power 18845620 3129 -> 1.35967443E+22764 Inexact Rounded -xrem364 remainder 18845620 3129.43753 -> 147.19434 -xsub364 subtract 18845620 3129.43753 -> 18842490.6 Inexact Rounded -xadd365 add 50707.1412E+912475670 -198098.186E+701407524 -> 5.07071412E+912475674 Inexact Rounded -xcom365 compare 50707.1412E+912475670 -198098.186E+701407524 -> 1 -xdiv365 divide 50707.1412E+912475670 -198098.186E+701407524 -> -2.55969740E+211068145 Inexact Rounded -xdvi365 divideint 50707.1412E+912475670 -198098.186E+701407524 -> NaN Division_impossible -xmul365 multiply 50707.1412E+912475670 -198098.186E+701407524 -> -Infinity Inexact Overflow Rounded -xpow365 power 50707.1412E+912475670 -2 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem365 remainder 50707.1412E+912475670 -198098.186E+701407524 -> NaN Division_impossible -xsub365 subtract 50707.1412E+912475670 -198098.186E+701407524 -> 5.07071412E+912475674 Inexact Rounded -xadd366 add 55.8245006E+928885991 99170843.9E-47402167 -> 5.58245006E+928885992 Inexact Rounded -xcom366 compare 55.8245006E+928885991 99170843.9E-47402167 -> 1 -xdiv366 divide 55.8245006E+928885991 99170843.9E-47402167 -> 5.62912429E+976288151 Inexact Rounded -xdvi366 divideint 55.8245006E+928885991 99170843.9E-47402167 -> NaN Division_impossible -xmul366 multiply 55.8245006E+928885991 99170843.9E-47402167 -> 5.53616283E+881483833 Inexact Rounded -xpow366 power 55.8245006E+928885991 10 -> Infinity Overflow Inexact Rounded -xrem366 remainder 55.8245006E+928885991 99170843.9E-47402167 -> NaN Division_impossible -xsub366 subtract 55.8245006E+928885991 99170843.9E-47402167 -> 5.58245006E+928885992 Inexact Rounded -xadd367 add 13.8003883E-386224921 -84126481.9E-296378341 -> -8.41264819E-296378334 Inexact Rounded -xcom367 compare 13.8003883E-386224921 -84126481.9E-296378341 -> 1 -xdiv367 divide 13.8003883E-386224921 -84126481.9E-296378341 -> -1.64043331E-89846587 Inexact Rounded -xdvi367 divideint 13.8003883E-386224921 -84126481.9E-296378341 -> -0 -xmul367 multiply 13.8003883E-386224921 -84126481.9E-296378341 -> -1.16097812E-682603253 Inexact Rounded -xpow367 power 13.8003883E-386224921 -8 -> Infinity Overflow Inexact Rounded -xrem367 remainder 13.8003883E-386224921 -84126481.9E-296378341 -> 1.38003883E-386224920 -xsub367 subtract 13.8003883E-386224921 -84126481.9E-296378341 -> 8.41264819E-296378334 Inexact Rounded -xadd368 add 9820.90457 46671.5915 -> 56492.4961 Inexact Rounded -xcom368 compare 9820.90457 46671.5915 -> -1 -xdiv368 divide 9820.90457 46671.5915 -> 0.210425748 Inexact Rounded -xdvi368 divideint 9820.90457 46671.5915 -> 0 -xmul368 multiply 9820.90457 46671.5915 -> 458357246 Inexact Rounded -xpow368 power 9820.90457 46672 -> 4.94753070E+186321 Inexact Rounded -xrem368 remainder 9820.90457 46671.5915 -> 9820.90457 -xsub368 subtract 9820.90457 46671.5915 -> -36850.6869 Inexact Rounded -xadd369 add 7.22436006E+831949153 -11168830E+322331045 -> 7.22436006E+831949153 Inexact Rounded -xcom369 compare 7.22436006E+831949153 -11168830E+322331045 -> 1 -xdiv369 divide 7.22436006E+831949153 -11168830E+322331045 -> -6.46832306E+509618101 Inexact Rounded -xdvi369 divideint 7.22436006E+831949153 -11168830E+322331045 -> NaN Division_impossible -xmul369 multiply 7.22436006E+831949153 -11168830E+322331045 -> -Infinity Inexact Overflow Rounded -xpow369 power 7.22436006E+831949153 -1 -> 1.38420565E-831949154 Inexact Rounded -xrem369 remainder 7.22436006E+831949153 -11168830E+322331045 -> NaN Division_impossible -xsub369 subtract 7.22436006E+831949153 -11168830E+322331045 -> 7.22436006E+831949153 Inexact Rounded -xadd370 add 472648900 -207.784153 -> 472648692 Inexact Rounded -xcom370 compare 472648900 -207.784153 -> 1 -xdiv370 divide 472648900 -207.784153 -> -2274711.01 Inexact Rounded -xdvi370 divideint 472648900 -207.784153 -> -2274711 -xmul370 multiply 472648900 -207.784153 -> -9.82089514E+10 Inexact Rounded -xpow370 power 472648900 -208 -> 4.96547145E-1805 Inexact Rounded -xrem370 remainder 472648900 -207.784153 -> 1.545217 -xsub370 subtract 472648900 -207.784153 -> 472649108 Inexact Rounded -xadd371 add -8754.49306 -818.165153E+631475457 -> -8.18165153E+631475459 Inexact Rounded -xcom371 compare -8754.49306 -818.165153E+631475457 -> 1 -xdiv371 divide -8754.49306 -818.165153E+631475457 -> 1.07001539E-631475456 Inexact Rounded -xdvi371 divideint -8754.49306 -818.165153E+631475457 -> 0 -xmul371 multiply -8754.49306 -818.165153E+631475457 -> 7.16262115E+631475463 Inexact Rounded -xpow371 power -8754.49306 -8 -> 2.89835767E-32 Inexact Rounded -xrem371 remainder -8754.49306 -818.165153E+631475457 -> -8754.49306 -xsub371 subtract -8754.49306 -818.165153E+631475457 -> 8.18165153E+631475459 Inexact Rounded -xadd372 add 98750864 191380.551 -> 98942244.6 Inexact Rounded -xcom372 compare 98750864 191380.551 -> 1 -xdiv372 divide 98750864 191380.551 -> 515.992161 Inexact Rounded -xdvi372 divideint 98750864 191380.551 -> 515 -xmul372 multiply 98750864 191380.551 -> 1.88989948E+13 Inexact Rounded -xpow372 power 98750864 191381 -> 1.70908809E+1530003 Inexact Rounded -xrem372 remainder 98750864 191380.551 -> 189880.235 -xsub372 subtract 98750864 191380.551 -> 98559483.4 Inexact Rounded -xadd373 add 725292561. -768963606.E+340762986 -> -7.68963606E+340762994 Inexact Rounded -xcom373 compare 725292561. -768963606.E+340762986 -> 1 -xdiv373 divide 725292561. -768963606.E+340762986 -> -9.43207917E-340762987 Inexact Rounded -xdvi373 divideint 725292561. -768963606.E+340762986 -> -0 -xmul373 multiply 725292561. -768963606.E+340762986 -> -5.57723583E+340763003 Inexact Rounded -xpow373 power 725292561. -8 -> 1.30585277E-71 Inexact Rounded -xrem373 remainder 725292561. -768963606.E+340762986 -> 725292561 -xsub373 subtract 725292561. -768963606.E+340762986 -> 7.68963606E+340762994 Inexact Rounded -xadd374 add 1862.80445 648254483. -> 648256346 Inexact Rounded -xcom374 compare 1862.80445 648254483. -> -1 -xdiv374 divide 1862.80445 648254483. -> 0.00000287356972 Inexact Rounded -xdvi374 divideint 1862.80445 648254483. -> 0 -xmul374 multiply 1862.80445 648254483. -> 1.20757134E+12 Inexact Rounded -xpow374 power 1862.80445 648254483 -> Infinity Overflow Inexact Rounded -xrem374 remainder 1862.80445 648254483. -> 1862.80445 -xsub374 subtract 1862.80445 648254483. -> -648252620 Inexact Rounded -xadd375 add -5549320.1 -93580684.1 -> -99130004.2 -xcom375 compare -5549320.1 -93580684.1 -> 1 -xdiv375 divide -5549320.1 -93580684.1 -> 0.0592998454 Inexact Rounded -xdvi375 divideint -5549320.1 -93580684.1 -> 0 -xmul375 multiply -5549320.1 -93580684.1 -> 5.19309171E+14 Inexact Rounded -xpow375 power -5549320.1 -93580684 -> 4.20662080E-631130572 Inexact Rounded -xrem375 remainder -5549320.1 -93580684.1 -> -5549320.1 -xsub375 subtract -5549320.1 -93580684.1 -> 88031364.0 -xadd376 add -14677053.1 -25784.7358 -> -14702837.8 Inexact Rounded -xcom376 compare -14677053.1 -25784.7358 -> -1 -xdiv376 divide -14677053.1 -25784.7358 -> 569.214795 Inexact Rounded -xdvi376 divideint -14677053.1 -25784.7358 -> 569 -xmul376 multiply -14677053.1 -25784.7358 -> 3.78443937E+11 Inexact Rounded -xpow376 power -14677053.1 -25785 -> -1.64760831E-184792 Inexact Rounded -xrem376 remainder -14677053.1 -25784.7358 -> -5538.4298 -xsub376 subtract -14677053.1 -25784.7358 -> -14651268.4 Inexact Rounded -xadd377 add 547402.308E+571687617 -7835797.01E+500067364 -> 5.47402308E+571687622 Inexact Rounded -xcom377 compare 547402.308E+571687617 -7835797.01E+500067364 -> 1 -xdiv377 divide 547402.308E+571687617 -7835797.01E+500067364 -> -6.98591742E+71620251 Inexact Rounded -xdvi377 divideint 547402.308E+571687617 -7835797.01E+500067364 -> NaN Division_impossible -xmul377 multiply 547402.308E+571687617 -7835797.01E+500067364 -> -Infinity Inexact Overflow Rounded -xpow377 power 547402.308E+571687617 -8 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem377 remainder 547402.308E+571687617 -7835797.01E+500067364 -> NaN Division_impossible -xsub377 subtract 547402.308E+571687617 -7835797.01E+500067364 -> 5.47402308E+571687622 Inexact Rounded -xadd378 add -4131738.09 7579.07566 -> -4124159.01 Inexact Rounded -xcom378 compare -4131738.09 7579.07566 -> -1 -xdiv378 divide -4131738.09 7579.07566 -> -545.150659 Inexact Rounded -xdvi378 divideint -4131738.09 7579.07566 -> -545 -xmul378 multiply -4131738.09 7579.07566 -> -3.13147556E+10 Inexact Rounded -xpow378 power -4131738.09 7579 -> -4.68132794E+50143 Inexact Rounded -xrem378 remainder -4131738.09 7579.07566 -> -1141.85530 -xsub378 subtract -4131738.09 7579.07566 -> -4139317.17 Inexact Rounded -xadd379 add 504544.648 -7678.96133E-662143268 -> 504544.648 Inexact Rounded -xcom379 compare 504544.648 -7678.96133E-662143268 -> 1 -xdiv379 divide 504544.648 -7678.96133E-662143268 -> -6.57048039E+662143269 Inexact Rounded -xdvi379 divideint 504544.648 -7678.96133E-662143268 -> NaN Division_impossible -xmul379 multiply 504544.648 -7678.96133E-662143268 -> -3.87437884E-662143259 Inexact Rounded -xpow379 power 504544.648 -8 -> 2.38124001E-46 Inexact Rounded -xrem379 remainder 504544.648 -7678.96133E-662143268 -> NaN Division_impossible -xsub379 subtract 504544.648 -7678.96133E-662143268 -> 504544.648 Inexact Rounded -xadd380 add 829898241 8912.99114E+929228149 -> 8.91299114E+929228152 Inexact Rounded -xcom380 compare 829898241 8912.99114E+929228149 -> -1 -xdiv380 divide 829898241 8912.99114E+929228149 -> 9.31110811E-929228145 Inexact Rounded -xdvi380 divideint 829898241 8912.99114E+929228149 -> 0 -xmul380 multiply 829898241 8912.99114E+929228149 -> 7.39687567E+929228161 Inexact Rounded -xpow380 power 829898241 9 -> 1.86734084E+80 Inexact Rounded -xrem380 remainder 829898241 8912.99114E+929228149 -> 829898241 -xsub380 subtract 829898241 8912.99114E+929228149 -> -8.91299114E+929228152 Inexact Rounded -xadd381 add 53.6891691 -11.2371140 -> 42.4520551 -xcom381 compare 53.6891691 -11.2371140 -> 1 -xdiv381 divide 53.6891691 -11.2371140 -> -4.77784323 Inexact Rounded -xdvi381 divideint 53.6891691 -11.2371140 -> -4 -xmul381 multiply 53.6891691 -11.2371140 -> -603.311314 Inexact Rounded -xpow381 power 53.6891691 -11 -> 9.35936725E-20 Inexact Rounded -xrem381 remainder 53.6891691 -11.2371140 -> 8.7407131 -xsub381 subtract 53.6891691 -11.2371140 -> 64.9262831 -xadd382 add -93951823.4 -25317.8645 -> -93977141.3 Inexact Rounded -xcom382 compare -93951823.4 -25317.8645 -> -1 -xdiv382 divide -93951823.4 -25317.8645 -> 3710.89052 Inexact Rounded -xdvi382 divideint -93951823.4 -25317.8645 -> 3710 -xmul382 multiply -93951823.4 -25317.8645 -> 2.37865953E+12 Inexact Rounded -xpow382 power -93951823.4 -25318 -> 9.67857714E-201859 Inexact Rounded -xrem382 remainder -93951823.4 -25317.8645 -> -22546.1050 -xsub382 subtract -93951823.4 -25317.8645 -> -93926505.5 Inexact Rounded -xadd383 add 446919.123 951338490. -> 951785409 Inexact Rounded -xcom383 compare 446919.123 951338490. -> -1 -xdiv383 divide 446919.123 951338490. -> 0.000469779293 Inexact Rounded -xdvi383 divideint 446919.123 951338490. -> 0 -xmul383 multiply 446919.123 951338490. -> 4.25171364E+14 Inexact Rounded -xpow383 power 446919.123 951338490 -> Infinity Overflow Inexact Rounded -xrem383 remainder 446919.123 951338490. -> 446919.123 -xsub383 subtract 446919.123 951338490. -> -950891571 Inexact Rounded -xadd384 add -8.01787748 -88.3076852 -> -96.3255627 Inexact Rounded -xcom384 compare -8.01787748 -88.3076852 -> 1 -xdiv384 divide -8.01787748 -88.3076852 -> 0.0907947871 Inexact Rounded -xdvi384 divideint -8.01787748 -88.3076852 -> 0 -xmul384 multiply -8.01787748 -88.3076852 -> 708.040200 Inexact Rounded -xpow384 power -8.01787748 -88 -> 2.77186088E-80 Inexact Rounded -xrem384 remainder -8.01787748 -88.3076852 -> -8.01787748 -xsub384 subtract -8.01787748 -88.3076852 -> 80.2898077 Inexact Rounded -xadd385 add 517458139 -999731.548 -> 516458407 Inexact Rounded -xcom385 compare 517458139 -999731.548 -> 1 -xdiv385 divide 517458139 -999731.548 -> -517.597089 Inexact Rounded -xdvi385 divideint 517458139 -999731.548 -> -517 -xmul385 multiply 517458139 -999731.548 -> -5.17319226E+14 Inexact Rounded -xpow385 power 517458139 -999732 -> 1.24821346E-8711540 Inexact Rounded -xrem385 remainder 517458139 -999731.548 -> 596928.684 -xsub385 subtract 517458139 -999731.548 -> 518457871 Inexact Rounded -xadd386 add -405543440 -4013.18295 -> -405547453 Inexact Rounded -xcom386 compare -405543440 -4013.18295 -> -1 -xdiv386 divide -405543440 -4013.18295 -> 101052.816 Inexact Rounded -xdvi386 divideint -405543440 -4013.18295 -> 101052 -xmul386 multiply -405543440 -4013.18295 -> 1.62752002E+12 Inexact Rounded -xpow386 power -405543440 -4013 -> -8.83061932E-34545 Inexact Rounded -xrem386 remainder -405543440 -4013.18295 -> -3276.53660 -xsub386 subtract -405543440 -4013.18295 -> -405539427 Inexact Rounded -xadd387 add -49245250.1E+682760825 -848776.637 -> -4.92452501E+682760832 Inexact Rounded -xcom387 compare -49245250.1E+682760825 -848776.637 -> -1 -xdiv387 divide -49245250.1E+682760825 -848776.637 -> 5.80190924E+682760826 Inexact Rounded -xdvi387 divideint -49245250.1E+682760825 -848776.637 -> NaN Division_impossible -xmul387 multiply -49245250.1E+682760825 -848776.637 -> 4.17982178E+682760838 Inexact Rounded -xpow387 power -49245250.1E+682760825 -848777 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem387 remainder -49245250.1E+682760825 -848776.637 -> NaN Division_impossible -xsub387 subtract -49245250.1E+682760825 -848776.637 -> -4.92452501E+682760832 Inexact Rounded -xadd388 add -151144455 -170371.29 -> -151314826 Inexact Rounded -xcom388 compare -151144455 -170371.29 -> -1 -xdiv388 divide -151144455 -170371.29 -> 887.147447 Inexact Rounded -xdvi388 divideint -151144455 -170371.29 -> 887 -xmul388 multiply -151144455 -170371.29 -> 2.57506758E+13 Inexact Rounded -xpow388 power -151144455 -170371 -> -5.86496369E-1393532 Inexact Rounded -xrem388 remainder -151144455 -170371.29 -> -25120.77 -xsub388 subtract -151144455 -170371.29 -> -150974084 Inexact Rounded -xadd389 add -729236746.E+662737067 9.10823602 -> -7.29236746E+662737075 Inexact Rounded -xcom389 compare -729236746.E+662737067 9.10823602 -> -1 -xdiv389 divide -729236746.E+662737067 9.10823602 -> -8.00634442E+662737074 Inexact Rounded -xdvi389 divideint -729236746.E+662737067 9.10823602 -> NaN Division_impossible -xmul389 multiply -729236746.E+662737067 9.10823602 -> -6.64206040E+662737076 Inexact Rounded -xpow389 power -729236746.E+662737067 9 -> -Infinity Overflow Inexact Rounded -xrem389 remainder -729236746.E+662737067 9.10823602 -> NaN Division_impossible -xsub389 subtract -729236746.E+662737067 9.10823602 -> -7.29236746E+662737075 Inexact Rounded -xadd390 add 534.394729 -2369839.37 -> -2369304.98 Inexact Rounded -xcom390 compare 534.394729 -2369839.37 -> 1 -xdiv390 divide 534.394729 -2369839.37 -> -0.000225498291 Inexact Rounded -xdvi390 divideint 534.394729 -2369839.37 -> -0 -xmul390 multiply 534.394729 -2369839.37 -> -1.26642967E+9 Inexact Rounded -xpow390 power 534.394729 -2369839 -> 7.12522896E-6464595 Inexact Rounded -xrem390 remainder 534.394729 -2369839.37 -> 534.394729 -xsub390 subtract 534.394729 -2369839.37 -> 2370373.76 Inexact Rounded -xadd391 add 89100.1797 224.370309 -> 89324.5500 Inexact Rounded -xcom391 compare 89100.1797 224.370309 -> 1 -xdiv391 divide 89100.1797 224.370309 -> 397.112167 Inexact Rounded -xdvi391 divideint 89100.1797 224.370309 -> 397 -xmul391 multiply 89100.1797 224.370309 -> 19991434.9 Inexact Rounded -xpow391 power 89100.1797 224 -> 5.92654936E+1108 Inexact Rounded -xrem391 remainder 89100.1797 224.370309 -> 25.167027 -xsub391 subtract 89100.1797 224.370309 -> 88875.8094 Inexact Rounded -xadd392 add -821377.777 38.552821 -> -821339.224 Inexact Rounded -xcom392 compare -821377.777 38.552821 -> -1 -xdiv392 divide -821377.777 38.552821 -> -21305.2575 Inexact Rounded -xdvi392 divideint -821377.777 38.552821 -> -21305 -xmul392 multiply -821377.777 38.552821 -> -31666430.4 Inexact Rounded -xpow392 power -821377.777 39 -> -4.64702482E+230 Inexact Rounded -xrem392 remainder -821377.777 38.552821 -> -9.925595 -xsub392 subtract -821377.777 38.552821 -> -821416.330 Inexact Rounded -xadd393 add -392640.782 -2571619.5E+113237865 -> -2.57161950E+113237871 Inexact Rounded -xcom393 compare -392640.782 -2571619.5E+113237865 -> 1 -xdiv393 divide -392640.782 -2571619.5E+113237865 -> 1.52682301E-113237866 Inexact Rounded -xdvi393 divideint -392640.782 -2571619.5E+113237865 -> 0 -xmul393 multiply -392640.782 -2571619.5E+113237865 -> 1.00972269E+113237877 Inexact Rounded -xpow393 power -392640.782 -3 -> -1.65201422E-17 Inexact Rounded -xrem393 remainder -392640.782 -2571619.5E+113237865 -> -392640.782 -xsub393 subtract -392640.782 -2571619.5E+113237865 -> 2.57161950E+113237871 Inexact Rounded -xadd394 add -651397.712 -723.59673 -> -652121.309 Inexact Rounded -xcom394 compare -651397.712 -723.59673 -> -1 -xdiv394 divide -651397.712 -723.59673 -> 900.222023 Inexact Rounded -xdvi394 divideint -651397.712 -723.59673 -> 900 -xmul394 multiply -651397.712 -723.59673 -> 471349254 Inexact Rounded -xpow394 power -651397.712 -724 -> 5.96115415E-4210 Inexact Rounded -xrem394 remainder -651397.712 -723.59673 -> -160.65500 -xsub394 subtract -651397.712 -723.59673 -> -650674.115 Inexact Rounded -xadd395 add 86.6890892 940380864 -> 940380951 Inexact Rounded -xcom395 compare 86.6890892 940380864 -> -1 -xdiv395 divide 86.6890892 940380864 -> 9.21850843E-8 Inexact Rounded -xdvi395 divideint 86.6890892 940380864 -> 0 -xmul395 multiply 86.6890892 940380864 -> 8.15207606E+10 Inexact Rounded -xpow395 power 86.6890892 940380864 -> Infinity Overflow Inexact Rounded -xrem395 remainder 86.6890892 940380864 -> 86.6890892 -xsub395 subtract 86.6890892 940380864 -> -940380777 Inexact Rounded -xadd396 add 4880.06442E-382222621 -115627239E-912834031 -> 4.88006442E-382222618 Inexact Rounded -xcom396 compare 4880.06442E-382222621 -115627239E-912834031 -> 1 -xdiv396 divide 4880.06442E-382222621 -115627239E-912834031 -> -4.22051453E+530611405 Inexact Rounded -xdvi396 divideint 4880.06442E-382222621 -115627239E-912834031 -> NaN Division_impossible -xmul396 multiply 4880.06442E-382222621 -115627239E-912834031 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow396 power 4880.06442E-382222621 -1 -> 2.04915328E+382222617 Inexact Rounded -xrem396 remainder 4880.06442E-382222621 -115627239E-912834031 -> NaN Division_impossible -xsub396 subtract 4880.06442E-382222621 -115627239E-912834031 -> 4.88006442E-382222618 Inexact Rounded -xadd397 add 173398265E-532383158 3462.51450E+80986915 -> 3.46251450E+80986918 Inexact Rounded -xcom397 compare 173398265E-532383158 3462.51450E+80986915 -> -1 -xdiv397 divide 173398265E-532383158 3462.51450E+80986915 -> 5.00787116E-613370069 Inexact Rounded -xdvi397 divideint 173398265E-532383158 3462.51450E+80986915 -> 0 -xmul397 multiply 173398265E-532383158 3462.51450E+80986915 -> 6.00394007E-451396232 Inexact Rounded -xpow397 power 173398265E-532383158 3 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem397 remainder 173398265E-532383158 3462.51450E+80986915 -> 1.73398265E-532383150 -xsub397 subtract 173398265E-532383158 3462.51450E+80986915 -> -3.46251450E+80986918 Inexact Rounded -xadd398 add -1522176.78 -6631061.77 -> -8153238.55 -xcom398 compare -1522176.78 -6631061.77 -> 1 -xdiv398 divide -1522176.78 -6631061.77 -> 0.229552496 Inexact Rounded -xdvi398 divideint -1522176.78 -6631061.77 -> 0 -xmul398 multiply -1522176.78 -6631061.77 -> 1.00936483E+13 Inexact Rounded -xpow398 power -1522176.78 -6631062 -> 4.54268854E-40996310 Inexact Rounded -xrem398 remainder -1522176.78 -6631061.77 -> -1522176.78 -xsub398 subtract -1522176.78 -6631061.77 -> 5108884.99 -xadd399 add 538.10453 522934310 -> 522934848 Inexact Rounded -xcom399 compare 538.10453 522934310 -> -1 -xdiv399 divide 538.10453 522934310 -> 0.00000102900980 Inexact Rounded -xdvi399 divideint 538.10453 522934310 -> 0 -xmul399 multiply 538.10453 522934310 -> 2.81393321E+11 Inexact Rounded -xpow399 power 538.10453 522934310 -> Infinity Overflow Inexact Rounded -xrem399 remainder 538.10453 522934310 -> 538.10453 -xsub399 subtract 538.10453 522934310 -> -522933772 Inexact Rounded -xadd400 add 880243.444E-750940977 -354.601578E-204943740 -> -3.54601578E-204943738 Inexact Rounded -xcom400 compare 880243.444E-750940977 -354.601578E-204943740 -> 1 -xdiv400 divide 880243.444E-750940977 -354.601578E-204943740 -> -2.48234497E-545997234 Inexact Rounded -xdvi400 divideint 880243.444E-750940977 -354.601578E-204943740 -> -0 -xmul400 multiply 880243.444E-750940977 -354.601578E-204943740 -> -3.12135714E-955884709 Inexact Rounded -xpow400 power 880243.444E-750940977 -4 -> Infinity Overflow Inexact Rounded -xrem400 remainder 880243.444E-750940977 -354.601578E-204943740 -> 8.80243444E-750940972 -xsub400 subtract 880243.444E-750940977 -354.601578E-204943740 -> 3.54601578E-204943738 Inexact Rounded -xadd401 add 968370.780 6677268.73 -> 7645639.51 Rounded -xcom401 compare 968370.780 6677268.73 -> -1 -xdiv401 divide 968370.780 6677268.73 -> 0.145024982 Inexact Rounded -xdvi401 divideint 968370.780 6677268.73 -> 0 -xmul401 multiply 968370.780 6677268.73 -> 6.46607193E+12 Inexact Rounded -xpow401 power 968370.780 6677269 -> 3.29990931E+39970410 Inexact Rounded -xrem401 remainder 968370.780 6677268.73 -> 968370.780 -xsub401 subtract 968370.780 6677268.73 -> -5708897.95 Rounded -xadd402 add -97.7474945 31248241.5 -> 31248143.8 Inexact Rounded -xcom402 compare -97.7474945 31248241.5 -> -1 -xdiv402 divide -97.7474945 31248241.5 -> -0.00000312809585 Inexact Rounded -xdvi402 divideint -97.7474945 31248241.5 -> -0 -xmul402 multiply -97.7474945 31248241.5 -> -3.05443731E+9 Inexact Rounded -xpow402 power -97.7474945 31248242 -> 2.90714257E+62187302 Inexact Rounded -xrem402 remainder -97.7474945 31248241.5 -> -97.7474945 -xsub402 subtract -97.7474945 31248241.5 -> -31248339.2 Inexact Rounded -xadd403 add -187582786.E+369916952 957840435E+744365567 -> 9.57840435E+744365575 Inexact Rounded -xcom403 compare -187582786.E+369916952 957840435E+744365567 -> -1 -xdiv403 divide -187582786.E+369916952 957840435E+744365567 -> -1.95839285E-374448616 Inexact Rounded -xdvi403 divideint -187582786.E+369916952 957840435E+744365567 -> -0 -xmul403 multiply -187582786.E+369916952 957840435E+744365567 -> -Infinity Inexact Overflow Rounded -xpow403 power -187582786.E+369916952 10 -> Infinity Overflow Inexact Rounded -xrem403 remainder -187582786.E+369916952 957840435E+744365567 -> -1.87582786E+369916960 -xsub403 subtract -187582786.E+369916952 957840435E+744365567 -> -9.57840435E+744365575 Inexact Rounded -xadd404 add -328026144. -125499735. -> -453525879 -xcom404 compare -328026144. -125499735. -> -1 -xdiv404 divide -328026144. -125499735. -> 2.61375965 Inexact Rounded -xdvi404 divideint -328026144. -125499735. -> 2 -xmul404 multiply -328026144. -125499735. -> 4.11671941E+16 Inexact Rounded -xpow404 power -328026144. -125499735 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem404 remainder -328026144. -125499735. -> -77026674 -xsub404 subtract -328026144. -125499735. -> -202526409 -xadd405 add -99424150.2E-523662102 3712.35030 -> 3712.35030 Inexact Rounded -xcom405 compare -99424150.2E-523662102 3712.35030 -> -1 -xdiv405 divide -99424150.2E-523662102 3712.35030 -> -2.67819958E-523662098 Inexact Rounded -xdvi405 divideint -99424150.2E-523662102 3712.35030 -> -0 -xmul405 multiply -99424150.2E-523662102 3712.35030 -> -3.69097274E-523662091 Inexact Rounded -xpow405 power -99424150.2E-523662102 3712 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem405 remainder -99424150.2E-523662102 3712.35030 -> -9.94241502E-523662095 -xsub405 subtract -99424150.2E-523662102 3712.35030 -> -3712.35030 Inexact Rounded -xadd406 add 14838.0718 9489893.28E+830631266 -> 9.48989328E+830631272 Inexact Rounded -xcom406 compare 14838.0718 9489893.28E+830631266 -> -1 -xdiv406 divide 14838.0718 9489893.28E+830631266 -> 1.56356572E-830631269 Inexact Rounded -xdvi406 divideint 14838.0718 9489893.28E+830631266 -> 0 -xmul406 multiply 14838.0718 9489893.28E+830631266 -> 1.40811718E+830631277 Inexact Rounded -xpow406 power 14838.0718 9 -> 3.48656057E+37 Inexact Rounded -xrem406 remainder 14838.0718 9489893.28E+830631266 -> 14838.0718 -xsub406 subtract 14838.0718 9489893.28E+830631266 -> -9.48989328E+830631272 Inexact Rounded -xadd407 add 71207472.8 -31835.0809 -> 71175637.7 Inexact Rounded -xcom407 compare 71207472.8 -31835.0809 -> 1 -xdiv407 divide 71207472.8 -31835.0809 -> -2236.76117 Inexact Rounded -xdvi407 divideint 71207472.8 -31835.0809 -> -2236 -xmul407 multiply 71207472.8 -31835.0809 -> -2.26689566E+12 Inexact Rounded -xpow407 power 71207472.8 -31835 -> 7.05333953E-249986 Inexact Rounded -xrem407 remainder 71207472.8 -31835.0809 -> 24231.9076 -xsub407 subtract 71207472.8 -31835.0809 -> 71239307.9 Inexact Rounded -xadd408 add -20440.4394 -44.4064328E+511085806 -> -4.44064328E+511085807 Inexact Rounded -xcom408 compare -20440.4394 -44.4064328E+511085806 -> 1 -xdiv408 divide -20440.4394 -44.4064328E+511085806 -> 4.60303567E-511085804 Inexact Rounded -xdvi408 divideint -20440.4394 -44.4064328E+511085806 -> 0 -xmul408 multiply -20440.4394 -44.4064328E+511085806 -> 9.07686999E+511085811 Inexact Rounded -xpow408 power -20440.4394 -4 -> 5.72847590E-18 Inexact Rounded -xrem408 remainder -20440.4394 -44.4064328E+511085806 -> -20440.4394 -xsub408 subtract -20440.4394 -44.4064328E+511085806 -> 4.44064328E+511085807 Inexact Rounded -xadd409 add -54.3684171E-807210192 1.04592973E-984041807 -> -5.43684171E-807210191 Inexact Rounded -xcom409 compare -54.3684171E-807210192 1.04592973E-984041807 -> -1 -xdiv409 divide -54.3684171E-807210192 1.04592973E-984041807 -> -5.19809463E+176831616 Inexact Rounded -xdvi409 divideint -54.3684171E-807210192 1.04592973E-984041807 -> NaN Division_impossible -xmul409 multiply -54.3684171E-807210192 1.04592973E-984041807 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow409 power -54.3684171E-807210192 1 -> -5.43684171E-807210191 -xrem409 remainder -54.3684171E-807210192 1.04592973E-984041807 -> NaN Division_impossible -xsub409 subtract -54.3684171E-807210192 1.04592973E-984041807 -> -5.43684171E-807210191 Inexact Rounded -xadd410 add 54310060.5E+948159739 274320701.E+205880484 -> 5.43100605E+948159746 Inexact Rounded -xcom410 compare 54310060.5E+948159739 274320701.E+205880484 -> 1 -xdiv410 divide 54310060.5E+948159739 274320701.E+205880484 -> 1.97980175E+742279254 Inexact Rounded -xdvi410 divideint 54310060.5E+948159739 274320701.E+205880484 -> NaN Division_impossible -xmul410 multiply 54310060.5E+948159739 274320701.E+205880484 -> Infinity Inexact Overflow Rounded -xpow410 power 54310060.5E+948159739 3 -> Infinity Overflow Inexact Rounded -xrem410 remainder 54310060.5E+948159739 274320701.E+205880484 -> NaN Division_impossible -xsub410 subtract 54310060.5E+948159739 274320701.E+205880484 -> 5.43100605E+948159746 Inexact Rounded -xadd411 add -657.186702 426844.39 -> 426187.203 Inexact Rounded -xcom411 compare -657.186702 426844.39 -> -1 -xdiv411 divide -657.186702 426844.39 -> -0.00153964001 Inexact Rounded -xdvi411 divideint -657.186702 426844.39 -> -0 -xmul411 multiply -657.186702 426844.39 -> -280516457 Inexact Rounded -xpow411 power -657.186702 426844 -> 3.50000575E+1202713 Inexact Rounded -xrem411 remainder -657.186702 426844.39 -> -657.186702 -xsub411 subtract -657.186702 426844.39 -> -427501.577 Inexact Rounded -xadd412 add -41593077.0 -688607.564 -> -42281684.6 Inexact Rounded -xcom412 compare -41593077.0 -688607.564 -> -1 -xdiv412 divide -41593077.0 -688607.564 -> 60.4017138 Inexact Rounded -xdvi412 divideint -41593077.0 -688607.564 -> 60 -xmul412 multiply -41593077.0 -688607.564 -> 2.86413074E+13 Inexact Rounded -xpow412 power -41593077.0 -688608 -> 1.42150750E-5246519 Inexact Rounded -xrem412 remainder -41593077.0 -688607.564 -> -276623.160 -xsub412 subtract -41593077.0 -688607.564 -> -40904469.4 Inexact Rounded -xadd413 add -5786.38132 190556652.E+177045877 -> 1.90556652E+177045885 Inexact Rounded -xcom413 compare -5786.38132 190556652.E+177045877 -> -1 -xdiv413 divide -5786.38132 190556652.E+177045877 -> -3.03656748E-177045882 Inexact Rounded -xdvi413 divideint -5786.38132 190556652.E+177045877 -> -0 -xmul413 multiply -5786.38132 190556652.E+177045877 -> -1.10263345E+177045889 Inexact Rounded -xpow413 power -5786.38132 2 -> 33482208.8 Inexact Rounded -xrem413 remainder -5786.38132 190556652.E+177045877 -> -5786.38132 -xsub413 subtract -5786.38132 190556652.E+177045877 -> -1.90556652E+177045885 Inexact Rounded -xadd414 add 737622.974 -241560693E+249506565 -> -2.41560693E+249506573 Inexact Rounded -xcom414 compare 737622.974 -241560693E+249506565 -> 1 -xdiv414 divide 737622.974 -241560693E+249506565 -> -3.05357202E-249506568 Inexact Rounded -xdvi414 divideint 737622.974 -241560693E+249506565 -> -0 -xmul414 multiply 737622.974 -241560693E+249506565 -> -1.78180717E+249506579 Inexact Rounded -xpow414 power 737622.974 -2 -> 1.83793916E-12 Inexact Rounded -xrem414 remainder 737622.974 -241560693E+249506565 -> 737622.974 -xsub414 subtract 737622.974 -241560693E+249506565 -> 2.41560693E+249506573 Inexact Rounded -xadd415 add 5615373.52 -7.27583808E-949781048 -> 5615373.52 Inexact Rounded -xcom415 compare 5615373.52 -7.27583808E-949781048 -> 1 -xdiv415 divide 5615373.52 -7.27583808E-949781048 -> -7.71783739E+949781053 Inexact Rounded -xdvi415 divideint 5615373.52 -7.27583808E-949781048 -> NaN Division_impossible -xmul415 multiply 5615373.52 -7.27583808E-949781048 -> -4.08565485E-949781041 Inexact Rounded -xpow415 power 5615373.52 -7 -> 5.68001460E-48 Inexact Rounded -xrem415 remainder 5615373.52 -7.27583808E-949781048 -> NaN Division_impossible -xsub415 subtract 5615373.52 -7.27583808E-949781048 -> 5615373.52 Inexact Rounded -xadd416 add 644136.179 -835708.103 -> -191571.924 -xcom416 compare 644136.179 -835708.103 -> 1 -xdiv416 divide 644136.179 -835708.103 -> -0.770766942 Inexact Rounded -xdvi416 divideint 644136.179 -835708.103 -> -0 -xmul416 multiply 644136.179 -835708.103 -> -5.38309824E+11 Inexact Rounded -xpow416 power 644136.179 -835708 -> 7.41936858E-4854610 Inexact Rounded -xrem416 remainder 644136.179 -835708.103 -> 644136.179 -xsub416 subtract 644136.179 -835708.103 -> 1479844.28 Inexact Rounded -xadd417 add -307.419521E+466861843 -738689976.E-199032711 -> -3.07419521E+466861845 Inexact Rounded -xcom417 compare -307.419521E+466861843 -738689976.E-199032711 -> -1 -xdiv417 divide -307.419521E+466861843 -738689976.E-199032711 -> 4.16168529E+665894547 Inexact Rounded -xdvi417 divideint -307.419521E+466861843 -738689976.E-199032711 -> NaN Division_impossible -xmul417 multiply -307.419521E+466861843 -738689976.E-199032711 -> 2.27087719E+267829143 Inexact Rounded -xpow417 power -307.419521E+466861843 -7 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem417 remainder -307.419521E+466861843 -738689976.E-199032711 -> NaN Division_impossible -xsub417 subtract -307.419521E+466861843 -738689976.E-199032711 -> -3.07419521E+466861845 Inexact Rounded -xadd418 add -619642.130 -226740537.E-902590153 -> -619642.130 Inexact Rounded -xcom418 compare -619642.130 -226740537.E-902590153 -> -1 -xdiv418 divide -619642.130 -226740537.E-902590153 -> 2.73282466E+902590150 Inexact Rounded -xdvi418 divideint -619642.130 -226740537.E-902590153 -> NaN Division_impossible -xmul418 multiply -619642.130 -226740537.E-902590153 -> 1.40497989E-902590139 Inexact Rounded -xpow418 power -619642.130 -2 -> 2.60446259E-12 Inexact Rounded -xrem418 remainder -619642.130 -226740537.E-902590153 -> NaN Division_impossible -xsub418 subtract -619642.130 -226740537.E-902590153 -> -619642.130 Inexact Rounded -xadd419 add -31068.7549 -3.41495042E+86001379 -> -3.41495042E+86001379 Inexact Rounded -xcom419 compare -31068.7549 -3.41495042E+86001379 -> 1 -xdiv419 divide -31068.7549 -3.41495042E+86001379 -> 9.09786412E-86001376 Inexact Rounded -xdvi419 divideint -31068.7549 -3.41495042E+86001379 -> 0 -xmul419 multiply -31068.7549 -3.41495042E+86001379 -> 1.06098258E+86001384 Inexact Rounded -xpow419 power -31068.7549 -3 -> -3.33448258E-14 Inexact Rounded -xrem419 remainder -31068.7549 -3.41495042E+86001379 -> -31068.7549 -xsub419 subtract -31068.7549 -3.41495042E+86001379 -> 3.41495042E+86001379 Inexact Rounded -xadd420 add -68951173. -211804977.E-97318126 -> -68951173.0 Inexact Rounded -xcom420 compare -68951173. -211804977.E-97318126 -> -1 -xdiv420 divide -68951173. -211804977.E-97318126 -> 3.25540854E+97318125 Inexact Rounded -xdvi420 divideint -68951173. -211804977.E-97318126 -> NaN Division_impossible -xmul420 multiply -68951173. -211804977.E-97318126 -> 1.46042016E-97318110 Inexact Rounded -xpow420 power -68951173. -2 -> 2.10337488E-16 Inexact Rounded -xrem420 remainder -68951173. -211804977.E-97318126 -> NaN Division_impossible -xsub420 subtract -68951173. -211804977.E-97318126 -> -68951173.0 Inexact Rounded -xadd421 add -4.09492571E-301749490 434.20199E-749390952 -> -4.09492571E-301749490 Inexact Rounded -xcom421 compare -4.09492571E-301749490 434.20199E-749390952 -> -1 -xdiv421 divide -4.09492571E-301749490 434.20199E-749390952 -> -9.43092341E+447641459 Inexact Rounded -xdvi421 divideint -4.09492571E-301749490 434.20199E-749390952 -> NaN Division_impossible -xmul421 multiply -4.09492571E-301749490 434.20199E-749390952 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow421 power -4.09492571E-301749490 4 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem421 remainder -4.09492571E-301749490 434.20199E-749390952 -> NaN Division_impossible -xsub421 subtract -4.09492571E-301749490 434.20199E-749390952 -> -4.09492571E-301749490 Inexact Rounded -xadd422 add 3898.03188 -82572.615 -> -78674.5831 Inexact Rounded -xcom422 compare 3898.03188 -82572.615 -> 1 -xdiv422 divide 3898.03188 -82572.615 -> -0.0472073202 Inexact Rounded -xdvi422 divideint 3898.03188 -82572.615 -> -0 -xmul422 multiply 3898.03188 -82572.615 -> -321870686 Inexact Rounded -xpow422 power 3898.03188 -82573 -> 1.33010737E-296507 Inexact Rounded -xrem422 remainder 3898.03188 -82572.615 -> 3898.03188 -xsub422 subtract 3898.03188 -82572.615 -> 86470.6469 Inexact Rounded -xadd423 add -1.7619356 -2546.64043 -> -2548.40237 Inexact Rounded -xcom423 compare -1.7619356 -2546.64043 -> 1 -xdiv423 divide -1.7619356 -2546.64043 -> 0.000691866657 Inexact Rounded -xdvi423 divideint -1.7619356 -2546.64043 -> 0 -xmul423 multiply -1.7619356 -2546.64043 -> 4487.01643 Inexact Rounded -xpow423 power -1.7619356 -2547 -> -2.90664557E-627 Inexact Rounded -xrem423 remainder -1.7619356 -2546.64043 -> -1.7619356 -xsub423 subtract -1.7619356 -2546.64043 -> 2544.87849 Inexact Rounded -xadd424 add 59714.1968 29734388.6E-564525525 -> 59714.1968 Inexact Rounded -xcom424 compare 59714.1968 29734388.6E-564525525 -> 1 -xdiv424 divide 59714.1968 29734388.6E-564525525 -> 2.00825373E+564525522 Inexact Rounded -xdvi424 divideint 59714.1968 29734388.6E-564525525 -> NaN Division_impossible -xmul424 multiply 59714.1968 29734388.6E-564525525 -> 1.77556513E-564525513 Inexact Rounded -xpow424 power 59714.1968 3 -> 2.12928005E+14 Inexact Rounded -xrem424 remainder 59714.1968 29734388.6E-564525525 -> NaN Division_impossible -xsub424 subtract 59714.1968 29734388.6E-564525525 -> 59714.1968 Inexact Rounded -xadd425 add 6.88891136E-935467395 -785049.562E-741671442 -> -7.85049562E-741671437 Inexact Rounded -xcom425 compare 6.88891136E-935467395 -785049.562E-741671442 -> 1 -xdiv425 divide 6.88891136E-935467395 -785049.562E-741671442 -> -8.77512923E-193795959 Inexact Rounded -xdvi425 divideint 6.88891136E-935467395 -785049.562E-741671442 -> -0 -xmul425 multiply 6.88891136E-935467395 -785049.562E-741671442 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow425 power 6.88891136E-935467395 -8 -> Infinity Overflow Inexact Rounded -xrem425 remainder 6.88891136E-935467395 -785049.562E-741671442 -> 6.88891136E-935467395 -xsub425 subtract 6.88891136E-935467395 -785049.562E-741671442 -> 7.85049562E-741671437 Inexact Rounded -xadd426 add 975566251 -519.858530 -> 975565731 Inexact Rounded -xcom426 compare 975566251 -519.858530 -> 1 -xdiv426 divide 975566251 -519.858530 -> -1876599.49 Inexact Rounded -xdvi426 divideint 975566251 -519.858530 -> -1876599 -xmul426 multiply 975566251 -519.858530 -> -5.07156437E+11 Inexact Rounded -xpow426 power 975566251 -520 -> 3.85905300E-4675 Inexact Rounded -xrem426 remainder 975566251 -519.858530 -> 253.460530 -xsub426 subtract 975566251 -519.858530 -> 975566771 Inexact Rounded -xadd427 add 307401954 -231481582. -> 75920372 -xcom427 compare 307401954 -231481582. -> 1 -xdiv427 divide 307401954 -231481582. -> -1.32797586 Inexact Rounded -xdvi427 divideint 307401954 -231481582. -> -1 -xmul427 multiply 307401954 -231481582. -> -7.11578906E+16 Inexact Rounded -xpow427 power 307401954 -231481582 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem427 remainder 307401954 -231481582. -> 75920372 -xsub427 subtract 307401954 -231481582. -> 538883536 -xadd428 add 2237645.48E+992947388 -60618055.3E-857316706 -> 2.23764548E+992947394 Inexact Rounded -xcom428 compare 2237645.48E+992947388 -60618055.3E-857316706 -> 1 -xdiv428 divide 2237645.48E+992947388 -60618055.3E-857316706 -> -Infinity Inexact Overflow Rounded -xdvi428 divideint 2237645.48E+992947388 -60618055.3E-857316706 -> NaN Division_impossible -xmul428 multiply 2237645.48E+992947388 -60618055.3E-857316706 -> -1.35641717E+135630696 Inexact Rounded -xpow428 power 2237645.48E+992947388 -6 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem428 remainder 2237645.48E+992947388 -60618055.3E-857316706 -> NaN Division_impossible -xsub428 subtract 2237645.48E+992947388 -60618055.3E-857316706 -> 2.23764548E+992947394 Inexact Rounded -xadd429 add -403903.851 35.5049687E-72095155 -> -403903.851 Inexact Rounded -xcom429 compare -403903.851 35.5049687E-72095155 -> -1 -xdiv429 divide -403903.851 35.5049687E-72095155 -> -1.13759810E+72095159 Inexact Rounded -xdvi429 divideint -403903.851 35.5049687E-72095155 -> NaN Division_impossible -xmul429 multiply -403903.851 35.5049687E-72095155 -> -1.43405936E-72095148 Inexact Rounded -xpow429 power -403903.851 4 -> 2.66141117E+22 Inexact Rounded -xrem429 remainder -403903.851 35.5049687E-72095155 -> NaN Division_impossible -xsub429 subtract -403903.851 35.5049687E-72095155 -> -403903.851 Inexact Rounded -xadd430 add 6.48674979 -621732.532E+422575800 -> -6.21732532E+422575805 Inexact Rounded -xcom430 compare 6.48674979 -621732.532E+422575800 -> 1 -xdiv430 divide 6.48674979 -621732.532E+422575800 -> -1.04333447E-422575805 Inexact Rounded -xdvi430 divideint 6.48674979 -621732.532E+422575800 -> -0 -xmul430 multiply 6.48674979 -621732.532E+422575800 -> -4.03302337E+422575806 Inexact Rounded -xpow430 power 6.48674979 -6 -> 0.0000134226146 Inexact Rounded -xrem430 remainder 6.48674979 -621732.532E+422575800 -> 6.48674979 -xsub430 subtract 6.48674979 -621732.532E+422575800 -> 6.21732532E+422575805 Inexact Rounded -xadd431 add -31401.9418 36.3960679 -> -31365.5457 Inexact Rounded -xcom431 compare -31401.9418 36.3960679 -> -1 -xdiv431 divide -31401.9418 36.3960679 -> -862.783911 Inexact Rounded -xdvi431 divideint -31401.9418 36.3960679 -> -862 -xmul431 multiply -31401.9418 36.3960679 -> -1142907.21 Inexact Rounded -xpow431 power -31401.9418 36 -> 7.77023505E+161 Inexact Rounded -xrem431 remainder -31401.9418 36.3960679 -> -28.5312702 -xsub431 subtract -31401.9418 36.3960679 -> -31438.3379 Inexact Rounded -xadd432 add 31345321.1 51.5482191 -> 31345372.6 Inexact Rounded -xcom432 compare 31345321.1 51.5482191 -> 1 -xdiv432 divide 31345321.1 51.5482191 -> 608077.673 Inexact Rounded -xdvi432 divideint 31345321.1 51.5482191 -> 608077 -xmul432 multiply 31345321.1 51.5482191 -> 1.61579548E+9 Inexact Rounded -xpow432 power 31345321.1 52 -> 6.32385059E+389 Inexact Rounded -xrem432 remainder 31345321.1 51.5482191 -> 34.6743293 -xsub432 subtract 31345321.1 51.5482191 -> 31345269.6 Inexact Rounded -xadd433 add -64.172844 -28506227.2E-767965800 -> -64.1728440 Inexact Rounded -xcom433 compare -64.172844 -28506227.2E-767965800 -> -1 -xdiv433 divide -64.172844 -28506227.2E-767965800 -> 2.25118686E+767965794 Inexact Rounded -xdvi433 divideint -64.172844 -28506227.2E-767965800 -> NaN Division_impossible -xmul433 multiply -64.172844 -28506227.2E-767965800 -> 1.82932567E-767965791 Inexact Rounded -xpow433 power -64.172844 -3 -> -0.00000378395654 Inexact Rounded -xrem433 remainder -64.172844 -28506227.2E-767965800 -> NaN Division_impossible -xsub433 subtract -64.172844 -28506227.2E-767965800 -> -64.1728440 Inexact Rounded -xadd434 add 70437.1551 -62916.1233 -> 7521.0318 -xcom434 compare 70437.1551 -62916.1233 -> 1 -xdiv434 divide 70437.1551 -62916.1233 -> -1.11954061 Inexact Rounded -xdvi434 divideint 70437.1551 -62916.1233 -> -1 -xmul434 multiply 70437.1551 -62916.1233 -> -4.43163274E+9 Inexact Rounded -xpow434 power 70437.1551 -62916 -> 5.02945060E-305005 Inexact Rounded -xrem434 remainder 70437.1551 -62916.1233 -> 7521.0318 -xsub434 subtract 70437.1551 -62916.1233 -> 133353.278 Inexact Rounded -xadd435 add 916260164 -58.4017325 -> 916260106 Inexact Rounded -xcom435 compare 916260164 -58.4017325 -> 1 -xdiv435 divide 916260164 -58.4017325 -> -15688920.9 Inexact Rounded -xdvi435 divideint 916260164 -58.4017325 -> -15688920 -xmul435 multiply 916260164 -58.4017325 -> -5.35111810E+10 Inexact Rounded -xpow435 power 916260164 -58 -> 1.59554587E-520 Inexact Rounded -xrem435 remainder 916260164 -58.4017325 -> 54.9461000 -xsub435 subtract 916260164 -58.4017325 -> 916260222 Inexact Rounded -xadd436 add 19889085.3E-46816480 1581683.94 -> 1581683.94 Inexact Rounded -xcom436 compare 19889085.3E-46816480 1581683.94 -> -1 -xdiv436 divide 19889085.3E-46816480 1581683.94 -> 1.25746268E-46816479 Inexact Rounded -xdvi436 divideint 19889085.3E-46816480 1581683.94 -> 0 -xmul436 multiply 19889085.3E-46816480 1581683.94 -> 3.14582468E-46816467 Inexact Rounded -xpow436 power 19889085.3E-46816480 1581684 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem436 remainder 19889085.3E-46816480 1581683.94 -> 1.98890853E-46816473 -xsub436 subtract 19889085.3E-46816480 1581683.94 -> -1581683.94 Inexact Rounded -xadd437 add -56312.3383 789.466064 -> -55522.8722 Inexact Rounded -xcom437 compare -56312.3383 789.466064 -> -1 -xdiv437 divide -56312.3383 789.466064 -> -71.3296503 Inexact Rounded -xdvi437 divideint -56312.3383 789.466064 -> -71 -xmul437 multiply -56312.3383 789.466064 -> -44456680.1 Inexact Rounded -xpow437 power -56312.3383 789 -> -1.68348724E+3748 Inexact Rounded -xrem437 remainder -56312.3383 789.466064 -> -260.247756 -xsub437 subtract -56312.3383 789.466064 -> -57101.8044 Inexact Rounded -xadd438 add 183442.849 -925876106 -> -925692663 Inexact Rounded -xcom438 compare 183442.849 -925876106 -> 1 -xdiv438 divide 183442.849 -925876106 -> -0.000198128937 Inexact Rounded -xdvi438 divideint 183442.849 -925876106 -> -0 -xmul438 multiply 183442.849 -925876106 -> -1.69845351E+14 Inexact Rounded -xpow438 power 183442.849 -925876106 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem438 remainder 183442.849 -925876106 -> 183442.849 -xsub438 subtract 183442.849 -925876106 -> 926059549 Inexact Rounded -xadd439 add 971113.655E-695540249 -419351120E-977743823 -> 9.71113655E-695540244 Inexact Rounded -xcom439 compare 971113.655E-695540249 -419351120E-977743823 -> 1 -xdiv439 divide 971113.655E-695540249 -419351120E-977743823 -> -2.31575310E+282203571 Inexact Rounded -xdvi439 divideint 971113.655E-695540249 -419351120E-977743823 -> NaN Division_impossible -xmul439 multiply 971113.655E-695540249 -419351120E-977743823 -> -0E-1000000007 Underflow Subnormal Inexact Rounded -xpow439 power 971113.655E-695540249 -4 -> Infinity Overflow Inexact Rounded -xrem439 remainder 971113.655E-695540249 -419351120E-977743823 -> NaN Division_impossible -xsub439 subtract 971113.655E-695540249 -419351120E-977743823 -> 9.71113655E-695540244 Inexact Rounded -xadd440 add 859658551. 72338.2054 -> 859730889 Inexact Rounded -xcom440 compare 859658551. 72338.2054 -> 1 -xdiv440 divide 859658551. 72338.2054 -> 11883.8800 Inexact Rounded -xdvi440 divideint 859658551. 72338.2054 -> 11883 -xmul440 multiply 859658551. 72338.2054 -> 6.21861568E+13 Inexact Rounded -xpow440 power 859658551. 72338 -> 1.87620450E+646291 Inexact Rounded -xrem440 remainder 859658551. 72338.2054 -> 63656.2318 -xsub440 subtract 859658551. 72338.2054 -> 859586213 Inexact Rounded -xadd441 add -3.86446630E+426816068 -664.534737 -> -3.86446630E+426816068 Inexact Rounded -xcom441 compare -3.86446630E+426816068 -664.534737 -> -1 -xdiv441 divide -3.86446630E+426816068 -664.534737 -> 5.81529615E+426816065 Inexact Rounded -xdvi441 divideint -3.86446630E+426816068 -664.534737 -> NaN Division_impossible -xmul441 multiply -3.86446630E+426816068 -664.534737 -> 2.56807210E+426816071 Inexact Rounded -xpow441 power -3.86446630E+426816068 -665 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem441 remainder -3.86446630E+426816068 -664.534737 -> NaN Division_impossible -xsub441 subtract -3.86446630E+426816068 -664.534737 -> -3.86446630E+426816068 Inexact Rounded -xadd442 add -969.881818 31170.8555 -> 30200.9737 Inexact Rounded -xcom442 compare -969.881818 31170.8555 -> -1 -xdiv442 divide -969.881818 31170.8555 -> -0.0311150208 Inexact Rounded -xdvi442 divideint -969.881818 31170.8555 -> -0 -xmul442 multiply -969.881818 31170.8555 -> -30232046.0 Inexact Rounded -xpow442 power -969.881818 31171 -> -1.02865894E+93099 Inexact Rounded -xrem442 remainder -969.881818 31170.8555 -> -969.881818 -xsub442 subtract -969.881818 31170.8555 -> -32140.7373 Inexact Rounded -xadd443 add 7980537.27 85.4040512 -> 7980622.67 Inexact Rounded -xcom443 compare 7980537.27 85.4040512 -> 1 -xdiv443 divide 7980537.27 85.4040512 -> 93444.4814 Inexact Rounded -xdvi443 divideint 7980537.27 85.4040512 -> 93444 -xmul443 multiply 7980537.27 85.4040512 -> 681570214 Inexact Rounded -xpow443 power 7980537.27 85 -> 4.70685763E+586 Inexact Rounded -xrem443 remainder 7980537.27 85.4040512 -> 41.1096672 -xsub443 subtract 7980537.27 85.4040512 -> 7980451.87 Inexact Rounded -xadd444 add -114609916. 7525.14981 -> -114602391 Inexact Rounded -xcom444 compare -114609916. 7525.14981 -> -1 -xdiv444 divide -114609916. 7525.14981 -> -15230.2504 Inexact Rounded -xdvi444 divideint -114609916. 7525.14981 -> -15230 -xmul444 multiply -114609916. 7525.14981 -> -8.62456788E+11 Inexact Rounded -xpow444 power -114609916. 7525 -> -4.43620445E+60645 Inexact Rounded -xrem444 remainder -114609916. 7525.14981 -> -1884.39370 -xsub444 subtract -114609916. 7525.14981 -> -114617441 Inexact Rounded -xadd445 add 8.43404682E-500572568 474526719 -> 474526719 Inexact Rounded -xcom445 compare 8.43404682E-500572568 474526719 -> -1 -xdiv445 divide 8.43404682E-500572568 474526719 -> 1.77735973E-500572576 Inexact Rounded -xdvi445 divideint 8.43404682E-500572568 474526719 -> 0 -xmul445 multiply 8.43404682E-500572568 474526719 -> 4.00218057E-500572559 Inexact Rounded -xpow445 power 8.43404682E-500572568 474526719 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem445 remainder 8.43404682E-500572568 474526719 -> 8.43404682E-500572568 -xsub445 subtract 8.43404682E-500572568 474526719 -> -474526719 Inexact Rounded -xadd446 add 188006433 2260.17037E-978192525 -> 188006433 Inexact Rounded -xcom446 compare 188006433 2260.17037E-978192525 -> 1 -xdiv446 divide 188006433 2260.17037E-978192525 -> 8.31824165E+978192529 Inexact Rounded -xdvi446 divideint 188006433 2260.17037E-978192525 -> NaN Division_impossible -xmul446 multiply 188006433 2260.17037E-978192525 -> 4.24926569E-978192514 Inexact Rounded -xpow446 power 188006433 2 -> 3.53464188E+16 Inexact Rounded -xrem446 remainder 188006433 2260.17037E-978192525 -> NaN Division_impossible -xsub446 subtract 188006433 2260.17037E-978192525 -> 188006433 Inexact Rounded -xadd447 add -9.95836312 -866466703 -> -866466713 Inexact Rounded -xcom447 compare -9.95836312 -866466703 -> 1 -xdiv447 divide -9.95836312 -866466703 -> 1.14930707E-8 Inexact Rounded -xdvi447 divideint -9.95836312 -866466703 -> 0 -xmul447 multiply -9.95836312 -866466703 -> 8.62859006E+9 Inexact Rounded -xpow447 power -9.95836312 -866466703 -> -6.71744368E-864896630 Inexact Rounded -xrem447 remainder -9.95836312 -866466703 -> -9.95836312 -xsub447 subtract -9.95836312 -866466703 -> 866466693 Inexact Rounded -xadd448 add 80919339.2E-967231586 219.824266 -> 219.824266 Inexact Rounded -xcom448 compare 80919339.2E-967231586 219.824266 -> -1 -xdiv448 divide 80919339.2E-967231586 219.824266 -> 3.68109220E-967231581 Inexact Rounded -xdvi448 divideint 80919339.2E-967231586 219.824266 -> 0 -xmul448 multiply 80919339.2E-967231586 219.824266 -> 1.77880343E-967231576 Inexact Rounded -xpow448 power 80919339.2E-967231586 220 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem448 remainder 80919339.2E-967231586 219.824266 -> 8.09193392E-967231579 -xsub448 subtract 80919339.2E-967231586 219.824266 -> -219.824266 Inexact Rounded -xadd449 add 159579.444 -89827.5229 -> 69751.9211 -xcom449 compare 159579.444 -89827.5229 -> 1 -xdiv449 divide 159579.444 -89827.5229 -> -1.77650946 Inexact Rounded -xdvi449 divideint 159579.444 -89827.5229 -> -1 -xmul449 multiply 159579.444 -89827.5229 -> -1.43346262E+10 Inexact Rounded -xpow449 power 159579.444 -89828 -> 9.69955849E-467374 Inexact Rounded -xrem449 remainder 159579.444 -89827.5229 -> 69751.9211 -xsub449 subtract 159579.444 -89827.5229 -> 249406.967 Inexact Rounded -xadd450 add -4.54000153 6966333.74 -> 6966329.20 Inexact Rounded -xcom450 compare -4.54000153 6966333.74 -> -1 -xdiv450 divide -4.54000153 6966333.74 -> -6.51706005E-7 Inexact Rounded -xdvi450 divideint -4.54000153 6966333.74 -> -0 -xmul450 multiply -4.54000153 6966333.74 -> -31627165.8 Inexact Rounded -xpow450 power -4.54000153 6966334 -> 3.52568913E+4577271 Inexact Rounded -xrem450 remainder -4.54000153 6966333.74 -> -4.54000153 -xsub450 subtract -4.54000153 6966333.74 -> -6966338.28 Inexact Rounded -xadd451 add 28701538.7E-391015649 -920999192. -> -920999192 Inexact Rounded -xcom451 compare 28701538.7E-391015649 -920999192. -> 1 -xdiv451 divide 28701538.7E-391015649 -920999192. -> -3.11634787E-391015651 Inexact Rounded -xdvi451 divideint 28701538.7E-391015649 -920999192. -> -0 -xmul451 multiply 28701538.7E-391015649 -920999192. -> -2.64340940E-391015633 Inexact Rounded -xpow451 power 28701538.7E-391015649 -920999192 -> Infinity Overflow Inexact Rounded -xrem451 remainder 28701538.7E-391015649 -920999192. -> 2.87015387E-391015642 -xsub451 subtract 28701538.7E-391015649 -920999192. -> 920999192 Inexact Rounded -xadd452 add -361382575. -7976.15286E+898491169 -> -7.97615286E+898491172 Inexact Rounded -xcom452 compare -361382575. -7976.15286E+898491169 -> 1 -xdiv452 divide -361382575. -7976.15286E+898491169 -> 4.53078798E-898491165 Inexact Rounded -xdvi452 divideint -361382575. -7976.15286E+898491169 -> 0 -xmul452 multiply -361382575. -7976.15286E+898491169 -> 2.88244266E+898491181 Inexact Rounded -xpow452 power -361382575. -8 -> 3.43765536E-69 Inexact Rounded -xrem452 remainder -361382575. -7976.15286E+898491169 -> -361382575 -xsub452 subtract -361382575. -7976.15286E+898491169 -> 7.97615286E+898491172 Inexact Rounded -xadd453 add 7021805.61 1222952.83 -> 8244758.44 -xcom453 compare 7021805.61 1222952.83 -> 1 -xdiv453 divide 7021805.61 1222952.83 -> 5.74168148 Inexact Rounded -xdvi453 divideint 7021805.61 1222952.83 -> 5 -xmul453 multiply 7021805.61 1222952.83 -> 8.58733704E+12 Inexact Rounded -xpow453 power 7021805.61 1222953 -> 1.26540553E+8372885 Inexact Rounded -xrem453 remainder 7021805.61 1222952.83 -> 907041.46 -xsub453 subtract 7021805.61 1222952.83 -> 5798852.78 -xadd454 add -40.4811667 -79655.5635 -> -79696.0447 Inexact Rounded -xcom454 compare -40.4811667 -79655.5635 -> 1 -xdiv454 divide -40.4811667 -79655.5635 -> 0.000508202628 Inexact Rounded -xdvi454 divideint -40.4811667 -79655.5635 -> 0 -xmul454 multiply -40.4811667 -79655.5635 -> 3224550.14 Inexact Rounded -xpow454 power -40.4811667 -79656 -> 4.50174275E-128028 Inexact Rounded -xrem454 remainder -40.4811667 -79655.5635 -> -40.4811667 -xsub454 subtract -40.4811667 -79655.5635 -> 79615.0823 Inexact Rounded -xadd455 add -8755674.38E+117168177 148.903404 -> -8.75567438E+117168183 Inexact Rounded -xcom455 compare -8755674.38E+117168177 148.903404 -> -1 -xdiv455 divide -8755674.38E+117168177 148.903404 -> -5.88010357E+117168181 Inexact Rounded -xdvi455 divideint -8755674.38E+117168177 148.903404 -> NaN Division_impossible -xmul455 multiply -8755674.38E+117168177 148.903404 -> -1.30374972E+117168186 Inexact Rounded -xpow455 power -8755674.38E+117168177 149 -> -Infinity Overflow Inexact Rounded -xrem455 remainder -8755674.38E+117168177 148.903404 -> NaN Division_impossible -xsub455 subtract -8755674.38E+117168177 148.903404 -> -8.75567438E+117168183 Inexact Rounded -xadd456 add 34.5329781E+382829392 -45.2177309 -> 3.45329781E+382829393 Inexact Rounded -xcom456 compare 34.5329781E+382829392 -45.2177309 -> 1 -xdiv456 divide 34.5329781E+382829392 -45.2177309 -> -7.63704357E+382829391 Inexact Rounded -xdvi456 divideint 34.5329781E+382829392 -45.2177309 -> NaN Division_impossible -xmul456 multiply 34.5329781E+382829392 -45.2177309 -> -1.56150291E+382829395 Inexact Rounded -xpow456 power 34.5329781E+382829392 -45 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem456 remainder 34.5329781E+382829392 -45.2177309 -> NaN Division_impossible -xsub456 subtract 34.5329781E+382829392 -45.2177309 -> 3.45329781E+382829393 Inexact Rounded -xadd457 add -37958476.0 584367.935 -> -37374108.1 Inexact Rounded -xcom457 compare -37958476.0 584367.935 -> -1 -xdiv457 divide -37958476.0 584367.935 -> -64.9564662 Inexact Rounded -xdvi457 divideint -37958476.0 584367.935 -> -64 -xmul457 multiply -37958476.0 584367.935 -> -2.21817162E+13 Inexact Rounded -xpow457 power -37958476.0 584368 -> 3.20538268E+4429105 Inexact Rounded -xrem457 remainder -37958476.0 584367.935 -> -558928.160 -xsub457 subtract -37958476.0 584367.935 -> -38542843.9 Inexact Rounded -xadd458 add 495233.553E-414152215 62352759.2 -> 62352759.2 Inexact Rounded -xcom458 compare 495233.553E-414152215 62352759.2 -> -1 -xdiv458 divide 495233.553E-414152215 62352759.2 -> 7.94244809E-414152218 Inexact Rounded -xdvi458 divideint 495233.553E-414152215 62352759.2 -> 0 -xmul458 multiply 495233.553E-414152215 62352759.2 -> 3.08791785E-414152202 Inexact Rounded -xpow458 power 495233.553E-414152215 62352759 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem458 remainder 495233.553E-414152215 62352759.2 -> 4.95233553E-414152210 -xsub458 subtract 495233.553E-414152215 62352759.2 -> -62352759.2 Inexact Rounded -xadd459 add -502343060 -96828.994 -> -502439889 Inexact Rounded -xcom459 compare -502343060 -96828.994 -> -1 -xdiv459 divide -502343060 -96828.994 -> 5187.94050 Inexact Rounded -xdvi459 divideint -502343060 -96828.994 -> 5187 -xmul459 multiply -502343060 -96828.994 -> 4.86413731E+13 Inexact Rounded -xpow459 power -502343060 -96829 -> -6.78602119E-842510 Inexact Rounded -xrem459 remainder -502343060 -96828.994 -> -91068.122 -xsub459 subtract -502343060 -96828.994 -> -502246231 Inexact Rounded -xadd460 add -22.439639E+916362878 -39.4037681 -> -2.24396390E+916362879 Inexact Rounded -xcom460 compare -22.439639E+916362878 -39.4037681 -> -1 -xdiv460 divide -22.439639E+916362878 -39.4037681 -> 5.69479521E+916362877 Inexact Rounded -xdvi460 divideint -22.439639E+916362878 -39.4037681 -> NaN Division_impossible -xmul460 multiply -22.439639E+916362878 -39.4037681 -> 8.84206331E+916362880 Inexact Rounded -xpow460 power -22.439639E+916362878 -39 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem460 remainder -22.439639E+916362878 -39.4037681 -> NaN Division_impossible -xsub460 subtract -22.439639E+916362878 -39.4037681 -> -2.24396390E+916362879 Inexact Rounded -xadd461 add 718180.587E-957473722 1.66223443 -> 1.66223443 Inexact Rounded -xcom461 compare 718180.587E-957473722 1.66223443 -> -1 -xdiv461 divide 718180.587E-957473722 1.66223443 -> 4.32057340E-957473717 Inexact Rounded -xdvi461 divideint 718180.587E-957473722 1.66223443 -> 0 -xmul461 multiply 718180.587E-957473722 1.66223443 -> 1.19378450E-957473716 Inexact Rounded -xpow461 power 718180.587E-957473722 2 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem461 remainder 718180.587E-957473722 1.66223443 -> 7.18180587E-957473717 -xsub461 subtract 718180.587E-957473722 1.66223443 -> -1.66223443 Inexact Rounded -xadd462 add -51592.2698 -713885.741 -> -765478.011 Inexact Rounded -xcom462 compare -51592.2698 -713885.741 -> 1 -xdiv462 divide -51592.2698 -713885.741 -> 0.0722696460 Inexact Rounded -xdvi462 divideint -51592.2698 -713885.741 -> 0 -xmul462 multiply -51592.2698 -713885.741 -> 3.68309858E+10 Inexact Rounded -xpow462 power -51592.2698 -713886 -> 6.38576921E-3364249 Inexact Rounded -xrem462 remainder -51592.2698 -713885.741 -> -51592.2698 -xsub462 subtract -51592.2698 -713885.741 -> 662293.471 Inexact Rounded -xadd463 add 51.2279848E+80439745 207.55925E+865165070 -> 2.07559250E+865165072 Inexact Rounded -xcom463 compare 51.2279848E+80439745 207.55925E+865165070 -> -1 -xdiv463 divide 51.2279848E+80439745 207.55925E+865165070 -> 2.46811379E-784725326 Inexact Rounded -xdvi463 divideint 51.2279848E+80439745 207.55925E+865165070 -> 0 -xmul463 multiply 51.2279848E+80439745 207.55925E+865165070 -> 1.06328421E+945604819 Inexact Rounded -xpow463 power 51.2279848E+80439745 2 -> 2.62430643E+160879493 Inexact Rounded -xrem463 remainder 51.2279848E+80439745 207.55925E+865165070 -> 5.12279848E+80439746 -xsub463 subtract 51.2279848E+80439745 207.55925E+865165070 -> -2.07559250E+865165072 Inexact Rounded -xadd464 add -5983.23468 -39.9544513 -> -6023.18913 Inexact Rounded -xcom464 compare -5983.23468 -39.9544513 -> -1 -xdiv464 divide -5983.23468 -39.9544513 -> 149.751392 Inexact Rounded -xdvi464 divideint -5983.23468 -39.9544513 -> 149 -xmul464 multiply -5983.23468 -39.9544513 -> 239056.859 Inexact Rounded -xpow464 power -5983.23468 -40 -> 8.36678291E-152 Inexact Rounded -xrem464 remainder -5983.23468 -39.9544513 -> -30.0214363 -xsub464 subtract -5983.23468 -39.9544513 -> -5943.28023 Inexact Rounded -xadd465 add 921639332.E-917542963 287325.891 -> 287325.891 Inexact Rounded -xcom465 compare 921639332.E-917542963 287325.891 -> -1 -xdiv465 divide 921639332.E-917542963 287325.891 -> 3.20764456E-917542960 Inexact Rounded -xdvi465 divideint 921639332.E-917542963 287325.891 -> 0 -xmul465 multiply 921639332.E-917542963 287325.891 -> 2.64810842E-917542949 Inexact Rounded -xpow465 power 921639332.E-917542963 287326 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem465 remainder 921639332.E-917542963 287325.891 -> 9.21639332E-917542955 -xsub465 subtract 921639332.E-917542963 287325.891 -> -287325.891 Inexact Rounded -xadd466 add 91095916.8E-787312969 -58643.418E+58189880 -> -5.86434180E+58189884 Inexact Rounded -xcom466 compare 91095916.8E-787312969 -58643.418E+58189880 -> 1 -xdiv466 divide 91095916.8E-787312969 -58643.418E+58189880 -> -1.55338689E-845502846 Inexact Rounded -xdvi466 divideint 91095916.8E-787312969 -58643.418E+58189880 -> -0 -xmul466 multiply 91095916.8E-787312969 -58643.418E+58189880 -> -5.34217593E-729123077 Inexact Rounded -xpow466 power 91095916.8E-787312969 -6 -> Infinity Overflow Inexact Rounded -xrem466 remainder 91095916.8E-787312969 -58643.418E+58189880 -> 9.10959168E-787312962 -xsub466 subtract 91095916.8E-787312969 -58643.418E+58189880 -> 5.86434180E+58189884 Inexact Rounded -xadd467 add -6410.5555 -234964259 -> -234970670 Inexact Rounded -xcom467 compare -6410.5555 -234964259 -> 1 -xdiv467 divide -6410.5555 -234964259 -> 0.0000272831090 Inexact Rounded -xdvi467 divideint -6410.5555 -234964259 -> 0 -xmul467 multiply -6410.5555 -234964259 -> 1.50625142E+12 Inexact Rounded -xpow467 power -6410.5555 -234964259 -> -1.27064467E-894484419 Inexact Rounded -xrem467 remainder -6410.5555 -234964259 -> -6410.5555 -xsub467 subtract -6410.5555 -234964259 -> 234957848 Inexact Rounded -xadd468 add -5.32711606 -8447286.21 -> -8447291.54 Inexact Rounded -xcom468 compare -5.32711606 -8447286.21 -> 1 -xdiv468 divide -5.32711606 -8447286.21 -> 6.30630468E-7 Inexact Rounded -xdvi468 divideint -5.32711606 -8447286.21 -> 0 -xmul468 multiply -5.32711606 -8447286.21 -> 44999674.0 Inexact Rounded -xpow468 power -5.32711606 -8447286 -> 9.09138729E-6136888 Inexact Rounded -xrem468 remainder -5.32711606 -8447286.21 -> -5.32711606 -xsub468 subtract -5.32711606 -8447286.21 -> 8447280.88 Inexact Rounded -xadd469 add -82272171.8 -776.238587E-372690416 -> -82272171.8 Inexact Rounded -xcom469 compare -82272171.8 -776.238587E-372690416 -> -1 -xdiv469 divide -82272171.8 -776.238587E-372690416 -> 1.05988253E+372690421 Inexact Rounded -xdvi469 divideint -82272171.8 -776.238587E-372690416 -> NaN Division_impossible -xmul469 multiply -82272171.8 -776.238587E-372690416 -> 6.38628344E-372690406 Inexact Rounded -xpow469 power -82272171.8 -8 -> 4.76404994E-64 Inexact Rounded -xrem469 remainder -82272171.8 -776.238587E-372690416 -> NaN Division_impossible -xsub469 subtract -82272171.8 -776.238587E-372690416 -> -82272171.8 Inexact Rounded -xadd470 add 412411244.E-774339264 866452.465 -> 866452.465 Inexact Rounded -xcom470 compare 412411244.E-774339264 866452.465 -> -1 -xdiv470 divide 412411244.E-774339264 866452.465 -> 4.75976768E-774339262 Inexact Rounded -xdvi470 divideint 412411244.E-774339264 866452.465 -> 0 -xmul470 multiply 412411244.E-774339264 866452.465 -> 3.57334739E-774339250 Inexact Rounded -xpow470 power 412411244.E-774339264 866452 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem470 remainder 412411244.E-774339264 866452.465 -> 4.12411244E-774339256 -xsub470 subtract 412411244.E-774339264 866452.465 -> -866452.465 Inexact Rounded -xadd471 add -103.474598 -3.01660661E-446661257 -> -103.474598 Inexact Rounded -xcom471 compare -103.474598 -3.01660661E-446661257 -> -1 -xdiv471 divide -103.474598 -3.01660661E-446661257 -> 3.43016546E+446661258 Inexact Rounded -xdvi471 divideint -103.474598 -3.01660661E-446661257 -> NaN Division_impossible -xmul471 multiply -103.474598 -3.01660661E-446661257 -> 3.12142156E-446661255 Inexact Rounded -xpow471 power -103.474598 -3 -> -9.02607123E-7 Inexact Rounded -xrem471 remainder -103.474598 -3.01660661E-446661257 -> NaN Division_impossible -xsub471 subtract -103.474598 -3.01660661E-446661257 -> -103.474598 Inexact Rounded -xadd472 add -31027.8323 -475378186. -> -475409214 Inexact Rounded -xcom472 compare -31027.8323 -475378186. -> 1 -xdiv472 divide -31027.8323 -475378186. -> 0.0000652697856 Inexact Rounded -xdvi472 divideint -31027.8323 -475378186. -> 0 -xmul472 multiply -31027.8323 -475378186. -> 1.47499546E+13 Inexact Rounded -xpow472 power -31027.8323 -475378186 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem472 remainder -31027.8323 -475378186. -> -31027.8323 -xsub472 subtract -31027.8323 -475378186. -> 475347158 Inexact Rounded -xadd473 add -1199339.72 -5.73068392E+53774632 -> -5.73068392E+53774632 Inexact Rounded -xcom473 compare -1199339.72 -5.73068392E+53774632 -> 1 -xdiv473 divide -1199339.72 -5.73068392E+53774632 -> 2.09283872E-53774627 Inexact Rounded -xdvi473 divideint -1199339.72 -5.73068392E+53774632 -> 0 -xmul473 multiply -1199339.72 -5.73068392E+53774632 -> 6.87303685E+53774638 Inexact Rounded -xpow473 power -1199339.72 -6 -> 3.36005741E-37 Inexact Rounded -xrem473 remainder -1199339.72 -5.73068392E+53774632 -> -1199339.72 -xsub473 subtract -1199339.72 -5.73068392E+53774632 -> 5.73068392E+53774632 Inexact Rounded -xadd474 add -732908.930E+364345433 -3486146.26 -> -7.32908930E+364345438 Inexact Rounded -xcom474 compare -732908.930E+364345433 -3486146.26 -> -1 -xdiv474 divide -732908.930E+364345433 -3486146.26 -> 2.10234705E+364345432 Inexact Rounded -xdvi474 divideint -732908.930E+364345433 -3486146.26 -> NaN Division_impossible -xmul474 multiply -732908.930E+364345433 -3486146.26 -> 2.55502773E+364345445 Inexact Rounded -xpow474 power -732908.930E+364345433 -3486146 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem474 remainder -732908.930E+364345433 -3486146.26 -> NaN Division_impossible -xsub474 subtract -732908.930E+364345433 -3486146.26 -> -7.32908930E+364345438 Inexact Rounded -xadd475 add -2376150.83 -46777583.3 -> -49153734.1 Inexact Rounded -xcom475 compare -2376150.83 -46777583.3 -> 1 -xdiv475 divide -2376150.83 -46777583.3 -> 0.0507967847 Inexact Rounded -xdvi475 divideint -2376150.83 -46777583.3 -> 0 -xmul475 multiply -2376150.83 -46777583.3 -> 1.11150593E+14 Inexact Rounded -xpow475 power -2376150.83 -46777583 -> -3.51886193E-298247976 Inexact Rounded -xrem475 remainder -2376150.83 -46777583.3 -> -2376150.83 -xsub475 subtract -2376150.83 -46777583.3 -> 44401432.5 Inexact Rounded -xadd476 add 6.3664211 -140854908. -> -140854902 Inexact Rounded -xcom476 compare 6.3664211 -140854908. -> 1 -xdiv476 divide 6.3664211 -140854908. -> -4.51984328E-8 Inexact Rounded -xdvi476 divideint 6.3664211 -140854908. -> -0 -xmul476 multiply 6.3664211 -140854908. -> -896741658 Inexact Rounded -xpow476 power 6.3664211 -140854908 -> 7.25432803E-113232608 Inexact Rounded -xrem476 remainder 6.3664211 -140854908. -> 6.3664211 -xsub476 subtract 6.3664211 -140854908. -> 140854914 Inexact Rounded -xadd477 add -15.791522 1902.30210E+90741844 -> 1.90230210E+90741847 Inexact Rounded -xcom477 compare -15.791522 1902.30210E+90741844 -> -1 -xdiv477 divide -15.791522 1902.30210E+90741844 -> -8.30126929E-90741847 Inexact Rounded -xdvi477 divideint -15.791522 1902.30210E+90741844 -> -0 -xmul477 multiply -15.791522 1902.30210E+90741844 -> -3.00402455E+90741848 Inexact Rounded -xpow477 power -15.791522 2 -> 249.372167 Inexact Rounded -xrem477 remainder -15.791522 1902.30210E+90741844 -> -15.791522 -xsub477 subtract -15.791522 1902.30210E+90741844 -> -1.90230210E+90741847 Inexact Rounded -xadd478 add 15356.1505E+373950429 2.88020400 -> 1.53561505E+373950433 Inexact Rounded -xcom478 compare 15356.1505E+373950429 2.88020400 -> 1 -xdiv478 divide 15356.1505E+373950429 2.88020400 -> 5.33161905E+373950432 Inexact Rounded -xdvi478 divideint 15356.1505E+373950429 2.88020400 -> NaN Division_impossible -xmul478 multiply 15356.1505E+373950429 2.88020400 -> 4.42288461E+373950433 Inexact Rounded -xpow478 power 15356.1505E+373950429 3 -> Infinity Overflow Inexact Rounded -xrem478 remainder 15356.1505E+373950429 2.88020400 -> NaN Division_impossible -xsub478 subtract 15356.1505E+373950429 2.88020400 -> 1.53561505E+373950433 Inexact Rounded -xadd479 add -3.12001326E+318884762 9567.21595 -> -3.12001326E+318884762 Inexact Rounded -xcom479 compare -3.12001326E+318884762 9567.21595 -> -1 -xdiv479 divide -3.12001326E+318884762 9567.21595 -> -3.26115066E+318884758 Inexact Rounded -xdvi479 divideint -3.12001326E+318884762 9567.21595 -> NaN Division_impossible -xmul479 multiply -3.12001326E+318884762 9567.21595 -> -2.98498406E+318884766 Inexact Rounded -xpow479 power -3.12001326E+318884762 9567 -> -Infinity Overflow Inexact Rounded -xrem479 remainder -3.12001326E+318884762 9567.21595 -> NaN Division_impossible -xsub479 subtract -3.12001326E+318884762 9567.21595 -> -3.12001326E+318884762 Inexact Rounded -xadd480 add 49436.6528 751.919517 -> 50188.5723 Inexact Rounded -xcom480 compare 49436.6528 751.919517 -> 1 -xdiv480 divide 49436.6528 751.919517 -> 65.7472664 Inexact Rounded -xdvi480 divideint 49436.6528 751.919517 -> 65 -xmul480 multiply 49436.6528 751.919517 -> 37172384.1 Inexact Rounded -xpow480 power 49436.6528 752 -> 8.41185718E+3529 Inexact Rounded -xrem480 remainder 49436.6528 751.919517 -> 561.884195 -xsub480 subtract 49436.6528 751.919517 -> 48684.7333 Inexact Rounded -xadd481 add 552.669453 8.3725760E+16223526 -> 8.37257600E+16223526 Inexact Rounded -xcom481 compare 552.669453 8.3725760E+16223526 -> -1 -xdiv481 divide 552.669453 8.3725760E+16223526 -> 6.60094878E-16223525 Inexact Rounded -xdvi481 divideint 552.669453 8.3725760E+16223526 -> 0 -xmul481 multiply 552.669453 8.3725760E+16223526 -> 4.62726700E+16223529 Inexact Rounded -xpow481 power 552.669453 8 -> 8.70409632E+21 Inexact Rounded -xrem481 remainder 552.669453 8.3725760E+16223526 -> 552.669453 -xsub481 subtract 552.669453 8.3725760E+16223526 -> -8.37257600E+16223526 Inexact Rounded -xadd482 add -3266303 453741.520 -> -2812561.48 Rounded -xcom482 compare -3266303 453741.520 -> -1 -xdiv482 divide -3266303 453741.520 -> -7.19859844 Inexact Rounded -xdvi482 divideint -3266303 453741.520 -> -7 -xmul482 multiply -3266303 453741.520 -> -1.48205729E+12 Inexact Rounded -xpow482 power -3266303 453742 -> 1.02497315E+2955701 Inexact Rounded -xrem482 remainder -3266303 453741.520 -> -90112.360 -xsub482 subtract -3266303 453741.520 -> -3720044.52 Rounded -xadd483 add 12302757.4 542922.487E+414443353 -> 5.42922487E+414443358 Inexact Rounded -xcom483 compare 12302757.4 542922.487E+414443353 -> -1 -xdiv483 divide 12302757.4 542922.487E+414443353 -> 2.26602465E-414443352 Inexact Rounded -xdvi483 divideint 12302757.4 542922.487E+414443353 -> 0 -xmul483 multiply 12302757.4 542922.487E+414443353 -> 6.67944364E+414443365 Inexact Rounded -xpow483 power 12302757.4 5 -> 2.81846276E+35 Inexact Rounded -xrem483 remainder 12302757.4 542922.487E+414443353 -> 12302757.4 -xsub483 subtract 12302757.4 542922.487E+414443353 -> -5.42922487E+414443358 Inexact Rounded -xadd484 add -5670757.79E-784754984 128144.503 -> 128144.503 Inexact Rounded -xcom484 compare -5670757.79E-784754984 128144.503 -> -1 -xdiv484 divide -5670757.79E-784754984 128144.503 -> -4.42528369E-784754983 Inexact Rounded -xdvi484 divideint -5670757.79E-784754984 128144.503 -> -0 -xmul484 multiply -5670757.79E-784754984 128144.503 -> -7.26676439E-784754973 Inexact Rounded -xpow484 power -5670757.79E-784754984 128145 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem484 remainder -5670757.79E-784754984 128144.503 -> -5.67075779E-784754978 -xsub484 subtract -5670757.79E-784754984 128144.503 -> -128144.503 Inexact Rounded -xadd485 add 22.7721968E+842530698 5223.70462 -> 2.27721968E+842530699 Inexact Rounded -xcom485 compare 22.7721968E+842530698 5223.70462 -> 1 -xdiv485 divide 22.7721968E+842530698 5223.70462 -> 4.35939596E+842530695 Inexact Rounded -xdvi485 divideint 22.7721968E+842530698 5223.70462 -> NaN Division_impossible -xmul485 multiply 22.7721968E+842530698 5223.70462 -> 1.18955230E+842530703 Inexact Rounded -xpow485 power 22.7721968E+842530698 5224 -> Infinity Overflow Inexact Rounded -xrem485 remainder 22.7721968E+842530698 5223.70462 -> NaN Division_impossible -xsub485 subtract 22.7721968E+842530698 5223.70462 -> 2.27721968E+842530699 Inexact Rounded -xadd486 add 88.5158199E-980164357 325846116 -> 325846116 Inexact Rounded -xcom486 compare 88.5158199E-980164357 325846116 -> -1 -xdiv486 divide 88.5158199E-980164357 325846116 -> 2.71649148E-980164364 Inexact Rounded -xdvi486 divideint 88.5158199E-980164357 325846116 -> 0 -xmul486 multiply 88.5158199E-980164357 325846116 -> 2.88425361E-980164347 Inexact Rounded -xpow486 power 88.5158199E-980164357 325846116 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem486 remainder 88.5158199E-980164357 325846116 -> 8.85158199E-980164356 -xsub486 subtract 88.5158199E-980164357 325846116 -> -325846116 Inexact Rounded -xadd487 add -22881.0408 5.63661562 -> -22875.4042 Inexact Rounded -xcom487 compare -22881.0408 5.63661562 -> -1 -xdiv487 divide -22881.0408 5.63661562 -> -4059.35802 Inexact Rounded -xdvi487 divideint -22881.0408 5.63661562 -> -4059 -xmul487 multiply -22881.0408 5.63661562 -> -128971.632 Inexact Rounded -xpow487 power -22881.0408 6 -> 1.43500909E+26 Inexact Rounded -xrem487 remainder -22881.0408 5.63661562 -> -2.01799842 -xsub487 subtract -22881.0408 5.63661562 -> -22886.6774 Inexact Rounded -xadd488 add -7157.57449 -76.4455519E-85647047 -> -7157.57449 Inexact Rounded -xcom488 compare -7157.57449 -76.4455519E-85647047 -> -1 -xdiv488 divide -7157.57449 -76.4455519E-85647047 -> 9.36297052E+85647048 Inexact Rounded -xdvi488 divideint -7157.57449 -76.4455519E-85647047 -> NaN Division_impossible -xmul488 multiply -7157.57449 -76.4455519E-85647047 -> 5.47164732E-85647042 Inexact Rounded -xpow488 power -7157.57449 -8 -> 1.45168700E-31 Inexact Rounded -xrem488 remainder -7157.57449 -76.4455519E-85647047 -> NaN Division_impossible -xsub488 subtract -7157.57449 -76.4455519E-85647047 -> -7157.57449 Inexact Rounded -xadd489 add -503113.801 -9715149.82E-612184422 -> -503113.801 Inexact Rounded -xcom489 compare -503113.801 -9715149.82E-612184422 -> -1 -xdiv489 divide -503113.801 -9715149.82E-612184422 -> 5.17865201E+612184420 Inexact Rounded -xdvi489 divideint -503113.801 -9715149.82E-612184422 -> NaN Division_impossible -xmul489 multiply -503113.801 -9715149.82E-612184422 -> 4.88782595E-612184410 Inexact Rounded -xpow489 power -503113.801 -10 -> 9.62360287E-58 Inexact Rounded -xrem489 remainder -503113.801 -9715149.82E-612184422 -> NaN Division_impossible -xsub489 subtract -503113.801 -9715149.82E-612184422 -> -503113.801 Inexact Rounded -xadd490 add -3066962.41 -55.3096879 -> -3067017.72 Inexact Rounded -xcom490 compare -3066962.41 -55.3096879 -> -1 -xdiv490 divide -3066962.41 -55.3096879 -> 55450.7271 Inexact Rounded -xdvi490 divideint -3066962.41 -55.3096879 -> 55450 -xmul490 multiply -3066962.41 -55.3096879 -> 169632734 Inexact Rounded -xpow490 power -3066962.41 -55 -> -1.70229600E-357 Inexact Rounded -xrem490 remainder -3066962.41 -55.3096879 -> -40.2159450 -xsub490 subtract -3066962.41 -55.3096879 -> -3066907.10 Inexact Rounded -xadd491 add -53311.5738E+156608936 -7.45890666 -> -5.33115738E+156608940 Inexact Rounded -xcom491 compare -53311.5738E+156608936 -7.45890666 -> -1 -xdiv491 divide -53311.5738E+156608936 -7.45890666 -> 7.14737109E+156608939 Inexact Rounded -xdvi491 divideint -53311.5738E+156608936 -7.45890666 -> NaN Division_impossible -xmul491 multiply -53311.5738E+156608936 -7.45890666 -> 3.97646053E+156608941 Inexact Rounded -xpow491 power -53311.5738E+156608936 -7 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem491 remainder -53311.5738E+156608936 -7.45890666 -> NaN Division_impossible -xsub491 subtract -53311.5738E+156608936 -7.45890666 -> -5.33115738E+156608940 Inexact Rounded -xadd492 add 998890068. -92.057879 -> 998889976 Inexact Rounded -xcom492 compare 998890068. -92.057879 -> 1 -xdiv492 divide 998890068. -92.057879 -> -10850674.4 Inexact Rounded -xdvi492 divideint 998890068. -92.057879 -> -10850674 -xmul492 multiply 998890068. -92.057879 -> -9.19557010E+10 Inexact Rounded -xpow492 power 998890068. -92 -> 1.10757225E-828 Inexact Rounded -xrem492 remainder 998890068. -92.057879 -> 33.839554 -xsub492 subtract 998890068. -92.057879 -> 998890160 Inexact Rounded -xadd493 add 122.495591 -407836028. -> -407835906 Inexact Rounded -xcom493 compare 122.495591 -407836028. -> 1 -xdiv493 divide 122.495591 -407836028. -> -3.00355002E-7 Inexact Rounded -xdvi493 divideint 122.495591 -407836028. -> -0 -xmul493 multiply 122.495591 -407836028. -> -4.99581153E+10 Inexact Rounded -xpow493 power 122.495591 -407836028 -> 4.82463773E-851610754 Inexact Rounded -xrem493 remainder 122.495591 -407836028. -> 122.495591 -xsub493 subtract 122.495591 -407836028. -> 407836150 Inexact Rounded -xadd494 add 187098.488 6220.05584E-236541249 -> 187098.488 Inexact Rounded -xcom494 compare 187098.488 6220.05584E-236541249 -> 1 -xdiv494 divide 187098.488 6220.05584E-236541249 -> 3.00798727E+236541250 Inexact Rounded -xdvi494 divideint 187098.488 6220.05584E-236541249 -> NaN Division_impossible -xmul494 multiply 187098.488 6220.05584E-236541249 -> 1.16376304E-236541240 Inexact Rounded -xpow494 power 187098.488 6 -> 4.28964811E+31 Inexact Rounded -xrem494 remainder 187098.488 6220.05584E-236541249 -> NaN Division_impossible -xsub494 subtract 187098.488 6220.05584E-236541249 -> 187098.488 Inexact Rounded -xadd495 add 4819899.21E+432982550 -727441917 -> 4.81989921E+432982556 Inexact Rounded -xcom495 compare 4819899.21E+432982550 -727441917 -> 1 -xdiv495 divide 4819899.21E+432982550 -727441917 -> -6.62582001E+432982547 Inexact Rounded -xdvi495 divideint 4819899.21E+432982550 -727441917 -> NaN Division_impossible -xmul495 multiply 4819899.21E+432982550 -727441917 -> -3.50619672E+432982565 Inexact Rounded -xpow495 power 4819899.21E+432982550 -727441917 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem495 remainder 4819899.21E+432982550 -727441917 -> NaN Division_impossible -xsub495 subtract 4819899.21E+432982550 -727441917 -> 4.81989921E+432982556 Inexact Rounded -xadd496 add 5770.01020E+507459752 -4208339.33E-129766680 -> 5.77001020E+507459755 Inexact Rounded -xcom496 compare 5770.01020E+507459752 -4208339.33E-129766680 -> 1 -xdiv496 divide 5770.01020E+507459752 -4208339.33E-129766680 -> -1.37108958E+637226429 Inexact Rounded -xdvi496 divideint 5770.01020E+507459752 -4208339.33E-129766680 -> NaN Division_impossible -xmul496 multiply 5770.01020E+507459752 -4208339.33E-129766680 -> -2.42821609E+377693082 Inexact Rounded -xpow496 power 5770.01020E+507459752 -4 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -xrem496 remainder 5770.01020E+507459752 -4208339.33E-129766680 -> NaN Division_impossible -xsub496 subtract 5770.01020E+507459752 -4208339.33E-129766680 -> 5.77001020E+507459755 Inexact Rounded -xadd497 add -286.371320 710319152 -> 710318866 Inexact Rounded -xcom497 compare -286.371320 710319152 -> -1 -xdiv497 divide -286.371320 710319152 -> -4.03158664E-7 Inexact Rounded -xdvi497 divideint -286.371320 710319152 -> -0 -xmul497 multiply -286.371320 710319152 -> -2.03415033E+11 Inexact Rounded -xpow497 power -286.371320 710319152 -> Infinity Overflow Inexact Rounded -xrem497 remainder -286.371320 710319152 -> -286.371320 -xsub497 subtract -286.371320 710319152 -> -710319438 Inexact Rounded -xadd498 add -7.27403536 -481469656E-835183700 -> -7.27403536 Inexact Rounded -xcom498 compare -7.27403536 -481469656E-835183700 -> -1 -xdiv498 divide -7.27403536 -481469656E-835183700 -> 1.51079830E+835183692 Inexact Rounded -xdvi498 divideint -7.27403536 -481469656E-835183700 -> NaN Division_impossible -xmul498 multiply -7.27403536 -481469656E-835183700 -> 3.50222730E-835183691 Inexact Rounded -xpow498 power -7.27403536 -5 -> -0.0000491046885 Inexact Rounded -xrem498 remainder -7.27403536 -481469656E-835183700 -> NaN Division_impossible -xsub498 subtract -7.27403536 -481469656E-835183700 -> -7.27403536 Inexact Rounded -xadd499 add -6157.74292 -94075286.2E+92555877 -> -9.40752862E+92555884 Inexact Rounded -xcom499 compare -6157.74292 -94075286.2E+92555877 -> 1 -xdiv499 divide -6157.74292 -94075286.2E+92555877 -> 6.54554790E-92555882 Inexact Rounded -xdvi499 divideint -6157.74292 -94075286.2E+92555877 -> 0 -xmul499 multiply -6157.74292 -94075286.2E+92555877 -> 5.79291428E+92555888 Inexact Rounded -xpow499 power -6157.74292 -9 -> -7.85608218E-35 Inexact Rounded -xrem499 remainder -6157.74292 -94075286.2E+92555877 -> -6157.74292 -xsub499 subtract -6157.74292 -94075286.2E+92555877 -> 9.40752862E+92555884 Inexact Rounded -xadd500 add -525445087.E+231529167 188227460 -> -5.25445087E+231529175 Inexact Rounded -xcom500 compare -525445087.E+231529167 188227460 -> -1 -xdiv500 divide -525445087.E+231529167 188227460 -> -2.79154321E+231529167 Inexact Rounded -xdvi500 divideint -525445087.E+231529167 188227460 -> NaN Division_impossible -xmul500 multiply -525445087.E+231529167 188227460 -> -9.89031941E+231529183 Inexact Rounded -xpow500 power -525445087.E+231529167 188227460 -> Infinity Overflow Inexact Rounded -xrem500 remainder -525445087.E+231529167 188227460 -> NaN Division_impossible -xsub500 subtract -525445087.E+231529167 188227460 -> -5.25445087E+231529175 Inexact Rounded diff --git a/sys/lib/python/test/decimaltestdata/remainder.decTest b/sys/lib/python/test/decimaltestdata/remainder.decTest deleted file mode 100644 index 6eb49c32a..000000000 --- a/sys/lib/python/test/decimaltestdata/remainder.decTest +++ /dev/null @@ -1,629 +0,0 @@ ------------------------------------------------------------------------- --- remainder.decTest -- decimal remainder -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - --- sanity checks (as base, above) -remx001 remainder 1 1 -> 0 -remx002 remainder 2 1 -> 0 -remx003 remainder 1 2 -> 1 -remx004 remainder 2 2 -> 0 -remx005 remainder 0 1 -> 0 -remx006 remainder 0 2 -> 0 -remx007 remainder 1 3 -> 1 -remx008 remainder 2 3 -> 2 -remx009 remainder 3 3 -> 0 - -remx010 remainder 2.4 1 -> 0.4 -remx011 remainder 2.4 -1 -> 0.4 -remx012 remainder -2.4 1 -> -0.4 -remx013 remainder -2.4 -1 -> -0.4 -remx014 remainder 2.40 1 -> 0.40 -remx015 remainder 2.400 1 -> 0.400 -remx016 remainder 2.4 2 -> 0.4 -remx017 remainder 2.400 2 -> 0.400 -remx018 remainder 2. 2 -> 0 -remx019 remainder 20 20 -> 0 - -remx020 remainder 187 187 -> 0 -remx021 remainder 5 2 -> 1 -remx022 remainder 5 2.0 -> 1.0 -remx023 remainder 5 2.000 -> 1.000 -remx024 remainder 5 0.200 -> 0.000 -remx025 remainder 5 0.200 -> 0.000 - -remx030 remainder 1 2 -> 1 -remx031 remainder 1 4 -> 1 -remx032 remainder 1 8 -> 1 - -remx033 remainder 1 16 -> 1 -remx034 remainder 1 32 -> 1 -remx035 remainder 1 64 -> 1 -remx040 remainder 1 -2 -> 1 -remx041 remainder 1 -4 -> 1 -remx042 remainder 1 -8 -> 1 -remx043 remainder 1 -16 -> 1 -remx044 remainder 1 -32 -> 1 -remx045 remainder 1 -64 -> 1 -remx050 remainder -1 2 -> -1 -remx051 remainder -1 4 -> -1 -remx052 remainder -1 8 -> -1 -remx053 remainder -1 16 -> -1 -remx054 remainder -1 32 -> -1 -remx055 remainder -1 64 -> -1 -remx060 remainder -1 -2 -> -1 -remx061 remainder -1 -4 -> -1 -remx062 remainder -1 -8 -> -1 -remx063 remainder -1 -16 -> -1 -remx064 remainder -1 -32 -> -1 -remx065 remainder -1 -64 -> -1 - -remx066 remainder 999999999 1 -> 0 -remx067 remainder 999999999.4 1 -> 0.4 -remx068 remainder 999999999.5 1 -> 0.5 -remx069 remainder 999999999.9 1 -> 0.9 -remx070 remainder 999999999.999 1 -> 0.999 -precision: 6 -remx071 remainder 999999999 1 -> NaN Division_impossible -remx072 remainder 99999999 1 -> NaN Division_impossible -remx073 remainder 9999999 1 -> NaN Division_impossible -remx074 remainder 999999 1 -> 0 -remx075 remainder 99999 1 -> 0 -remx076 remainder 9999 1 -> 0 -remx077 remainder 999 1 -> 0 -remx078 remainder 99 1 -> 0 -remx079 remainder 9 1 -> 0 - -precision: 9 -remx080 remainder 0. 1 -> 0 -remx081 remainder .0 1 -> 0.0 -remx082 remainder 0.00 1 -> 0.00 -remx083 remainder 0.00E+9 1 -> 0 -remx084 remainder 0.00E+3 1 -> 0 -remx085 remainder 0.00E+2 1 -> 0 -remx086 remainder 0.00E+1 1 -> 0.0 -remx087 remainder 0.00E+0 1 -> 0.00 -remx088 remainder 0.00E-0 1 -> 0.00 -remx089 remainder 0.00E-1 1 -> 0.000 -remx090 remainder 0.00E-2 1 -> 0.0000 -remx091 remainder 0.00E-3 1 -> 0.00000 -remx092 remainder 0.00E-4 1 -> 0.000000 -remx093 remainder 0.00E-5 1 -> 0E-7 -remx094 remainder 0.00E-6 1 -> 0E-8 -remx095 remainder 0.0000E-50 1 -> 0E-54 - --- Various flavours of remainder by 0 -precision: 9 -maxexponent: 999999999 -minexponent: -999999999 -remx101 remainder 0 0 -> NaN Division_undefined -remx102 remainder 0 -0 -> NaN Division_undefined -remx103 remainder -0 0 -> NaN Division_undefined -remx104 remainder -0 -0 -> NaN Division_undefined -remx105 remainder 0.0E5 0 -> NaN Division_undefined -remx106 remainder 0.000 0 -> NaN Division_undefined --- [Some think this next group should be Division_by_zero exception, but --- IEEE 854 is explicit that it is Invalid operation .. for --- remainder-near, anyway] -remx107 remainder 0.0001 0 -> NaN Invalid_operation -remx108 remainder 0.01 0 -> NaN Invalid_operation -remx109 remainder 0.1 0 -> NaN Invalid_operation -remx110 remainder 1 0 -> NaN Invalid_operation -remx111 remainder 1 0.0 -> NaN Invalid_operation -remx112 remainder 10 0.0 -> NaN Invalid_operation -remx113 remainder 1E+100 0.0 -> NaN Invalid_operation -remx114 remainder 1E+1000 0 -> NaN Invalid_operation -remx115 remainder 0.0001 -0 -> NaN Invalid_operation -remx116 remainder 0.01 -0 -> NaN Invalid_operation -remx119 remainder 0.1 -0 -> NaN Invalid_operation -remx120 remainder 1 -0 -> NaN Invalid_operation -remx121 remainder 1 -0.0 -> NaN Invalid_operation -remx122 remainder 10 -0.0 -> NaN Invalid_operation -remx123 remainder 1E+100 -0.0 -> NaN Invalid_operation -remx124 remainder 1E+1000 -0 -> NaN Invalid_operation --- and zeros on left -remx130 remainder 0 1 -> 0 -remx131 remainder 0 -1 -> 0 -remx132 remainder 0.0 1 -> 0.0 -remx133 remainder 0.0 -1 -> 0.0 -remx134 remainder -0 1 -> -0 -remx135 remainder -0 -1 -> -0 -remx136 remainder -0.0 1 -> -0.0 -remx137 remainder -0.0 -1 -> -0.0 - --- 0.5ers -remx143 remainder 0.5 2 -> 0.5 -remx144 remainder 0.5 2.1 -> 0.5 -remx145 remainder 0.5 2.01 -> 0.50 -remx146 remainder 0.5 2.001 -> 0.500 -remx147 remainder 0.50 2 -> 0.50 -remx148 remainder 0.50 2.01 -> 0.50 -remx149 remainder 0.50 2.001 -> 0.500 - --- steadies -remx150 remainder 1 1 -> 0 -remx151 remainder 1 2 -> 1 -remx152 remainder 1 3 -> 1 -remx153 remainder 1 4 -> 1 -remx154 remainder 1 5 -> 1 -remx155 remainder 1 6 -> 1 -remx156 remainder 1 7 -> 1 -remx157 remainder 1 8 -> 1 -remx158 remainder 1 9 -> 1 -remx159 remainder 1 10 -> 1 -remx160 remainder 1 1 -> 0 -remx161 remainder 2 1 -> 0 -remx162 remainder 3 1 -> 0 -remx163 remainder 4 1 -> 0 -remx164 remainder 5 1 -> 0 -remx165 remainder 6 1 -> 0 -remx166 remainder 7 1 -> 0 -remx167 remainder 8 1 -> 0 -remx168 remainder 9 1 -> 0 -remx169 remainder 10 1 -> 0 - --- some differences from remainderNear -remx171 remainder 0.4 1.020 -> 0.400 -remx172 remainder 0.50 1.020 -> 0.500 -remx173 remainder 0.51 1.020 -> 0.510 -remx174 remainder 0.52 1.020 -> 0.520 -remx175 remainder 0.6 1.020 -> 0.600 - - --- More flavours of remainder by 0 -maxexponent: 999999999 -minexponent: -999999999 -remx201 remainder 0 0 -> NaN Division_undefined -remx202 remainder 0.0E5 0 -> NaN Division_undefined -remx203 remainder 0.000 0 -> NaN Division_undefined -remx204 remainder 0.0001 0 -> NaN Invalid_operation -remx205 remainder 0.01 0 -> NaN Invalid_operation -remx206 remainder 0.1 0 -> NaN Invalid_operation -remx207 remainder 1 0 -> NaN Invalid_operation -remx208 remainder 1 0.0 -> NaN Invalid_operation -remx209 remainder 10 0.0 -> NaN Invalid_operation -remx210 remainder 1E+100 0.0 -> NaN Invalid_operation -remx211 remainder 1E+1000 0 -> NaN Invalid_operation - --- some differences from remainderNear -remx231 remainder -0.4 1.020 -> -0.400 -remx232 remainder -0.50 1.020 -> -0.500 -remx233 remainder -0.51 1.020 -> -0.510 -remx234 remainder -0.52 1.020 -> -0.520 -remx235 remainder -0.6 1.020 -> -0.600 - --- high Xs -remx240 remainder 1E+2 1.00 -> 0.00 - - --- test some cases that are close to exponent overflow -maxexponent: 999999999 -minexponent: -999999999 -remx270 remainder 1 1e999999999 -> 1 -remx271 remainder 1 0.9e999999999 -> 1 -remx272 remainder 1 0.99e999999999 -> 1 -remx273 remainder 1 0.999999999e999999999 -> 1 -remx274 remainder 9e999999999 1 -> NaN Division_impossible -remx275 remainder 9.9e999999999 1 -> NaN Division_impossible -remx276 remainder 9.99e999999999 1 -> NaN Division_impossible -remx277 remainder 9.99999999e999999999 1 -> NaN Division_impossible - -remx280 remainder 0.1 9e-999999999 -> NaN Division_impossible -remx281 remainder 0.1 99e-999999999 -> NaN Division_impossible -remx282 remainder 0.1 999e-999999999 -> NaN Division_impossible - -remx283 remainder 0.1 9e-999999998 -> NaN Division_impossible -remx284 remainder 0.1 99e-999999998 -> NaN Division_impossible -remx285 remainder 0.1 999e-999999998 -> NaN Division_impossible -remx286 remainder 0.1 999e-999999997 -> NaN Division_impossible -remx287 remainder 0.1 9999e-999999997 -> NaN Division_impossible -remx288 remainder 0.1 99999e-999999997 -> NaN Division_impossible - --- remx3xx are from DiagBigDecimal -remx301 remainder 1 3 -> 1 -remx302 remainder 5 5 -> 0 -remx303 remainder 13 10 -> 3 -remx304 remainder 13 50 -> 13 -remx305 remainder 13 100 -> 13 -remx306 remainder 13 1000 -> 13 -remx307 remainder .13 1 -> 0.13 -remx308 remainder 0.133 1 -> 0.133 -remx309 remainder 0.1033 1 -> 0.1033 -remx310 remainder 1.033 1 -> 0.033 -remx311 remainder 10.33 1 -> 0.33 -remx312 remainder 10.33 10 -> 0.33 -remx313 remainder 103.3 1 -> 0.3 -remx314 remainder 133 10 -> 3 -remx315 remainder 1033 10 -> 3 -remx316 remainder 1033 50 -> 33 -remx317 remainder 101.0 3 -> 2.0 -remx318 remainder 102.0 3 -> 0.0 -remx319 remainder 103.0 3 -> 1.0 -remx320 remainder 2.40 1 -> 0.40 -remx321 remainder 2.400 1 -> 0.400 -remx322 remainder 2.4 1 -> 0.4 -remx323 remainder 2.4 2 -> 0.4 -remx324 remainder 2.400 2 -> 0.400 -remx325 remainder 1 0.3 -> 0.1 -remx326 remainder 1 0.30 -> 0.10 -remx327 remainder 1 0.300 -> 0.100 -remx328 remainder 1 0.3000 -> 0.1000 -remx329 remainder 1.0 0.3 -> 0.1 -remx330 remainder 1.00 0.3 -> 0.10 -remx331 remainder 1.000 0.3 -> 0.100 -remx332 remainder 1.0000 0.3 -> 0.1000 -remx333 remainder 0.5 2 -> 0.5 -remx334 remainder 0.5 2.1 -> 0.5 -remx335 remainder 0.5 2.01 -> 0.50 -remx336 remainder 0.5 2.001 -> 0.500 -remx337 remainder 0.50 2 -> 0.50 -remx338 remainder 0.50 2.01 -> 0.50 -remx339 remainder 0.50 2.001 -> 0.500 - -remx340 remainder 0.5 0.5000001 -> 0.5000000 -remx341 remainder 0.5 0.50000001 -> 0.50000000 -remx342 remainder 0.5 0.500000001 -> 0.500000000 -remx343 remainder 0.5 0.5000000001 -> 0.500000000 Rounded -remx344 remainder 0.5 0.50000000001 -> 0.500000000 Rounded -remx345 remainder 0.5 0.4999999 -> 1E-7 -remx346 remainder 0.5 0.49999999 -> 1E-8 -remx347 remainder 0.5 0.499999999 -> 1E-9 -remx348 remainder 0.5 0.4999999999 -> 1E-10 -remx349 remainder 0.5 0.49999999999 -> 1E-11 -remx350 remainder 0.5 0.499999999999 -> 1E-12 - -remx351 remainder 0.03 7 -> 0.03 -remx352 remainder 5 2 -> 1 -remx353 remainder 4.1 2 -> 0.1 -remx354 remainder 4.01 2 -> 0.01 -remx355 remainder 4.001 2 -> 0.001 -remx356 remainder 4.0001 2 -> 0.0001 -remx357 remainder 4.00001 2 -> 0.00001 -remx358 remainder 4.000001 2 -> 0.000001 -remx359 remainder 4.0000001 2 -> 1E-7 - -remx360 remainder 1.2 0.7345 -> 0.4655 -remx361 remainder 0.8 12 -> 0.8 -remx362 remainder 0.8 0.2 -> 0.0 -remx363 remainder 0.8 0.3 -> 0.2 -remx364 remainder 0.800 12 -> 0.800 -remx365 remainder 0.800 1.7 -> 0.800 -remx366 remainder 2.400 2 -> 0.400 - -precision: 6 -remx371 remainder 2.400 2 -> 0.400 -precision: 3 --- long operand, rounded, case -remx372 remainder 12345678900000 12e+12 -> 3.46E+11 Inexact Rounded --- 12000000000000 - -precision: 5 -remx381 remainder 12345 1 -> 0 -remx382 remainder 12345 1.0001 -> 0.7657 -remx383 remainder 12345 1.001 -> 0.668 -remx384 remainder 12345 1.01 -> 0.78 -remx385 remainder 12345 1.1 -> 0.8 -remx386 remainder 12355 4 -> 3 -remx387 remainder 12345 4 -> 1 -remx388 remainder 12355 4.0001 -> 2.6912 -remx389 remainder 12345 4.0001 -> 0.6914 -remx390 remainder 12345 4.9 -> 1.9 -remx391 remainder 12345 4.99 -> 4.73 -remx392 remainder 12345 4.999 -> 2.469 -remx393 remainder 12345 4.9999 -> 0.2469 -remx394 remainder 12345 5 -> 0 -remx395 remainder 12345 5.0001 -> 4.7532 -remx396 remainder 12345 5.001 -> 2.532 -remx397 remainder 12345 5.01 -> 0.36 -remx398 remainder 12345 5.1 -> 3.0 - -precision: 9 --- the nasty division-by-1 cases -remx401 remainder 0.5 1 -> 0.5 -remx402 remainder 0.55 1 -> 0.55 -remx403 remainder 0.555 1 -> 0.555 -remx404 remainder 0.5555 1 -> 0.5555 -remx405 remainder 0.55555 1 -> 0.55555 -remx406 remainder 0.555555 1 -> 0.555555 -remx407 remainder 0.5555555 1 -> 0.5555555 -remx408 remainder 0.55555555 1 -> 0.55555555 -remx409 remainder 0.555555555 1 -> 0.555555555 - - --- Specials -remx680 remainder Inf -Inf -> NaN Invalid_operation -remx681 remainder Inf -1000 -> NaN Invalid_operation -remx682 remainder Inf -1 -> NaN Invalid_operation -remx683 remainder Inf 0 -> NaN Invalid_operation -remx684 remainder Inf -0 -> NaN Invalid_operation -remx685 remainder Inf 1 -> NaN Invalid_operation -remx686 remainder Inf 1000 -> NaN Invalid_operation -remx687 remainder Inf Inf -> NaN Invalid_operation -remx688 remainder -1000 Inf -> -1000 -remx689 remainder -Inf Inf -> NaN Invalid_operation -remx691 remainder -1 Inf -> -1 -remx692 remainder 0 Inf -> 0 -remx693 remainder -0 Inf -> -0 -remx694 remainder 1 Inf -> 1 -remx695 remainder 1000 Inf -> 1000 -remx696 remainder Inf Inf -> NaN Invalid_operation - -remx700 remainder -Inf -Inf -> NaN Invalid_operation -remx701 remainder -Inf -1000 -> NaN Invalid_operation -remx702 remainder -Inf -1 -> NaN Invalid_operation -remx703 remainder -Inf -0 -> NaN Invalid_operation -remx704 remainder -Inf 0 -> NaN Invalid_operation -remx705 remainder -Inf 1 -> NaN Invalid_operation -remx706 remainder -Inf 1000 -> NaN Invalid_operation -remx707 remainder -Inf Inf -> NaN Invalid_operation -remx708 remainder -Inf -Inf -> NaN Invalid_operation -remx709 remainder -1000 Inf -> -1000 -remx710 remainder -1 -Inf -> -1 -remx711 remainder -0 -Inf -> -0 -remx712 remainder 0 -Inf -> 0 -remx713 remainder 1 -Inf -> 1 -remx714 remainder 1000 -Inf -> 1000 -remx715 remainder Inf -Inf -> NaN Invalid_operation - -remx721 remainder NaN -Inf -> NaN -remx722 remainder NaN -1000 -> NaN -remx723 remainder NaN -1 -> NaN -remx724 remainder NaN -0 -> NaN -remx725 remainder -NaN 0 -> -NaN -remx726 remainder NaN 1 -> NaN -remx727 remainder NaN 1000 -> NaN -remx728 remainder NaN Inf -> NaN -remx729 remainder NaN -NaN -> NaN -remx730 remainder -Inf NaN -> NaN -remx731 remainder -1000 NaN -> NaN -remx732 remainder -1 NaN -> NaN -remx733 remainder -0 -NaN -> -NaN -remx734 remainder 0 NaN -> NaN -remx735 remainder 1 -NaN -> -NaN -remx736 remainder 1000 NaN -> NaN -remx737 remainder Inf NaN -> NaN - -remx741 remainder sNaN -Inf -> NaN Invalid_operation -remx742 remainder sNaN -1000 -> NaN Invalid_operation -remx743 remainder -sNaN -1 -> -NaN Invalid_operation -remx744 remainder sNaN -0 -> NaN Invalid_operation -remx745 remainder sNaN 0 -> NaN Invalid_operation -remx746 remainder sNaN 1 -> NaN Invalid_operation -remx747 remainder sNaN 1000 -> NaN Invalid_operation -remx749 remainder sNaN NaN -> NaN Invalid_operation -remx750 remainder sNaN sNaN -> NaN Invalid_operation -remx751 remainder NaN sNaN -> NaN Invalid_operation -remx752 remainder -Inf sNaN -> NaN Invalid_operation -remx753 remainder -1000 sNaN -> NaN Invalid_operation -remx754 remainder -1 sNaN -> NaN Invalid_operation -remx755 remainder -0 sNaN -> NaN Invalid_operation -remx756 remainder 0 sNaN -> NaN Invalid_operation -remx757 remainder 1 sNaN -> NaN Invalid_operation -remx758 remainder 1000 sNaN -> NaN Invalid_operation -remx759 remainder Inf -sNaN -> -NaN Invalid_operation - --- propaging NaNs -remx760 remainder NaN1 NaN7 -> NaN1 -remx761 remainder sNaN2 NaN8 -> NaN2 Invalid_operation -remx762 remainder NaN3 sNaN9 -> NaN9 Invalid_operation -remx763 remainder sNaN4 sNaN10 -> NaN4 Invalid_operation -remx764 remainder 15 NaN11 -> NaN11 -remx765 remainder NaN6 NaN12 -> NaN6 -remx766 remainder Inf NaN13 -> NaN13 -remx767 remainder NaN14 -Inf -> NaN14 -remx768 remainder 0 NaN15 -> NaN15 -remx769 remainder NaN16 -0 -> NaN16 - --- test some cases that are close to exponent overflow -maxexponent: 999999999 -minexponent: -999999999 -remx770 remainder 1 1e999999999 -> 1 -remx771 remainder 1 0.9e999999999 -> 1 -remx772 remainder 1 0.99e999999999 -> 1 -remx773 remainder 1 0.999999999e999999999 -> 1 -remx774 remainder 9e999999999 1 -> NaN Division_impossible -remx775 remainder 9.9e999999999 1 -> NaN Division_impossible -remx776 remainder 9.99e999999999 1 -> NaN Division_impossible -remx777 remainder 9.99999999e999999999 1 -> NaN Division_impossible - --- long operand checks -maxexponent: 999 -minexponent: -999 -precision: 9 -remx801 remainder 12345678000 100 -> 0 -remx802 remainder 1 12345678000 -> 1 -remx803 remainder 1234567800 10 -> 0 -remx804 remainder 1 1234567800 -> 1 -remx805 remainder 1234567890 10 -> 0 -remx806 remainder 1 1234567890 -> 1 -remx807 remainder 1234567891 10 -> 1 -remx808 remainder 1 1234567891 -> 1 -remx809 remainder 12345678901 100 -> 1 -remx810 remainder 1 12345678901 -> 1 -remx811 remainder 1234567896 10 -> 6 -remx812 remainder 1 1234567896 -> 1 - -precision: 15 -remx821 remainder 12345678000 100 -> 0 -remx822 remainder 1 12345678000 -> 1 -remx823 remainder 1234567800 10 -> 0 -remx824 remainder 1 1234567800 -> 1 -remx825 remainder 1234567890 10 -> 0 -remx826 remainder 1 1234567890 -> 1 -remx827 remainder 1234567891 10 -> 1 -remx828 remainder 1 1234567891 -> 1 -remx829 remainder 12345678901 100 -> 1 -remx830 remainder 1 12345678901 -> 1 -remx831 remainder 1234567896 10 -> 6 -remx832 remainder 1 1234567896 -> 1 - --- worries from divideint -precision: 8 -remx840 remainder 100000000.0 1 -> NaN Division_impossible -remx841 remainder 100000000.4 1 -> NaN Division_impossible -remx842 remainder 100000000.5 1 -> NaN Division_impossible -remx843 remainder 100000000.9 1 -> NaN Division_impossible -remx844 remainder 100000000.999 1 -> NaN Division_impossible -precision: 6 -remx850 remainder 100000003 5 -> NaN Division_impossible -remx851 remainder 10000003 5 -> NaN Division_impossible -remx852 remainder 1000003 5 -> 3 -remx853 remainder 100003 5 -> 3 -remx854 remainder 10003 5 -> 3 -remx855 remainder 1003 5 -> 3 -remx856 remainder 103 5 -> 3 -remx857 remainder 13 5 -> 3 -remx858 remainder 1 5 -> 1 - --- Vladimir's cases -remx860 remainder 123.0e1 10000000000000000 -> 1230 -remx861 remainder 1230 10000000000000000 -> 1230 -remx862 remainder 12.3e2 10000000000000000 -> 1230 -remx863 remainder 1.23e3 10000000000000000 -> 1230 -remx864 remainder 123e1 10000000000000000 -> 1230 -remx870 remainder 123e1 1000000000000000 -> 1230 -remx871 remainder 123e1 100000000000000 -> 1230 -remx872 remainder 123e1 10000000000000 -> 1230 -remx873 remainder 123e1 1000000000000 -> 1230 -remx874 remainder 123e1 100000000000 -> 1230 -remx875 remainder 123e1 10000000000 -> 1230 -remx876 remainder 123e1 1000000000 -> 1230 -remx877 remainder 123e1 100000000 -> 1230 -remx878 remainder 1230 100000000 -> 1230 -remx879 remainder 123e1 10000000 -> 1230 -remx880 remainder 123e1 1000000 -> 1230 -remx881 remainder 123e1 100000 -> 1230 -remx882 remainder 123e1 10000 -> 1230 -remx883 remainder 123e1 1000 -> 230 -remx884 remainder 123e1 100 -> 30 -remx885 remainder 123e1 10 -> 0 -remx886 remainder 123e1 1 -> 0 - -remx889 remainder 123e1 20000000000000000 -> 1230 -remx890 remainder 123e1 2000000000000000 -> 1230 -remx891 remainder 123e1 200000000000000 -> 1230 -remx892 remainder 123e1 20000000000000 -> 1230 -remx893 remainder 123e1 2000000000000 -> 1230 -remx894 remainder 123e1 200000000000 -> 1230 -remx895 remainder 123e1 20000000000 -> 1230 -remx896 remainder 123e1 2000000000 -> 1230 -remx897 remainder 123e1 200000000 -> 1230 -remx899 remainder 123e1 20000000 -> 1230 -remx900 remainder 123e1 2000000 -> 1230 -remx901 remainder 123e1 200000 -> 1230 -remx902 remainder 123e1 20000 -> 1230 -remx903 remainder 123e1 2000 -> 1230 -remx904 remainder 123e1 200 -> 30 -remx905 remainder 123e1 20 -> 10 -remx906 remainder 123e1 2 -> 0 - -remx909 remainder 123e1 50000000000000000 -> 1230 -remx910 remainder 123e1 5000000000000000 -> 1230 -remx911 remainder 123e1 500000000000000 -> 1230 -remx912 remainder 123e1 50000000000000 -> 1230 -remx913 remainder 123e1 5000000000000 -> 1230 -remx914 remainder 123e1 500000000000 -> 1230 -remx915 remainder 123e1 50000000000 -> 1230 -remx916 remainder 123e1 5000000000 -> 1230 -remx917 remainder 123e1 500000000 -> 1230 -remx919 remainder 123e1 50000000 -> 1230 -remx920 remainder 123e1 5000000 -> 1230 -remx921 remainder 123e1 500000 -> 1230 -remx922 remainder 123e1 50000 -> 1230 -remx923 remainder 123e1 5000 -> 1230 -remx924 remainder 123e1 500 -> 230 -remx925 remainder 123e1 50 -> 30 -remx926 remainder 123e1 5 -> 0 - -remx929 remainder 123e1 90000000000000000 -> 1230 -remx930 remainder 123e1 9000000000000000 -> 1230 -remx931 remainder 123e1 900000000000000 -> 1230 -remx932 remainder 123e1 90000000000000 -> 1230 -remx933 remainder 123e1 9000000000000 -> 1230 -remx934 remainder 123e1 900000000000 -> 1230 -remx935 remainder 123e1 90000000000 -> 1230 -remx936 remainder 123e1 9000000000 -> 1230 -remx937 remainder 123e1 900000000 -> 1230 -remx939 remainder 123e1 90000000 -> 1230 -remx940 remainder 123e1 9000000 -> 1230 -remx941 remainder 123e1 900000 -> 1230 -remx942 remainder 123e1 90000 -> 1230 -remx943 remainder 123e1 9000 -> 1230 -remx944 remainder 123e1 900 -> 330 -remx945 remainder 123e1 90 -> 60 -remx946 remainder 123e1 9 -> 6 - -remx950 remainder 123e1 10000000000000000 -> 1230 -remx951 remainder 123e1 100000000000000000 -> 1230 -remx952 remainder 123e1 1000000000000000000 -> 1230 -remx953 remainder 123e1 10000000000000000000 -> 1230 -remx954 remainder 123e1 100000000000000000000 -> 1230 -remx955 remainder 123e1 1000000000000000000000 -> 1230 -remx956 remainder 123e1 10000000000000000000000 -> 1230 -remx957 remainder 123e1 100000000000000000000000 -> 1230 -remx958 remainder 123e1 1000000000000000000000000 -> 1230 -remx959 remainder 123e1 10000000000000000000000000 -> 1230 - -remx960 remainder 123e1 19999999999999999 -> 1230 -remx961 remainder 123e1 199999999999999990 -> 1230 -remx962 remainder 123e1 1999999999999999999 -> 1230 -remx963 remainder 123e1 19999999999999999990 -> 1230 -remx964 remainder 123e1 199999999999999999999 -> 1230 -remx965 remainder 123e1 1999999999999999999990 -> 1230 -remx966 remainder 123e1 19999999999999999999999 -> 1230 -remx967 remainder 123e1 199999999999999999999990 -> 1230 -remx968 remainder 123e1 1999999999999999999999999 -> 1230 -remx969 remainder 123e1 19999999999999999999999990 -> 1230 - -remx970 remainder 1e1 10000000000000000 -> 10 -remx971 remainder 1e1 100000000000000000 -> 10 -remx972 remainder 1e1 1000000000000000000 -> 10 -remx973 remainder 1e1 10000000000000000000 -> 10 -remx974 remainder 1e1 100000000000000000000 -> 10 -remx975 remainder 1e1 1000000000000000000000 -> 10 -remx976 remainder 1e1 10000000000000000000000 -> 10 -remx977 remainder 1e1 100000000000000000000000 -> 10 -remx978 remainder 1e1 1000000000000000000000000 -> 10 -remx979 remainder 1e1 10000000000000000000000000 -> 10 - -remx980 remainder 123e1 1000E999999 -> 1.23E+3 -- 123E+1 internally - --- overflow and underflow tests [from divide] -precision: 9 -maxexponent: 999999999 -minexponent: -999999999 -remx990 remainder +1.23456789012345E-0 9E+999999999 -> 1.23456789 Inexact Rounded -remx991 remainder 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible -remx992 remainder +0.100 9E+999999999 -> 0.100 -remx993 remainder 9E-999999999 +9.100 -> 9E-999999999 -remx995 remainder -1.23456789012345E-0 9E+999999999 -> -1.23456789 Inexact Rounded -remx996 remainder 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible -remx997 remainder -0.100 9E+999999999 -> -0.100 -remx998 remainder 9E-999999999 -9.100 -> 9E-999999999 - --- Null tests -remx1000 remainder 10 # -> NaN Invalid_operation -remx1001 remainder # 10 -> NaN Invalid_operation - diff --git a/sys/lib/python/test/decimaltestdata/remainderNear.decTest b/sys/lib/python/test/decimaltestdata/remainderNear.decTest deleted file mode 100644 index d007bdae9..000000000 --- a/sys/lib/python/test/decimaltestdata/remainderNear.decTest +++ /dev/null @@ -1,560 +0,0 @@ ------------------------------------------------------------------------- --- remainderNear.decTest -- decimal remainder-near (IEEE remainder) -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - -rmnx001 remaindernear 1 1 -> 0 -rmnx002 remaindernear 2 1 -> 0 -rmnx003 remaindernear 1 2 -> 1 -rmnx004 remaindernear 2 2 -> 0 -rmnx005 remaindernear 0 1 -> 0 -rmnx006 remaindernear 0 2 -> 0 -rmnx007 remaindernear 1 3 -> 1 -rmnx008 remaindernear 2 3 -> -1 -rmnx009 remaindernear 3 3 -> 0 - -rmnx010 remaindernear 2.4 1 -> 0.4 -rmnx011 remaindernear 2.4 -1 -> 0.4 -rmnx012 remaindernear -2.4 1 -> -0.4 -rmnx013 remaindernear -2.4 -1 -> -0.4 -rmnx014 remaindernear 2.40 1 -> 0.40 -rmnx015 remaindernear 2.400 1 -> 0.400 -rmnx016 remaindernear 2.4 2 -> 0.4 -rmnx017 remaindernear 2.400 2 -> 0.400 -rmnx018 remaindernear 2. 2 -> 0 -rmnx019 remaindernear 20 20 -> 0 - -rmnx020 remaindernear 187 187 -> 0 -rmnx021 remaindernear 5 2 -> 1 -rmnx022 remaindernear 5 2.0 -> 1.0 -rmnx023 remaindernear 5 2.000 -> 1.000 -rmnx024 remaindernear 5 0.200 -> 0.000 -rmnx025 remaindernear 5 0.200 -> 0.000 - -rmnx030 remaindernear 1 2 -> 1 -rmnx031 remaindernear 1 4 -> 1 -rmnx032 remaindernear 1 8 -> 1 -rmnx033 remaindernear 1 16 -> 1 -rmnx034 remaindernear 1 32 -> 1 -rmnx035 remaindernear 1 64 -> 1 -rmnx040 remaindernear 1 -2 -> 1 -rmnx041 remaindernear 1 -4 -> 1 -rmnx042 remaindernear 1 -8 -> 1 -rmnx043 remaindernear 1 -16 -> 1 -rmnx044 remaindernear 1 -32 -> 1 -rmnx045 remaindernear 1 -64 -> 1 -rmnx050 remaindernear -1 2 -> -1 -rmnx051 remaindernear -1 4 -> -1 -rmnx052 remaindernear -1 8 -> -1 -rmnx053 remaindernear -1 16 -> -1 -rmnx054 remaindernear -1 32 -> -1 -rmnx055 remaindernear -1 64 -> -1 -rmnx060 remaindernear -1 -2 -> -1 -rmnx061 remaindernear -1 -4 -> -1 -rmnx062 remaindernear -1 -8 -> -1 -rmnx063 remaindernear -1 -16 -> -1 -rmnx064 remaindernear -1 -32 -> -1 -rmnx065 remaindernear -1 -64 -> -1 - -rmnx066 remaindernear 999999997 1 -> 0 -rmnx067 remaindernear 999999997.4 1 -> 0.4 -rmnx068 remaindernear 999999997.5 1 -> -0.5 -rmnx069 remaindernear 999999997.9 1 -> -0.1 -rmnx070 remaindernear 999999997.999 1 -> -0.001 - -rmnx071 remaindernear 999999998 1 -> 0 -rmnx072 remaindernear 999999998.4 1 -> 0.4 -rmnx073 remaindernear 999999998.5 1 -> 0.5 -rmnx074 remaindernear 999999998.9 1 -> -0.1 -rmnx075 remaindernear 999999998.999 1 -> -0.001 - -rmnx076 remaindernear 999999999 1 -> 0 -rmnx077 remaindernear 999999999.4 1 -> 0.4 -rmnx078 remaindernear 999999999.5 1 -> NaN Division_impossible -rmnx079 remaindernear 999999999.9 1 -> NaN Division_impossible -rmnx080 remaindernear 999999999.999 1 -> NaN Division_impossible - -precision: 6 -rmnx081 remaindernear 999999999 1 -> NaN Division_impossible -rmnx082 remaindernear 99999999 1 -> NaN Division_impossible -rmnx083 remaindernear 9999999 1 -> NaN Division_impossible -rmnx084 remaindernear 999999 1 -> 0 -rmnx085 remaindernear 99999 1 -> 0 -rmnx086 remaindernear 9999 1 -> 0 -rmnx087 remaindernear 999 1 -> 0 -rmnx088 remaindernear 99 1 -> 0 -rmnx089 remaindernear 9 1 -> 0 - -precision: 9 -rmnx090 remaindernear 0. 1 -> 0 -rmnx091 remaindernear .0 1 -> 0.0 -rmnx092 remaindernear 0.00 1 -> 0.00 -rmnx093 remaindernear 0.00E+9 1 -> 0 -rmnx094 remaindernear 0.0000E-50 1 -> 0E-54 - - --- Various flavours of remaindernear by 0 -precision: 9 -maxexponent: 999999999 -minexponent: -999999999 -rmnx101 remaindernear 0 0 -> NaN Division_undefined -rmnx102 remaindernear 0 -0 -> NaN Division_undefined -rmnx103 remaindernear -0 0 -> NaN Division_undefined -rmnx104 remaindernear -0 -0 -> NaN Division_undefined -rmnx105 remaindernear 0.0E5 0 -> NaN Division_undefined -rmnx106 remaindernear 0.000 0 -> NaN Division_undefined --- [Some think this next group should be Division_by_zero exception, --- but IEEE 854 is explicit that it is Invalid operation .. for --- remaindernear-near, anyway] -rmnx107 remaindernear 0.0001 0 -> NaN Invalid_operation -rmnx108 remaindernear 0.01 0 -> NaN Invalid_operation -rmnx109 remaindernear 0.1 0 -> NaN Invalid_operation -rmnx110 remaindernear 1 0 -> NaN Invalid_operation -rmnx111 remaindernear 1 0.0 -> NaN Invalid_operation -rmnx112 remaindernear 10 0.0 -> NaN Invalid_operation -rmnx113 remaindernear 1E+100 0.0 -> NaN Invalid_operation -rmnx114 remaindernear 1E+1000 0 -> NaN Invalid_operation -rmnx115 remaindernear 0.0001 -0 -> NaN Invalid_operation -rmnx116 remaindernear 0.01 -0 -> NaN Invalid_operation -rmnx119 remaindernear 0.1 -0 -> NaN Invalid_operation -rmnx120 remaindernear 1 -0 -> NaN Invalid_operation -rmnx121 remaindernear 1 -0.0 -> NaN Invalid_operation -rmnx122 remaindernear 10 -0.0 -> NaN Invalid_operation -rmnx123 remaindernear 1E+100 -0.0 -> NaN Invalid_operation -rmnx124 remaindernear 1E+1000 -0 -> NaN Invalid_operation --- and zeros on left -rmnx130 remaindernear 0 1 -> 0 -rmnx131 remaindernear 0 -1 -> 0 -rmnx132 remaindernear 0.0 1 -> 0.0 -rmnx133 remaindernear 0.0 -1 -> 0.0 -rmnx134 remaindernear -0 1 -> -0 -rmnx135 remaindernear -0 -1 -> -0 -rmnx136 remaindernear -0.0 1 -> -0.0 -rmnx137 remaindernear -0.0 -1 -> -0.0 - --- 0.5ers -rmmx143 remaindernear 0.5 2 -> 0.5 -rmmx144 remaindernear 0.5 2.1 -> 0.5 -rmmx145 remaindernear 0.5 2.01 -> 0.50 -rmmx146 remaindernear 0.5 2.001 -> 0.500 -rmmx147 remaindernear 0.50 2 -> 0.50 -rmmx148 remaindernear 0.50 2.01 -> 0.50 -rmmx149 remaindernear 0.50 2.001 -> 0.500 - --- some differences from remainder -rmnx150 remaindernear 0.4 1.020 -> 0.400 -rmnx151 remaindernear 0.50 1.020 -> 0.500 -rmnx152 remaindernear 0.51 1.020 -> 0.510 -rmnx153 remaindernear 0.52 1.020 -> -0.500 -rmnx154 remaindernear 0.6 1.020 -> -0.420 -rmnx155 remaindernear 0.49 1 -> 0.49 -rmnx156 remaindernear 0.50 1 -> 0.50 -rmnx157 remaindernear 1.50 1 -> -0.50 -rmnx158 remaindernear 2.50 1 -> 0.50 -rmnx159 remaindernear 9.50 1 -> -0.50 -rmnx160 remaindernear 0.51 1 -> -0.49 - --- the nasty division-by-1 cases -rmnx161 remaindernear 0.4 1 -> 0.4 -rmnx162 remaindernear 0.45 1 -> 0.45 -rmnx163 remaindernear 0.455 1 -> 0.455 -rmnx164 remaindernear 0.4555 1 -> 0.4555 -rmnx165 remaindernear 0.45555 1 -> 0.45555 -rmnx166 remaindernear 0.455555 1 -> 0.455555 -rmnx167 remaindernear 0.4555555 1 -> 0.4555555 -rmnx168 remaindernear 0.45555555 1 -> 0.45555555 -rmnx169 remaindernear 0.455555555 1 -> 0.455555555 --- with spill... -rmnx171 remaindernear 0.5 1 -> 0.5 -rmnx172 remaindernear 0.55 1 -> -0.45 -rmnx173 remaindernear 0.555 1 -> -0.445 -rmnx174 remaindernear 0.5555 1 -> -0.4445 -rmnx175 remaindernear 0.55555 1 -> -0.44445 -rmnx176 remaindernear 0.555555 1 -> -0.444445 -rmnx177 remaindernear 0.5555555 1 -> -0.4444445 -rmnx178 remaindernear 0.55555555 1 -> -0.44444445 -rmnx179 remaindernear 0.555555555 1 -> -0.444444445 - --- progression -rmnx180 remaindernear 1 1 -> 0 -rmnx181 remaindernear 1 2 -> 1 -rmnx182 remaindernear 1 3 -> 1 -rmnx183 remaindernear 1 4 -> 1 -rmnx184 remaindernear 1 5 -> 1 -rmnx185 remaindernear 1 6 -> 1 -rmnx186 remaindernear 1 7 -> 1 -rmnx187 remaindernear 1 8 -> 1 -rmnx188 remaindernear 1 9 -> 1 -rmnx189 remaindernear 1 10 -> 1 -rmnx190 remaindernear 1 1 -> 0 -rmnx191 remaindernear 2 1 -> 0 -rmnx192 remaindernear 3 1 -> 0 -rmnx193 remaindernear 4 1 -> 0 -rmnx194 remaindernear 5 1 -> 0 -rmnx195 remaindernear 6 1 -> 0 -rmnx196 remaindernear 7 1 -> 0 -rmnx197 remaindernear 8 1 -> 0 -rmnx198 remaindernear 9 1 -> 0 -rmnx199 remaindernear 10 1 -> 0 - - --- Various flavours of remaindernear by 0 -maxexponent: 999999999 -minexponent: -999999999 -rmnx201 remaindernear 0 0 -> NaN Division_undefined -rmnx202 remaindernear 0.0E5 0 -> NaN Division_undefined -rmnx203 remaindernear 0.000 0 -> NaN Division_undefined -rmnx204 remaindernear 0.0001 0 -> NaN Invalid_operation -rmnx205 remaindernear 0.01 0 -> NaN Invalid_operation -rmnx206 remaindernear 0.1 0 -> NaN Invalid_operation -rmnx207 remaindernear 1 0 -> NaN Invalid_operation -rmnx208 remaindernear 1 0.0 -> NaN Invalid_operation -rmnx209 remaindernear 10 0.0 -> NaN Invalid_operation -rmnx210 remaindernear 1E+100 0.0 -> NaN Invalid_operation -rmnx211 remaindernear 1E+1000 0 -> NaN Invalid_operation - --- tests from the extended specification -rmnx221 remaindernear 2.1 3 -> -0.9 -rmnx222 remaindernear 10 6 -> -2 -rmnx223 remaindernear 10 3 -> 1 -rmnx224 remaindernear -10 3 -> -1 -rmnx225 remaindernear 10.2 1 -> 0.2 -rmnx226 remaindernear 10 0.3 -> 0.1 -rmnx227 remaindernear 3.6 1.3 -> -0.3 - --- some differences from remainder -rmnx231 remaindernear 0.4 1.020 -> 0.400 -rmnx232 remaindernear 0.50 1.020 -> 0.500 -rmnx233 remaindernear 0.51 1.020 -> 0.510 -rmnx234 remaindernear 0.52 1.020 -> -0.500 -rmnx235 remaindernear 0.6 1.020 -> -0.420 - --- test some cases that are close to exponent overflow -maxexponent: 999999999 -minexponent: -999999999 -rmnx270 remaindernear 1 1e999999999 -> 1 -rmnx271 remaindernear 1 0.9e999999999 -> 1 -rmnx272 remaindernear 1 0.99e999999999 -> 1 -rmnx273 remaindernear 1 0.999999999e999999999 -> 1 -rmnx274 remaindernear 9e999999999 1 -> NaN Division_impossible -rmnx275 remaindernear 9.9e999999999 1 -> NaN Division_impossible -rmnx276 remaindernear 9.99e999999999 1 -> NaN Division_impossible -rmnx277 remaindernear 9.99999999e999999999 1 -> NaN Division_impossible - -rmnx280 remaindernear 0.1 9e-999999999 -> NaN Division_impossible -rmnx281 remaindernear 0.1 99e-999999999 -> NaN Division_impossible -rmnx282 remaindernear 0.1 999e-999999999 -> NaN Division_impossible - -rmnx283 remaindernear 0.1 9e-999999998 -> NaN Division_impossible -rmnx284 remaindernear 0.1 99e-999999998 -> NaN Division_impossible -rmnx285 remaindernear 0.1 999e-999999998 -> NaN Division_impossible -rmnx286 remaindernear 0.1 999e-999999997 -> NaN Division_impossible -rmnx287 remaindernear 0.1 9999e-999999997 -> NaN Division_impossible -rmnx288 remaindernear 0.1 99999e-999999997 -> NaN Division_impossible - --- rmnx3xx are from DiagBigDecimal -rmnx301 remaindernear 1 3 -> 1 -rmnx302 remaindernear 5 5 -> 0 -rmnx303 remaindernear 13 10 -> 3 -rmnx304 remaindernear 13 50 -> 13 -rmnx305 remaindernear 13 100 -> 13 -rmnx306 remaindernear 13 1000 -> 13 -rmnx307 remaindernear .13 1 -> 0.13 -rmnx308 remaindernear 0.133 1 -> 0.133 -rmnx309 remaindernear 0.1033 1 -> 0.1033 -rmnx310 remaindernear 1.033 1 -> 0.033 -rmnx311 remaindernear 10.33 1 -> 0.33 -rmnx312 remaindernear 10.33 10 -> 0.33 -rmnx313 remaindernear 103.3 1 -> 0.3 -rmnx314 remaindernear 133 10 -> 3 -rmnx315 remaindernear 1033 10 -> 3 -rmnx316 remaindernear 1033 50 -> -17 -rmnx317 remaindernear 101.0 3 -> -1.0 -rmnx318 remaindernear 102.0 3 -> 0.0 -rmnx319 remaindernear 103.0 3 -> 1.0 -rmnx320 remaindernear 2.40 1 -> 0.40 -rmnx321 remaindernear 2.400 1 -> 0.400 -rmnx322 remaindernear 2.4 1 -> 0.4 -rmnx323 remaindernear 2.4 2 -> 0.4 -rmnx324 remaindernear 2.400 2 -> 0.400 -rmnx325 remaindernear 1 0.3 -> 0.1 -rmnx326 remaindernear 1 0.30 -> 0.10 -rmnx327 remaindernear 1 0.300 -> 0.100 -rmnx328 remaindernear 1 0.3000 -> 0.1000 -rmnx329 remaindernear 1.0 0.3 -> 0.1 -rmnx330 remaindernear 1.00 0.3 -> 0.10 -rmnx331 remaindernear 1.000 0.3 -> 0.100 -rmnx332 remaindernear 1.0000 0.3 -> 0.1000 -rmnx333 remaindernear 0.5 2 -> 0.5 -rmnx334 remaindernear 0.5 2.1 -> 0.5 -rmnx335 remaindernear 0.5 2.01 -> 0.50 -rmnx336 remaindernear 0.5 2.001 -> 0.500 -rmnx337 remaindernear 0.50 2 -> 0.50 -rmnx338 remaindernear 0.50 2.01 -> 0.50 -rmnx339 remaindernear 0.50 2.001 -> 0.500 - -rmnx340 remaindernear 0.5 0.5000001 -> -1E-7 -rmnx341 remaindernear 0.5 0.50000001 -> -1E-8 -rmnx342 remaindernear 0.5 0.500000001 -> -1E-9 -rmnx343 remaindernear 0.5 0.5000000001 -> -1E-10 -rmnx344 remaindernear 0.5 0.50000000001 -> -1E-11 -rmnx345 remaindernear 0.5 0.4999999 -> 1E-7 -rmnx346 remaindernear 0.5 0.49999999 -> 1E-8 -rmnx347 remaindernear 0.5 0.499999999 -> 1E-9 -rmnx348 remaindernear 0.5 0.4999999999 -> 1E-10 -rmnx349 remaindernear 0.5 0.49999999999 -> 1E-11 - -rmnx350 remaindernear 0.03 7 -> 0.03 -rmnx351 remaindernear 5 2 -> 1 -rmnx352 remaindernear 4.1 2 -> 0.1 -rmnx353 remaindernear 4.01 2 -> 0.01 -rmnx354 remaindernear 4.001 2 -> 0.001 -rmnx355 remaindernear 4.0001 2 -> 0.0001 -rmnx356 remaindernear 4.00001 2 -> 0.00001 -rmnx357 remaindernear 4.000001 2 -> 0.000001 -rmnx358 remaindernear 4.0000001 2 -> 1E-7 - -rmnx360 remaindernear 1.2 0.7345 -> -0.2690 -rmnx361 remaindernear 0.8 12 -> 0.8 -rmnx362 remaindernear 0.8 0.2 -> 0.0 -rmnx363 remaindernear 0.8 0.3 -> -0.1 -rmnx364 remaindernear 0.800 12 -> 0.800 -rmnx365 remaindernear 0.800 1.7 -> 0.800 -rmnx366 remaindernear 2.400 2 -> 0.400 - -precision: 6 -rmnx371 remaindernear 2.400 2 -> 0.400 -precision: 3 -rmnx372 remaindernear 12345678900000 12e+12 -> 3.46E+11 Inexact Rounded - -precision: 5 -rmnx381 remaindernear 12345 1 -> 0 -rmnx382 remaindernear 12345 1.0001 -> -0.2344 -rmnx383 remaindernear 12345 1.001 -> -0.333 -rmnx384 remaindernear 12345 1.01 -> -0.23 -rmnx385 remaindernear 12345 1.1 -> -0.3 -rmnx386 remaindernear 12355 4 -> -1 -rmnx387 remaindernear 12345 4 -> 1 -rmnx388 remaindernear 12355 4.0001 -> -1.3089 -rmnx389 remaindernear 12345 4.0001 -> 0.6914 -rmnx390 remaindernear 12345 4.9 -> 1.9 -rmnx391 remaindernear 12345 4.99 -> -0.26 -rmnx392 remaindernear 12345 4.999 -> 2.469 -rmnx393 remaindernear 12345 4.9999 -> 0.2469 -rmnx394 remaindernear 12345 5 -> 0 -rmnx395 remaindernear 12345 5.0001 -> -0.2469 -rmnx396 remaindernear 12345 5.001 -> -2.469 -rmnx397 remaindernear 12345 5.01 -> 0.36 -rmnx398 remaindernear 12345 5.1 -> -2.1 - -precision: 9 --- some nasty division-by-1 cases [some similar above] -rmnx401 remaindernear 0.4 1 -> 0.4 -rmnx402 remaindernear 0.45 1 -> 0.45 -rmnx403 remaindernear 0.455 1 -> 0.455 -rmnx404 remaindernear 0.4555 1 -> 0.4555 -rmnx405 remaindernear 0.45555 1 -> 0.45555 -rmnx406 remaindernear 0.455555 1 -> 0.455555 -rmnx407 remaindernear 0.4555555 1 -> 0.4555555 -rmnx408 remaindernear 0.45555555 1 -> 0.45555555 -rmnx409 remaindernear 0.455555555 1 -> 0.455555555 - --- some tricky LHSs -rmnx420 remaindernear 99999999.999999999 1E+8 -> -1E-9 -rmnx421 remaindernear 999999999.999999999 1E+9 -> -1E-9 -precision: 9 -rmnx430 remaindernear 0.455555555 1 -> 0.455555555 -precision: 8 -rmnx431 remaindernear 0.455555555 1 -> 0.45555556 Inexact Rounded -precision: 7 -rmnx432 remaindernear 0.455555555 1 -> 0.4555556 Inexact Rounded -precision: 6 -rmnx433 remaindernear 0.455555555 1 -> 0.455556 Inexact Rounded -precision: 5 -rmnx434 remaindernear 0.455555555 1 -> 0.45556 Inexact Rounded -precision: 4 -rmnx435 remaindernear 0.455555555 1 -> 0.4556 Inexact Rounded -precision: 3 -rmnx436 remaindernear 0.455555555 1 -> 0.456 Inexact Rounded -precision: 2 -rmnx437 remaindernear 0.455555555 1 -> 0.46 Inexact Rounded -precision: 1 -rmnx438 remaindernear 0.455555555 1 -> 0.5 Inexact Rounded - --- early tests; from text descriptions -precision: 9 -rmnx601 remaindernear 10 6 -> -2 -rmnx602 remaindernear -10 6 -> 2 -rmnx603 remaindernear 11 3 -> -1 -rmnx604 remaindernear 11 5 -> 1 -rmnx605 remaindernear 7.7 8 -> -0.3 -rmnx606 remaindernear 31.5 3 -> 1.5 -- i=10 -rmnx607 remaindernear 34.5 3 -> -1.5 -- i=11 - --- Specials -rmnx680 remaindernear Inf -Inf -> NaN Invalid_operation -rmnx681 remaindernear Inf -1000 -> NaN Invalid_operation -rmnx682 remaindernear Inf -1 -> NaN Invalid_operation -rmnx683 remaindernear Inf 0 -> NaN Invalid_operation -rmnx684 remaindernear Inf -0 -> NaN Invalid_operation -rmnx685 remaindernear Inf 1 -> NaN Invalid_operation -rmnx686 remaindernear Inf 1000 -> NaN Invalid_operation -rmnx687 remaindernear Inf Inf -> NaN Invalid_operation -rmnx688 remaindernear -1000 Inf -> -1000 -rmnx689 remaindernear -Inf Inf -> NaN Invalid_operation -rmnx691 remaindernear -1 Inf -> -1 -rmnx692 remaindernear 0 Inf -> 0 -rmnx693 remaindernear -0 Inf -> -0 -rmnx694 remaindernear 1 Inf -> 1 -rmnx695 remaindernear 1000 Inf -> 1000 -rmnx696 remaindernear Inf Inf -> NaN Invalid_operation - -rmnx700 remaindernear -Inf -Inf -> NaN Invalid_operation -rmnx701 remaindernear -Inf -1000 -> NaN Invalid_operation -rmnx702 remaindernear -Inf -1 -> NaN Invalid_operation -rmnx703 remaindernear -Inf -0 -> NaN Invalid_operation -rmnx704 remaindernear -Inf 0 -> NaN Invalid_operation -rmnx705 remaindernear -Inf 1 -> NaN Invalid_operation -rmnx706 remaindernear -Inf 1000 -> NaN Invalid_operation -rmnx707 remaindernear -Inf Inf -> NaN Invalid_operation -rmnx708 remaindernear -Inf -Inf -> NaN Invalid_operation -rmnx709 remaindernear -1000 Inf -> -1000 -rmnx710 remaindernear -1 -Inf -> -1 -rmnx711 remaindernear -0 -Inf -> -0 -rmnx712 remaindernear 0 -Inf -> 0 -rmnx713 remaindernear 1 -Inf -> 1 -rmnx714 remaindernear 1000 -Inf -> 1000 -rmnx715 remaindernear Inf -Inf -> NaN Invalid_operation - -rmnx721 remaindernear NaN -Inf -> NaN -rmnx722 remaindernear NaN -1000 -> NaN -rmnx723 remaindernear NaN -1 -> NaN -rmnx724 remaindernear NaN -0 -> NaN -rmnx725 remaindernear NaN 0 -> NaN -rmnx726 remaindernear NaN 1 -> NaN -rmnx727 remaindernear NaN 1000 -> NaN -rmnx728 remaindernear NaN Inf -> NaN -rmnx729 remaindernear NaN NaN -> NaN -rmnx730 remaindernear -Inf NaN -> NaN -rmnx731 remaindernear -1000 NaN -> NaN -rmnx732 remaindernear -1 -NaN -> -NaN -rmnx733 remaindernear -0 NaN -> NaN -rmnx734 remaindernear 0 NaN -> NaN -rmnx735 remaindernear 1 NaN -> NaN -rmnx736 remaindernear 1000 NaN -> NaN -rmnx737 remaindernear Inf NaN -> NaN - -rmnx741 remaindernear sNaN -Inf -> NaN Invalid_operation -rmnx742 remaindernear sNaN -1000 -> NaN Invalid_operation -rmnx743 remaindernear -sNaN -1 -> -NaN Invalid_operation -rmnx744 remaindernear sNaN -0 -> NaN Invalid_operation -rmnx745 remaindernear sNaN 0 -> NaN Invalid_operation -rmnx746 remaindernear sNaN 1 -> NaN Invalid_operation -rmnx747 remaindernear sNaN 1000 -> NaN Invalid_operation -rmnx749 remaindernear sNaN NaN -> NaN Invalid_operation -rmnx750 remaindernear sNaN sNaN -> NaN Invalid_operation -rmnx751 remaindernear NaN sNaN -> NaN Invalid_operation -rmnx752 remaindernear -Inf sNaN -> NaN Invalid_operation -rmnx753 remaindernear -1000 sNaN -> NaN Invalid_operation -rmnx754 remaindernear -1 sNaN -> NaN Invalid_operation -rmnx755 remaindernear -0 -sNaN -> -NaN Invalid_operation -rmnx756 remaindernear 0 sNaN -> NaN Invalid_operation -rmnx757 remaindernear 1 sNaN -> NaN Invalid_operation -rmnx758 remaindernear 1000 sNaN -> NaN Invalid_operation -rmnx759 remaindernear Inf sNaN -> NaN Invalid_operation -rmnx760 remaindernear NaN sNaN -> NaN Invalid_operation - --- propaging NaNs -rmnx761 remaindernear NaN1 NaN7 -> NaN1 -rmnx762 remaindernear sNaN2 NaN8 -> NaN2 Invalid_operation -rmnx763 remaindernear NaN3 -sNaN9 -> -NaN9 Invalid_operation -rmnx764 remaindernear sNaN4 sNaN10 -> NaN4 Invalid_operation -rmnx765 remaindernear 15 NaN11 -> NaN11 -rmnx766 remaindernear NaN6 NaN12 -> NaN6 -rmnx767 remaindernear Inf -NaN13 -> -NaN13 -rmnx768 remaindernear NaN14 -Inf -> NaN14 -rmnx769 remaindernear 0 NaN15 -> NaN15 -rmnx770 remaindernear -NaN16 -0 -> -NaN16 - --- test some cases that are close to exponent overflow -maxexponent: 999999999 -minexponent: -999999999 -rmnx780 remaindernear 1 1e999999999 -> 1 -rmnx781 remaindernear 1 0.9e999999999 -> 1 -rmnx782 remaindernear 1 0.99e999999999 -> 1 -rmnx783 remaindernear 1 0.999999999e999999999 -> 1 -rmnx784 remaindernear 9e999999999 1 -> NaN Division_impossible -rmnx785 remaindernear 9.9e999999999 1 -> NaN Division_impossible -rmnx786 remaindernear 9.99e999999999 1 -> NaN Division_impossible -rmnx787 remaindernear 9.99999999e999999999 1 -> NaN Division_impossible - - --- overflow and underflow tests [from divide] -precision: 9 -maxexponent: 999999999 -minexponent: -999999999 -rmnx790 remaindernear +1.23456789012345E-0 9E+999999999 -> 1.23456789 Inexact Rounded -rmnx791 remaindernear 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible -rmnx792 remaindernear +0.100 9E+999999999 -> 0.100 -rmnx793 remaindernear 9E-999999999 +9.100 -> 9E-999999999 -rmnx795 remaindernear -1.23456789012345E-0 9E+999999999 -> -1.23456789 Inexact Rounded -rmnx796 remaindernear 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible -rmnx797 remaindernear -0.100 9E+999999999 -> -0.100 -rmnx798 remaindernear 9E-999999999 -9.100 -> 9E-999999999 - --- long operands checks -maxexponent: 999 -minexponent: -999 -precision: 9 -rmnx801 remaindernear 12345678000 100 -> 0 -rmnx802 remaindernear 1 12345678000 -> 1 -rmnx803 remaindernear 1234567800 10 -> 0 -rmnx804 remaindernear 1 1234567800 -> 1 -rmnx805 remaindernear 1234567890 10 -> 0 -rmnx806 remaindernear 1 1234567890 -> 1 -rmnx807 remaindernear 1234567891 10 -> 1 -rmnx808 remaindernear 1 1234567891 -> 1 -rmnx809 remaindernear 12345678901 100 -> 1 -rmnx810 remaindernear 1 12345678901 -> 1 -rmnx811 remaindernear 1234567896 10 -> -4 -rmnx812 remaindernear 1 1234567896 -> 1 - -precision: 15 -rmnx841 remaindernear 12345678000 100 -> 0 -rmnx842 remaindernear 1 12345678000 -> 1 -rmnx843 remaindernear 1234567800 10 -> 0 -rmnx844 remaindernear 1 1234567800 -> 1 -rmnx845 remaindernear 1234567890 10 -> 0 -rmnx846 remaindernear 1 1234567890 -> 1 -rmnx847 remaindernear 1234567891 10 -> 1 -rmnx848 remaindernear 1 1234567891 -> 1 -rmnx849 remaindernear 12345678901 100 -> 1 -rmnx850 remaindernear 1 12345678901 -> 1 -rmnx851 remaindernear 1234567896 10 -> -4 -rmnx852 remaindernear 1 1234567896 -> 1 - --- Null tests -rmnx900 remaindernear 10 # -> NaN Invalid_operation -rmnx901 remaindernear # 10 -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/rescale.decTest b/sys/lib/python/test/decimaltestdata/rescale.decTest deleted file mode 100644 index fd63f0f71..000000000 --- a/sys/lib/python/test/decimaltestdata/rescale.decTest +++ /dev/null @@ -1,758 +0,0 @@ ------------------------------------------------------------------------- --- rescale.decTest -- decimal rescale operation -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- [obsolete] Quantize.decTest has the improved version - --- 2004.03.15 Underflow for quantize is suppressed - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 999 -minexponent: -999 - --- sanity checks - -resx001 rescale 0 0 -> 0 -resx002 rescale 1 0 -> 1 -resx003 rescale 0.1 +2 -> 0E+2 Inexact Rounded -resx005 rescale 0.1 +1 -> 0E+1 Inexact Rounded -resx006 rescale 0.1 0 -> 0 Inexact Rounded -resx007 rescale 0.1 -1 -> 0.1 -resx008 rescale 0.1 -2 -> 0.10 -resx009 rescale 0.1 -3 -> 0.100 -resx010 rescale 0.9 +2 -> 0E+2 Inexact Rounded -resx011 rescale 0.9 +1 -> 0E+1 Inexact Rounded -resx012 rescale 0.9 +0 -> 1 Inexact Rounded -resx013 rescale 0.9 -1 -> 0.9 -resx014 rescale 0.9 -2 -> 0.90 -resx015 rescale 0.9 -3 -> 0.900 --- negatives -resx021 rescale -0 0 -> -0 -resx022 rescale -1 0 -> -1 -resx023 rescale -0.1 +2 -> -0E+2 Inexact Rounded -resx025 rescale -0.1 +1 -> -0E+1 Inexact Rounded -resx026 rescale -0.1 0 -> -0 Inexact Rounded -resx027 rescale -0.1 -1 -> -0.1 -resx028 rescale -0.1 -2 -> -0.10 -resx029 rescale -0.1 -3 -> -0.100 -resx030 rescale -0.9 +2 -> -0E+2 Inexact Rounded -resx031 rescale -0.9 +1 -> -0E+1 Inexact Rounded -resx032 rescale -0.9 +0 -> -1 Inexact Rounded -resx033 rescale -0.9 -1 -> -0.9 -resx034 rescale -0.9 -2 -> -0.90 -resx035 rescale -0.9 -3 -> -0.900 -resx036 rescale -0.5 +2 -> -0E+2 Inexact Rounded -resx037 rescale -0.5 +1 -> -0E+1 Inexact Rounded -resx038 rescale -0.5 +0 -> -1 Inexact Rounded -resx039 rescale -0.5 -1 -> -0.5 -resx040 rescale -0.5 -2 -> -0.50 -resx041 rescale -0.5 -3 -> -0.500 -resx042 rescale -0.9 +2 -> -0E+2 Inexact Rounded -resx043 rescale -0.9 +1 -> -0E+1 Inexact Rounded -resx044 rescale -0.9 +0 -> -1 Inexact Rounded -resx045 rescale -0.9 -1 -> -0.9 -resx046 rescale -0.9 -2 -> -0.90 -resx047 rescale -0.9 -3 -> -0.900 - --- examples from Specification -resx060 rescale 2.17 -3 -> 2.170 -resx061 rescale 2.17 -2 -> 2.17 -resx062 rescale 2.17 -1 -> 2.2 Inexact Rounded -resx063 rescale 2.17 0 -> 2 Inexact Rounded -resx064 rescale 2.17 +1 -> 0E+1 Inexact Rounded -resx065 rescale 2 Inf -> NaN Invalid_operation -resx066 rescale -0.1 0 -> -0 Inexact Rounded -resx067 rescale -0 5 -> -0E+5 -resx068 rescale +35236450.6 -2 -> NaN Invalid_operation -resx069 rescale -35236450.6 -2 -> NaN Invalid_operation -resx070 rescale 217 -1 -> 217.0 -resx071 rescale 217 0 -> 217 -resx072 rescale 217 +1 -> 2.2E+2 Inexact Rounded -resx073 rescale 217 +2 -> 2E+2 Inexact Rounded - --- general tests .. -resx089 rescale 12 +4 -> 0E+4 Inexact Rounded -resx090 rescale 12 +3 -> 0E+3 Inexact Rounded -resx091 rescale 12 +2 -> 0E+2 Inexact Rounded -resx092 rescale 12 +1 -> 1E+1 Inexact Rounded -resx093 rescale 1.2345 -2 -> 1.23 Inexact Rounded -resx094 rescale 1.2355 -2 -> 1.24 Inexact Rounded -resx095 rescale 1.2345 -6 -> 1.234500 -resx096 rescale 9.9999 -2 -> 10.00 Inexact Rounded -resx097 rescale 0.0001 -2 -> 0.00 Inexact Rounded -resx098 rescale 0.001 -2 -> 0.00 Inexact Rounded -resx099 rescale 0.009 -2 -> 0.01 Inexact Rounded -resx100 rescale 92 +2 -> 1E+2 Inexact Rounded - -resx101 rescale -1 0 -> -1 -resx102 rescale -1 -1 -> -1.0 -resx103 rescale -1 -2 -> -1.00 -resx104 rescale 0 0 -> 0 -resx105 rescale 0 -1 -> 0.0 -resx106 rescale 0 -2 -> 0.00 -resx107 rescale 0.00 0 -> 0 -resx108 rescale 0 +1 -> 0E+1 -resx109 rescale 0 +2 -> 0E+2 -resx110 rescale +1 0 -> 1 -resx111 rescale +1 -1 -> 1.0 -resx112 rescale +1 -2 -> 1.00 - -resx120 rescale 1.04 -3 -> 1.040 -resx121 rescale 1.04 -2 -> 1.04 -resx122 rescale 1.04 -1 -> 1.0 Inexact Rounded -resx123 rescale 1.04 0 -> 1 Inexact Rounded -resx124 rescale 1.05 -3 -> 1.050 -resx125 rescale 1.05 -2 -> 1.05 -resx126 rescale 1.05 -1 -> 1.1 Inexact Rounded -resx127 rescale 1.05 0 -> 1 Inexact Rounded -resx128 rescale 1.05 -3 -> 1.050 -resx129 rescale 1.05 -2 -> 1.05 -resx130 rescale 1.05 -1 -> 1.1 Inexact Rounded -resx131 rescale 1.05 0 -> 1 Inexact Rounded -resx132 rescale 1.06 -3 -> 1.060 -resx133 rescale 1.06 -2 -> 1.06 -resx134 rescale 1.06 -1 -> 1.1 Inexact Rounded -resx135 rescale 1.06 0 -> 1 Inexact Rounded - -resx140 rescale -10 -2 -> -10.00 -resx141 rescale +1 -2 -> 1.00 -resx142 rescale +10 -2 -> 10.00 -resx143 rescale 1E+10 -2 -> NaN Invalid_operation -resx144 rescale 1E-10 -2 -> 0.00 Inexact Rounded -resx145 rescale 1E-3 -2 -> 0.00 Inexact Rounded -resx146 rescale 1E-2 -2 -> 0.01 -resx147 rescale 1E-1 -2 -> 0.10 -resx148 rescale 0E-10 -2 -> 0.00 - -resx150 rescale 1.0600 -5 -> 1.06000 -resx151 rescale 1.0600 -4 -> 1.0600 -resx152 rescale 1.0600 -3 -> 1.060 Rounded -resx153 rescale 1.0600 -2 -> 1.06 Rounded -resx154 rescale 1.0600 -1 -> 1.1 Inexact Rounded -resx155 rescale 1.0600 0 -> 1 Inexact Rounded - --- +ve exponents .. -resx201 rescale -1 +0 -> -1 -resx202 rescale -1 +1 -> -0E+1 Inexact Rounded -resx203 rescale -1 +2 -> -0E+2 Inexact Rounded -resx204 rescale 0 +0 -> 0 -resx205 rescale 0 +1 -> 0E+1 -resx206 rescale 0 +2 -> 0E+2 -resx207 rescale +1 +0 -> 1 -resx208 rescale +1 +1 -> 0E+1 Inexact Rounded -resx209 rescale +1 +2 -> 0E+2 Inexact Rounded - -resx220 rescale 1.04 +3 -> 0E+3 Inexact Rounded -resx221 rescale 1.04 +2 -> 0E+2 Inexact Rounded -resx222 rescale 1.04 +1 -> 0E+1 Inexact Rounded -resx223 rescale 1.04 +0 -> 1 Inexact Rounded -resx224 rescale 1.05 +3 -> 0E+3 Inexact Rounded -resx225 rescale 1.05 +2 -> 0E+2 Inexact Rounded -resx226 rescale 1.05 +1 -> 0E+1 Inexact Rounded -resx227 rescale 1.05 +0 -> 1 Inexact Rounded -resx228 rescale 1.05 +3 -> 0E+3 Inexact Rounded -resx229 rescale 1.05 +2 -> 0E+2 Inexact Rounded -resx230 rescale 1.05 +1 -> 0E+1 Inexact Rounded -resx231 rescale 1.05 +0 -> 1 Inexact Rounded -resx232 rescale 1.06 +3 -> 0E+3 Inexact Rounded -resx233 rescale 1.06 +2 -> 0E+2 Inexact Rounded -resx234 rescale 1.06 +1 -> 0E+1 Inexact Rounded -resx235 rescale 1.06 +0 -> 1 Inexact Rounded - -resx240 rescale -10 +1 -> -1E+1 Rounded -resx241 rescale +1 +1 -> 0E+1 Inexact Rounded -resx242 rescale +10 +1 -> 1E+1 Rounded -resx243 rescale 1E+1 +1 -> 1E+1 -- underneath this is E+1 -resx244 rescale 1E+2 +1 -> 1.0E+2 -- underneath this is E+1 -resx245 rescale 1E+3 +1 -> 1.00E+3 -- underneath this is E+1 -resx246 rescale 1E+4 +1 -> 1.000E+4 -- underneath this is E+1 -resx247 rescale 1E+5 +1 -> 1.0000E+5 -- underneath this is E+1 -resx248 rescale 1E+6 +1 -> 1.00000E+6 -- underneath this is E+1 -resx249 rescale 1E+7 +1 -> 1.000000E+7 -- underneath this is E+1 -resx250 rescale 1E+8 +1 -> 1.0000000E+8 -- underneath this is E+1 -resx251 rescale 1E+9 +1 -> 1.00000000E+9 -- underneath this is E+1 --- next one tries to add 9 zeros -resx252 rescale 1E+10 +1 -> NaN Invalid_operation -resx253 rescale 1E-10 +1 -> 0E+1 Inexact Rounded -resx254 rescale 1E-2 +1 -> 0E+1 Inexact Rounded -resx255 rescale 0E-10 +1 -> 0E+1 -resx256 rescale -0E-10 +1 -> -0E+1 -resx257 rescale -0E-1 +1 -> -0E+1 -resx258 rescale -0 +1 -> -0E+1 -resx259 rescale -0E+1 +1 -> -0E+1 - -resx260 rescale -10 +2 -> -0E+2 Inexact Rounded -resx261 rescale +1 +2 -> 0E+2 Inexact Rounded -resx262 rescale +10 +2 -> 0E+2 Inexact Rounded -resx263 rescale 1E+1 +2 -> 0E+2 Inexact Rounded -resx264 rescale 1E+2 +2 -> 1E+2 -resx265 rescale 1E+3 +2 -> 1.0E+3 -resx266 rescale 1E+4 +2 -> 1.00E+4 -resx267 rescale 1E+5 +2 -> 1.000E+5 -resx268 rescale 1E+6 +2 -> 1.0000E+6 -resx269 rescale 1E+7 +2 -> 1.00000E+7 -resx270 rescale 1E+8 +2 -> 1.000000E+8 -resx271 rescale 1E+9 +2 -> 1.0000000E+9 -resx272 rescale 1E+10 +2 -> 1.00000000E+10 -resx273 rescale 1E-10 +2 -> 0E+2 Inexact Rounded -resx274 rescale 1E-2 +2 -> 0E+2 Inexact Rounded -resx275 rescale 0E-10 +2 -> 0E+2 - -resx280 rescale -10 +3 -> -0E+3 Inexact Rounded -resx281 rescale +1 +3 -> 0E+3 Inexact Rounded -resx282 rescale +10 +3 -> 0E+3 Inexact Rounded -resx283 rescale 1E+1 +3 -> 0E+3 Inexact Rounded -resx284 rescale 1E+2 +3 -> 0E+3 Inexact Rounded -resx285 rescale 1E+3 +3 -> 1E+3 -resx286 rescale 1E+4 +3 -> 1.0E+4 -resx287 rescale 1E+5 +3 -> 1.00E+5 -resx288 rescale 1E+6 +3 -> 1.000E+6 -resx289 rescale 1E+7 +3 -> 1.0000E+7 -resx290 rescale 1E+8 +3 -> 1.00000E+8 -resx291 rescale 1E+9 +3 -> 1.000000E+9 -resx292 rescale 1E+10 +3 -> 1.0000000E+10 -resx293 rescale 1E-10 +3 -> 0E+3 Inexact Rounded -resx294 rescale 1E-2 +3 -> 0E+3 Inexact Rounded -resx295 rescale 0E-10 +3 -> 0E+3 - --- round up from below [sign wrong in JIT compiler once] -resx300 rescale 0.0078 -5 -> 0.00780 -resx301 rescale 0.0078 -4 -> 0.0078 -resx302 rescale 0.0078 -3 -> 0.008 Inexact Rounded -resx303 rescale 0.0078 -2 -> 0.01 Inexact Rounded -resx304 rescale 0.0078 -1 -> 0.0 Inexact Rounded -resx305 rescale 0.0078 0 -> 0 Inexact Rounded -resx306 rescale 0.0078 +1 -> 0E+1 Inexact Rounded -resx307 rescale 0.0078 +2 -> 0E+2 Inexact Rounded - -resx310 rescale -0.0078 -5 -> -0.00780 -resx311 rescale -0.0078 -4 -> -0.0078 -resx312 rescale -0.0078 -3 -> -0.008 Inexact Rounded -resx313 rescale -0.0078 -2 -> -0.01 Inexact Rounded -resx314 rescale -0.0078 -1 -> -0.0 Inexact Rounded -resx315 rescale -0.0078 0 -> -0 Inexact Rounded -resx316 rescale -0.0078 +1 -> -0E+1 Inexact Rounded -resx317 rescale -0.0078 +2 -> -0E+2 Inexact Rounded - -resx320 rescale 0.078 -5 -> 0.07800 -resx321 rescale 0.078 -4 -> 0.0780 -resx322 rescale 0.078 -3 -> 0.078 -resx323 rescale 0.078 -2 -> 0.08 Inexact Rounded -resx324 rescale 0.078 -1 -> 0.1 Inexact Rounded -resx325 rescale 0.078 0 -> 0 Inexact Rounded -resx326 rescale 0.078 +1 -> 0E+1 Inexact Rounded -resx327 rescale 0.078 +2 -> 0E+2 Inexact Rounded - -resx330 rescale -0.078 -5 -> -0.07800 -resx331 rescale -0.078 -4 -> -0.0780 -resx332 rescale -0.078 -3 -> -0.078 -resx333 rescale -0.078 -2 -> -0.08 Inexact Rounded -resx334 rescale -0.078 -1 -> -0.1 Inexact Rounded -resx335 rescale -0.078 0 -> -0 Inexact Rounded -resx336 rescale -0.078 +1 -> -0E+1 Inexact Rounded -resx337 rescale -0.078 +2 -> -0E+2 Inexact Rounded - -resx340 rescale 0.78 -5 -> 0.78000 -resx341 rescale 0.78 -4 -> 0.7800 -resx342 rescale 0.78 -3 -> 0.780 -resx343 rescale 0.78 -2 -> 0.78 -resx344 rescale 0.78 -1 -> 0.8 Inexact Rounded -resx345 rescale 0.78 0 -> 1 Inexact Rounded -resx346 rescale 0.78 +1 -> 0E+1 Inexact Rounded -resx347 rescale 0.78 +2 -> 0E+2 Inexact Rounded - -resx350 rescale -0.78 -5 -> -0.78000 -resx351 rescale -0.78 -4 -> -0.7800 -resx352 rescale -0.78 -3 -> -0.780 -resx353 rescale -0.78 -2 -> -0.78 -resx354 rescale -0.78 -1 -> -0.8 Inexact Rounded -resx355 rescale -0.78 0 -> -1 Inexact Rounded -resx356 rescale -0.78 +1 -> -0E+1 Inexact Rounded -resx357 rescale -0.78 +2 -> -0E+2 Inexact Rounded - -resx360 rescale 7.8 -5 -> 7.80000 -resx361 rescale 7.8 -4 -> 7.8000 -resx362 rescale 7.8 -3 -> 7.800 -resx363 rescale 7.8 -2 -> 7.80 -resx364 rescale 7.8 -1 -> 7.8 -resx365 rescale 7.8 0 -> 8 Inexact Rounded -resx366 rescale 7.8 +1 -> 1E+1 Inexact Rounded -resx367 rescale 7.8 +2 -> 0E+2 Inexact Rounded -resx368 rescale 7.8 +3 -> 0E+3 Inexact Rounded - -resx370 rescale -7.8 -5 -> -7.80000 -resx371 rescale -7.8 -4 -> -7.8000 -resx372 rescale -7.8 -3 -> -7.800 -resx373 rescale -7.8 -2 -> -7.80 -resx374 rescale -7.8 -1 -> -7.8 -resx375 rescale -7.8 0 -> -8 Inexact Rounded -resx376 rescale -7.8 +1 -> -1E+1 Inexact Rounded -resx377 rescale -7.8 +2 -> -0E+2 Inexact Rounded -resx378 rescale -7.8 +3 -> -0E+3 Inexact Rounded - --- some individuals -precision: 9 -resx380 rescale 352364.506 -2 -> 352364.51 Inexact Rounded -resx381 rescale 3523645.06 -2 -> 3523645.06 -resx382 rescale 35236450.6 -2 -> NaN Invalid_operation -resx383 rescale 352364506 -2 -> NaN Invalid_operation -resx384 rescale -352364.506 -2 -> -352364.51 Inexact Rounded -resx385 rescale -3523645.06 -2 -> -3523645.06 -resx386 rescale -35236450.6 -2 -> NaN Invalid_operation -resx387 rescale -352364506 -2 -> NaN Invalid_operation - -rounding: down -resx389 rescale 35236450.6 -2 -> NaN Invalid_operation --- ? should that one instead have been: --- resx389 rescale 35236450.6 -2 -> NaN Invalid_operation -rounding: half_up - --- and a few more from e-mail discussions -precision: 7 -resx391 rescale 12.34567 -3 -> 12.346 Inexact Rounded -resx392 rescale 123.4567 -3 -> 123.457 Inexact Rounded -resx393 rescale 1234.567 -3 -> 1234.567 -resx394 rescale 12345.67 -3 -> NaN Invalid_operation -resx395 rescale 123456.7 -3 -> NaN Invalid_operation -resx396 rescale 1234567. -3 -> NaN Invalid_operation - --- some 9999 round-up cases -precision: 9 -resx400 rescale 9.999 -5 -> 9.99900 -resx401 rescale 9.999 -4 -> 9.9990 -resx402 rescale 9.999 -3 -> 9.999 -resx403 rescale 9.999 -2 -> 10.00 Inexact Rounded -resx404 rescale 9.999 -1 -> 10.0 Inexact Rounded -resx405 rescale 9.999 0 -> 10 Inexact Rounded -resx406 rescale 9.999 1 -> 1E+1 Inexact Rounded -resx407 rescale 9.999 2 -> 0E+2 Inexact Rounded - -resx410 rescale 0.999 -5 -> 0.99900 -resx411 rescale 0.999 -4 -> 0.9990 -resx412 rescale 0.999 -3 -> 0.999 -resx413 rescale 0.999 -2 -> 1.00 Inexact Rounded -resx414 rescale 0.999 -1 -> 1.0 Inexact Rounded -resx415 rescale 0.999 0 -> 1 Inexact Rounded -resx416 rescale 0.999 1 -> 0E+1 Inexact Rounded - -resx420 rescale 0.0999 -5 -> 0.09990 -resx421 rescale 0.0999 -4 -> 0.0999 -resx422 rescale 0.0999 -3 -> 0.100 Inexact Rounded -resx423 rescale 0.0999 -2 -> 0.10 Inexact Rounded -resx424 rescale 0.0999 -1 -> 0.1 Inexact Rounded -resx425 rescale 0.0999 0 -> 0 Inexact Rounded -resx426 rescale 0.0999 1 -> 0E+1 Inexact Rounded - -resx430 rescale 0.00999 -5 -> 0.00999 -resx431 rescale 0.00999 -4 -> 0.0100 Inexact Rounded -resx432 rescale 0.00999 -3 -> 0.010 Inexact Rounded -resx433 rescale 0.00999 -2 -> 0.01 Inexact Rounded -resx434 rescale 0.00999 -1 -> 0.0 Inexact Rounded -resx435 rescale 0.00999 0 -> 0 Inexact Rounded -resx436 rescale 0.00999 1 -> 0E+1 Inexact Rounded - -resx440 rescale 0.000999 -5 -> 0.00100 Inexact Rounded -resx441 rescale 0.000999 -4 -> 0.0010 Inexact Rounded -resx442 rescale 0.000999 -3 -> 0.001 Inexact Rounded -resx443 rescale 0.000999 -2 -> 0.00 Inexact Rounded -resx444 rescale 0.000999 -1 -> 0.0 Inexact Rounded -resx445 rescale 0.000999 0 -> 0 Inexact Rounded -resx446 rescale 0.000999 1 -> 0E+1 Inexact Rounded - -precision: 8 -resx449 rescale 9.999E-15 -23 -> NaN Invalid_operation -resx450 rescale 9.999E-15 -22 -> 9.9990000E-15 -resx451 rescale 9.999E-15 -21 -> 9.999000E-15 -resx452 rescale 9.999E-15 -20 -> 9.99900E-15 -resx453 rescale 9.999E-15 -19 -> 9.9990E-15 -resx454 rescale 9.999E-15 -18 -> 9.999E-15 -resx455 rescale 9.999E-15 -17 -> 1.000E-14 Inexact Rounded -resx456 rescale 9.999E-15 -16 -> 1.00E-14 Inexact Rounded -resx457 rescale 9.999E-15 -15 -> 1.0E-14 Inexact Rounded -resx458 rescale 9.999E-15 -14 -> 1E-14 Inexact Rounded -resx459 rescale 9.999E-15 -13 -> 0E-13 Inexact Rounded -resx460 rescale 9.999E-15 -12 -> 0E-12 Inexact Rounded -resx461 rescale 9.999E-15 -11 -> 0E-11 Inexact Rounded -resx462 rescale 9.999E-15 -10 -> 0E-10 Inexact Rounded -resx463 rescale 9.999E-15 -9 -> 0E-9 Inexact Rounded -resx464 rescale 9.999E-15 -8 -> 0E-8 Inexact Rounded -resx465 rescale 9.999E-15 -7 -> 0E-7 Inexact Rounded -resx466 rescale 9.999E-15 -6 -> 0.000000 Inexact Rounded -resx467 rescale 9.999E-15 -5 -> 0.00000 Inexact Rounded -resx468 rescale 9.999E-15 -4 -> 0.0000 Inexact Rounded -resx469 rescale 9.999E-15 -3 -> 0.000 Inexact Rounded -resx470 rescale 9.999E-15 -2 -> 0.00 Inexact Rounded -resx471 rescale 9.999E-15 -1 -> 0.0 Inexact Rounded -resx472 rescale 9.999E-15 0 -> 0 Inexact Rounded -resx473 rescale 9.999E-15 1 -> 0E+1 Inexact Rounded - --- long operand checks [rhs checks removed] -maxexponent: 999 -minexponent: -999 -precision: 9 -resx481 rescale 12345678000 +3 -> 1.2345678E+10 Rounded -resx482 rescale 1234567800 +1 -> 1.23456780E+9 Rounded -resx483 rescale 1234567890 +1 -> 1.23456789E+9 Rounded -resx484 rescale 1234567891 +1 -> 1.23456789E+9 Inexact Rounded -resx485 rescale 12345678901 +2 -> 1.23456789E+10 Inexact Rounded -resx486 rescale 1234567896 +1 -> 1.23456790E+9 Inexact Rounded --- a potential double-round -resx487 rescale 1234.987643 -4 -> 1234.9876 Inexact Rounded -resx488 rescale 1234.987647 -4 -> 1234.9876 Inexact Rounded - -precision: 15 -resx491 rescale 12345678000 +3 -> 1.2345678E+10 Rounded -resx492 rescale 1234567800 +1 -> 1.23456780E+9 Rounded -resx493 rescale 1234567890 +1 -> 1.23456789E+9 Rounded -resx494 rescale 1234567891 +1 -> 1.23456789E+9 Inexact Rounded -resx495 rescale 12345678901 +2 -> 1.23456789E+10 Inexact Rounded -resx496 rescale 1234567896 +1 -> 1.23456790E+9 Inexact Rounded -resx497 rescale 1234.987643 -4 -> 1234.9876 Inexact Rounded -resx498 rescale 1234.987647 -4 -> 1234.9876 Inexact Rounded - --- Zeros -resx500 rescale 0 1 -> 0E+1 -resx501 rescale 0 0 -> 0 -resx502 rescale 0 -1 -> 0.0 -resx503 rescale 0.0 -1 -> 0.0 -resx504 rescale 0.0 0 -> 0 -resx505 rescale 0.0 +1 -> 0E+1 -resx506 rescale 0E+1 -1 -> 0.0 -resx507 rescale 0E+1 0 -> 0 -resx508 rescale 0E+1 +1 -> 0E+1 -resx509 rescale -0 1 -> -0E+1 -resx510 rescale -0 0 -> -0 -resx511 rescale -0 -1 -> -0.0 -resx512 rescale -0.0 -1 -> -0.0 -resx513 rescale -0.0 0 -> -0 -resx514 rescale -0.0 +1 -> -0E+1 -resx515 rescale -0E+1 -1 -> -0.0 -resx516 rescale -0E+1 0 -> -0 -resx517 rescale -0E+1 +1 -> -0E+1 - --- Suspicious RHS values -maxexponent: 999999999 -minexponent: -999999999 -precision: 15 -resx520 rescale 1.234 999999E+3 -> 0E+999999000 Inexact Rounded -resx521 rescale 123.456 999999E+3 -> 0E+999999000 Inexact Rounded -resx522 rescale 1.234 999999999 -> 0E+999999999 Inexact Rounded -resx523 rescale 123.456 999999999 -> 0E+999999999 Inexact Rounded -resx524 rescale 123.456 1000000000 -> NaN Invalid_operation -resx525 rescale 123.456 12345678903 -> NaN Invalid_operation --- next four are "won't fit" overflows -resx526 rescale 1.234 -999999E+3 -> NaN Invalid_operation -resx527 rescale 123.456 -999999E+3 -> NaN Invalid_operation -resx528 rescale 1.234 -999999999 -> NaN Invalid_operation -resx529 rescale 123.456 -999999999 -> NaN Invalid_operation -resx530 rescale 123.456 -1000000014 -> NaN Invalid_operation -resx531 rescale 123.456 -12345678903 -> NaN Invalid_operation - -maxexponent: 999 -minexponent: -999 -precision: 15 -resx532 rescale 1.234E+999 999 -> 1E+999 Inexact Rounded -resx533 rescale 1.234E+998 999 -> 0E+999 Inexact Rounded -resx534 rescale 1.234 999 -> 0E+999 Inexact Rounded -resx535 rescale 1.234 1000 -> NaN Invalid_operation -resx536 rescale 1.234 5000 -> NaN Invalid_operation -resx537 rescale 0 -999 -> 0E-999 --- next two are "won't fit" overflows -resx538 rescale 1.234 -999 -> NaN Invalid_operation -resx539 rescale 1.234 -1000 -> NaN Invalid_operation -resx540 rescale 1.234 -5000 -> NaN Invalid_operation --- [more below] - --- check bounds (lhs maybe out of range for destination, etc.) -precision: 7 -resx541 rescale 1E+999 +999 -> 1E+999 -resx542 rescale 1E+1000 +999 -> NaN Invalid_operation -resx543 rescale 1E+999 +1000 -> NaN Invalid_operation -resx544 rescale 1E-999 -999 -> 1E-999 -resx545 rescale 1E-1000 -999 -> 0E-999 Inexact Rounded -resx546 rescale 1E-999 -1000 -> 1.0E-999 -resx547 rescale 1E-1005 -999 -> 0E-999 Inexact Rounded -resx548 rescale 1E-1006 -999 -> 0E-999 Inexact Rounded -resx549 rescale 1E-1007 -999 -> 0E-999 Inexact Rounded -resx550 rescale 1E-998 -1005 -> NaN Invalid_operation -- won't fit -resx551 rescale 1E-999 -1005 -> 1.000000E-999 -resx552 rescale 1E-1000 -1005 -> 1.00000E-1000 Subnormal -resx553 rescale 1E-999 -1006 -> NaN Invalid_operation -resx554 rescale 1E-999 -1007 -> NaN Invalid_operation --- related subnormal rounding -resx555 rescale 1.666666E-999 -1005 -> 1.666666E-999 -resx556 rescale 1.666666E-1000 -1005 -> 1.66667E-1000 Subnormal Inexact Rounded -resx557 rescale 1.666666E-1001 -1005 -> 1.6667E-1001 Subnormal Inexact Rounded -resx558 rescale 1.666666E-1002 -1005 -> 1.667E-1002 Subnormal Inexact Rounded -resx559 rescale 1.666666E-1003 -1005 -> 1.67E-1003 Subnormal Inexact Rounded -resx560 rescale 1.666666E-1004 -1005 -> 1.7E-1004 Subnormal Inexact Rounded -resx561 rescale 1.666666E-1005 -1005 -> 2E-1005 Subnormal Inexact Rounded -resx562 rescale 1.666666E-1006 -1005 -> 0E-1005 Inexact Rounded -resx563 rescale 1.666666E-1007 -1005 -> 0E-1005 Inexact Rounded - --- fractional RHS, some good and some bad -precision: 9 -resx564 rescale 222 +2.0 -> 2E+2 Inexact Rounded -resx565 rescale 222 +2.00000000 -> 2E+2 Inexact Rounded -resx566 rescale 222 +2.00100000000 -> NaN Invalid_operation -resx567 rescale 222 +2.000001 -> NaN Invalid_operation -resx568 rescale 222 +2.000000001 -> NaN Invalid_operation -resx569 rescale 222 +2.0000000001 -> NaN Invalid_operation -resx570 rescale 222 +2.00000000001 -> NaN Invalid_operation -resx571 rescale 222 +2.99999999999 -> NaN Invalid_operation -resx572 rescale 222 -2.00000000 -> 222.00 -resx573 rescale 222 -2.00100000000 -> NaN Invalid_operation -resx574 rescale 222 -2.0000001000 -> NaN Invalid_operation -resx575 rescale 222 -2.00000000001 -> NaN Invalid_operation -resx576 rescale 222 -2.99999999999 -> NaN Invalid_operation - --- Specials -resx580 rescale Inf -Inf -> Infinity -resx581 rescale Inf -1000 -> NaN Invalid_operation -resx582 rescale Inf -1 -> NaN Invalid_operation -resx583 rescale Inf 0 -> NaN Invalid_operation -resx584 rescale Inf 1 -> NaN Invalid_operation -resx585 rescale Inf 1000 -> NaN Invalid_operation -resx586 rescale Inf Inf -> Infinity -resx587 rescale -1000 Inf -> NaN Invalid_operation -resx588 rescale -Inf Inf -> -Infinity -resx589 rescale -1 Inf -> NaN Invalid_operation -resx590 rescale 0 Inf -> NaN Invalid_operation -resx591 rescale 1 Inf -> NaN Invalid_operation -resx592 rescale 1000 Inf -> NaN Invalid_operation -resx593 rescale Inf Inf -> Infinity -resx594 rescale Inf -0 -> NaN Invalid_operation -resx595 rescale -0 Inf -> NaN Invalid_operation - -resx600 rescale -Inf -Inf -> -Infinity -resx601 rescale -Inf -1000 -> NaN Invalid_operation -resx602 rescale -Inf -1 -> NaN Invalid_operation -resx603 rescale -Inf 0 -> NaN Invalid_operation -resx604 rescale -Inf 1 -> NaN Invalid_operation -resx605 rescale -Inf 1000 -> NaN Invalid_operation -resx606 rescale -Inf Inf -> -Infinity -resx607 rescale -1000 Inf -> NaN Invalid_operation -resx608 rescale -Inf -Inf -> -Infinity -resx609 rescale -1 -Inf -> NaN Invalid_operation -resx610 rescale 0 -Inf -> NaN Invalid_operation -resx611 rescale 1 -Inf -> NaN Invalid_operation -resx612 rescale 1000 -Inf -> NaN Invalid_operation -resx613 rescale Inf -Inf -> Infinity -resx614 rescale -Inf -0 -> NaN Invalid_operation -resx615 rescale -0 -Inf -> NaN Invalid_operation - -resx621 rescale NaN -Inf -> NaN -resx622 rescale NaN -1000 -> NaN -resx623 rescale NaN -1 -> NaN -resx624 rescale NaN 0 -> NaN -resx625 rescale NaN 1 -> NaN -resx626 rescale NaN 1000 -> NaN -resx627 rescale NaN Inf -> NaN -resx628 rescale NaN NaN -> NaN -resx629 rescale -Inf NaN -> NaN -resx630 rescale -1000 NaN -> NaN -resx631 rescale -1 NaN -> NaN -resx632 rescale 0 NaN -> NaN -resx633 rescale 1 -NaN -> -NaN -resx634 rescale 1000 NaN -> NaN -resx635 rescale Inf NaN -> NaN -resx636 rescale NaN -0 -> NaN -resx637 rescale -0 NaN -> NaN - -resx641 rescale sNaN -Inf -> NaN Invalid_operation -resx642 rescale sNaN -1000 -> NaN Invalid_operation -resx643 rescale sNaN -1 -> NaN Invalid_operation -resx644 rescale sNaN 0 -> NaN Invalid_operation -resx645 rescale sNaN 1 -> NaN Invalid_operation -resx646 rescale sNaN 1000 -> NaN Invalid_operation -resx647 rescale -sNaN NaN -> -NaN Invalid_operation -resx648 rescale sNaN -sNaN -> NaN Invalid_operation -resx649 rescale NaN sNaN -> NaN Invalid_operation -resx650 rescale -Inf sNaN -> NaN Invalid_operation -resx651 rescale -1000 sNaN -> NaN Invalid_operation -resx652 rescale -1 sNaN -> NaN Invalid_operation -resx653 rescale 0 sNaN -> NaN Invalid_operation -resx654 rescale 1 -sNaN -> -NaN Invalid_operation -resx655 rescale 1000 sNaN -> NaN Invalid_operation -resx656 rescale Inf sNaN -> NaN Invalid_operation -resx657 rescale NaN sNaN -> NaN Invalid_operation -resx658 rescale sNaN -0 -> NaN Invalid_operation -resx659 rescale -0 sNaN -> NaN Invalid_operation - --- propagating NaNs -resx661 rescale NaN9 -Inf -> NaN9 -resx662 rescale NaN81 919 -> NaN81 -resx663 rescale NaN72 Inf -> NaN72 -resx664 rescale -NaN66 NaN5 -> -NaN66 -resx665 rescale -Inf NaN4 -> NaN4 -resx666 rescale -919 NaN32 -> NaN32 -resx667 rescale Inf NaN2 -> NaN2 - -resx671 rescale sNaN99 -Inf -> NaN99 Invalid_operation -resx672 rescale -sNaN98 -11 -> -NaN98 Invalid_operation -resx673 rescale sNaN97 NaN -> NaN97 Invalid_operation -resx674 rescale sNaN16 sNaN94 -> NaN16 Invalid_operation -resx675 rescale NaN95 sNaN93 -> NaN93 Invalid_operation -resx676 rescale -Inf sNaN92 -> NaN92 Invalid_operation -resx677 rescale 088 -sNaN91 -> -NaN91 Invalid_operation -resx678 rescale Inf -sNaN90 -> -NaN90 Invalid_operation -resx679 rescale NaN sNaN87 -> NaN87 Invalid_operation - --- subnormals and underflow -precision: 4 -maxexponent: 999 -minexponent: -999 -resx710 rescale 1.00E-999 -999 -> 1E-999 Rounded -resx711 rescale 0.1E-999 -1000 -> 1E-1000 Subnormal -resx712 rescale 0.10E-999 -1000 -> 1E-1000 Subnormal Rounded -resx713 rescale 0.100E-999 -1000 -> 1E-1000 Subnormal Rounded -resx714 rescale 0.01E-999 -1001 -> 1E-1001 Subnormal --- next is rounded to Emin -resx715 rescale 0.999E-999 -999 -> 1E-999 Inexact Rounded -resx716 rescale 0.099E-999 -1000 -> 1E-1000 Inexact Rounded Subnormal - -resx717 rescale 0.009E-999 -1001 -> 1E-1001 Inexact Rounded Subnormal -resx718 rescale 0.001E-999 -1001 -> 0E-1001 Inexact Rounded -resx719 rescale 0.0009E-999 -1001 -> 0E-1001 Inexact Rounded -resx720 rescale 0.0001E-999 -1001 -> 0E-1001 Inexact Rounded - -resx730 rescale -1.00E-999 -999 -> -1E-999 Rounded -resx731 rescale -0.1E-999 -999 -> -0E-999 Rounded Inexact -resx732 rescale -0.10E-999 -999 -> -0E-999 Rounded Inexact -resx733 rescale -0.100E-999 -999 -> -0E-999 Rounded Inexact -resx734 rescale -0.01E-999 -999 -> -0E-999 Inexact Rounded --- next is rounded to Emin -resx735 rescale -0.999E-999 -999 -> -1E-999 Inexact Rounded -resx736 rescale -0.099E-999 -999 -> -0E-999 Inexact Rounded -resx737 rescale -0.009E-999 -999 -> -0E-999 Inexact Rounded -resx738 rescale -0.001E-999 -999 -> -0E-999 Inexact Rounded -resx739 rescale -0.0001E-999 -999 -> -0E-999 Inexact Rounded - -resx740 rescale -1.00E-999 -1000 -> -1.0E-999 Rounded -resx741 rescale -0.1E-999 -1000 -> -1E-1000 Subnormal -resx742 rescale -0.10E-999 -1000 -> -1E-1000 Subnormal Rounded -resx743 rescale -0.100E-999 -1000 -> -1E-1000 Subnormal Rounded -resx744 rescale -0.01E-999 -1000 -> -0E-1000 Inexact Rounded --- next is rounded to Emin -resx745 rescale -0.999E-999 -1000 -> -1.0E-999 Inexact Rounded -resx746 rescale -0.099E-999 -1000 -> -1E-1000 Inexact Rounded Subnormal -resx747 rescale -0.009E-999 -1000 -> -0E-1000 Inexact Rounded -resx748 rescale -0.001E-999 -1000 -> -0E-1000 Inexact Rounded -resx749 rescale -0.0001E-999 -1000 -> -0E-1000 Inexact Rounded - -resx750 rescale -1.00E-999 -1001 -> -1.00E-999 -resx751 rescale -0.1E-999 -1001 -> -1.0E-1000 Subnormal -resx752 rescale -0.10E-999 -1001 -> -1.0E-1000 Subnormal -resx753 rescale -0.100E-999 -1001 -> -1.0E-1000 Subnormal Rounded -resx754 rescale -0.01E-999 -1001 -> -1E-1001 Subnormal --- next is rounded to Emin -resx755 rescale -0.999E-999 -1001 -> -1.00E-999 Inexact Rounded -resx756 rescale -0.099E-999 -1001 -> -1.0E-1000 Inexact Rounded Subnormal -resx757 rescale -0.009E-999 -1001 -> -1E-1001 Inexact Rounded Subnormal -resx758 rescale -0.001E-999 -1001 -> -0E-1001 Inexact Rounded -resx759 rescale -0.0001E-999 -1001 -> -0E-1001 Inexact Rounded - -resx760 rescale -1.00E-999 -1002 -> -1.000E-999 -resx761 rescale -0.1E-999 -1002 -> -1.00E-1000 Subnormal -resx762 rescale -0.10E-999 -1002 -> -1.00E-1000 Subnormal -resx763 rescale -0.100E-999 -1002 -> -1.00E-1000 Subnormal -resx764 rescale -0.01E-999 -1002 -> -1.0E-1001 Subnormal -resx765 rescale -0.999E-999 -1002 -> -9.99E-1000 Subnormal -resx766 rescale -0.099E-999 -1002 -> -9.9E-1001 Subnormal -resx767 rescale -0.009E-999 -1002 -> -9E-1002 Subnormal -resx768 rescale -0.001E-999 -1002 -> -1E-1002 Subnormal -resx769 rescale -0.0001E-999 -1002 -> -0E-1002 Inexact Rounded - --- rhs must be no less than Etiny -resx770 rescale -1.00E-999 -1003 -> NaN Invalid_operation -resx771 rescale -0.1E-999 -1003 -> NaN Invalid_operation -resx772 rescale -0.10E-999 -1003 -> NaN Invalid_operation -resx773 rescale -0.100E-999 -1003 -> NaN Invalid_operation -resx774 rescale -0.01E-999 -1003 -> NaN Invalid_operation -resx775 rescale -0.999E-999 -1003 -> NaN Invalid_operation -resx776 rescale -0.099E-999 -1003 -> NaN Invalid_operation -resx777 rescale -0.009E-999 -1003 -> NaN Invalid_operation -resx778 rescale -0.001E-999 -1003 -> NaN Invalid_operation -resx779 rescale -0.0001E-999 -1003 -> NaN Invalid_operation - -precision: 9 -maxExponent: 999999999 -minexponent: -999999999 - --- getInt worries -resx801 rescale 0 1000000000 -> NaN Invalid_operation -resx802 rescale 0 -1000000000 -> 0E-1000000000 -resx803 rescale 0 2000000000 -> NaN Invalid_operation -resx804 rescale 0 -2000000000 -> NaN Invalid_operation -resx805 rescale 0 3000000000 -> NaN Invalid_operation -resx806 rescale 0 -3000000000 -> NaN Invalid_operation -resx807 rescale 0 4000000000 -> NaN Invalid_operation -resx808 rescale 0 -4000000000 -> NaN Invalid_operation -resx809 rescale 0 5000000000 -> NaN Invalid_operation -resx810 rescale 0 -5000000000 -> NaN Invalid_operation -resx811 rescale 0 6000000000 -> NaN Invalid_operation -resx812 rescale 0 -6000000000 -> NaN Invalid_operation -resx813 rescale 0 7000000000 -> NaN Invalid_operation -resx814 rescale 0 -7000000000 -> NaN Invalid_operation -resx815 rescale 0 8000000000 -> NaN Invalid_operation -resx816 rescale 0 -8000000000 -> NaN Invalid_operation -resx817 rescale 0 9000000000 -> NaN Invalid_operation -resx818 rescale 0 -9000000000 -> NaN Invalid_operation -resx819 rescale 0 9999999999 -> NaN Invalid_operation -resx820 rescale 0 -9999999999 -> NaN Invalid_operation -resx821 rescale 0 10000000000 -> NaN Invalid_operation -resx822 rescale 0 -10000000000 -> NaN Invalid_operation - -resx831 rescale 1 0E-1 -> 1 -resx832 rescale 1 0E-2 -> 1 -resx833 rescale 1 0E-3 -> 1 -resx834 rescale 1 0E-4 -> 1 -resx835 rescale 1 0E-100 -> 1 -resx836 rescale 1 0E-100000 -> 1 -resx837 rescale 1 0E+100 -> 1 -resx838 rescale 1 0E+100000 -> 1 - -resx841 rescale 0 5E-1000000 -> NaN Invalid_operation -resx842 rescale 0 5E-1000000 -> NaN Invalid_operation -resx843 rescale 0 999999999 -> 0E+999999999 -resx844 rescale 0 1000000000 -> NaN Invalid_operation -resx845 rescale 0 -999999999 -> 0E-999999999 -resx846 rescale 0 -1000000000 -> 0E-1000000000 -resx847 rescale 0 -1000000001 -> 0E-1000000001 -resx848 rescale 0 -1000000002 -> 0E-1000000002 -resx849 rescale 0 -1000000003 -> 0E-1000000003 -resx850 rescale 0 -1000000004 -> 0E-1000000004 -resx851 rescale 0 -1000000005 -> 0E-1000000005 -resx852 rescale 0 -1000000006 -> 0E-1000000006 -resx853 rescale 0 -1000000007 -> 0E-1000000007 -resx854 rescale 0 -1000000008 -> NaN Invalid_operation - -resx861 rescale 1 +2147483649 -> NaN Invalid_operation -resx862 rescale 1 +2147483648 -> NaN Invalid_operation -resx863 rescale 1 +2147483647 -> NaN Invalid_operation -resx864 rescale 1 -2147483647 -> NaN Invalid_operation -resx865 rescale 1 -2147483648 -> NaN Invalid_operation -resx866 rescale 1 -2147483649 -> NaN Invalid_operation - --- Null tests -res900 rescale 10 # -> NaN Invalid_operation -res901 rescale # 10 -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/rounding.decTest b/sys/lib/python/test/decimaltestdata/rounding.decTest deleted file mode 100644 index f1437a50e..000000000 --- a/sys/lib/python/test/decimaltestdata/rounding.decTest +++ /dev/null @@ -1,1079 +0,0 @@ ------------------------------------------------------------------------- --- rounding.decTest -- decimal rounding modes testcases -- --- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- These tests require that implementations take account of residues in --- order to get correct results for some rounding modes. Rather than --- single rounding tests we therefore need tests for most operators. --- [We do assume add/minus/plus/subtract are common paths, however, as --- is rounding of negatives (if the latter works for addition, assume it --- works for the others, too).] --- --- Underflow Subnormal and overflow behaviours are tested under the individual --- operators. - -extended: 1 -precision: 5 -- for easier visual inspection -maxExponent: 999 -minexponent: -999 - --- Addition operators ------------------------------------------------- -rounding: down - -radx100 add 12345 -0.1 -> 12344 Inexact Rounded -radx101 add 12345 -0.01 -> 12344 Inexact Rounded -radx102 add 12345 -0.001 -> 12344 Inexact Rounded -radx103 add 12345 -0.00001 -> 12344 Inexact Rounded -radx104 add 12345 -0.000001 -> 12344 Inexact Rounded -radx105 add 12345 -0.0000001 -> 12344 Inexact Rounded -radx106 add 12345 0 -> 12345 -radx107 add 12345 0.0000001 -> 12345 Inexact Rounded -radx108 add 12345 0.000001 -> 12345 Inexact Rounded -radx109 add 12345 0.00001 -> 12345 Inexact Rounded -radx110 add 12345 0.0001 -> 12345 Inexact Rounded -radx111 add 12345 0.001 -> 12345 Inexact Rounded -radx112 add 12345 0.01 -> 12345 Inexact Rounded -radx113 add 12345 0.1 -> 12345 Inexact Rounded - -radx115 add 12346 0.49999 -> 12346 Inexact Rounded -radx116 add 12346 0.5 -> 12346 Inexact Rounded -radx117 add 12346 0.50001 -> 12346 Inexact Rounded - -radx120 add 12345 0.4 -> 12345 Inexact Rounded -radx121 add 12345 0.49 -> 12345 Inexact Rounded -radx122 add 12345 0.499 -> 12345 Inexact Rounded -radx123 add 12345 0.49999 -> 12345 Inexact Rounded -radx124 add 12345 0.5 -> 12345 Inexact Rounded -radx125 add 12345 0.50001 -> 12345 Inexact Rounded -radx126 add 12345 0.5001 -> 12345 Inexact Rounded -radx127 add 12345 0.501 -> 12345 Inexact Rounded -radx128 add 12345 0.51 -> 12345 Inexact Rounded -radx129 add 12345 0.6 -> 12345 Inexact Rounded - -rounding: half_down - -radx140 add 12345 -0.1 -> 12345 Inexact Rounded -radx141 add 12345 -0.01 -> 12345 Inexact Rounded -radx142 add 12345 -0.001 -> 12345 Inexact Rounded -radx143 add 12345 -0.00001 -> 12345 Inexact Rounded -radx144 add 12345 -0.000001 -> 12345 Inexact Rounded -radx145 add 12345 -0.0000001 -> 12345 Inexact Rounded -radx146 add 12345 0 -> 12345 -radx147 add 12345 0.0000001 -> 12345 Inexact Rounded -radx148 add 12345 0.000001 -> 12345 Inexact Rounded -radx149 add 12345 0.00001 -> 12345 Inexact Rounded -radx150 add 12345 0.0001 -> 12345 Inexact Rounded -radx151 add 12345 0.001 -> 12345 Inexact Rounded -radx152 add 12345 0.01 -> 12345 Inexact Rounded -radx153 add 12345 0.1 -> 12345 Inexact Rounded - -radx155 add 12346 0.49999 -> 12346 Inexact Rounded -radx156 add 12346 0.5 -> 12346 Inexact Rounded -radx157 add 12346 0.50001 -> 12347 Inexact Rounded - -radx160 add 12345 0.4 -> 12345 Inexact Rounded -radx161 add 12345 0.49 -> 12345 Inexact Rounded -radx162 add 12345 0.499 -> 12345 Inexact Rounded -radx163 add 12345 0.49999 -> 12345 Inexact Rounded -radx164 add 12345 0.5 -> 12345 Inexact Rounded -radx165 add 12345 0.50001 -> 12346 Inexact Rounded -radx166 add 12345 0.5001 -> 12346 Inexact Rounded -radx167 add 12345 0.501 -> 12346 Inexact Rounded -radx168 add 12345 0.51 -> 12346 Inexact Rounded -radx169 add 12345 0.6 -> 12346 Inexact Rounded - -rounding: half_even - -radx170 add 12345 -0.1 -> 12345 Inexact Rounded -radx171 add 12345 -0.01 -> 12345 Inexact Rounded -radx172 add 12345 -0.001 -> 12345 Inexact Rounded -radx173 add 12345 -0.00001 -> 12345 Inexact Rounded -radx174 add 12345 -0.000001 -> 12345 Inexact Rounded -radx175 add 12345 -0.0000001 -> 12345 Inexact Rounded -radx176 add 12345 0 -> 12345 -radx177 add 12345 0.0000001 -> 12345 Inexact Rounded -radx178 add 12345 0.000001 -> 12345 Inexact Rounded -radx179 add 12345 0.00001 -> 12345 Inexact Rounded -radx180 add 12345 0.0001 -> 12345 Inexact Rounded -radx181 add 12345 0.001 -> 12345 Inexact Rounded -radx182 add 12345 0.01 -> 12345 Inexact Rounded -radx183 add 12345 0.1 -> 12345 Inexact Rounded - -radx185 add 12346 0.49999 -> 12346 Inexact Rounded -radx186 add 12346 0.5 -> 12346 Inexact Rounded -radx187 add 12346 0.50001 -> 12347 Inexact Rounded - -radx190 add 12345 0.4 -> 12345 Inexact Rounded -radx191 add 12345 0.49 -> 12345 Inexact Rounded -radx192 add 12345 0.499 -> 12345 Inexact Rounded -radx193 add 12345 0.49999 -> 12345 Inexact Rounded -radx194 add 12345 0.5 -> 12346 Inexact Rounded -radx195 add 12345 0.50001 -> 12346 Inexact Rounded -radx196 add 12345 0.5001 -> 12346 Inexact Rounded -radx197 add 12345 0.501 -> 12346 Inexact Rounded -radx198 add 12345 0.51 -> 12346 Inexact Rounded -radx199 add 12345 0.6 -> 12346 Inexact Rounded - -rounding: half_up - -radx200 add 12345 -0.1 -> 12345 Inexact Rounded -radx201 add 12345 -0.01 -> 12345 Inexact Rounded -radx202 add 12345 -0.001 -> 12345 Inexact Rounded -radx203 add 12345 -0.00001 -> 12345 Inexact Rounded -radx204 add 12345 -0.000001 -> 12345 Inexact Rounded -radx205 add 12345 -0.0000001 -> 12345 Inexact Rounded -radx206 add 12345 0 -> 12345 -radx207 add 12345 0.0000001 -> 12345 Inexact Rounded -radx208 add 12345 0.000001 -> 12345 Inexact Rounded -radx209 add 12345 0.00001 -> 12345 Inexact Rounded -radx210 add 12345 0.0001 -> 12345 Inexact Rounded -radx211 add 12345 0.001 -> 12345 Inexact Rounded -radx212 add 12345 0.01 -> 12345 Inexact Rounded -radx213 add 12345 0.1 -> 12345 Inexact Rounded - -radx215 add 12346 0.49999 -> 12346 Inexact Rounded -radx216 add 12346 0.5 -> 12347 Inexact Rounded -radx217 add 12346 0.50001 -> 12347 Inexact Rounded - -radx220 add 12345 0.4 -> 12345 Inexact Rounded -radx221 add 12345 0.49 -> 12345 Inexact Rounded -radx222 add 12345 0.499 -> 12345 Inexact Rounded -radx223 add 12345 0.49999 -> 12345 Inexact Rounded -radx224 add 12345 0.5 -> 12346 Inexact Rounded -radx225 add 12345 0.50001 -> 12346 Inexact Rounded -radx226 add 12345 0.5001 -> 12346 Inexact Rounded -radx227 add 12345 0.501 -> 12346 Inexact Rounded -radx228 add 12345 0.51 -> 12346 Inexact Rounded -radx229 add 12345 0.6 -> 12346 Inexact Rounded - -rounding: up - -radx230 add 12345 -0.1 -> 12345 Inexact Rounded -radx231 add 12345 -0.01 -> 12345 Inexact Rounded -radx232 add 12345 -0.001 -> 12345 Inexact Rounded -radx233 add 12345 -0.00001 -> 12345 Inexact Rounded -radx234 add 12345 -0.000001 -> 12345 Inexact Rounded -radx235 add 12345 -0.0000001 -> 12345 Inexact Rounded -radx236 add 12345 0 -> 12345 -radx237 add 12345 0.0000001 -> 12346 Inexact Rounded -radx238 add 12345 0.000001 -> 12346 Inexact Rounded -radx239 add 12345 0.00001 -> 12346 Inexact Rounded -radx240 add 12345 0.0001 -> 12346 Inexact Rounded -radx241 add 12345 0.001 -> 12346 Inexact Rounded -radx242 add 12345 0.01 -> 12346 Inexact Rounded -radx243 add 12345 0.1 -> 12346 Inexact Rounded - -radx245 add 12346 0.49999 -> 12347 Inexact Rounded -radx246 add 12346 0.5 -> 12347 Inexact Rounded -radx247 add 12346 0.50001 -> 12347 Inexact Rounded - -radx250 add 12345 0.4 -> 12346 Inexact Rounded -radx251 add 12345 0.49 -> 12346 Inexact Rounded -radx252 add 12345 0.499 -> 12346 Inexact Rounded -radx253 add 12345 0.49999 -> 12346 Inexact Rounded -radx254 add 12345 0.5 -> 12346 Inexact Rounded -radx255 add 12345 0.50001 -> 12346 Inexact Rounded -radx256 add 12345 0.5001 -> 12346 Inexact Rounded -radx257 add 12345 0.501 -> 12346 Inexact Rounded -radx258 add 12345 0.51 -> 12346 Inexact Rounded -radx259 add 12345 0.6 -> 12346 Inexact Rounded - -rounding: floor - -radx300 add 12345 -0.1 -> 12344 Inexact Rounded -radx301 add 12345 -0.01 -> 12344 Inexact Rounded -radx302 add 12345 -0.001 -> 12344 Inexact Rounded -radx303 add 12345 -0.00001 -> 12344 Inexact Rounded -radx304 add 12345 -0.000001 -> 12344 Inexact Rounded -radx305 add 12345 -0.0000001 -> 12344 Inexact Rounded -radx306 add 12345 0 -> 12345 -radx307 add 12345 0.0000001 -> 12345 Inexact Rounded -radx308 add 12345 0.000001 -> 12345 Inexact Rounded -radx309 add 12345 0.00001 -> 12345 Inexact Rounded -radx310 add 12345 0.0001 -> 12345 Inexact Rounded -radx311 add 12345 0.001 -> 12345 Inexact Rounded -radx312 add 12345 0.01 -> 12345 Inexact Rounded -radx313 add 12345 0.1 -> 12345 Inexact Rounded - -radx315 add 12346 0.49999 -> 12346 Inexact Rounded -radx316 add 12346 0.5 -> 12346 Inexact Rounded -radx317 add 12346 0.50001 -> 12346 Inexact Rounded - -radx320 add 12345 0.4 -> 12345 Inexact Rounded -radx321 add 12345 0.49 -> 12345 Inexact Rounded -radx322 add 12345 0.499 -> 12345 Inexact Rounded -radx323 add 12345 0.49999 -> 12345 Inexact Rounded -radx324 add 12345 0.5 -> 12345 Inexact Rounded -radx325 add 12345 0.50001 -> 12345 Inexact Rounded -radx326 add 12345 0.5001 -> 12345 Inexact Rounded -radx327 add 12345 0.501 -> 12345 Inexact Rounded -radx328 add 12345 0.51 -> 12345 Inexact Rounded -radx329 add 12345 0.6 -> 12345 Inexact Rounded - -rounding: ceiling - -radx330 add 12345 -0.1 -> 12345 Inexact Rounded -radx331 add 12345 -0.01 -> 12345 Inexact Rounded -radx332 add 12345 -0.001 -> 12345 Inexact Rounded -radx333 add 12345 -0.00001 -> 12345 Inexact Rounded -radx334 add 12345 -0.000001 -> 12345 Inexact Rounded -radx335 add 12345 -0.0000001 -> 12345 Inexact Rounded -radx336 add 12345 0 -> 12345 -radx337 add 12345 0.0000001 -> 12346 Inexact Rounded -radx338 add 12345 0.000001 -> 12346 Inexact Rounded -radx339 add 12345 0.00001 -> 12346 Inexact Rounded -radx340 add 12345 0.0001 -> 12346 Inexact Rounded -radx341 add 12345 0.001 -> 12346 Inexact Rounded -radx342 add 12345 0.01 -> 12346 Inexact Rounded -radx343 add 12345 0.1 -> 12346 Inexact Rounded - -radx345 add 12346 0.49999 -> 12347 Inexact Rounded -radx346 add 12346 0.5 -> 12347 Inexact Rounded -radx347 add 12346 0.50001 -> 12347 Inexact Rounded - -radx350 add 12345 0.4 -> 12346 Inexact Rounded -radx351 add 12345 0.49 -> 12346 Inexact Rounded -radx352 add 12345 0.499 -> 12346 Inexact Rounded -radx353 add 12345 0.49999 -> 12346 Inexact Rounded -radx354 add 12345 0.5 -> 12346 Inexact Rounded -radx355 add 12345 0.50001 -> 12346 Inexact Rounded -radx356 add 12345 0.5001 -> 12346 Inexact Rounded -radx357 add 12345 0.501 -> 12346 Inexact Rounded -radx358 add 12345 0.51 -> 12346 Inexact Rounded -radx359 add 12345 0.6 -> 12346 Inexact Rounded - --- negatives... - -rounding: down - -rsux100 add -12345 -0.1 -> -12345 Inexact Rounded -rsux101 add -12345 -0.01 -> -12345 Inexact Rounded -rsux102 add -12345 -0.001 -> -12345 Inexact Rounded -rsux103 add -12345 -0.00001 -> -12345 Inexact Rounded -rsux104 add -12345 -0.000001 -> -12345 Inexact Rounded -rsux105 add -12345 -0.0000001 -> -12345 Inexact Rounded -rsux106 add -12345 0 -> -12345 -rsux107 add -12345 0.0000001 -> -12344 Inexact Rounded -rsux108 add -12345 0.000001 -> -12344 Inexact Rounded -rsux109 add -12345 0.00001 -> -12344 Inexact Rounded -rsux110 add -12345 0.0001 -> -12344 Inexact Rounded -rsux111 add -12345 0.001 -> -12344 Inexact Rounded -rsux112 add -12345 0.01 -> -12344 Inexact Rounded -rsux113 add -12345 0.1 -> -12344 Inexact Rounded - -rsux115 add -12346 0.49999 -> -12345 Inexact Rounded -rsux116 add -12346 0.5 -> -12345 Inexact Rounded -rsux117 add -12346 0.50001 -> -12345 Inexact Rounded - -rsux120 add -12345 0.4 -> -12344 Inexact Rounded -rsux121 add -12345 0.49 -> -12344 Inexact Rounded -rsux122 add -12345 0.499 -> -12344 Inexact Rounded -rsux123 add -12345 0.49999 -> -12344 Inexact Rounded -rsux124 add -12345 0.5 -> -12344 Inexact Rounded -rsux125 add -12345 0.50001 -> -12344 Inexact Rounded -rsux126 add -12345 0.5001 -> -12344 Inexact Rounded -rsux127 add -12345 0.501 -> -12344 Inexact Rounded -rsux128 add -12345 0.51 -> -12344 Inexact Rounded -rsux129 add -12345 0.6 -> -12344 Inexact Rounded - -rounding: half_down - -rsux140 add -12345 -0.1 -> -12345 Inexact Rounded -rsux141 add -12345 -0.01 -> -12345 Inexact Rounded -rsux142 add -12345 -0.001 -> -12345 Inexact Rounded -rsux143 add -12345 -0.00001 -> -12345 Inexact Rounded -rsux144 add -12345 -0.000001 -> -12345 Inexact Rounded -rsux145 add -12345 -0.0000001 -> -12345 Inexact Rounded -rsux146 add -12345 0 -> -12345 -rsux147 add -12345 0.0000001 -> -12345 Inexact Rounded -rsux148 add -12345 0.000001 -> -12345 Inexact Rounded -rsux149 add -12345 0.00001 -> -12345 Inexact Rounded -rsux150 add -12345 0.0001 -> -12345 Inexact Rounded -rsux151 add -12345 0.001 -> -12345 Inexact Rounded -rsux152 add -12345 0.01 -> -12345 Inexact Rounded -rsux153 add -12345 0.1 -> -12345 Inexact Rounded - -rsux155 add -12346 0.49999 -> -12346 Inexact Rounded -rsux156 add -12346 0.5 -> -12345 Inexact Rounded -rsux157 add -12346 0.50001 -> -12345 Inexact Rounded - -rsux160 add -12345 0.4 -> -12345 Inexact Rounded -rsux161 add -12345 0.49 -> -12345 Inexact Rounded -rsux162 add -12345 0.499 -> -12345 Inexact Rounded -rsux163 add -12345 0.49999 -> -12345 Inexact Rounded -rsux164 add -12345 0.5 -> -12344 Inexact Rounded -rsux165 add -12345 0.50001 -> -12344 Inexact Rounded -rsux166 add -12345 0.5001 -> -12344 Inexact Rounded -rsux167 add -12345 0.501 -> -12344 Inexact Rounded -rsux168 add -12345 0.51 -> -12344 Inexact Rounded -rsux169 add -12345 0.6 -> -12344 Inexact Rounded - -rounding: half_even - -rsux170 add -12345 -0.1 -> -12345 Inexact Rounded -rsux171 add -12345 -0.01 -> -12345 Inexact Rounded -rsux172 add -12345 -0.001 -> -12345 Inexact Rounded -rsux173 add -12345 -0.00001 -> -12345 Inexact Rounded -rsux174 add -12345 -0.000001 -> -12345 Inexact Rounded -rsux175 add -12345 -0.0000001 -> -12345 Inexact Rounded -rsux176 add -12345 0 -> -12345 -rsux177 add -12345 0.0000001 -> -12345 Inexact Rounded -rsux178 add -12345 0.000001 -> -12345 Inexact Rounded -rsux179 add -12345 0.00001 -> -12345 Inexact Rounded -rsux180 add -12345 0.0001 -> -12345 Inexact Rounded -rsux181 add -12345 0.001 -> -12345 Inexact Rounded -rsux182 add -12345 0.01 -> -12345 Inexact Rounded -rsux183 add -12345 0.1 -> -12345 Inexact Rounded - -rsux185 add -12346 0.49999 -> -12346 Inexact Rounded -rsux186 add -12346 0.5 -> -12346 Inexact Rounded -rsux187 add -12346 0.50001 -> -12345 Inexact Rounded - -rsux190 add -12345 0.4 -> -12345 Inexact Rounded -rsux191 add -12345 0.49 -> -12345 Inexact Rounded -rsux192 add -12345 0.499 -> -12345 Inexact Rounded -rsux193 add -12345 0.49999 -> -12345 Inexact Rounded -rsux194 add -12345 0.5 -> -12344 Inexact Rounded -rsux195 add -12345 0.50001 -> -12344 Inexact Rounded -rsux196 add -12345 0.5001 -> -12344 Inexact Rounded -rsux197 add -12345 0.501 -> -12344 Inexact Rounded -rsux198 add -12345 0.51 -> -12344 Inexact Rounded -rsux199 add -12345 0.6 -> -12344 Inexact Rounded - -rounding: half_up - -rsux200 add -12345 -0.1 -> -12345 Inexact Rounded -rsux201 add -12345 -0.01 -> -12345 Inexact Rounded -rsux202 add -12345 -0.001 -> -12345 Inexact Rounded -rsux203 add -12345 -0.00001 -> -12345 Inexact Rounded -rsux204 add -12345 -0.000001 -> -12345 Inexact Rounded -rsux205 add -12345 -0.0000001 -> -12345 Inexact Rounded -rsux206 add -12345 0 -> -12345 -rsux207 add -12345 0.0000001 -> -12345 Inexact Rounded -rsux208 add -12345 0.000001 -> -12345 Inexact Rounded -rsux209 add -12345 0.00001 -> -12345 Inexact Rounded -rsux210 add -12345 0.0001 -> -12345 Inexact Rounded -rsux211 add -12345 0.001 -> -12345 Inexact Rounded -rsux212 add -12345 0.01 -> -12345 Inexact Rounded -rsux213 add -12345 0.1 -> -12345 Inexact Rounded - -rsux215 add -12346 0.49999 -> -12346 Inexact Rounded -rsux216 add -12346 0.5 -> -12346 Inexact Rounded -rsux217 add -12346 0.50001 -> -12345 Inexact Rounded - -rsux220 add -12345 0.4 -> -12345 Inexact Rounded -rsux221 add -12345 0.49 -> -12345 Inexact Rounded -rsux222 add -12345 0.499 -> -12345 Inexact Rounded -rsux223 add -12345 0.49999 -> -12345 Inexact Rounded -rsux224 add -12345 0.5 -> -12345 Inexact Rounded -rsux225 add -12345 0.50001 -> -12344 Inexact Rounded -rsux226 add -12345 0.5001 -> -12344 Inexact Rounded -rsux227 add -12345 0.501 -> -12344 Inexact Rounded -rsux228 add -12345 0.51 -> -12344 Inexact Rounded -rsux229 add -12345 0.6 -> -12344 Inexact Rounded - -rounding: up - -rsux230 add -12345 -0.1 -> -12346 Inexact Rounded -rsux231 add -12345 -0.01 -> -12346 Inexact Rounded -rsux232 add -12345 -0.001 -> -12346 Inexact Rounded -rsux233 add -12345 -0.00001 -> -12346 Inexact Rounded -rsux234 add -12345 -0.000001 -> -12346 Inexact Rounded -rsux235 add -12345 -0.0000001 -> -12346 Inexact Rounded -rsux236 add -12345 0 -> -12345 -rsux237 add -12345 0.0000001 -> -12345 Inexact Rounded -rsux238 add -12345 0.000001 -> -12345 Inexact Rounded -rsux239 add -12345 0.00001 -> -12345 Inexact Rounded -rsux240 add -12345 0.0001 -> -12345 Inexact Rounded -rsux241 add -12345 0.001 -> -12345 Inexact Rounded -rsux242 add -12345 0.01 -> -12345 Inexact Rounded -rsux243 add -12345 0.1 -> -12345 Inexact Rounded - -rsux245 add -12346 0.49999 -> -12346 Inexact Rounded -rsux246 add -12346 0.5 -> -12346 Inexact Rounded -rsux247 add -12346 0.50001 -> -12346 Inexact Rounded - -rsux250 add -12345 0.4 -> -12345 Inexact Rounded -rsux251 add -12345 0.49 -> -12345 Inexact Rounded -rsux252 add -12345 0.499 -> -12345 Inexact Rounded -rsux253 add -12345 0.49999 -> -12345 Inexact Rounded -rsux254 add -12345 0.5 -> -12345 Inexact Rounded -rsux255 add -12345 0.50001 -> -12345 Inexact Rounded -rsux256 add -12345 0.5001 -> -12345 Inexact Rounded -rsux257 add -12345 0.501 -> -12345 Inexact Rounded -rsux258 add -12345 0.51 -> -12345 Inexact Rounded -rsux259 add -12345 0.6 -> -12345 Inexact Rounded - -rounding: floor - -rsux300 add -12345 -0.1 -> -12346 Inexact Rounded -rsux301 add -12345 -0.01 -> -12346 Inexact Rounded -rsux302 add -12345 -0.001 -> -12346 Inexact Rounded -rsux303 add -12345 -0.00001 -> -12346 Inexact Rounded -rsux304 add -12345 -0.000001 -> -12346 Inexact Rounded -rsux305 add -12345 -0.0000001 -> -12346 Inexact Rounded -rsux306 add -12345 0 -> -12345 -rsux307 add -12345 0.0000001 -> -12345 Inexact Rounded -rsux308 add -12345 0.000001 -> -12345 Inexact Rounded -rsux309 add -12345 0.00001 -> -12345 Inexact Rounded -rsux310 add -12345 0.0001 -> -12345 Inexact Rounded -rsux311 add -12345 0.001 -> -12345 Inexact Rounded -rsux312 add -12345 0.01 -> -12345 Inexact Rounded -rsux313 add -12345 0.1 -> -12345 Inexact Rounded - -rsux315 add -12346 0.49999 -> -12346 Inexact Rounded -rsux316 add -12346 0.5 -> -12346 Inexact Rounded -rsux317 add -12346 0.50001 -> -12346 Inexact Rounded - -rsux320 add -12345 0.4 -> -12345 Inexact Rounded -rsux321 add -12345 0.49 -> -12345 Inexact Rounded -rsux322 add -12345 0.499 -> -12345 Inexact Rounded -rsux323 add -12345 0.49999 -> -12345 Inexact Rounded -rsux324 add -12345 0.5 -> -12345 Inexact Rounded -rsux325 add -12345 0.50001 -> -12345 Inexact Rounded -rsux326 add -12345 0.5001 -> -12345 Inexact Rounded -rsux327 add -12345 0.501 -> -12345 Inexact Rounded -rsux328 add -12345 0.51 -> -12345 Inexact Rounded -rsux329 add -12345 0.6 -> -12345 Inexact Rounded - -rounding: ceiling - -rsux330 add -12345 -0.1 -> -12345 Inexact Rounded -rsux331 add -12345 -0.01 -> -12345 Inexact Rounded -rsux332 add -12345 -0.001 -> -12345 Inexact Rounded -rsux333 add -12345 -0.00001 -> -12345 Inexact Rounded -rsux334 add -12345 -0.000001 -> -12345 Inexact Rounded -rsux335 add -12345 -0.0000001 -> -12345 Inexact Rounded -rsux336 add -12345 0 -> -12345 -rsux337 add -12345 0.0000001 -> -12344 Inexact Rounded -rsux338 add -12345 0.000001 -> -12344 Inexact Rounded -rsux339 add -12345 0.00001 -> -12344 Inexact Rounded -rsux340 add -12345 0.0001 -> -12344 Inexact Rounded -rsux341 add -12345 0.001 -> -12344 Inexact Rounded -rsux342 add -12345 0.01 -> -12344 Inexact Rounded -rsux343 add -12345 0.1 -> -12344 Inexact Rounded - -rsux345 add -12346 0.49999 -> -12345 Inexact Rounded -rsux346 add -12346 0.5 -> -12345 Inexact Rounded -rsux347 add -12346 0.50001 -> -12345 Inexact Rounded - -rsux350 add -12345 0.4 -> -12344 Inexact Rounded -rsux351 add -12345 0.49 -> -12344 Inexact Rounded -rsux352 add -12345 0.499 -> -12344 Inexact Rounded -rsux353 add -12345 0.49999 -> -12344 Inexact Rounded -rsux354 add -12345 0.5 -> -12344 Inexact Rounded -rsux355 add -12345 0.50001 -> -12344 Inexact Rounded -rsux356 add -12345 0.5001 -> -12344 Inexact Rounded -rsux357 add -12345 0.501 -> -12344 Inexact Rounded -rsux358 add -12345 0.51 -> -12344 Inexact Rounded -rsux359 add -12345 0.6 -> -12344 Inexact Rounded - --- Check cancellation subtractions --- (The IEEE 854 'curious rule' in $6.3) - -rounding: down -rzex001 add 0 0 -> 0 -rzex002 add 0 -0 -> 0 -rzex003 add -0 0 -> 0 -rzex004 add -0 -0 -> -0 -rzex005 add 1 -1 -> 0 -rzex006 add -1 1 -> 0 -rzex007 add 1.5 -1.5 -> 0.0 -rzex008 add -1.5 1.5 -> 0.0 -rzex009 add 2 -2 -> 0 -rzex010 add -2 2 -> 0 - -rounding: up -rzex011 add 0 0 -> 0 -rzex012 add 0 -0 -> 0 -rzex013 add -0 0 -> 0 -rzex014 add -0 -0 -> -0 -rzex015 add 1 -1 -> 0 -rzex016 add -1 1 -> 0 -rzex017 add 1.5 -1.5 -> 0.0 -rzex018 add -1.5 1.5 -> 0.0 -rzex019 add 2 -2 -> 0 -rzex020 add -2 2 -> 0 - -rounding: half_up -rzex021 add 0 0 -> 0 -rzex022 add 0 -0 -> 0 -rzex023 add -0 0 -> 0 -rzex024 add -0 -0 -> -0 -rzex025 add 1 -1 -> 0 -rzex026 add -1 1 -> 0 -rzex027 add 1.5 -1.5 -> 0.0 -rzex028 add -1.5 1.5 -> 0.0 -rzex029 add 2 -2 -> 0 -rzex030 add -2 2 -> 0 - -rounding: half_down -rzex031 add 0 0 -> 0 -rzex032 add 0 -0 -> 0 -rzex033 add -0 0 -> 0 -rzex034 add -0 -0 -> -0 -rzex035 add 1 -1 -> 0 -rzex036 add -1 1 -> 0 -rzex037 add 1.5 -1.5 -> 0.0 -rzex038 add -1.5 1.5 -> 0.0 -rzex039 add 2 -2 -> 0 -rzex040 add -2 2 -> 0 - -rounding: half_even -rzex041 add 0 0 -> 0 -rzex042 add 0 -0 -> 0 -rzex043 add -0 0 -> 0 -rzex044 add -0 -0 -> -0 -rzex045 add 1 -1 -> 0 -rzex046 add -1 1 -> 0 -rzex047 add 1.5 -1.5 -> 0.0 -rzex048 add -1.5 1.5 -> 0.0 -rzex049 add 2 -2 -> 0 -rzex050 add -2 2 -> 0 - -rounding: floor -rzex051 add 0 0 -> 0 -rzex052 add 0 -0 -> -0 -- here are two 'curious' -rzex053 add -0 0 -> -0 -- -rzex054 add -0 -0 -> -0 -rzex055 add 1 -1 -> -0 -- here are the rest -rzex056 add -1 1 -> -0 -- .. -rzex057 add 1.5 -1.5 -> -0.0 -- .. -rzex058 add -1.5 1.5 -> -0.0 -- .. -rzex059 add 2 -2 -> -0 -- .. -rzex060 add -2 2 -> -0 -- .. - -rounding: ceiling -rzex061 add 0 0 -> 0 -rzex062 add 0 -0 -> 0 -rzex063 add -0 0 -> 0 -rzex064 add -0 -0 -> -0 -rzex065 add 1 -1 -> 0 -rzex066 add -1 1 -> 0 -rzex067 add 1.5 -1.5 -> 0.0 -rzex068 add -1.5 1.5 -> 0.0 -rzex069 add 2 -2 -> 0 -rzex070 add -2 2 -> 0 - - --- Division operators ------------------------------------------------- - -rounding: down -rdvx101 divide 12345 1 -> 12345 -rdvx102 divide 12345 1.0001 -> 12343 Inexact Rounded -rdvx103 divide 12345 1.001 -> 12332 Inexact Rounded -rdvx104 divide 12345 1.01 -> 12222 Inexact Rounded -rdvx105 divide 12345 1.1 -> 11222 Inexact Rounded -rdvx106 divide 12355 4 -> 3088.7 Inexact Rounded -rdvx107 divide 12345 4 -> 3086.2 Inexact Rounded -rdvx108 divide 12355 4.0001 -> 3088.6 Inexact Rounded -rdvx109 divide 12345 4.0001 -> 3086.1 Inexact Rounded -rdvx110 divide 12345 4.9 -> 2519.3 Inexact Rounded -rdvx111 divide 12345 4.99 -> 2473.9 Inexact Rounded -rdvx112 divide 12345 4.999 -> 2469.4 Inexact Rounded -rdvx113 divide 12345 4.9999 -> 2469.0 Inexact Rounded -rdvx114 divide 12345 5 -> 2469 -rdvx115 divide 12345 5.0001 -> 2468.9 Inexact Rounded -rdvx116 divide 12345 5.001 -> 2468.5 Inexact Rounded -rdvx117 divide 12345 5.01 -> 2464.0 Inexact Rounded -rdvx118 divide 12345 5.1 -> 2420.5 Inexact Rounded - -rounding: half_down -rdvx201 divide 12345 1 -> 12345 -rdvx202 divide 12345 1.0001 -> 12344 Inexact Rounded -rdvx203 divide 12345 1.001 -> 12333 Inexact Rounded -rdvx204 divide 12345 1.01 -> 12223 Inexact Rounded -rdvx205 divide 12345 1.1 -> 11223 Inexact Rounded -rdvx206 divide 12355 4 -> 3088.7 Inexact Rounded -rdvx207 divide 12345 4 -> 3086.2 Inexact Rounded -rdvx208 divide 12355 4.0001 -> 3088.7 Inexact Rounded -rdvx209 divide 12345 4.0001 -> 3086.2 Inexact Rounded -rdvx210 divide 12345 4.9 -> 2519.4 Inexact Rounded -rdvx211 divide 12345 4.99 -> 2473.9 Inexact Rounded -rdvx212 divide 12345 4.999 -> 2469.5 Inexact Rounded -rdvx213 divide 12345 4.9999 -> 2469.0 Inexact Rounded -rdvx214 divide 12345 5 -> 2469 -rdvx215 divide 12345 5.0001 -> 2469.0 Inexact Rounded -rdvx216 divide 12345 5.001 -> 2468.5 Inexact Rounded -rdvx217 divide 12345 5.01 -> 2464.1 Inexact Rounded -rdvx218 divide 12345 5.1 -> 2420.6 Inexact Rounded - -rounding: half_even -rdvx301 divide 12345 1 -> 12345 -rdvx302 divide 12345 1.0001 -> 12344 Inexact Rounded -rdvx303 divide 12345 1.001 -> 12333 Inexact Rounded -rdvx304 divide 12345 1.01 -> 12223 Inexact Rounded -rdvx305 divide 12345 1.1 -> 11223 Inexact Rounded -rdvx306 divide 12355 4 -> 3088.8 Inexact Rounded -rdvx307 divide 12345 4 -> 3086.2 Inexact Rounded -rdvx308 divide 12355 4.0001 -> 3088.7 Inexact Rounded -rdvx309 divide 12345 4.0001 -> 3086.2 Inexact Rounded -rdvx310 divide 12345 4.9 -> 2519.4 Inexact Rounded -rdvx311 divide 12345 4.99 -> 2473.9 Inexact Rounded -rdvx312 divide 12345 4.999 -> 2469.5 Inexact Rounded -rdvx313 divide 12345 4.9999 -> 2469.0 Inexact Rounded -rdvx314 divide 12345 5 -> 2469 -rdvx315 divide 12345 5.0001 -> 2469.0 Inexact Rounded -rdvx316 divide 12345 5.001 -> 2468.5 Inexact Rounded -rdvx317 divide 12345 5.01 -> 2464.1 Inexact Rounded -rdvx318 divide 12345 5.1 -> 2420.6 Inexact Rounded - -rounding: half_up -rdvx401 divide 12345 1 -> 12345 -rdvx402 divide 12345 1.0001 -> 12344 Inexact Rounded -rdvx403 divide 12345 1.001 -> 12333 Inexact Rounded -rdvx404 divide 12345 1.01 -> 12223 Inexact Rounded -rdvx405 divide 12345 1.1 -> 11223 Inexact Rounded -rdvx406 divide 12355 4 -> 3088.8 Inexact Rounded -rdvx407 divide 12345 4 -> 3086.3 Inexact Rounded -rdvx408 divide 12355 4.0001 -> 3088.7 Inexact Rounded -rdvx409 divide 12345 4.0001 -> 3086.2 Inexact Rounded -rdvx410 divide 12345 4.9 -> 2519.4 Inexact Rounded -rdvx411 divide 12345 4.99 -> 2473.9 Inexact Rounded -rdvx412 divide 12345 4.999 -> 2469.5 Inexact Rounded -rdvx413 divide 12345 4.9999 -> 2469.0 Inexact Rounded -rdvx414 divide 12345 5 -> 2469 -rdvx415 divide 12345 5.0001 -> 2469.0 Inexact Rounded -rdvx416 divide 12345 5.001 -> 2468.5 Inexact Rounded -rdvx417 divide 12345 5.01 -> 2464.1 Inexact Rounded -rdvx418 divide 12345 5.1 -> 2420.6 Inexact Rounded - -rounding: up -rdvx501 divide 12345 1 -> 12345 -rdvx502 divide 12345 1.0001 -> 12344 Inexact Rounded -rdvx503 divide 12345 1.001 -> 12333 Inexact Rounded -rdvx504 divide 12345 1.01 -> 12223 Inexact Rounded -rdvx505 divide 12345 1.1 -> 11223 Inexact Rounded -rdvx506 divide 12355 4 -> 3088.8 Inexact Rounded -rdvx507 divide 12345 4 -> 3086.3 Inexact Rounded -rdvx508 divide 12355 4.0001 -> 3088.7 Inexact Rounded -rdvx509 divide 12345 4.0001 -> 3086.2 Inexact Rounded -rdvx510 divide 12345 4.9 -> 2519.4 Inexact Rounded -rdvx511 divide 12345 4.99 -> 2474.0 Inexact Rounded -rdvx512 divide 12345 4.999 -> 2469.5 Inexact Rounded -rdvx513 divide 12345 4.9999 -> 2469.1 Inexact Rounded -rdvx514 divide 12345 5 -> 2469 -rdvx515 divide 12345 5.0001 -> 2469.0 Inexact Rounded -rdvx516 divide 12345 5.001 -> 2468.6 Inexact Rounded -rdvx517 divide 12345 5.01 -> 2464.1 Inexact Rounded -rdvx518 divide 12345 5.1 -> 2420.6 Inexact Rounded - -rounding: floor -rdvx601 divide 12345 1 -> 12345 -rdvx602 divide 12345 1.0001 -> 12343 Inexact Rounded -rdvx603 divide 12345 1.001 -> 12332 Inexact Rounded -rdvx604 divide 12345 1.01 -> 12222 Inexact Rounded -rdvx605 divide 12345 1.1 -> 11222 Inexact Rounded -rdvx606 divide 12355 4 -> 3088.7 Inexact Rounded -rdvx607 divide 12345 4 -> 3086.2 Inexact Rounded -rdvx608 divide 12355 4.0001 -> 3088.6 Inexact Rounded -rdvx609 divide 12345 4.0001 -> 3086.1 Inexact Rounded -rdvx610 divide 12345 4.9 -> 2519.3 Inexact Rounded -rdvx611 divide 12345 4.99 -> 2473.9 Inexact Rounded -rdvx612 divide 12345 4.999 -> 2469.4 Inexact Rounded -rdvx613 divide 12345 4.9999 -> 2469.0 Inexact Rounded -rdvx614 divide 12345 5 -> 2469 -rdvx615 divide 12345 5.0001 -> 2468.9 Inexact Rounded -rdvx616 divide 12345 5.001 -> 2468.5 Inexact Rounded -rdvx617 divide 12345 5.01 -> 2464.0 Inexact Rounded -rdvx618 divide 12345 5.1 -> 2420.5 Inexact Rounded - -rounding: ceiling -rdvx701 divide 12345 1 -> 12345 -rdvx702 divide 12345 1.0001 -> 12344 Inexact Rounded -rdvx703 divide 12345 1.001 -> 12333 Inexact Rounded -rdvx704 divide 12345 1.01 -> 12223 Inexact Rounded -rdvx705 divide 12345 1.1 -> 11223 Inexact Rounded -rdvx706 divide 12355 4 -> 3088.8 Inexact Rounded -rdvx707 divide 12345 4 -> 3086.3 Inexact Rounded -rdvx708 divide 12355 4.0001 -> 3088.7 Inexact Rounded -rdvx709 divide 12345 4.0001 -> 3086.2 Inexact Rounded -rdvx710 divide 12345 4.9 -> 2519.4 Inexact Rounded -rdvx711 divide 12345 4.99 -> 2474.0 Inexact Rounded -rdvx712 divide 12345 4.999 -> 2469.5 Inexact Rounded -rdvx713 divide 12345 4.9999 -> 2469.1 Inexact Rounded -rdvx714 divide 12345 5 -> 2469 -rdvx715 divide 12345 5.0001 -> 2469.0 Inexact Rounded -rdvx716 divide 12345 5.001 -> 2468.6 Inexact Rounded -rdvx717 divide 12345 5.01 -> 2464.1 Inexact Rounded -rdvx718 divide 12345 5.1 -> 2420.6 Inexact Rounded - --- [divideInteger and remainder unaffected] - --- Multiplication operator -------------------------------------------- - -rounding: down -rmux101 multiply 12345 1 -> 12345 -rmux102 multiply 12345 1.0001 -> 12346 Inexact Rounded -rmux103 multiply 12345 1.001 -> 12357 Inexact Rounded -rmux104 multiply 12345 1.01 -> 12468 Inexact Rounded -rmux105 multiply 12345 1.1 -> 13579 Inexact Rounded -rmux106 multiply 12345 4 -> 49380 -rmux107 multiply 12345 4.0001 -> 49381 Inexact Rounded -rmux108 multiply 12345 4.9 -> 60490 Inexact Rounded -rmux109 multiply 12345 4.99 -> 61601 Inexact Rounded -rmux110 multiply 12345 4.999 -> 61712 Inexact Rounded -rmux111 multiply 12345 4.9999 -> 61723 Inexact Rounded -rmux112 multiply 12345 5 -> 61725 -rmux113 multiply 12345 5.0001 -> 61726 Inexact Rounded -rmux114 multiply 12345 5.001 -> 61737 Inexact Rounded -rmux115 multiply 12345 5.01 -> 61848 Inexact Rounded -rmux116 multiply 12345 12 -> 1.4814E+5 Rounded -rmux117 multiply 12345 13 -> 1.6048E+5 Inexact Rounded -rmux118 multiply 12355 12 -> 1.4826E+5 Rounded -rmux119 multiply 12355 13 -> 1.6061E+5 Inexact Rounded - -rounding: half_down -rmux201 multiply 12345 1 -> 12345 -rmux202 multiply 12345 1.0001 -> 12346 Inexact Rounded -rmux203 multiply 12345 1.001 -> 12357 Inexact Rounded -rmux204 multiply 12345 1.01 -> 12468 Inexact Rounded -rmux205 multiply 12345 1.1 -> 13579 Inexact Rounded -rmux206 multiply 12345 4 -> 49380 -rmux207 multiply 12345 4.0001 -> 49381 Inexact Rounded -rmux208 multiply 12345 4.9 -> 60490 Inexact Rounded -rmux209 multiply 12345 4.99 -> 61602 Inexact Rounded -rmux210 multiply 12345 4.999 -> 61713 Inexact Rounded -rmux211 multiply 12345 4.9999 -> 61724 Inexact Rounded -rmux212 multiply 12345 5 -> 61725 -rmux213 multiply 12345 5.0001 -> 61726 Inexact Rounded -rmux214 multiply 12345 5.001 -> 61737 Inexact Rounded -rmux215 multiply 12345 5.01 -> 61848 Inexact Rounded -rmux216 multiply 12345 12 -> 1.4814E+5 Rounded -rmux217 multiply 12345 13 -> 1.6048E+5 Inexact Rounded -rmux218 multiply 12355 12 -> 1.4826E+5 Rounded -rmux219 multiply 12355 13 -> 1.6061E+5 Inexact Rounded - -rounding: half_even -rmux301 multiply 12345 1 -> 12345 -rmux302 multiply 12345 1.0001 -> 12346 Inexact Rounded -rmux303 multiply 12345 1.001 -> 12357 Inexact Rounded -rmux304 multiply 12345 1.01 -> 12468 Inexact Rounded -rmux305 multiply 12345 1.1 -> 13580 Inexact Rounded -rmux306 multiply 12345 4 -> 49380 -rmux307 multiply 12345 4.0001 -> 49381 Inexact Rounded -rmux308 multiply 12345 4.9 -> 60490 Inexact Rounded -rmux309 multiply 12345 4.99 -> 61602 Inexact Rounded -rmux310 multiply 12345 4.999 -> 61713 Inexact Rounded -rmux311 multiply 12345 4.9999 -> 61724 Inexact Rounded -rmux312 multiply 12345 5 -> 61725 -rmux313 multiply 12345 5.0001 -> 61726 Inexact Rounded -rmux314 multiply 12345 5.001 -> 61737 Inexact Rounded -rmux315 multiply 12345 5.01 -> 61848 Inexact Rounded -rmux316 multiply 12345 12 -> 1.4814E+5 Rounded -rmux317 multiply 12345 13 -> 1.6048E+5 Inexact Rounded -rmux318 multiply 12355 12 -> 1.4826E+5 Rounded -rmux319 multiply 12355 13 -> 1.6062E+5 Inexact Rounded - -rounding: half_up -rmux401 multiply 12345 1 -> 12345 -rmux402 multiply 12345 1.0001 -> 12346 Inexact Rounded -rmux403 multiply 12345 1.001 -> 12357 Inexact Rounded -rmux404 multiply 12345 1.01 -> 12468 Inexact Rounded -rmux405 multiply 12345 1.1 -> 13580 Inexact Rounded -rmux406 multiply 12345 4 -> 49380 -rmux407 multiply 12345 4.0001 -> 49381 Inexact Rounded -rmux408 multiply 12345 4.9 -> 60491 Inexact Rounded -rmux409 multiply 12345 4.99 -> 61602 Inexact Rounded -rmux410 multiply 12345 4.999 -> 61713 Inexact Rounded -rmux411 multiply 12345 4.9999 -> 61724 Inexact Rounded -rmux412 multiply 12345 5 -> 61725 -rmux413 multiply 12345 5.0001 -> 61726 Inexact Rounded -rmux414 multiply 12345 5.001 -> 61737 Inexact Rounded -rmux415 multiply 12345 5.01 -> 61848 Inexact Rounded -rmux416 multiply 12345 12 -> 1.4814E+5 Rounded -rmux417 multiply 12345 13 -> 1.6049E+5 Inexact Rounded -rmux418 multiply 12355 12 -> 1.4826E+5 Rounded -rmux419 multiply 12355 13 -> 1.6062E+5 Inexact Rounded - -rounding: up -rmux501 multiply 12345 1 -> 12345 -rmux502 multiply 12345 1.0001 -> 12347 Inexact Rounded -rmux503 multiply 12345 1.001 -> 12358 Inexact Rounded -rmux504 multiply 12345 1.01 -> 12469 Inexact Rounded -rmux505 multiply 12345 1.1 -> 13580 Inexact Rounded -rmux506 multiply 12345 4 -> 49380 -rmux507 multiply 12345 4.0001 -> 49382 Inexact Rounded -rmux508 multiply 12345 4.9 -> 60491 Inexact Rounded -rmux509 multiply 12345 4.99 -> 61602 Inexact Rounded -rmux510 multiply 12345 4.999 -> 61713 Inexact Rounded -rmux511 multiply 12345 4.9999 -> 61724 Inexact Rounded -rmux512 multiply 12345 5 -> 61725 -rmux513 multiply 12345 5.0001 -> 61727 Inexact Rounded -rmux514 multiply 12345 5.001 -> 61738 Inexact Rounded -rmux515 multiply 12345 5.01 -> 61849 Inexact Rounded -rmux516 multiply 12345 12 -> 1.4814E+5 Rounded -rmux517 multiply 12345 13 -> 1.6049E+5 Inexact Rounded -rmux518 multiply 12355 12 -> 1.4826E+5 Rounded -rmux519 multiply 12355 13 -> 1.6062E+5 Inexact Rounded --- [rmux516 & rmux518] can surprise - -rounding: floor -rmux601 multiply 12345 1 -> 12345 -rmux602 multiply 12345 1.0001 -> 12346 Inexact Rounded -rmux603 multiply 12345 1.001 -> 12357 Inexact Rounded -rmux604 multiply 12345 1.01 -> 12468 Inexact Rounded -rmux605 multiply 12345 1.1 -> 13579 Inexact Rounded -rmux606 multiply 12345 4 -> 49380 -rmux607 multiply 12345 4.0001 -> 49381 Inexact Rounded -rmux608 multiply 12345 4.9 -> 60490 Inexact Rounded -rmux609 multiply 12345 4.99 -> 61601 Inexact Rounded -rmux610 multiply 12345 4.999 -> 61712 Inexact Rounded -rmux611 multiply 12345 4.9999 -> 61723 Inexact Rounded -rmux612 multiply 12345 5 -> 61725 -rmux613 multiply 12345 5.0001 -> 61726 Inexact Rounded -rmux614 multiply 12345 5.001 -> 61737 Inexact Rounded -rmux615 multiply 12345 5.01 -> 61848 Inexact Rounded -rmux616 multiply 12345 12 -> 1.4814E+5 Rounded -rmux617 multiply 12345 13 -> 1.6048E+5 Inexact Rounded -rmux618 multiply 12355 12 -> 1.4826E+5 Rounded -rmux619 multiply 12355 13 -> 1.6061E+5 Inexact Rounded - -rounding: ceiling -rmux701 multiply 12345 1 -> 12345 -rmux702 multiply 12345 1.0001 -> 12347 Inexact Rounded -rmux703 multiply 12345 1.001 -> 12358 Inexact Rounded -rmux704 multiply 12345 1.01 -> 12469 Inexact Rounded -rmux705 multiply 12345 1.1 -> 13580 Inexact Rounded -rmux706 multiply 12345 4 -> 49380 -rmux707 multiply 12345 4.0001 -> 49382 Inexact Rounded -rmux708 multiply 12345 4.9 -> 60491 Inexact Rounded -rmux709 multiply 12345 4.99 -> 61602 Inexact Rounded -rmux710 multiply 12345 4.999 -> 61713 Inexact Rounded -rmux711 multiply 12345 4.9999 -> 61724 Inexact Rounded -rmux712 multiply 12345 5 -> 61725 -rmux713 multiply 12345 5.0001 -> 61727 Inexact Rounded -rmux714 multiply 12345 5.001 -> 61738 Inexact Rounded -rmux715 multiply 12345 5.01 -> 61849 Inexact Rounded -rmux716 multiply 12345 12 -> 1.4814E+5 Rounded -rmux717 multiply 12345 13 -> 1.6049E+5 Inexact Rounded -rmux718 multiply 12355 12 -> 1.4826E+5 Rounded -rmux719 multiply 12355 13 -> 1.6062E+5 Inexact Rounded - --- Power operator ----------------------------------------------------- - -rounding: down -rpox101 power 12345 -5 -> 3.4877E-21 Inexact Rounded -rpox102 power 12345 -4 -> 4.3056E-17 Inexact Rounded -rpox103 power 12345 -3 -> 5.3152E-13 Inexact Rounded -rpox104 power 12345 -2 -> 6.5617E-9 Inexact Rounded -rpox105 power 12345 -1 -> 0.000081004 Inexact Rounded -rpox106 power 12345 0 -> 1 -rpox107 power 12345 1 -> 12345 -rpox108 power 12345 2 -> 1.5239E+8 Inexact Rounded -rpox109 power 12345 3 -> 1.8813E+12 Inexact Rounded -rpox110 power 12345 4 -> 2.3225E+16 Inexact Rounded -rpox111 power 12345 5 -> 2.8671E+20 Inexact Rounded -rpox112 power 415 2 -> 1.7222E+5 Inexact Rounded -rpox113 power 75 3 -> 4.2187E+5 Inexact Rounded - -rounding: half_down -rpox201 power 12345 -5 -> 3.4877E-21 Inexact Rounded -rpox202 power 12345 -4 -> 4.3056E-17 Inexact Rounded -rpox203 power 12345 -3 -> 5.3153E-13 Inexact Rounded -rpox204 power 12345 -2 -> 6.5617E-9 Inexact Rounded -rpox205 power 12345 -1 -> 0.000081004 Inexact Rounded -rpox206 power 12345 0 -> 1 -rpox207 power 12345 1 -> 12345 -rpox208 power 12345 2 -> 1.5240E+8 Inexact Rounded -rpox209 power 12345 3 -> 1.8814E+12 Inexact Rounded -rpox210 power 12345 4 -> 2.3225E+16 Inexact Rounded -rpox211 power 12345 5 -> 2.8672E+20 Inexact Rounded -rpox212 power 415 2 -> 1.7222E+5 Inexact Rounded -rpox213 power 75 3 -> 4.2187E+5 Inexact Rounded - -rounding: half_even -rpox301 power 12345 -5 -> 3.4877E-21 Inexact Rounded -rpox302 power 12345 -4 -> 4.3056E-17 Inexact Rounded -rpox303 power 12345 -3 -> 5.3153E-13 Inexact Rounded -rpox304 power 12345 -2 -> 6.5617E-9 Inexact Rounded -rpox305 power 12345 -1 -> 0.000081004 Inexact Rounded -rpox306 power 12345 0 -> 1 -rpox307 power 12345 1 -> 12345 -rpox308 power 12345 2 -> 1.5240E+8 Inexact Rounded -rpox309 power 12345 3 -> 1.8814E+12 Inexact Rounded -rpox310 power 12345 4 -> 2.3225E+16 Inexact Rounded -rpox311 power 12345 5 -> 2.8672E+20 Inexact Rounded -rpox312 power 415 2 -> 1.7222E+5 Inexact Rounded -rpox313 power 75 3 -> 4.2188E+5 Inexact Rounded - -rounding: half_up -rpox401 power 12345 -5 -> 3.4877E-21 Inexact Rounded -rpox402 power 12345 -4 -> 4.3056E-17 Inexact Rounded -rpox403 power 12345 -3 -> 5.3153E-13 Inexact Rounded -rpox404 power 12345 -2 -> 6.5617E-9 Inexact Rounded -rpox405 power 12345 -1 -> 0.000081004 Inexact Rounded -rpox406 power 12345 0 -> 1 -rpox407 power 12345 1 -> 12345 -rpox408 power 12345 2 -> 1.5240E+8 Inexact Rounded -rpox409 power 12345 3 -> 1.8814E+12 Inexact Rounded -rpox410 power 12345 4 -> 2.3225E+16 Inexact Rounded -rpox411 power 12345 5 -> 2.8672E+20 Inexact Rounded -rpox412 power 415 2 -> 1.7223E+5 Inexact Rounded -rpox413 power 75 3 -> 4.2188E+5 Inexact Rounded - -rounding: up -rpox501 power 12345 -5 -> 3.4878E-21 Inexact Rounded -rpox502 power 12345 -4 -> 4.3057E-17 Inexact Rounded -rpox503 power 12345 -3 -> 5.3153E-13 Inexact Rounded -rpox504 power 12345 -2 -> 6.5618E-9 Inexact Rounded -rpox505 power 12345 -1 -> 0.000081005 Inexact Rounded -rpox506 power 12345 0 -> 1 -rpox507 power 12345 1 -> 12345 -rpox508 power 12345 2 -> 1.5240E+8 Inexact Rounded -rpox509 power 12345 3 -> 1.8814E+12 Inexact Rounded -rpox510 power 12345 4 -> 2.3226E+16 Inexact Rounded -rpox511 power 12345 5 -> 2.8672E+20 Inexact Rounded -rpox512 power 415 2 -> 1.7223E+5 Inexact Rounded -rpox513 power 75 3 -> 4.2188E+5 Inexact Rounded - -rounding: floor -rpox601 power 12345 -5 -> 3.4877E-21 Inexact Rounded -rpox602 power 12345 -4 -> 4.3056E-17 Inexact Rounded -rpox603 power 12345 -3 -> 5.3152E-13 Inexact Rounded -rpox604 power 12345 -2 -> 6.5617E-9 Inexact Rounded -rpox605 power 12345 -1 -> 0.000081004 Inexact Rounded -rpox606 power 12345 0 -> 1 -rpox607 power 12345 1 -> 12345 -rpox608 power 12345 2 -> 1.5239E+8 Inexact Rounded -rpox609 power 12345 3 -> 1.8813E+12 Inexact Rounded -rpox610 power 12345 4 -> 2.3225E+16 Inexact Rounded -rpox611 power 12345 5 -> 2.8671E+20 Inexact Rounded -rpox612 power 415 2 -> 1.7222E+5 Inexact Rounded -rpox613 power 75 3 -> 4.2187E+5 Inexact Rounded - -rounding: ceiling -rpox701 power 12345 -5 -> 3.4878E-21 Inexact Rounded -rpox702 power 12345 -4 -> 4.3057E-17 Inexact Rounded -rpox703 power 12345 -3 -> 5.3153E-13 Inexact Rounded -rpox704 power 12345 -2 -> 6.5618E-9 Inexact Rounded -rpox705 power 12345 -1 -> 0.000081005 Inexact Rounded -rpox706 power 12345 0 -> 1 -rpox707 power 12345 1 -> 12345 -rpox708 power 12345 2 -> 1.5240E+8 Inexact Rounded -rpox709 power 12345 3 -> 1.8814E+12 Inexact Rounded -rpox710 power 12345 4 -> 2.3226E+16 Inexact Rounded -rpox711 power 12345 5 -> 2.8672E+20 Inexact Rounded -rpox712 power 415 2 -> 1.7223E+5 Inexact Rounded -rpox713 power 75 3 -> 4.2188E+5 Inexact Rounded - --- Underflow Subnormal and overflow values vary with rounding mode and sign -maxexponent: 999999999 -minexponent: -999999999 -rounding: down -rovx100 multiply 10 9E+999999999 -> 9.9999E+999999999 Overflow Inexact Rounded -rovx101 multiply -10 9E+999999999 -> -9.9999E+999999999 Overflow Inexact Rounded -rovx102 divide 1E-9 9E+999999999 -> 0E-1000000003 Underflow Subnormal Inexact Rounded -rovx104 divide -1E-9 9E+999999999 -> -0E-1000000003 Underflow Subnormal Inexact Rounded - -rounding: up -rovx110 multiply 10 9E+999999999 -> Infinity Overflow Inexact Rounded -rovx111 multiply -10 9E+999999999 -> -Infinity Overflow Inexact Rounded -rovx112 divide 1E-9 9E+999999999 -> 1E-1000000003 Underflow Subnormal Inexact Rounded -rovx114 divide -1E-9 9E+999999999 -> -1E-1000000003 Underflow Subnormal Inexact Rounded - -rounding: ceiling -rovx120 multiply 10 9E+999999999 -> Infinity Overflow Inexact Rounded -rovx121 multiply -10 9E+999999999 -> -9.9999E+999999999 Overflow Inexact Rounded -rovx122 divide 1E-9 9E+999999999 -> 1E-1000000003 Underflow Subnormal Inexact Rounded -rovx124 divide -1E-9 9E+999999999 -> -0E-1000000003 Underflow Subnormal Inexact Rounded - -rounding: floor -rovx130 multiply 10 9E+999999999 -> 9.9999E+999999999 Overflow Inexact Rounded -rovx131 multiply -10 9E+999999999 -> -Infinity Overflow Inexact Rounded -rovx132 divide 1E-9 9E+999999999 -> 0E-1000000003 Underflow Subnormal Inexact Rounded -rovx134 divide -1E-9 9E+999999999 -> -1E-1000000003 Underflow Subnormal Inexact Rounded - -rounding: half_up -rovx140 multiply 10 9E+999999999 -> Infinity Overflow Inexact Rounded -rovx141 multiply -10 9E+999999999 -> -Infinity Overflow Inexact Rounded -rovx142 divide 1E-9 9E+999999999 -> 0E-1000000003 Underflow Subnormal Inexact Rounded -rovx144 divide -1E-9 9E+999999999 -> -0E-1000000003 Underflow Subnormal Inexact Rounded - -rounding: half_even -rovx150 multiply 10 9E+999999999 -> Infinity Overflow Inexact Rounded -rovx151 multiply -10 9E+999999999 -> -Infinity Overflow Inexact Rounded -rovx152 divide 1E-9 9E+999999999 -> 0E-1000000003 Underflow Subnormal Inexact Rounded -rovx154 divide -1E-9 9E+999999999 -> -0E-1000000003 Underflow Subnormal Inexact Rounded - -rounding: half_down -rovx160 multiply 10 9E+999999999 -> Infinity Overflow Inexact Rounded -rovx161 multiply -10 9E+999999999 -> -Infinity Overflow Inexact Rounded -rovx162 divide 1E-9 9E+999999999 -> 0E-1000000003 Underflow Subnormal Inexact Rounded -rovx164 divide -1E-9 9E+999999999 -> -0E-1000000003 Underflow Subnormal Inexact Rounded - --- check maximum finite value over a range of precisions -rounding: down -precision: 1 -rovx200 multiply 10 9E+999999999 -> 9E+999999999 Overflow Inexact Rounded -rovx201 multiply -10 9E+999999999 -> -9E+999999999 Overflow Inexact Rounded -precision: 2 -rovx210 multiply 10 9E+999999999 -> 9.9E+999999999 Overflow Inexact Rounded -rovx211 multiply -10 9E+999999999 -> -9.9E+999999999 Overflow Inexact Rounded -precision: 3 -rovx220 multiply 10 9E+999999999 -> 9.99E+999999999 Overflow Inexact Rounded -rovx221 multiply -10 9E+999999999 -> -9.99E+999999999 Overflow Inexact Rounded -precision: 4 -rovx230 multiply 10 9E+999999999 -> 9.999E+999999999 Overflow Inexact Rounded -rovx231 multiply -10 9E+999999999 -> -9.999E+999999999 Overflow Inexact Rounded -precision: 5 -rovx240 multiply 10 9E+999999999 -> 9.9999E+999999999 Overflow Inexact Rounded -rovx241 multiply -10 9E+999999999 -> -9.9999E+999999999 Overflow Inexact Rounded -precision: 6 -rovx250 multiply 10 9E+999999999 -> 9.99999E+999999999 Overflow Inexact Rounded -rovx251 multiply -10 9E+999999999 -> -9.99999E+999999999 Overflow Inexact Rounded -precision: 7 -rovx260 multiply 10 9E+999999999 -> 9.999999E+999999999 Overflow Inexact Rounded -rovx261 multiply -10 9E+999999999 -> -9.999999E+999999999 Overflow Inexact Rounded -precision: 8 -rovx270 multiply 10 9E+999999999 -> 9.9999999E+999999999 Overflow Inexact Rounded -rovx271 multiply -10 9E+999999999 -> -9.9999999E+999999999 Overflow Inexact Rounded -precision: 9 -rovx280 multiply 10 9E+999999999 -> 9.99999999E+999999999 Overflow Inexact Rounded -rovx281 multiply -10 9E+999999999 -> -9.99999999E+999999999 Overflow Inexact Rounded -precision: 10 -rovx290 multiply 10 9E+999999999 -> 9.999999999E+999999999 Overflow Inexact Rounded -rovx291 multiply -10 9E+999999999 -> -9.999999999E+999999999 Overflow Inexact Rounded - --- reprise rounding mode effect (using multiplies so precision directive used) -precision: 9 -maxexponent: 999999999 -rounding: half_up -rmex400 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded -rmex401 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded -rounding: half_down -rmex402 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded -rmex403 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded -rounding: half_even -rmex404 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded -rmex405 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded -rounding: floor -rmex406 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded -rmex407 multiply 9.999E+999999999 10 -> 9.99999999E+999999999 Overflow Inexact Rounded -rounding: ceiling -rmex408 multiply -9.999E+999999999 10 -> -9.99999999E+999999999 Overflow Inexact Rounded -rmex409 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded -rounding: up -rmex410 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded -rmex411 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded -rounding: down -rmex412 multiply -9.999E+999999999 10 -> -9.99999999E+999999999 Overflow Inexact Rounded -rmex413 multiply 9.999E+999999999 10 -> 9.99999999E+999999999 Overflow Inexact Rounded - diff --git a/sys/lib/python/test/decimaltestdata/samequantum.decTest b/sys/lib/python/test/decimaltestdata/samequantum.decTest deleted file mode 100644 index bdea00080..000000000 --- a/sys/lib/python/test/decimaltestdata/samequantum.decTest +++ /dev/null @@ -1,353 +0,0 @@ ------------------------------------------------------------------------- --- samequantum.decTest -- check quantums match -- --- Copyright (c) IBM Corporation, 2001, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 999 -minExponent: -999 - -samq001 samequantum 0 0 -> 1 -samq002 samequantum 0 1 -> 1 -samq003 samequantum 1 0 -> 1 -samq004 samequantum 1 1 -> 1 - -samq011 samequantum 10 1E+1 -> 0 -samq012 samequantum 10E+1 10E+1 -> 1 -samq013 samequantum 100 10E+1 -> 0 -samq014 samequantum 100 1E+2 -> 0 -samq015 samequantum 0.1 1E-2 -> 0 -samq016 samequantum 0.1 1E-1 -> 1 -samq017 samequantum 0.1 1E-0 -> 0 -samq018 samequantum 999 999 -> 1 -samq019 samequantum 999E-1 99.9 -> 1 -samq020 samequantum 111E-1 22.2 -> 1 -samq021 samequantum 111E-1 1234.2 -> 1 - --- zeros -samq030 samequantum 0.0 1.1 -> 1 -samq031 samequantum 0.0 1.11 -> 0 -samq032 samequantum 0.0 0 -> 0 -samq033 samequantum 0.0 0.0 -> 1 -samq034 samequantum 0.0 0.00 -> 0 -samq035 samequantum 0E+1 0E+0 -> 0 -samq036 samequantum 0E+1 0E+1 -> 1 -samq037 samequantum 0E+1 0E+2 -> 0 -samq038 samequantum 0E-17 0E-16 -> 0 -samq039 samequantum 0E-17 0E-17 -> 1 -samq040 samequantum 0E-17 0E-18 -> 0 -samq041 samequantum 0E-17 0.0E-15 -> 0 -samq042 samequantum 0E-17 0.0E-16 -> 1 -samq043 samequantum 0E-17 0.0E-17 -> 0 -samq044 samequantum -0E-17 0.0E-16 -> 1 -samq045 samequantum 0E-17 -0.0E-17 -> 0 -samq046 samequantum 0E-17 -0.0E-16 -> 1 -samq047 samequantum -0E-17 0.0E-17 -> 0 -samq048 samequantum -0E-17 -0.0E-16 -> 1 -samq049 samequantum -0E-17 -0.0E-17 -> 0 - --- specials & combinations - -samq0110 samequantum -Inf -Inf -> 1 -samq0111 samequantum -Inf Inf -> 1 -samq0112 samequantum -Inf NaN -> 0 -samq0113 samequantum -Inf -7E+3 -> 0 -samq0114 samequantum -Inf -7 -> 0 -samq0115 samequantum -Inf -7E-3 -> 0 -samq0116 samequantum -Inf -0E-3 -> 0 -samq0117 samequantum -Inf -0 -> 0 -samq0118 samequantum -Inf -0E+3 -> 0 -samq0119 samequantum -Inf 0E-3 -> 0 -samq0120 samequantum -Inf 0 -> 0 -samq0121 samequantum -Inf 0E+3 -> 0 -samq0122 samequantum -Inf 7E-3 -> 0 -samq0123 samequantum -Inf 7 -> 0 -samq0124 samequantum -Inf 7E+3 -> 0 -samq0125 samequantum -Inf sNaN -> 0 - -samq0210 samequantum Inf -Inf -> 1 -samq0211 samequantum Inf Inf -> 1 -samq0212 samequantum Inf NaN -> 0 -samq0213 samequantum Inf -7E+3 -> 0 -samq0214 samequantum Inf -7 -> 0 -samq0215 samequantum Inf -7E-3 -> 0 -samq0216 samequantum Inf -0E-3 -> 0 -samq0217 samequantum Inf -0 -> 0 -samq0218 samequantum Inf -0E+3 -> 0 -samq0219 samequantum Inf 0E-3 -> 0 -samq0220 samequantum Inf 0 -> 0 -samq0221 samequantum Inf 0E+3 -> 0 -samq0222 samequantum Inf 7E-3 -> 0 -samq0223 samequantum Inf 7 -> 0 -samq0224 samequantum Inf 7E+3 -> 0 -samq0225 samequantum Inf sNaN -> 0 - -samq0310 samequantum NaN -Inf -> 0 -samq0311 samequantum NaN Inf -> 0 -samq0312 samequantum NaN NaN -> 1 -samq0313 samequantum NaN -7E+3 -> 0 -samq0314 samequantum NaN -7 -> 0 -samq0315 samequantum NaN -7E-3 -> 0 -samq0316 samequantum NaN -0E-3 -> 0 -samq0317 samequantum NaN -0 -> 0 -samq0318 samequantum NaN -0E+3 -> 0 -samq0319 samequantum NaN 0E-3 -> 0 -samq0320 samequantum NaN 0 -> 0 -samq0321 samequantum NaN 0E+3 -> 0 -samq0322 samequantum NaN 7E-3 -> 0 -samq0323 samequantum NaN 7 -> 0 -samq0324 samequantum NaN 7E+3 -> 0 -samq0325 samequantum NaN sNaN -> 1 - -samq0410 samequantum -7E+3 -Inf -> 0 -samq0411 samequantum -7E+3 Inf -> 0 -samq0412 samequantum -7E+3 NaN -> 0 -samq0413 samequantum -7E+3 -7E+3 -> 1 -samq0414 samequantum -7E+3 -7 -> 0 -samq0415 samequantum -7E+3 -7E-3 -> 0 -samq0416 samequantum -7E+3 -0E-3 -> 0 -samq0417 samequantum -7E+3 -0 -> 0 -samq0418 samequantum -7E+3 -0E+3 -> 1 -samq0419 samequantum -7E+3 0E-3 -> 0 -samq0420 samequantum -7E+3 0 -> 0 -samq0421 samequantum -7E+3 0E+3 -> 1 -samq0422 samequantum -7E+3 7E-3 -> 0 -samq0423 samequantum -7E+3 7 -> 0 -samq0424 samequantum -7E+3 7E+3 -> 1 -samq0425 samequantum -7E+3 sNaN -> 0 - -samq0510 samequantum -7 -Inf -> 0 -samq0511 samequantum -7 Inf -> 0 -samq0512 samequantum -7 NaN -> 0 -samq0513 samequantum -7 -7E+3 -> 0 -samq0514 samequantum -7 -7 -> 1 -samq0515 samequantum -7 -7E-3 -> 0 -samq0516 samequantum -7 -0E-3 -> 0 -samq0517 samequantum -7 -0 -> 1 -samq0518 samequantum -7 -0E+3 -> 0 -samq0519 samequantum -7 0E-3 -> 0 -samq0520 samequantum -7 0 -> 1 -samq0521 samequantum -7 0E+3 -> 0 -samq0522 samequantum -7 7E-3 -> 0 -samq0523 samequantum -7 7 -> 1 -samq0524 samequantum -7 7E+3 -> 0 -samq0525 samequantum -7 sNaN -> 0 - -samq0610 samequantum -7E-3 -Inf -> 0 -samq0611 samequantum -7E-3 Inf -> 0 -samq0612 samequantum -7E-3 NaN -> 0 -samq0613 samequantum -7E-3 -7E+3 -> 0 -samq0614 samequantum -7E-3 -7 -> 0 -samq0615 samequantum -7E-3 -7E-3 -> 1 -samq0616 samequantum -7E-3 -0E-3 -> 1 -samq0617 samequantum -7E-3 -0 -> 0 -samq0618 samequantum -7E-3 -0E+3 -> 0 -samq0619 samequantum -7E-3 0E-3 -> 1 -samq0620 samequantum -7E-3 0 -> 0 -samq0621 samequantum -7E-3 0E+3 -> 0 -samq0622 samequantum -7E-3 7E-3 -> 1 -samq0623 samequantum -7E-3 7 -> 0 -samq0624 samequantum -7E-3 7E+3 -> 0 -samq0625 samequantum -7E-3 sNaN -> 0 - -samq0710 samequantum -0E-3 -Inf -> 0 -samq0711 samequantum -0E-3 Inf -> 0 -samq0712 samequantum -0E-3 NaN -> 0 -samq0713 samequantum -0E-3 -7E+3 -> 0 -samq0714 samequantum -0E-3 -7 -> 0 -samq0715 samequantum -0E-3 -7E-3 -> 1 -samq0716 samequantum -0E-3 -0E-3 -> 1 -samq0717 samequantum -0E-3 -0 -> 0 -samq0718 samequantum -0E-3 -0E+3 -> 0 -samq0719 samequantum -0E-3 0E-3 -> 1 -samq0720 samequantum -0E-3 0 -> 0 -samq0721 samequantum -0E-3 0E+3 -> 0 -samq0722 samequantum -0E-3 7E-3 -> 1 -samq0723 samequantum -0E-3 7 -> 0 -samq0724 samequantum -0E-3 7E+3 -> 0 -samq0725 samequantum -0E-3 sNaN -> 0 - -samq0810 samequantum -0 -Inf -> 0 -samq0811 samequantum -0 Inf -> 0 -samq0812 samequantum -0 NaN -> 0 -samq0813 samequantum -0 -7E+3 -> 0 -samq0814 samequantum -0 -7 -> 1 -samq0815 samequantum -0 -7E-3 -> 0 -samq0816 samequantum -0 -0E-3 -> 0 -samq0817 samequantum -0 -0 -> 1 -samq0818 samequantum -0 -0E+3 -> 0 -samq0819 samequantum -0 0E-3 -> 0 -samq0820 samequantum -0 0 -> 1 -samq0821 samequantum -0 0E+3 -> 0 -samq0822 samequantum -0 7E-3 -> 0 -samq0823 samequantum -0 7 -> 1 -samq0824 samequantum -0 7E+3 -> 0 -samq0825 samequantum -0 sNaN -> 0 - -samq0910 samequantum -0E+3 -Inf -> 0 -samq0911 samequantum -0E+3 Inf -> 0 -samq0912 samequantum -0E+3 NaN -> 0 -samq0913 samequantum -0E+3 -7E+3 -> 1 -samq0914 samequantum -0E+3 -7 -> 0 -samq0915 samequantum -0E+3 -7E-3 -> 0 -samq0916 samequantum -0E+3 -0E-3 -> 0 -samq0917 samequantum -0E+3 -0 -> 0 -samq0918 samequantum -0E+3 -0E+3 -> 1 -samq0919 samequantum -0E+3 0E-3 -> 0 -samq0920 samequantum -0E+3 0 -> 0 -samq0921 samequantum -0E+3 0E+3 -> 1 -samq0922 samequantum -0E+3 7E-3 -> 0 -samq0923 samequantum -0E+3 7 -> 0 -samq0924 samequantum -0E+3 7E+3 -> 1 -samq0925 samequantum -0E+3 sNaN -> 0 - -samq1110 samequantum 0E-3 -Inf -> 0 -samq1111 samequantum 0E-3 Inf -> 0 -samq1112 samequantum 0E-3 NaN -> 0 -samq1113 samequantum 0E-3 -7E+3 -> 0 -samq1114 samequantum 0E-3 -7 -> 0 -samq1115 samequantum 0E-3 -7E-3 -> 1 -samq1116 samequantum 0E-3 -0E-3 -> 1 -samq1117 samequantum 0E-3 -0 -> 0 -samq1118 samequantum 0E-3 -0E+3 -> 0 -samq1119 samequantum 0E-3 0E-3 -> 1 -samq1120 samequantum 0E-3 0 -> 0 -samq1121 samequantum 0E-3 0E+3 -> 0 -samq1122 samequantum 0E-3 7E-3 -> 1 -samq1123 samequantum 0E-3 7 -> 0 -samq1124 samequantum 0E-3 7E+3 -> 0 -samq1125 samequantum 0E-3 sNaN -> 0 - -samq1210 samequantum 0 -Inf -> 0 -samq1211 samequantum 0 Inf -> 0 -samq1212 samequantum 0 NaN -> 0 -samq1213 samequantum 0 -7E+3 -> 0 -samq1214 samequantum 0 -7 -> 1 -samq1215 samequantum 0 -7E-3 -> 0 -samq1216 samequantum 0 -0E-3 -> 0 -samq1217 samequantum 0 -0 -> 1 -samq1218 samequantum 0 -0E+3 -> 0 -samq1219 samequantum 0 0E-3 -> 0 -samq1220 samequantum 0 0 -> 1 -samq1221 samequantum 0 0E+3 -> 0 -samq1222 samequantum 0 7E-3 -> 0 -samq1223 samequantum 0 7 -> 1 -samq1224 samequantum 0 7E+3 -> 0 -samq1225 samequantum 0 sNaN -> 0 - -samq1310 samequantum 0E+3 -Inf -> 0 -samq1311 samequantum 0E+3 Inf -> 0 -samq1312 samequantum 0E+3 NaN -> 0 -samq1313 samequantum 0E+3 -7E+3 -> 1 -samq1314 samequantum 0E+3 -7 -> 0 -samq1315 samequantum 0E+3 -7E-3 -> 0 -samq1316 samequantum 0E+3 -0E-3 -> 0 -samq1317 samequantum 0E+3 -0 -> 0 -samq1318 samequantum 0E+3 -0E+3 -> 1 -samq1319 samequantum 0E+3 0E-3 -> 0 -samq1320 samequantum 0E+3 0 -> 0 -samq1321 samequantum 0E+3 0E+3 -> 1 -samq1322 samequantum 0E+3 7E-3 -> 0 -samq1323 samequantum 0E+3 7 -> 0 -samq1324 samequantum 0E+3 7E+3 -> 1 -samq1325 samequantum 0E+3 sNaN -> 0 - -samq1410 samequantum 7E-3 -Inf -> 0 -samq1411 samequantum 7E-3 Inf -> 0 -samq1412 samequantum 7E-3 NaN -> 0 -samq1413 samequantum 7E-3 -7E+3 -> 0 -samq1414 samequantum 7E-3 -7 -> 0 -samq1415 samequantum 7E-3 -7E-3 -> 1 -samq1416 samequantum 7E-3 -0E-3 -> 1 -samq1417 samequantum 7E-3 -0 -> 0 -samq1418 samequantum 7E-3 -0E+3 -> 0 -samq1419 samequantum 7E-3 0E-3 -> 1 -samq1420 samequantum 7E-3 0 -> 0 -samq1421 samequantum 7E-3 0E+3 -> 0 -samq1422 samequantum 7E-3 7E-3 -> 1 -samq1423 samequantum 7E-3 7 -> 0 -samq1424 samequantum 7E-3 7E+3 -> 0 -samq1425 samequantum 7E-3 sNaN -> 0 - -samq1510 samequantum 7 -Inf -> 0 -samq1511 samequantum 7 Inf -> 0 -samq1512 samequantum 7 NaN -> 0 -samq1513 samequantum 7 -7E+3 -> 0 -samq1514 samequantum 7 -7 -> 1 -samq1515 samequantum 7 -7E-3 -> 0 -samq1516 samequantum 7 -0E-3 -> 0 -samq1517 samequantum 7 -0 -> 1 -samq1518 samequantum 7 -0E+3 -> 0 -samq1519 samequantum 7 0E-3 -> 0 -samq1520 samequantum 7 0 -> 1 -samq1521 samequantum 7 0E+3 -> 0 -samq1522 samequantum 7 7E-3 -> 0 -samq1523 samequantum 7 7 -> 1 -samq1524 samequantum 7 7E+3 -> 0 -samq1525 samequantum 7 sNaN -> 0 - -samq1610 samequantum 7E+3 -Inf -> 0 -samq1611 samequantum 7E+3 Inf -> 0 -samq1612 samequantum 7E+3 NaN -> 0 -samq1613 samequantum 7E+3 -7E+3 -> 1 -samq1614 samequantum 7E+3 -7 -> 0 -samq1615 samequantum 7E+3 -7E-3 -> 0 -samq1616 samequantum 7E+3 -0E-3 -> 0 -samq1617 samequantum 7E+3 -0 -> 0 -samq1618 samequantum 7E+3 -0E+3 -> 1 -samq1619 samequantum 7E+3 0E-3 -> 0 -samq1620 samequantum 7E+3 0 -> 0 -samq1621 samequantum 7E+3 0E+3 -> 1 -samq1622 samequantum 7E+3 7E-3 -> 0 -samq1623 samequantum 7E+3 7 -> 0 -samq1624 samequantum 7E+3 7E+3 -> 1 -samq1625 samequantum 7E+3 sNaN -> 0 - -samq1710 samequantum sNaN -Inf -> 0 -samq1711 samequantum sNaN Inf -> 0 -samq1712 samequantum sNaN NaN -> 1 -samq1713 samequantum sNaN -7E+3 -> 0 -samq1714 samequantum sNaN -7 -> 0 -samq1715 samequantum sNaN -7E-3 -> 0 -samq1716 samequantum sNaN -0E-3 -> 0 -samq1717 samequantum sNaN -0 -> 0 -samq1718 samequantum sNaN -0E+3 -> 0 -samq1719 samequantum sNaN 0E-3 -> 0 -samq1720 samequantum sNaN 0 -> 0 -samq1721 samequantum sNaN 0E+3 -> 0 -samq1722 samequantum sNaN 7E-3 -> 0 -samq1723 samequantum sNaN 7 -> 0 -samq1724 samequantum sNaN 7E+3 -> 0 -samq1725 samequantum sNaN sNaN -> 1 --- noisy NaNs -samq1730 samequantum sNaN3 sNaN3 -> 1 -samq1731 samequantum sNaN3 sNaN4 -> 1 -samq1732 samequantum NaN3 NaN3 -> 1 -samq1733 samequantum NaN3 NaN4 -> 1 -samq1734 samequantum sNaN3 3 -> 0 -samq1735 samequantum NaN3 3 -> 0 -samq1736 samequantum 4 sNaN4 -> 0 -samq1737 samequantum 3 NaN3 -> 0 -samq1738 samequantum Inf sNaN4 -> 0 -samq1739 samequantum -Inf NaN3 -> 0 - - - diff --git a/sys/lib/python/test/decimaltestdata/squareroot.decTest b/sys/lib/python/test/decimaltestdata/squareroot.decTest deleted file mode 100644 index 0c83cc7cc..000000000 --- a/sys/lib/python/test/decimaltestdata/squareroot.decTest +++ /dev/null @@ -1,2958 +0,0 @@ ------------------------------------------------------------------------- --- squareroot.decTest -- decimal square root -- --- Copyright (c) IBM Corporation, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - --- basics -sqtx001 squareroot 1 -> 1 -sqtx002 squareroot -1 -> NaN Invalid_operation -sqtx003 squareroot 1.00 -> 1.0 -sqtx004 squareroot -1.00 -> NaN Invalid_operation -sqtx005 squareroot 0 -> 0 -sqtx006 squareroot 00.0 -> 0.0 -sqtx007 squareroot 0.00 -> 0.0 -sqtx008 squareroot 00.00 -> 0.0 -sqtx009 squareroot 00.000 -> 0.00 -sqtx010 squareroot 00.0000 -> 0.00 -sqtx011 squareroot 00 -> 0 - -sqtx012 squareroot -2 -> NaN Invalid_operation -sqtx013 squareroot 2 -> 1.41421356 Inexact Rounded -sqtx014 squareroot -2.00 -> NaN Invalid_operation -sqtx015 squareroot 2.00 -> 1.41421356 Inexact Rounded -sqtx016 squareroot -0 -> -0 -sqtx017 squareroot -0.0 -> -0.0 -sqtx018 squareroot -00.00 -> -0.0 -sqtx019 squareroot -00.000 -> -0.00 -sqtx020 squareroot -0.0000 -> -0.00 -sqtx021 squareroot -0E+9 -> -0E+4 -sqtx022 squareroot -0E+10 -> -0E+5 -sqtx023 squareroot -0E+11 -> -0E+5 -sqtx024 squareroot -0E+12 -> -0E+6 -sqtx025 squareroot -00 -> -0 -sqtx026 squareroot 0E+5 -> 0E+2 -sqtx027 squareroot 4.0 -> 2.0 -sqtx028 squareroot 4.00 -> 2.0 - -sqtx030 squareroot +0.1 -> 0.316227766 Inexact Rounded -sqtx031 squareroot -0.1 -> NaN Invalid_operation -sqtx032 squareroot +0.01 -> 0.1 -sqtx033 squareroot -0.01 -> NaN Invalid_operation -sqtx034 squareroot +0.001 -> 0.0316227766 Inexact Rounded -sqtx035 squareroot -0.001 -> NaN Invalid_operation -sqtx036 squareroot +0.000001 -> 0.001 -sqtx037 squareroot -0.000001 -> NaN Invalid_operation -sqtx038 squareroot +0.000000000001 -> 0.000001 -sqtx039 squareroot -0.000000000001 -> NaN Invalid_operation - -sqtx041 squareroot 1.1 -> 1.04880885 Inexact Rounded -sqtx042 squareroot 1.10 -> 1.04880885 Inexact Rounded -sqtx043 squareroot 1.100 -> 1.04880885 Inexact Rounded -sqtx044 squareroot 1.110 -> 1.05356538 Inexact Rounded -sqtx045 squareroot -1.1 -> NaN Invalid_operation -sqtx046 squareroot -1.10 -> NaN Invalid_operation -sqtx047 squareroot -1.100 -> NaN Invalid_operation -sqtx048 squareroot -1.110 -> NaN Invalid_operation -sqtx049 squareroot 9.9 -> 3.14642654 Inexact Rounded -sqtx050 squareroot 9.90 -> 3.14642654 Inexact Rounded -sqtx051 squareroot 9.900 -> 3.14642654 Inexact Rounded -sqtx052 squareroot 9.990 -> 3.16069613 Inexact Rounded -sqtx053 squareroot -9.9 -> NaN Invalid_operation -sqtx054 squareroot -9.90 -> NaN Invalid_operation -sqtx055 squareroot -9.900 -> NaN Invalid_operation -sqtx056 squareroot -9.990 -> NaN Invalid_operation - -sqtx060 squareroot 1 -> 1 -sqtx061 squareroot 1.0 -> 1.0 -sqtx062 squareroot 1.00 -> 1.0 -sqtx063 squareroot 10.0 -> 3.16227766 Inexact Rounded -sqtx064 squareroot 10.0 -> 3.16227766 Inexact Rounded -sqtx065 squareroot 10.0 -> 3.16227766 Inexact Rounded -sqtx066 squareroot 10.00 -> 3.16227766 Inexact Rounded -sqtx067 squareroot 100 -> 10 -sqtx068 squareroot 100.0 -> 10.0 -sqtx069 squareroot 100.00 -> 10.0 -sqtx070 squareroot 1.1000E+3 -> 33.1662479 Inexact Rounded -sqtx071 squareroot 1.10000E+3 -> 33.1662479 Inexact Rounded -sqtx072 squareroot -10.0 -> NaN Invalid_operation -sqtx073 squareroot -10.00 -> NaN Invalid_operation -sqtx074 squareroot -100.0 -> NaN Invalid_operation -sqtx075 squareroot -100.00 -> NaN Invalid_operation -sqtx076 squareroot -1.1000E+3 -> NaN Invalid_operation -sqtx077 squareroot -1.10000E+3 -> NaN Invalid_operation - --- famous squares -sqtx080 squareroot 1 -> 1 -sqtx081 squareroot 4 -> 2 -sqtx082 squareroot 9 -> 3 -sqtx083 squareroot 16 -> 4 -sqtx084 squareroot 25 -> 5 -sqtx085 squareroot 36 -> 6 -sqtx086 squareroot 49 -> 7 -sqtx087 squareroot 64 -> 8 -sqtx088 squareroot 81 -> 9 -sqtx089 squareroot 100 -> 10 -sqtx090 squareroot 121 -> 11 -sqtx091 squareroot 144 -> 12 -sqtx092 squareroot 169 -> 13 -sqtx093 squareroot 256 -> 16 -sqtx094 squareroot 1024 -> 32 -sqtx095 squareroot 4096 -> 64 -sqtx100 squareroot 0.01 -> 0.1 -sqtx101 squareroot 0.04 -> 0.2 -sqtx102 squareroot 0.09 -> 0.3 -sqtx103 squareroot 0.16 -> 0.4 -sqtx104 squareroot 0.25 -> 0.5 -sqtx105 squareroot 0.36 -> 0.6 -sqtx106 squareroot 0.49 -> 0.7 -sqtx107 squareroot 0.64 -> 0.8 -sqtx108 squareroot 0.81 -> 0.9 -sqtx109 squareroot 1.00 -> 1.0 -sqtx110 squareroot 1.21 -> 1.1 -sqtx111 squareroot 1.44 -> 1.2 -sqtx112 squareroot 1.69 -> 1.3 -sqtx113 squareroot 2.56 -> 1.6 -sqtx114 squareroot 10.24 -> 3.2 -sqtx115 squareroot 40.96 -> 6.4 - --- Precision 1 squareroot tests [exhaustive, plus exponent adjusts] -rounding: half_even -maxExponent: 999 -minexponent: -999 -precision: 1 -sqtx1201 squareroot 0.1 -> 0.3 Inexact Rounded -sqtx1202 squareroot 0.01 -> 0.1 -sqtx1203 squareroot 1.0E-1 -> 0.3 Inexact Rounded -sqtx1204 squareroot 1.00E-2 -> 0.1 Rounded -sqtx1205 squareroot 1E-3 -> 0.03 Inexact Rounded -sqtx1206 squareroot 1E+1 -> 3 Inexact Rounded -sqtx1207 squareroot 1E+2 -> 1E+1 -sqtx1208 squareroot 1E+3 -> 3E+1 Inexact Rounded -sqtx1209 squareroot 0.2 -> 0.4 Inexact Rounded -sqtx1210 squareroot 0.02 -> 0.1 Inexact Rounded -sqtx1211 squareroot 2.0E-1 -> 0.4 Inexact Rounded -sqtx1212 squareroot 2.00E-2 -> 0.1 Inexact Rounded -sqtx1213 squareroot 2E-3 -> 0.04 Inexact Rounded -sqtx1214 squareroot 2E+1 -> 4 Inexact Rounded -sqtx1215 squareroot 2E+2 -> 1E+1 Inexact Rounded -sqtx1216 squareroot 2E+3 -> 4E+1 Inexact Rounded -sqtx1217 squareroot 0.3 -> 0.5 Inexact Rounded -sqtx1218 squareroot 0.03 -> 0.2 Inexact Rounded -sqtx1219 squareroot 3.0E-1 -> 0.5 Inexact Rounded -sqtx1220 squareroot 3.00E-2 -> 0.2 Inexact Rounded -sqtx1221 squareroot 3E-3 -> 0.05 Inexact Rounded -sqtx1222 squareroot 3E+1 -> 5 Inexact Rounded -sqtx1223 squareroot 3E+2 -> 2E+1 Inexact Rounded -sqtx1224 squareroot 3E+3 -> 5E+1 Inexact Rounded -sqtx1225 squareroot 0.4 -> 0.6 Inexact Rounded -sqtx1226 squareroot 0.04 -> 0.2 -sqtx1227 squareroot 4.0E-1 -> 0.6 Inexact Rounded -sqtx1228 squareroot 4.00E-2 -> 0.2 Rounded -sqtx1229 squareroot 4E-3 -> 0.06 Inexact Rounded -sqtx1230 squareroot 4E+1 -> 6 Inexact Rounded -sqtx1231 squareroot 4E+2 -> 2E+1 -sqtx1232 squareroot 4E+3 -> 6E+1 Inexact Rounded -sqtx1233 squareroot 0.5 -> 0.7 Inexact Rounded -sqtx1234 squareroot 0.05 -> 0.2 Inexact Rounded -sqtx1235 squareroot 5.0E-1 -> 0.7 Inexact Rounded -sqtx1236 squareroot 5.00E-2 -> 0.2 Inexact Rounded -sqtx1237 squareroot 5E-3 -> 0.07 Inexact Rounded -sqtx1238 squareroot 5E+1 -> 7 Inexact Rounded -sqtx1239 squareroot 5E+2 -> 2E+1 Inexact Rounded -sqtx1240 squareroot 5E+3 -> 7E+1 Inexact Rounded -sqtx1241 squareroot 0.6 -> 0.8 Inexact Rounded -sqtx1242 squareroot 0.06 -> 0.2 Inexact Rounded -sqtx1243 squareroot 6.0E-1 -> 0.8 Inexact Rounded -sqtx1244 squareroot 6.00E-2 -> 0.2 Inexact Rounded -sqtx1245 squareroot 6E-3 -> 0.08 Inexact Rounded -sqtx1246 squareroot 6E+1 -> 8 Inexact Rounded -sqtx1247 squareroot 6E+2 -> 2E+1 Inexact Rounded -sqtx1248 squareroot 6E+3 -> 8E+1 Inexact Rounded -sqtx1249 squareroot 0.7 -> 0.8 Inexact Rounded -sqtx1250 squareroot 0.07 -> 0.3 Inexact Rounded -sqtx1251 squareroot 7.0E-1 -> 0.8 Inexact Rounded -sqtx1252 squareroot 7.00E-2 -> 0.3 Inexact Rounded -sqtx1253 squareroot 7E-3 -> 0.08 Inexact Rounded -sqtx1254 squareroot 7E+1 -> 8 Inexact Rounded -sqtx1255 squareroot 7E+2 -> 3E+1 Inexact Rounded -sqtx1256 squareroot 7E+3 -> 8E+1 Inexact Rounded -sqtx1257 squareroot 0.8 -> 0.9 Inexact Rounded -sqtx1258 squareroot 0.08 -> 0.3 Inexact Rounded -sqtx1259 squareroot 8.0E-1 -> 0.9 Inexact Rounded -sqtx1260 squareroot 8.00E-2 -> 0.3 Inexact Rounded -sqtx1261 squareroot 8E-3 -> 0.09 Inexact Rounded -sqtx1262 squareroot 8E+1 -> 9 Inexact Rounded -sqtx1263 squareroot 8E+2 -> 3E+1 Inexact Rounded -sqtx1264 squareroot 8E+3 -> 9E+1 Inexact Rounded -sqtx1265 squareroot 0.9 -> 0.9 Inexact Rounded -sqtx1266 squareroot 0.09 -> 0.3 -sqtx1267 squareroot 9.0E-1 -> 0.9 Inexact Rounded -sqtx1268 squareroot 9.00E-2 -> 0.3 Rounded -sqtx1269 squareroot 9E-3 -> 0.09 Inexact Rounded -sqtx1270 squareroot 9E+1 -> 9 Inexact Rounded -sqtx1271 squareroot 9E+2 -> 3E+1 -sqtx1272 squareroot 9E+3 -> 9E+1 Inexact Rounded - --- Precision 2 squareroot tests [exhaustive, plus exponent adjusts] -rounding: half_even -maxExponent: 999 -minexponent: -999 -precision: 2 -sqtx2201 squareroot 0.1 -> 0.32 Inexact Rounded -sqtx2202 squareroot 0.01 -> 0.1 -sqtx2203 squareroot 1.0E-1 -> 0.32 Inexact Rounded -sqtx2204 squareroot 1.00E-2 -> 0.10 -sqtx2205 squareroot 1E-3 -> 0.032 Inexact Rounded -sqtx2206 squareroot 1E+1 -> 3.2 Inexact Rounded -sqtx2207 squareroot 1E+2 -> 1E+1 -sqtx2208 squareroot 1E+3 -> 32 Inexact Rounded -sqtx2209 squareroot 0.2 -> 0.45 Inexact Rounded -sqtx2210 squareroot 0.02 -> 0.14 Inexact Rounded -sqtx2211 squareroot 2.0E-1 -> 0.45 Inexact Rounded -sqtx2212 squareroot 2.00E-2 -> 0.14 Inexact Rounded -sqtx2213 squareroot 2E-3 -> 0.045 Inexact Rounded -sqtx2214 squareroot 2E+1 -> 4.5 Inexact Rounded -sqtx2215 squareroot 2E+2 -> 14 Inexact Rounded -sqtx2216 squareroot 2E+3 -> 45 Inexact Rounded -sqtx2217 squareroot 0.3 -> 0.55 Inexact Rounded -sqtx2218 squareroot 0.03 -> 0.17 Inexact Rounded -sqtx2219 squareroot 3.0E-1 -> 0.55 Inexact Rounded -sqtx2220 squareroot 3.00E-2 -> 0.17 Inexact Rounded -sqtx2221 squareroot 3E-3 -> 0.055 Inexact Rounded -sqtx2222 squareroot 3E+1 -> 5.5 Inexact Rounded -sqtx2223 squareroot 3E+2 -> 17 Inexact Rounded -sqtx2224 squareroot 3E+3 -> 55 Inexact Rounded -sqtx2225 squareroot 0.4 -> 0.63 Inexact Rounded -sqtx2226 squareroot 0.04 -> 0.2 -sqtx2227 squareroot 4.0E-1 -> 0.63 Inexact Rounded -sqtx2228 squareroot 4.00E-2 -> 0.20 -sqtx2229 squareroot 4E-3 -> 0.063 Inexact Rounded -sqtx2230 squareroot 4E+1 -> 6.3 Inexact Rounded -sqtx2231 squareroot 4E+2 -> 2E+1 -sqtx2232 squareroot 4E+3 -> 63 Inexact Rounded -sqtx2233 squareroot 0.5 -> 0.71 Inexact Rounded -sqtx2234 squareroot 0.05 -> 0.22 Inexact Rounded -sqtx2235 squareroot 5.0E-1 -> 0.71 Inexact Rounded -sqtx2236 squareroot 5.00E-2 -> 0.22 Inexact Rounded -sqtx2237 squareroot 5E-3 -> 0.071 Inexact Rounded -sqtx2238 squareroot 5E+1 -> 7.1 Inexact Rounded -sqtx2239 squareroot 5E+2 -> 22 Inexact Rounded -sqtx2240 squareroot 5E+3 -> 71 Inexact Rounded -sqtx2241 squareroot 0.6 -> 0.77 Inexact Rounded -sqtx2242 squareroot 0.06 -> 0.24 Inexact Rounded -sqtx2243 squareroot 6.0E-1 -> 0.77 Inexact Rounded -sqtx2244 squareroot 6.00E-2 -> 0.24 Inexact Rounded -sqtx2245 squareroot 6E-3 -> 0.077 Inexact Rounded -sqtx2246 squareroot 6E+1 -> 7.7 Inexact Rounded -sqtx2247 squareroot 6E+2 -> 24 Inexact Rounded -sqtx2248 squareroot 6E+3 -> 77 Inexact Rounded -sqtx2249 squareroot 0.7 -> 0.84 Inexact Rounded -sqtx2250 squareroot 0.07 -> 0.26 Inexact Rounded -sqtx2251 squareroot 7.0E-1 -> 0.84 Inexact Rounded -sqtx2252 squareroot 7.00E-2 -> 0.26 Inexact Rounded -sqtx2253 squareroot 7E-3 -> 0.084 Inexact Rounded -sqtx2254 squareroot 7E+1 -> 8.4 Inexact Rounded -sqtx2255 squareroot 7E+2 -> 26 Inexact Rounded -sqtx2256 squareroot 7E+3 -> 84 Inexact Rounded -sqtx2257 squareroot 0.8 -> 0.89 Inexact Rounded -sqtx2258 squareroot 0.08 -> 0.28 Inexact Rounded -sqtx2259 squareroot 8.0E-1 -> 0.89 Inexact Rounded -sqtx2260 squareroot 8.00E-2 -> 0.28 Inexact Rounded -sqtx2261 squareroot 8E-3 -> 0.089 Inexact Rounded -sqtx2262 squareroot 8E+1 -> 8.9 Inexact Rounded -sqtx2263 squareroot 8E+2 -> 28 Inexact Rounded -sqtx2264 squareroot 8E+3 -> 89 Inexact Rounded -sqtx2265 squareroot 0.9 -> 0.95 Inexact Rounded -sqtx2266 squareroot 0.09 -> 0.3 -sqtx2267 squareroot 9.0E-1 -> 0.95 Inexact Rounded -sqtx2268 squareroot 9.00E-2 -> 0.30 -sqtx2269 squareroot 9E-3 -> 0.095 Inexact Rounded -sqtx2270 squareroot 9E+1 -> 9.5 Inexact Rounded -sqtx2271 squareroot 9E+2 -> 3E+1 -sqtx2272 squareroot 9E+3 -> 95 Inexact Rounded -sqtx2273 squareroot 0.10 -> 0.32 Inexact Rounded -sqtx2274 squareroot 0.010 -> 0.10 -sqtx2275 squareroot 10.0E-1 -> 1.0 -sqtx2276 squareroot 10.00E-2 -> 0.32 Inexact Rounded -sqtx2277 squareroot 10E-3 -> 0.10 -sqtx2278 squareroot 10E+1 -> 10 -sqtx2279 squareroot 10E+2 -> 32 Inexact Rounded -sqtx2280 squareroot 10E+3 -> 1.0E+2 -sqtx2281 squareroot 0.11 -> 0.33 Inexact Rounded -sqtx2282 squareroot 0.011 -> 0.10 Inexact Rounded -sqtx2283 squareroot 11.0E-1 -> 1.0 Inexact Rounded -sqtx2284 squareroot 11.00E-2 -> 0.33 Inexact Rounded -sqtx2285 squareroot 11E-3 -> 0.10 Inexact Rounded -sqtx2286 squareroot 11E+1 -> 10 Inexact Rounded -sqtx2287 squareroot 11E+2 -> 33 Inexact Rounded -sqtx2288 squareroot 11E+3 -> 1.0E+2 Inexact Rounded -sqtx2289 squareroot 0.12 -> 0.35 Inexact Rounded -sqtx2290 squareroot 0.012 -> 0.11 Inexact Rounded -sqtx2291 squareroot 12.0E-1 -> 1.1 Inexact Rounded -sqtx2292 squareroot 12.00E-2 -> 0.35 Inexact Rounded -sqtx2293 squareroot 12E-3 -> 0.11 Inexact Rounded -sqtx2294 squareroot 12E+1 -> 11 Inexact Rounded -sqtx2295 squareroot 12E+2 -> 35 Inexact Rounded -sqtx2296 squareroot 12E+3 -> 1.1E+2 Inexact Rounded -sqtx2297 squareroot 0.13 -> 0.36 Inexact Rounded -sqtx2298 squareroot 0.013 -> 0.11 Inexact Rounded -sqtx2299 squareroot 13.0E-1 -> 1.1 Inexact Rounded -sqtx2300 squareroot 13.00E-2 -> 0.36 Inexact Rounded -sqtx2301 squareroot 13E-3 -> 0.11 Inexact Rounded -sqtx2302 squareroot 13E+1 -> 11 Inexact Rounded -sqtx2303 squareroot 13E+2 -> 36 Inexact Rounded -sqtx2304 squareroot 13E+3 -> 1.1E+2 Inexact Rounded -sqtx2305 squareroot 0.14 -> 0.37 Inexact Rounded -sqtx2306 squareroot 0.014 -> 0.12 Inexact Rounded -sqtx2307 squareroot 14.0E-1 -> 1.2 Inexact Rounded -sqtx2308 squareroot 14.00E-2 -> 0.37 Inexact Rounded -sqtx2309 squareroot 14E-3 -> 0.12 Inexact Rounded -sqtx2310 squareroot 14E+1 -> 12 Inexact Rounded -sqtx2311 squareroot 14E+2 -> 37 Inexact Rounded -sqtx2312 squareroot 14E+3 -> 1.2E+2 Inexact Rounded -sqtx2313 squareroot 0.15 -> 0.39 Inexact Rounded -sqtx2314 squareroot 0.015 -> 0.12 Inexact Rounded -sqtx2315 squareroot 15.0E-1 -> 1.2 Inexact Rounded -sqtx2316 squareroot 15.00E-2 -> 0.39 Inexact Rounded -sqtx2317 squareroot 15E-3 -> 0.12 Inexact Rounded -sqtx2318 squareroot 15E+1 -> 12 Inexact Rounded -sqtx2319 squareroot 15E+2 -> 39 Inexact Rounded -sqtx2320 squareroot 15E+3 -> 1.2E+2 Inexact Rounded -sqtx2321 squareroot 0.16 -> 0.4 -sqtx2322 squareroot 0.016 -> 0.13 Inexact Rounded -sqtx2323 squareroot 16.0E-1 -> 1.3 Inexact Rounded -sqtx2324 squareroot 16.00E-2 -> 0.40 -sqtx2325 squareroot 16E-3 -> 0.13 Inexact Rounded -sqtx2326 squareroot 16E+1 -> 13 Inexact Rounded -sqtx2327 squareroot 16E+2 -> 4E+1 -sqtx2328 squareroot 16E+3 -> 1.3E+2 Inexact Rounded -sqtx2329 squareroot 0.17 -> 0.41 Inexact Rounded -sqtx2330 squareroot 0.017 -> 0.13 Inexact Rounded -sqtx2331 squareroot 17.0E-1 -> 1.3 Inexact Rounded -sqtx2332 squareroot 17.00E-2 -> 0.41 Inexact Rounded -sqtx2333 squareroot 17E-3 -> 0.13 Inexact Rounded -sqtx2334 squareroot 17E+1 -> 13 Inexact Rounded -sqtx2335 squareroot 17E+2 -> 41 Inexact Rounded -sqtx2336 squareroot 17E+3 -> 1.3E+2 Inexact Rounded -sqtx2337 squareroot 0.18 -> 0.42 Inexact Rounded -sqtx2338 squareroot 0.018 -> 0.13 Inexact Rounded -sqtx2339 squareroot 18.0E-1 -> 1.3 Inexact Rounded -sqtx2340 squareroot 18.00E-2 -> 0.42 Inexact Rounded -sqtx2341 squareroot 18E-3 -> 0.13 Inexact Rounded -sqtx2342 squareroot 18E+1 -> 13 Inexact Rounded -sqtx2343 squareroot 18E+2 -> 42 Inexact Rounded -sqtx2344 squareroot 18E+3 -> 1.3E+2 Inexact Rounded -sqtx2345 squareroot 0.19 -> 0.44 Inexact Rounded -sqtx2346 squareroot 0.019 -> 0.14 Inexact Rounded -sqtx2347 squareroot 19.0E-1 -> 1.4 Inexact Rounded -sqtx2348 squareroot 19.00E-2 -> 0.44 Inexact Rounded -sqtx2349 squareroot 19E-3 -> 0.14 Inexact Rounded -sqtx2350 squareroot 19E+1 -> 14 Inexact Rounded -sqtx2351 squareroot 19E+2 -> 44 Inexact Rounded -sqtx2352 squareroot 19E+3 -> 1.4E+2 Inexact Rounded -sqtx2353 squareroot 0.20 -> 0.45 Inexact Rounded -sqtx2354 squareroot 0.020 -> 0.14 Inexact Rounded -sqtx2355 squareroot 20.0E-1 -> 1.4 Inexact Rounded -sqtx2356 squareroot 20.00E-2 -> 0.45 Inexact Rounded -sqtx2357 squareroot 20E-3 -> 0.14 Inexact Rounded -sqtx2358 squareroot 20E+1 -> 14 Inexact Rounded -sqtx2359 squareroot 20E+2 -> 45 Inexact Rounded -sqtx2360 squareroot 20E+3 -> 1.4E+2 Inexact Rounded -sqtx2361 squareroot 0.21 -> 0.46 Inexact Rounded -sqtx2362 squareroot 0.021 -> 0.14 Inexact Rounded -sqtx2363 squareroot 21.0E-1 -> 1.4 Inexact Rounded -sqtx2364 squareroot 21.00E-2 -> 0.46 Inexact Rounded -sqtx2365 squareroot 21E-3 -> 0.14 Inexact Rounded -sqtx2366 squareroot 21E+1 -> 14 Inexact Rounded -sqtx2367 squareroot 21E+2 -> 46 Inexact Rounded -sqtx2368 squareroot 21E+3 -> 1.4E+2 Inexact Rounded -sqtx2369 squareroot 0.22 -> 0.47 Inexact Rounded -sqtx2370 squareroot 0.022 -> 0.15 Inexact Rounded -sqtx2371 squareroot 22.0E-1 -> 1.5 Inexact Rounded -sqtx2372 squareroot 22.00E-2 -> 0.47 Inexact Rounded -sqtx2373 squareroot 22E-3 -> 0.15 Inexact Rounded -sqtx2374 squareroot 22E+1 -> 15 Inexact Rounded -sqtx2375 squareroot 22E+2 -> 47 Inexact Rounded -sqtx2376 squareroot 22E+3 -> 1.5E+2 Inexact Rounded -sqtx2377 squareroot 0.23 -> 0.48 Inexact Rounded -sqtx2378 squareroot 0.023 -> 0.15 Inexact Rounded -sqtx2379 squareroot 23.0E-1 -> 1.5 Inexact Rounded -sqtx2380 squareroot 23.00E-2 -> 0.48 Inexact Rounded -sqtx2381 squareroot 23E-3 -> 0.15 Inexact Rounded -sqtx2382 squareroot 23E+1 -> 15 Inexact Rounded -sqtx2383 squareroot 23E+2 -> 48 Inexact Rounded -sqtx2384 squareroot 23E+3 -> 1.5E+2 Inexact Rounded -sqtx2385 squareroot 0.24 -> 0.49 Inexact Rounded -sqtx2386 squareroot 0.024 -> 0.15 Inexact Rounded -sqtx2387 squareroot 24.0E-1 -> 1.5 Inexact Rounded -sqtx2388 squareroot 24.00E-2 -> 0.49 Inexact Rounded -sqtx2389 squareroot 24E-3 -> 0.15 Inexact Rounded -sqtx2390 squareroot 24E+1 -> 15 Inexact Rounded -sqtx2391 squareroot 24E+2 -> 49 Inexact Rounded -sqtx2392 squareroot 24E+3 -> 1.5E+2 Inexact Rounded -sqtx2393 squareroot 0.25 -> 0.5 -sqtx2394 squareroot 0.025 -> 0.16 Inexact Rounded -sqtx2395 squareroot 25.0E-1 -> 1.6 Inexact Rounded -sqtx2396 squareroot 25.00E-2 -> 0.50 -sqtx2397 squareroot 25E-3 -> 0.16 Inexact Rounded -sqtx2398 squareroot 25E+1 -> 16 Inexact Rounded -sqtx2399 squareroot 25E+2 -> 5E+1 -sqtx2400 squareroot 25E+3 -> 1.6E+2 Inexact Rounded -sqtx2401 squareroot 0.26 -> 0.51 Inexact Rounded -sqtx2402 squareroot 0.026 -> 0.16 Inexact Rounded -sqtx2403 squareroot 26.0E-1 -> 1.6 Inexact Rounded -sqtx2404 squareroot 26.00E-2 -> 0.51 Inexact Rounded -sqtx2405 squareroot 26E-3 -> 0.16 Inexact Rounded -sqtx2406 squareroot 26E+1 -> 16 Inexact Rounded -sqtx2407 squareroot 26E+2 -> 51 Inexact Rounded -sqtx2408 squareroot 26E+3 -> 1.6E+2 Inexact Rounded -sqtx2409 squareroot 0.27 -> 0.52 Inexact Rounded -sqtx2410 squareroot 0.027 -> 0.16 Inexact Rounded -sqtx2411 squareroot 27.0E-1 -> 1.6 Inexact Rounded -sqtx2412 squareroot 27.00E-2 -> 0.52 Inexact Rounded -sqtx2413 squareroot 27E-3 -> 0.16 Inexact Rounded -sqtx2414 squareroot 27E+1 -> 16 Inexact Rounded -sqtx2415 squareroot 27E+2 -> 52 Inexact Rounded -sqtx2416 squareroot 27E+3 -> 1.6E+2 Inexact Rounded -sqtx2417 squareroot 0.28 -> 0.53 Inexact Rounded -sqtx2418 squareroot 0.028 -> 0.17 Inexact Rounded -sqtx2419 squareroot 28.0E-1 -> 1.7 Inexact Rounded -sqtx2420 squareroot 28.00E-2 -> 0.53 Inexact Rounded -sqtx2421 squareroot 28E-3 -> 0.17 Inexact Rounded -sqtx2422 squareroot 28E+1 -> 17 Inexact Rounded -sqtx2423 squareroot 28E+2 -> 53 Inexact Rounded -sqtx2424 squareroot 28E+3 -> 1.7E+2 Inexact Rounded -sqtx2425 squareroot 0.29 -> 0.54 Inexact Rounded -sqtx2426 squareroot 0.029 -> 0.17 Inexact Rounded -sqtx2427 squareroot 29.0E-1 -> 1.7 Inexact Rounded -sqtx2428 squareroot 29.00E-2 -> 0.54 Inexact Rounded -sqtx2429 squareroot 29E-3 -> 0.17 Inexact Rounded -sqtx2430 squareroot 29E+1 -> 17 Inexact Rounded -sqtx2431 squareroot 29E+2 -> 54 Inexact Rounded -sqtx2432 squareroot 29E+3 -> 1.7E+2 Inexact Rounded -sqtx2433 squareroot 0.30 -> 0.55 Inexact Rounded -sqtx2434 squareroot 0.030 -> 0.17 Inexact Rounded -sqtx2435 squareroot 30.0E-1 -> 1.7 Inexact Rounded -sqtx2436 squareroot 30.00E-2 -> 0.55 Inexact Rounded -sqtx2437 squareroot 30E-3 -> 0.17 Inexact Rounded -sqtx2438 squareroot 30E+1 -> 17 Inexact Rounded -sqtx2439 squareroot 30E+2 -> 55 Inexact Rounded -sqtx2440 squareroot 30E+3 -> 1.7E+2 Inexact Rounded -sqtx2441 squareroot 0.31 -> 0.56 Inexact Rounded -sqtx2442 squareroot 0.031 -> 0.18 Inexact Rounded -sqtx2443 squareroot 31.0E-1 -> 1.8 Inexact Rounded -sqtx2444 squareroot 31.00E-2 -> 0.56 Inexact Rounded -sqtx2445 squareroot 31E-3 -> 0.18 Inexact Rounded -sqtx2446 squareroot 31E+1 -> 18 Inexact Rounded -sqtx2447 squareroot 31E+2 -> 56 Inexact Rounded -sqtx2448 squareroot 31E+3 -> 1.8E+2 Inexact Rounded -sqtx2449 squareroot 0.32 -> 0.57 Inexact Rounded -sqtx2450 squareroot 0.032 -> 0.18 Inexact Rounded -sqtx2451 squareroot 32.0E-1 -> 1.8 Inexact Rounded -sqtx2452 squareroot 32.00E-2 -> 0.57 Inexact Rounded -sqtx2453 squareroot 32E-3 -> 0.18 Inexact Rounded -sqtx2454 squareroot 32E+1 -> 18 Inexact Rounded -sqtx2455 squareroot 32E+2 -> 57 Inexact Rounded -sqtx2456 squareroot 32E+3 -> 1.8E+2 Inexact Rounded -sqtx2457 squareroot 0.33 -> 0.57 Inexact Rounded -sqtx2458 squareroot 0.033 -> 0.18 Inexact Rounded -sqtx2459 squareroot 33.0E-1 -> 1.8 Inexact Rounded -sqtx2460 squareroot 33.00E-2 -> 0.57 Inexact Rounded -sqtx2461 squareroot 33E-3 -> 0.18 Inexact Rounded -sqtx2462 squareroot 33E+1 -> 18 Inexact Rounded -sqtx2463 squareroot 33E+2 -> 57 Inexact Rounded -sqtx2464 squareroot 33E+3 -> 1.8E+2 Inexact Rounded -sqtx2465 squareroot 0.34 -> 0.58 Inexact Rounded -sqtx2466 squareroot 0.034 -> 0.18 Inexact Rounded -sqtx2467 squareroot 34.0E-1 -> 1.8 Inexact Rounded -sqtx2468 squareroot 34.00E-2 -> 0.58 Inexact Rounded -sqtx2469 squareroot 34E-3 -> 0.18 Inexact Rounded -sqtx2470 squareroot 34E+1 -> 18 Inexact Rounded -sqtx2471 squareroot 34E+2 -> 58 Inexact Rounded -sqtx2472 squareroot 34E+3 -> 1.8E+2 Inexact Rounded -sqtx2473 squareroot 0.35 -> 0.59 Inexact Rounded -sqtx2474 squareroot 0.035 -> 0.19 Inexact Rounded -sqtx2475 squareroot 35.0E-1 -> 1.9 Inexact Rounded -sqtx2476 squareroot 35.00E-2 -> 0.59 Inexact Rounded -sqtx2477 squareroot 35E-3 -> 0.19 Inexact Rounded -sqtx2478 squareroot 35E+1 -> 19 Inexact Rounded -sqtx2479 squareroot 35E+2 -> 59 Inexact Rounded -sqtx2480 squareroot 35E+3 -> 1.9E+2 Inexact Rounded -sqtx2481 squareroot 0.36 -> 0.6 -sqtx2482 squareroot 0.036 -> 0.19 Inexact Rounded -sqtx2483 squareroot 36.0E-1 -> 1.9 Inexact Rounded -sqtx2484 squareroot 36.00E-2 -> 0.60 -sqtx2485 squareroot 36E-3 -> 0.19 Inexact Rounded -sqtx2486 squareroot 36E+1 -> 19 Inexact Rounded -sqtx2487 squareroot 36E+2 -> 6E+1 -sqtx2488 squareroot 36E+3 -> 1.9E+2 Inexact Rounded -sqtx2489 squareroot 0.37 -> 0.61 Inexact Rounded -sqtx2490 squareroot 0.037 -> 0.19 Inexact Rounded -sqtx2491 squareroot 37.0E-1 -> 1.9 Inexact Rounded -sqtx2492 squareroot 37.00E-2 -> 0.61 Inexact Rounded -sqtx2493 squareroot 37E-3 -> 0.19 Inexact Rounded -sqtx2494 squareroot 37E+1 -> 19 Inexact Rounded -sqtx2495 squareroot 37E+2 -> 61 Inexact Rounded -sqtx2496 squareroot 37E+3 -> 1.9E+2 Inexact Rounded -sqtx2497 squareroot 0.38 -> 0.62 Inexact Rounded -sqtx2498 squareroot 0.038 -> 0.19 Inexact Rounded -sqtx2499 squareroot 38.0E-1 -> 1.9 Inexact Rounded -sqtx2500 squareroot 38.00E-2 -> 0.62 Inexact Rounded -sqtx2501 squareroot 38E-3 -> 0.19 Inexact Rounded -sqtx2502 squareroot 38E+1 -> 19 Inexact Rounded -sqtx2503 squareroot 38E+2 -> 62 Inexact Rounded -sqtx2504 squareroot 38E+3 -> 1.9E+2 Inexact Rounded -sqtx2505 squareroot 0.39 -> 0.62 Inexact Rounded -sqtx2506 squareroot 0.039 -> 0.20 Inexact Rounded -sqtx2507 squareroot 39.0E-1 -> 2.0 Inexact Rounded -sqtx2508 squareroot 39.00E-2 -> 0.62 Inexact Rounded -sqtx2509 squareroot 39E-3 -> 0.20 Inexact Rounded -sqtx2510 squareroot 39E+1 -> 20 Inexact Rounded -sqtx2511 squareroot 39E+2 -> 62 Inexact Rounded -sqtx2512 squareroot 39E+3 -> 2.0E+2 Inexact Rounded -sqtx2513 squareroot 0.40 -> 0.63 Inexact Rounded -sqtx2514 squareroot 0.040 -> 0.20 -sqtx2515 squareroot 40.0E-1 -> 2.0 -sqtx2516 squareroot 40.00E-2 -> 0.63 Inexact Rounded -sqtx2517 squareroot 40E-3 -> 0.20 -sqtx2518 squareroot 40E+1 -> 20 -sqtx2519 squareroot 40E+2 -> 63 Inexact Rounded -sqtx2520 squareroot 40E+3 -> 2.0E+2 -sqtx2521 squareroot 0.41 -> 0.64 Inexact Rounded -sqtx2522 squareroot 0.041 -> 0.20 Inexact Rounded -sqtx2523 squareroot 41.0E-1 -> 2.0 Inexact Rounded -sqtx2524 squareroot 41.00E-2 -> 0.64 Inexact Rounded -sqtx2525 squareroot 41E-3 -> 0.20 Inexact Rounded -sqtx2526 squareroot 41E+1 -> 20 Inexact Rounded -sqtx2527 squareroot 41E+2 -> 64 Inexact Rounded -sqtx2528 squareroot 41E+3 -> 2.0E+2 Inexact Rounded -sqtx2529 squareroot 0.42 -> 0.65 Inexact Rounded -sqtx2530 squareroot 0.042 -> 0.20 Inexact Rounded -sqtx2531 squareroot 42.0E-1 -> 2.0 Inexact Rounded -sqtx2532 squareroot 42.00E-2 -> 0.65 Inexact Rounded -sqtx2533 squareroot 42E-3 -> 0.20 Inexact Rounded -sqtx2534 squareroot 42E+1 -> 20 Inexact Rounded -sqtx2535 squareroot 42E+2 -> 65 Inexact Rounded -sqtx2536 squareroot 42E+3 -> 2.0E+2 Inexact Rounded -sqtx2537 squareroot 0.43 -> 0.66 Inexact Rounded -sqtx2538 squareroot 0.043 -> 0.21 Inexact Rounded -sqtx2539 squareroot 43.0E-1 -> 2.1 Inexact Rounded -sqtx2540 squareroot 43.00E-2 -> 0.66 Inexact Rounded -sqtx2541 squareroot 43E-3 -> 0.21 Inexact Rounded -sqtx2542 squareroot 43E+1 -> 21 Inexact Rounded -sqtx2543 squareroot 43E+2 -> 66 Inexact Rounded -sqtx2544 squareroot 43E+3 -> 2.1E+2 Inexact Rounded -sqtx2545 squareroot 0.44 -> 0.66 Inexact Rounded -sqtx2546 squareroot 0.044 -> 0.21 Inexact Rounded -sqtx2547 squareroot 44.0E-1 -> 2.1 Inexact Rounded -sqtx2548 squareroot 44.00E-2 -> 0.66 Inexact Rounded -sqtx2549 squareroot 44E-3 -> 0.21 Inexact Rounded -sqtx2550 squareroot 44E+1 -> 21 Inexact Rounded -sqtx2551 squareroot 44E+2 -> 66 Inexact Rounded -sqtx2552 squareroot 44E+3 -> 2.1E+2 Inexact Rounded -sqtx2553 squareroot 0.45 -> 0.67 Inexact Rounded -sqtx2554 squareroot 0.045 -> 0.21 Inexact Rounded -sqtx2555 squareroot 45.0E-1 -> 2.1 Inexact Rounded -sqtx2556 squareroot 45.00E-2 -> 0.67 Inexact Rounded -sqtx2557 squareroot 45E-3 -> 0.21 Inexact Rounded -sqtx2558 squareroot 45E+1 -> 21 Inexact Rounded -sqtx2559 squareroot 45E+2 -> 67 Inexact Rounded -sqtx2560 squareroot 45E+3 -> 2.1E+2 Inexact Rounded -sqtx2561 squareroot 0.46 -> 0.68 Inexact Rounded -sqtx2562 squareroot 0.046 -> 0.21 Inexact Rounded -sqtx2563 squareroot 46.0E-1 -> 2.1 Inexact Rounded -sqtx2564 squareroot 46.00E-2 -> 0.68 Inexact Rounded -sqtx2565 squareroot 46E-3 -> 0.21 Inexact Rounded -sqtx2566 squareroot 46E+1 -> 21 Inexact Rounded -sqtx2567 squareroot 46E+2 -> 68 Inexact Rounded -sqtx2568 squareroot 46E+3 -> 2.1E+2 Inexact Rounded -sqtx2569 squareroot 0.47 -> 0.69 Inexact Rounded -sqtx2570 squareroot 0.047 -> 0.22 Inexact Rounded -sqtx2571 squareroot 47.0E-1 -> 2.2 Inexact Rounded -sqtx2572 squareroot 47.00E-2 -> 0.69 Inexact Rounded -sqtx2573 squareroot 47E-3 -> 0.22 Inexact Rounded -sqtx2574 squareroot 47E+1 -> 22 Inexact Rounded -sqtx2575 squareroot 47E+2 -> 69 Inexact Rounded -sqtx2576 squareroot 47E+3 -> 2.2E+2 Inexact Rounded -sqtx2577 squareroot 0.48 -> 0.69 Inexact Rounded -sqtx2578 squareroot 0.048 -> 0.22 Inexact Rounded -sqtx2579 squareroot 48.0E-1 -> 2.2 Inexact Rounded -sqtx2580 squareroot 48.00E-2 -> 0.69 Inexact Rounded -sqtx2581 squareroot 48E-3 -> 0.22 Inexact Rounded -sqtx2582 squareroot 48E+1 -> 22 Inexact Rounded -sqtx2583 squareroot 48E+2 -> 69 Inexact Rounded -sqtx2584 squareroot 48E+3 -> 2.2E+2 Inexact Rounded -sqtx2585 squareroot 0.49 -> 0.7 -sqtx2586 squareroot 0.049 -> 0.22 Inexact Rounded -sqtx2587 squareroot 49.0E-1 -> 2.2 Inexact Rounded -sqtx2588 squareroot 49.00E-2 -> 0.70 -sqtx2589 squareroot 49E-3 -> 0.22 Inexact Rounded -sqtx2590 squareroot 49E+1 -> 22 Inexact Rounded -sqtx2591 squareroot 49E+2 -> 7E+1 -sqtx2592 squareroot 49E+3 -> 2.2E+2 Inexact Rounded -sqtx2593 squareroot 0.50 -> 0.71 Inexact Rounded -sqtx2594 squareroot 0.050 -> 0.22 Inexact Rounded -sqtx2595 squareroot 50.0E-1 -> 2.2 Inexact Rounded -sqtx2596 squareroot 50.00E-2 -> 0.71 Inexact Rounded -sqtx2597 squareroot 50E-3 -> 0.22 Inexact Rounded -sqtx2598 squareroot 50E+1 -> 22 Inexact Rounded -sqtx2599 squareroot 50E+2 -> 71 Inexact Rounded -sqtx2600 squareroot 50E+3 -> 2.2E+2 Inexact Rounded -sqtx2601 squareroot 0.51 -> 0.71 Inexact Rounded -sqtx2602 squareroot 0.051 -> 0.23 Inexact Rounded -sqtx2603 squareroot 51.0E-1 -> 2.3 Inexact Rounded -sqtx2604 squareroot 51.00E-2 -> 0.71 Inexact Rounded -sqtx2605 squareroot 51E-3 -> 0.23 Inexact Rounded -sqtx2606 squareroot 51E+1 -> 23 Inexact Rounded -sqtx2607 squareroot 51E+2 -> 71 Inexact Rounded -sqtx2608 squareroot 51E+3 -> 2.3E+2 Inexact Rounded -sqtx2609 squareroot 0.52 -> 0.72 Inexact Rounded -sqtx2610 squareroot 0.052 -> 0.23 Inexact Rounded -sqtx2611 squareroot 52.0E-1 -> 2.3 Inexact Rounded -sqtx2612 squareroot 52.00E-2 -> 0.72 Inexact Rounded -sqtx2613 squareroot 52E-3 -> 0.23 Inexact Rounded -sqtx2614 squareroot 52E+1 -> 23 Inexact Rounded -sqtx2615 squareroot 52E+2 -> 72 Inexact Rounded -sqtx2616 squareroot 52E+3 -> 2.3E+2 Inexact Rounded -sqtx2617 squareroot 0.53 -> 0.73 Inexact Rounded -sqtx2618 squareroot 0.053 -> 0.23 Inexact Rounded -sqtx2619 squareroot 53.0E-1 -> 2.3 Inexact Rounded -sqtx2620 squareroot 53.00E-2 -> 0.73 Inexact Rounded -sqtx2621 squareroot 53E-3 -> 0.23 Inexact Rounded -sqtx2622 squareroot 53E+1 -> 23 Inexact Rounded -sqtx2623 squareroot 53E+2 -> 73 Inexact Rounded -sqtx2624 squareroot 53E+3 -> 2.3E+2 Inexact Rounded -sqtx2625 squareroot 0.54 -> 0.73 Inexact Rounded -sqtx2626 squareroot 0.054 -> 0.23 Inexact Rounded -sqtx2627 squareroot 54.0E-1 -> 2.3 Inexact Rounded -sqtx2628 squareroot 54.00E-2 -> 0.73 Inexact Rounded -sqtx2629 squareroot 54E-3 -> 0.23 Inexact Rounded -sqtx2630 squareroot 54E+1 -> 23 Inexact Rounded -sqtx2631 squareroot 54E+2 -> 73 Inexact Rounded -sqtx2632 squareroot 54E+3 -> 2.3E+2 Inexact Rounded -sqtx2633 squareroot 0.55 -> 0.74 Inexact Rounded -sqtx2634 squareroot 0.055 -> 0.23 Inexact Rounded -sqtx2635 squareroot 55.0E-1 -> 2.3 Inexact Rounded -sqtx2636 squareroot 55.00E-2 -> 0.74 Inexact Rounded -sqtx2637 squareroot 55E-3 -> 0.23 Inexact Rounded -sqtx2638 squareroot 55E+1 -> 23 Inexact Rounded -sqtx2639 squareroot 55E+2 -> 74 Inexact Rounded -sqtx2640 squareroot 55E+3 -> 2.3E+2 Inexact Rounded -sqtx2641 squareroot 0.56 -> 0.75 Inexact Rounded -sqtx2642 squareroot 0.056 -> 0.24 Inexact Rounded -sqtx2643 squareroot 56.0E-1 -> 2.4 Inexact Rounded -sqtx2644 squareroot 56.00E-2 -> 0.75 Inexact Rounded -sqtx2645 squareroot 56E-3 -> 0.24 Inexact Rounded -sqtx2646 squareroot 56E+1 -> 24 Inexact Rounded -sqtx2647 squareroot 56E+2 -> 75 Inexact Rounded -sqtx2648 squareroot 56E+3 -> 2.4E+2 Inexact Rounded -sqtx2649 squareroot 0.57 -> 0.75 Inexact Rounded -sqtx2650 squareroot 0.057 -> 0.24 Inexact Rounded -sqtx2651 squareroot 57.0E-1 -> 2.4 Inexact Rounded -sqtx2652 squareroot 57.00E-2 -> 0.75 Inexact Rounded -sqtx2653 squareroot 57E-3 -> 0.24 Inexact Rounded -sqtx2654 squareroot 57E+1 -> 24 Inexact Rounded -sqtx2655 squareroot 57E+2 -> 75 Inexact Rounded -sqtx2656 squareroot 57E+3 -> 2.4E+2 Inexact Rounded -sqtx2657 squareroot 0.58 -> 0.76 Inexact Rounded -sqtx2658 squareroot 0.058 -> 0.24 Inexact Rounded -sqtx2659 squareroot 58.0E-1 -> 2.4 Inexact Rounded -sqtx2660 squareroot 58.00E-2 -> 0.76 Inexact Rounded -sqtx2661 squareroot 58E-3 -> 0.24 Inexact Rounded -sqtx2662 squareroot 58E+1 -> 24 Inexact Rounded -sqtx2663 squareroot 58E+2 -> 76 Inexact Rounded -sqtx2664 squareroot 58E+3 -> 2.4E+2 Inexact Rounded -sqtx2665 squareroot 0.59 -> 0.77 Inexact Rounded -sqtx2666 squareroot 0.059 -> 0.24 Inexact Rounded -sqtx2667 squareroot 59.0E-1 -> 2.4 Inexact Rounded -sqtx2668 squareroot 59.00E-2 -> 0.77 Inexact Rounded -sqtx2669 squareroot 59E-3 -> 0.24 Inexact Rounded -sqtx2670 squareroot 59E+1 -> 24 Inexact Rounded -sqtx2671 squareroot 59E+2 -> 77 Inexact Rounded -sqtx2672 squareroot 59E+3 -> 2.4E+2 Inexact Rounded -sqtx2673 squareroot 0.60 -> 0.77 Inexact Rounded -sqtx2674 squareroot 0.060 -> 0.24 Inexact Rounded -sqtx2675 squareroot 60.0E-1 -> 2.4 Inexact Rounded -sqtx2676 squareroot 60.00E-2 -> 0.77 Inexact Rounded -sqtx2677 squareroot 60E-3 -> 0.24 Inexact Rounded -sqtx2678 squareroot 60E+1 -> 24 Inexact Rounded -sqtx2679 squareroot 60E+2 -> 77 Inexact Rounded -sqtx2680 squareroot 60E+3 -> 2.4E+2 Inexact Rounded -sqtx2681 squareroot 0.61 -> 0.78 Inexact Rounded -sqtx2682 squareroot 0.061 -> 0.25 Inexact Rounded -sqtx2683 squareroot 61.0E-1 -> 2.5 Inexact Rounded -sqtx2684 squareroot 61.00E-2 -> 0.78 Inexact Rounded -sqtx2685 squareroot 61E-3 -> 0.25 Inexact Rounded -sqtx2686 squareroot 61E+1 -> 25 Inexact Rounded -sqtx2687 squareroot 61E+2 -> 78 Inexact Rounded -sqtx2688 squareroot 61E+3 -> 2.5E+2 Inexact Rounded -sqtx2689 squareroot 0.62 -> 0.79 Inexact Rounded -sqtx2690 squareroot 0.062 -> 0.25 Inexact Rounded -sqtx2691 squareroot 62.0E-1 -> 2.5 Inexact Rounded -sqtx2692 squareroot 62.00E-2 -> 0.79 Inexact Rounded -sqtx2693 squareroot 62E-3 -> 0.25 Inexact Rounded -sqtx2694 squareroot 62E+1 -> 25 Inexact Rounded -sqtx2695 squareroot 62E+2 -> 79 Inexact Rounded -sqtx2696 squareroot 62E+3 -> 2.5E+2 Inexact Rounded -sqtx2697 squareroot 0.63 -> 0.79 Inexact Rounded -sqtx2698 squareroot 0.063 -> 0.25 Inexact Rounded -sqtx2699 squareroot 63.0E-1 -> 2.5 Inexact Rounded -sqtx2700 squareroot 63.00E-2 -> 0.79 Inexact Rounded -sqtx2701 squareroot 63E-3 -> 0.25 Inexact Rounded -sqtx2702 squareroot 63E+1 -> 25 Inexact Rounded -sqtx2703 squareroot 63E+2 -> 79 Inexact Rounded -sqtx2704 squareroot 63E+3 -> 2.5E+2 Inexact Rounded -sqtx2705 squareroot 0.64 -> 0.8 -sqtx2706 squareroot 0.064 -> 0.25 Inexact Rounded -sqtx2707 squareroot 64.0E-1 -> 2.5 Inexact Rounded -sqtx2708 squareroot 64.00E-2 -> 0.80 -sqtx2709 squareroot 64E-3 -> 0.25 Inexact Rounded -sqtx2710 squareroot 64E+1 -> 25 Inexact Rounded -sqtx2711 squareroot 64E+2 -> 8E+1 -sqtx2712 squareroot 64E+3 -> 2.5E+2 Inexact Rounded -sqtx2713 squareroot 0.65 -> 0.81 Inexact Rounded -sqtx2714 squareroot 0.065 -> 0.25 Inexact Rounded -sqtx2715 squareroot 65.0E-1 -> 2.5 Inexact Rounded -sqtx2716 squareroot 65.00E-2 -> 0.81 Inexact Rounded -sqtx2717 squareroot 65E-3 -> 0.25 Inexact Rounded -sqtx2718 squareroot 65E+1 -> 25 Inexact Rounded -sqtx2719 squareroot 65E+2 -> 81 Inexact Rounded -sqtx2720 squareroot 65E+3 -> 2.5E+2 Inexact Rounded -sqtx2721 squareroot 0.66 -> 0.81 Inexact Rounded -sqtx2722 squareroot 0.066 -> 0.26 Inexact Rounded -sqtx2723 squareroot 66.0E-1 -> 2.6 Inexact Rounded -sqtx2724 squareroot 66.00E-2 -> 0.81 Inexact Rounded -sqtx2725 squareroot 66E-3 -> 0.26 Inexact Rounded -sqtx2726 squareroot 66E+1 -> 26 Inexact Rounded -sqtx2727 squareroot 66E+2 -> 81 Inexact Rounded -sqtx2728 squareroot 66E+3 -> 2.6E+2 Inexact Rounded -sqtx2729 squareroot 0.67 -> 0.82 Inexact Rounded -sqtx2730 squareroot 0.067 -> 0.26 Inexact Rounded -sqtx2731 squareroot 67.0E-1 -> 2.6 Inexact Rounded -sqtx2732 squareroot 67.00E-2 -> 0.82 Inexact Rounded -sqtx2733 squareroot 67E-3 -> 0.26 Inexact Rounded -sqtx2734 squareroot 67E+1 -> 26 Inexact Rounded -sqtx2735 squareroot 67E+2 -> 82 Inexact Rounded -sqtx2736 squareroot 67E+3 -> 2.6E+2 Inexact Rounded -sqtx2737 squareroot 0.68 -> 0.82 Inexact Rounded -sqtx2738 squareroot 0.068 -> 0.26 Inexact Rounded -sqtx2739 squareroot 68.0E-1 -> 2.6 Inexact Rounded -sqtx2740 squareroot 68.00E-2 -> 0.82 Inexact Rounded -sqtx2741 squareroot 68E-3 -> 0.26 Inexact Rounded -sqtx2742 squareroot 68E+1 -> 26 Inexact Rounded -sqtx2743 squareroot 68E+2 -> 82 Inexact Rounded -sqtx2744 squareroot 68E+3 -> 2.6E+2 Inexact Rounded -sqtx2745 squareroot 0.69 -> 0.83 Inexact Rounded -sqtx2746 squareroot 0.069 -> 0.26 Inexact Rounded -sqtx2747 squareroot 69.0E-1 -> 2.6 Inexact Rounded -sqtx2748 squareroot 69.00E-2 -> 0.83 Inexact Rounded -sqtx2749 squareroot 69E-3 -> 0.26 Inexact Rounded -sqtx2750 squareroot 69E+1 -> 26 Inexact Rounded -sqtx2751 squareroot 69E+2 -> 83 Inexact Rounded -sqtx2752 squareroot 69E+3 -> 2.6E+2 Inexact Rounded -sqtx2753 squareroot 0.70 -> 0.84 Inexact Rounded -sqtx2754 squareroot 0.070 -> 0.26 Inexact Rounded -sqtx2755 squareroot 70.0E-1 -> 2.6 Inexact Rounded -sqtx2756 squareroot 70.00E-2 -> 0.84 Inexact Rounded -sqtx2757 squareroot 70E-3 -> 0.26 Inexact Rounded -sqtx2758 squareroot 70E+1 -> 26 Inexact Rounded -sqtx2759 squareroot 70E+2 -> 84 Inexact Rounded -sqtx2760 squareroot 70E+3 -> 2.6E+2 Inexact Rounded -sqtx2761 squareroot 0.71 -> 0.84 Inexact Rounded -sqtx2762 squareroot 0.071 -> 0.27 Inexact Rounded -sqtx2763 squareroot 71.0E-1 -> 2.7 Inexact Rounded -sqtx2764 squareroot 71.00E-2 -> 0.84 Inexact Rounded -sqtx2765 squareroot 71E-3 -> 0.27 Inexact Rounded -sqtx2766 squareroot 71E+1 -> 27 Inexact Rounded -sqtx2767 squareroot 71E+2 -> 84 Inexact Rounded -sqtx2768 squareroot 71E+3 -> 2.7E+2 Inexact Rounded -sqtx2769 squareroot 0.72 -> 0.85 Inexact Rounded -sqtx2770 squareroot 0.072 -> 0.27 Inexact Rounded -sqtx2771 squareroot 72.0E-1 -> 2.7 Inexact Rounded -sqtx2772 squareroot 72.00E-2 -> 0.85 Inexact Rounded -sqtx2773 squareroot 72E-3 -> 0.27 Inexact Rounded -sqtx2774 squareroot 72E+1 -> 27 Inexact Rounded -sqtx2775 squareroot 72E+2 -> 85 Inexact Rounded -sqtx2776 squareroot 72E+3 -> 2.7E+2 Inexact Rounded -sqtx2777 squareroot 0.73 -> 0.85 Inexact Rounded -sqtx2778 squareroot 0.073 -> 0.27 Inexact Rounded -sqtx2779 squareroot 73.0E-1 -> 2.7 Inexact Rounded -sqtx2780 squareroot 73.00E-2 -> 0.85 Inexact Rounded -sqtx2781 squareroot 73E-3 -> 0.27 Inexact Rounded -sqtx2782 squareroot 73E+1 -> 27 Inexact Rounded -sqtx2783 squareroot 73E+2 -> 85 Inexact Rounded -sqtx2784 squareroot 73E+3 -> 2.7E+2 Inexact Rounded -sqtx2785 squareroot 0.74 -> 0.86 Inexact Rounded -sqtx2786 squareroot 0.074 -> 0.27 Inexact Rounded -sqtx2787 squareroot 74.0E-1 -> 2.7 Inexact Rounded -sqtx2788 squareroot 74.00E-2 -> 0.86 Inexact Rounded -sqtx2789 squareroot 74E-3 -> 0.27 Inexact Rounded -sqtx2790 squareroot 74E+1 -> 27 Inexact Rounded -sqtx2791 squareroot 74E+2 -> 86 Inexact Rounded -sqtx2792 squareroot 74E+3 -> 2.7E+2 Inexact Rounded -sqtx2793 squareroot 0.75 -> 0.87 Inexact Rounded -sqtx2794 squareroot 0.075 -> 0.27 Inexact Rounded -sqtx2795 squareroot 75.0E-1 -> 2.7 Inexact Rounded -sqtx2796 squareroot 75.00E-2 -> 0.87 Inexact Rounded -sqtx2797 squareroot 75E-3 -> 0.27 Inexact Rounded -sqtx2798 squareroot 75E+1 -> 27 Inexact Rounded -sqtx2799 squareroot 75E+2 -> 87 Inexact Rounded -sqtx2800 squareroot 75E+3 -> 2.7E+2 Inexact Rounded -sqtx2801 squareroot 0.76 -> 0.87 Inexact Rounded -sqtx2802 squareroot 0.076 -> 0.28 Inexact Rounded -sqtx2803 squareroot 76.0E-1 -> 2.8 Inexact Rounded -sqtx2804 squareroot 76.00E-2 -> 0.87 Inexact Rounded -sqtx2805 squareroot 76E-3 -> 0.28 Inexact Rounded -sqtx2806 squareroot 76E+1 -> 28 Inexact Rounded -sqtx2807 squareroot 76E+2 -> 87 Inexact Rounded -sqtx2808 squareroot 76E+3 -> 2.8E+2 Inexact Rounded -sqtx2809 squareroot 0.77 -> 0.88 Inexact Rounded -sqtx2810 squareroot 0.077 -> 0.28 Inexact Rounded -sqtx2811 squareroot 77.0E-1 -> 2.8 Inexact Rounded -sqtx2812 squareroot 77.00E-2 -> 0.88 Inexact Rounded -sqtx2813 squareroot 77E-3 -> 0.28 Inexact Rounded -sqtx2814 squareroot 77E+1 -> 28 Inexact Rounded -sqtx2815 squareroot 77E+2 -> 88 Inexact Rounded -sqtx2816 squareroot 77E+3 -> 2.8E+2 Inexact Rounded -sqtx2817 squareroot 0.78 -> 0.88 Inexact Rounded -sqtx2818 squareroot 0.078 -> 0.28 Inexact Rounded -sqtx2819 squareroot 78.0E-1 -> 2.8 Inexact Rounded -sqtx2820 squareroot 78.00E-2 -> 0.88 Inexact Rounded -sqtx2821 squareroot 78E-3 -> 0.28 Inexact Rounded -sqtx2822 squareroot 78E+1 -> 28 Inexact Rounded -sqtx2823 squareroot 78E+2 -> 88 Inexact Rounded -sqtx2824 squareroot 78E+3 -> 2.8E+2 Inexact Rounded -sqtx2825 squareroot 0.79 -> 0.89 Inexact Rounded -sqtx2826 squareroot 0.079 -> 0.28 Inexact Rounded -sqtx2827 squareroot 79.0E-1 -> 2.8 Inexact Rounded -sqtx2828 squareroot 79.00E-2 -> 0.89 Inexact Rounded -sqtx2829 squareroot 79E-3 -> 0.28 Inexact Rounded -sqtx2830 squareroot 79E+1 -> 28 Inexact Rounded -sqtx2831 squareroot 79E+2 -> 89 Inexact Rounded -sqtx2832 squareroot 79E+3 -> 2.8E+2 Inexact Rounded -sqtx2833 squareroot 0.80 -> 0.89 Inexact Rounded -sqtx2834 squareroot 0.080 -> 0.28 Inexact Rounded -sqtx2835 squareroot 80.0E-1 -> 2.8 Inexact Rounded -sqtx2836 squareroot 80.00E-2 -> 0.89 Inexact Rounded -sqtx2837 squareroot 80E-3 -> 0.28 Inexact Rounded -sqtx2838 squareroot 80E+1 -> 28 Inexact Rounded -sqtx2839 squareroot 80E+2 -> 89 Inexact Rounded -sqtx2840 squareroot 80E+3 -> 2.8E+2 Inexact Rounded -sqtx2841 squareroot 0.81 -> 0.9 -sqtx2842 squareroot 0.081 -> 0.28 Inexact Rounded -sqtx2843 squareroot 81.0E-1 -> 2.8 Inexact Rounded -sqtx2844 squareroot 81.00E-2 -> 0.90 -sqtx2845 squareroot 81E-3 -> 0.28 Inexact Rounded -sqtx2846 squareroot 81E+1 -> 28 Inexact Rounded -sqtx2847 squareroot 81E+2 -> 9E+1 -sqtx2848 squareroot 81E+3 -> 2.8E+2 Inexact Rounded -sqtx2849 squareroot 0.82 -> 0.91 Inexact Rounded -sqtx2850 squareroot 0.082 -> 0.29 Inexact Rounded -sqtx2851 squareroot 82.0E-1 -> 2.9 Inexact Rounded -sqtx2852 squareroot 82.00E-2 -> 0.91 Inexact Rounded -sqtx2853 squareroot 82E-3 -> 0.29 Inexact Rounded -sqtx2854 squareroot 82E+1 -> 29 Inexact Rounded -sqtx2855 squareroot 82E+2 -> 91 Inexact Rounded -sqtx2856 squareroot 82E+3 -> 2.9E+2 Inexact Rounded -sqtx2857 squareroot 0.83 -> 0.91 Inexact Rounded -sqtx2858 squareroot 0.083 -> 0.29 Inexact Rounded -sqtx2859 squareroot 83.0E-1 -> 2.9 Inexact Rounded -sqtx2860 squareroot 83.00E-2 -> 0.91 Inexact Rounded -sqtx2861 squareroot 83E-3 -> 0.29 Inexact Rounded -sqtx2862 squareroot 83E+1 -> 29 Inexact Rounded -sqtx2863 squareroot 83E+2 -> 91 Inexact Rounded -sqtx2864 squareroot 83E+3 -> 2.9E+2 Inexact Rounded -sqtx2865 squareroot 0.84 -> 0.92 Inexact Rounded -sqtx2866 squareroot 0.084 -> 0.29 Inexact Rounded -sqtx2867 squareroot 84.0E-1 -> 2.9 Inexact Rounded -sqtx2868 squareroot 84.00E-2 -> 0.92 Inexact Rounded -sqtx2869 squareroot 84E-3 -> 0.29 Inexact Rounded -sqtx2870 squareroot 84E+1 -> 29 Inexact Rounded -sqtx2871 squareroot 84E+2 -> 92 Inexact Rounded -sqtx2872 squareroot 84E+3 -> 2.9E+2 Inexact Rounded -sqtx2873 squareroot 0.85 -> 0.92 Inexact Rounded -sqtx2874 squareroot 0.085 -> 0.29 Inexact Rounded -sqtx2875 squareroot 85.0E-1 -> 2.9 Inexact Rounded -sqtx2876 squareroot 85.00E-2 -> 0.92 Inexact Rounded -sqtx2877 squareroot 85E-3 -> 0.29 Inexact Rounded -sqtx2878 squareroot 85E+1 -> 29 Inexact Rounded -sqtx2879 squareroot 85E+2 -> 92 Inexact Rounded -sqtx2880 squareroot 85E+3 -> 2.9E+2 Inexact Rounded -sqtx2881 squareroot 0.86 -> 0.93 Inexact Rounded -sqtx2882 squareroot 0.086 -> 0.29 Inexact Rounded -sqtx2883 squareroot 86.0E-1 -> 2.9 Inexact Rounded -sqtx2884 squareroot 86.00E-2 -> 0.93 Inexact Rounded -sqtx2885 squareroot 86E-3 -> 0.29 Inexact Rounded -sqtx2886 squareroot 86E+1 -> 29 Inexact Rounded -sqtx2887 squareroot 86E+2 -> 93 Inexact Rounded -sqtx2888 squareroot 86E+3 -> 2.9E+2 Inexact Rounded -sqtx2889 squareroot 0.87 -> 0.93 Inexact Rounded -sqtx2890 squareroot 0.087 -> 0.29 Inexact Rounded -sqtx2891 squareroot 87.0E-1 -> 2.9 Inexact Rounded -sqtx2892 squareroot 87.00E-2 -> 0.93 Inexact Rounded -sqtx2893 squareroot 87E-3 -> 0.29 Inexact Rounded -sqtx2894 squareroot 87E+1 -> 29 Inexact Rounded -sqtx2895 squareroot 87E+2 -> 93 Inexact Rounded -sqtx2896 squareroot 87E+3 -> 2.9E+2 Inexact Rounded -sqtx2897 squareroot 0.88 -> 0.94 Inexact Rounded -sqtx2898 squareroot 0.088 -> 0.30 Inexact Rounded -sqtx2899 squareroot 88.0E-1 -> 3.0 Inexact Rounded -sqtx2900 squareroot 88.00E-2 -> 0.94 Inexact Rounded -sqtx2901 squareroot 88E-3 -> 0.30 Inexact Rounded -sqtx2902 squareroot 88E+1 -> 30 Inexact Rounded -sqtx2903 squareroot 88E+2 -> 94 Inexact Rounded -sqtx2904 squareroot 88E+3 -> 3.0E+2 Inexact Rounded -sqtx2905 squareroot 0.89 -> 0.94 Inexact Rounded -sqtx2906 squareroot 0.089 -> 0.30 Inexact Rounded -sqtx2907 squareroot 89.0E-1 -> 3.0 Inexact Rounded -sqtx2908 squareroot 89.00E-2 -> 0.94 Inexact Rounded -sqtx2909 squareroot 89E-3 -> 0.30 Inexact Rounded -sqtx2910 squareroot 89E+1 -> 30 Inexact Rounded -sqtx2911 squareroot 89E+2 -> 94 Inexact Rounded -sqtx2912 squareroot 89E+3 -> 3.0E+2 Inexact Rounded -sqtx2913 squareroot 0.90 -> 0.95 Inexact Rounded -sqtx2914 squareroot 0.090 -> 0.30 -sqtx2915 squareroot 90.0E-1 -> 3.0 -sqtx2916 squareroot 90.00E-2 -> 0.95 Inexact Rounded -sqtx2917 squareroot 90E-3 -> 0.30 -sqtx2918 squareroot 90E+1 -> 30 -sqtx2919 squareroot 90E+2 -> 95 Inexact Rounded -sqtx2920 squareroot 90E+3 -> 3.0E+2 -sqtx2921 squareroot 0.91 -> 0.95 Inexact Rounded -sqtx2922 squareroot 0.091 -> 0.30 Inexact Rounded -sqtx2923 squareroot 91.0E-1 -> 3.0 Inexact Rounded -sqtx2924 squareroot 91.00E-2 -> 0.95 Inexact Rounded -sqtx2925 squareroot 91E-3 -> 0.30 Inexact Rounded -sqtx2926 squareroot 91E+1 -> 30 Inexact Rounded -sqtx2927 squareroot 91E+2 -> 95 Inexact Rounded -sqtx2928 squareroot 91E+3 -> 3.0E+2 Inexact Rounded -sqtx2929 squareroot 0.92 -> 0.96 Inexact Rounded -sqtx2930 squareroot 0.092 -> 0.30 Inexact Rounded -sqtx2931 squareroot 92.0E-1 -> 3.0 Inexact Rounded -sqtx2932 squareroot 92.00E-2 -> 0.96 Inexact Rounded -sqtx2933 squareroot 92E-3 -> 0.30 Inexact Rounded -sqtx2934 squareroot 92E+1 -> 30 Inexact Rounded -sqtx2935 squareroot 92E+2 -> 96 Inexact Rounded -sqtx2936 squareroot 92E+3 -> 3.0E+2 Inexact Rounded -sqtx2937 squareroot 0.93 -> 0.96 Inexact Rounded -sqtx2938 squareroot 0.093 -> 0.30 Inexact Rounded -sqtx2939 squareroot 93.0E-1 -> 3.0 Inexact Rounded -sqtx2940 squareroot 93.00E-2 -> 0.96 Inexact Rounded -sqtx2941 squareroot 93E-3 -> 0.30 Inexact Rounded -sqtx2942 squareroot 93E+1 -> 30 Inexact Rounded -sqtx2943 squareroot 93E+2 -> 96 Inexact Rounded -sqtx2944 squareroot 93E+3 -> 3.0E+2 Inexact Rounded -sqtx2945 squareroot 0.94 -> 0.97 Inexact Rounded -sqtx2946 squareroot 0.094 -> 0.31 Inexact Rounded -sqtx2947 squareroot 94.0E-1 -> 3.1 Inexact Rounded -sqtx2948 squareroot 94.00E-2 -> 0.97 Inexact Rounded -sqtx2949 squareroot 94E-3 -> 0.31 Inexact Rounded -sqtx2950 squareroot 94E+1 -> 31 Inexact Rounded -sqtx2951 squareroot 94E+2 -> 97 Inexact Rounded -sqtx2952 squareroot 94E+3 -> 3.1E+2 Inexact Rounded -sqtx2953 squareroot 0.95 -> 0.97 Inexact Rounded -sqtx2954 squareroot 0.095 -> 0.31 Inexact Rounded -sqtx2955 squareroot 95.0E-1 -> 3.1 Inexact Rounded -sqtx2956 squareroot 95.00E-2 -> 0.97 Inexact Rounded -sqtx2957 squareroot 95E-3 -> 0.31 Inexact Rounded -sqtx2958 squareroot 95E+1 -> 31 Inexact Rounded -sqtx2959 squareroot 95E+2 -> 97 Inexact Rounded -sqtx2960 squareroot 95E+3 -> 3.1E+2 Inexact Rounded -sqtx2961 squareroot 0.96 -> 0.98 Inexact Rounded -sqtx2962 squareroot 0.096 -> 0.31 Inexact Rounded -sqtx2963 squareroot 96.0E-1 -> 3.1 Inexact Rounded -sqtx2964 squareroot 96.00E-2 -> 0.98 Inexact Rounded -sqtx2965 squareroot 96E-3 -> 0.31 Inexact Rounded -sqtx2966 squareroot 96E+1 -> 31 Inexact Rounded -sqtx2967 squareroot 96E+2 -> 98 Inexact Rounded -sqtx2968 squareroot 96E+3 -> 3.1E+2 Inexact Rounded -sqtx2969 squareroot 0.97 -> 0.98 Inexact Rounded -sqtx2970 squareroot 0.097 -> 0.31 Inexact Rounded -sqtx2971 squareroot 97.0E-1 -> 3.1 Inexact Rounded -sqtx2972 squareroot 97.00E-2 -> 0.98 Inexact Rounded -sqtx2973 squareroot 97E-3 -> 0.31 Inexact Rounded -sqtx2974 squareroot 97E+1 -> 31 Inexact Rounded -sqtx2975 squareroot 97E+2 -> 98 Inexact Rounded -sqtx2976 squareroot 97E+3 -> 3.1E+2 Inexact Rounded -sqtx2977 squareroot 0.98 -> 0.99 Inexact Rounded -sqtx2978 squareroot 0.098 -> 0.31 Inexact Rounded -sqtx2979 squareroot 98.0E-1 -> 3.1 Inexact Rounded -sqtx2980 squareroot 98.00E-2 -> 0.99 Inexact Rounded -sqtx2981 squareroot 98E-3 -> 0.31 Inexact Rounded -sqtx2982 squareroot 98E+1 -> 31 Inexact Rounded -sqtx2983 squareroot 98E+2 -> 99 Inexact Rounded -sqtx2984 squareroot 98E+3 -> 3.1E+2 Inexact Rounded -sqtx2985 squareroot 0.99 -> 0.99 Inexact Rounded -sqtx2986 squareroot 0.099 -> 0.31 Inexact Rounded -sqtx2987 squareroot 99.0E-1 -> 3.1 Inexact Rounded -sqtx2988 squareroot 99.00E-2 -> 0.99 Inexact Rounded -sqtx2989 squareroot 99E-3 -> 0.31 Inexact Rounded -sqtx2990 squareroot 99E+1 -> 31 Inexact Rounded -sqtx2991 squareroot 99E+2 -> 99 Inexact Rounded -sqtx2992 squareroot 99E+3 -> 3.1E+2 Inexact Rounded - --- Precision 3 squareroot tests [exhaustive, f and f/10] -rounding: half_even -maxExponent: 999 -minexponent: -999 -precision: 3 -sqtx3001 squareroot 0.1 -> 0.316 Inexact Rounded -sqtx3002 squareroot 0.01 -> 0.1 -sqtx3003 squareroot 0.2 -> 0.447 Inexact Rounded -sqtx3004 squareroot 0.02 -> 0.141 Inexact Rounded -sqtx3005 squareroot 0.3 -> 0.548 Inexact Rounded -sqtx3006 squareroot 0.03 -> 0.173 Inexact Rounded -sqtx3007 squareroot 0.4 -> 0.632 Inexact Rounded -sqtx3008 squareroot 0.04 -> 0.2 -sqtx3009 squareroot 0.5 -> 0.707 Inexact Rounded -sqtx3010 squareroot 0.05 -> 0.224 Inexact Rounded -sqtx3011 squareroot 0.6 -> 0.775 Inexact Rounded -sqtx3012 squareroot 0.06 -> 0.245 Inexact Rounded -sqtx3013 squareroot 0.7 -> 0.837 Inexact Rounded -sqtx3014 squareroot 0.07 -> 0.265 Inexact Rounded -sqtx3015 squareroot 0.8 -> 0.894 Inexact Rounded -sqtx3016 squareroot 0.08 -> 0.283 Inexact Rounded -sqtx3017 squareroot 0.9 -> 0.949 Inexact Rounded -sqtx3018 squareroot 0.09 -> 0.3 -sqtx3019 squareroot 0.11 -> 0.332 Inexact Rounded -sqtx3020 squareroot 0.011 -> 0.105 Inexact Rounded -sqtx3021 squareroot 0.12 -> 0.346 Inexact Rounded -sqtx3022 squareroot 0.012 -> 0.110 Inexact Rounded -sqtx3023 squareroot 0.13 -> 0.361 Inexact Rounded -sqtx3024 squareroot 0.013 -> 0.114 Inexact Rounded -sqtx3025 squareroot 0.14 -> 0.374 Inexact Rounded -sqtx3026 squareroot 0.014 -> 0.118 Inexact Rounded -sqtx3027 squareroot 0.15 -> 0.387 Inexact Rounded -sqtx3028 squareroot 0.015 -> 0.122 Inexact Rounded -sqtx3029 squareroot 0.16 -> 0.4 -sqtx3030 squareroot 0.016 -> 0.126 Inexact Rounded -sqtx3031 squareroot 0.17 -> 0.412 Inexact Rounded -sqtx3032 squareroot 0.017 -> 0.130 Inexact Rounded -sqtx3033 squareroot 0.18 -> 0.424 Inexact Rounded -sqtx3034 squareroot 0.018 -> 0.134 Inexact Rounded -sqtx3035 squareroot 0.19 -> 0.436 Inexact Rounded -sqtx3036 squareroot 0.019 -> 0.138 Inexact Rounded -sqtx3037 squareroot 0.21 -> 0.458 Inexact Rounded -sqtx3038 squareroot 0.021 -> 0.145 Inexact Rounded -sqtx3039 squareroot 0.22 -> 0.469 Inexact Rounded -sqtx3040 squareroot 0.022 -> 0.148 Inexact Rounded -sqtx3041 squareroot 0.23 -> 0.480 Inexact Rounded -sqtx3042 squareroot 0.023 -> 0.152 Inexact Rounded -sqtx3043 squareroot 0.24 -> 0.490 Inexact Rounded -sqtx3044 squareroot 0.024 -> 0.155 Inexact Rounded -sqtx3045 squareroot 0.25 -> 0.5 -sqtx3046 squareroot 0.025 -> 0.158 Inexact Rounded -sqtx3047 squareroot 0.26 -> 0.510 Inexact Rounded -sqtx3048 squareroot 0.026 -> 0.161 Inexact Rounded -sqtx3049 squareroot 0.27 -> 0.520 Inexact Rounded -sqtx3050 squareroot 0.027 -> 0.164 Inexact Rounded -sqtx3051 squareroot 0.28 -> 0.529 Inexact Rounded -sqtx3052 squareroot 0.028 -> 0.167 Inexact Rounded -sqtx3053 squareroot 0.29 -> 0.539 Inexact Rounded -sqtx3054 squareroot 0.029 -> 0.170 Inexact Rounded -sqtx3055 squareroot 0.31 -> 0.557 Inexact Rounded -sqtx3056 squareroot 0.031 -> 0.176 Inexact Rounded -sqtx3057 squareroot 0.32 -> 0.566 Inexact Rounded -sqtx3058 squareroot 0.032 -> 0.179 Inexact Rounded -sqtx3059 squareroot 0.33 -> 0.574 Inexact Rounded -sqtx3060 squareroot 0.033 -> 0.182 Inexact Rounded -sqtx3061 squareroot 0.34 -> 0.583 Inexact Rounded -sqtx3062 squareroot 0.034 -> 0.184 Inexact Rounded -sqtx3063 squareroot 0.35 -> 0.592 Inexact Rounded -sqtx3064 squareroot 0.035 -> 0.187 Inexact Rounded -sqtx3065 squareroot 0.36 -> 0.6 -sqtx3066 squareroot 0.036 -> 0.190 Inexact Rounded -sqtx3067 squareroot 0.37 -> 0.608 Inexact Rounded -sqtx3068 squareroot 0.037 -> 0.192 Inexact Rounded -sqtx3069 squareroot 0.38 -> 0.616 Inexact Rounded -sqtx3070 squareroot 0.038 -> 0.195 Inexact Rounded -sqtx3071 squareroot 0.39 -> 0.624 Inexact Rounded -sqtx3072 squareroot 0.039 -> 0.197 Inexact Rounded -sqtx3073 squareroot 0.41 -> 0.640 Inexact Rounded -sqtx3074 squareroot 0.041 -> 0.202 Inexact Rounded -sqtx3075 squareroot 0.42 -> 0.648 Inexact Rounded -sqtx3076 squareroot 0.042 -> 0.205 Inexact Rounded -sqtx3077 squareroot 0.43 -> 0.656 Inexact Rounded -sqtx3078 squareroot 0.043 -> 0.207 Inexact Rounded -sqtx3079 squareroot 0.44 -> 0.663 Inexact Rounded -sqtx3080 squareroot 0.044 -> 0.210 Inexact Rounded -sqtx3081 squareroot 0.45 -> 0.671 Inexact Rounded -sqtx3082 squareroot 0.045 -> 0.212 Inexact Rounded -sqtx3083 squareroot 0.46 -> 0.678 Inexact Rounded -sqtx3084 squareroot 0.046 -> 0.214 Inexact Rounded -sqtx3085 squareroot 0.47 -> 0.686 Inexact Rounded -sqtx3086 squareroot 0.047 -> 0.217 Inexact Rounded -sqtx3087 squareroot 0.48 -> 0.693 Inexact Rounded -sqtx3088 squareroot 0.048 -> 0.219 Inexact Rounded -sqtx3089 squareroot 0.49 -> 0.7 -sqtx3090 squareroot 0.049 -> 0.221 Inexact Rounded -sqtx3091 squareroot 0.51 -> 0.714 Inexact Rounded -sqtx3092 squareroot 0.051 -> 0.226 Inexact Rounded -sqtx3093 squareroot 0.52 -> 0.721 Inexact Rounded -sqtx3094 squareroot 0.052 -> 0.228 Inexact Rounded -sqtx3095 squareroot 0.53 -> 0.728 Inexact Rounded -sqtx3096 squareroot 0.053 -> 0.230 Inexact Rounded -sqtx3097 squareroot 0.54 -> 0.735 Inexact Rounded -sqtx3098 squareroot 0.054 -> 0.232 Inexact Rounded -sqtx3099 squareroot 0.55 -> 0.742 Inexact Rounded -sqtx3100 squareroot 0.055 -> 0.235 Inexact Rounded -sqtx3101 squareroot 0.56 -> 0.748 Inexact Rounded -sqtx3102 squareroot 0.056 -> 0.237 Inexact Rounded -sqtx3103 squareroot 0.57 -> 0.755 Inexact Rounded -sqtx3104 squareroot 0.057 -> 0.239 Inexact Rounded -sqtx3105 squareroot 0.58 -> 0.762 Inexact Rounded -sqtx3106 squareroot 0.058 -> 0.241 Inexact Rounded -sqtx3107 squareroot 0.59 -> 0.768 Inexact Rounded -sqtx3108 squareroot 0.059 -> 0.243 Inexact Rounded -sqtx3109 squareroot 0.61 -> 0.781 Inexact Rounded -sqtx3110 squareroot 0.061 -> 0.247 Inexact Rounded -sqtx3111 squareroot 0.62 -> 0.787 Inexact Rounded -sqtx3112 squareroot 0.062 -> 0.249 Inexact Rounded -sqtx3113 squareroot 0.63 -> 0.794 Inexact Rounded -sqtx3114 squareroot 0.063 -> 0.251 Inexact Rounded -sqtx3115 squareroot 0.64 -> 0.8 -sqtx3116 squareroot 0.064 -> 0.253 Inexact Rounded -sqtx3117 squareroot 0.65 -> 0.806 Inexact Rounded -sqtx3118 squareroot 0.065 -> 0.255 Inexact Rounded -sqtx3119 squareroot 0.66 -> 0.812 Inexact Rounded -sqtx3120 squareroot 0.066 -> 0.257 Inexact Rounded -sqtx3121 squareroot 0.67 -> 0.819 Inexact Rounded -sqtx3122 squareroot 0.067 -> 0.259 Inexact Rounded -sqtx3123 squareroot 0.68 -> 0.825 Inexact Rounded -sqtx3124 squareroot 0.068 -> 0.261 Inexact Rounded -sqtx3125 squareroot 0.69 -> 0.831 Inexact Rounded -sqtx3126 squareroot 0.069 -> 0.263 Inexact Rounded -sqtx3127 squareroot 0.71 -> 0.843 Inexact Rounded -sqtx3128 squareroot 0.071 -> 0.266 Inexact Rounded -sqtx3129 squareroot 0.72 -> 0.849 Inexact Rounded -sqtx3130 squareroot 0.072 -> 0.268 Inexact Rounded -sqtx3131 squareroot 0.73 -> 0.854 Inexact Rounded -sqtx3132 squareroot 0.073 -> 0.270 Inexact Rounded -sqtx3133 squareroot 0.74 -> 0.860 Inexact Rounded -sqtx3134 squareroot 0.074 -> 0.272 Inexact Rounded -sqtx3135 squareroot 0.75 -> 0.866 Inexact Rounded -sqtx3136 squareroot 0.075 -> 0.274 Inexact Rounded -sqtx3137 squareroot 0.76 -> 0.872 Inexact Rounded -sqtx3138 squareroot 0.076 -> 0.276 Inexact Rounded -sqtx3139 squareroot 0.77 -> 0.877 Inexact Rounded -sqtx3140 squareroot 0.077 -> 0.277 Inexact Rounded -sqtx3141 squareroot 0.78 -> 0.883 Inexact Rounded -sqtx3142 squareroot 0.078 -> 0.279 Inexact Rounded -sqtx3143 squareroot 0.79 -> 0.889 Inexact Rounded -sqtx3144 squareroot 0.079 -> 0.281 Inexact Rounded -sqtx3145 squareroot 0.81 -> 0.9 -sqtx3146 squareroot 0.081 -> 0.285 Inexact Rounded -sqtx3147 squareroot 0.82 -> 0.906 Inexact Rounded -sqtx3148 squareroot 0.082 -> 0.286 Inexact Rounded -sqtx3149 squareroot 0.83 -> 0.911 Inexact Rounded -sqtx3150 squareroot 0.083 -> 0.288 Inexact Rounded -sqtx3151 squareroot 0.84 -> 0.917 Inexact Rounded -sqtx3152 squareroot 0.084 -> 0.290 Inexact Rounded -sqtx3153 squareroot 0.85 -> 0.922 Inexact Rounded -sqtx3154 squareroot 0.085 -> 0.292 Inexact Rounded -sqtx3155 squareroot 0.86 -> 0.927 Inexact Rounded -sqtx3156 squareroot 0.086 -> 0.293 Inexact Rounded -sqtx3157 squareroot 0.87 -> 0.933 Inexact Rounded -sqtx3158 squareroot 0.087 -> 0.295 Inexact Rounded -sqtx3159 squareroot 0.88 -> 0.938 Inexact Rounded -sqtx3160 squareroot 0.088 -> 0.297 Inexact Rounded -sqtx3161 squareroot 0.89 -> 0.943 Inexact Rounded -sqtx3162 squareroot 0.089 -> 0.298 Inexact Rounded -sqtx3163 squareroot 0.91 -> 0.954 Inexact Rounded -sqtx3164 squareroot 0.091 -> 0.302 Inexact Rounded -sqtx3165 squareroot 0.92 -> 0.959 Inexact Rounded -sqtx3166 squareroot 0.092 -> 0.303 Inexact Rounded -sqtx3167 squareroot 0.93 -> 0.964 Inexact Rounded -sqtx3168 squareroot 0.093 -> 0.305 Inexact Rounded -sqtx3169 squareroot 0.94 -> 0.970 Inexact Rounded -sqtx3170 squareroot 0.094 -> 0.307 Inexact Rounded -sqtx3171 squareroot 0.95 -> 0.975 Inexact Rounded -sqtx3172 squareroot 0.095 -> 0.308 Inexact Rounded -sqtx3173 squareroot 0.96 -> 0.980 Inexact Rounded -sqtx3174 squareroot 0.096 -> 0.310 Inexact Rounded -sqtx3175 squareroot 0.97 -> 0.985 Inexact Rounded -sqtx3176 squareroot 0.097 -> 0.311 Inexact Rounded -sqtx3177 squareroot 0.98 -> 0.990 Inexact Rounded -sqtx3178 squareroot 0.098 -> 0.313 Inexact Rounded -sqtx3179 squareroot 0.99 -> 0.995 Inexact Rounded -sqtx3180 squareroot 0.099 -> 0.315 Inexact Rounded -sqtx3181 squareroot 0.101 -> 0.318 Inexact Rounded -sqtx3182 squareroot 0.0101 -> 0.100 Inexact Rounded -sqtx3183 squareroot 0.102 -> 0.319 Inexact Rounded -sqtx3184 squareroot 0.0102 -> 0.101 Inexact Rounded -sqtx3185 squareroot 0.103 -> 0.321 Inexact Rounded -sqtx3186 squareroot 0.0103 -> 0.101 Inexact Rounded -sqtx3187 squareroot 0.104 -> 0.322 Inexact Rounded -sqtx3188 squareroot 0.0104 -> 0.102 Inexact Rounded -sqtx3189 squareroot 0.105 -> 0.324 Inexact Rounded -sqtx3190 squareroot 0.0105 -> 0.102 Inexact Rounded -sqtx3191 squareroot 0.106 -> 0.326 Inexact Rounded -sqtx3192 squareroot 0.0106 -> 0.103 Inexact Rounded -sqtx3193 squareroot 0.107 -> 0.327 Inexact Rounded -sqtx3194 squareroot 0.0107 -> 0.103 Inexact Rounded -sqtx3195 squareroot 0.108 -> 0.329 Inexact Rounded -sqtx3196 squareroot 0.0108 -> 0.104 Inexact Rounded -sqtx3197 squareroot 0.109 -> 0.330 Inexact Rounded -sqtx3198 squareroot 0.0109 -> 0.104 Inexact Rounded -sqtx3199 squareroot 0.111 -> 0.333 Inexact Rounded -sqtx3200 squareroot 0.0111 -> 0.105 Inexact Rounded -sqtx3201 squareroot 0.112 -> 0.335 Inexact Rounded -sqtx3202 squareroot 0.0112 -> 0.106 Inexact Rounded -sqtx3203 squareroot 0.113 -> 0.336 Inexact Rounded -sqtx3204 squareroot 0.0113 -> 0.106 Inexact Rounded -sqtx3205 squareroot 0.114 -> 0.338 Inexact Rounded -sqtx3206 squareroot 0.0114 -> 0.107 Inexact Rounded -sqtx3207 squareroot 0.115 -> 0.339 Inexact Rounded -sqtx3208 squareroot 0.0115 -> 0.107 Inexact Rounded -sqtx3209 squareroot 0.116 -> 0.341 Inexact Rounded -sqtx3210 squareroot 0.0116 -> 0.108 Inexact Rounded -sqtx3211 squareroot 0.117 -> 0.342 Inexact Rounded -sqtx3212 squareroot 0.0117 -> 0.108 Inexact Rounded -sqtx3213 squareroot 0.118 -> 0.344 Inexact Rounded -sqtx3214 squareroot 0.0118 -> 0.109 Inexact Rounded -sqtx3215 squareroot 0.119 -> 0.345 Inexact Rounded -sqtx3216 squareroot 0.0119 -> 0.109 Inexact Rounded -sqtx3217 squareroot 0.121 -> 0.348 Inexact Rounded -sqtx3218 squareroot 0.0121 -> 0.11 -sqtx3219 squareroot 0.122 -> 0.349 Inexact Rounded -sqtx3220 squareroot 0.0122 -> 0.110 Inexact Rounded -sqtx3221 squareroot 0.123 -> 0.351 Inexact Rounded -sqtx3222 squareroot 0.0123 -> 0.111 Inexact Rounded -sqtx3223 squareroot 0.124 -> 0.352 Inexact Rounded -sqtx3224 squareroot 0.0124 -> 0.111 Inexact Rounded -sqtx3225 squareroot 0.125 -> 0.354 Inexact Rounded -sqtx3226 squareroot 0.0125 -> 0.112 Inexact Rounded -sqtx3227 squareroot 0.126 -> 0.355 Inexact Rounded -sqtx3228 squareroot 0.0126 -> 0.112 Inexact Rounded -sqtx3229 squareroot 0.127 -> 0.356 Inexact Rounded -sqtx3230 squareroot 0.0127 -> 0.113 Inexact Rounded -sqtx3231 squareroot 0.128 -> 0.358 Inexact Rounded -sqtx3232 squareroot 0.0128 -> 0.113 Inexact Rounded -sqtx3233 squareroot 0.129 -> 0.359 Inexact Rounded -sqtx3234 squareroot 0.0129 -> 0.114 Inexact Rounded -sqtx3235 squareroot 0.131 -> 0.362 Inexact Rounded -sqtx3236 squareroot 0.0131 -> 0.114 Inexact Rounded -sqtx3237 squareroot 0.132 -> 0.363 Inexact Rounded -sqtx3238 squareroot 0.0132 -> 0.115 Inexact Rounded -sqtx3239 squareroot 0.133 -> 0.365 Inexact Rounded -sqtx3240 squareroot 0.0133 -> 0.115 Inexact Rounded -sqtx3241 squareroot 0.134 -> 0.366 Inexact Rounded -sqtx3242 squareroot 0.0134 -> 0.116 Inexact Rounded -sqtx3243 squareroot 0.135 -> 0.367 Inexact Rounded -sqtx3244 squareroot 0.0135 -> 0.116 Inexact Rounded -sqtx3245 squareroot 0.136 -> 0.369 Inexact Rounded -sqtx3246 squareroot 0.0136 -> 0.117 Inexact Rounded -sqtx3247 squareroot 0.137 -> 0.370 Inexact Rounded -sqtx3248 squareroot 0.0137 -> 0.117 Inexact Rounded -sqtx3249 squareroot 0.138 -> 0.371 Inexact Rounded -sqtx3250 squareroot 0.0138 -> 0.117 Inexact Rounded -sqtx3251 squareroot 0.139 -> 0.373 Inexact Rounded -sqtx3252 squareroot 0.0139 -> 0.118 Inexact Rounded -sqtx3253 squareroot 0.141 -> 0.375 Inexact Rounded -sqtx3254 squareroot 0.0141 -> 0.119 Inexact Rounded -sqtx3255 squareroot 0.142 -> 0.377 Inexact Rounded -sqtx3256 squareroot 0.0142 -> 0.119 Inexact Rounded -sqtx3257 squareroot 0.143 -> 0.378 Inexact Rounded -sqtx3258 squareroot 0.0143 -> 0.120 Inexact Rounded -sqtx3259 squareroot 0.144 -> 0.379 Inexact Rounded -sqtx3260 squareroot 0.0144 -> 0.12 -sqtx3261 squareroot 0.145 -> 0.381 Inexact Rounded -sqtx3262 squareroot 0.0145 -> 0.120 Inexact Rounded -sqtx3263 squareroot 0.146 -> 0.382 Inexact Rounded -sqtx3264 squareroot 0.0146 -> 0.121 Inexact Rounded -sqtx3265 squareroot 0.147 -> 0.383 Inexact Rounded -sqtx3266 squareroot 0.0147 -> 0.121 Inexact Rounded -sqtx3267 squareroot 0.148 -> 0.385 Inexact Rounded -sqtx3268 squareroot 0.0148 -> 0.122 Inexact Rounded -sqtx3269 squareroot 0.149 -> 0.386 Inexact Rounded -sqtx3270 squareroot 0.0149 -> 0.122 Inexact Rounded -sqtx3271 squareroot 0.151 -> 0.389 Inexact Rounded -sqtx3272 squareroot 0.0151 -> 0.123 Inexact Rounded -sqtx3273 squareroot 0.152 -> 0.390 Inexact Rounded -sqtx3274 squareroot 0.0152 -> 0.123 Inexact Rounded -sqtx3275 squareroot 0.153 -> 0.391 Inexact Rounded -sqtx3276 squareroot 0.0153 -> 0.124 Inexact Rounded -sqtx3277 squareroot 0.154 -> 0.392 Inexact Rounded -sqtx3278 squareroot 0.0154 -> 0.124 Inexact Rounded -sqtx3279 squareroot 0.155 -> 0.394 Inexact Rounded -sqtx3280 squareroot 0.0155 -> 0.124 Inexact Rounded -sqtx3281 squareroot 0.156 -> 0.395 Inexact Rounded -sqtx3282 squareroot 0.0156 -> 0.125 Inexact Rounded -sqtx3283 squareroot 0.157 -> 0.396 Inexact Rounded -sqtx3284 squareroot 0.0157 -> 0.125 Inexact Rounded -sqtx3285 squareroot 0.158 -> 0.397 Inexact Rounded -sqtx3286 squareroot 0.0158 -> 0.126 Inexact Rounded -sqtx3287 squareroot 0.159 -> 0.399 Inexact Rounded -sqtx3288 squareroot 0.0159 -> 0.126 Inexact Rounded -sqtx3289 squareroot 0.161 -> 0.401 Inexact Rounded -sqtx3290 squareroot 0.0161 -> 0.127 Inexact Rounded -sqtx3291 squareroot 0.162 -> 0.402 Inexact Rounded -sqtx3292 squareroot 0.0162 -> 0.127 Inexact Rounded -sqtx3293 squareroot 0.163 -> 0.404 Inexact Rounded -sqtx3294 squareroot 0.0163 -> 0.128 Inexact Rounded -sqtx3295 squareroot 0.164 -> 0.405 Inexact Rounded -sqtx3296 squareroot 0.0164 -> 0.128 Inexact Rounded -sqtx3297 squareroot 0.165 -> 0.406 Inexact Rounded -sqtx3298 squareroot 0.0165 -> 0.128 Inexact Rounded -sqtx3299 squareroot 0.166 -> 0.407 Inexact Rounded -sqtx3300 squareroot 0.0166 -> 0.129 Inexact Rounded -sqtx3301 squareroot 0.167 -> 0.409 Inexact Rounded -sqtx3302 squareroot 0.0167 -> 0.129 Inexact Rounded -sqtx3303 squareroot 0.168 -> 0.410 Inexact Rounded -sqtx3304 squareroot 0.0168 -> 0.130 Inexact Rounded -sqtx3305 squareroot 0.169 -> 0.411 Inexact Rounded -sqtx3306 squareroot 0.0169 -> 0.13 -sqtx3307 squareroot 0.171 -> 0.414 Inexact Rounded -sqtx3308 squareroot 0.0171 -> 0.131 Inexact Rounded -sqtx3309 squareroot 0.172 -> 0.415 Inexact Rounded -sqtx3310 squareroot 0.0172 -> 0.131 Inexact Rounded -sqtx3311 squareroot 0.173 -> 0.416 Inexact Rounded -sqtx3312 squareroot 0.0173 -> 0.132 Inexact Rounded -sqtx3313 squareroot 0.174 -> 0.417 Inexact Rounded -sqtx3314 squareroot 0.0174 -> 0.132 Inexact Rounded -sqtx3315 squareroot 0.175 -> 0.418 Inexact Rounded -sqtx3316 squareroot 0.0175 -> 0.132 Inexact Rounded -sqtx3317 squareroot 0.176 -> 0.420 Inexact Rounded -sqtx3318 squareroot 0.0176 -> 0.133 Inexact Rounded -sqtx3319 squareroot 0.177 -> 0.421 Inexact Rounded -sqtx3320 squareroot 0.0177 -> 0.133 Inexact Rounded -sqtx3321 squareroot 0.178 -> 0.422 Inexact Rounded -sqtx3322 squareroot 0.0178 -> 0.133 Inexact Rounded -sqtx3323 squareroot 0.179 -> 0.423 Inexact Rounded -sqtx3324 squareroot 0.0179 -> 0.134 Inexact Rounded -sqtx3325 squareroot 0.181 -> 0.425 Inexact Rounded -sqtx3326 squareroot 0.0181 -> 0.135 Inexact Rounded -sqtx3327 squareroot 0.182 -> 0.427 Inexact Rounded -sqtx3328 squareroot 0.0182 -> 0.135 Inexact Rounded -sqtx3329 squareroot 0.183 -> 0.428 Inexact Rounded -sqtx3330 squareroot 0.0183 -> 0.135 Inexact Rounded -sqtx3331 squareroot 0.184 -> 0.429 Inexact Rounded -sqtx3332 squareroot 0.0184 -> 0.136 Inexact Rounded -sqtx3333 squareroot 0.185 -> 0.430 Inexact Rounded -sqtx3334 squareroot 0.0185 -> 0.136 Inexact Rounded -sqtx3335 squareroot 0.186 -> 0.431 Inexact Rounded -sqtx3336 squareroot 0.0186 -> 0.136 Inexact Rounded -sqtx3337 squareroot 0.187 -> 0.432 Inexact Rounded -sqtx3338 squareroot 0.0187 -> 0.137 Inexact Rounded -sqtx3339 squareroot 0.188 -> 0.434 Inexact Rounded -sqtx3340 squareroot 0.0188 -> 0.137 Inexact Rounded -sqtx3341 squareroot 0.189 -> 0.435 Inexact Rounded -sqtx3342 squareroot 0.0189 -> 0.137 Inexact Rounded -sqtx3343 squareroot 0.191 -> 0.437 Inexact Rounded -sqtx3344 squareroot 0.0191 -> 0.138 Inexact Rounded -sqtx3345 squareroot 0.192 -> 0.438 Inexact Rounded -sqtx3346 squareroot 0.0192 -> 0.139 Inexact Rounded -sqtx3347 squareroot 0.193 -> 0.439 Inexact Rounded -sqtx3348 squareroot 0.0193 -> 0.139 Inexact Rounded -sqtx3349 squareroot 0.194 -> 0.440 Inexact Rounded -sqtx3350 squareroot 0.0194 -> 0.139 Inexact Rounded -sqtx3351 squareroot 0.195 -> 0.442 Inexact Rounded -sqtx3352 squareroot 0.0195 -> 0.140 Inexact Rounded -sqtx3353 squareroot 0.196 -> 0.443 Inexact Rounded -sqtx3354 squareroot 0.0196 -> 0.14 -sqtx3355 squareroot 0.197 -> 0.444 Inexact Rounded -sqtx3356 squareroot 0.0197 -> 0.140 Inexact Rounded -sqtx3357 squareroot 0.198 -> 0.445 Inexact Rounded -sqtx3358 squareroot 0.0198 -> 0.141 Inexact Rounded -sqtx3359 squareroot 0.199 -> 0.446 Inexact Rounded -sqtx3360 squareroot 0.0199 -> 0.141 Inexact Rounded -sqtx3361 squareroot 0.201 -> 0.448 Inexact Rounded -sqtx3362 squareroot 0.0201 -> 0.142 Inexact Rounded -sqtx3363 squareroot 0.202 -> 0.449 Inexact Rounded -sqtx3364 squareroot 0.0202 -> 0.142 Inexact Rounded -sqtx3365 squareroot 0.203 -> 0.451 Inexact Rounded -sqtx3366 squareroot 0.0203 -> 0.142 Inexact Rounded -sqtx3367 squareroot 0.204 -> 0.452 Inexact Rounded -sqtx3368 squareroot 0.0204 -> 0.143 Inexact Rounded -sqtx3369 squareroot 0.205 -> 0.453 Inexact Rounded -sqtx3370 squareroot 0.0205 -> 0.143 Inexact Rounded -sqtx3371 squareroot 0.206 -> 0.454 Inexact Rounded -sqtx3372 squareroot 0.0206 -> 0.144 Inexact Rounded -sqtx3373 squareroot 0.207 -> 0.455 Inexact Rounded -sqtx3374 squareroot 0.0207 -> 0.144 Inexact Rounded -sqtx3375 squareroot 0.208 -> 0.456 Inexact Rounded -sqtx3376 squareroot 0.0208 -> 0.144 Inexact Rounded -sqtx3377 squareroot 0.209 -> 0.457 Inexact Rounded -sqtx3378 squareroot 0.0209 -> 0.145 Inexact Rounded -sqtx3379 squareroot 0.211 -> 0.459 Inexact Rounded -sqtx3380 squareroot 0.0211 -> 0.145 Inexact Rounded -sqtx3381 squareroot 0.212 -> 0.460 Inexact Rounded -sqtx3382 squareroot 0.0212 -> 0.146 Inexact Rounded -sqtx3383 squareroot 0.213 -> 0.462 Inexact Rounded -sqtx3384 squareroot 0.0213 -> 0.146 Inexact Rounded -sqtx3385 squareroot 0.214 -> 0.463 Inexact Rounded -sqtx3386 squareroot 0.0214 -> 0.146 Inexact Rounded -sqtx3387 squareroot 0.215 -> 0.464 Inexact Rounded -sqtx3388 squareroot 0.0215 -> 0.147 Inexact Rounded -sqtx3389 squareroot 0.216 -> 0.465 Inexact Rounded -sqtx3390 squareroot 0.0216 -> 0.147 Inexact Rounded -sqtx3391 squareroot 0.217 -> 0.466 Inexact Rounded -sqtx3392 squareroot 0.0217 -> 0.147 Inexact Rounded -sqtx3393 squareroot 0.218 -> 0.467 Inexact Rounded -sqtx3394 squareroot 0.0218 -> 0.148 Inexact Rounded -sqtx3395 squareroot 0.219 -> 0.468 Inexact Rounded -sqtx3396 squareroot 0.0219 -> 0.148 Inexact Rounded -sqtx3397 squareroot 0.221 -> 0.470 Inexact Rounded -sqtx3398 squareroot 0.0221 -> 0.149 Inexact Rounded -sqtx3399 squareroot 0.222 -> 0.471 Inexact Rounded -sqtx3400 squareroot 0.0222 -> 0.149 Inexact Rounded -sqtx3401 squareroot 0.223 -> 0.472 Inexact Rounded -sqtx3402 squareroot 0.0223 -> 0.149 Inexact Rounded -sqtx3403 squareroot 0.224 -> 0.473 Inexact Rounded -sqtx3404 squareroot 0.0224 -> 0.150 Inexact Rounded -sqtx3405 squareroot 0.225 -> 0.474 Inexact Rounded -sqtx3406 squareroot 0.0225 -> 0.15 -sqtx3407 squareroot 0.226 -> 0.475 Inexact Rounded -sqtx3408 squareroot 0.0226 -> 0.150 Inexact Rounded -sqtx3409 squareroot 0.227 -> 0.476 Inexact Rounded -sqtx3410 squareroot 0.0227 -> 0.151 Inexact Rounded -sqtx3411 squareroot 0.228 -> 0.477 Inexact Rounded -sqtx3412 squareroot 0.0228 -> 0.151 Inexact Rounded -sqtx3413 squareroot 0.229 -> 0.479 Inexact Rounded -sqtx3414 squareroot 0.0229 -> 0.151 Inexact Rounded -sqtx3415 squareroot 0.231 -> 0.481 Inexact Rounded -sqtx3416 squareroot 0.0231 -> 0.152 Inexact Rounded -sqtx3417 squareroot 0.232 -> 0.482 Inexact Rounded -sqtx3418 squareroot 0.0232 -> 0.152 Inexact Rounded -sqtx3419 squareroot 0.233 -> 0.483 Inexact Rounded -sqtx3420 squareroot 0.0233 -> 0.153 Inexact Rounded -sqtx3421 squareroot 0.234 -> 0.484 Inexact Rounded -sqtx3422 squareroot 0.0234 -> 0.153 Inexact Rounded -sqtx3423 squareroot 0.235 -> 0.485 Inexact Rounded -sqtx3424 squareroot 0.0235 -> 0.153 Inexact Rounded -sqtx3425 squareroot 0.236 -> 0.486 Inexact Rounded -sqtx3426 squareroot 0.0236 -> 0.154 Inexact Rounded -sqtx3427 squareroot 0.237 -> 0.487 Inexact Rounded -sqtx3428 squareroot 0.0237 -> 0.154 Inexact Rounded -sqtx3429 squareroot 0.238 -> 0.488 Inexact Rounded -sqtx3430 squareroot 0.0238 -> 0.154 Inexact Rounded -sqtx3431 squareroot 0.239 -> 0.489 Inexact Rounded -sqtx3432 squareroot 0.0239 -> 0.155 Inexact Rounded -sqtx3433 squareroot 0.241 -> 0.491 Inexact Rounded -sqtx3434 squareroot 0.0241 -> 0.155 Inexact Rounded -sqtx3435 squareroot 0.242 -> 0.492 Inexact Rounded -sqtx3436 squareroot 0.0242 -> 0.156 Inexact Rounded -sqtx3437 squareroot 0.243 -> 0.493 Inexact Rounded -sqtx3438 squareroot 0.0243 -> 0.156 Inexact Rounded -sqtx3439 squareroot 0.244 -> 0.494 Inexact Rounded -sqtx3440 squareroot 0.0244 -> 0.156 Inexact Rounded -sqtx3441 squareroot 0.245 -> 0.495 Inexact Rounded -sqtx3442 squareroot 0.0245 -> 0.157 Inexact Rounded -sqtx3443 squareroot 0.246 -> 0.496 Inexact Rounded -sqtx3444 squareroot 0.0246 -> 0.157 Inexact Rounded -sqtx3445 squareroot 0.247 -> 0.497 Inexact Rounded -sqtx3446 squareroot 0.0247 -> 0.157 Inexact Rounded -sqtx3447 squareroot 0.248 -> 0.498 Inexact Rounded -sqtx3448 squareroot 0.0248 -> 0.157 Inexact Rounded -sqtx3449 squareroot 0.249 -> 0.499 Inexact Rounded -sqtx3450 squareroot 0.0249 -> 0.158 Inexact Rounded -sqtx3451 squareroot 0.251 -> 0.501 Inexact Rounded -sqtx3452 squareroot 0.0251 -> 0.158 Inexact Rounded -sqtx3453 squareroot 0.252 -> 0.502 Inexact Rounded -sqtx3454 squareroot 0.0252 -> 0.159 Inexact Rounded -sqtx3455 squareroot 0.253 -> 0.503 Inexact Rounded -sqtx3456 squareroot 0.0253 -> 0.159 Inexact Rounded -sqtx3457 squareroot 0.254 -> 0.504 Inexact Rounded -sqtx3458 squareroot 0.0254 -> 0.159 Inexact Rounded -sqtx3459 squareroot 0.255 -> 0.505 Inexact Rounded -sqtx3460 squareroot 0.0255 -> 0.160 Inexact Rounded -sqtx3461 squareroot 0.256 -> 0.506 Inexact Rounded -sqtx3462 squareroot 0.0256 -> 0.16 -sqtx3463 squareroot 0.257 -> 0.507 Inexact Rounded -sqtx3464 squareroot 0.0257 -> 0.160 Inexact Rounded -sqtx3465 squareroot 0.258 -> 0.508 Inexact Rounded -sqtx3466 squareroot 0.0258 -> 0.161 Inexact Rounded -sqtx3467 squareroot 0.259 -> 0.509 Inexact Rounded -sqtx3468 squareroot 0.0259 -> 0.161 Inexact Rounded -sqtx3469 squareroot 0.261 -> 0.511 Inexact Rounded -sqtx3470 squareroot 0.0261 -> 0.162 Inexact Rounded -sqtx3471 squareroot 0.262 -> 0.512 Inexact Rounded -sqtx3472 squareroot 0.0262 -> 0.162 Inexact Rounded -sqtx3473 squareroot 0.263 -> 0.513 Inexact Rounded -sqtx3474 squareroot 0.0263 -> 0.162 Inexact Rounded -sqtx3475 squareroot 0.264 -> 0.514 Inexact Rounded -sqtx3476 squareroot 0.0264 -> 0.162 Inexact Rounded -sqtx3477 squareroot 0.265 -> 0.515 Inexact Rounded -sqtx3478 squareroot 0.0265 -> 0.163 Inexact Rounded -sqtx3479 squareroot 0.266 -> 0.516 Inexact Rounded -sqtx3480 squareroot 0.0266 -> 0.163 Inexact Rounded -sqtx3481 squareroot 0.267 -> 0.517 Inexact Rounded -sqtx3482 squareroot 0.0267 -> 0.163 Inexact Rounded -sqtx3483 squareroot 0.268 -> 0.518 Inexact Rounded -sqtx3484 squareroot 0.0268 -> 0.164 Inexact Rounded -sqtx3485 squareroot 0.269 -> 0.519 Inexact Rounded -sqtx3486 squareroot 0.0269 -> 0.164 Inexact Rounded -sqtx3487 squareroot 0.271 -> 0.521 Inexact Rounded -sqtx3488 squareroot 0.0271 -> 0.165 Inexact Rounded -sqtx3489 squareroot 0.272 -> 0.522 Inexact Rounded -sqtx3490 squareroot 0.0272 -> 0.165 Inexact Rounded -sqtx3491 squareroot 0.273 -> 0.522 Inexact Rounded -sqtx3492 squareroot 0.0273 -> 0.165 Inexact Rounded -sqtx3493 squareroot 0.274 -> 0.523 Inexact Rounded -sqtx3494 squareroot 0.0274 -> 0.166 Inexact Rounded -sqtx3495 squareroot 0.275 -> 0.524 Inexact Rounded -sqtx3496 squareroot 0.0275 -> 0.166 Inexact Rounded -sqtx3497 squareroot 0.276 -> 0.525 Inexact Rounded -sqtx3498 squareroot 0.0276 -> 0.166 Inexact Rounded -sqtx3499 squareroot 0.277 -> 0.526 Inexact Rounded -sqtx3500 squareroot 0.0277 -> 0.166 Inexact Rounded -sqtx3501 squareroot 0.278 -> 0.527 Inexact Rounded -sqtx3502 squareroot 0.0278 -> 0.167 Inexact Rounded -sqtx3503 squareroot 0.279 -> 0.528 Inexact Rounded -sqtx3504 squareroot 0.0279 -> 0.167 Inexact Rounded -sqtx3505 squareroot 0.281 -> 0.530 Inexact Rounded -sqtx3506 squareroot 0.0281 -> 0.168 Inexact Rounded -sqtx3507 squareroot 0.282 -> 0.531 Inexact Rounded -sqtx3508 squareroot 0.0282 -> 0.168 Inexact Rounded -sqtx3509 squareroot 0.283 -> 0.532 Inexact Rounded -sqtx3510 squareroot 0.0283 -> 0.168 Inexact Rounded -sqtx3511 squareroot 0.284 -> 0.533 Inexact Rounded -sqtx3512 squareroot 0.0284 -> 0.169 Inexact Rounded -sqtx3513 squareroot 0.285 -> 0.534 Inexact Rounded -sqtx3514 squareroot 0.0285 -> 0.169 Inexact Rounded -sqtx3515 squareroot 0.286 -> 0.535 Inexact Rounded -sqtx3516 squareroot 0.0286 -> 0.169 Inexact Rounded -sqtx3517 squareroot 0.287 -> 0.536 Inexact Rounded -sqtx3518 squareroot 0.0287 -> 0.169 Inexact Rounded -sqtx3519 squareroot 0.288 -> 0.537 Inexact Rounded -sqtx3520 squareroot 0.0288 -> 0.170 Inexact Rounded -sqtx3521 squareroot 0.289 -> 0.538 Inexact Rounded -sqtx3522 squareroot 0.0289 -> 0.17 -sqtx3523 squareroot 0.291 -> 0.539 Inexact Rounded -sqtx3524 squareroot 0.0291 -> 0.171 Inexact Rounded -sqtx3525 squareroot 0.292 -> 0.540 Inexact Rounded -sqtx3526 squareroot 0.0292 -> 0.171 Inexact Rounded -sqtx3527 squareroot 0.293 -> 0.541 Inexact Rounded -sqtx3528 squareroot 0.0293 -> 0.171 Inexact Rounded -sqtx3529 squareroot 0.294 -> 0.542 Inexact Rounded -sqtx3530 squareroot 0.0294 -> 0.171 Inexact Rounded -sqtx3531 squareroot 0.295 -> 0.543 Inexact Rounded -sqtx3532 squareroot 0.0295 -> 0.172 Inexact Rounded -sqtx3533 squareroot 0.296 -> 0.544 Inexact Rounded -sqtx3534 squareroot 0.0296 -> 0.172 Inexact Rounded -sqtx3535 squareroot 0.297 -> 0.545 Inexact Rounded -sqtx3536 squareroot 0.0297 -> 0.172 Inexact Rounded -sqtx3537 squareroot 0.298 -> 0.546 Inexact Rounded -sqtx3538 squareroot 0.0298 -> 0.173 Inexact Rounded -sqtx3539 squareroot 0.299 -> 0.547 Inexact Rounded -sqtx3540 squareroot 0.0299 -> 0.173 Inexact Rounded -sqtx3541 squareroot 0.301 -> 0.549 Inexact Rounded -sqtx3542 squareroot 0.0301 -> 0.173 Inexact Rounded -sqtx3543 squareroot 0.302 -> 0.550 Inexact Rounded -sqtx3544 squareroot 0.0302 -> 0.174 Inexact Rounded -sqtx3545 squareroot 0.303 -> 0.550 Inexact Rounded -sqtx3546 squareroot 0.0303 -> 0.174 Inexact Rounded -sqtx3547 squareroot 0.304 -> 0.551 Inexact Rounded -sqtx3548 squareroot 0.0304 -> 0.174 Inexact Rounded -sqtx3549 squareroot 0.305 -> 0.552 Inexact Rounded -sqtx3550 squareroot 0.0305 -> 0.175 Inexact Rounded -sqtx3551 squareroot 0.306 -> 0.553 Inexact Rounded -sqtx3552 squareroot 0.0306 -> 0.175 Inexact Rounded -sqtx3553 squareroot 0.307 -> 0.554 Inexact Rounded -sqtx3554 squareroot 0.0307 -> 0.175 Inexact Rounded -sqtx3555 squareroot 0.308 -> 0.555 Inexact Rounded -sqtx3556 squareroot 0.0308 -> 0.175 Inexact Rounded -sqtx3557 squareroot 0.309 -> 0.556 Inexact Rounded -sqtx3558 squareroot 0.0309 -> 0.176 Inexact Rounded -sqtx3559 squareroot 0.311 -> 0.558 Inexact Rounded -sqtx3560 squareroot 0.0311 -> 0.176 Inexact Rounded -sqtx3561 squareroot 0.312 -> 0.559 Inexact Rounded -sqtx3562 squareroot 0.0312 -> 0.177 Inexact Rounded -sqtx3563 squareroot 0.313 -> 0.559 Inexact Rounded -sqtx3564 squareroot 0.0313 -> 0.177 Inexact Rounded -sqtx3565 squareroot 0.314 -> 0.560 Inexact Rounded -sqtx3566 squareroot 0.0314 -> 0.177 Inexact Rounded -sqtx3567 squareroot 0.315 -> 0.561 Inexact Rounded -sqtx3568 squareroot 0.0315 -> 0.177 Inexact Rounded -sqtx3569 squareroot 0.316 -> 0.562 Inexact Rounded -sqtx3570 squareroot 0.0316 -> 0.178 Inexact Rounded -sqtx3571 squareroot 0.317 -> 0.563 Inexact Rounded -sqtx3572 squareroot 0.0317 -> 0.178 Inexact Rounded -sqtx3573 squareroot 0.318 -> 0.564 Inexact Rounded -sqtx3574 squareroot 0.0318 -> 0.178 Inexact Rounded -sqtx3575 squareroot 0.319 -> 0.565 Inexact Rounded -sqtx3576 squareroot 0.0319 -> 0.179 Inexact Rounded -sqtx3577 squareroot 0.321 -> 0.567 Inexact Rounded -sqtx3578 squareroot 0.0321 -> 0.179 Inexact Rounded -sqtx3579 squareroot 0.322 -> 0.567 Inexact Rounded -sqtx3580 squareroot 0.0322 -> 0.179 Inexact Rounded -sqtx3581 squareroot 0.323 -> 0.568 Inexact Rounded -sqtx3582 squareroot 0.0323 -> 0.180 Inexact Rounded -sqtx3583 squareroot 0.324 -> 0.569 Inexact Rounded -sqtx3584 squareroot 0.0324 -> 0.18 -sqtx3585 squareroot 0.325 -> 0.570 Inexact Rounded -sqtx3586 squareroot 0.0325 -> 0.180 Inexact Rounded -sqtx3587 squareroot 0.326 -> 0.571 Inexact Rounded -sqtx3588 squareroot 0.0326 -> 0.181 Inexact Rounded -sqtx3589 squareroot 0.327 -> 0.572 Inexact Rounded -sqtx3590 squareroot 0.0327 -> 0.181 Inexact Rounded -sqtx3591 squareroot 0.328 -> 0.573 Inexact Rounded -sqtx3592 squareroot 0.0328 -> 0.181 Inexact Rounded -sqtx3593 squareroot 0.329 -> 0.574 Inexact Rounded -sqtx3594 squareroot 0.0329 -> 0.181 Inexact Rounded -sqtx3595 squareroot 0.331 -> 0.575 Inexact Rounded -sqtx3596 squareroot 0.0331 -> 0.182 Inexact Rounded -sqtx3597 squareroot 0.332 -> 0.576 Inexact Rounded -sqtx3598 squareroot 0.0332 -> 0.182 Inexact Rounded -sqtx3599 squareroot 0.333 -> 0.577 Inexact Rounded -sqtx3600 squareroot 0.0333 -> 0.182 Inexact Rounded -sqtx3601 squareroot 0.334 -> 0.578 Inexact Rounded -sqtx3602 squareroot 0.0334 -> 0.183 Inexact Rounded -sqtx3603 squareroot 0.335 -> 0.579 Inexact Rounded -sqtx3604 squareroot 0.0335 -> 0.183 Inexact Rounded -sqtx3605 squareroot 0.336 -> 0.580 Inexact Rounded -sqtx3606 squareroot 0.0336 -> 0.183 Inexact Rounded -sqtx3607 squareroot 0.337 -> 0.581 Inexact Rounded -sqtx3608 squareroot 0.0337 -> 0.184 Inexact Rounded -sqtx3609 squareroot 0.338 -> 0.581 Inexact Rounded -sqtx3610 squareroot 0.0338 -> 0.184 Inexact Rounded -sqtx3611 squareroot 0.339 -> 0.582 Inexact Rounded -sqtx3612 squareroot 0.0339 -> 0.184 Inexact Rounded -sqtx3613 squareroot 0.341 -> 0.584 Inexact Rounded -sqtx3614 squareroot 0.0341 -> 0.185 Inexact Rounded -sqtx3615 squareroot 0.342 -> 0.585 Inexact Rounded -sqtx3616 squareroot 0.0342 -> 0.185 Inexact Rounded -sqtx3617 squareroot 0.343 -> 0.586 Inexact Rounded -sqtx3618 squareroot 0.0343 -> 0.185 Inexact Rounded -sqtx3619 squareroot 0.344 -> 0.587 Inexact Rounded -sqtx3620 squareroot 0.0344 -> 0.185 Inexact Rounded -sqtx3621 squareroot 0.345 -> 0.587 Inexact Rounded -sqtx3622 squareroot 0.0345 -> 0.186 Inexact Rounded -sqtx3623 squareroot 0.346 -> 0.588 Inexact Rounded -sqtx3624 squareroot 0.0346 -> 0.186 Inexact Rounded -sqtx3625 squareroot 0.347 -> 0.589 Inexact Rounded -sqtx3626 squareroot 0.0347 -> 0.186 Inexact Rounded -sqtx3627 squareroot 0.348 -> 0.590 Inexact Rounded -sqtx3628 squareroot 0.0348 -> 0.187 Inexact Rounded -sqtx3629 squareroot 0.349 -> 0.591 Inexact Rounded -sqtx3630 squareroot 0.0349 -> 0.187 Inexact Rounded -sqtx3631 squareroot 0.351 -> 0.592 Inexact Rounded -sqtx3632 squareroot 0.0351 -> 0.187 Inexact Rounded -sqtx3633 squareroot 0.352 -> 0.593 Inexact Rounded -sqtx3634 squareroot 0.0352 -> 0.188 Inexact Rounded -sqtx3635 squareroot 0.353 -> 0.594 Inexact Rounded -sqtx3636 squareroot 0.0353 -> 0.188 Inexact Rounded -sqtx3637 squareroot 0.354 -> 0.595 Inexact Rounded -sqtx3638 squareroot 0.0354 -> 0.188 Inexact Rounded -sqtx3639 squareroot 0.355 -> 0.596 Inexact Rounded -sqtx3640 squareroot 0.0355 -> 0.188 Inexact Rounded -sqtx3641 squareroot 0.356 -> 0.597 Inexact Rounded -sqtx3642 squareroot 0.0356 -> 0.189 Inexact Rounded -sqtx3643 squareroot 0.357 -> 0.597 Inexact Rounded -sqtx3644 squareroot 0.0357 -> 0.189 Inexact Rounded -sqtx3645 squareroot 0.358 -> 0.598 Inexact Rounded -sqtx3646 squareroot 0.0358 -> 0.189 Inexact Rounded -sqtx3647 squareroot 0.359 -> 0.599 Inexact Rounded -sqtx3648 squareroot 0.0359 -> 0.189 Inexact Rounded -sqtx3649 squareroot 0.361 -> 0.601 Inexact Rounded -sqtx3650 squareroot 0.0361 -> 0.19 -sqtx3651 squareroot 0.362 -> 0.602 Inexact Rounded -sqtx3652 squareroot 0.0362 -> 0.190 Inexact Rounded -sqtx3653 squareroot 0.363 -> 0.602 Inexact Rounded -sqtx3654 squareroot 0.0363 -> 0.191 Inexact Rounded -sqtx3655 squareroot 0.364 -> 0.603 Inexact Rounded -sqtx3656 squareroot 0.0364 -> 0.191 Inexact Rounded -sqtx3657 squareroot 0.365 -> 0.604 Inexact Rounded -sqtx3658 squareroot 0.0365 -> 0.191 Inexact Rounded -sqtx3659 squareroot 0.366 -> 0.605 Inexact Rounded -sqtx3660 squareroot 0.0366 -> 0.191 Inexact Rounded -sqtx3661 squareroot 0.367 -> 0.606 Inexact Rounded -sqtx3662 squareroot 0.0367 -> 0.192 Inexact Rounded -sqtx3663 squareroot 0.368 -> 0.607 Inexact Rounded -sqtx3664 squareroot 0.0368 -> 0.192 Inexact Rounded -sqtx3665 squareroot 0.369 -> 0.607 Inexact Rounded -sqtx3666 squareroot 0.0369 -> 0.192 Inexact Rounded -sqtx3667 squareroot 0.371 -> 0.609 Inexact Rounded -sqtx3668 squareroot 0.0371 -> 0.193 Inexact Rounded -sqtx3669 squareroot 0.372 -> 0.610 Inexact Rounded -sqtx3670 squareroot 0.0372 -> 0.193 Inexact Rounded -sqtx3671 squareroot 0.373 -> 0.611 Inexact Rounded -sqtx3672 squareroot 0.0373 -> 0.193 Inexact Rounded -sqtx3673 squareroot 0.374 -> 0.612 Inexact Rounded -sqtx3674 squareroot 0.0374 -> 0.193 Inexact Rounded -sqtx3675 squareroot 0.375 -> 0.612 Inexact Rounded -sqtx3676 squareroot 0.0375 -> 0.194 Inexact Rounded -sqtx3677 squareroot 0.376 -> 0.613 Inexact Rounded -sqtx3678 squareroot 0.0376 -> 0.194 Inexact Rounded -sqtx3679 squareroot 0.377 -> 0.614 Inexact Rounded -sqtx3680 squareroot 0.0377 -> 0.194 Inexact Rounded -sqtx3681 squareroot 0.378 -> 0.615 Inexact Rounded -sqtx3682 squareroot 0.0378 -> 0.194 Inexact Rounded -sqtx3683 squareroot 0.379 -> 0.616 Inexact Rounded -sqtx3684 squareroot 0.0379 -> 0.195 Inexact Rounded -sqtx3685 squareroot 0.381 -> 0.617 Inexact Rounded -sqtx3686 squareroot 0.0381 -> 0.195 Inexact Rounded -sqtx3687 squareroot 0.382 -> 0.618 Inexact Rounded -sqtx3688 squareroot 0.0382 -> 0.195 Inexact Rounded -sqtx3689 squareroot 0.383 -> 0.619 Inexact Rounded -sqtx3690 squareroot 0.0383 -> 0.196 Inexact Rounded -sqtx3691 squareroot 0.384 -> 0.620 Inexact Rounded -sqtx3692 squareroot 0.0384 -> 0.196 Inexact Rounded -sqtx3693 squareroot 0.385 -> 0.620 Inexact Rounded -sqtx3694 squareroot 0.0385 -> 0.196 Inexact Rounded -sqtx3695 squareroot 0.386 -> 0.621 Inexact Rounded -sqtx3696 squareroot 0.0386 -> 0.196 Inexact Rounded -sqtx3697 squareroot 0.387 -> 0.622 Inexact Rounded -sqtx3698 squareroot 0.0387 -> 0.197 Inexact Rounded -sqtx3699 squareroot 0.388 -> 0.623 Inexact Rounded -sqtx3700 squareroot 0.0388 -> 0.197 Inexact Rounded -sqtx3701 squareroot 0.389 -> 0.624 Inexact Rounded -sqtx3702 squareroot 0.0389 -> 0.197 Inexact Rounded -sqtx3703 squareroot 0.391 -> 0.625 Inexact Rounded -sqtx3704 squareroot 0.0391 -> 0.198 Inexact Rounded -sqtx3705 squareroot 0.392 -> 0.626 Inexact Rounded -sqtx3706 squareroot 0.0392 -> 0.198 Inexact Rounded -sqtx3707 squareroot 0.393 -> 0.627 Inexact Rounded -sqtx3708 squareroot 0.0393 -> 0.198 Inexact Rounded -sqtx3709 squareroot 0.394 -> 0.628 Inexact Rounded -sqtx3710 squareroot 0.0394 -> 0.198 Inexact Rounded -sqtx3711 squareroot 0.395 -> 0.628 Inexact Rounded -sqtx3712 squareroot 0.0395 -> 0.199 Inexact Rounded -sqtx3713 squareroot 0.396 -> 0.629 Inexact Rounded -sqtx3714 squareroot 0.0396 -> 0.199 Inexact Rounded -sqtx3715 squareroot 0.397 -> 0.630 Inexact Rounded -sqtx3716 squareroot 0.0397 -> 0.199 Inexact Rounded -sqtx3717 squareroot 0.398 -> 0.631 Inexact Rounded -sqtx3718 squareroot 0.0398 -> 0.199 Inexact Rounded -sqtx3719 squareroot 0.399 -> 0.632 Inexact Rounded -sqtx3720 squareroot 0.0399 -> 0.200 Inexact Rounded -sqtx3721 squareroot 0.401 -> 0.633 Inexact Rounded -sqtx3722 squareroot 0.0401 -> 0.200 Inexact Rounded -sqtx3723 squareroot 0.402 -> 0.634 Inexact Rounded -sqtx3724 squareroot 0.0402 -> 0.200 Inexact Rounded -sqtx3725 squareroot 0.403 -> 0.635 Inexact Rounded -sqtx3726 squareroot 0.0403 -> 0.201 Inexact Rounded -sqtx3727 squareroot 0.404 -> 0.636 Inexact Rounded -sqtx3728 squareroot 0.0404 -> 0.201 Inexact Rounded -sqtx3729 squareroot 0.405 -> 0.636 Inexact Rounded -sqtx3730 squareroot 0.0405 -> 0.201 Inexact Rounded -sqtx3731 squareroot 0.406 -> 0.637 Inexact Rounded -sqtx3732 squareroot 0.0406 -> 0.201 Inexact Rounded -sqtx3733 squareroot 0.407 -> 0.638 Inexact Rounded -sqtx3734 squareroot 0.0407 -> 0.202 Inexact Rounded -sqtx3735 squareroot 0.408 -> 0.639 Inexact Rounded -sqtx3736 squareroot 0.0408 -> 0.202 Inexact Rounded -sqtx3737 squareroot 0.409 -> 0.640 Inexact Rounded -sqtx3738 squareroot 0.0409 -> 0.202 Inexact Rounded -sqtx3739 squareroot 0.411 -> 0.641 Inexact Rounded -sqtx3740 squareroot 0.0411 -> 0.203 Inexact Rounded -sqtx3741 squareroot 0.412 -> 0.642 Inexact Rounded -sqtx3742 squareroot 0.0412 -> 0.203 Inexact Rounded -sqtx3743 squareroot 0.413 -> 0.643 Inexact Rounded -sqtx3744 squareroot 0.0413 -> 0.203 Inexact Rounded -sqtx3745 squareroot 0.414 -> 0.643 Inexact Rounded -sqtx3746 squareroot 0.0414 -> 0.203 Inexact Rounded -sqtx3747 squareroot 0.415 -> 0.644 Inexact Rounded -sqtx3748 squareroot 0.0415 -> 0.204 Inexact Rounded -sqtx3749 squareroot 0.416 -> 0.645 Inexact Rounded -sqtx3750 squareroot 0.0416 -> 0.204 Inexact Rounded -sqtx3751 squareroot 0.417 -> 0.646 Inexact Rounded -sqtx3752 squareroot 0.0417 -> 0.204 Inexact Rounded -sqtx3753 squareroot 0.418 -> 0.647 Inexact Rounded -sqtx3754 squareroot 0.0418 -> 0.204 Inexact Rounded -sqtx3755 squareroot 0.419 -> 0.647 Inexact Rounded -sqtx3756 squareroot 0.0419 -> 0.205 Inexact Rounded -sqtx3757 squareroot 0.421 -> 0.649 Inexact Rounded -sqtx3758 squareroot 0.0421 -> 0.205 Inexact Rounded -sqtx3759 squareroot 0.422 -> 0.650 Inexact Rounded -sqtx3760 squareroot 0.0422 -> 0.205 Inexact Rounded -sqtx3761 squareroot 0.423 -> 0.650 Inexact Rounded -sqtx3762 squareroot 0.0423 -> 0.206 Inexact Rounded -sqtx3763 squareroot 0.424 -> 0.651 Inexact Rounded -sqtx3764 squareroot 0.0424 -> 0.206 Inexact Rounded -sqtx3765 squareroot 0.425 -> 0.652 Inexact Rounded -sqtx3766 squareroot 0.0425 -> 0.206 Inexact Rounded -sqtx3767 squareroot 0.426 -> 0.653 Inexact Rounded -sqtx3768 squareroot 0.0426 -> 0.206 Inexact Rounded -sqtx3769 squareroot 0.427 -> 0.653 Inexact Rounded -sqtx3770 squareroot 0.0427 -> 0.207 Inexact Rounded -sqtx3771 squareroot 0.428 -> 0.654 Inexact Rounded -sqtx3772 squareroot 0.0428 -> 0.207 Inexact Rounded -sqtx3773 squareroot 0.429 -> 0.655 Inexact Rounded -sqtx3774 squareroot 0.0429 -> 0.207 Inexact Rounded -sqtx3775 squareroot 0.431 -> 0.657 Inexact Rounded -sqtx3776 squareroot 0.0431 -> 0.208 Inexact Rounded -sqtx3777 squareroot 0.432 -> 0.657 Inexact Rounded -sqtx3778 squareroot 0.0432 -> 0.208 Inexact Rounded -sqtx3779 squareroot 0.433 -> 0.658 Inexact Rounded -sqtx3780 squareroot 0.0433 -> 0.208 Inexact Rounded -sqtx3781 squareroot 0.434 -> 0.659 Inexact Rounded -sqtx3782 squareroot 0.0434 -> 0.208 Inexact Rounded -sqtx3783 squareroot 0.435 -> 0.660 Inexact Rounded -sqtx3784 squareroot 0.0435 -> 0.209 Inexact Rounded -sqtx3785 squareroot 0.436 -> 0.660 Inexact Rounded -sqtx3786 squareroot 0.0436 -> 0.209 Inexact Rounded -sqtx3787 squareroot 0.437 -> 0.661 Inexact Rounded -sqtx3788 squareroot 0.0437 -> 0.209 Inexact Rounded -sqtx3789 squareroot 0.438 -> 0.662 Inexact Rounded -sqtx3790 squareroot 0.0438 -> 0.209 Inexact Rounded -sqtx3791 squareroot 0.439 -> 0.663 Inexact Rounded -sqtx3792 squareroot 0.0439 -> 0.210 Inexact Rounded -sqtx3793 squareroot 0.441 -> 0.664 Inexact Rounded -sqtx3794 squareroot 0.0441 -> 0.21 -sqtx3795 squareroot 0.442 -> 0.665 Inexact Rounded -sqtx3796 squareroot 0.0442 -> 0.210 Inexact Rounded -sqtx3797 squareroot 0.443 -> 0.666 Inexact Rounded -sqtx3798 squareroot 0.0443 -> 0.210 Inexact Rounded -sqtx3799 squareroot 0.444 -> 0.666 Inexact Rounded -sqtx3800 squareroot 0.0444 -> 0.211 Inexact Rounded -sqtx3801 squareroot 0.445 -> 0.667 Inexact Rounded -sqtx3802 squareroot 0.0445 -> 0.211 Inexact Rounded -sqtx3803 squareroot 0.446 -> 0.668 Inexact Rounded -sqtx3804 squareroot 0.0446 -> 0.211 Inexact Rounded -sqtx3805 squareroot 0.447 -> 0.669 Inexact Rounded -sqtx3806 squareroot 0.0447 -> 0.211 Inexact Rounded -sqtx3807 squareroot 0.448 -> 0.669 Inexact Rounded -sqtx3808 squareroot 0.0448 -> 0.212 Inexact Rounded -sqtx3809 squareroot 0.449 -> 0.670 Inexact Rounded -sqtx3810 squareroot 0.0449 -> 0.212 Inexact Rounded -sqtx3811 squareroot 0.451 -> 0.672 Inexact Rounded -sqtx3812 squareroot 0.0451 -> 0.212 Inexact Rounded -sqtx3813 squareroot 0.452 -> 0.672 Inexact Rounded -sqtx3814 squareroot 0.0452 -> 0.213 Inexact Rounded -sqtx3815 squareroot 0.453 -> 0.673 Inexact Rounded -sqtx3816 squareroot 0.0453 -> 0.213 Inexact Rounded -sqtx3817 squareroot 0.454 -> 0.674 Inexact Rounded -sqtx3818 squareroot 0.0454 -> 0.213 Inexact Rounded -sqtx3819 squareroot 0.455 -> 0.675 Inexact Rounded -sqtx3820 squareroot 0.0455 -> 0.213 Inexact Rounded -sqtx3821 squareroot 0.456 -> 0.675 Inexact Rounded -sqtx3822 squareroot 0.0456 -> 0.214 Inexact Rounded -sqtx3823 squareroot 0.457 -> 0.676 Inexact Rounded -sqtx3824 squareroot 0.0457 -> 0.214 Inexact Rounded -sqtx3825 squareroot 0.458 -> 0.677 Inexact Rounded -sqtx3826 squareroot 0.0458 -> 0.214 Inexact Rounded -sqtx3827 squareroot 0.459 -> 0.677 Inexact Rounded -sqtx3828 squareroot 0.0459 -> 0.214 Inexact Rounded -sqtx3829 squareroot 0.461 -> 0.679 Inexact Rounded -sqtx3830 squareroot 0.0461 -> 0.215 Inexact Rounded -sqtx3831 squareroot 0.462 -> 0.680 Inexact Rounded -sqtx3832 squareroot 0.0462 -> 0.215 Inexact Rounded -sqtx3833 squareroot 0.463 -> 0.680 Inexact Rounded -sqtx3834 squareroot 0.0463 -> 0.215 Inexact Rounded -sqtx3835 squareroot 0.464 -> 0.681 Inexact Rounded -sqtx3836 squareroot 0.0464 -> 0.215 Inexact Rounded -sqtx3837 squareroot 0.465 -> 0.682 Inexact Rounded -sqtx3838 squareroot 0.0465 -> 0.216 Inexact Rounded -sqtx3839 squareroot 0.466 -> 0.683 Inexact Rounded -sqtx3840 squareroot 0.0466 -> 0.216 Inexact Rounded -sqtx3841 squareroot 0.467 -> 0.683 Inexact Rounded -sqtx3842 squareroot 0.0467 -> 0.216 Inexact Rounded -sqtx3843 squareroot 0.468 -> 0.684 Inexact Rounded -sqtx3844 squareroot 0.0468 -> 0.216 Inexact Rounded -sqtx3845 squareroot 0.469 -> 0.685 Inexact Rounded -sqtx3846 squareroot 0.0469 -> 0.217 Inexact Rounded -sqtx3847 squareroot 0.471 -> 0.686 Inexact Rounded -sqtx3848 squareroot 0.0471 -> 0.217 Inexact Rounded -sqtx3849 squareroot 0.472 -> 0.687 Inexact Rounded -sqtx3850 squareroot 0.0472 -> 0.217 Inexact Rounded -sqtx3851 squareroot 0.473 -> 0.688 Inexact Rounded -sqtx3852 squareroot 0.0473 -> 0.217 Inexact Rounded -sqtx3853 squareroot 0.474 -> 0.688 Inexact Rounded -sqtx3854 squareroot 0.0474 -> 0.218 Inexact Rounded -sqtx3855 squareroot 0.475 -> 0.689 Inexact Rounded -sqtx3856 squareroot 0.0475 -> 0.218 Inexact Rounded -sqtx3857 squareroot 0.476 -> 0.690 Inexact Rounded -sqtx3858 squareroot 0.0476 -> 0.218 Inexact Rounded -sqtx3859 squareroot 0.477 -> 0.691 Inexact Rounded -sqtx3860 squareroot 0.0477 -> 0.218 Inexact Rounded -sqtx3861 squareroot 0.478 -> 0.691 Inexact Rounded -sqtx3862 squareroot 0.0478 -> 0.219 Inexact Rounded -sqtx3863 squareroot 0.479 -> 0.692 Inexact Rounded -sqtx3864 squareroot 0.0479 -> 0.219 Inexact Rounded -sqtx3865 squareroot 0.481 -> 0.694 Inexact Rounded -sqtx3866 squareroot 0.0481 -> 0.219 Inexact Rounded -sqtx3867 squareroot 0.482 -> 0.694 Inexact Rounded -sqtx3868 squareroot 0.0482 -> 0.220 Inexact Rounded -sqtx3869 squareroot 0.483 -> 0.695 Inexact Rounded -sqtx3870 squareroot 0.0483 -> 0.220 Inexact Rounded -sqtx3871 squareroot 0.484 -> 0.696 Inexact Rounded -sqtx3872 squareroot 0.0484 -> 0.22 -sqtx3873 squareroot 0.485 -> 0.696 Inexact Rounded -sqtx3874 squareroot 0.0485 -> 0.220 Inexact Rounded -sqtx3875 squareroot 0.486 -> 0.697 Inexact Rounded -sqtx3876 squareroot 0.0486 -> 0.220 Inexact Rounded -sqtx3877 squareroot 0.487 -> 0.698 Inexact Rounded -sqtx3878 squareroot 0.0487 -> 0.221 Inexact Rounded -sqtx3879 squareroot 0.488 -> 0.699 Inexact Rounded -sqtx3880 squareroot 0.0488 -> 0.221 Inexact Rounded -sqtx3881 squareroot 0.489 -> 0.699 Inexact Rounded -sqtx3882 squareroot 0.0489 -> 0.221 Inexact Rounded -sqtx3883 squareroot 0.491 -> 0.701 Inexact Rounded -sqtx3884 squareroot 0.0491 -> 0.222 Inexact Rounded -sqtx3885 squareroot 0.492 -> 0.701 Inexact Rounded -sqtx3886 squareroot 0.0492 -> 0.222 Inexact Rounded -sqtx3887 squareroot 0.493 -> 0.702 Inexact Rounded -sqtx3888 squareroot 0.0493 -> 0.222 Inexact Rounded -sqtx3889 squareroot 0.494 -> 0.703 Inexact Rounded -sqtx3890 squareroot 0.0494 -> 0.222 Inexact Rounded -sqtx3891 squareroot 0.495 -> 0.704 Inexact Rounded -sqtx3892 squareroot 0.0495 -> 0.222 Inexact Rounded -sqtx3893 squareroot 0.496 -> 0.704 Inexact Rounded -sqtx3894 squareroot 0.0496 -> 0.223 Inexact Rounded -sqtx3895 squareroot 0.497 -> 0.705 Inexact Rounded -sqtx3896 squareroot 0.0497 -> 0.223 Inexact Rounded -sqtx3897 squareroot 0.498 -> 0.706 Inexact Rounded -sqtx3898 squareroot 0.0498 -> 0.223 Inexact Rounded -sqtx3899 squareroot 0.499 -> 0.706 Inexact Rounded -sqtx3900 squareroot 0.0499 -> 0.223 Inexact Rounded -sqtx3901 squareroot 0.501 -> 0.708 Inexact Rounded -sqtx3902 squareroot 0.0501 -> 0.224 Inexact Rounded -sqtx3903 squareroot 0.502 -> 0.709 Inexact Rounded -sqtx3904 squareroot 0.0502 -> 0.224 Inexact Rounded -sqtx3905 squareroot 0.503 -> 0.709 Inexact Rounded -sqtx3906 squareroot 0.0503 -> 0.224 Inexact Rounded -sqtx3907 squareroot 0.504 -> 0.710 Inexact Rounded -sqtx3908 squareroot 0.0504 -> 0.224 Inexact Rounded -sqtx3909 squareroot 0.505 -> 0.711 Inexact Rounded -sqtx3910 squareroot 0.0505 -> 0.225 Inexact Rounded -sqtx3911 squareroot 0.506 -> 0.711 Inexact Rounded -sqtx3912 squareroot 0.0506 -> 0.225 Inexact Rounded -sqtx3913 squareroot 0.507 -> 0.712 Inexact Rounded -sqtx3914 squareroot 0.0507 -> 0.225 Inexact Rounded -sqtx3915 squareroot 0.508 -> 0.713 Inexact Rounded -sqtx3916 squareroot 0.0508 -> 0.225 Inexact Rounded -sqtx3917 squareroot 0.509 -> 0.713 Inexact Rounded -sqtx3918 squareroot 0.0509 -> 0.226 Inexact Rounded -sqtx3919 squareroot 0.511 -> 0.715 Inexact Rounded -sqtx3920 squareroot 0.0511 -> 0.226 Inexact Rounded -sqtx3921 squareroot 0.512 -> 0.716 Inexact Rounded -sqtx3922 squareroot 0.0512 -> 0.226 Inexact Rounded -sqtx3923 squareroot 0.513 -> 0.716 Inexact Rounded -sqtx3924 squareroot 0.0513 -> 0.226 Inexact Rounded -sqtx3925 squareroot 0.514 -> 0.717 Inexact Rounded -sqtx3926 squareroot 0.0514 -> 0.227 Inexact Rounded -sqtx3927 squareroot 0.515 -> 0.718 Inexact Rounded -sqtx3928 squareroot 0.0515 -> 0.227 Inexact Rounded -sqtx3929 squareroot 0.516 -> 0.718 Inexact Rounded -sqtx3930 squareroot 0.0516 -> 0.227 Inexact Rounded -sqtx3931 squareroot 0.517 -> 0.719 Inexact Rounded -sqtx3932 squareroot 0.0517 -> 0.227 Inexact Rounded -sqtx3933 squareroot 0.518 -> 0.720 Inexact Rounded -sqtx3934 squareroot 0.0518 -> 0.228 Inexact Rounded -sqtx3935 squareroot 0.519 -> 0.720 Inexact Rounded -sqtx3936 squareroot 0.0519 -> 0.228 Inexact Rounded -sqtx3937 squareroot 0.521 -> 0.722 Inexact Rounded -sqtx3938 squareroot 0.0521 -> 0.228 Inexact Rounded -sqtx3939 squareroot 0.522 -> 0.722 Inexact Rounded -sqtx3940 squareroot 0.0522 -> 0.228 Inexact Rounded -sqtx3941 squareroot 0.523 -> 0.723 Inexact Rounded -sqtx3942 squareroot 0.0523 -> 0.229 Inexact Rounded -sqtx3943 squareroot 0.524 -> 0.724 Inexact Rounded -sqtx3944 squareroot 0.0524 -> 0.229 Inexact Rounded -sqtx3945 squareroot 0.525 -> 0.725 Inexact Rounded -sqtx3946 squareroot 0.0525 -> 0.229 Inexact Rounded -sqtx3947 squareroot 0.526 -> 0.725 Inexact Rounded -sqtx3948 squareroot 0.0526 -> 0.229 Inexact Rounded -sqtx3949 squareroot 0.527 -> 0.726 Inexact Rounded -sqtx3950 squareroot 0.0527 -> 0.230 Inexact Rounded -sqtx3951 squareroot 0.528 -> 0.727 Inexact Rounded -sqtx3952 squareroot 0.0528 -> 0.230 Inexact Rounded -sqtx3953 squareroot 0.529 -> 0.727 Inexact Rounded -sqtx3954 squareroot 0.0529 -> 0.23 -sqtx3955 squareroot 0.531 -> 0.729 Inexact Rounded -sqtx3956 squareroot 0.0531 -> 0.230 Inexact Rounded -sqtx3957 squareroot 0.532 -> 0.729 Inexact Rounded -sqtx3958 squareroot 0.0532 -> 0.231 Inexact Rounded -sqtx3959 squareroot 0.533 -> 0.730 Inexact Rounded -sqtx3960 squareroot 0.0533 -> 0.231 Inexact Rounded -sqtx3961 squareroot 0.534 -> 0.731 Inexact Rounded -sqtx3962 squareroot 0.0534 -> 0.231 Inexact Rounded -sqtx3963 squareroot 0.535 -> 0.731 Inexact Rounded -sqtx3964 squareroot 0.0535 -> 0.231 Inexact Rounded -sqtx3965 squareroot 0.536 -> 0.732 Inexact Rounded -sqtx3966 squareroot 0.0536 -> 0.232 Inexact Rounded -sqtx3967 squareroot 0.537 -> 0.733 Inexact Rounded -sqtx3968 squareroot 0.0537 -> 0.232 Inexact Rounded -sqtx3969 squareroot 0.538 -> 0.733 Inexact Rounded -sqtx3970 squareroot 0.0538 -> 0.232 Inexact Rounded -sqtx3971 squareroot 0.539 -> 0.734 Inexact Rounded -sqtx3972 squareroot 0.0539 -> 0.232 Inexact Rounded -sqtx3973 squareroot 0.541 -> 0.736 Inexact Rounded -sqtx3974 squareroot 0.0541 -> 0.233 Inexact Rounded -sqtx3975 squareroot 0.542 -> 0.736 Inexact Rounded -sqtx3976 squareroot 0.0542 -> 0.233 Inexact Rounded -sqtx3977 squareroot 0.543 -> 0.737 Inexact Rounded -sqtx3978 squareroot 0.0543 -> 0.233 Inexact Rounded -sqtx3979 squareroot 0.544 -> 0.738 Inexact Rounded -sqtx3980 squareroot 0.0544 -> 0.233 Inexact Rounded -sqtx3981 squareroot 0.545 -> 0.738 Inexact Rounded -sqtx3982 squareroot 0.0545 -> 0.233 Inexact Rounded -sqtx3983 squareroot 0.546 -> 0.739 Inexact Rounded -sqtx3984 squareroot 0.0546 -> 0.234 Inexact Rounded -sqtx3985 squareroot 0.547 -> 0.740 Inexact Rounded -sqtx3986 squareroot 0.0547 -> 0.234 Inexact Rounded -sqtx3987 squareroot 0.548 -> 0.740 Inexact Rounded -sqtx3988 squareroot 0.0548 -> 0.234 Inexact Rounded -sqtx3989 squareroot 0.549 -> 0.741 Inexact Rounded -sqtx3990 squareroot 0.0549 -> 0.234 Inexact Rounded -sqtx3991 squareroot 0.551 -> 0.742 Inexact Rounded -sqtx3992 squareroot 0.0551 -> 0.235 Inexact Rounded -sqtx3993 squareroot 0.552 -> 0.743 Inexact Rounded -sqtx3994 squareroot 0.0552 -> 0.235 Inexact Rounded -sqtx3995 squareroot 0.553 -> 0.744 Inexact Rounded -sqtx3996 squareroot 0.0553 -> 0.235 Inexact Rounded -sqtx3997 squareroot 0.554 -> 0.744 Inexact Rounded -sqtx3998 squareroot 0.0554 -> 0.235 Inexact Rounded -sqtx3999 squareroot 0.555 -> 0.745 Inexact Rounded -sqtx4000 squareroot 0.0555 -> 0.236 Inexact Rounded -sqtx4001 squareroot 0.556 -> 0.746 Inexact Rounded -sqtx4002 squareroot 0.0556 -> 0.236 Inexact Rounded -sqtx4003 squareroot 0.557 -> 0.746 Inexact Rounded -sqtx4004 squareroot 0.0557 -> 0.236 Inexact Rounded -sqtx4005 squareroot 0.558 -> 0.747 Inexact Rounded -sqtx4006 squareroot 0.0558 -> 0.236 Inexact Rounded -sqtx4007 squareroot 0.559 -> 0.748 Inexact Rounded -sqtx4008 squareroot 0.0559 -> 0.236 Inexact Rounded -sqtx4009 squareroot 0.561 -> 0.749 Inexact Rounded -sqtx4010 squareroot 0.0561 -> 0.237 Inexact Rounded -sqtx4011 squareroot 0.562 -> 0.750 Inexact Rounded -sqtx4012 squareroot 0.0562 -> 0.237 Inexact Rounded -sqtx4013 squareroot 0.563 -> 0.750 Inexact Rounded -sqtx4014 squareroot 0.0563 -> 0.237 Inexact Rounded -sqtx4015 squareroot 0.564 -> 0.751 Inexact Rounded -sqtx4016 squareroot 0.0564 -> 0.237 Inexact Rounded -sqtx4017 squareroot 0.565 -> 0.752 Inexact Rounded -sqtx4018 squareroot 0.0565 -> 0.238 Inexact Rounded -sqtx4019 squareroot 0.566 -> 0.752 Inexact Rounded -sqtx4020 squareroot 0.0566 -> 0.238 Inexact Rounded -sqtx4021 squareroot 0.567 -> 0.753 Inexact Rounded -sqtx4022 squareroot 0.0567 -> 0.238 Inexact Rounded -sqtx4023 squareroot 0.568 -> 0.754 Inexact Rounded -sqtx4024 squareroot 0.0568 -> 0.238 Inexact Rounded -sqtx4025 squareroot 0.569 -> 0.754 Inexact Rounded -sqtx4026 squareroot 0.0569 -> 0.239 Inexact Rounded -sqtx4027 squareroot 0.571 -> 0.756 Inexact Rounded -sqtx4028 squareroot 0.0571 -> 0.239 Inexact Rounded -sqtx4029 squareroot 0.572 -> 0.756 Inexact Rounded -sqtx4030 squareroot 0.0572 -> 0.239 Inexact Rounded -sqtx4031 squareroot 0.573 -> 0.757 Inexact Rounded -sqtx4032 squareroot 0.0573 -> 0.239 Inexact Rounded -sqtx4033 squareroot 0.574 -> 0.758 Inexact Rounded -sqtx4034 squareroot 0.0574 -> 0.240 Inexact Rounded -sqtx4035 squareroot 0.575 -> 0.758 Inexact Rounded -sqtx4036 squareroot 0.0575 -> 0.240 Inexact Rounded -sqtx4037 squareroot 0.576 -> 0.759 Inexact Rounded -sqtx4038 squareroot 0.0576 -> 0.24 -sqtx4039 squareroot 0.577 -> 0.760 Inexact Rounded -sqtx4040 squareroot 0.0577 -> 0.240 Inexact Rounded -sqtx4041 squareroot 0.578 -> 0.760 Inexact Rounded -sqtx4042 squareroot 0.0578 -> 0.240 Inexact Rounded -sqtx4043 squareroot 0.579 -> 0.761 Inexact Rounded -sqtx4044 squareroot 0.0579 -> 0.241 Inexact Rounded -sqtx4045 squareroot 0.581 -> 0.762 Inexact Rounded -sqtx4046 squareroot 0.0581 -> 0.241 Inexact Rounded -sqtx4047 squareroot 0.582 -> 0.763 Inexact Rounded -sqtx4048 squareroot 0.0582 -> 0.241 Inexact Rounded -sqtx4049 squareroot 0.583 -> 0.764 Inexact Rounded -sqtx4050 squareroot 0.0583 -> 0.241 Inexact Rounded -sqtx4051 squareroot 0.584 -> 0.764 Inexact Rounded -sqtx4052 squareroot 0.0584 -> 0.242 Inexact Rounded -sqtx4053 squareroot 0.585 -> 0.765 Inexact Rounded -sqtx4054 squareroot 0.0585 -> 0.242 Inexact Rounded -sqtx4055 squareroot 0.586 -> 0.766 Inexact Rounded -sqtx4056 squareroot 0.0586 -> 0.242 Inexact Rounded -sqtx4057 squareroot 0.587 -> 0.766 Inexact Rounded -sqtx4058 squareroot 0.0587 -> 0.242 Inexact Rounded -sqtx4059 squareroot 0.588 -> 0.767 Inexact Rounded -sqtx4060 squareroot 0.0588 -> 0.242 Inexact Rounded -sqtx4061 squareroot 0.589 -> 0.767 Inexact Rounded -sqtx4062 squareroot 0.0589 -> 0.243 Inexact Rounded -sqtx4063 squareroot 0.591 -> 0.769 Inexact Rounded -sqtx4064 squareroot 0.0591 -> 0.243 Inexact Rounded -sqtx4065 squareroot 0.592 -> 0.769 Inexact Rounded -sqtx4066 squareroot 0.0592 -> 0.243 Inexact Rounded -sqtx4067 squareroot 0.593 -> 0.770 Inexact Rounded -sqtx4068 squareroot 0.0593 -> 0.244 Inexact Rounded -sqtx4069 squareroot 0.594 -> 0.771 Inexact Rounded -sqtx4070 squareroot 0.0594 -> 0.244 Inexact Rounded -sqtx4071 squareroot 0.595 -> 0.771 Inexact Rounded -sqtx4072 squareroot 0.0595 -> 0.244 Inexact Rounded -sqtx4073 squareroot 0.596 -> 0.772 Inexact Rounded -sqtx4074 squareroot 0.0596 -> 0.244 Inexact Rounded -sqtx4075 squareroot 0.597 -> 0.773 Inexact Rounded -sqtx4076 squareroot 0.0597 -> 0.244 Inexact Rounded -sqtx4077 squareroot 0.598 -> 0.773 Inexact Rounded -sqtx4078 squareroot 0.0598 -> 0.245 Inexact Rounded -sqtx4079 squareroot 0.599 -> 0.774 Inexact Rounded -sqtx4080 squareroot 0.0599 -> 0.245 Inexact Rounded -sqtx4081 squareroot 0.601 -> 0.775 Inexact Rounded -sqtx4082 squareroot 0.0601 -> 0.245 Inexact Rounded -sqtx4083 squareroot 0.602 -> 0.776 Inexact Rounded -sqtx4084 squareroot 0.0602 -> 0.245 Inexact Rounded -sqtx4085 squareroot 0.603 -> 0.777 Inexact Rounded -sqtx4086 squareroot 0.0603 -> 0.246 Inexact Rounded -sqtx4087 squareroot 0.604 -> 0.777 Inexact Rounded -sqtx4088 squareroot 0.0604 -> 0.246 Inexact Rounded -sqtx4089 squareroot 0.605 -> 0.778 Inexact Rounded -sqtx4090 squareroot 0.0605 -> 0.246 Inexact Rounded -sqtx4091 squareroot 0.606 -> 0.778 Inexact Rounded -sqtx4092 squareroot 0.0606 -> 0.246 Inexact Rounded -sqtx4093 squareroot 0.607 -> 0.779 Inexact Rounded -sqtx4094 squareroot 0.0607 -> 0.246 Inexact Rounded -sqtx4095 squareroot 0.608 -> 0.780 Inexact Rounded -sqtx4096 squareroot 0.0608 -> 0.247 Inexact Rounded -sqtx4097 squareroot 0.609 -> 0.780 Inexact Rounded -sqtx4098 squareroot 0.0609 -> 0.247 Inexact Rounded -sqtx4099 squareroot 0.611 -> 0.782 Inexact Rounded -sqtx4100 squareroot 0.0611 -> 0.247 Inexact Rounded -sqtx4101 squareroot 0.612 -> 0.782 Inexact Rounded -sqtx4102 squareroot 0.0612 -> 0.247 Inexact Rounded -sqtx4103 squareroot 0.613 -> 0.783 Inexact Rounded -sqtx4104 squareroot 0.0613 -> 0.248 Inexact Rounded -sqtx4105 squareroot 0.614 -> 0.784 Inexact Rounded -sqtx4106 squareroot 0.0614 -> 0.248 Inexact Rounded -sqtx4107 squareroot 0.615 -> 0.784 Inexact Rounded -sqtx4108 squareroot 0.0615 -> 0.248 Inexact Rounded -sqtx4109 squareroot 0.616 -> 0.785 Inexact Rounded -sqtx4110 squareroot 0.0616 -> 0.248 Inexact Rounded -sqtx4111 squareroot 0.617 -> 0.785 Inexact Rounded -sqtx4112 squareroot 0.0617 -> 0.248 Inexact Rounded -sqtx4113 squareroot 0.618 -> 0.786 Inexact Rounded -sqtx4114 squareroot 0.0618 -> 0.249 Inexact Rounded -sqtx4115 squareroot 0.619 -> 0.787 Inexact Rounded -sqtx4116 squareroot 0.0619 -> 0.249 Inexact Rounded -sqtx4117 squareroot 0.621 -> 0.788 Inexact Rounded -sqtx4118 squareroot 0.0621 -> 0.249 Inexact Rounded -sqtx4119 squareroot 0.622 -> 0.789 Inexact Rounded -sqtx4120 squareroot 0.0622 -> 0.249 Inexact Rounded -sqtx4121 squareroot 0.623 -> 0.789 Inexact Rounded -sqtx4122 squareroot 0.0623 -> 0.250 Inexact Rounded -sqtx4123 squareroot 0.624 -> 0.790 Inexact Rounded -sqtx4124 squareroot 0.0624 -> 0.250 Inexact Rounded -sqtx4125 squareroot 0.625 -> 0.791 Inexact Rounded -sqtx4126 squareroot 0.0625 -> 0.25 -sqtx4127 squareroot 0.626 -> 0.791 Inexact Rounded -sqtx4128 squareroot 0.0626 -> 0.250 Inexact Rounded -sqtx4129 squareroot 0.627 -> 0.792 Inexact Rounded -sqtx4130 squareroot 0.0627 -> 0.250 Inexact Rounded -sqtx4131 squareroot 0.628 -> 0.792 Inexact Rounded -sqtx4132 squareroot 0.0628 -> 0.251 Inexact Rounded -sqtx4133 squareroot 0.629 -> 0.793 Inexact Rounded -sqtx4134 squareroot 0.0629 -> 0.251 Inexact Rounded -sqtx4135 squareroot 0.631 -> 0.794 Inexact Rounded -sqtx4136 squareroot 0.0631 -> 0.251 Inexact Rounded -sqtx4137 squareroot 0.632 -> 0.795 Inexact Rounded -sqtx4138 squareroot 0.0632 -> 0.251 Inexact Rounded -sqtx4139 squareroot 0.633 -> 0.796 Inexact Rounded -sqtx4140 squareroot 0.0633 -> 0.252 Inexact Rounded -sqtx4141 squareroot 0.634 -> 0.796 Inexact Rounded -sqtx4142 squareroot 0.0634 -> 0.252 Inexact Rounded -sqtx4143 squareroot 0.635 -> 0.797 Inexact Rounded -sqtx4144 squareroot 0.0635 -> 0.252 Inexact Rounded -sqtx4145 squareroot 0.636 -> 0.797 Inexact Rounded -sqtx4146 squareroot 0.0636 -> 0.252 Inexact Rounded -sqtx4147 squareroot 0.637 -> 0.798 Inexact Rounded -sqtx4148 squareroot 0.0637 -> 0.252 Inexact Rounded -sqtx4149 squareroot 0.638 -> 0.799 Inexact Rounded -sqtx4150 squareroot 0.0638 -> 0.253 Inexact Rounded -sqtx4151 squareroot 0.639 -> 0.799 Inexact Rounded -sqtx4152 squareroot 0.0639 -> 0.253 Inexact Rounded -sqtx4153 squareroot 0.641 -> 0.801 Inexact Rounded -sqtx4154 squareroot 0.0641 -> 0.253 Inexact Rounded -sqtx4155 squareroot 0.642 -> 0.801 Inexact Rounded -sqtx4156 squareroot 0.0642 -> 0.253 Inexact Rounded -sqtx4157 squareroot 0.643 -> 0.802 Inexact Rounded -sqtx4158 squareroot 0.0643 -> 0.254 Inexact Rounded -sqtx4159 squareroot 0.644 -> 0.802 Inexact Rounded -sqtx4160 squareroot 0.0644 -> 0.254 Inexact Rounded -sqtx4161 squareroot 0.645 -> 0.803 Inexact Rounded -sqtx4162 squareroot 0.0645 -> 0.254 Inexact Rounded -sqtx4163 squareroot 0.646 -> 0.804 Inexact Rounded -sqtx4164 squareroot 0.0646 -> 0.254 Inexact Rounded -sqtx4165 squareroot 0.647 -> 0.804 Inexact Rounded -sqtx4166 squareroot 0.0647 -> 0.254 Inexact Rounded -sqtx4167 squareroot 0.648 -> 0.805 Inexact Rounded -sqtx4168 squareroot 0.0648 -> 0.255 Inexact Rounded -sqtx4169 squareroot 0.649 -> 0.806 Inexact Rounded -sqtx4170 squareroot 0.0649 -> 0.255 Inexact Rounded -sqtx4171 squareroot 0.651 -> 0.807 Inexact Rounded -sqtx4172 squareroot 0.0651 -> 0.255 Inexact Rounded -sqtx4173 squareroot 0.652 -> 0.807 Inexact Rounded -sqtx4174 squareroot 0.0652 -> 0.255 Inexact Rounded -sqtx4175 squareroot 0.653 -> 0.808 Inexact Rounded -sqtx4176 squareroot 0.0653 -> 0.256 Inexact Rounded -sqtx4177 squareroot 0.654 -> 0.809 Inexact Rounded -sqtx4178 squareroot 0.0654 -> 0.256 Inexact Rounded -sqtx4179 squareroot 0.655 -> 0.809 Inexact Rounded -sqtx4180 squareroot 0.0655 -> 0.256 Inexact Rounded -sqtx4181 squareroot 0.656 -> 0.810 Inexact Rounded -sqtx4182 squareroot 0.0656 -> 0.256 Inexact Rounded -sqtx4183 squareroot 0.657 -> 0.811 Inexact Rounded -sqtx4184 squareroot 0.0657 -> 0.256 Inexact Rounded -sqtx4185 squareroot 0.658 -> 0.811 Inexact Rounded -sqtx4186 squareroot 0.0658 -> 0.257 Inexact Rounded -sqtx4187 squareroot 0.659 -> 0.812 Inexact Rounded -sqtx4188 squareroot 0.0659 -> 0.257 Inexact Rounded -sqtx4189 squareroot 0.661 -> 0.813 Inexact Rounded -sqtx4190 squareroot 0.0661 -> 0.257 Inexact Rounded -sqtx4191 squareroot 0.662 -> 0.814 Inexact Rounded -sqtx4192 squareroot 0.0662 -> 0.257 Inexact Rounded -sqtx4193 squareroot 0.663 -> 0.814 Inexact Rounded -sqtx4194 squareroot 0.0663 -> 0.257 Inexact Rounded -sqtx4195 squareroot 0.664 -> 0.815 Inexact Rounded -sqtx4196 squareroot 0.0664 -> 0.258 Inexact Rounded -sqtx4197 squareroot 0.665 -> 0.815 Inexact Rounded -sqtx4198 squareroot 0.0665 -> 0.258 Inexact Rounded -sqtx4199 squareroot 0.666 -> 0.816 Inexact Rounded -sqtx4200 squareroot 0.0666 -> 0.258 Inexact Rounded -sqtx4201 squareroot 0.667 -> 0.817 Inexact Rounded -sqtx4202 squareroot 0.0667 -> 0.258 Inexact Rounded -sqtx4203 squareroot 0.668 -> 0.817 Inexact Rounded -sqtx4204 squareroot 0.0668 -> 0.258 Inexact Rounded -sqtx4205 squareroot 0.669 -> 0.818 Inexact Rounded -sqtx4206 squareroot 0.0669 -> 0.259 Inexact Rounded -sqtx4207 squareroot 0.671 -> 0.819 Inexact Rounded -sqtx4208 squareroot 0.0671 -> 0.259 Inexact Rounded -sqtx4209 squareroot 0.672 -> 0.820 Inexact Rounded -sqtx4210 squareroot 0.0672 -> 0.259 Inexact Rounded -sqtx4211 squareroot 0.673 -> 0.820 Inexact Rounded -sqtx4212 squareroot 0.0673 -> 0.259 Inexact Rounded -sqtx4213 squareroot 0.674 -> 0.821 Inexact Rounded -sqtx4214 squareroot 0.0674 -> 0.260 Inexact Rounded -sqtx4215 squareroot 0.675 -> 0.822 Inexact Rounded -sqtx4216 squareroot 0.0675 -> 0.260 Inexact Rounded -sqtx4217 squareroot 0.676 -> 0.822 Inexact Rounded -sqtx4218 squareroot 0.0676 -> 0.26 -sqtx4219 squareroot 0.677 -> 0.823 Inexact Rounded -sqtx4220 squareroot 0.0677 -> 0.260 Inexact Rounded -sqtx4221 squareroot 0.678 -> 0.823 Inexact Rounded -sqtx4222 squareroot 0.0678 -> 0.260 Inexact Rounded -sqtx4223 squareroot 0.679 -> 0.824 Inexact Rounded -sqtx4224 squareroot 0.0679 -> 0.261 Inexact Rounded -sqtx4225 squareroot 0.681 -> 0.825 Inexact Rounded -sqtx4226 squareroot 0.0681 -> 0.261 Inexact Rounded -sqtx4227 squareroot 0.682 -> 0.826 Inexact Rounded -sqtx4228 squareroot 0.0682 -> 0.261 Inexact Rounded -sqtx4229 squareroot 0.683 -> 0.826 Inexact Rounded -sqtx4230 squareroot 0.0683 -> 0.261 Inexact Rounded -sqtx4231 squareroot 0.684 -> 0.827 Inexact Rounded -sqtx4232 squareroot 0.0684 -> 0.262 Inexact Rounded -sqtx4233 squareroot 0.685 -> 0.828 Inexact Rounded -sqtx4234 squareroot 0.0685 -> 0.262 Inexact Rounded -sqtx4235 squareroot 0.686 -> 0.828 Inexact Rounded -sqtx4236 squareroot 0.0686 -> 0.262 Inexact Rounded -sqtx4237 squareroot 0.687 -> 0.829 Inexact Rounded -sqtx4238 squareroot 0.0687 -> 0.262 Inexact Rounded -sqtx4239 squareroot 0.688 -> 0.829 Inexact Rounded -sqtx4240 squareroot 0.0688 -> 0.262 Inexact Rounded -sqtx4241 squareroot 0.689 -> 0.830 Inexact Rounded -sqtx4242 squareroot 0.0689 -> 0.262 Inexact Rounded -sqtx4243 squareroot 0.691 -> 0.831 Inexact Rounded -sqtx4244 squareroot 0.0691 -> 0.263 Inexact Rounded -sqtx4245 squareroot 0.692 -> 0.832 Inexact Rounded -sqtx4246 squareroot 0.0692 -> 0.263 Inexact Rounded -sqtx4247 squareroot 0.693 -> 0.832 Inexact Rounded -sqtx4248 squareroot 0.0693 -> 0.263 Inexact Rounded -sqtx4249 squareroot 0.694 -> 0.833 Inexact Rounded -sqtx4250 squareroot 0.0694 -> 0.263 Inexact Rounded -sqtx4251 squareroot 0.695 -> 0.834 Inexact Rounded -sqtx4252 squareroot 0.0695 -> 0.264 Inexact Rounded -sqtx4253 squareroot 0.696 -> 0.834 Inexact Rounded -sqtx4254 squareroot 0.0696 -> 0.264 Inexact Rounded -sqtx4255 squareroot 0.697 -> 0.835 Inexact Rounded -sqtx4256 squareroot 0.0697 -> 0.264 Inexact Rounded -sqtx4257 squareroot 0.698 -> 0.835 Inexact Rounded -sqtx4258 squareroot 0.0698 -> 0.264 Inexact Rounded -sqtx4259 squareroot 0.699 -> 0.836 Inexact Rounded -sqtx4260 squareroot 0.0699 -> 0.264 Inexact Rounded -sqtx4261 squareroot 0.701 -> 0.837 Inexact Rounded -sqtx4262 squareroot 0.0701 -> 0.265 Inexact Rounded -sqtx4263 squareroot 0.702 -> 0.838 Inexact Rounded -sqtx4264 squareroot 0.0702 -> 0.265 Inexact Rounded -sqtx4265 squareroot 0.703 -> 0.838 Inexact Rounded -sqtx4266 squareroot 0.0703 -> 0.265 Inexact Rounded -sqtx4267 squareroot 0.704 -> 0.839 Inexact Rounded -sqtx4268 squareroot 0.0704 -> 0.265 Inexact Rounded -sqtx4269 squareroot 0.705 -> 0.840 Inexact Rounded -sqtx4270 squareroot 0.0705 -> 0.266 Inexact Rounded -sqtx4271 squareroot 0.706 -> 0.840 Inexact Rounded -sqtx4272 squareroot 0.0706 -> 0.266 Inexact Rounded -sqtx4273 squareroot 0.707 -> 0.841 Inexact Rounded -sqtx4274 squareroot 0.0707 -> 0.266 Inexact Rounded -sqtx4275 squareroot 0.708 -> 0.841 Inexact Rounded -sqtx4276 squareroot 0.0708 -> 0.266 Inexact Rounded -sqtx4277 squareroot 0.709 -> 0.842 Inexact Rounded -sqtx4278 squareroot 0.0709 -> 0.266 Inexact Rounded -sqtx4279 squareroot 0.711 -> 0.843 Inexact Rounded -sqtx4280 squareroot 0.0711 -> 0.267 Inexact Rounded -sqtx4281 squareroot 0.712 -> 0.844 Inexact Rounded -sqtx4282 squareroot 0.0712 -> 0.267 Inexact Rounded -sqtx4283 squareroot 0.713 -> 0.844 Inexact Rounded -sqtx4284 squareroot 0.0713 -> 0.267 Inexact Rounded -sqtx4285 squareroot 0.714 -> 0.845 Inexact Rounded -sqtx4286 squareroot 0.0714 -> 0.267 Inexact Rounded -sqtx4287 squareroot 0.715 -> 0.846 Inexact Rounded -sqtx4288 squareroot 0.0715 -> 0.267 Inexact Rounded -sqtx4289 squareroot 0.716 -> 0.846 Inexact Rounded -sqtx4290 squareroot 0.0716 -> 0.268 Inexact Rounded -sqtx4291 squareroot 0.717 -> 0.847 Inexact Rounded -sqtx4292 squareroot 0.0717 -> 0.268 Inexact Rounded -sqtx4293 squareroot 0.718 -> 0.847 Inexact Rounded -sqtx4294 squareroot 0.0718 -> 0.268 Inexact Rounded -sqtx4295 squareroot 0.719 -> 0.848 Inexact Rounded -sqtx4296 squareroot 0.0719 -> 0.268 Inexact Rounded -sqtx4297 squareroot 0.721 -> 0.849 Inexact Rounded -sqtx4298 squareroot 0.0721 -> 0.269 Inexact Rounded -sqtx4299 squareroot 0.722 -> 0.850 Inexact Rounded -sqtx4300 squareroot 0.0722 -> 0.269 Inexact Rounded -sqtx4301 squareroot 0.723 -> 0.850 Inexact Rounded -sqtx4302 squareroot 0.0723 -> 0.269 Inexact Rounded -sqtx4303 squareroot 0.724 -> 0.851 Inexact Rounded -sqtx4304 squareroot 0.0724 -> 0.269 Inexact Rounded -sqtx4305 squareroot 0.725 -> 0.851 Inexact Rounded -sqtx4306 squareroot 0.0725 -> 0.269 Inexact Rounded -sqtx4307 squareroot 0.726 -> 0.852 Inexact Rounded -sqtx4308 squareroot 0.0726 -> 0.269 Inexact Rounded -sqtx4309 squareroot 0.727 -> 0.853 Inexact Rounded -sqtx4310 squareroot 0.0727 -> 0.270 Inexact Rounded -sqtx4311 squareroot 0.728 -> 0.853 Inexact Rounded -sqtx4312 squareroot 0.0728 -> 0.270 Inexact Rounded -sqtx4313 squareroot 0.729 -> 0.854 Inexact Rounded -sqtx4314 squareroot 0.0729 -> 0.27 -sqtx4315 squareroot 0.731 -> 0.855 Inexact Rounded -sqtx4316 squareroot 0.0731 -> 0.270 Inexact Rounded -sqtx4317 squareroot 0.732 -> 0.856 Inexact Rounded -sqtx4318 squareroot 0.0732 -> 0.271 Inexact Rounded -sqtx4319 squareroot 0.733 -> 0.856 Inexact Rounded -sqtx4320 squareroot 0.0733 -> 0.271 Inexact Rounded -sqtx4321 squareroot 0.734 -> 0.857 Inexact Rounded -sqtx4322 squareroot 0.0734 -> 0.271 Inexact Rounded -sqtx4323 squareroot 0.735 -> 0.857 Inexact Rounded -sqtx4324 squareroot 0.0735 -> 0.271 Inexact Rounded -sqtx4325 squareroot 0.736 -> 0.858 Inexact Rounded -sqtx4326 squareroot 0.0736 -> 0.271 Inexact Rounded -sqtx4327 squareroot 0.737 -> 0.858 Inexact Rounded -sqtx4328 squareroot 0.0737 -> 0.271 Inexact Rounded -sqtx4329 squareroot 0.738 -> 0.859 Inexact Rounded -sqtx4330 squareroot 0.0738 -> 0.272 Inexact Rounded -sqtx4331 squareroot 0.739 -> 0.860 Inexact Rounded -sqtx4332 squareroot 0.0739 -> 0.272 Inexact Rounded -sqtx4333 squareroot 0.741 -> 0.861 Inexact Rounded -sqtx4334 squareroot 0.0741 -> 0.272 Inexact Rounded -sqtx4335 squareroot 0.742 -> 0.861 Inexact Rounded -sqtx4336 squareroot 0.0742 -> 0.272 Inexact Rounded -sqtx4337 squareroot 0.743 -> 0.862 Inexact Rounded -sqtx4338 squareroot 0.0743 -> 0.273 Inexact Rounded -sqtx4339 squareroot 0.744 -> 0.863 Inexact Rounded -sqtx4340 squareroot 0.0744 -> 0.273 Inexact Rounded -sqtx4341 squareroot 0.745 -> 0.863 Inexact Rounded -sqtx4342 squareroot 0.0745 -> 0.273 Inexact Rounded -sqtx4343 squareroot 0.746 -> 0.864 Inexact Rounded -sqtx4344 squareroot 0.0746 -> 0.273 Inexact Rounded -sqtx4345 squareroot 0.747 -> 0.864 Inexact Rounded -sqtx4346 squareroot 0.0747 -> 0.273 Inexact Rounded -sqtx4347 squareroot 0.748 -> 0.865 Inexact Rounded -sqtx4348 squareroot 0.0748 -> 0.273 Inexact Rounded -sqtx4349 squareroot 0.749 -> 0.865 Inexact Rounded -sqtx4350 squareroot 0.0749 -> 0.274 Inexact Rounded -sqtx4351 squareroot 0.751 -> 0.867 Inexact Rounded -sqtx4352 squareroot 0.0751 -> 0.274 Inexact Rounded -sqtx4353 squareroot 0.752 -> 0.867 Inexact Rounded -sqtx4354 squareroot 0.0752 -> 0.274 Inexact Rounded -sqtx4355 squareroot 0.753 -> 0.868 Inexact Rounded -sqtx4356 squareroot 0.0753 -> 0.274 Inexact Rounded -sqtx4357 squareroot 0.754 -> 0.868 Inexact Rounded -sqtx4358 squareroot 0.0754 -> 0.275 Inexact Rounded -sqtx4359 squareroot 0.755 -> 0.869 Inexact Rounded -sqtx4360 squareroot 0.0755 -> 0.275 Inexact Rounded -sqtx4361 squareroot 0.756 -> 0.869 Inexact Rounded -sqtx4362 squareroot 0.0756 -> 0.275 Inexact Rounded -sqtx4363 squareroot 0.757 -> 0.870 Inexact Rounded -sqtx4364 squareroot 0.0757 -> 0.275 Inexact Rounded -sqtx4365 squareroot 0.758 -> 0.871 Inexact Rounded -sqtx4366 squareroot 0.0758 -> 0.275 Inexact Rounded -sqtx4367 squareroot 0.759 -> 0.871 Inexact Rounded -sqtx4368 squareroot 0.0759 -> 0.275 Inexact Rounded -sqtx4369 squareroot 0.761 -> 0.872 Inexact Rounded -sqtx4370 squareroot 0.0761 -> 0.276 Inexact Rounded -sqtx4371 squareroot 0.762 -> 0.873 Inexact Rounded -sqtx4372 squareroot 0.0762 -> 0.276 Inexact Rounded -sqtx4373 squareroot 0.763 -> 0.873 Inexact Rounded -sqtx4374 squareroot 0.0763 -> 0.276 Inexact Rounded -sqtx4375 squareroot 0.764 -> 0.874 Inexact Rounded -sqtx4376 squareroot 0.0764 -> 0.276 Inexact Rounded -sqtx4377 squareroot 0.765 -> 0.875 Inexact Rounded -sqtx4378 squareroot 0.0765 -> 0.277 Inexact Rounded -sqtx4379 squareroot 0.766 -> 0.875 Inexact Rounded -sqtx4380 squareroot 0.0766 -> 0.277 Inexact Rounded -sqtx4381 squareroot 0.767 -> 0.876 Inexact Rounded -sqtx4382 squareroot 0.0767 -> 0.277 Inexact Rounded -sqtx4383 squareroot 0.768 -> 0.876 Inexact Rounded -sqtx4384 squareroot 0.0768 -> 0.277 Inexact Rounded -sqtx4385 squareroot 0.769 -> 0.877 Inexact Rounded -sqtx4386 squareroot 0.0769 -> 0.277 Inexact Rounded -sqtx4387 squareroot 0.771 -> 0.878 Inexact Rounded -sqtx4388 squareroot 0.0771 -> 0.278 Inexact Rounded -sqtx4389 squareroot 0.772 -> 0.879 Inexact Rounded -sqtx4390 squareroot 0.0772 -> 0.278 Inexact Rounded -sqtx4391 squareroot 0.773 -> 0.879 Inexact Rounded -sqtx4392 squareroot 0.0773 -> 0.278 Inexact Rounded -sqtx4393 squareroot 0.774 -> 0.880 Inexact Rounded -sqtx4394 squareroot 0.0774 -> 0.278 Inexact Rounded -sqtx4395 squareroot 0.775 -> 0.880 Inexact Rounded -sqtx4396 squareroot 0.0775 -> 0.278 Inexact Rounded -sqtx4397 squareroot 0.776 -> 0.881 Inexact Rounded -sqtx4398 squareroot 0.0776 -> 0.279 Inexact Rounded -sqtx4399 squareroot 0.777 -> 0.881 Inexact Rounded -sqtx4400 squareroot 0.0777 -> 0.279 Inexact Rounded -sqtx4401 squareroot 0.778 -> 0.882 Inexact Rounded -sqtx4402 squareroot 0.0778 -> 0.279 Inexact Rounded -sqtx4403 squareroot 0.779 -> 0.883 Inexact Rounded -sqtx4404 squareroot 0.0779 -> 0.279 Inexact Rounded -sqtx4405 squareroot 0.781 -> 0.884 Inexact Rounded -sqtx4406 squareroot 0.0781 -> 0.279 Inexact Rounded -sqtx4407 squareroot 0.782 -> 0.884 Inexact Rounded -sqtx4408 squareroot 0.0782 -> 0.280 Inexact Rounded -sqtx4409 squareroot 0.783 -> 0.885 Inexact Rounded -sqtx4410 squareroot 0.0783 -> 0.280 Inexact Rounded -sqtx4411 squareroot 0.784 -> 0.885 Inexact Rounded -sqtx4412 squareroot 0.0784 -> 0.28 -sqtx4413 squareroot 0.785 -> 0.886 Inexact Rounded -sqtx4414 squareroot 0.0785 -> 0.280 Inexact Rounded -sqtx4415 squareroot 0.786 -> 0.887 Inexact Rounded -sqtx4416 squareroot 0.0786 -> 0.280 Inexact Rounded -sqtx4417 squareroot 0.787 -> 0.887 Inexact Rounded -sqtx4418 squareroot 0.0787 -> 0.281 Inexact Rounded -sqtx4419 squareroot 0.788 -> 0.888 Inexact Rounded -sqtx4420 squareroot 0.0788 -> 0.281 Inexact Rounded -sqtx4421 squareroot 0.789 -> 0.888 Inexact Rounded -sqtx4422 squareroot 0.0789 -> 0.281 Inexact Rounded -sqtx4423 squareroot 0.791 -> 0.889 Inexact Rounded -sqtx4424 squareroot 0.0791 -> 0.281 Inexact Rounded -sqtx4425 squareroot 0.792 -> 0.890 Inexact Rounded -sqtx4426 squareroot 0.0792 -> 0.281 Inexact Rounded -sqtx4427 squareroot 0.793 -> 0.891 Inexact Rounded -sqtx4428 squareroot 0.0793 -> 0.282 Inexact Rounded -sqtx4429 squareroot 0.794 -> 0.891 Inexact Rounded -sqtx4430 squareroot 0.0794 -> 0.282 Inexact Rounded -sqtx4431 squareroot 0.795 -> 0.892 Inexact Rounded -sqtx4432 squareroot 0.0795 -> 0.282 Inexact Rounded -sqtx4433 squareroot 0.796 -> 0.892 Inexact Rounded -sqtx4434 squareroot 0.0796 -> 0.282 Inexact Rounded -sqtx4435 squareroot 0.797 -> 0.893 Inexact Rounded -sqtx4436 squareroot 0.0797 -> 0.282 Inexact Rounded -sqtx4437 squareroot 0.798 -> 0.893 Inexact Rounded -sqtx4438 squareroot 0.0798 -> 0.282 Inexact Rounded -sqtx4439 squareroot 0.799 -> 0.894 Inexact Rounded -sqtx4440 squareroot 0.0799 -> 0.283 Inexact Rounded -sqtx4441 squareroot 0.801 -> 0.895 Inexact Rounded -sqtx4442 squareroot 0.0801 -> 0.283 Inexact Rounded -sqtx4443 squareroot 0.802 -> 0.896 Inexact Rounded -sqtx4444 squareroot 0.0802 -> 0.283 Inexact Rounded -sqtx4445 squareroot 0.803 -> 0.896 Inexact Rounded -sqtx4446 squareroot 0.0803 -> 0.283 Inexact Rounded -sqtx4447 squareroot 0.804 -> 0.897 Inexact Rounded -sqtx4448 squareroot 0.0804 -> 0.284 Inexact Rounded -sqtx4449 squareroot 0.805 -> 0.897 Inexact Rounded -sqtx4450 squareroot 0.0805 -> 0.284 Inexact Rounded -sqtx4451 squareroot 0.806 -> 0.898 Inexact Rounded -sqtx4452 squareroot 0.0806 -> 0.284 Inexact Rounded -sqtx4453 squareroot 0.807 -> 0.898 Inexact Rounded -sqtx4454 squareroot 0.0807 -> 0.284 Inexact Rounded -sqtx4455 squareroot 0.808 -> 0.899 Inexact Rounded -sqtx4456 squareroot 0.0808 -> 0.284 Inexact Rounded -sqtx4457 squareroot 0.809 -> 0.899 Inexact Rounded -sqtx4458 squareroot 0.0809 -> 0.284 Inexact Rounded -sqtx4459 squareroot 0.811 -> 0.901 Inexact Rounded -sqtx4460 squareroot 0.0811 -> 0.285 Inexact Rounded -sqtx4461 squareroot 0.812 -> 0.901 Inexact Rounded -sqtx4462 squareroot 0.0812 -> 0.285 Inexact Rounded -sqtx4463 squareroot 0.813 -> 0.902 Inexact Rounded -sqtx4464 squareroot 0.0813 -> 0.285 Inexact Rounded -sqtx4465 squareroot 0.814 -> 0.902 Inexact Rounded -sqtx4466 squareroot 0.0814 -> 0.285 Inexact Rounded -sqtx4467 squareroot 0.815 -> 0.903 Inexact Rounded -sqtx4468 squareroot 0.0815 -> 0.285 Inexact Rounded -sqtx4469 squareroot 0.816 -> 0.903 Inexact Rounded -sqtx4470 squareroot 0.0816 -> 0.286 Inexact Rounded -sqtx4471 squareroot 0.817 -> 0.904 Inexact Rounded -sqtx4472 squareroot 0.0817 -> 0.286 Inexact Rounded -sqtx4473 squareroot 0.818 -> 0.904 Inexact Rounded -sqtx4474 squareroot 0.0818 -> 0.286 Inexact Rounded -sqtx4475 squareroot 0.819 -> 0.905 Inexact Rounded -sqtx4476 squareroot 0.0819 -> 0.286 Inexact Rounded -sqtx4477 squareroot 0.821 -> 0.906 Inexact Rounded -sqtx4478 squareroot 0.0821 -> 0.287 Inexact Rounded -sqtx4479 squareroot 0.822 -> 0.907 Inexact Rounded -sqtx4480 squareroot 0.0822 -> 0.287 Inexact Rounded -sqtx4481 squareroot 0.823 -> 0.907 Inexact Rounded -sqtx4482 squareroot 0.0823 -> 0.287 Inexact Rounded -sqtx4483 squareroot 0.824 -> 0.908 Inexact Rounded -sqtx4484 squareroot 0.0824 -> 0.287 Inexact Rounded -sqtx4485 squareroot 0.825 -> 0.908 Inexact Rounded -sqtx4486 squareroot 0.0825 -> 0.287 Inexact Rounded -sqtx4487 squareroot 0.826 -> 0.909 Inexact Rounded -sqtx4488 squareroot 0.0826 -> 0.287 Inexact Rounded -sqtx4489 squareroot 0.827 -> 0.909 Inexact Rounded -sqtx4490 squareroot 0.0827 -> 0.288 Inexact Rounded -sqtx4491 squareroot 0.828 -> 0.910 Inexact Rounded -sqtx4492 squareroot 0.0828 -> 0.288 Inexact Rounded -sqtx4493 squareroot 0.829 -> 0.910 Inexact Rounded -sqtx4494 squareroot 0.0829 -> 0.288 Inexact Rounded -sqtx4495 squareroot 0.831 -> 0.912 Inexact Rounded -sqtx4496 squareroot 0.0831 -> 0.288 Inexact Rounded -sqtx4497 squareroot 0.832 -> 0.912 Inexact Rounded -sqtx4498 squareroot 0.0832 -> 0.288 Inexact Rounded -sqtx4499 squareroot 0.833 -> 0.913 Inexact Rounded -sqtx4500 squareroot 0.0833 -> 0.289 Inexact Rounded -sqtx4501 squareroot 0.834 -> 0.913 Inexact Rounded -sqtx4502 squareroot 0.0834 -> 0.289 Inexact Rounded -sqtx4503 squareroot 0.835 -> 0.914 Inexact Rounded -sqtx4504 squareroot 0.0835 -> 0.289 Inexact Rounded -sqtx4505 squareroot 0.836 -> 0.914 Inexact Rounded -sqtx4506 squareroot 0.0836 -> 0.289 Inexact Rounded -sqtx4507 squareroot 0.837 -> 0.915 Inexact Rounded -sqtx4508 squareroot 0.0837 -> 0.289 Inexact Rounded -sqtx4509 squareroot 0.838 -> 0.915 Inexact Rounded -sqtx4510 squareroot 0.0838 -> 0.289 Inexact Rounded -sqtx4511 squareroot 0.839 -> 0.916 Inexact Rounded -sqtx4512 squareroot 0.0839 -> 0.290 Inexact Rounded -sqtx4513 squareroot 0.841 -> 0.917 Inexact Rounded -sqtx4514 squareroot 0.0841 -> 0.29 -sqtx4515 squareroot 0.842 -> 0.918 Inexact Rounded -sqtx4516 squareroot 0.0842 -> 0.290 Inexact Rounded -sqtx4517 squareroot 0.843 -> 0.918 Inexact Rounded -sqtx4518 squareroot 0.0843 -> 0.290 Inexact Rounded -sqtx4519 squareroot 0.844 -> 0.919 Inexact Rounded -sqtx4520 squareroot 0.0844 -> 0.291 Inexact Rounded -sqtx4521 squareroot 0.845 -> 0.919 Inexact Rounded -sqtx4522 squareroot 0.0845 -> 0.291 Inexact Rounded -sqtx4523 squareroot 0.846 -> 0.920 Inexact Rounded -sqtx4524 squareroot 0.0846 -> 0.291 Inexact Rounded -sqtx4525 squareroot 0.847 -> 0.920 Inexact Rounded -sqtx4526 squareroot 0.0847 -> 0.291 Inexact Rounded -sqtx4527 squareroot 0.848 -> 0.921 Inexact Rounded -sqtx4528 squareroot 0.0848 -> 0.291 Inexact Rounded -sqtx4529 squareroot 0.849 -> 0.921 Inexact Rounded -sqtx4530 squareroot 0.0849 -> 0.291 Inexact Rounded -sqtx4531 squareroot 0.851 -> 0.922 Inexact Rounded -sqtx4532 squareroot 0.0851 -> 0.292 Inexact Rounded -sqtx4533 squareroot 0.852 -> 0.923 Inexact Rounded -sqtx4534 squareroot 0.0852 -> 0.292 Inexact Rounded -sqtx4535 squareroot 0.853 -> 0.924 Inexact Rounded -sqtx4536 squareroot 0.0853 -> 0.292 Inexact Rounded -sqtx4537 squareroot 0.854 -> 0.924 Inexact Rounded -sqtx4538 squareroot 0.0854 -> 0.292 Inexact Rounded -sqtx4539 squareroot 0.855 -> 0.925 Inexact Rounded -sqtx4540 squareroot 0.0855 -> 0.292 Inexact Rounded -sqtx4541 squareroot 0.856 -> 0.925 Inexact Rounded -sqtx4542 squareroot 0.0856 -> 0.293 Inexact Rounded -sqtx4543 squareroot 0.857 -> 0.926 Inexact Rounded -sqtx4544 squareroot 0.0857 -> 0.293 Inexact Rounded -sqtx4545 squareroot 0.858 -> 0.926 Inexact Rounded -sqtx4546 squareroot 0.0858 -> 0.293 Inexact Rounded -sqtx4547 squareroot 0.859 -> 0.927 Inexact Rounded -sqtx4548 squareroot 0.0859 -> 0.293 Inexact Rounded -sqtx4549 squareroot 0.861 -> 0.928 Inexact Rounded -sqtx4550 squareroot 0.0861 -> 0.293 Inexact Rounded -sqtx4551 squareroot 0.862 -> 0.928 Inexact Rounded -sqtx4552 squareroot 0.0862 -> 0.294 Inexact Rounded -sqtx4553 squareroot 0.863 -> 0.929 Inexact Rounded -sqtx4554 squareroot 0.0863 -> 0.294 Inexact Rounded -sqtx4555 squareroot 0.864 -> 0.930 Inexact Rounded -sqtx4556 squareroot 0.0864 -> 0.294 Inexact Rounded -sqtx4557 squareroot 0.865 -> 0.930 Inexact Rounded -sqtx4558 squareroot 0.0865 -> 0.294 Inexact Rounded -sqtx4559 squareroot 0.866 -> 0.931 Inexact Rounded -sqtx4560 squareroot 0.0866 -> 0.294 Inexact Rounded -sqtx4561 squareroot 0.867 -> 0.931 Inexact Rounded -sqtx4562 squareroot 0.0867 -> 0.294 Inexact Rounded -sqtx4563 squareroot 0.868 -> 0.932 Inexact Rounded -sqtx4564 squareroot 0.0868 -> 0.295 Inexact Rounded -sqtx4565 squareroot 0.869 -> 0.932 Inexact Rounded -sqtx4566 squareroot 0.0869 -> 0.295 Inexact Rounded -sqtx4567 squareroot 0.871 -> 0.933 Inexact Rounded -sqtx4568 squareroot 0.0871 -> 0.295 Inexact Rounded -sqtx4569 squareroot 0.872 -> 0.934 Inexact Rounded -sqtx4570 squareroot 0.0872 -> 0.295 Inexact Rounded -sqtx4571 squareroot 0.873 -> 0.934 Inexact Rounded -sqtx4572 squareroot 0.0873 -> 0.295 Inexact Rounded -sqtx4573 squareroot 0.874 -> 0.935 Inexact Rounded -sqtx4574 squareroot 0.0874 -> 0.296 Inexact Rounded -sqtx4575 squareroot 0.875 -> 0.935 Inexact Rounded -sqtx4576 squareroot 0.0875 -> 0.296 Inexact Rounded -sqtx4577 squareroot 0.876 -> 0.936 Inexact Rounded -sqtx4578 squareroot 0.0876 -> 0.296 Inexact Rounded -sqtx4579 squareroot 0.877 -> 0.936 Inexact Rounded -sqtx4580 squareroot 0.0877 -> 0.296 Inexact Rounded -sqtx4581 squareroot 0.878 -> 0.937 Inexact Rounded -sqtx4582 squareroot 0.0878 -> 0.296 Inexact Rounded -sqtx4583 squareroot 0.879 -> 0.938 Inexact Rounded -sqtx4584 squareroot 0.0879 -> 0.296 Inexact Rounded -sqtx4585 squareroot 0.881 -> 0.939 Inexact Rounded -sqtx4586 squareroot 0.0881 -> 0.297 Inexact Rounded -sqtx4587 squareroot 0.882 -> 0.939 Inexact Rounded -sqtx4588 squareroot 0.0882 -> 0.297 Inexact Rounded -sqtx4589 squareroot 0.883 -> 0.940 Inexact Rounded -sqtx4590 squareroot 0.0883 -> 0.297 Inexact Rounded -sqtx4591 squareroot 0.884 -> 0.940 Inexact Rounded -sqtx4592 squareroot 0.0884 -> 0.297 Inexact Rounded -sqtx4593 squareroot 0.885 -> 0.941 Inexact Rounded -sqtx4594 squareroot 0.0885 -> 0.297 Inexact Rounded -sqtx4595 squareroot 0.886 -> 0.941 Inexact Rounded -sqtx4596 squareroot 0.0886 -> 0.298 Inexact Rounded -sqtx4597 squareroot 0.887 -> 0.942 Inexact Rounded -sqtx4598 squareroot 0.0887 -> 0.298 Inexact Rounded -sqtx4599 squareroot 0.888 -> 0.942 Inexact Rounded -sqtx4600 squareroot 0.0888 -> 0.298 Inexact Rounded -sqtx4601 squareroot 0.889 -> 0.943 Inexact Rounded -sqtx4602 squareroot 0.0889 -> 0.298 Inexact Rounded -sqtx4603 squareroot 0.891 -> 0.944 Inexact Rounded -sqtx4604 squareroot 0.0891 -> 0.298 Inexact Rounded -sqtx4605 squareroot 0.892 -> 0.944 Inexact Rounded -sqtx4606 squareroot 0.0892 -> 0.299 Inexact Rounded -sqtx4607 squareroot 0.893 -> 0.945 Inexact Rounded -sqtx4608 squareroot 0.0893 -> 0.299 Inexact Rounded -sqtx4609 squareroot 0.894 -> 0.946 Inexact Rounded -sqtx4610 squareroot 0.0894 -> 0.299 Inexact Rounded -sqtx4611 squareroot 0.895 -> 0.946 Inexact Rounded -sqtx4612 squareroot 0.0895 -> 0.299 Inexact Rounded -sqtx4613 squareroot 0.896 -> 0.947 Inexact Rounded -sqtx4614 squareroot 0.0896 -> 0.299 Inexact Rounded -sqtx4615 squareroot 0.897 -> 0.947 Inexact Rounded -sqtx4616 squareroot 0.0897 -> 0.299 Inexact Rounded -sqtx4617 squareroot 0.898 -> 0.948 Inexact Rounded -sqtx4618 squareroot 0.0898 -> 0.300 Inexact Rounded -sqtx4619 squareroot 0.899 -> 0.948 Inexact Rounded -sqtx4620 squareroot 0.0899 -> 0.300 Inexact Rounded -sqtx4621 squareroot 0.901 -> 0.949 Inexact Rounded -sqtx4622 squareroot 0.0901 -> 0.300 Inexact Rounded -sqtx4623 squareroot 0.902 -> 0.950 Inexact Rounded -sqtx4624 squareroot 0.0902 -> 0.300 Inexact Rounded -sqtx4625 squareroot 0.903 -> 0.950 Inexact Rounded -sqtx4626 squareroot 0.0903 -> 0.300 Inexact Rounded -sqtx4627 squareroot 0.904 -> 0.951 Inexact Rounded -sqtx4628 squareroot 0.0904 -> 0.301 Inexact Rounded -sqtx4629 squareroot 0.905 -> 0.951 Inexact Rounded -sqtx4630 squareroot 0.0905 -> 0.301 Inexact Rounded -sqtx4631 squareroot 0.906 -> 0.952 Inexact Rounded -sqtx4632 squareroot 0.0906 -> 0.301 Inexact Rounded -sqtx4633 squareroot 0.907 -> 0.952 Inexact Rounded -sqtx4634 squareroot 0.0907 -> 0.301 Inexact Rounded -sqtx4635 squareroot 0.908 -> 0.953 Inexact Rounded -sqtx4636 squareroot 0.0908 -> 0.301 Inexact Rounded -sqtx4637 squareroot 0.909 -> 0.953 Inexact Rounded -sqtx4638 squareroot 0.0909 -> 0.301 Inexact Rounded -sqtx4639 squareroot 0.911 -> 0.954 Inexact Rounded -sqtx4640 squareroot 0.0911 -> 0.302 Inexact Rounded -sqtx4641 squareroot 0.912 -> 0.955 Inexact Rounded -sqtx4642 squareroot 0.0912 -> 0.302 Inexact Rounded -sqtx4643 squareroot 0.913 -> 0.956 Inexact Rounded -sqtx4644 squareroot 0.0913 -> 0.302 Inexact Rounded -sqtx4645 squareroot 0.914 -> 0.956 Inexact Rounded -sqtx4646 squareroot 0.0914 -> 0.302 Inexact Rounded -sqtx4647 squareroot 0.915 -> 0.957 Inexact Rounded -sqtx4648 squareroot 0.0915 -> 0.302 Inexact Rounded -sqtx4649 squareroot 0.916 -> 0.957 Inexact Rounded -sqtx4650 squareroot 0.0916 -> 0.303 Inexact Rounded -sqtx4651 squareroot 0.917 -> 0.958 Inexact Rounded -sqtx4652 squareroot 0.0917 -> 0.303 Inexact Rounded -sqtx4653 squareroot 0.918 -> 0.958 Inexact Rounded -sqtx4654 squareroot 0.0918 -> 0.303 Inexact Rounded -sqtx4655 squareroot 0.919 -> 0.959 Inexact Rounded -sqtx4656 squareroot 0.0919 -> 0.303 Inexact Rounded -sqtx4657 squareroot 0.921 -> 0.960 Inexact Rounded -sqtx4658 squareroot 0.0921 -> 0.303 Inexact Rounded -sqtx4659 squareroot 0.922 -> 0.960 Inexact Rounded -sqtx4660 squareroot 0.0922 -> 0.304 Inexact Rounded -sqtx4661 squareroot 0.923 -> 0.961 Inexact Rounded -sqtx4662 squareroot 0.0923 -> 0.304 Inexact Rounded -sqtx4663 squareroot 0.924 -> 0.961 Inexact Rounded -sqtx4664 squareroot 0.0924 -> 0.304 Inexact Rounded -sqtx4665 squareroot 0.925 -> 0.962 Inexact Rounded -sqtx4666 squareroot 0.0925 -> 0.304 Inexact Rounded -sqtx4667 squareroot 0.926 -> 0.962 Inexact Rounded -sqtx4668 squareroot 0.0926 -> 0.304 Inexact Rounded -sqtx4669 squareroot 0.927 -> 0.963 Inexact Rounded -sqtx4670 squareroot 0.0927 -> 0.304 Inexact Rounded -sqtx4671 squareroot 0.928 -> 0.963 Inexact Rounded -sqtx4672 squareroot 0.0928 -> 0.305 Inexact Rounded -sqtx4673 squareroot 0.929 -> 0.964 Inexact Rounded -sqtx4674 squareroot 0.0929 -> 0.305 Inexact Rounded -sqtx4675 squareroot 0.931 -> 0.965 Inexact Rounded -sqtx4676 squareroot 0.0931 -> 0.305 Inexact Rounded -sqtx4677 squareroot 0.932 -> 0.965 Inexact Rounded -sqtx4678 squareroot 0.0932 -> 0.305 Inexact Rounded -sqtx4679 squareroot 0.933 -> 0.966 Inexact Rounded -sqtx4680 squareroot 0.0933 -> 0.305 Inexact Rounded -sqtx4681 squareroot 0.934 -> 0.966 Inexact Rounded -sqtx4682 squareroot 0.0934 -> 0.306 Inexact Rounded -sqtx4683 squareroot 0.935 -> 0.967 Inexact Rounded -sqtx4684 squareroot 0.0935 -> 0.306 Inexact Rounded -sqtx4685 squareroot 0.936 -> 0.967 Inexact Rounded -sqtx4686 squareroot 0.0936 -> 0.306 Inexact Rounded -sqtx4687 squareroot 0.937 -> 0.968 Inexact Rounded -sqtx4688 squareroot 0.0937 -> 0.306 Inexact Rounded -sqtx4689 squareroot 0.938 -> 0.969 Inexact Rounded -sqtx4690 squareroot 0.0938 -> 0.306 Inexact Rounded -sqtx4691 squareroot 0.939 -> 0.969 Inexact Rounded -sqtx4692 squareroot 0.0939 -> 0.306 Inexact Rounded -sqtx4693 squareroot 0.941 -> 0.970 Inexact Rounded -sqtx4694 squareroot 0.0941 -> 0.307 Inexact Rounded -sqtx4695 squareroot 0.942 -> 0.971 Inexact Rounded -sqtx4696 squareroot 0.0942 -> 0.307 Inexact Rounded -sqtx4697 squareroot 0.943 -> 0.971 Inexact Rounded -sqtx4698 squareroot 0.0943 -> 0.307 Inexact Rounded -sqtx4699 squareroot 0.944 -> 0.972 Inexact Rounded -sqtx4700 squareroot 0.0944 -> 0.307 Inexact Rounded -sqtx4701 squareroot 0.945 -> 0.972 Inexact Rounded -sqtx4702 squareroot 0.0945 -> 0.307 Inexact Rounded -sqtx4703 squareroot 0.946 -> 0.973 Inexact Rounded -sqtx4704 squareroot 0.0946 -> 0.308 Inexact Rounded -sqtx4705 squareroot 0.947 -> 0.973 Inexact Rounded -sqtx4706 squareroot 0.0947 -> 0.308 Inexact Rounded -sqtx4707 squareroot 0.948 -> 0.974 Inexact Rounded -sqtx4708 squareroot 0.0948 -> 0.308 Inexact Rounded -sqtx4709 squareroot 0.949 -> 0.974 Inexact Rounded -sqtx4710 squareroot 0.0949 -> 0.308 Inexact Rounded -sqtx4711 squareroot 0.951 -> 0.975 Inexact Rounded -sqtx4712 squareroot 0.0951 -> 0.308 Inexact Rounded -sqtx4713 squareroot 0.952 -> 0.976 Inexact Rounded -sqtx4714 squareroot 0.0952 -> 0.309 Inexact Rounded -sqtx4715 squareroot 0.953 -> 0.976 Inexact Rounded -sqtx4716 squareroot 0.0953 -> 0.309 Inexact Rounded -sqtx4717 squareroot 0.954 -> 0.977 Inexact Rounded -sqtx4718 squareroot 0.0954 -> 0.309 Inexact Rounded -sqtx4719 squareroot 0.955 -> 0.977 Inexact Rounded -sqtx4720 squareroot 0.0955 -> 0.309 Inexact Rounded -sqtx4721 squareroot 0.956 -> 0.978 Inexact Rounded -sqtx4722 squareroot 0.0956 -> 0.309 Inexact Rounded -sqtx4723 squareroot 0.957 -> 0.978 Inexact Rounded -sqtx4724 squareroot 0.0957 -> 0.309 Inexact Rounded -sqtx4725 squareroot 0.958 -> 0.979 Inexact Rounded -sqtx4726 squareroot 0.0958 -> 0.310 Inexact Rounded -sqtx4727 squareroot 0.959 -> 0.979 Inexact Rounded -sqtx4728 squareroot 0.0959 -> 0.310 Inexact Rounded -sqtx4729 squareroot 0.961 -> 0.980 Inexact Rounded -sqtx4730 squareroot 0.0961 -> 0.31 -sqtx4731 squareroot 0.962 -> 0.981 Inexact Rounded -sqtx4732 squareroot 0.0962 -> 0.310 Inexact Rounded -sqtx4733 squareroot 0.963 -> 0.981 Inexact Rounded -sqtx4734 squareroot 0.0963 -> 0.310 Inexact Rounded -sqtx4735 squareroot 0.964 -> 0.982 Inexact Rounded -sqtx4736 squareroot 0.0964 -> 0.310 Inexact Rounded -sqtx4737 squareroot 0.965 -> 0.982 Inexact Rounded -sqtx4738 squareroot 0.0965 -> 0.311 Inexact Rounded -sqtx4739 squareroot 0.966 -> 0.983 Inexact Rounded -sqtx4740 squareroot 0.0966 -> 0.311 Inexact Rounded -sqtx4741 squareroot 0.967 -> 0.983 Inexact Rounded -sqtx4742 squareroot 0.0967 -> 0.311 Inexact Rounded -sqtx4743 squareroot 0.968 -> 0.984 Inexact Rounded -sqtx4744 squareroot 0.0968 -> 0.311 Inexact Rounded -sqtx4745 squareroot 0.969 -> 0.984 Inexact Rounded -sqtx4746 squareroot 0.0969 -> 0.311 Inexact Rounded -sqtx4747 squareroot 0.971 -> 0.985 Inexact Rounded -sqtx4748 squareroot 0.0971 -> 0.312 Inexact Rounded -sqtx4749 squareroot 0.972 -> 0.986 Inexact Rounded -sqtx4750 squareroot 0.0972 -> 0.312 Inexact Rounded -sqtx4751 squareroot 0.973 -> 0.986 Inexact Rounded -sqtx4752 squareroot 0.0973 -> 0.312 Inexact Rounded -sqtx4753 squareroot 0.974 -> 0.987 Inexact Rounded -sqtx4754 squareroot 0.0974 -> 0.312 Inexact Rounded -sqtx4755 squareroot 0.975 -> 0.987 Inexact Rounded -sqtx4756 squareroot 0.0975 -> 0.312 Inexact Rounded -sqtx4757 squareroot 0.976 -> 0.988 Inexact Rounded -sqtx4758 squareroot 0.0976 -> 0.312 Inexact Rounded -sqtx4759 squareroot 0.977 -> 0.988 Inexact Rounded -sqtx4760 squareroot 0.0977 -> 0.313 Inexact Rounded -sqtx4761 squareroot 0.978 -> 0.989 Inexact Rounded -sqtx4762 squareroot 0.0978 -> 0.313 Inexact Rounded -sqtx4763 squareroot 0.979 -> 0.989 Inexact Rounded -sqtx4764 squareroot 0.0979 -> 0.313 Inexact Rounded -sqtx4765 squareroot 0.981 -> 0.990 Inexact Rounded -sqtx4766 squareroot 0.0981 -> 0.313 Inexact Rounded -sqtx4767 squareroot 0.982 -> 0.991 Inexact Rounded -sqtx4768 squareroot 0.0982 -> 0.313 Inexact Rounded -sqtx4769 squareroot 0.983 -> 0.991 Inexact Rounded -sqtx4770 squareroot 0.0983 -> 0.314 Inexact Rounded -sqtx4771 squareroot 0.984 -> 0.992 Inexact Rounded -sqtx4772 squareroot 0.0984 -> 0.314 Inexact Rounded -sqtx4773 squareroot 0.985 -> 0.992 Inexact Rounded -sqtx4774 squareroot 0.0985 -> 0.314 Inexact Rounded -sqtx4775 squareroot 0.986 -> 0.993 Inexact Rounded -sqtx4776 squareroot 0.0986 -> 0.314 Inexact Rounded -sqtx4777 squareroot 0.987 -> 0.993 Inexact Rounded -sqtx4778 squareroot 0.0987 -> 0.314 Inexact Rounded -sqtx4779 squareroot 0.988 -> 0.994 Inexact Rounded -sqtx4780 squareroot 0.0988 -> 0.314 Inexact Rounded -sqtx4781 squareroot 0.989 -> 0.994 Inexact Rounded -sqtx4782 squareroot 0.0989 -> 0.314 Inexact Rounded -sqtx4783 squareroot 0.991 -> 0.995 Inexact Rounded -sqtx4784 squareroot 0.0991 -> 0.315 Inexact Rounded -sqtx4785 squareroot 0.992 -> 0.996 Inexact Rounded -sqtx4786 squareroot 0.0992 -> 0.315 Inexact Rounded -sqtx4787 squareroot 0.993 -> 0.996 Inexact Rounded -sqtx4788 squareroot 0.0993 -> 0.315 Inexact Rounded -sqtx4789 squareroot 0.994 -> 0.997 Inexact Rounded -sqtx4790 squareroot 0.0994 -> 0.315 Inexact Rounded -sqtx4791 squareroot 0.995 -> 0.997 Inexact Rounded -sqtx4792 squareroot 0.0995 -> 0.315 Inexact Rounded -sqtx4793 squareroot 0.996 -> 0.998 Inexact Rounded -sqtx4794 squareroot 0.0996 -> 0.316 Inexact Rounded -sqtx4795 squareroot 0.997 -> 0.998 Inexact Rounded -sqtx4796 squareroot 0.0997 -> 0.316 Inexact Rounded -sqtx4797 squareroot 0.998 -> 0.999 Inexact Rounded -sqtx4798 squareroot 0.0998 -> 0.316 Inexact Rounded -sqtx4799 squareroot 0.999 -> 0.999 Inexact Rounded -sqtx4800 squareroot 0.0999 -> 0.316 Inexact Rounded - --- A group of precision 4 tests where Hull & Abrham adjustments are --- needed in some cases (both up and down) [see Hull1985b] -rounding: half_even -maxExponent: 999 -minexponent: -999 -precision: 4 -sqtx5001 squareroot 0.0118 -> 0.1086 Inexact Rounded -sqtx5002 squareroot 0.119 -> 0.3450 Inexact Rounded -sqtx5003 squareroot 0.0119 -> 0.1091 Inexact Rounded -sqtx5004 squareroot 0.121 -> 0.3479 Inexact Rounded -sqtx5005 squareroot 0.0121 -> 0.11 -sqtx5006 squareroot 0.122 -> 0.3493 Inexact Rounded -sqtx5007 squareroot 0.0122 -> 0.1105 Inexact Rounded -sqtx5008 squareroot 0.123 -> 0.3507 Inexact Rounded -sqtx5009 squareroot 0.494 -> 0.7029 Inexact Rounded -sqtx5010 squareroot 0.0669 -> 0.2587 Inexact Rounded -sqtx5011 squareroot 0.9558 -> 0.9777 Inexact Rounded -sqtx5012 squareroot 0.9348 -> 0.9669 Inexact Rounded -sqtx5013 squareroot 0.9345 -> 0.9667 Inexact Rounded -sqtx5014 squareroot 0.09345 -> 0.3057 Inexact Rounded -sqtx5015 squareroot 0.9346 -> 0.9667 Inexact Rounded -sqtx5016 squareroot 0.09346 -> 0.3057 Inexact Rounded -sqtx5017 squareroot 0.9347 -> 0.9668 Inexact Rounded - --- examples from decArith -precision: 9 -sqtx700 squareroot 0 -> '0' -sqtx701 squareroot -0 -> '-0' -sqtx702 squareroot 0.39 -> 0.624499800 Inexact Rounded -sqtx703 squareroot 100 -> '10' -sqtx704 squareroot 1.00 -> '1.0' -sqtx705 squareroot 7 -> '2.64575131' Inexact Rounded -sqtx706 squareroot 10 -> 3.16227766 Inexact Rounded - --- some one-offs -precision: 9 -sqtx711 squareroot 0.1 -> 0.316227766 Inexact Rounded -sqtx712 squareroot 0.2 -> 0.447213595 Inexact Rounded -sqtx713 squareroot 0.3 -> 0.547722558 Inexact Rounded -sqtx714 squareroot 0.4 -> 0.632455532 Inexact Rounded -sqtx715 squareroot 0.5 -> 0.707106781 Inexact Rounded -sqtx716 squareroot 0.6 -> 0.774596669 Inexact Rounded -sqtx717 squareroot 0.7 -> 0.836660027 Inexact Rounded -sqtx718 squareroot 0.8 -> 0.894427191 Inexact Rounded -sqtx719 squareroot 0.9 -> 0.948683298 Inexact Rounded -precision: 10 -- note no normalizatoin here -sqtx720 squareroot +0.1 -> 0.3162277660 Inexact Rounded -precision: 11 -sqtx721 squareroot +0.1 -> 0.31622776602 Inexact Rounded -precision: 12 -sqtx722 squareroot +0.1 -> 0.316227766017 Inexact Rounded -precision: 9 -sqtx723 squareroot 0.39 -> 0.624499800 Inexact Rounded -precision: 15 -sqtx724 squareroot 0.39 -> 0.624499799839840 Inexact Rounded - --- discussion cases -precision: 7 -sqtx731 squareroot 9 -> 3 -sqtx732 squareroot 100 -> 10 -sqtx733 squareroot 123 -> 11.09054 Inexact Rounded -sqtx734 squareroot 144 -> 12 -sqtx735 squareroot 156 -> 12.49000 Inexact Rounded -sqtx736 squareroot 10000 -> 100 - --- values close to overflow (if there were input rounding) -maxexponent: 99 -minexponent: -99 -precision: 5 -sqtx760 squareroot 9.9997E+99 -> 9.9998E+49 Inexact Rounded -sqtx761 squareroot 9.9998E+99 -> 9.9999E+49 Inexact Rounded -sqtx762 squareroot 9.9999E+99 -> 9.9999E+49 Inexact Rounded -sqtx763 squareroot 9.99991E+99 -> 1.0000E+50 Inexact Rounded -sqtx764 squareroot 9.99994E+99 -> 1.0000E+50 Inexact Rounded -sqtx765 squareroot 9.99995E+99 -> 1.0000E+50 Inexact Rounded -sqtx766 squareroot 9.99999E+99 -> 1.0000E+50 Inexact Rounded -precision: 9 -sqtx770 squareroot 9.9997E+99 -> 9.99985000E+49 Inexact Rounded -sqtx771 squareroot 9.9998E+99 -> 9.99990000E+49 Inexact Rounded -sqtx772 squareroot 9.9999E+99 -> 9.99995000E+49 Inexact Rounded -sqtx773 squareroot 9.99991E+99 -> 9.99995500E+49 Inexact Rounded -sqtx774 squareroot 9.99994E+99 -> 9.99997000E+49 Inexact Rounded -sqtx775 squareroot 9.99995E+99 -> 9.99997500E+49 Inexact Rounded -sqtx776 squareroot 9.99999E+99 -> 9.99999500E+49 Inexact Rounded -precision: 20 -sqtx780 squareroot 9.9997E+99 -> '9.9998499988749831247E+49' Inexact Rounded -sqtx781 squareroot 9.9998E+99 -> '9.9998999994999949999E+49' Inexact Rounded -sqtx782 squareroot 9.9999E+99 -> '9.9999499998749993750E+49' Inexact Rounded -sqtx783 squareroot 9.99991E+99 -> '9.9999549998987495444E+49' Inexact Rounded -sqtx784 squareroot 9.99994E+99 -> '9.9999699999549998650E+49' Inexact Rounded -sqtx785 squareroot 9.99995E+99 -> '9.9999749999687499219E+49' Inexact Rounded -sqtx786 squareroot 9.99999E+99 -> '9.9999949999987499994E+49' Inexact Rounded - --- subnormals and underflows [these can only result when eMax is < digits+1] --- Etiny = -(Emax + (precision-1)) --- start with subnormal operands and normal results -maxexponent: 9 -minexponent: -9 -precision: 9 -- Etiny=-17 -sqtx800 squareroot 1E-17 -> 3.16227766E-9 Inexact Rounded -sqtx801 squareroot 10E-17 -> 1.0E-8 -precision: 10 -- Etiny=-18 -sqtx802 squareroot 10E-18 -> 3.162277660E-9 Inexact Rounded -sqtx803 squareroot 1E-18 -> 1E-9 - -precision: 11 -- Etiny=-19 -sqtx804 squareroot 1E-19 -> 3.162277660E-10 Underflow Subnormal Inexact Rounded -sqtx805 squareroot 10E-19 -> 1.0E-9 -precision: 12 -- Etiny=-20 -sqtx806 squareroot 10E-20 -> 3.1622776602E-10 Underflow Subnormal Inexact Rounded -sqtx807 squareroot 1E-20 -> 1E-10 Subnormal -- Exact Subnormal case - -precision: 13 -- Etiny=-21 -sqtx808 squareroot 1E-21 -> 3.1622776602E-11 Underflow Subnormal Inexact Rounded -sqtx809 squareroot 10E-21 -> 1.0E-10 Subnormal -precision: 14 -- Etiny=-22 -sqtx810 squareroot 1E-21 -> 3.16227766017E-11 Underflow Subnormal Inexact Rounded -sqtx811 squareroot 10E-22 -> 3.16227766017E-11 Underflow Subnormal Inexact Rounded -sqtx812 squareroot 1E-22 -> 1E-11 Subnormal -- Exact Subnormal case - - --- special values -maxexponent: 999 -minexponent: -999 -sqtx820 squareroot Inf -> Infinity -sqtx821 squareroot -Inf -> NaN Invalid_operation -sqtx822 squareroot NaN -> NaN -sqtx823 squareroot sNaN -> NaN Invalid_operation --- propagating NaNs -sqtx824 squareroot sNaN123 -> NaN123 Invalid_operation -sqtx825 squareroot -sNaN321 -> -NaN321 Invalid_operation -sqtx826 squareroot NaN456 -> NaN456 -sqtx827 squareroot -NaN654 -> -NaN654 -sqtx828 squareroot NaN1 -> NaN1 - --- Null test -sqtx900 squareroot # -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/subtract.decTest b/sys/lib/python/test/decimaltestdata/subtract.decTest deleted file mode 100644 index bdedc5b89..000000000 --- a/sys/lib/python/test/decimaltestdata/subtract.decTest +++ /dev/null @@ -1,863 +0,0 @@ ------------------------------------------------------------------------- --- subtract.decTest -- decimal subtraction -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 384 -minexponent: -383 - --- [first group are 'quick confidence check'] -subx001 subtract 0 0 -> '0' -subx002 subtract 1 1 -> '0' -subx003 subtract 1 2 -> '-1' -subx004 subtract 2 1 -> '1' -subx005 subtract 2 2 -> '0' -subx006 subtract 3 2 -> '1' -subx007 subtract 2 3 -> '-1' - -subx011 subtract -0 0 -> '-0' -subx012 subtract -1 1 -> '-2' -subx013 subtract -1 2 -> '-3' -subx014 subtract -2 1 -> '-3' -subx015 subtract -2 2 -> '-4' -subx016 subtract -3 2 -> '-5' -subx017 subtract -2 3 -> '-5' - -subx021 subtract 0 -0 -> '0' -subx022 subtract 1 -1 -> '2' -subx023 subtract 1 -2 -> '3' -subx024 subtract 2 -1 -> '3' -subx025 subtract 2 -2 -> '4' -subx026 subtract 3 -2 -> '5' -subx027 subtract 2 -3 -> '5' - -subx030 subtract 11 1 -> 10 -subx031 subtract 10 1 -> 9 -subx032 subtract 9 1 -> 8 -subx033 subtract 1 1 -> 0 -subx034 subtract 0 1 -> -1 -subx035 subtract -1 1 -> -2 -subx036 subtract -9 1 -> -10 -subx037 subtract -10 1 -> -11 -subx038 subtract -11 1 -> -12 - -subx040 subtract '5.75' '3.3' -> '2.45' -subx041 subtract '5' '-3' -> '8' -subx042 subtract '-5' '-3' -> '-2' -subx043 subtract '-7' '2.5' -> '-9.5' -subx044 subtract '0.7' '0.3' -> '0.4' -subx045 subtract '1.3' '0.3' -> '1.0' -subx046 subtract '1.25' '1.25' -> '0.00' - -subx050 subtract '1.23456789' '1.00000000' -> '0.23456789' -subx051 subtract '1.23456789' '1.00000089' -> '0.23456700' -subx052 subtract '0.5555555559' '0.0000000001' -> '0.555555556' Inexact Rounded -subx053 subtract '0.5555555559' '0.0000000005' -> '0.555555555' Inexact Rounded -subx054 subtract '0.4444444444' '0.1111111111' -> '0.333333333' Inexact Rounded -subx055 subtract '1.0000000000' '0.00000001' -> '0.999999990' Rounded -subx056 subtract '0.4444444444999' '0' -> '0.444444444' Inexact Rounded -subx057 subtract '0.4444444445000' '0' -> '0.444444445' Inexact Rounded - -subx060 subtract '70' '10000e+9' -> '-1.00000000E+13' Inexact Rounded -subx061 subtract '700' '10000e+9' -> '-1.00000000E+13' Inexact Rounded -subx062 subtract '7000' '10000e+9' -> '-9.99999999E+12' Inexact Rounded -subx063 subtract '70000' '10000e+9' -> '-9.99999993E+12' Rounded -subx064 subtract '700000' '10000e+9' -> '-9.99999930E+12' Rounded - -- symmetry: -subx065 subtract '10000e+9' '70' -> '1.00000000E+13' Inexact Rounded -subx066 subtract '10000e+9' '700' -> '1.00000000E+13' Inexact Rounded -subx067 subtract '10000e+9' '7000' -> '9.99999999E+12' Inexact Rounded -subx068 subtract '10000e+9' '70000' -> '9.99999993E+12' Rounded -subx069 subtract '10000e+9' '700000' -> '9.99999930E+12' Rounded - - -- change precision -subx080 subtract '10000e+9' '70000' -> '9.99999993E+12' Rounded -precision: 6 -subx081 subtract '10000e+9' '70000' -> '1.00000E+13' Inexact Rounded -precision: 9 - - -- some of the next group are really constructor tests -subx090 subtract '00.0' '0.0' -> '0.0' -subx091 subtract '00.0' '0.00' -> '0.00' -subx092 subtract '0.00' '00.0' -> '0.00' -subx093 subtract '00.0' '0.00' -> '0.00' -subx094 subtract '0.00' '00.0' -> '0.00' -subx095 subtract '3' '.3' -> '2.7' -subx096 subtract '3.' '.3' -> '2.7' -subx097 subtract '3.0' '.3' -> '2.7' -subx098 subtract '3.00' '.3' -> '2.70' -subx099 subtract '3' '3' -> '0' -subx100 subtract '3' '+3' -> '0' -subx101 subtract '3' '-3' -> '6' -subx102 subtract '3' '0.3' -> '2.7' -subx103 subtract '3.' '0.3' -> '2.7' -subx104 subtract '3.0' '0.3' -> '2.7' -subx105 subtract '3.00' '0.3' -> '2.70' -subx106 subtract '3' '3.0' -> '0.0' -subx107 subtract '3' '+3.0' -> '0.0' -subx108 subtract '3' '-3.0' -> '6.0' - --- the above all from add; massaged and extended. Now some new ones... --- [particularly important for comparisons] --- NB: -xE-8 below were non-exponents pre-ANSI X3-274, and -1E-7 or 0E-7 --- with input rounding. -subx120 subtract '10.23456784' '10.23456789' -> '-5E-8' -subx121 subtract '10.23456785' '10.23456789' -> '-4E-8' -subx122 subtract '10.23456786' '10.23456789' -> '-3E-8' -subx123 subtract '10.23456787' '10.23456789' -> '-2E-8' -subx124 subtract '10.23456788' '10.23456789' -> '-1E-8' -subx125 subtract '10.23456789' '10.23456789' -> '0E-8' -subx126 subtract '10.23456790' '10.23456789' -> '1E-8' -subx127 subtract '10.23456791' '10.23456789' -> '2E-8' -subx128 subtract '10.23456792' '10.23456789' -> '3E-8' -subx129 subtract '10.23456793' '10.23456789' -> '4E-8' -subx130 subtract '10.23456794' '10.23456789' -> '5E-8' -subx131 subtract '10.23456781' '10.23456786' -> '-5E-8' -subx132 subtract '10.23456782' '10.23456786' -> '-4E-8' -subx133 subtract '10.23456783' '10.23456786' -> '-3E-8' -subx134 subtract '10.23456784' '10.23456786' -> '-2E-8' -subx135 subtract '10.23456785' '10.23456786' -> '-1E-8' -subx136 subtract '10.23456786' '10.23456786' -> '0E-8' -subx137 subtract '10.23456787' '10.23456786' -> '1E-8' -subx138 subtract '10.23456788' '10.23456786' -> '2E-8' -subx139 subtract '10.23456789' '10.23456786' -> '3E-8' -subx140 subtract '10.23456790' '10.23456786' -> '4E-8' -subx141 subtract '10.23456791' '10.23456786' -> '5E-8' -subx142 subtract '1' '0.999999999' -> '1E-9' -subx143 subtract '0.999999999' '1' -> '-1E-9' -subx144 subtract '-10.23456780' '-10.23456786' -> '6E-8' -subx145 subtract '-10.23456790' '-10.23456786' -> '-4E-8' -subx146 subtract '-10.23456791' '-10.23456786' -> '-5E-8' - -precision: 3 -subx150 subtract '12345678900000' '9999999999999' -> 2.35E+12 Inexact Rounded -subx151 subtract '9999999999999' '12345678900000' -> -2.35E+12 Inexact Rounded -precision: 6 -subx152 subtract '12345678900000' '9999999999999' -> 2.34568E+12 Inexact Rounded -subx153 subtract '9999999999999' '12345678900000' -> -2.34568E+12 Inexact Rounded -precision: 9 -subx154 subtract '12345678900000' '9999999999999' -> 2.34567890E+12 Inexact Rounded -subx155 subtract '9999999999999' '12345678900000' -> -2.34567890E+12 Inexact Rounded -precision: 12 -subx156 subtract '12345678900000' '9999999999999' -> 2.34567890000E+12 Inexact Rounded -subx157 subtract '9999999999999' '12345678900000' -> -2.34567890000E+12 Inexact Rounded -precision: 15 -subx158 subtract '12345678900000' '9999999999999' -> 2345678900001 -subx159 subtract '9999999999999' '12345678900000' -> -2345678900001 -precision: 9 - --- additional scaled arithmetic tests [0.97 problem] -subx160 subtract '0' '.1' -> '-0.1' -subx161 subtract '00' '.97983' -> '-0.97983' -subx162 subtract '0' '.9' -> '-0.9' -subx163 subtract '0' '0.102' -> '-0.102' -subx164 subtract '0' '.4' -> '-0.4' -subx165 subtract '0' '.307' -> '-0.307' -subx166 subtract '0' '.43822' -> '-0.43822' -subx167 subtract '0' '.911' -> '-0.911' -subx168 subtract '.0' '.02' -> '-0.02' -subx169 subtract '00' '.392' -> '-0.392' -subx170 subtract '0' '.26' -> '-0.26' -subx171 subtract '0' '0.51' -> '-0.51' -subx172 subtract '0' '.2234' -> '-0.2234' -subx173 subtract '0' '.2' -> '-0.2' -subx174 subtract '.0' '.0008' -> '-0.0008' --- 0. on left -subx180 subtract '0.0' '-.1' -> '0.1' -subx181 subtract '0.00' '-.97983' -> '0.97983' -subx182 subtract '0.0' '-.9' -> '0.9' -subx183 subtract '0.0' '-0.102' -> '0.102' -subx184 subtract '0.0' '-.4' -> '0.4' -subx185 subtract '0.0' '-.307' -> '0.307' -subx186 subtract '0.0' '-.43822' -> '0.43822' -subx187 subtract '0.0' '-.911' -> '0.911' -subx188 subtract '0.0' '-.02' -> '0.02' -subx189 subtract '0.00' '-.392' -> '0.392' -subx190 subtract '0.0' '-.26' -> '0.26' -subx191 subtract '0.0' '-0.51' -> '0.51' -subx192 subtract '0.0' '-.2234' -> '0.2234' -subx193 subtract '0.0' '-.2' -> '0.2' -subx194 subtract '0.0' '-.0008' -> '0.0008' --- negatives of same -subx200 subtract '0' '-.1' -> '0.1' -subx201 subtract '00' '-.97983' -> '0.97983' -subx202 subtract '0' '-.9' -> '0.9' -subx203 subtract '0' '-0.102' -> '0.102' -subx204 subtract '0' '-.4' -> '0.4' -subx205 subtract '0' '-.307' -> '0.307' -subx206 subtract '0' '-.43822' -> '0.43822' -subx207 subtract '0' '-.911' -> '0.911' -subx208 subtract '.0' '-.02' -> '0.02' -subx209 subtract '00' '-.392' -> '0.392' -subx210 subtract '0' '-.26' -> '0.26' -subx211 subtract '0' '-0.51' -> '0.51' -subx212 subtract '0' '-.2234' -> '0.2234' -subx213 subtract '0' '-.2' -> '0.2' -subx214 subtract '.0' '-.0008' -> '0.0008' - --- more fixed, LHS swaps [really the same as testcases under add] -subx220 subtract '-56267E-12' 0 -> '-5.6267E-8' -subx221 subtract '-56267E-11' 0 -> '-5.6267E-7' -subx222 subtract '-56267E-10' 0 -> '-0.0000056267' -subx223 subtract '-56267E-9' 0 -> '-0.000056267' -subx224 subtract '-56267E-8' 0 -> '-0.00056267' -subx225 subtract '-56267E-7' 0 -> '-0.0056267' -subx226 subtract '-56267E-6' 0 -> '-0.056267' -subx227 subtract '-56267E-5' 0 -> '-0.56267' -subx228 subtract '-56267E-2' 0 -> '-562.67' -subx229 subtract '-56267E-1' 0 -> '-5626.7' -subx230 subtract '-56267E-0' 0 -> '-56267' --- symmetry ... -subx240 subtract 0 '-56267E-12' -> '5.6267E-8' -subx241 subtract 0 '-56267E-11' -> '5.6267E-7' -subx242 subtract 0 '-56267E-10' -> '0.0000056267' -subx243 subtract 0 '-56267E-9' -> '0.000056267' -subx244 subtract 0 '-56267E-8' -> '0.00056267' -subx245 subtract 0 '-56267E-7' -> '0.0056267' -subx246 subtract 0 '-56267E-6' -> '0.056267' -subx247 subtract 0 '-56267E-5' -> '0.56267' -subx248 subtract 0 '-56267E-2' -> '562.67' -subx249 subtract 0 '-56267E-1' -> '5626.7' -subx250 subtract 0 '-56267E-0' -> '56267' - --- now some more from the 'new' add -precision: 9 -subx301 subtract '1.23456789' '1.00000000' -> '0.23456789' -subx302 subtract '1.23456789' '1.00000011' -> '0.23456778' - -subx311 subtract '0.4444444444' '0.5555555555' -> '-0.111111111' Inexact Rounded -subx312 subtract '0.4444444440' '0.5555555555' -> '-0.111111112' Inexact Rounded -subx313 subtract '0.4444444444' '0.5555555550' -> '-0.111111111' Inexact Rounded -subx314 subtract '0.44444444449' '0' -> '0.444444444' Inexact Rounded -subx315 subtract '0.444444444499' '0' -> '0.444444444' Inexact Rounded -subx316 subtract '0.4444444444999' '0' -> '0.444444444' Inexact Rounded -subx317 subtract '0.4444444445000' '0' -> '0.444444445' Inexact Rounded -subx318 subtract '0.4444444445001' '0' -> '0.444444445' Inexact Rounded -subx319 subtract '0.444444444501' '0' -> '0.444444445' Inexact Rounded -subx320 subtract '0.44444444451' '0' -> '0.444444445' Inexact Rounded - --- some carrying effects -subx321 subtract '0.9998' '0.0000' -> '0.9998' -subx322 subtract '0.9998' '0.0001' -> '0.9997' -subx323 subtract '0.9998' '0.0002' -> '0.9996' -subx324 subtract '0.9998' '0.0003' -> '0.9995' -subx325 subtract '0.9998' '-0.0000' -> '0.9998' -subx326 subtract '0.9998' '-0.0001' -> '0.9999' -subx327 subtract '0.9998' '-0.0002' -> '1.0000' -subx328 subtract '0.9998' '-0.0003' -> '1.0001' - -subx330 subtract '70' '10000e+9' -> '-1.00000000E+13' Inexact Rounded -subx331 subtract '700' '10000e+9' -> '-1.00000000E+13' Inexact Rounded -subx332 subtract '7000' '10000e+9' -> '-9.99999999E+12' Inexact Rounded -subx333 subtract '70000' '10000e+9' -> '-9.99999993E+12' Rounded -subx334 subtract '700000' '10000e+9' -> '-9.99999930E+12' Rounded -subx335 subtract '7000000' '10000e+9' -> '-9.99999300E+12' Rounded --- symmetry: -subx340 subtract '10000e+9' '70' -> '1.00000000E+13' Inexact Rounded -subx341 subtract '10000e+9' '700' -> '1.00000000E+13' Inexact Rounded -subx342 subtract '10000e+9' '7000' -> '9.99999999E+12' Inexact Rounded -subx343 subtract '10000e+9' '70000' -> '9.99999993E+12' Rounded -subx344 subtract '10000e+9' '700000' -> '9.99999930E+12' Rounded -subx345 subtract '10000e+9' '7000000' -> '9.99999300E+12' Rounded - --- same, higher precision -precision: 15 -subx346 subtract '10000e+9' '7' -> '9999999999993' -subx347 subtract '10000e+9' '70' -> '9999999999930' -subx348 subtract '10000e+9' '700' -> '9999999999300' -subx349 subtract '10000e+9' '7000' -> '9999999993000' -subx350 subtract '10000e+9' '70000' -> '9999999930000' -subx351 subtract '10000e+9' '700000' -> '9999999300000' -subx352 subtract '7' '10000e+9' -> '-9999999999993' -subx353 subtract '70' '10000e+9' -> '-9999999999930' -subx354 subtract '700' '10000e+9' -> '-9999999999300' -subx355 subtract '7000' '10000e+9' -> '-9999999993000' -subx356 subtract '70000' '10000e+9' -> '-9999999930000' -subx357 subtract '700000' '10000e+9' -> '-9999999300000' - --- zero preservation -precision: 6 -subx360 subtract '10000e+9' '70000' -> '1.00000E+13' Inexact Rounded -subx361 subtract 1 '0.0001' -> '0.9999' -subx362 subtract 1 '0.00001' -> '0.99999' -subx363 subtract 1 '0.000001' -> '0.999999' -subx364 subtract 1 '0.0000001' -> '1.00000' Inexact Rounded -subx365 subtract 1 '0.00000001' -> '1.00000' Inexact Rounded - --- some funny zeros [in case of bad signum] -subx370 subtract 1 0 -> 1 -subx371 subtract 1 0. -> 1 -subx372 subtract 1 .0 -> 1.0 -subx373 subtract 1 0.0 -> 1.0 -subx374 subtract 0 1 -> -1 -subx375 subtract 0. 1 -> -1 -subx376 subtract .0 1 -> -1.0 -subx377 subtract 0.0 1 -> -1.0 - -precision: 9 - --- leading 0 digit before round -subx910 subtract -103519362 -51897955.3 -> -51621406.7 -subx911 subtract 159579.444 89827.5229 -> 69751.9211 - -subx920 subtract 333.123456 33.1234566 -> 299.999999 Inexact Rounded -subx921 subtract 333.123456 33.1234565 -> 300.000000 Inexact Rounded -subx922 subtract 133.123456 33.1234565 -> 99.9999995 -subx923 subtract 133.123456 33.1234564 -> 99.9999996 -subx924 subtract 133.123456 33.1234540 -> 100.000002 Rounded -subx925 subtract 133.123456 43.1234560 -> 90.0000000 -subx926 subtract 133.123456 43.1234561 -> 89.9999999 -subx927 subtract 133.123456 43.1234566 -> 89.9999994 -subx928 subtract 101.123456 91.1234566 -> 9.9999994 -subx929 subtract 101.123456 99.1234566 -> 1.9999994 - --- more of the same; probe for cluster boundary problems -precision: 1 -subx930 subtract 11 2 -> 9 -precision: 2 -subx932 subtract 101 2 -> 99 -precision: 3 -subx934 subtract 101 2.1 -> 98.9 -subx935 subtract 101 92.01 -> 8.99 -precision: 4 -subx936 subtract 101 2.01 -> 98.99 -subx937 subtract 101 92.01 -> 8.99 -subx938 subtract 101 92.006 -> 8.994 -precision: 5 -subx939 subtract 101 2.001 -> 98.999 -subx940 subtract 101 92.001 -> 8.999 -subx941 subtract 101 92.0006 -> 8.9994 -precision: 6 -subx942 subtract 101 2.0001 -> 98.9999 -subx943 subtract 101 92.0001 -> 8.9999 -subx944 subtract 101 92.00006 -> 8.99994 -precision: 7 -subx945 subtract 101 2.00001 -> 98.99999 -subx946 subtract 101 92.00001 -> 8.99999 -subx947 subtract 101 92.000006 -> 8.999994 -precision: 8 -subx948 subtract 101 2.000001 -> 98.999999 -subx949 subtract 101 92.000001 -> 8.999999 -subx950 subtract 101 92.0000006 -> 8.9999994 -precision: 9 -subx951 subtract 101 2.0000001 -> 98.9999999 -subx952 subtract 101 92.0000001 -> 8.9999999 -subx953 subtract 101 92.00000006 -> 8.99999994 - -precision: 9 - --- more LHS swaps [were fixed] -subx390 subtract '-56267E-10' 0 -> '-0.0000056267' -subx391 subtract '-56267E-6' 0 -> '-0.056267' -subx392 subtract '-56267E-5' 0 -> '-0.56267' -subx393 subtract '-56267E-4' 0 -> '-5.6267' -subx394 subtract '-56267E-3' 0 -> '-56.267' -subx395 subtract '-56267E-2' 0 -> '-562.67' -subx396 subtract '-56267E-1' 0 -> '-5626.7' -subx397 subtract '-56267E-0' 0 -> '-56267' -subx398 subtract '-5E-10' 0 -> '-5E-10' -subx399 subtract '-5E-7' 0 -> '-5E-7' -subx400 subtract '-5E-6' 0 -> '-0.000005' -subx401 subtract '-5E-5' 0 -> '-0.00005' -subx402 subtract '-5E-4' 0 -> '-0.0005' -subx403 subtract '-5E-1' 0 -> '-0.5' -subx404 subtract '-5E0' 0 -> '-5' -subx405 subtract '-5E1' 0 -> '-50' -subx406 subtract '-5E5' 0 -> '-500000' -subx407 subtract '-5E8' 0 -> '-500000000' -subx408 subtract '-5E9' 0 -> '-5.00000000E+9' Rounded -subx409 subtract '-5E10' 0 -> '-5.00000000E+10' Rounded -subx410 subtract '-5E11' 0 -> '-5.00000000E+11' Rounded -subx411 subtract '-5E100' 0 -> '-5.00000000E+100' Rounded - --- more RHS swaps [were fixed] -subx420 subtract 0 '-56267E-10' -> '0.0000056267' -subx421 subtract 0 '-56267E-6' -> '0.056267' -subx422 subtract 0 '-56267E-5' -> '0.56267' -subx423 subtract 0 '-56267E-4' -> '5.6267' -subx424 subtract 0 '-56267E-3' -> '56.267' -subx425 subtract 0 '-56267E-2' -> '562.67' -subx426 subtract 0 '-56267E-1' -> '5626.7' -subx427 subtract 0 '-56267E-0' -> '56267' -subx428 subtract 0 '-5E-10' -> '5E-10' -subx429 subtract 0 '-5E-7' -> '5E-7' -subx430 subtract 0 '-5E-6' -> '0.000005' -subx431 subtract 0 '-5E-5' -> '0.00005' -subx432 subtract 0 '-5E-4' -> '0.0005' -subx433 subtract 0 '-5E-1' -> '0.5' -subx434 subtract 0 '-5E0' -> '5' -subx435 subtract 0 '-5E1' -> '50' -subx436 subtract 0 '-5E5' -> '500000' -subx437 subtract 0 '-5E8' -> '500000000' -subx438 subtract 0 '-5E9' -> '5.00000000E+9' Rounded -subx439 subtract 0 '-5E10' -> '5.00000000E+10' Rounded -subx440 subtract 0 '-5E11' -> '5.00000000E+11' Rounded -subx441 subtract 0 '-5E100' -> '5.00000000E+100' Rounded - - --- try borderline precision, with carries, etc. -precision: 15 -subx461 subtract '1E+12' '1' -> '999999999999' -subx462 subtract '1E+12' '-1.11' -> '1000000000001.11' -subx463 subtract '1.11' '-1E+12' -> '1000000000001.11' -subx464 subtract '-1' '-1E+12' -> '999999999999' -subx465 subtract '7E+12' '1' -> '6999999999999' -subx466 subtract '7E+12' '-1.11' -> '7000000000001.11' -subx467 subtract '1.11' '-7E+12' -> '7000000000001.11' -subx468 subtract '-1' '-7E+12' -> '6999999999999' - --- 123456789012345 123456789012345 1 23456789012345 -subx470 subtract '0.444444444444444' '-0.555555555555563' -> '1.00000000000001' Inexact Rounded -subx471 subtract '0.444444444444444' '-0.555555555555562' -> '1.00000000000001' Inexact Rounded -subx472 subtract '0.444444444444444' '-0.555555555555561' -> '1.00000000000001' Inexact Rounded -subx473 subtract '0.444444444444444' '-0.555555555555560' -> '1.00000000000000' Inexact Rounded -subx474 subtract '0.444444444444444' '-0.555555555555559' -> '1.00000000000000' Inexact Rounded -subx475 subtract '0.444444444444444' '-0.555555555555558' -> '1.00000000000000' Inexact Rounded -subx476 subtract '0.444444444444444' '-0.555555555555557' -> '1.00000000000000' Inexact Rounded -subx477 subtract '0.444444444444444' '-0.555555555555556' -> '1.00000000000000' Rounded -subx478 subtract '0.444444444444444' '-0.555555555555555' -> '0.999999999999999' -subx479 subtract '0.444444444444444' '-0.555555555555554' -> '0.999999999999998' -subx480 subtract '0.444444444444444' '-0.555555555555553' -> '0.999999999999997' -subx481 subtract '0.444444444444444' '-0.555555555555552' -> '0.999999999999996' -subx482 subtract '0.444444444444444' '-0.555555555555551' -> '0.999999999999995' -subx483 subtract '0.444444444444444' '-0.555555555555550' -> '0.999999999999994' - --- and some more, including residue effects and different roundings -precision: 9 -rounding: half_up -subx500 subtract '123456789' 0 -> '123456789' -subx501 subtract '123456789' 0.000000001 -> '123456789' Inexact Rounded -subx502 subtract '123456789' 0.000001 -> '123456789' Inexact Rounded -subx503 subtract '123456789' 0.1 -> '123456789' Inexact Rounded -subx504 subtract '123456789' 0.4 -> '123456789' Inexact Rounded -subx505 subtract '123456789' 0.49 -> '123456789' Inexact Rounded -subx506 subtract '123456789' 0.499999 -> '123456789' Inexact Rounded -subx507 subtract '123456789' 0.499999999 -> '123456789' Inexact Rounded -subx508 subtract '123456789' 0.5 -> '123456789' Inexact Rounded -subx509 subtract '123456789' 0.500000001 -> '123456788' Inexact Rounded -subx510 subtract '123456789' 0.500001 -> '123456788' Inexact Rounded -subx511 subtract '123456789' 0.51 -> '123456788' Inexact Rounded -subx512 subtract '123456789' 0.6 -> '123456788' Inexact Rounded -subx513 subtract '123456789' 0.9 -> '123456788' Inexact Rounded -subx514 subtract '123456789' 0.99999 -> '123456788' Inexact Rounded -subx515 subtract '123456789' 0.999999999 -> '123456788' Inexact Rounded -subx516 subtract '123456789' 1 -> '123456788' -subx517 subtract '123456789' 1.000000001 -> '123456788' Inexact Rounded -subx518 subtract '123456789' 1.00001 -> '123456788' Inexact Rounded -subx519 subtract '123456789' 1.1 -> '123456788' Inexact Rounded - -rounding: half_even -subx520 subtract '123456789' 0 -> '123456789' -subx521 subtract '123456789' 0.000000001 -> '123456789' Inexact Rounded -subx522 subtract '123456789' 0.000001 -> '123456789' Inexact Rounded -subx523 subtract '123456789' 0.1 -> '123456789' Inexact Rounded -subx524 subtract '123456789' 0.4 -> '123456789' Inexact Rounded -subx525 subtract '123456789' 0.49 -> '123456789' Inexact Rounded -subx526 subtract '123456789' 0.499999 -> '123456789' Inexact Rounded -subx527 subtract '123456789' 0.499999999 -> '123456789' Inexact Rounded -subx528 subtract '123456789' 0.5 -> '123456788' Inexact Rounded -subx529 subtract '123456789' 0.500000001 -> '123456788' Inexact Rounded -subx530 subtract '123456789' 0.500001 -> '123456788' Inexact Rounded -subx531 subtract '123456789' 0.51 -> '123456788' Inexact Rounded -subx532 subtract '123456789' 0.6 -> '123456788' Inexact Rounded -subx533 subtract '123456789' 0.9 -> '123456788' Inexact Rounded -subx534 subtract '123456789' 0.99999 -> '123456788' Inexact Rounded -subx535 subtract '123456789' 0.999999999 -> '123456788' Inexact Rounded -subx536 subtract '123456789' 1 -> '123456788' -subx537 subtract '123456789' 1.00000001 -> '123456788' Inexact Rounded -subx538 subtract '123456789' 1.00001 -> '123456788' Inexact Rounded -subx539 subtract '123456789' 1.1 -> '123456788' Inexact Rounded --- critical few with even bottom digit... -subx540 subtract '123456788' 0.499999999 -> '123456788' Inexact Rounded -subx541 subtract '123456788' 0.5 -> '123456788' Inexact Rounded -subx542 subtract '123456788' 0.500000001 -> '123456787' Inexact Rounded - -rounding: down -subx550 subtract '123456789' 0 -> '123456789' -subx551 subtract '123456789' 0.000000001 -> '123456788' Inexact Rounded -subx552 subtract '123456789' 0.000001 -> '123456788' Inexact Rounded -subx553 subtract '123456789' 0.1 -> '123456788' Inexact Rounded -subx554 subtract '123456789' 0.4 -> '123456788' Inexact Rounded -subx555 subtract '123456789' 0.49 -> '123456788' Inexact Rounded -subx556 subtract '123456789' 0.499999 -> '123456788' Inexact Rounded -subx557 subtract '123456789' 0.499999999 -> '123456788' Inexact Rounded -subx558 subtract '123456789' 0.5 -> '123456788' Inexact Rounded -subx559 subtract '123456789' 0.500000001 -> '123456788' Inexact Rounded -subx560 subtract '123456789' 0.500001 -> '123456788' Inexact Rounded -subx561 subtract '123456789' 0.51 -> '123456788' Inexact Rounded -subx562 subtract '123456789' 0.6 -> '123456788' Inexact Rounded -subx563 subtract '123456789' 0.9 -> '123456788' Inexact Rounded -subx564 subtract '123456789' 0.99999 -> '123456788' Inexact Rounded -subx565 subtract '123456789' 0.999999999 -> '123456788' Inexact Rounded -subx566 subtract '123456789' 1 -> '123456788' -subx567 subtract '123456789' 1.00000001 -> '123456787' Inexact Rounded -subx568 subtract '123456789' 1.00001 -> '123456787' Inexact Rounded -subx569 subtract '123456789' 1.1 -> '123456787' Inexact Rounded - --- symmetry... -rounding: half_up -subx600 subtract 0 '123456789' -> '-123456789' -subx601 subtract 0.000000001 '123456789' -> '-123456789' Inexact Rounded -subx602 subtract 0.000001 '123456789' -> '-123456789' Inexact Rounded -subx603 subtract 0.1 '123456789' -> '-123456789' Inexact Rounded -subx604 subtract 0.4 '123456789' -> '-123456789' Inexact Rounded -subx605 subtract 0.49 '123456789' -> '-123456789' Inexact Rounded -subx606 subtract 0.499999 '123456789' -> '-123456789' Inexact Rounded -subx607 subtract 0.499999999 '123456789' -> '-123456789' Inexact Rounded -subx608 subtract 0.5 '123456789' -> '-123456789' Inexact Rounded -subx609 subtract 0.500000001 '123456789' -> '-123456788' Inexact Rounded -subx610 subtract 0.500001 '123456789' -> '-123456788' Inexact Rounded -subx611 subtract 0.51 '123456789' -> '-123456788' Inexact Rounded -subx612 subtract 0.6 '123456789' -> '-123456788' Inexact Rounded -subx613 subtract 0.9 '123456789' -> '-123456788' Inexact Rounded -subx614 subtract 0.99999 '123456789' -> '-123456788' Inexact Rounded -subx615 subtract 0.999999999 '123456789' -> '-123456788' Inexact Rounded -subx616 subtract 1 '123456789' -> '-123456788' -subx617 subtract 1.000000001 '123456789' -> '-123456788' Inexact Rounded -subx618 subtract 1.00001 '123456789' -> '-123456788' Inexact Rounded -subx619 subtract 1.1 '123456789' -> '-123456788' Inexact Rounded - -rounding: half_even -subx620 subtract 0 '123456789' -> '-123456789' -subx621 subtract 0.000000001 '123456789' -> '-123456789' Inexact Rounded -subx622 subtract 0.000001 '123456789' -> '-123456789' Inexact Rounded -subx623 subtract 0.1 '123456789' -> '-123456789' Inexact Rounded -subx624 subtract 0.4 '123456789' -> '-123456789' Inexact Rounded -subx625 subtract 0.49 '123456789' -> '-123456789' Inexact Rounded -subx626 subtract 0.499999 '123456789' -> '-123456789' Inexact Rounded -subx627 subtract 0.499999999 '123456789' -> '-123456789' Inexact Rounded -subx628 subtract 0.5 '123456789' -> '-123456788' Inexact Rounded -subx629 subtract 0.500000001 '123456789' -> '-123456788' Inexact Rounded -subx630 subtract 0.500001 '123456789' -> '-123456788' Inexact Rounded -subx631 subtract 0.51 '123456789' -> '-123456788' Inexact Rounded -subx632 subtract 0.6 '123456789' -> '-123456788' Inexact Rounded -subx633 subtract 0.9 '123456789' -> '-123456788' Inexact Rounded -subx634 subtract 0.99999 '123456789' -> '-123456788' Inexact Rounded -subx635 subtract 0.999999999 '123456789' -> '-123456788' Inexact Rounded -subx636 subtract 1 '123456789' -> '-123456788' -subx637 subtract 1.00000001 '123456789' -> '-123456788' Inexact Rounded -subx638 subtract 1.00001 '123456789' -> '-123456788' Inexact Rounded -subx639 subtract 1.1 '123456789' -> '-123456788' Inexact Rounded --- critical few with even bottom digit... -subx640 subtract 0.499999999 '123456788' -> '-123456788' Inexact Rounded -subx641 subtract 0.5 '123456788' -> '-123456788' Inexact Rounded -subx642 subtract 0.500000001 '123456788' -> '-123456787' Inexact Rounded - -rounding: down -subx650 subtract 0 '123456789' -> '-123456789' -subx651 subtract 0.000000001 '123456789' -> '-123456788' Inexact Rounded -subx652 subtract 0.000001 '123456789' -> '-123456788' Inexact Rounded -subx653 subtract 0.1 '123456789' -> '-123456788' Inexact Rounded -subx654 subtract 0.4 '123456789' -> '-123456788' Inexact Rounded -subx655 subtract 0.49 '123456789' -> '-123456788' Inexact Rounded -subx656 subtract 0.499999 '123456789' -> '-123456788' Inexact Rounded -subx657 subtract 0.499999999 '123456789' -> '-123456788' Inexact Rounded -subx658 subtract 0.5 '123456789' -> '-123456788' Inexact Rounded -subx659 subtract 0.500000001 '123456789' -> '-123456788' Inexact Rounded -subx660 subtract 0.500001 '123456789' -> '-123456788' Inexact Rounded -subx661 subtract 0.51 '123456789' -> '-123456788' Inexact Rounded -subx662 subtract 0.6 '123456789' -> '-123456788' Inexact Rounded -subx663 subtract 0.9 '123456789' -> '-123456788' Inexact Rounded -subx664 subtract 0.99999 '123456789' -> '-123456788' Inexact Rounded -subx665 subtract 0.999999999 '123456789' -> '-123456788' Inexact Rounded -subx666 subtract 1 '123456789' -> '-123456788' -subx667 subtract 1.00000001 '123456789' -> '-123456787' Inexact Rounded -subx668 subtract 1.00001 '123456789' -> '-123456787' Inexact Rounded -subx669 subtract 1.1 '123456789' -> '-123456787' Inexact Rounded - - --- lots of leading zeros in intermediate result, and showing effects of --- input rounding would have affected the following -precision: 9 -rounding: half_up -subx670 subtract '123456789' '123456788.1' -> 0.9 -subx671 subtract '123456789' '123456788.9' -> 0.1 -subx672 subtract '123456789' '123456789.1' -> -0.1 -subx673 subtract '123456789' '123456789.5' -> -0.5 -subx674 subtract '123456789' '123456789.9' -> -0.9 - -rounding: half_even -subx680 subtract '123456789' '123456788.1' -> 0.9 -subx681 subtract '123456789' '123456788.9' -> 0.1 -subx682 subtract '123456789' '123456789.1' -> -0.1 -subx683 subtract '123456789' '123456789.5' -> -0.5 -subx684 subtract '123456789' '123456789.9' -> -0.9 - -subx685 subtract '123456788' '123456787.1' -> 0.9 -subx686 subtract '123456788' '123456787.9' -> 0.1 -subx687 subtract '123456788' '123456788.1' -> -0.1 -subx688 subtract '123456788' '123456788.5' -> -0.5 -subx689 subtract '123456788' '123456788.9' -> -0.9 - -rounding: down -subx690 subtract '123456789' '123456788.1' -> 0.9 -subx691 subtract '123456789' '123456788.9' -> 0.1 -subx692 subtract '123456789' '123456789.1' -> -0.1 -subx693 subtract '123456789' '123456789.5' -> -0.5 -subx694 subtract '123456789' '123456789.9' -> -0.9 - --- input preparation tests -rounding: half_up -precision: 3 - -subx700 subtract '12345678900000' -9999999999999 -> '2.23E+13' Inexact Rounded -subx701 subtract '9999999999999' -12345678900000 -> '2.23E+13' Inexact Rounded -subx702 subtract '12E+3' '-3456' -> '1.55E+4' Inexact Rounded -subx703 subtract '12E+3' '-3446' -> '1.54E+4' Inexact Rounded -subx704 subtract '12E+3' '-3454' -> '1.55E+4' Inexact Rounded -subx705 subtract '12E+3' '-3444' -> '1.54E+4' Inexact Rounded - -subx706 subtract '3456' '-12E+3' -> '1.55E+4' Inexact Rounded -subx707 subtract '3446' '-12E+3' -> '1.54E+4' Inexact Rounded -subx708 subtract '3454' '-12E+3' -> '1.55E+4' Inexact Rounded -subx709 subtract '3444' '-12E+3' -> '1.54E+4' Inexact Rounded - --- overflow and underflow tests [subnormals now possible] -maxexponent: 999999999 -minexponent: -999999999 -precision: 9 -rounding: down -subx710 subtract 1E+999999999 -9E+999999999 -> 9.99999999E+999999999 Overflow Inexact Rounded -subx711 subtract 9E+999999999 -1E+999999999 -> 9.99999999E+999999999 Overflow Inexact Rounded -rounding: half_up -subx712 subtract 1E+999999999 -9E+999999999 -> Infinity Overflow Inexact Rounded -subx713 subtract 9E+999999999 -1E+999999999 -> Infinity Overflow Inexact Rounded -subx714 subtract -1.1E-999999999 -1E-999999999 -> -1E-1000000000 Subnormal -subx715 subtract 1E-999999999 +1.1e-999999999 -> -1E-1000000000 Subnormal -subx716 subtract -1E+999999999 +9E+999999999 -> -Infinity Overflow Inexact Rounded -subx717 subtract -9E+999999999 +1E+999999999 -> -Infinity Overflow Inexact Rounded -subx718 subtract +1.1E-999999999 +1E-999999999 -> 1E-1000000000 Subnormal -subx719 subtract -1E-999999999 -1.1e-999999999 -> 1E-1000000000 Subnormal - -precision: 3 -subx720 subtract 1 9.999E+999999999 -> -Infinity Inexact Overflow Rounded -subx721 subtract 1 -9.999E+999999999 -> Infinity Inexact Overflow Rounded -subx722 subtract 9.999E+999999999 1 -> Infinity Inexact Overflow Rounded -subx723 subtract -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded -subx724 subtract 1 9.999E+999999999 -> -Infinity Inexact Overflow Rounded -subx725 subtract 1 -9.999E+999999999 -> Infinity Inexact Overflow Rounded -subx726 subtract 9.999E+999999999 1 -> Infinity Inexact Overflow Rounded -subx727 subtract -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded - --- [more below] - --- long operand checks -maxexponent: 999 -minexponent: -999 -precision: 9 -sub731 subtract 12345678000 0 -> 1.23456780E+10 Rounded -sub732 subtract 0 12345678000 -> -1.23456780E+10 Rounded -sub733 subtract 1234567800 0 -> 1.23456780E+9 Rounded -sub734 subtract 0 1234567800 -> -1.23456780E+9 Rounded -sub735 subtract 1234567890 0 -> 1.23456789E+9 Rounded -sub736 subtract 0 1234567890 -> -1.23456789E+9 Rounded -sub737 subtract 1234567891 0 -> 1.23456789E+9 Inexact Rounded -sub738 subtract 0 1234567891 -> -1.23456789E+9 Inexact Rounded -sub739 subtract 12345678901 0 -> 1.23456789E+10 Inexact Rounded -sub740 subtract 0 12345678901 -> -1.23456789E+10 Inexact Rounded -sub741 subtract 1234567896 0 -> 1.23456790E+9 Inexact Rounded -sub742 subtract 0 1234567896 -> -1.23456790E+9 Inexact Rounded - -precision: 15 -sub751 subtract 12345678000 0 -> 12345678000 -sub752 subtract 0 12345678000 -> -12345678000 -sub753 subtract 1234567800 0 -> 1234567800 -sub754 subtract 0 1234567800 -> -1234567800 -sub755 subtract 1234567890 0 -> 1234567890 -sub756 subtract 0 1234567890 -> -1234567890 -sub757 subtract 1234567891 0 -> 1234567891 -sub758 subtract 0 1234567891 -> -1234567891 -sub759 subtract 12345678901 0 -> 12345678901 -sub760 subtract 0 12345678901 -> -12345678901 -sub761 subtract 1234567896 0 -> 1234567896 -sub762 subtract 0 1234567896 -> -1234567896 - --- Specials -subx780 subtract -Inf Inf -> -Infinity -subx781 subtract -Inf 1000 -> -Infinity -subx782 subtract -Inf 1 -> -Infinity -subx783 subtract -Inf -0 -> -Infinity -subx784 subtract -Inf -1 -> -Infinity -subx785 subtract -Inf -1000 -> -Infinity -subx787 subtract -1000 Inf -> -Infinity -subx788 subtract -Inf Inf -> -Infinity -subx789 subtract -1 Inf -> -Infinity -subx790 subtract 0 Inf -> -Infinity -subx791 subtract 1 Inf -> -Infinity -subx792 subtract 1000 Inf -> -Infinity - -subx800 subtract Inf Inf -> NaN Invalid_operation -subx801 subtract Inf 1000 -> Infinity -subx802 subtract Inf 1 -> Infinity -subx803 subtract Inf 0 -> Infinity -subx804 subtract Inf -0 -> Infinity -subx805 subtract Inf -1 -> Infinity -subx806 subtract Inf -1000 -> Infinity -subx807 subtract Inf -Inf -> Infinity -subx808 subtract -1000 -Inf -> Infinity -subx809 subtract -Inf -Inf -> NaN Invalid_operation -subx810 subtract -1 -Inf -> Infinity -subx811 subtract -0 -Inf -> Infinity -subx812 subtract 0 -Inf -> Infinity -subx813 subtract 1 -Inf -> Infinity -subx814 subtract 1000 -Inf -> Infinity -subx815 subtract Inf -Inf -> Infinity - -subx821 subtract NaN Inf -> NaN -subx822 subtract -NaN 1000 -> -NaN -subx823 subtract NaN 1 -> NaN -subx824 subtract NaN 0 -> NaN -subx825 subtract NaN -0 -> NaN -subx826 subtract NaN -1 -> NaN -subx827 subtract NaN -1000 -> NaN -subx828 subtract NaN -Inf -> NaN -subx829 subtract -NaN NaN -> -NaN -subx830 subtract -Inf NaN -> NaN -subx831 subtract -1000 NaN -> NaN -subx832 subtract -1 NaN -> NaN -subx833 subtract -0 NaN -> NaN -subx834 subtract 0 NaN -> NaN -subx835 subtract 1 NaN -> NaN -subx836 subtract 1000 -NaN -> -NaN -subx837 subtract Inf NaN -> NaN - -subx841 subtract sNaN Inf -> NaN Invalid_operation -subx842 subtract -sNaN 1000 -> -NaN Invalid_operation -subx843 subtract sNaN 1 -> NaN Invalid_operation -subx844 subtract sNaN 0 -> NaN Invalid_operation -subx845 subtract sNaN -0 -> NaN Invalid_operation -subx846 subtract sNaN -1 -> NaN Invalid_operation -subx847 subtract sNaN -1000 -> NaN Invalid_operation -subx848 subtract sNaN NaN -> NaN Invalid_operation -subx849 subtract sNaN sNaN -> NaN Invalid_operation -subx850 subtract NaN sNaN -> NaN Invalid_operation -subx851 subtract -Inf -sNaN -> -NaN Invalid_operation -subx852 subtract -1000 sNaN -> NaN Invalid_operation -subx853 subtract -1 sNaN -> NaN Invalid_operation -subx854 subtract -0 sNaN -> NaN Invalid_operation -subx855 subtract 0 sNaN -> NaN Invalid_operation -subx856 subtract 1 sNaN -> NaN Invalid_operation -subx857 subtract 1000 sNaN -> NaN Invalid_operation -subx858 subtract Inf sNaN -> NaN Invalid_operation -subx859 subtract NaN sNaN -> NaN Invalid_operation - --- propagating NaNs -subx861 subtract NaN01 -Inf -> NaN1 -subx862 subtract -NaN02 -1000 -> -NaN2 -subx863 subtract NaN03 1000 -> NaN3 -subx864 subtract NaN04 Inf -> NaN4 -subx865 subtract NaN05 NaN61 -> NaN5 -subx866 subtract -Inf -NaN71 -> -NaN71 -subx867 subtract -1000 NaN81 -> NaN81 -subx868 subtract 1000 NaN91 -> NaN91 -subx869 subtract Inf NaN101 -> NaN101 -subx871 subtract sNaN011 -Inf -> NaN11 Invalid_operation -subx872 subtract sNaN012 -1000 -> NaN12 Invalid_operation -subx873 subtract -sNaN013 1000 -> -NaN13 Invalid_operation -subx874 subtract sNaN014 NaN171 -> NaN14 Invalid_operation -subx875 subtract sNaN015 sNaN181 -> NaN15 Invalid_operation -subx876 subtract NaN016 sNaN191 -> NaN191 Invalid_operation -subx877 subtract -Inf sNaN201 -> NaN201 Invalid_operation -subx878 subtract -1000 sNaN211 -> NaN211 Invalid_operation -subx879 subtract 1000 -sNaN221 -> -NaN221 Invalid_operation -subx880 subtract Inf sNaN231 -> NaN231 Invalid_operation -subx881 subtract NaN025 sNaN241 -> NaN241 Invalid_operation - --- edge case spills -subx901 subtract 2.E-3 1.002 -> -1.000 -subx902 subtract 2.0E-3 1.002 -> -1.0000 -subx903 subtract 2.00E-3 1.0020 -> -1.00000 -subx904 subtract 2.000E-3 1.00200 -> -1.000000 -subx905 subtract 2.0000E-3 1.002000 -> -1.0000000 -subx906 subtract 2.00000E-3 1.0020000 -> -1.00000000 -subx907 subtract 2.000000E-3 1.00200000 -> -1.000000000 -subx908 subtract 2.0000000E-3 1.002000000 -> -1.0000000000 - --- subnormals and underflows -precision: 3 -maxexponent: 999 -minexponent: -999 -subx1010 subtract 0 1.00E-999 -> -1.00E-999 -subx1011 subtract 0 0.1E-999 -> -1E-1000 Subnormal -subx1012 subtract 0 0.10E-999 -> -1.0E-1000 Subnormal -subx1013 subtract 0 0.100E-999 -> -1.0E-1000 Subnormal Rounded -subx1014 subtract 0 0.01E-999 -> -1E-1001 Subnormal --- next is rounded to Emin -subx1015 subtract 0 0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow -subx1016 subtract 0 0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -subx1017 subtract 0 0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow -subx1018 subtract 0 0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow -subx1019 subtract 0 0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow -subx1020 subtract 0 0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow - -subx1030 subtract 0 -1.00E-999 -> 1.00E-999 -subx1031 subtract 0 -0.1E-999 -> 1E-1000 Subnormal -subx1032 subtract 0 -0.10E-999 -> 1.0E-1000 Subnormal -subx1033 subtract 0 -0.100E-999 -> 1.0E-1000 Subnormal Rounded -subx1034 subtract 0 -0.01E-999 -> 1E-1001 Subnormal --- next is rounded to Emin -subx1035 subtract 0 -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow -subx1036 subtract 0 -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -subx1037 subtract 0 -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow -subx1038 subtract 0 -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -subx1039 subtract 0 -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -subx1040 subtract 0 -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow - --- some non-zero subnormal subtracts --- subx1056 is a tricky case -rounding: half_up -subx1050 subtract 1.00E-999 0.1E-999 -> 9.0E-1000 Subnormal -subx1051 subtract 0.1E-999 0.1E-999 -> 0E-1000 -subx1052 subtract 0.10E-999 0.1E-999 -> 0E-1001 -subx1053 subtract 0.100E-999 0.1E-999 -> 0E-1001 Clamped -subx1054 subtract 0.01E-999 0.1E-999 -> -9E-1001 Subnormal -subx1055 subtract 0.999E-999 0.1E-999 -> 9.0E-1000 Inexact Rounded Subnormal Underflow -subx1056 subtract 0.099E-999 0.1E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow -subx1057 subtract 0.009E-999 0.1E-999 -> -9E-1001 Inexact Rounded Subnormal Underflow -subx1058 subtract 0.001E-999 0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -subx1059 subtract 0.0009E-999 0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -subx1060 subtract 0.0001E-999 0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow - - --- check for double-rounded subnormals -precision: 5 -maxexponent: 79 -minexponent: -79 -subx1101 subtract 0 1.52444E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow -subx1102 subtract 0 1.52445E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow -subx1103 subtract 0 1.52446E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow -subx1104 subtract 1.52444E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow -subx1105 subtract 1.52445E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow -subx1106 subtract 1.52446E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow - -subx1111 subtract 1.2345678E-80 1.2345671E-80 -> 0E-83 Inexact Rounded Subnormal Underflow -subx1112 subtract 1.2345678E-80 1.2345618E-80 -> 0E-83 Inexact Rounded Subnormal Underflow -subx1113 subtract 1.2345678E-80 1.2345178E-80 -> 0E-83 Inexact Rounded Subnormal Underflow -subx1114 subtract 1.2345678E-80 1.2341678E-80 -> 0E-83 Inexact Rounded Subnormal Underflow -subx1115 subtract 1.2345678E-80 1.2315678E-80 -> 3E-83 Rounded Subnormal -subx1116 subtract 1.2345678E-80 1.2145678E-80 -> 2.0E-82 Rounded Subnormal -subx1117 subtract 1.2345678E-80 1.1345678E-80 -> 1.00E-81 Rounded Subnormal -subx1118 subtract 1.2345678E-80 0.2345678E-80 -> 1.000E-80 Rounded Subnormal - --- Null tests -subx9990 subtract 10 # -> NaN Invalid_operation -subx9991 subtract # 10 -> NaN Invalid_operation diff --git a/sys/lib/python/test/decimaltestdata/testall.decTest b/sys/lib/python/test/decimaltestdata/testall.decTest deleted file mode 100644 index 8daa0d944..000000000 --- a/sys/lib/python/test/decimaltestdata/testall.decTest +++ /dev/null @@ -1,58 +0,0 @@ ------------------------------------------------------------------------- --- testall.decTest -- run all general decimal arithmetic testcases -- --- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- core tests (using Extended: 1) -------------------------------------- -dectest: base -dectest: abs -dectest: add -dectest: clamp -dectest: compare -dectest: divide -dectest: divideint -dectest: inexact -dectest: max -dectest: min -dectest: minus -dectest: multiply -dectest: normalize -dectest: plus -dectest: power -dectest: quantize -dectest: randoms -dectest: remainder -dectest: remaindernear -dectest: rescale -- [obsolete] -dectest: rounding -dectest: samequantum -dectest: squareroot -dectest: subtract -dectest: tointegral -dectest: trim - --- The next are for the Strawman 4d concrete representations -dectest: decimal32 -dectest: decimal64 -dectest: decimal128 - - --- General 31->33-digit boundary tests -dectest: randombound32 - diff --git a/sys/lib/python/test/decimaltestdata/tointegral.decTest b/sys/lib/python/test/decimaltestdata/tointegral.decTest deleted file mode 100644 index f7174d4ca..000000000 --- a/sys/lib/python/test/decimaltestdata/tointegral.decTest +++ /dev/null @@ -1,176 +0,0 @@ ------------------------------------------------------------------------- --- tointegral.decTest -- round decimal to integral value -- --- Copyright (c) IBM Corporation, 2001, 2003. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc@uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.39 - --- This set of tests tests the extended specification 'round-to-integral --- value' operation (from IEEE 854, later modified in 754r). --- All non-zero results are defined as being those from either copy or --- quantize, so those are assumed to have been tested. --- Note that 754r requires that Inexact not be set, and we similarly --- assume Rounded is not set. - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 999 -minExponent: -999 - -intx001 tointegral 0 -> 0 -intx002 tointegral 0.0 -> 0 -intx003 tointegral 0.1 -> 0 -intx004 tointegral 0.2 -> 0 -intx005 tointegral 0.3 -> 0 -intx006 tointegral 0.4 -> 0 -intx007 tointegral 0.5 -> 1 -intx008 tointegral 0.6 -> 1 -intx009 tointegral 0.7 -> 1 -intx010 tointegral 0.8 -> 1 -intx011 tointegral 0.9 -> 1 -intx012 tointegral 1 -> 1 -intx013 tointegral 1.0 -> 1 -intx014 tointegral 1.1 -> 1 -intx015 tointegral 1.2 -> 1 -intx016 tointegral 1.3 -> 1 -intx017 tointegral 1.4 -> 1 -intx018 tointegral 1.5 -> 2 -intx019 tointegral 1.6 -> 2 -intx020 tointegral 1.7 -> 2 -intx021 tointegral 1.8 -> 2 -intx022 tointegral 1.9 -> 2 --- negatives -intx031 tointegral -0 -> -0 -intx032 tointegral -0.0 -> -0 -intx033 tointegral -0.1 -> -0 -intx034 tointegral -0.2 -> -0 -intx035 tointegral -0.3 -> -0 -intx036 tointegral -0.4 -> -0 -intx037 tointegral -0.5 -> -1 -intx038 tointegral -0.6 -> -1 -intx039 tointegral -0.7 -> -1 -intx040 tointegral -0.8 -> -1 -intx041 tointegral -0.9 -> -1 -intx042 tointegral -1 -> -1 -intx043 tointegral -1.0 -> -1 -intx044 tointegral -1.1 -> -1 -intx045 tointegral -1.2 -> -1 -intx046 tointegral -1.3 -> -1 -intx047 tointegral -1.4 -> -1 -intx048 tointegral -1.5 -> -2 -intx049 tointegral -1.6 -> -2 -intx050 tointegral -1.7 -> -2 -intx051 tointegral -1.8 -> -2 -intx052 tointegral -1.9 -> -2 --- next two would be NaN using quantize(x, 0) -intx053 tointegral 10E+30 -> 1.0E+31 -intx054 tointegral -10E+30 -> -1.0E+31 - --- numbers around precision -precision: 9 -intx060 tointegral '56267E-10' -> '0' -intx061 tointegral '56267E-5' -> '1' -intx062 tointegral '56267E-2' -> '563' -intx063 tointegral '56267E-1' -> '5627' -intx065 tointegral '56267E-0' -> '56267' -intx066 tointegral '56267E+0' -> '56267' -intx067 tointegral '56267E+1' -> '5.6267E+5' -intx068 tointegral '56267E+2' -> '5.6267E+6' -intx069 tointegral '56267E+3' -> '5.6267E+7' -intx070 tointegral '56267E+4' -> '5.6267E+8' -intx071 tointegral '56267E+5' -> '5.6267E+9' -intx072 tointegral '56267E+6' -> '5.6267E+10' -intx073 tointegral '1.23E+96' -> '1.23E+96' -intx074 tointegral '1.23E+384' -> '1.23E+384' -intx075 tointegral '1.23E+999' -> '1.23E+999' - -intx080 tointegral '-56267E-10' -> '-0' -intx081 tointegral '-56267E-5' -> '-1' -intx082 tointegral '-56267E-2' -> '-563' -intx083 tointegral '-56267E-1' -> '-5627' -intx085 tointegral '-56267E-0' -> '-56267' -intx086 tointegral '-56267E+0' -> '-56267' -intx087 tointegral '-56267E+1' -> '-5.6267E+5' -intx088 tointegral '-56267E+2' -> '-5.6267E+6' -intx089 tointegral '-56267E+3' -> '-5.6267E+7' -intx090 tointegral '-56267E+4' -> '-5.6267E+8' -intx091 tointegral '-56267E+5' -> '-5.6267E+9' -intx092 tointegral '-56267E+6' -> '-5.6267E+10' -intx093 tointegral '-1.23E+96' -> '-1.23E+96' -intx094 tointegral '-1.23E+384' -> '-1.23E+384' -intx095 tointegral '-1.23E+999' -> '-1.23E+999' - --- subnormal inputs -intx100 tointegral 1E-999 -> 0 -intx101 tointegral 0.1E-999 -> 0 -intx102 tointegral 0.01E-999 -> 0 -intx103 tointegral 0E-999 -> 0 - --- specials and zeros -intx120 tointegral 'Inf' -> Infinity -intx121 tointegral '-Inf' -> -Infinity -intx122 tointegral NaN -> NaN -intx123 tointegral sNaN -> NaN Invalid_operation -intx124 tointegral 0 -> 0 -intx125 tointegral -0 -> -0 -intx126 tointegral 0.000 -> 0 -intx127 tointegral 0.00 -> 0 -intx128 tointegral 0.0 -> 0 -intx129 tointegral 0 -> 0 -intx130 tointegral 0E-3 -> 0 -intx131 tointegral 0E-2 -> 0 -intx132 tointegral 0E-1 -> 0 -intx133 tointegral 0E-0 -> 0 -intx134 tointegral 0E+1 -> 0E+1 -intx135 tointegral 0E+2 -> 0E+2 -intx136 tointegral 0E+3 -> 0E+3 -intx137 tointegral 0E+4 -> 0E+4 -intx138 tointegral 0E+5 -> 0E+5 -intx139 tointegral -0.000 -> -0 -intx140 tointegral -0.00 -> -0 -intx141 tointegral -0.0 -> -0 -intx142 tointegral -0 -> -0 -intx143 tointegral -0E-3 -> -0 -intx144 tointegral -0E-2 -> -0 -intx145 tointegral -0E-1 -> -0 -intx146 tointegral -0E-0 -> -0 -intx147 tointegral -0E+1 -> -0E+1 -intx148 tointegral -0E+2 -> -0E+2 -intx149 tointegral -0E+3 -> -0E+3 -intx150 tointegral -0E+4 -> -0E+4 -intx151 tointegral -0E+5 -> -0E+5 --- propagating NaNs -intx152 tointegral NaN808 -> NaN808 -intx153 tointegral sNaN080 -> NaN80 Invalid_operation -intx154 tointegral -NaN808 -> -NaN808 -intx155 tointegral -sNaN080 -> -NaN80 Invalid_operation -intx156 tointegral -NaN -> -NaN -intx157 tointegral -sNaN -> -NaN Invalid_operation - --- examples -rounding: half_up -precision: 9 -intx200 tointegral 2.1 -> 2 -intx201 tointegral 100 -> 100 -intx202 tointegral 100.0 -> 100 -intx203 tointegral 101.5 -> 102 -intx204 tointegral -101.5 -> -102 -intx205 tointegral 10E+5 -> 1.0E+6 -intx206 tointegral 7.89E+77 -> 7.89E+77 -intx207 tointegral -Inf -> -Infinity - diff --git a/sys/lib/python/test/doctest_aliases.py b/sys/lib/python/test/doctest_aliases.py deleted file mode 100644 index e6e5ca955..000000000 --- a/sys/lib/python/test/doctest_aliases.py +++ /dev/null @@ -1,13 +0,0 @@ -# Used by test_doctest.py. - -class TwoNames: - '''f() and g() are two names for the same method''' - - def f(self): - ''' - >>> print TwoNames().f() - f - ''' - return 'f' - - g = f # define an alias for f diff --git a/sys/lib/python/test/double_const.py b/sys/lib/python/test/double_const.py deleted file mode 100644 index 16c33a19c..000000000 --- a/sys/lib/python/test/double_const.py +++ /dev/null @@ -1,30 +0,0 @@ -from test.test_support import TestFailed - -# A test for SF bug 422177: manifest float constants varied way too much in -# precision depending on whether Python was loading a module for the first -# time, or reloading it from a precompiled .pyc. The "expected" failure -# mode is that when test_import imports this after all .pyc files have been -# erased, it passes, but when test_import imports this from -# double_const.pyc, it fails. This indicates a woeful loss of precision in -# the marshal format for doubles. It's also possible that repr() doesn't -# produce enough digits to get reasonable precision for this box. - -PI = 3.14159265358979324 -TWOPI = 6.28318530717958648 - -PI_str = "3.14159265358979324" -TWOPI_str = "6.28318530717958648" - -# Verify that the double x is within a few bits of eval(x_str). -def check_ok(x, x_str): - assert x > 0.0 - x2 = eval(x_str) - assert x2 > 0.0 - diff = abs(x - x2) - # If diff is no larger than 3 ULP (wrt x2), then diff/8 is no larger - # than 0.375 ULP, so adding diff/8 to x2 should have no effect. - if x2 + (diff / 8.) != x2: - raise TestFailed("Manifest const %s lost too much precision " % x_str) - -check_ok(PI, PI_str) -check_ok(TWOPI, TWOPI_str) diff --git a/sys/lib/python/test/empty.vbs b/sys/lib/python/test/empty.vbs deleted file mode 100644 index f35f076fd..000000000 --- a/sys/lib/python/test/empty.vbs +++ /dev/null @@ -1 +0,0 @@ -'Empty VBS file, does nothing. Helper for Lib\test\test_startfile.py. \ No newline at end of file diff --git a/sys/lib/python/test/exception_hierarchy.txt b/sys/lib/python/test/exception_hierarchy.txt deleted file mode 100644 index a03f7bbd7..000000000 --- a/sys/lib/python/test/exception_hierarchy.txt +++ /dev/null @@ -1,48 +0,0 @@ -BaseException - +-- SystemExit - +-- KeyboardInterrupt - +-- Exception - +-- GeneratorExit - +-- StopIteration - +-- StandardError - | +-- ArithmeticError - | | +-- FloatingPointError - | | +-- OverflowError - | | +-- ZeroDivisionError - | +-- AssertionError - | +-- AttributeError - | +-- EnvironmentError - | | +-- IOError - | | +-- OSError - | | +-- WindowsError (Windows) - | | +-- VMSError (VMS) - | +-- EOFError - | +-- ImportError - | +-- LookupError - | | +-- IndexError - | | +-- KeyError - | +-- MemoryError - | +-- NameError - | | +-- UnboundLocalError - | +-- ReferenceError - | +-- RuntimeError - | | +-- NotImplementedError - | +-- SyntaxError - | | +-- IndentationError - | | +-- TabError - | +-- SystemError - | +-- TypeError - | +-- ValueError - | | +-- UnicodeError - | | +-- UnicodeDecodeError - | | +-- UnicodeEncodeError - | | +-- UnicodeTranslateError - +-- Warning - +-- DeprecationWarning - +-- PendingDeprecationWarning - +-- RuntimeWarning - +-- SyntaxWarning - +-- UserWarning - +-- FutureWarning - +-- ImportWarning - +-- UnicodeWarning diff --git a/sys/lib/python/test/fork_wait.py b/sys/lib/python/test/fork_wait.py deleted file mode 100644 index 7eb55f668..000000000 --- a/sys/lib/python/test/fork_wait.py +++ /dev/null @@ -1,78 +0,0 @@ -"""This test case provides support for checking forking and wait behavior. - -To test different wait behavior, overrise the wait_impl method. - -We want fork1() semantics -- only the forking thread survives in the -child after a fork(). - -On some systems (e.g. Solaris without posix threads) we find that all -active threads survive in the child after a fork(); this is an error. - -While BeOS doesn't officially support fork and native threading in -the same application, the present example should work just fine. DC -""" - -import os, sys, time, thread, unittest -from test.test_support import TestSkipped - -LONGSLEEP = 2 -SHORTSLEEP = 0.5 -NUM_THREADS = 4 - -class ForkWait(unittest.TestCase): - - def setUp(self): - self.alive = {} - self.stop = 0 - - def f(self, id): - while not self.stop: - self.alive[id] = os.getpid() - try: - time.sleep(SHORTSLEEP) - except IOError: - pass - - def wait_impl(self, cpid): - for i in range(10): - # waitpid() shouldn't hang, but some of the buildbots seem to hang - # in the forking tests. This is an attempt to fix the problem. - spid, status = os.waitpid(cpid, os.WNOHANG) - if spid == cpid: - break - time.sleep(2 * SHORTSLEEP) - - self.assertEquals(spid, cpid) - self.assertEquals(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8)) - - def test_wait(self): - for i in range(NUM_THREADS): - thread.start_new(self.f, (i,)) - - time.sleep(LONGSLEEP) - - a = self.alive.keys() - a.sort() - self.assertEquals(a, range(NUM_THREADS)) - - prefork_lives = self.alive.copy() - - if sys.platform in ['unixware7']: - cpid = os.fork1() - else: - cpid = os.fork() - - if cpid == 0: - # Child - time.sleep(LONGSLEEP) - n = 0 - for key in self.alive: - if self.alive[key] != prefork_lives[key]: - n += 1 - os._exit(n) - else: - # Parent - self.wait_impl(cpid) - # Tell threads to die - self.stop = 1 - time.sleep(2*SHORTSLEEP) # Wait for threads to die diff --git a/sys/lib/python/test/greyrgb.uue b/sys/lib/python/test/greyrgb.uue deleted file mode 100644 index de1beba18..000000000 --- a/sys/lib/python/test/greyrgb.uue +++ /dev/null @@ -1,1547 +0,0 @@ -begin 644 greytest.rgb -M =H! 0 " 0 ! ! "0 )( ;F\@;F%M90 -M -M ! " #_ $ %- -M\ 0]<$ %%Z! !2>P -M -M -M -M -M -M -M -M H +!@ # L T1 .%@ #QH ! > -M 1(P $BD !,O 4- %3H !8_ 710 &$H !E0 :50 &UD -M !Q? =90 'FH !]P @=@ (7D ")^ CA )(D "6/ FE -M)YH "B> II *JH "NP LM0 +;D "Z_ OQ ,,@ #', R -MT ,]4 #39 UWP -N4 #?J X\ .?0 #KX [_ /0( #X' -M _"@ 0! $$5 !"&P 0R$ $0G !%+0 1C( $* "(D B98 (J< "+H@ C*@ (VN ". -ML@ C[8 )"Z "1OP DL0 )/* "4T E=8 );< "7X@ F.@ )GM -M ":\@ F_@ )S\ "> @ GP@ * . "A$P HA< *,< "D(0 I28 -M *8K "G, J#8 *D[ "J00 JT< *Q- "M4P KED *]> "P9 -ML6H +)P "S= M'H +6 "VA@ MXL +B/ "YDP NI< +N= "\ -MHP O:D +ZN "_M P+H ,' #"Q@ P\P ,31 #%UP QMT ,?C -M #(Z R>T ,KS #+]P S/P ,X" #/" T T -$2 #2& TQX -M -0D #5*@ UB\ -60 -MWU\ .!E #A:P XG .-T #D>0 Y7T .:# #GB0 Z(\ .F4 #J -MF0 ZY\ .RD #MJ [JX .^T #PN0 \;\ /+% #SR@ ]- /76 -M #VVP ]^ /CF #YZP ^O /OU #\^P _@$ /\' $ # ! 1( -M 0(6 $#&P !!"$ 04G $&+ !!S( 0@X $)/ !"D( 0M' $,3 ! -M#5$ 0Y6 !!@ 04 $& !!0 00 $$ !!0 08 $& ! -M!0 08 $% !!@ 04 $& !!0 00 $& !!@ 04 $& -M !!@ 0, $% !!@ 04 $& !!0 08 $$ !!@ 08 -M $& !!0 00 $& !!0 00 $$ !! 04 $$ !!@ -M 08 $% !!@ 00 $$ !! 08 $% ! P 08 $% ! -M!@ 08 $& !!@ 04 $& !!@ 00 $& !!@ 00 $& -M !!@ 08 $& !!@ 04 $% !!@ 08 $& !!0 04 -M $% !!0 00 $$ !!0 04 $& !!@ 08 $& ! P -M 04 $% !!0 08 $& !!@ 08 $& !!0 00 $& ! -M!0 00 $& !!@ 04 $& !!@ 00 $& !!@ 04 $& -M !!@ 08 $$ !!@ 00 $% !!@ 08 $& !! 08 -M $% !!@ 08 $& !!@ 08 $& !! 00 $$ !!0 -M 04 $& !!@ 08 $& !!@ 08 $% !!0 08 $$ ! -M!@ 08 $& !!0 00 $% !!0 04 $% !!0 08 $% -M !!@ 08 $& !!@ 08 $% !!@ 08 $& !! 08 -M $& !!@ 04 $$ !! 00 $& !!@ 08 $% !!@ -M 08 $& !!@ 08 $% !!@ 08 $& !!0 04 $& ! -M! 04 $& !!@ 04 $% !!@ 08 $& !!@ 04 $& -M !!0 00 $% !!0 04 $& !!@ 08 $& !!@ 04 -M $$ !!0 00 $& !!@ 08 $% !!0 08 $% !! -M 08 $& !!0 08 $& !!0 08 $& !!0 04 $& ! -M!0 04 $% !!@ 08 $& !!0 08 $$ !!0 08 $& -M !!0 08 $& !! 08 $% !!0 04 $% !!OZ*@EA6 -M*3156$5:6TUFHII,#9$6%D#.?Y$ -M=W5H8%D_*1@@+3!07)U:EA%:5MK@4\Y -M8H-V>VE8-CQ;@W V+4QO3#=64!U)1# 5&#M$8'!C$DV.TE@ 3D!1 #^<8)P-EAA8FI?+1LE<()F8V-?22DM -M.RU-:F)B3#8M3W!B;W)8.3DG&SE@6%@I'6)[:F-@36IR6T]R:EII/B=8U@V<&!:/QM)G)@ -M17=[8FIH23Y@9T5%8FE-.3Q-7V)K5B=B@')Z:FE;;$UF@TLV:H-N?7-825IW -M>W!)24]K224V5D16:6$@&#(\16E-6SDM7VI:=WIZ:FM@-ALE+39F?'I836M: -M9GV"@FI%/X)%:P$V 5@ \')M>F-;6V)V=RT.)6.(8F-P7)K9DU%3&MJ8FA%9GI,+6]W:G)K6C]9 -M:$U5:G)H8$0Y25M<224E8&MR9EM;<'-Z=TE9>H)N?'9@7EEJH* :D5; -M23E):&\P)RE86%I@8Q42,&A%<'IU>GIJ7"T@%25-:ER-339A:FIZ?()Z6UA@ -M6F)M>F]),$PM(@-)Z5A)6')R9FE- -M5G*#6DUB:FI$6E8M3'UZ24UN7EI--BU;?V)K6G)R:V))6#\R+39@6FAC9F9J -M7#8V/V)U=RT@&!56DPY(#9L7)@.RU?>@-R_G!F3&!N("5)8EI% -M/S9%:H!B3#Y)6$E;>GILG$_&S9Z8VMB=75R8D]/8VE63&);8V]FG)Q8:0M24DG16M<8VAB8WMR9S(8.UA$ -M-EA$871L/B4I,'6"8&-H168$:YMN@(9]9F-A/R5?7"4K("TY54UJ26QI+2U: -M6EX#>HU]:UI)26*#83(8(EQZ V:%:F!-:W(!>@%W /Y[AG=@6#E-6F)S:%A5 -M16EOV],67-5("U)8%@K%39@>G-R8#]8 -M36N";D1/GIB44UG:%EJ@G)B6FIJ:VZ >VYK -M:#LV7EEJ=V-$$B5J>G5N=TD@&RU?:@-:N45(>WMK+1A)&U:9FDV37-S;&E;=7A]=G)K6UA-7#9$/S0;/V!B16IH+45;6@-CEFMK=6M: -M259B7C\M-F!L/TQK8UIB:FH!8@%$ /YG@GUS6#!$8&!:6#E$+6!K:VIR>G=D -M?7=M3R5823DR+5EB:$UB>G!)37IO/S(R.TLE&"UA:G)W33YM36J":S8V46YU -M>F],1%Q6,B4R7D0R-C!61%!@36IR:VEB8UMA259J64UB/S9K>FLE)5IK:V(Y -M/F)RH [&SQ83%IH8#8G:GI@&PXM8FIK>W=I8#\8%14M<5I,8W!)/FEZ -M'IL;G):6DE,65XE+55-=VIF>FI;:&!%/S\V/V ^)3Y,8VMB8E@R -M+3EK;VAH@G)Z 7G)Z64QB:EX_5F]J:V=>24EBFKS5$QB:V)<9EN"@G!:26]O3&A>259)6CY,>GII7UE%-CEC -M23YB>F<[.T1965I636)J:$DE& D;2UA,6ED^/RU%:UMR>G9U:DQNBG=C6TQH -M:U4[+5AN8&-J:&!6<(!Z=T]8:WIJ8#8[,BU)9U],3&)[<6)G:5@M -M.SD@&!(_;VU)37)W@H)4(!@E25MF:F)9-CLP6$4Y15MVGIJ -M6$1B:%MC8%9<=7U]>W)S:F-I36A5.Q@;6FIU@H)J/BU>??YR658^+6I:7&Y; -M3W%W:$1C=6YL63]RVA64TMC9UI?9F(P26%- -M8UI:8&IR>FT\*Q@I5DU-25M%/DE83%9J>GIF/AU:DH)P84E:8DL^66EF?6XY -M8')K4'MR6#9::X!]8S8P8VMF84Q(:&!?3T6"6EP!:@%P /YH/TU[-"4=4SXP -M:#8V6FIJ8EM)+UN':G)R34V":F)@7#P@+6AW8DE:=WI;8&!8-D0_.S(I+6!J -M6%1::H)]=U4T*S98:VIC<$DP26%))S]-GMB,$E:/A@2*6B":T4E"2U-641-8W6&?6YB.2E; -M;EI8/BD8#A@@1'IZ5B([7V)B3%QC:T\^27)ZFIK -M:U]):&L[&!@^W)O6C8R;V%%.SY66E9$6F)J;V!:6E9)238_F%0638K,#9(:'3UI;9WML:T1-9TQJ8UIJ -M8W!H36J":F)W:4E/=V]:2U4[(C]836ER=81UFM@255@65EZ:FAC<(I@-C9)7V)J -M8FYT 7H!< #^6#Y)16=O3%EP83])-F)Z=V@P1$E)-C!Q@FIK:V-K@'=)("56 -M8EH_+2=CBFIJ6D0_36)/1#9-:&]%8&EJH*"8CLR25A@:FIH,@D@6&IJ:4PY37)R9U4@+6!@9UI852D.#B R,#PM3'5J -M_DH)Z@@%U 7 -M_E8Y6556:$DP8G=I9S96 -M8TD^245-1#DV/UEB9EA;<'=B35Z"BGIK/DE::FM$8#8;-DUB9VUXA6M$0C]) -M8&=:;QL)"45536]O6$5KF)8/C8_4"T_E9::VM:36EL9BT;-G!R7%IF>G9K:VY+1"4@-EA)36=6:4U6:&!/6F!) -M6$U$:$E/8VI@+3EK=H6"84E-:F]'-TDI&S9)1W-R?7)98$D^1$E89S05#BU) -M36MW;UIG66:"8S!@.69Z:D4P840M/#(V.S99F]8(AM)6$EUG)/:&I,1%I$6E@M6&IJ9&UUBEQC9G*"14A8 -M*2)8:F):8$DI*8(^:P%F 6H _EIH<& M(#]N23\^1&IR>FMR6D]9:F0I)5I: -M+5A%1%E?/S!(24DR.S8;.3X;/F)-G)P8'!C23Y@ -M8DU/=UDK*38[6W.$=WIZ:$187#YG8E]B:F)3>H9:/V)Z=58P/BD8275B7&9@ -M/TN"/D4!<@%B ,PV6%@;/C\_8%I823Y8:GIR<6(_.5MI/C996"U89EA-6$DI -M'39)6$DV+40[)2T_1&]V2S9:>HI>&!@PG\G87)F:#8[ S^+ -M,#];6U8O1&!Q:%8#2?Y-36!P8VA96F]M;6M,5F(_26 R'4]W7SY-;G%; -M+3ES<4LV-CYA:WQN&I9.3YA8TU-:F!)*24_ -M3%Z#>GJC@G)'5DDP8FUB65YK7&9UFE)3T1%.5B$>G);:H*"9G)J65MC6V\[&SYB5DE)6CEQGYW7BU)8FAA6TQ?G=-6G-H3SD5+5L_8F-;:W)B -M8$DV6FIJ6EAN=5I9:&))6X)R:FA/%1):32DV.3]9@GIR 8 !50#^2T]K<%AG -M63X_6&)?23]-W)Z8#EJBG59( D@,#968DD=/F]R=6A-:W)N3S9- -M>GYH+TQZ@FI:=W),9FUI7C]@34UN238Y>GIF6T]I_G-]>V$8%3=R>G-C34]] -MAG9]<#PI.5]0)2]Z@&-C8FA@H):/U!T6W=[8"TP85LV16MN -M>G@_/TEI6DU).6)837:&;V-$4')U8VMR:T1L241U63Y$/CEC=WIR6&AJ8V9S -M>GIB35A-.6.'9EQ98#8@.4U$2T5)3()C9@&& 7( _FE%:WI;:F,^.6-B7U]8 -M36IU<6!)26!@6FMK:'-O54EA8F-)8')@+6!G-C(G$AM:@FA%/S]9;VM84%!) -M6EQ?/C94:FYN>W)-1'UV3R 8#A@T8&]),#E,GUN -M46IR7&)M6T]:<%DY9E\M&VMK8VE%6^=R:7IJ*QTM:FYK22V-A<&YW?7(^+2DM6')ZF)B6EA$.TEB.3]9<$0^3 *# /YR.4UZ;VIG.2M;8%]BH=R/TMI8D4@+45CA'!5-D4_2U4R-C!:GUF7&-R@GIP2S8\,DEK:SDM:XAO30-;ED]9854V+4UZ7DE)1#Q$5CXM -M/GQ?)24!<@&# /YK24UZ:G!,/CY@85!:?V9J:W)O36)W:VEH9UH_66%:66)J -M:V]P8UAB65A-7UY$3')W238V.6MH24E:8%]<8F]B1$U-7GIB:EQF=8)Z6QL2 -M+6]$1&J(>F9?*0X;66 ;+6A%7V@^&T2"B')B2&V*6EQ)0D1B:EI).SY/8%I, -M+27^16-J:C<_9F-C:TL@+6MZ=G!W;%@I+V]P6FDV(F)Z;F];6"4K:(5W86!P -M:F=5*S8_:G)<14UO:ELR&Q@Y?(1W/S _6& _+2D^669Z,CEB<4E%=GUU8&AZ -M?()P1#Q926%R;%D^9WUZ;%I-23\_:68\&R)B;CM58&%I6DD\26M@@B4. 4P! -M=0#*3#E:>DUW8#Y(6G!B37%M=VIJ8CE%:T]6 -M3&-O;VAFUI@ -M:VMQ8#8E+4]K>V-(:ED8%4R"&$R&!4[8GB*:3]/:6-)-#Q866-K-BFS/F9:1&IZ;F)K&!/;G)U=GUR8%A$-G-X22DK24TP:6IJ>G(Y66-S:2T. 38!< #^)1U@>FER -M9EI-6&]W26)RBH%Z<$4V6G)B:G-K34M81#Y$9SD_13]-;$U61$E;=WMH7&)@ -M63Y::5I_;T0M-D1J>FE$(#EJ@GMF6F-,6G%W:F-I)39B>G)J3&)J4')[8&!V -M.5IH6#0K27)B241B@GI/26A68')8)25$G=)&V]W8#Y@838E5F-;>H))/V)[=X)>( $; 3\ UQ@5-EJ WIO3V%A16-W7F@V(" _ -M<6M6-$EI-C!9>G=%(!LV3UIRG=)+3E9GUH26)Z=VMK=V)% -M26MR,B K -M-FJ":4EK>G598'-L8VMI35!H3UES@&M$+4UR:VIR;W)Z>V)%6TDY26AO!#:K -M5DUB2W>";CP;-F!N@G9N;&9Z@': 8Q@;6&DV,%J ;UIH35I9;C0;)V:"?0%H -M 5D _H!B65Y88VY[>F))(!AJ<69N>F)K<%QJ:FE5.4U)6FIJFUK:"D5&" [6&AR1$%UBOZ 6S]: -M8G!%-CPT26)F'M[<$E- -MH6#V$8 -M%3=R>G-C34]]AG9]<#PI.5]0)2]Z@&-C6V)A?8!>-D6"=W4!; %K /Z"33E@ -M15A,<'MK5" 28WIK:W=B:FE,6')Z:#XM)24^8G)W:F%//D0[25IJF@_.24@(&AG1#]:>G(^.6-NF=%8EH^+1L@%39-+2=J -M@GQ--BT[.6MKFY0:G%;8GIB8V0T'39O339O@&YC:4E$/U!C@#^@TDG639).6EP8E4@ -M)5IZ>F)J:F)8+39B9'Y;-"D8($5C6EIH<4E%:7)N?7-%63E(?7-P83X@&TEZ@W);7T5; -M>& Y6&);=7A]=G)K6UA-7#8;)5IR9EHP6V-W=BTT15MJ:T08*6N"=7U[9F@V -M/FE)26E-1'6(:7=K,A@R86A5*45K?&LP.3FMM;S\@ -M17!R:W)<*2 T56$V$CEJ>GV&GIC8$5C@FM/8[MR9E-< -M@GAZ;&YR6EI)54E88F]I)45C:FHW/V9C8VM+("UK>G9P=VQ8*2]O<%II-B)B -MBGIK8&EK8#8.#@$P 6( _C9Z@&!9+2FHY+4UZ?7IZ/RU:>FM:8E@_241-/V)K -M?6-9*SYCBOZ-BGML36)816E;:X%/.6*#=GMI6#8\6X-P-A@8-H)K/V%H6DQ? -M8VM8/VMJ9HJ/;GM:8&MK<6 V)2U/:WMC2&I9&!5,@G-9)1M6=79G,B4@)3Z" -M=U4"%0#^26I[@&YR:$5@1#LR+59BW!)*RE):VM;84U@16)J:DDT8VA/>HUV -M:#E,1#!I8T0@(#]IG)P36)J524M6%]$ -M&QM9>GV%?&IK/Q@I<'IFG=)67J";GQV8%Y9:G)N4%@\26):6E@Y6&%B9G!+'4UH.6:1@F M+55)86MF -M-B V8WF8^'5J2@G!A5G!I245%36YQ22]%:EI;>WIO -M3V%A16-W7F@V(" _<6M6-$EI3S9K,$1:)39W@P$M 2< L4E-6FE$2'IR:TDM -M+4E>1&-W34E-6F)96W)P+5EW:U\V+4E?/SY)6%@R(E]C:WI;-DD#EDT/DU; -M:6]A23966FMK1"TE5I**@FA)7&-)/DE;7'5W6#E@,#YR;6UJ>FLY6G=C33\I -M*3YC6E0M.69A1&]%-CL;&TR" 6@!/@#^:$UC<$E%:W6'9R4I5%A%6G1$2&A; -M7F!%7GU)37]R:EE$5DU).SY)8#\E86QZ>F(V/UQ[EDI#@X^@GUZ=7V#=5M$871L/B4I,'6"8&-I168$:YEQFI;*4E:6&8I -M(%EJ?862>FEG9F)%6GMB7&MO35@E+45%4&V ;SE-H-W24E@7T5-:%E9:&AC8$E/G:#W=A6W5[8UHM36)621(837)F=9**V%%BH!;/UIB<$4V/#1)8F9R6&QN:V%@84MA24E4(!U%>&)B7UA)-BDI.0%H -M 5H W%8V+4DM+4ER@WI086%B8%E@8&-R8FA@+2U;?W)H8$]88VIH6DE)6&]- -M+45BX*":V!)25IJ>E8V/TE%35IR>F ^5FIT -MG)OGUR:FZ%=S^ DGH)[6T0R-EAJ;W!R<&%$8W)83W*&@#\V27%A-A@;8&Q$ -M(#)I8#]:3411;H,Y8G)C,B Y37IF86EN9T=RBG)5;G2#8S\Y6$D\56!I:V$_ -M36MK3%QI+3!H<&!8-BM):VD^-C(M/FJ";S8"/P#^6%A)-D1-36ER=7IK-CY8 -M45@^:GIF330\-T5Z>FYC,AL@8UM%8FIJ;FQC;VUN;%E);W)J;EI)/SY)6G*" -M@G5KWIR63E>56!SW1$*2U;:#\@,EIW6UM>-C!( -M9EA::FQ/-D1)GUU:FYK8EI@ -M8VIK:F)1>G0;27)R:G5%15IPH=P;&Q/:&QW?EMA.5MW:4MA<'=9*39%F)-24AZ>V!;)2!9:UA)/C\V R"(+5QR;FIJ;FH#8OYF>FUK8W)W -M+4M:3U%V<&%@3VIF/V%K14]I1#]BFI66T0E-F!I -M:5]B8G)R;UE-6W)F9F],8#P8#BE)6&)O6V!)/SY-G)B22TM1%E]@G)? -M6%9J>VM6.T19:%I-6%E)-CP\,CYB;UE<>FIK:V!-:DQ9>W=Z36!A345:;W)W -M86E:6F)B;&MH6%EP84]B>G6 VQ$&S!S<%E+,%MW:VEQ8$UF24UH/S9$)2U965@_6W)K:&%J>G P.7-W -M<$LM.5A;9W)C3UMI/V)Z:VMJ7F9_6T0I)V*(@X* 3TAR<#(2'5EJ -M8UY$/F)B=V]625I8.4E@83(@+5E8/S]88#9%9UIR<#PE1X-R<$LV6'!C8VM/6#(M W+384U-6#X_:&-B;6MU>F(R%2]WB'I/.5I,;VMA13YI8UAH>FM: -M2&IZ@W%%66MM5H=S(@-&!H8$E8/Q@E2UEP:U@E-G-S>W _5G)\:4U:344_:6 ^)14I -M25@^1&IZE!96UIN@G5B35@_27IZ@W!- -M85M%/V!8.6)F>XAC)0D26H-W8#D^.V):84U/3T4^6GML8V-H>HIL,$AZ=7)% -M/TEC8F-C:6$M1#8I-DUUBGI/4'-87EY5]"DM5#L8&RU9 FMH7CLV -M86!H230T/%A98VM)+39;(!(V:%I86EMN>W);35@V6&YUB&(T8W!824\^)3 _ -M@)%P*0X827)F:V$^/VA98VQA2T0V-V=A8&MZ=8-C-D5[@G=@/SE)87)Z6FDV -M/SXM_C9-8G:"6TUL<%MA:5Q)83\R+39)6F-Z@G!826U-+3M$15IK>W=A6'*#=6$^/EA:;G=R:F I$C]/6#X_240G8VE86%!F>H)W30%: -M 7, _FM;8VIZ:U9B>FM:8W)V>&!-3%48#@XI27J2A'5R:EA)28B#DDT+5AK -M7G)S/DEP8F-K83]97CY915AB=UQZ<458 -M11U,:G)P1!LE8GIB45A8/AU8844_,&-0.2U) V"K6V)RW)B/UAA36IPFM88G)U>F]-8%@;"0X8-FN*BFU>338V1(J%@F]4+2U,;TPW5E =240P -M%1@[1&!P8W)R;VMK6"T;/WAP.6)U9')R3#()&%F"=UM>6$5),&!O.5AA:6EB -M6#!::#]A24U97$UR>%M98VQZ:D0I-C9C?7%;3V V/Z!Z;FAC624M25Z(;CLR -M6W5R:V-O-BU)6$54/E@V(!M%6P-8PDQ-6V-C:6-926!Q:WIR7G)K6TE/86=R -M=69A8#])=X-J9G!R6#8E/WN";G5R:F!>)4)@6$D_3'5N6F-@1&MCFA@230I6%IR;V!-:&EC:FQ$369J8P)[ /YF33M-=GU$35I,-&!J;7-U -M4&IP,A4.'3QO@HUZ12TI+4EZ>()UG=$.7!I-A(V8#9/15AI340;/UXG/T1,9T1) -M;')C22<_F8M("5:>WMH25IR:7> =V!%3UI) -M8FAF+0X8/TU%/DU)-C]88%I:6$E@>F)KG=Z6SXP8"DK/SX_-CEJFIB8E8^1$DY -M:6]$16)K6EQF8V%?@D11 7H!?0#^=7)816IZ:$E)+1@^54U[@%!,F$R(!LV:W9V:F9R>H* :D5;23E):&\P)RE86%I@8VUJ6%M;1&YF)25B -MBG(_:H5Z<#8M67I[8"4P<&T;-FA@839/*3YQ52DM27!;64]B:FD\,DQB -M239$2S9)8V-B<$D^]&E(&IP/S!S;24V640P8G%F;GIJ6TE':&%82TE/245$ -M&A1<'=R9U45)4U:.4E;6V)V=RT@ -M-EA@6E@^&T1K37* :6%@15AP64UB8UL_9H-K8V)P7C(R=$Q$8GMZ@&-5-D5A -M85AA:7!5-EIK8UA%8W-O-A@E86]J8%I935]))6ES<6)89G%/-BD^9H):1 %J -M 7H _F1F;FUR6U@E%2T\/SXY<(:(:UI:9CY$;GIJ:7)A/RT_845I7&IK4&Z -MAGUF8V$_)5]<)2L@+3E536IR:UY)&RUC-@D.'6IZ8W!$68A+/%M:<()A.2 E -M/!@E6&85/G-'7UE)H->8FT^-D596VEK8$]C -M:F)I/TECF M+44@%2TV"25@ -M/C Y8&YZ6W!K530_6T]F@VM/>HA[;G)925E4)15-UQB=5Q:33EK@FI, 40!:P#^@W)'6G%C8F$R%1@V -M/CYF?75K+2TV<&A-=UMI=V$_-DQB6E@P,G=R9E-<@GAZ;&YR6EI)3%E>)2U5 -M36!W6TP^8(" :R4)-GI]=G)B@UDP.6IZ?8IK/EEA-"DK%0X;8%@V+6!W=UIR -M:&!@86M;6FYI,&.*AGIJ8#Y%/A@.+5]0_E!J9GAR<7=S8%59:U\M/V-<;W!F -M?8)U>UEM>FU;1#8_:%@M+3E<@H-,16%%8VE85EE)8&IR -M=7)O8AL2.7IW;G)B3S])8X)B10$E 44 _GI[159C15IR;S\Y)2U$8W5HGIF8G=Q351L>W*">V-F:5Y)4$$@,EA@1#9-9G)B35E96$UZG9P6V)J -M7E]Z:T]833E$8&!:6 ,_U&-RBGUR:5L_36-Z>EQ853(;)VMR7CE$8FMC2SY4 -M/RG5BG9U:DQNBG=C6TQH:U4[+5AA34DB/V]R9G=/-DM-;8-R -M9FUW33EIH*" -M:UX!1 %4 /Y]BGUL4&=RW)R338_+2]JG)[VI_=S9K?75Z9C8V6&IH6DE)6#9J -M;75[;T\V6&%P;'):/TEI:4L^6FM@8%MA/VA4*2U@,B5M669Q26.#:UDV/%MZ -MVMK9R4V5#]6&Q@P7T(M6%IK:T0M -M)5:2BH)H6$D_+39P<#EHBF@5/FI<;U@^52 @1%@Y6')Z>W)B;&)@7V-:-BU) -M83])-@X5,$5,4&1U=7FM>.R E_CPV6W$\)5A- -M:$E$/"5+@W]/.4UB<& G24EF8UQ0:F<^)3Y/ -M;&QC238V379W34UJ6G!@8U5B5C8M340R:$M%>W%L@W):24D^6G5ZGIW:W)W;V)+/"U%25A5.3(V*2(^ -M1%IN@V$T("5821L817=N:EY/:&9U;VE4.S;^23YA>F@[-DEW8#L@%2UO>UD@ -M+6!S:#]H:V)J:V%J7U!G5C0E'5,^/DD^-F!H5C1-23 \1%ISG)]/RT_-RTY:W!5.T]F@GR# 5L!.0#^+5AN>FUK8D]M<#\M8H!P/CY) -M7UI9639-FQR>GIR:44E+41@<7!A/RTI-CD_67IR@%4R -M6&9;1%EZV@R%1@M86\\#AL^:W)W>W)J -M8EYA:DDP:UA85#L[)2U$.S9-:U]%63\G,$E/;'-@-TE)2V.#@FIC86Y[6W)K -M6D0@23(V=6);:6!J>GUQ:44K)4UR>G)C;'-C6V)I;'9U;6,G1')?6F%6338E -M-S8K+4]Z=5HY8H)0>@%H 38 M1L_<&YF=7IB4& M%3!J@%])5$5%5CX^16)R -M8DLP8$1J -M=V!A1#8#/]588V=)2U0V-#9%6%!)&R4M/TQQ@FU<;&Y]FYK:6%$8&EJ;F->:$UN@FIB6" .*4EN9$UH138^)TE81%QR8C9)8EIH:W)F -M84DY8G)C,B Y37IF86ENWIR -M_FQ@6&MP9C0I)2=8:4EC>FD@"1@I/T1F?7I;34U@3UA:245G;TQ9<%X_23]: -M:6!664D_7DE88%]$+3(I-C9$;FI:GEQ>,')J5C)!/"=JG5R:FV"<%XP6%A+:W)M??Z)WMF -M6!@8+4]A<'YP-BDM-EA@8%!O:UA%6CE/;(-R6D5B:&MH64E,6EM)35HV+5IK -M<&)B6#!$6%Y56&)98(" 6VIR16]J64E95F!-1&)Z:4E/1$U$VIZ -MFI5)3(Y:G]B8GIF;T0I/VIB5C]K>F$M1%8V8'-Z;6)-:')8*2]8;CLP8()Z -M8$D\.7)C)0Y,=6M)37IZG-Z<&!8/DUF-A@V:WIR8U\^.6!X -M<'1@-BUU@G-K<&)R=V):23E6<$DT:G)R:E@M)VJ)@F)654$V/CEC<$U(:UMF -M>FI6:&@[+4DE16%R>F@E#AUB;GLI@C!R 6,!/P#^*1L^;WR"@GIF:UMA64E% -M8G6&=4\G/FMS:W!RW)C7&YLWUM:&!$6EAC8FERAGU-("U; -M=6YZ@H)S:F R)6TY%2UA35""9R55=W!%65@\27![;UXR)3EB@G!J9F)07FM) -M6G5C8GIN8W(!L_)1U@>G=R -M:V]U=G5F-"LM3VE%1/YZBFDP17Q[=G)I3&)R26%/6UIN"5B .&UEZ;6IH47=A/D1):%A63%!B8VEJ3UA8:V$E,&-UUF"87(!:@%$ .X@/VA;@G5]9EQ;3#XV3VE99GUZ6B(5.6)?;H.&@FM- -M1#)H1!LM/D59>GEXI&Q45-@-:_F)K>G5ZWUS8S\8&"TP8G)%34U/ -M8W)Z>W=J:G=>,CQ+.45P:UM@:7)P63]/>'-R:F)-7V]J:FM09']ZF(_5FIB65],1W&">GIO:5MF:VA>/"U$.415 -M(C]P8E@V3WQZ<%A98EI@/S)8:W-5*2TY;8EL338;+69P=W0!<@%@ /XM)V)C -M6FMU?(-K/EA6'3E,F])+1L2/FZ"?U0=/$UB -M7G)K9GIZ14]>141$6VYZ@&(E3%I%27#^G=S<&I@6%5;9GU[83X^4'I\<%0I&"5BA7UH+39,66-L=VQO<75Z -M8EAH9F-@/R!%:#E%6H*"1#X\& E$>GI]@WIA)1@^8W)P/C!$7CM):&]F:WIR2V!%+3YW_H%N8E%:=V-86GIZ-"!-;U42#A@M38(^)P%, 40 _BD^66MO8G)R>G)H5DU>7#!$@7UN -MH)Z8S(@)3!@:V8V-FAR9CE$>GV :4]:8G)Z@DTY -M8$DE&T5RG5P1"T_7#M4-BU-:&MA -M2UIC.2UB@GUK,ALE6()Z:%A;=W-B52 V8$DR+6%U53PM-UMQ7C98:F-),CD^ -M23X^238Y7UEJ;F]H8G)]@&<[-F!G/S9?;U0P:G5R6C ^6$1,7SEH36%%8FE+ -M<7M@*2DR25B"6& !:0%> /YH1R -M1!M862&8[.UGH9X)]FI816)P6FEF-EM6/" Y;UM%25AA<6@^-C!::&!4+39%.SE86&!B -M9FI@7EEM>H)B84E65BTM6'9G/G&">F(#/HE)8V V5F-?:T<#8HEA6$]@35IB -M7VL!> & /YW6TDR$AM@>FQC8#8E6W)P246 :$U08" ;6H)K3U9,37!_<$U/ -M?W<^-FAB25A@16-K8EI;6VYZV\M#@XP8GM))4E<,A4@6&ER=V-C:VE)3VGV -M:W5V?'!?52 .+6)H8W-Z>H)R8TD_3VIZ7VMH36%K82D@6')R:UDR&S9J>FUA -M6&%;15ES65MH53L\340P+3YC<&M?/S9>8H!O,BDV/TE665IBSDV:H!K36!(8&1, -M8')<:FMC7F9Z+3!>1"DO15M;>G)C8DE%6FOM8F)F>WAK7B 5 -M(%EO8G)R:6!-8%M86FIR:G):/DE18$1):VYK<4]$*39K>G%B8VYA/UAF:5YK -M6DM88$DV(" _5F-R6V!H36IJ23(V24U624E-9W%Q(!@R/D5: -M6CXM6&-B:W*#>F%::%DI&#EO7%@[/TUK,#9B -M;G)H2UA9:&QH22TR.SQ)6UM,9G5O6$4^6'"\7T5@@()V9U@T,EER:W5K;&A@ -M6EA-3VAM8V-:-BTM-C)6@&)>=T0M("5@<&E64&T!<@%B *]Q8EIB.Q@[6#!$22TE7FE/3'N" -M>FI::W))("UO6C8^6&!03#LR)2]-6DUA8VE:3 1R_EQK36-K8%4R-EXM8%MB -M:FQ)& XB6DU;51T_>GQF6FU@8%QB<'A[8U])86%B>W)FDV.6A: -M+39C=V8^,$D[ R74+6%J<'MI36)N>W)L6FIZ:V _/UE)8&-K:VI)& DR7BTM -M( D_F9>>FIN<#D.)6)O:%D_ -M:V P22T2 TG^66EK=G)[=V)A/QLV36!?67<\(!@B8F)R>FA>*0X@26QC:GIO -M-B V:7N">FA:23\Y6V-A=W-5-#E8638V539+,A)%:V-%,!TE16MR8EA@8F)R -M<6UW8S8V52T5("4P:GUZ=6YW/AM,BHI[<%I865INF _-DDT -M'0X;24Q:>H5:/UZ#>G)B:WIU:TQ%541836!R>FA>,C]H)0,)_B)B?V Y7V)H -M:$E89G)?,$EI8&-O4&]O/S1+6F^#:%MR:W)K.Q@@1&-I3UYC6# V(!@E&R(^ -M8VQH3W6)>UE$(!4M;FE;8EPG#@Y636=J4&M5&"!88%I-W!A -M84E%:G![B&]@6&!?-BU<6E@8#B5@8FEA1#0G1(]J34U@9FIR;VAN63D# -M&*(I1&)B7&MS5!4G9&UV>W)K;VMN=FIB6D5$38!K5#)$7R(M 6(!;0#):V-R -M7S]->GQS8EA$6#!$;"(P;8)Z8&-]9D5K>E@M($F"F9B;'IF>GI@,"=;4QU->F!R;H!H( ,5_B V:X!C8$5%;G!%8'%8,DEC -M6$QWB'IK1" M/V-[8#E::WIO/"D^6$589&-P6F!85#(T*2D2,&-,/DV"?VE5 -M( XE<(5P6V!>.Q@M66--,%A>&Q@\66)@=TLE(#MC8V)R>VM>EHV-DER;FYJ:50K"14G+15)6V: =85]<69F>W)9 -M:8)W/B!62"5):DAC6WIP,C \.RLE37MB63\^9F\^6'!H1%E@8VAF@X):/CDE -M.UAF6"TM17)S52 Y;T4_:FYZ36-P3SX__C\[*RU).S(\;FUP62<8+6:#=UI; -M6&!!%3Y925EA:%4\1$UJ8F Y6#PT.45:7DQS8W-4&Q@M239-:FYN8F958VARF)<:W)R;VYR:V!83UMH -M8FIB<&IJ7&T_/U@R($V :DU:36MI.S]@=5@V,$UP2')[-B(V)2U)8$DT+55L -M@6]$27)9+4ELBD5%;5HV1?Y-3%Y$/TE$.6](:&!$1#YJ@X)L8F)R;#Q+6$1- -M6UIO:FE::&@V&TE>+2 V6')P6SEF@VM@7&A%/UAH65A",C]C=T@Y3W M8F-O -M51@2*5HM-F)Y;UYK3TU9:7-[6#0G-&%;.6J!;'-R9CP@%39RF9B/C]$8&!,16-R3"EZ83(W26-/2W!K -M8FIK:F]Z;6I/:$D8&" 8%2 V1!LM>WI96G!/9GQU63]B>UA-EIJ -M53Y:/!LPFI%24E9-C!<:F-R:UIJ>GIK -M8VU9/#)$1#0T25P2(&IW2&)]6F)Z@HER/B4\*25C10X.%4E-+41Z>FG: F):7V)LC'I:6%A)1$EC<&]K8G!P8%59 -M9D1@:G);3'J2BF\\1$0P6C0##OX5%0XV>GIB1#1$:%E88W%)/D]I5EIO6$5) -M1VYR6#]:>F\I%2U96#D_=E8^6"TV3VQJ>GIM/REB?TT_:3Y$F)%6DE%<@."GVMR;1L_3&)I.5@Y -M3V!B=8-S7@D816YW8V-H3WIS14P#6/Y@67)R7UER'!%16A9:VEH:FUZ5"<@ -M+5I3/F)-154M%2U,6G)S;S8I8FDM,'%8+4D^-%]FFM@ -M8%]O<&!88UDV-C(V8&*R/D1$-C)J8U@R,BLI369N8UI8:G5F@G5<+1LP47IS33D!:P%R (1UW!F-C9;:T5H8EI@ -M-BLT+3Y68F \26!@)25B9BTG1$]F>H!R8$UBXIC16:">FMC8S PW=H9FI985@M$B V26-$,&)M9EH_7V8^-@-:_DDI%24M27IR6$L_6')Z:F ^13X8 -M#BU?4%!J9GAR<7=O:%XV-CPI-EMU;F-D?8)R:VMI16MMG=886QJ/V)O4&-%25LV24DW/S8V -M3VE5-EA-+25):6YVB8)P3,M-8VA)/DUI:G=R8T]W:4]C:7IL11@5+6!B:')P -M<%8^3&I/568\+3\W+3EL=U4[3TU9>HIP35QVA7UZ;#PE;()U=7-O8DE):G!) -M/DT!7 %R /Y9=VIF>FI;:& M("D@-F ^)3Y,-D0\)4QJ1UIJ;6)>7V!-6SY/>GUR<%A;;'K^ -MU8^65A)56%B66I_8TUP:V)B:X*#21@.+5MC6V%KA7Y]@V9-24PV -M)3WA:.2]B@WYU6EIJ<(9];6E)9W5M;7UZ63)I>FHV@C9? 6(!9P#^ -M17!<2')K<&MC5CY)-DEC6DD^+6-[;7!-*2!)9#X_7EIL3TE)8#\R4%Q;86)J -M=TURBF)'<&YC:%9)6$QO=V)824]R=FM;:6%)*0D.+44@&U9J/UJ!:6)R6#!; -M:#9$6D1$65L^-&MJ8&-[<6):;'!,6F-@8%L[6'5[8')C15J!_G)13&U[:U@; -M-E4[-DEH:FMCE@E'3Q@8%I96WN&AXIW8V!;2S9>7D0M.6Z# -M:B4;,GIR:V-H6UQ]?5QB6'=F:VY]>DPK8WEG+8(G60%J 5\ _DUN6-B8#E9>_YK.2E%GF)W6#!B -M:%E:6FYU9FMK;GIK7CL@)3PV6W$\)5A)6&%C24EKBGIK>G]N:TDE2&-:8G5I -M/SE,:FI6/RE$GAR5EA$@BUF 5@!'0#^+5IZ>C P4&I%6EQF)2TY>HIR63E08EE; -M34L_1&)P7&=13W)B3VYR23\^/UER;UM)35QJ8$E(:G)N@&$V25M-5EIN:EY/ -M:&9U;VE4.S9)/F%Z:#LV6V-:8&!8:HAS3&*"@GII.S!89W)U:4DV,&!H:%4M -M+V!;15MK:6);8W)Z_G)@/#Q/9W)J;FEIF@E#AUB;GMZ>V-)/#9).6EI;'HY+3(R25I)16:" -M@G=H-H(=6 %A 24 FEAK:FY@2UAJ8V]J:#LI)5EU>G)85F)B6T5- V#^8F)K -M3UAJ7)))4UB7T])37*(<# Y <$D\/W)U=7)D23\_F,#6ZYI8FM836MA)3!C=7)I -M53Q-<'N%C7AC145>/%MJ2"T.#CX\/SDM,&*"A7%R8U4_ 3D!:P#^=8)W6F-6 -M-V)U;FYF;U]-8VQ/56IO6F-B-AM$:FUK669Q5E]P:VA/:G [#@XE245G=TQ) -M9H:(:%8Y:'IR>G(V/UYF=VE5-F-C2V-[>G)L8%AK<&8T1$U-26!@3&M9GII8TE$,"]65EQVBG)C:VMR;FI836EI-"E/8V-K:%E$8W:-DH!O -M33E-6&-0.3D=#CY@=38)%3E[A6YB38)).P$= 3\ BVIUFD^&T5K -M6W)M/C8_;8)P7C!86$MKF-K6C]R>FDV -M/TUR@V]A8%MA8V]@/" M,F)$.3PK+5MW+1@P,$E:%>EHT)2U);G V1&UO8#E)5B]R:UDT&RU$8F]5)2TG8G)U -M?7I@638@+3(V:XV#8F9NR5!21TY -M;6MH3T1/>GIY>FIF5FI[:3!;,CQB -M?8)P/CD@)4UW23!?8CX;.6D_6V _-"W5N"2UL?'!]@F,V17AR34AF("4I,G1>&S!9 -M;75W21LV 6 !1P#^1%I$6E@M36IJ9&AUBEQC9G*"14A8*2)8:FA8.4UZ?'5] -M@G);6X*(7UEC8F!68VXE/CP;.6I9/#(V9F))/DEB23]<;FQR82 5.6-K3VJ* -M@EA6:H.#82TG%2UM/C!).2<^;WIP25A::F$_*39F8FMK:4U;F Y66MP-#]B=6MA6$]C8%9A-#9-24UH6"T8:5]I:VIR@T0R&Q@^ -M:EA6:&([&S9P6%A>-BT\1%4^.6%$)41$8&IR;EIP6S8I&S9@7&Y,2&YN:W M -M.6)C6EXT($UO51()#B!,6T]4>G(Y+6M]6TUR1#8M-FAR62M86F9ZH9:/V)Z=58P/BD8275:/CE%>GM(4'MR8EIU@G)C -M3V%B6&IR-DA$.SY9:F0I-G=R6TD^6#D_:W)SHII,$5\>U@; -M*1@E9#X^6#P8&V!Z>G!H6F)I2V9@7EIA8FEJV @%2!5:5I8.6)R5#9C?6Q%:V$Y*5A6@%H /)'5DD; -MOYM2TE)84D@#FF$@G))-VN*:#LM26!@9GIJ3%MP>FZ!84E:<&9Z?6@\-%B#>V-C -M7E%R9SE1GH!@@%R /YB8$DE6FIJ6EAKE\R&SEB/BU88&IM>G5F=7))16EP6S9$F-I:4@_9FLV-E@V8&!)+45R>H)G26-J -M8SY$;TTM25XM+45N=6Y9;GB*:6E>-C]C8D0Y=7=)6%I)6%IF@GUN6S9/BGM1;&M16V)>25MR -M:U@_3$M97E8_.6N"6S]B@F-; 6L!<@#^V9B6UM9/!@. -M-GI]:FE83X)R138E.59J:U]6:FMC;UA9:$E$-EA@.RDR.TE?+39H;UMN:V!9 -M8VMR:5E)8$\;&V)R2$DW+3E%6FUP:U _17U[2&-R:V!<:&EHF)H8F)).S]-3VE) -M/CPI(#9O:$5R@H)U:$E):VIJ:39$H!J34T#28M8>GIR8S8I6&IR8P-8S40M+38V1&-C:EI: -M8W5R:&!825Y:8&)K23 ^.RU$:FE866)Z:UQ]>F-@6$D_+2 5(FMZ;VM)*7* -M:E\_/DU:6EA@8V-I-B56>EXV/SP[.S8V;G=C7FY5-DU@:G)< -M3%AS6"TW65MJ8!LM:FYB:E!)/T]K:V _/V!%VM:36IK4&E:8V):65A:8V-8_F)0 -M8()K1%!88SL@-C(Y8G!K65IF855+23\V/T0K&!M?<3])2%A0>FMC9F-8:&-A -M8%@_+5IR:W!J:5D_8%M:6EMC>FEA34Q;9FIR;FQ%46]H23M$8V-S:54M04E) -M1&EL:3\V36-P22=-/S!::VIK8TU::6$V16M8+6!]>GIP2X(V/ $K 3\ _G)L -M63YG?7IL6DE%-C]K:388(F)N.UE@86%5)3YH141C;V=+36IZ8TU:>FDE+59A -M:5@@)6N#BG=8*2U9=W)@24EH)6=R')9 -M,BT\-C!R?6MJ9F-B6S\[/T]C1 X.-F-)/TM8369K:W)K8V-R:6-8,A@M3V-R -M:V-/26MN8UYC9FYN:U@V+4QB:F!I/SYH:5@V/X"">WMI-CEI22=%:VE)/T^# -M=V%9:5D_36-G:T4G36Q[8V9J6UEL>GV"<$2"/%D!20%A /YX8$]N:VMA,"E?@HV -M51@@67)C:5E;:2!8:7)W8V-K:4E/:6MU=GQP7U5+/EIH/SE$25IC9F(I+38; -M/FM]EI,;7UZ:D<_52(;6G9R -MEL^2UM@:EDG#B!)23];:6%:9FYUF-/ -M6V)J;GIO/R4^6&)/144_86E%-D1ZAV]Z=ED^=W T/VE;15DY=7)86FMC:5 # -M8)([&"U(?8!S=GIG8UIR>F,_.6 !6@%I /YW86)R=FYR=7)Z=TD;;W=@/F!A -M-B568UMZ?W%C/QLE26MR9EMRAG V-EMR:UMJ6VUZ6UM)3#=$8VYN=75]BF]%26-K -M8UIN/!LR+3Q96VA@:7-F>H)K7&=R>VDY&!(\;&A86V%[@F,V5&%-8GM[8#)) -M65E$/$4_258I%2]Z?%MF<&-8>GMA66M/16M93TPY/F!:7U5-14EC*Q@E3WUM -M;8)N8&!99ED\@BU6 3\!6@#^8F9R=79C:6-:7'I4$EE]6T5;<5E):VA(W B#BUKH)-+41Z=UY: -M9S8@16-'65AK_G)V:45,9FM:83),6$L_6FQJ;G5V=8)Z8UE;8V-8>F\M*1@E -M/SE-37!R6FMU=6MF:X!R+0X.+5I:16MK=7I:/EEA2TU]?5IIGI]>DQ(:V]B7&IS8S8P)WMU/!@M;'IU9DT[.6=Z1#9)8FMC:V]<545835MG -M>OYN:W!:24QW;&%+6&->*3E>:V-N=7)]@F]A/EI;8'*#63LE*2DM/DEJ:V-C -M9G)KH!V@&,8&UAI-C!:@&]::$U:=U&&BG@\+2T;)6."B%I'6V%% -M8&M),$5I83];>GYW7BU)8FAA6TQ?DP^54Q:;')F66$Y85I(:WING-C34]] -MAG9]<#PI.5]0)2]Z@&-C6V)H6'IZ=FA>-A@8/WJ"6C]0=%MW>V M,&%;-D5K -M;GIX/S]):5I-23EB1&-I3UYC6# V+24I)24^8VQH3W5Z:U%B:%AI8CYA;VYF -M:DDE/VN*@F-B3%YZ:EA)25YJ;G)>12)>8$QJW<^ -M/EE%-CX_26YX84E0>GIF6T]IV$!& $5 ,LM:FYK22$DV-F%) -M.3L=-EA%6&1C<%I@340$-OXE.6-,/FUU>DU%6T]A33E@H-[6"T_6$UR;EI9G5]>EI; -M85@V86M@:V-%239%83\;3&IH-DQR>'5;4&MF/"U/=4\M&!@W9E5%1%!U=FMR -MV9H-CYI24EI341UB&D^ -M1VMN-!L^?V8_36IH/S8M/DAZAW(_2VEB12 M16.$<%4V13]57BTV,%9NF<_6GI9.2T_5%MB6#EZ12L5%1M$;5Q;>F)>=V V8F!C:V)) -M5#\[65D@(DEI239;G9P=VQ8*2]O<%II-B)BBGIN;UM8)2MHA7=A -M8'!J9U4K-C]JGIH27**=5I$)1LY9'6&>EIA845B -MAOYZ341J:54V2U1-8&D[;D\_6H)6%14M8%8P26%;8%QF;'M-.5!F9FQR:EQ::FMI8#9- -M=6--/SE%/DE@/TUN:$D[.T@P4'V#V$_6V _3"TE16.":FH!-P$_ -M /YK:W%@-B4M3VM[8TAJ61@53()S624;5G5V&$R&!4[8GB*:3]/;&E%-#Q68&-I6F)G:G)K3UA<8EMK6EA86TU8 -M-EAN=8AB-&-P6$E//B4P1'J :TE:@G5523Y86%%F;V=%37=6*WW^?')O6D5A -M84U:3'-R24QKG5C7UIC6TL_.75[:UI+6EE+ -M34],:6-I9BT@($5J=GMS8UI(>GUW36-R@FY[ 5H!8 #^:6-W<#XE -M-EA-F--8VMK8UYB:G)I8SD_6VAB8C8Y16:#8#!B -MW)C3T]J21M<_G5T>V)A:&,_64AN=U@G -M369@6&-;,#!C:G)Z=U8R16)W22U-:VYC;&L\#C9U:CE%6%\P.7)C66QJW183':"@&-RB'IB6&EI48)/8@%: 6H _EI;>WIO3V%A16-W7F@V -M(" _<6M6-$EI3S8G67UX12 ;-D]:6D]O6%9H6%YS65Y:;S\8-FA:;U!< -M=VYW:W4^-DUO3&YB141BF ^/W=O:VM8+1L_>' Y8G5DG!)1.I<=7A,35!P7UI;:W5:-D5@6%IJ8S8V -M3VMU?7=)-C];FLY6G=C33\I*3YC6E0M.69A -M1"DY:F9T-" E+39K>UM$:W)R3&)P86MQ<&)R9RT_=W)C-C1KG=$/UI/,$UI -M;&A::$PG'5J"U@M-EMR -M4%EC8V)C8408+5MZ=UE:6V-Q8V,_("=0?8-\8U9:.3]S:UI9, X;7'I]@&,_ -M.4AB>EI98&%)+3E1:G)L)QM$>H%J:VQJ=6@_1%98,"TE16);9WMS9EYR?7)) -M6%M<=8)W6 $Y 6 _B4M1450;8!O.4UR;%M9/RTV1#\_+3YK=U@_27!B:UXR -M("LV:H)I26MZ=5E@VA18DLY8V%%3S<.#C9PBH9J6UXP57IK:&-P -M83LP24106AL.'6*#>FI<:G5<26%I:40#/Y$Y.7!R>EM(&)),')_:VE5*RU)8WIZ>'M[ -M<$E-H6#X!R -M8V9[UM/:&):8UI83S0@)R\Y=HEP<&D_3&M;:VM[@6D_24E+/A@. -M&S]NF)C9#0=-G=O339O@&YC:4E$/U!C -M=89Z:S]F6 X5*S]J6D1K:UQ(>H)R8&]P.3)KV-:>GIK85A8 -M7F(Y1&-J:F%6:VD^*418-DQK8VMO:6IA86Q16EIH<4E%:7)N?7-%63E(?7-P83X@&TEZ@W); -M7T5;>& Y6&);=7A]9G9]?75R9SY)-&-R8F%$%6]@2QL_:$0G'1MBBGU[85B" -M/S9A<'J#22HIN845<FMZ>TDY8UM)-BU)6$US?7UR:FIB7&E>?&Q9.45-67)6 -M.6)022U9:V9-3$5C8UXV:&M6159)+T5K:FM;655)3VMP.3\_2&ML6UD_+2(P -MH=@,&IR85I%6X%/.6MR#8E\W27!F<&$I#@XM8GIZ8V!%8X)K3V-R -M9E-<@EQB9GIU?'I90BU;GIJ;GM:67)C-BDP,D0_8W)]@G9S:UA@47)R6#9$545R:$5-/CDM37)S -M8T5$6TTP-EQP;%H_.39%8EL^86QN?'<\("U:>GIF8G=Q351L85I-7&A>+5AR;FV"9&9Z -M8#EFX9RF);639)6VMA-TMAHUV:#E,1#!I8T0@(#]IH)N?'9@7EEJG)F:F)-8F)@6F)J21M)84QR8_UB6EEK8&-F -MFLM%25C>FI)17-R8V-J:EEH9FMK&!(M7&YZ;#]):FYI8$UF>@-] 7(!80"O3TQO>G]@+3M> -M@GUN:V);7EIJ;%M@6D]86DE,8#X^6W)L9E45+5PY6H.*<"4;2W #=_YC/#=C -M>EDT/DU;:6]A23966FMK1"TY6H**@FA823\M-G!P.6B*:!4^:EQO6#Y5("!$ -M6#E8GIJ -M34]RG)P9F!-7UIK:4DM,CD_:6++8G)I6G)U:"TE16-F -M>V%)36--6'!M6UI$:GMP3TUB:UMB@%J )!;1&%T;#XE*3!U@F!C:45F!&N: -M<7)K7#D_6&X^+3]::TA5-#0_-D5F<'W=A6W5[8UHM36)621(837)F -M=9**9RD.#A50@G)B=8!A8ULO3VIK8SE8;& \&S!S@VYV>FIK:V-J:V-8/UA8 -M53]5:$TOF%913E$;'IU8DD2+6:":C]BG)OW<^8F]6*14@1')96GI]=S0##OXV -MFMB>FMI23([.T1:6EA>6FI:,%@V*39%;U]$2TE- -M34E,34]Q2RTV84UK8V-P/U%P+0X.+6 V.4QB:6E-16MH16VN;6IZ:SE:=V-- -M/RDI/F-:5"TYF-N9BDV17)825MQ:$D^23XG7T0M -M+4E%8FQC6EAP<40@'31>8%M;8EII-BU68#9%4&V ;SE-/S9)8FIREQ>,')J -M5C)!/"=B:V!-8&]:16I:+2 V3W=[:&!:)S#^VYL:'%F1"DK6&-C<"4=1$E) -M8FA0;FQJ84D_65IB>&YZAW!L;$]H;'=^6V$Y6W=I2V%P=UDI-D5RFI5)3(Y:G]B8GIF;T0I/VIB5C]K>F$M1%8^6FEC -M35AZ8$UC32TI/TAQ@G=F8395_G)N/T1@6UA08F9R:&.#7BU)2UL_.7%R:UI9 -M6$U-.4V";EIF;EYC6$0G;F V,EAW:V)B6V!H3#YI83XT8FI:3TQJ345)/TU% -M36!S>H--4XJ"8F-@23L_ -M26F#;$DE,&M[/((.#@%6 74 _GIK6$5B>%H[/UAC86M>54M@8$AO6#]-<&$\ -M*6EF7EIF@WUN8W=J8EEK@F-F,C96:6F!G)R:C8; -M&S8V8HIZ7FEA8_Y_=T]@6F%835I>:G)DA75:6VEO1")$<7-:15E-839$>H)B -M4$U@6TUN7EI--BU;?V);645%6EDP2VQ>-CE$86A-35A+6$E8-C!):GIR:DL_ -M6%A@:7)A35IR:T1<:2TP=WQ;6#8K52 @5GIZ14U]>G)R;6DM545K@VM)&SYX -M>DF"&!@!1 %J /Y[;$0;,'-P64LP6W=K:7%@369)36@_-F%$)2U965@_6W)K -M:&%J>G P.7-W<$LM.5A;9W)C3UMI/V)Z*R M.UIV@F9K -M;E[^8D@P8TUC8%M/6F)JFE++3Y86#Y$538P'-J8EDM)4R(844@*40I&#ERFM-7G-P&RTP8X)K1!A)@XIQ@EA% 4D! -M7P#^,A@M8%@^/UA@-D5G6G)P/"5' -M@W)P2S98<&-A84E09C]:8E8Y*2E/6TU;>GG)A.4EO63]:>H)M($AS9D5B -M<$4Y6%@[>XIZ:UY51$LM)2T2&V)@-AM$23]W8UE)/UMK@5@^8H-V>VE8-CQA -M=VD\("E4,B4M3VIF@8-P.3YR>BL8&UM_6T0I)V*(@X*"@ %/ 4@ DFIK+2W _5G)\ -M:4U:344_:6 ^)14I25@^1&IZ%IO>CXM8FI1=4PV6#8_8&YZ?6YXFMJ -MF)W<&)I1"D2(#Q9;U0;-FE;:VQC6#E-9H-+-FJ#;GUS64E8<'-K23(T854W -M/$U96GJ$52DM6#L##OYJ -MV);/RTP<'55 -M& X;1$DM&SYN@G]4'3Q-8EYR:V9Z>G)L2S9B;G),1#9I8$1H;H)Z4%E)+2=I -MB&YU@DD26G)>3"VUNF-+/V-U84$T/DU;:6]A23DG3W6*=EQVG=)67)];GQV8%Y9:FYK6E@\16-B66Y[<$DI -M.6A))PXV:6$M1#P5&T1]D@%[ 4\ _DUL<%MA:5Q)83\@'15C8F-Z@G!826U- -M/RT\1"U(:W-R63]86%YS>V,V55YZ@FM;<5M$GI]@S8E6WIR -M6"4@1%A6/CM:=5Q9?_Y+*45P+5E$( XV36IB+6=W -M>G5B1$UH:DU$86]R6E9P7SY-=7IJ6S8R/VI]?6MMG!)*R!Z?V P/UYU=6YK8EM>6FIL6V!:.6AN26)Z:V9Z>FA)/UE)*0XE6FDV -M-CX5&"6"67T!@@%; /YC>G=A3V-O8VE%+3(8/SY0H(V-FN">F,[%399<%I) -M87)C1'+>8S8^:#)[<"(.+6MR;F!H:UMC:VUI2#YC>G)@/B5B=7UR33)%<&L^ -M-F)Z>V!)>W=A6W5[8UHY9DE,;H)U:F)(:VY;65E;8%@V+3DP3&MR8UY5=&P^ -M)2U):G)J8VA%9@1KGG%R&T5H,#EZ=5QN?7)B24]))0X826$M(AL;.458;@&# -M 7, _G)Z@GAH8W-S?&A81"D@/DU-;7IR>GIR6#=)G!@255%3$U- -MW V+6)V@GM6.T1B;T0V3')R:%AB9F]C -M;GI[=R)86"U9=72!:UIK8C):8VIK6$E<6$M88$Q9<'AA2QL8*3]C:&)F;2U) -MF%9>&99:$E%:&))6&!%8VMB6EM;;GIR:DD^3&E@:7MH.R<^ -M+2UPBH))(DU9)2U)87)B/F-]>FYH*14T8F9K;G5U:%O^8%98:7-R;FDM)5AZ -M?5Q-:V: ?6I:239-:W)R251B:WV";VAK8VM-241K8EI)8#]:3411;H,[26$V -M2V]JD]-8E4R+55Q3S@%O 4@ F4MB34QR8DAGFM5/!L@(#]A -M2#E%D]$/TEC>WU9(!M:>G=-G)K&EL=FE815MG>F]%.T1I+6!;8FIL21@.(EI-6U4=/WI\9EI@6& Y+5IZF-I6CLE27=U;VXV+6]K;%M0;42S)T0P&VAQ -M9D0I*TEA8V!)/D5)26)C8F-$.UAC& D8+4UN?WIN8TE+9VI><%@\1$M5/"5% -M 7(!8@#!G=:3&AA338#+?YA:G![:4UB;GMR;%IJ>FM@ -M/S]926!C:VMJ21@),EXM+2 )/W)M6DU:6%@M&T5R9DUC.T5B>%H[/UA@8V-> -M6$M@8$AI6TU915EP.QT=(#),G)R>FE5/SYI:#Y8 5@!4 #C<$4P -M8X!B6GN*@UD^25AA15AA3&MI6%A$%0X;@8J"=V$_-BDV88B"=7)F:T\^83]- -M<$DM/VIO-AMP@WA-.6ER6#8@&RE)3%IZA5H_7H-ZG5K3$551%A-8')Z -M:%XR/V@E PG^(F)_8$5835@R*41J2%A:8H)O6EH^-C])24U/22DR3VMO8$0R -M-$U-13P;&S]Z=7IR1!@@6V @17)@6F@Y16!V>V(E+6A96F)6.2DI3ULY6'"# -MA8);26!88&!>H:*@W=9*0X5.8*,A'UK8$M9639);&A987%O2R5O -M>G-96&-F8#8@&"!")TENA8IKF9Z>F P)UM3'4UZ8')N@&@@ Q7^ -M(#9K@&-@25E)-DE?1$M,68-P;&M)56%C8TD_:5P\1&-ZH)Z8$$[4& V8'=C6F V)UIUG R,#P[*R5->V)86$E@ -M241-15E%18B*;F-(25MRX')@.5!I345HFI98#9,;FMI/UYH37!U51@.&T1)/EEJ,#=O/B)CBGQU8&-K13M$>G(V -M27-K:UH_+2LE-C!%8$0E)39J=6-A8P-9G6AJ -M9G-@& D))7"*?'UZ245C9FIJ:38M7H*&:T5)/TMF>FM:6#P8)S @#BDV/DU; -MB'IB7&MRG)8.3]L]&UR;DE;645::FM[1!4Y>H""<6-8+14;36\^88*",B =2'*">G-F S:)1')[:V-B8VQ% -M 3P!3P#^:VI>03]97V. ?6YI85M84&II-DUI6DU$2UE925E:8G)N-C0@)6*# -M@G)W6#Y/345:<"T;67U];TTR)39J@W=),DD8&" 8%2 V1!LM>WI96G!/9GQU -M63]B>UA-EIJ53Y:/!LPV]$+5EA:%Q)83\I("E) -M6V-Z@G!826UP33ENAVUB/SP@+41NAH-W8&$^-EEB15IO8X)@-@%) 6D _DUB -M=W%)13YB>G5K540V8XB 83]9/#)$1#0T25P2(&IW2&)]6F)ZG5O1%9%6'!H4%R*BF9%,B4E6&=M9G=V6#9;6V,#:*E)-#(I/CY0EI8 -M7DE526-P;S8\7F$T&"4B2&I-:U!GG*"62 !+0$^ /Y$-TQR840@)TDY.5IR:FUV>W)> -M:VA5,BT_6FIA,B5-F))6&!@:7%I24M;2V-H,$ER63)R -M/UYM.QU@?7<_&S9B9C8V<&9B6' V -M(#E?9S9-W)F:W-[26)< -M8S8I-F!:8FAQ9FZ"<3LM@8-R3T5,8&IZ=TU-;UMJ:4]:>F8M3&MC8G)R=6MA -M7C0T-D]O:EI,=TPM36)B6E%BV9MB%D@.S9-3$UK;G9P:W)R8V$[(CEB=8-R6%A[:6]R:G=J:W!; -M8()B8@%9 5H _G5Z:%QR7FA>,%N!>V$P6FYZ?6)/36N"=UMJ.41K -M>W=A17*#=6$^/EA:;G=-36);9UM)269Q7D5(8EIBH)R6$DM/TU8-D5;3%!9WIK53P;(" _84@Y8UMW>F)A52DM-F*%@VEB>G5V:UIC9G-P6VR":$0!80%C -M /YB9FYRW)B/UAA36IP36!;8&E;8&%>:V-A16!).4]R8U8^6&!%+45J=7)G6S\R1&MF -M8F9N8E8^-D5]?79H14]C:WAR?7A)-FAP34E)1&EO.6IZ-QM)@EO^6D]-:DQ9 -M>S _:WQZ:S!>/B=:;7(M-FEM;VA)/$UZ@&D\/&%C24AK8UY$:6%)*V-G/D5O -M24EK9AL8/W5;36EP;TA%.4=ZA7IO/TE6/S(Y6EMI36ML34]K:VYI8&)F/# ; -M/W=-+3\V8W)-15E%*1@P;H)L:WIN>G);6$QH:6%K@G V 3X!30"O6F-!8WQ- -M-BD8,'* 9FMK=7)B9V%)65E<U\G8')':F)%6#8^;CLP7(*";#!H -M1!@E38!),&IR8EQ@33]B.5E;24G.:%IGF!B6"TI-EIF>F-Q:V%A>'%%14U/8TM;54UZ838M)4E; -M/S<_2S8.&$5B15MR9GIR:&);66%A8W)H 3X!- #^,#X8*W=C/" 8&U![8V)B -M=7IK;VM-/S]86SXP8"DK/SX_-CEJEE(8V]RF1N&A)-DM@6EIR>FQR84U83&=937)RGIR:6):669Z>FI8 -M1"\V8W)@:&-1@%\ /YI/"LV86M95C(8)4]K:V%:8FY^@%I)2VY[>H!C539% -M86%886EP539::V-816-S;S88)6%O/!4I/SEF@H-]GIK85@; -M#B=<:W5H/EYB;W)K7F96&T1U=69/4%M%.4E-,$1J:4\Y22T5*1@5.75W-C\^ -M)T=01%;^34UC<%A)3SE88G);'6M];E@I("UGBG9L:38E-FA::')Z;V=86VUW -MW5R6$E)-EMI6%MC -M35F&CG),14M:=VE+14]I:VL[("5%6&)]62LE:7!+6#\V.6EH14Q%1$Q8@FE; -M 6,!@@"]>F@R+4U:6T]5-#0^:6]B6DU9P-C UO^66!K?7UZHZ*=6MS<%M):'1,:&UCO7)[6REC@WIR63E>56!H6UM@65ARBGI8/$E$ -M:X)C,$]Q8WII1"D;-FEW:3\E16!%:5D\-FAK5D5622]%:UH!1 %J /YJ;T5$ -M8%IB6&$\*R4V:&E;84]C:DD;$CER>HA!37IN+2TV16EI35AI:W-R251;7G-K -M5DAP<6!!-#])3V)Q;%YC85M;8%ERA(1UG-B6EH^4(6*:D5;:F9N -M=FZ#FYJ:SXMG9R -M:3\8*6%H7F=$/S\M85M$-EQP;%H_.39%@G* 3D!/P#^:6M96VAL<6EO62TE -M($5?8&-96F\V#@DE25Y[66UZ;5M$-C]H6"TM.5R"@TQ%845C:5A667=R6E19 -M65MR>GIP8V-;3UA/>HR$=6YC239@=7MZ6&-L:45J?6(Y3&IL9FMT:6"*>DLM -M-D1N>G9R8$UH52DV36QR:FAKG5K3&)M$OX2-E9(85MF=SXM*1@M;FEV>WQWVM6.T19:%I-9F%+*30\,CYB;UE<>FIK:V!-:DQ9>W=Z36!A -M345:;W)W86E:6F)B;&MH6%EP84]B>G6 FYZ=6M88T5-:$U@:F(V54MI:E@B -M6H-L338E8H-O/" R539KB&]A25]H6DU%/TUJ;TEC:V T8W)S@&];6%ABF!)*3!;;FMJ8EM;8&-B84D; -M'6AF9T1J@QNN$D1-1&)K7&MC6%0T+6!?7W)\@&MNW)R=WIK:F-P:3]%6E@P/T199G%)8X-K638\6WIS -M9CQ)6#8_>FY;86AP;VA8.3]<FM@6EA:6EQ]@VDY53\=+1MB -M8CE>8UA:6$Q6-CY-+TUN?8J&?'=8-"4_4')C UO(7G9]FYC24MJ22TK&%Q8.38P6G)]@VA%,"TM8W=I -M65M::GJ!>VM/6#(M W+#84U-6#X_:&-B;6MU>F(R%2]WB'I/.5I,;VMA13YI -M8UAH>FM:2&IZ@W%%66MMG):3'-Z8TM)6%E824M%>W%L@W):24D^6G5ZH-P36%;13]@6#EB9GN(8R4)$EJ#=V Y/CMB6F%-3T]%/EI[;&-C:'J* -M;#!(>G5R13])8V)C8WJ#G=,3'!@/SEO -MG)]F)18VDM'5AA13\P8U M-C]A -M=V9B6VE@:GI]<6E%*R5-=7US8VQS8UMB:6QV=6UC7RT;6H)H15],.3]%:6!C -M:6!R;V Y6H*$:T@I/W!$37)P.3(O.5A@6F%I23YB8VM[=69B6V%H9U9)15MB -M:F-$4')U8VMR:UMC:GK^:U9B>FM:8W)V>&!-340@*38\6WIR3&ER:EA)5G)O -M33(M/FEO8FA4*1)8*0X2+4E67VAS>G)H8F(V.45F@V P8G)K;&A),@D;:HEZ -M230M6&M>/EE%6&)W7'IQ15AR>WIS1"U$67)]=69C:$5' -M=W):7D4=@DQJ 7(!< #^;CLR6W5R:V-O-BU)6$54/E@V+4188VYR#:F9P22T[16%;6VMO;FMO:5!R -M@VU8/SE:-CYKUY%14US=G)B8$E-V-06EY\_G='8GIK6&)R=7IO6F!4*2DM.6-[FM4+2U,;TPW -M5E =240P%1@[1&!P8W)R;VMK6"T;/WAP.6)U9')R3#()&%F"=UM>6$5),&!O -M.5AA:6EB6#!::#]A24U97$UR>%M98VQZ:D0I-C9C?7%;3V V/WIN:&-9)8(M -M20%> 8@ _GMH25IR:7> =V!%3UI)8FAF+2 V15IB9FYK<#XP8EIB8EDV6WIB -M:W)R;F))14E$26-B36-C6&*"D7)L@6@_1$5A9CE%=TA(:WIC8GYM3$DP-B4^ -M7')C6#8M.58G.7IN138I45I>:F V+6EO1$E@8V)<9F-A7T11>GUF33M-=OY] -M1$U:3#1@:FUS=5!B8SLR(!U(G=$.7!I-A(V8#9/15AI340; -M/UXG/T1,9T1);')C22<_+1M@:P-:_F)B33(Y8G%)179]=7)816IZ:$E)+1@^54U[ -M@%!,GM@)3!P;1LV:&!9/UAR8EXI/G%5*2U)<%M9 -M3V)J:3PR3&))-I)$2S9)8V-B<$D^:4AR@GA>,"4!8P%M /YK8SPY86%::WJ# -M>&A1<'=R9U50(!@V24]98F)-8VA923!9:%9@-AM$:TUR@&EA8$58<%E-8F-; -M/V:#:V-;:W-P83XE+6-H;VMN6EIZBG)K;%A@:6)B66IJ3&9%(")9839W>V$Y -M/F!8/TEIF-:;HEZ7F-::')F8T]<:C!@8U@V.5@^7GIR6DE:/CE:8G)Z -M:D1F@F-A1#EO9$U/;V1F;FUR_EM8)14M/#\^.7"&B&M:6F8^1&YZ:FER83\M -M/V%%7&IK4&Z AGUF8V$_)5]<)2L@+3E536IR:UY)&RUC-@D.'6IZ8W!$68A+ -M/%M:<()A.2 E/!@E6'IZ231)<6$V&!M@;$0[%2MP;G6*;F-P:VQO:$U'64DV -M,&MW6DUJ;&-97H(P-@%' 68 _F)Z6R4_:VMI8W.*?6M:3%MP8VI65#D_64U: -M=W Y6G)A:7UP-C9O;3(E/UEC9G-<8V@Y1%AB;F@M3')W:E!R>F-/6&%527)J -M=75N6UZ&@V)08F9J9G)K8W!)25!;/QM%84ECF M -M+44@%2UU@T]97WMT1"DM6V@_530_6T]F@VM/>HA[;G)925E4)15-C9,8EHP,G=R9E-<@GAZ;&YR -M6EI)3%E>)2U536!W6TP^8(" :R4)-GI]=G)B@UDP.6IZ?8IK/EEA-"DK=WY; -M83E;=VE+87!W66!@86M;6FYI,&.*AGIJ8#Y%/A@.+5]04&IF>')Q@G=S 6 ! -M50#^8%I-66%C6V-L:WUR>G9P6V)J6F%L:455/T]B:S]/7$1:GI<6%4R&R=K&A+-RD;26]@/S [*S9$&Q4;6VYF;6I;26MP:CX;)WI[159C_D5:GIF8G=Q351L>W*">V-F:5Y)4&N"8V8R-E9I:8%R -M8FJ"F-J8U5;7FZ):%A; -M9BD;16)Q24E(:%0G.5MI/"LK)1TV;W5R8VMP:FMC26)U?6<#:H%N W+^:V@\ -M$EE[8E@M)SEH8$0R&TEP8W)F/TUZ@FM>1%2 BFIC65IIG9U:DQNBG=C6TQH:U4[+5AA34DB/V]R -M9G=/-DM-;8-R9FUW33EIW)R338_+2]J -MW)B -M;&)@7V-:-BU))39SFM>.R E -M/#9;<3PE@EA- 6@!20#^.R 5+6][62 M8'-H2VAK7&9K:UR&CG),14M:=VE+ -M/TMC8VAI5C1-23 \1%ISG)@3UA)+59$.6AN:VMF?(-; -M.45K>G5K_EM89()O)2UQ:3LE245K:FM@,E9N9F)J24EA5DD_/CDV'4E:6&8I -M(%EJ?862>DDV(!@EHIZ>G=KU!/ -M:FMQ9DE%;&AJ34Q@:&A)37*"?7IM8DU8.2U5/D5@9UIJ8E!Z:#8M6&YZ;6MB -M3VUP/RUB@' ^/DE?6EE9-DUS;UQB3&-T3$1B62T\+4UB5DD2&$UR9G62BFG)I124V55YZ@FM; -M<5M$G* 53)89EM$67IR:EDV6&]D9F]>7TM8.4UYX):1#8M/"4Y9T0P1&-K;TTY8W!K -M6$Q:8%@E17)@=8)F45A8/B=$,#Y@:$5$6DEB8RT;/W!N9J]U>F)08"T5,&J -M7TE41456/CY%8G)R6#!-GUW- ,.N39R<7)Z -M:V)S8SXY6H!H+4QW8D08%45SH!1EM-36!$86M%3VE$/V)RF9A:6YS9C .#BUK;76"FQ965MK9G9W21M-G)L8%AK<&:"-"D!)0$G /XM3V%P?G R%0XE66!@4&]K6$5: -M;&MH6%EP84]B>G5H64E$7UM)35HV+5IK<&)B6#!$6%Y56&)98(" 6VI]:CY, -M6EYK;&%:14UR>G!A16)O6DUC63]-8FM%-D5:>GUK1" 8(%A:2W!R1TE816 M -M*RTV3%MB2SY,@%LV/TM@;EO^3WUR46 \%2U69FI;;F [(!4W7S]);' _1$5C -M;VI08V!86FIL3S9$27-S8EIL>FIF*Q(M8GIM>7IK:F\_(F!Z7%XPDDR(#9I>WG!@6#Y-9C88-FMZ'!T8#8M=8)S:VIB6EE:8VM:6G!)/V-F -M8F-CFD_.3E-VIZF9O1"D_:F)6/VMZ82U$5C9@GIRE69M@G-K/R4M8'-K6WJ2=T]C>H)U -M;@%! 1@ _E]>24%<@#DV,CYR@W)96G)U:VIO:V%%/FEC6&-S:VMN?8)W:3\_ -M8EX;)6EK=7=L83]/:DU%)3(I375[;TU%6F-;:'IB6FYC54E%8V9::G)B/TUI -M8W**AH)K:4D_6V _,D1>8#XM8X%R:5I-8&E<8$1%6%I8/S]K:U8I&SYO?/Z" -M@GIF:UMA64E%8G6&=4\G/FMS:W!R26MR64]R>FM>)S V3WJ";F!%:GIH*25C>D]$/TEC -M=W!5/SE/*1@V<$PY6GI[G)>:W)S>VYC8EIA34]/145:<&Q;:WN#?7!86&IF(!MI.5IX -M:6)-6FM@)1LV6%I<:FA)+3Y@6VMZWUM:&!$6EAC -M8FERAGU-("U;=6YZ@H)S:E@[/U4M+6%-4()G)55W<$596#Q)<'MO7C(E.6*" -M<&IF8E!>:TE:=6-B>FYC=S8\,CF >F,V-EIF=U4E/X)N(!M)@G!825IR<%@@ -M&S\E'6!Z=W)K;W5V=68T*RU/:45$>HII,$5\@GMV 7(!:0#^)T5P5#=K/T]< -MGMW:FIW7C(K625%<&M;8&ER<%D_ -M3WAS=VIH538M1&EL;FIB:G)B.3YL>D0G/V--6&%@669R=&YZ9E@^-D5A6F9N -M9TD^7UEK;UM%8%!U:DQ%9F9K<'IR22 _:%N"Z'5]9EQ;3#XV3VE99GUZ6B(5 -M.6)?;H.&@FM-/SQ8&RT^15EZ=S8G8&,P2U]96G-U:EI%+24O9GUR;6M/8F)@ -M6FMP=W-<:W5$7D0RF]%6F90.6%SG)$23DV6&A:8W)R=VY9/RTM8VYN8F-;:%IC<&IJ=6M/6F@^ -M:7A:;WI6& X8/&-K;&!;:G=8-F!J-A(G8H:-@CP@'2DR/D0_/S1K WJ/6#!A -M64E):7)M>F-I:4AF 7,!60#^8FMW/B!P64TY:WUZGIR;$LV8FYR3$0V:6!$:&Z">E!922TG:8AN=8)I-!@; -M2VMN()%10%R 6L _GIR?TD217!)+4QR>G%P-FEO/C!8<&,@)6AZ?6L_-C):@F]$ -M-D]O8$E))U]L/"T[254M&!TY:W E+6J"=FMC8#9%H)O3&%) -M&W!Z@X-R:V!98FA(6V-KG=S<&I@6%5;9GU[83X^4'QP5"D8)6*%?6@M-DQ9 -M8VQW;&]Q=7IB6&AF8V _($5H.45:@H)$/CP8"41Z>GV#>F$E&#YC.TEH;V9K>G)+8$4M/G>!;F)16G>"8U@!6@%Z -M /Z#>H9P,#EO:#]%8WIF8C]H=V$\-EIC.2UB@GUK,ALE6()Z:%A;=W-B52 V -M8$DR+6%U53PM-UMQ7C98:VMF8W!I8FU\@W-R8"D@/W)Z:C8V+0Y:G)J -M66)R6TU;9G5F.38V,%9R=7QR47!B23XI6%A$8UI:8&E>*3Y9:V_^8G)R>G)H -M5DU>7#!$@7UNX9W8%IK@FA) 40!@ #^?VMN@V!; -MFI816)P6FEF-EM6/" Y;UM% -M25AA<6@^-C!::%E/;W=F>GIR6C\8#BE::FI5&Q4526)/8FIM;4=,;G)K6DE98VE+8F]" -M*3Y6-D1ZA')$&UA9)SE-9H)]02 ^6V M(D1)/R4V:VYR:SP;)V:#@TDG -M64DI#B5G"?7-C6H)@)0$; 6 [6)I7GII8H)R5FIZ>FM$ -M8W-K3&-W:V$I(%AR-D=K7'I\G)C6ED#8OYH9EQ/:6MB9G5W6TDR$AM@>FQC8#8E6W)P246 :$U08" ;6H)K -M3U9,37!W6%IK=SXV:&))6&!%8VMB6EM;;GIR:DD^3&E@:7MH.R<^+2UPBH)) -M(DU9)2U)87)UTDE25PR%2!8:7*0 -M=V-C:VE)3VEK=79\<%]5( $. 2T _EEO7G)B8WUS35QR:UI+6&!)-B @/U9CW5<:6,V+V-V@G5C/U5)6G5\9FMJ35MC24Q_ -M=VA%6&-J8F9[+3!>1"DO15M;>G)C8DE%6FMB -M8F9[>&N"7B !%0$@ +-9DD^37)J6FMJ1#LY8H-M8D])36IL=5Q?1$1@3#8G6EYP:590;7)B -MW!;14E% -M6G%(:GIO+1L^6$LM*2LG640B8HIR6$188%EJ:VMB@WUCTE$ -M:&9C:EQC14DB6'IF65E%3&IF:VM8+3EB240V+1U-?V)-9H)F<6):8CNI&#M8 -M,$1)+25>:4],>X)Z:EIK+6!;8FIL21@.(EI-6U4=/WI\9EIM8&!<8G!X>V-?26%A8GMR7#]) -M36-G:')C 44 _F$_&S98 -M8EA9=SL.#B)B8G> :5Y5*0X@26EC:G9I-B V:7N">FA:23\Y6V-A=W-5-#E8 -M638V539+,A)$?W);:'-K6EI;8SYS>F-F>G5C6E9)+7F*:UIB7&MK6EM).QM8 -M=7)-13]8;FEFW:!:%!A1* V25@Y.S(8($E:.2=P -MBGQB6')Z:38Y:%HM-F-P83Y).P,EU"UA:G![:4UB;GMR;%IJ>FM@/S]926!C -M:VMJ21@),EXM+2 )/W)M5CEB8V)<.6EW>FM956EP<&I<>FA$.TM:8WIF7GIJ -M;G Y#B5B;VA9/VM@,$DM$@-)AEEI:W9R>P%W 6( _EE$(!4M;FE;8EPG#@Y6 -M36=J4&MW51@@6&!:6G)C+255GMP86%)16IP>XAO8%A@7S8M7%I8& XE -M8$E8:WI[:UI86$EC9VMN9D]G6F-)%5E\@G)<8V)J8F!)/C1);G9-)TEB:V=F -M>FIB6D5$38!K5#)$7R(M8FV"G5K3$551%A-8')Z:%XR/V@E -M PFZ(F)_8#E?8FAH25AF.Q@M66--,%AP7AL8 -M/%EB8'=+)2 [8V-BGQS8EA$6#!$;"(P;8)Z8&-]9D5K>E@M($EZF9Z>F P)UM3'4UZ8')N@&@@ Q6Z(#9K@&-@ -M145N<$5@<5@R26-83'>(>FM$("T_8WM@.5IK>F\\*3Y815AD8W!:8%A4,C0I -M*1(P8TP^30&" 7\ _G!9)Q@M9H-W6EM88$$5/EE)66%A:%4\1$UJ8F Y6#PT -M.45:7CP_8W)ZEHV-DER;FII5"L)%2G R,#P[*R5->V)9/SYF;SY8<&A$ -M66!C:&:#@EH^.24[6&)8-BU%+2 V6')P6SEF -M@VM@7&A%/UAH65A",C]C=T@Y3W!>16-K;G!)6%A)6%A@33!>1#])@D0Y 6\!2 #^3#Y$ -M:%A-;GIW:VIS=VA-6TE58$U%8WIZ9F9I-BE)6$0R.UAW8V%HEE:<$]F?'59/V)[ -M6$US6EIJ'IG+25)A5\Y8DDI25M'8F9568)93P%P 5@ _F!).6-W23(_:W)F -M7FYW2$U9/F%)26%N@G!:63]A?4E+7C]H=V)@9G*#>G: FI%24E9 -M-C!<:F-R:UIJ>FMC;5D\,D1$-#1)7!(@:G=(8GU:8GIR:#Y!9CY$?V@_35EM -M@H)O7$E812 I8%IF;V!I:%0P,EIB55AA8%Z"B7(^)3PI-EA$%0X524TM1'IZ -M9RT5)VIK6F]A)39@8%E:34F"34L!:@%W /YR6#]:>F\I%2U96#D_=E8^6"TV -M-D]L:GIZ;3\I8G]-/VD^1')B35MN@W)C>H!G340I3'-Z:V!A6VEC:&->/UAO -M:F-C65@^245837!P6UEH65@E.6U]A' V2V-N@GIR3TQB6"=8EI87DE5 -M26-P;VMB<'!@55EF1&!JI**;SP_1#]).Q@.#A45#C9Z>F)$-$1H65AC -M<4D^3VE66F]8@D5) 4GIK8&!?;W!?845:;FI@6$D_35D_ -M2$E@>V=P;V9G13EH;7IR145-8G)U>G):;%@I16Z*@G5K:G5F@G5<+1LP47IS -M33EK,C)8HS=913E86V!R"1A%;G=C8VA/>G-%3%A)5F!9H)I37J2DGI;15A88#\T.2 ."0XV@H)J24MQ@UE88VIO;TAA.3EX -M<$5% 6@!60#].6>)BGU[<&8V-EMK16AB6F V*RLT+3Y68F \26!@)25B9BTG -M1$]F>H!R8$UBX)::FA)5G*)>'5NGQN=W!C52TE(#YO6F!F:W)H22T5(%F">GUR9'(E+3]8 -M8DD[)24[1%N";E\Y*2U$5F!B:V)W -M;HJ&=6!;6%AP6EIX52 5#BEP>F-%27*&:# R8&9Z:VG!S<6%IGMW:&:L:EEA6"T2(#9) -M8T0P8FUR>FYP8#05,DE834E9;G):6!4)"2=:669:/U]F/C8#6M$Y6G)J6"=9 -M86AK8VM-241K8EI)8#\_-DEK:#X_<&IB;VA>-C8\*39;=6YC9'V"FQK -MH5[5CY96$E586)9:G]C -M38%W36%C-A@G5DURG):8W-I -M84DV=UM8-CEK7QTE8FYJ9FMW7C9$/"5,:D=::FUB7G)R:$UK=7=C<'!87E]@ -M35L^3WI]VN"6!L!-@%5 /Y%238Y6UEC=V)BH!9-D1)/R4M8GV%:SE,:38;7GIR -M:TTM1#Y:8EIQ@H)R4#XMF9I7S0@,C))6D]-9H*"=V@V'59@,BU:G)@/#Q/9X)R:@%N 6D -M_F9W=VM$(!@I3U]$6']P53Y823!)2SEBTD;&UIMBGURG=;1" = -M+59::W]V:5MA13)%7C(V=W]9*2589DE86T5F1$EH35!L;VY@1"U836I,67MW -M>E!W;FI$-F. 9FA863PP)6-]A8EJ2S8@(#9R:C!-53L[8%M92T51>E@5%3EK -M>F9:3&)[:SX\/SDM,&*"A7%R8U4_/F>"?6I9:.U@36IF=7IK8$E58%E9>FIH -M8W!@-BUB:$UP=7![6V)H1&)J:VEB:&!8/SE<>G)@2V!B>H-K/R4_=7)Y:#XM6#\M -M/UM) RV08H M)U]@34^ GIJ8308(#9-:X!R:6-L -M224M/S(P:HIO.R P6FE]:3EJ;VEP6$]:6H)K23Q615@V/FYR:UIK>GII8W)[ -M:& ^.6AM2X"*A'QR8U9454MJ8S\^6D]$8&)R:UDO658R,"=J=5Q$+3!P8CY@ -M=38)%3E[A6YB34D['3]U@G=:8_Y6-V)U;FYF;U]-8VQ/56IO6F-B-AM$:FUK -M669Q5G!K:$]J<#L.#B5)16=W3$EFABT\8VMO1&J&;6IH8V)(;T58=&!R@6]U -M:%IG+3E::W!$34U)8&!,:UER?&=-:VMD:5H_3&9U=6I86UA+66AA1"42.6H_ -M(#E$&R=OR5!21TY;6MH3T1/>GIY>FI6:GMI,%MR22TY23(@ -M23(;86]:5FIJ34E%)TQW?89[6UI8.SEJ=8-Z9EIK>F -M-BTT8W!824\^)41$:&-U=7=[:UIK>FIB8CDB+4E%-FA?6UI::TU;:D]J:TQJ -M?75L8F-:.5YT?75L8UMC6#8M-FAR62M86F9ZG!)6%IJ -M83\I-F9B:VMI35MR>FIJ:&-C6B(P1#!->GI@.5F":W !- $_ /YI?W)K:VEB -M14UR7BDY82TM.7J*4$TY*5A6GIH1%A<+W?^8E]B:V)3>H9:/V)Z=58P -M/BD8275:/CE%>GM(4'MB6G6"6F%@ -M:&AR>WIR2V@[ -M*259=7IR6%9B8EMKBF@[+4E@8&9Z:DQ;<'IN@7-)/S])8%@P23\M-EAI=X!- -M1%EB:5!R;P-)_BTE+4UK;UI-8V!-:G!C65E)(D>";6YU9FI$/E9:8G5]GJ"FYC:6%@-F!J8$Q)/DE9:@-ZD6UR -MA8)C,AT.&#]K8D0^.3E? 6(!6P#^9VMB3&:"@G5RF\Y,C9)7W=R8$QJGUV8EY8*59K6V9]?6YB3$M97E8_.6N" -M6S]B8UMKE\R&SEB/BU8:FUZ -M=69UFYL8F!-6DUC/R4Y84];:&MH -M13]F:S8V6#9@8TDM17)Z@F=)8VIC/D1O32U)7#8P16YU;EEN>(IS7"D8(%9W -M8FAB6X)96 %- 5L _FMR85E>;GUU;H5[9EYF;U]-8VE/5FIO8&-@6X)R138E -M.59J:U]-:FMC;UA9:$E$-EA8-B ;&U9?)2UKG)8:/YJ8V9S>WI;35A-.6.'9EQ/;2T5.6)17"4R/B451&)1>GIB;&I,27!P -M:D0R8FYW7WV%.24B/CEB86-)2&MC7D1I84DK8V!526%;6V->:38I8H!H/C]) -M544^5&AR;7)6/&)R>F@Y8C\;+5A$-C!:<6),8&Z)@&U0-BD_:&-C:$V"5EH! -M-@%( (U$:FE866)Z:UQ]>F)J W+^1%MK8S8Y8TU:8BER@&I?.S!)6EI-:'!K -M;VM83'!I6&%L8#L@%2 V53Q$64U;=V9)65MC:UAF21@.%4E987%X6CERGUA&QM,=75J63D[*2=,6D=R8CD;&TEA2 X218)]G)C -M-BE8;H6#6F!-/"TM-C9$8V-J6EIC>GQW:%Q)7EI@8FM),#X!.P$M /X;/F=O -M6EMF;V)M;F)B?7UF86!K;S8_22DY6C!;!:DQB;8)I*R5-W9NF-JW)R<#X;&$EZ?VY?)1@E1X*":FA% -M22TM-C]A=V9B6VE@:GI]H-@+41+/%!P3&)H*14O:5IB:VM$($1N.QMP -M;T0M/FEC3%]8238^8EA5-C9F+14^8AT.;V1;65%N339)41;_GUF7GIF66)F:VE86$4;27)R>H-R -M6DUN>G5<.5I94$DO9X!:.5AI87!K6"TM6G)J=75]=#(.&$EJ:G=H(!M):&)Q -M=6YB:FI%8&J"@F(^6%EKH)8&!4R7G=B13 .%2UQ=7IP36 _+3]8:75] -MFH_27IZ;V)A24MI -M.4EJ>FY@*1TT/#(I7V(M7VQ:8GIZ9FY>8V!816Y@-C)8=VMJ34UK;75K36!J -M7U@M27)?+4UP8V9X23(_8V-K:FIR;5\R(#9-8GQW)0X;-F)YE4R+6MU=7)-(A5-;F@^+VN"H9K23)% -M:5Y)8#DE;^%J65IZ@U!-8%M-;EY:338M6W]B:TQ8:V)C:F9K:VIC539,6#Y% -MU@_16E:36)J9F9J5C8V/V)R;S8@&!56G56,#XR*4EJ -M7TE%6&%A64E-:&X[&TEB W*<9EQG.R 5)3E%1%QJG)_>#P5-&%>-C)J@F))+4EI6&Z#>G!A/CM@ -M46-C36)K=VI66G!W:$0M+2 ^@GIP8V-S:UM)2S\^8FIW8E@Y-EA8+45J8EE+ -M;H-]?4PV56IQ>GIB,#E64%DV%3YZ@FHM("UA1#85,GIK.4DP,$1H:#8;.?Y: -M6$1:>F,Y26A%7GMZ<3\;-GIC;EI-3$U@:UQR/S]$6F-B7TUH9D0@(#9)3UEB8DUC:%E,6FIR6#!;33F"23X!+0%6 /Y9 -M6$5-8GI[=SX=27IF>H!$%1M$<#L2.7]W-A(G8F)L@WIR<%AA?6%6/RE/:WN( -M;4E;G9VH)M($AS9G9K238B.7!F>H-J;3XR,A4.$D1F14QR;T5);C\M/G)Z:V@V34DY.S\!50%/ /Y@:UDT1&]Z>DD[ -M-DQK;&M9,C)C>E4@)6)W/R!$2$UC>GIB8E@_:G)A52LE16:">W=?7&MC<&D_ -M+6)Z@GIF=HIW230M/V)B:V)J:F)Q:"(5,BT^:F)$8W-C/T1-FA66G-K6BWH-F!B1%M:/DUR8C\V:WIK)25: -M;W)R;UXM+4E';7AN?V P1$$8#BUH5DEMGIR6&AJ -M8V9S=G5F35A-.6.'9EQ07S8E/F1F:V)<2U8Y37ER22U$>V$V&Q@M8&@#294Y -M/UE-6G=P.5IR>W=H7G!@5EI5)S\!=0%; /Y/:FQ>26%<ED[,D]R;45H8$5/GU[ -M:30T16)G;VIB;F]U>E\[/"5%-B56FD@86QI154_3V)K/T]<WMF6!@8+4]A<'YP,EMJ;TU)1$5?:F)@676%@F)0:F)B88(R)0%8 6@ -M_FM).6MG8(%N8FIR:U!K6#(M8VIC34UO;UMA:UI-/SE:8V)@/S8R$C)63W)R -M:FM9/V%K63E)-CLR-D5C8VIF9G5W:#8V3TE;;X)-/W)R9G(_7&9BGMW-#Y-6VEO84E)36MW;FUR -M6FMR?S]X8$]NDEL":%4!+0%- +IA6#!6,A@I23Y::W)Z;TDY3&E@ -M63\R)4M: V+^:FYR>F(^/U@V-DU[:DUJ;U!S8F)R:FJ#<$E51#Y812TE17)] -M:EE::TU).5E$)UEZ6C!-:F P1'J">FIK<&$Y6G)J6"=986AK8VM-241K8EI) -M8#]:6X)R=8AK15IRG=)&V]W8#Y@838E5F)B:RT^8VM/:HJ"6%9J@X-U<$M?7DE!8F], -M:7IP8S\I,B5%<$DM3')Z<7 \)4QZ>G@!( $E /Y6.2T^:G5VG!$/F)C:4\R&S]@:G)K -M8FMN?W)A6EL_-C9J>F)N:C]J@FIZULG.4UMB'IR6F-S:6%)-G=;6SEK3V:% -MFYZ8" 2)UMR8GMW85MU>V-:&QM;@GUR7FMR>V]B -M:$DP3&)<8F1;:W5J3UQN:V-U_GUZ8$\Y6VYP=3E,@F%8.5ARF), -M6#\M38)Z>@(^ --F5"5):&!,35Q@+3!,,B4[26-8/UAB:U]86GI]8E@I+6!P -M65IF.3(@%2EB-CY?:'%O8FMI23 [*3!-6EMK?V]:3&)R:F)B53\V.TU$8G)R -M9FIZ;P-K_F)B7E\R.R )"2UFC9%;UI$+2=/8D5KH!V@&,8&UAI-C!:@&]::$U:,&%92:I) -M:7)M>F-I:4AFVA85EIJ65ER8$0T*TM@ -M-CY/87!P8G)_:#8E,#!I6SE:>G5J5EIB9G),6$DM)S8Y8&I:8EIRF9C:EIP:FI,)38V,&+^6SEDC7]W -M.41@@XEN-BUA8V)Z$5% -MH9[12UJ -M;FM))S!WBGU]>VE>-D58+2=J:V!P9U!+8$4M/G>!;F)16G=C6%IZ>G)_21(. -M&UII;G!?.QLB86YJ.T5U?7)).5AR@H)J3P%5 40 _FFEG*25)9EM;:DU::VIK5C8G8G)R:EIC8$EJ=V _1%]U>W!C -M8TA-F)%6VIK1!@I:X)U -M?7MF:#8^:4E):4U$=8AI:W!%&R5$>X9W8%IK:$E$@(-ZAG P#A5$6WJ0;RT; -M,DEW;S8P8%YB8$D^8(!J/P%; 7< _H!)*25)8DD_.4]Z@&9A14E?52 8(%9T -M>FM$)4QL8EQ08V-F>FA$3UE-:%@I%1L_>G)F1$TY138V.TE8,%AB/UIJ7S9: -M?7IF:G)F:VIM=T0Y:EH@*41% -M3'5C/REAAVUZ8"4@8_YL9EEUBEE@-DQN:VD_7FA-<'552QL)#B!)34P_7T19 -M7C8P6FTM8GIR6CY,6EHE%39J9QL88'I:6G)F8V-K2R M:WIV<'=L6"DO;W!: -M:38B8HIZ:WAF.SM99X)]C\I5$1:=SXM6#8P -M65@V,'*"<#X!+P%J /Y_FI,+3LV8H!C2S V-D^&>F-U:59%6WI;36IP4 XM6&IJ7%I)6GIU -M:U@M/&/^:V]$:H9M:FAC8DAO15AT8'*!6&8M&!A$<&]?8&MK>GI:.T5H5EIB -M5CDI*4];.1LM6F@I(FN -B=Z:VMQ8#8E+4]K>V-(:ED8%4R" -M 14!.0#^6EIW>G]R:#8;-%AU:UIW7TMH6TDI$BU:8E]F25]8-BU886)R;S8; -M/VAP/S9>7D0Y6FMR=V!A6#PI(C8G*SPM-EA1:WIR<&E@,BE$8$PP#AMKC&UJ -M8EA5-F"":TU-7B4=>FUQ>FU6-DUZ6T1F:V@@&$EZ(!4@66]><'MW8F=98&AK7SE$4S9):&@R+8(V80(M /XM-FEN -M@GUO025$6$Q--G):/FAO669$/UMO:F-B8V \+5AC>X-Q5"LV8'$_.6)_:$59 -M469U>6M;8$M>6#\T*QLV6$QC>G5W8ED_/#=H1"TP(%B*;6)-8V=-8G)B/UI: -M.RER=&UZ<%A%2']B/VIJ;S8;-GIZ6"U86V)06V%:5FK^:DU)12=,=WV&>UM: -M6#LY:G6#>'5\8UE4/D5866I@:V=R8F)J;W!U51@.&T1)8C\Y7S @&UIZ21M@ -M6EM[>F]/86%%8W=>:#8@(#]Q:U9-24AZ>V!;)2!9:UA)/D4[#A@8-#)9GIK:$UA=7)R=%@M,%9R@F$_@BM+ 4D!+0#^,BE):G6">E4M7FA$ -M33YB3S9:<$]B;TU-GM04&-H:VMJ:E\P8G=B<$0V25I6 -M+3])+25):V-R>F$=#A@M27)R:V$_-%AK:U@E1"4M1450;8!O.4UR;%M9/RTV -M1#\_65]U=G5J5CY)/FEG.0-CHVEJ<7=B83\;-EAB6$DV.7)Z8D4_)1M;?(:* -M:$1$16EC8$E6 5\!60#8:6!8:TUK<$D=16A966-W6B _8$587T]+6GUZ9TUK -M8V9$/UQU:CE%.5IK83\\37!P:%\_35M)869%7V!,6DT_-EAF3VEB;%!;6FJ -M>F=8,BU824U?-C]$9P-R_F-DH6"F)9FYL8F!-6DUC;T1-6UM-4'!B6F--5C8@($5H:%8T,C(;*U1,:GA] -M>EG.3'*"E!9 -M6UIN@H)_:54@#B5A<$E$25A$8&QI.RU6:&9]>V)).3E8:$U8 5D!=@#^BG=/ -M8R4V5E]%8&I,:U@V6$DY8&!8/T]R>GV":#\_8VI@23];:F!6:&!8/S]K>G)K -M3TUR@GIJ:VL_6FMK:$D\*3];8')R:E!B24EU?7V*;D])35IB3&%)&U"*BF9( -M6GIW.2TV33ECAV9<3VTM%3Y?6%AB.2 8%3EP>F]F?84Y_B4B/CEB86-)2&MC -M7D1I84DK8V=B:FMC+2UB8D]C8U@W24U:;W)H7E561#9)+3YJ;G):4&YZ=7IK -M63\V56!IVYM<%DG -A B<$M)66 _,%I[<"TV6F)R@GIP5#!)6H)@6 %9 74 - -end diff --git a/sys/lib/python/test/infinite_reload.py b/sys/lib/python/test/infinite_reload.py deleted file mode 100644 index bfbec91b0..000000000 --- a/sys/lib/python/test/infinite_reload.py +++ /dev/null @@ -1,7 +0,0 @@ -# For testing http://python.org/sf/742342, which reports that Python -# segfaults (infinite recursion in C) in the presence of infinite -# reload()ing. This module is imported by test_import.py:test_infinite_reload -# to make sure this doesn't happen any more. - -import infinite_reload -reload(infinite_reload) diff --git a/sys/lib/python/test/inspect_fodder.py b/sys/lib/python/test/inspect_fodder.py deleted file mode 100644 index 823559bb3..000000000 --- a/sys/lib/python/test/inspect_fodder.py +++ /dev/null @@ -1,56 +0,0 @@ -# line 1 -'A module docstring.' - -import sys, inspect -# line 5 - -# line 7 -def spam(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h): - eggs(b + d, c + f) - -# line 11 -def eggs(x, y): - "A docstring." - global fr, st - fr = inspect.currentframe() - st = inspect.stack() - p = x - q = y / 0 - -# line 20 -class StupidGit: - """A longer, - - indented - - docstring.""" -# line 27 - - def abuse(self, a, b, c): - """Another - -\tdocstring - - containing - -\ttabs -\t - """ - self.argue(a, b, c) -# line 40 - def argue(self, a, b, c): - try: - spam(a, b, c) - except: - self.ex = sys.exc_info() - self.tr = inspect.trace() - -# line 48 -class MalodorousPervert(StupidGit): - pass - -class ParrotDroppings: - pass - -class FesteringGob(MalodorousPervert, ParrotDroppings): - pass diff --git a/sys/lib/python/test/inspect_fodder2.py b/sys/lib/python/test/inspect_fodder2.py deleted file mode 100644 index 3d978cffe..000000000 --- a/sys/lib/python/test/inspect_fodder2.py +++ /dev/null @@ -1,99 +0,0 @@ -# line 1 -def wrap(foo=None): - def wrapper(func): - return func - return wrapper - -# line 7 -def replace(func): - def insteadfunc(): - print 'hello' - return insteadfunc - -# line 13 -@wrap() -@wrap(wrap) -def wrapped(): - pass - -# line 19 -@replace -def gone(): - pass - -# line 24 -oll = lambda m: m - -# line 27 -tll = lambda g: g and \ -g and \ -g - -# line 32 -tlli = lambda d: d and \ - d - -# line 36 -def onelinefunc(): pass - -# line 39 -def manyargs(arg1, arg2, -arg3, arg4): pass - -# line 43 -def twolinefunc(m): return m and \ -m - -# line 47 -a = [None, - lambda x: x, - None] - -# line 52 -def setfunc(func): - globals()["anonymous"] = func -setfunc(lambda x, y: x*y) - -# line 57 -def with_comment(): # hello - world - -# line 61 -multiline_sig = [ - lambda (x, - y): x+y, - None, - ] - -# line 68 -def func69(): - class cls70: - def func71(): - pass - return cls70 -extra74 = 74 - -# line 76 -def func77(): pass -(extra78, stuff78) = 'xy' -extra79 = 'stop' - -# line 81 -class cls82: - def func83(): pass -(extra84, stuff84) = 'xy' -extra85 = 'stop' - -# line 87 -def func88(): - # comment - return 90 - -# line 92 -def f(): - class X: - def g(): - "doc" - return 42 - return X -method_in_dynamic_class = f().g.im_func diff --git a/sys/lib/python/test/leakers/README.txt b/sys/lib/python/test/leakers/README.txt deleted file mode 100644 index beeee0e7f..000000000 --- a/sys/lib/python/test/leakers/README.txt +++ /dev/null @@ -1,32 +0,0 @@ -This directory contains test cases that are known to leak references. -The idea is that you can import these modules while in the interpreter -and call the leak function repeatedly. This will only be helpful if -the interpreter was built in debug mode. If the total ref count -doesn't increase, the bug has been fixed and the file should be removed -from the repository. - -Note: be careful to check for cyclic garbage. Sometimes it may be helpful -to define the leak function like: - -def leak(): - def inner_leak(): - # this is the function that leaks, but also creates cycles - inner_leak() - gc.collect() ; gc.collect() ; gc.collect() - -Here's an example interpreter session for test_gestalt which still leaks: - ->>> from test.leakers.test_gestalt import leak -[24275 refs] ->>> leak() -[28936 refs] ->>> leak() -[28938 refs] ->>> leak() -[28940 refs] ->>> - -Once the leak is fixed, the test case should be moved into an appropriate -test (even if it was originally from the test suite). This ensures the -regression doesn't happen again. And if it does, it should be easier -to track down. diff --git a/sys/lib/python/test/leakers/__init__.py b/sys/lib/python/test/leakers/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/sys/lib/python/test/leakers/test_ctypes.py b/sys/lib/python/test/leakers/test_ctypes.py deleted file mode 100644 index 0f9a2cdc9..000000000 --- a/sys/lib/python/test/leakers/test_ctypes.py +++ /dev/null @@ -1,16 +0,0 @@ - -# Taken from Lib/ctypes/test/test_keeprefs.py, PointerToStructure.test(). -# When this leak is fixed, remember to remove from Misc/build.sh LEAKY_TESTS. - -from ctypes import Structure, c_int, POINTER -import gc - -def leak_inner(): - class POINT(Structure): - _fields_ = [("x", c_int)] - class RECT(Structure): - _fields_ = [("a", POINTER(POINT))] - -def leak(): - leak_inner() - gc.collect() diff --git a/sys/lib/python/test/leakers/test_gestalt.py b/sys/lib/python/test/leakers/test_gestalt.py deleted file mode 100644 index 46bfcc806..000000000 --- a/sys/lib/python/test/leakers/test_gestalt.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys - -if sys.platform != 'darwin': - raise ValueError, "This test only leaks on Mac OS X" - -def leak(): - # taken from platform._mac_ver_lookup() - from gestalt import gestalt - import MacOS - - try: - gestalt('sysu') - except MacOS.Error: - pass diff --git a/sys/lib/python/test/leakers/test_selftype.py b/sys/lib/python/test/leakers/test_selftype.py deleted file mode 100644 index 4207c328b..000000000 --- a/sys/lib/python/test/leakers/test_selftype.py +++ /dev/null @@ -1,13 +0,0 @@ -# Reference cycles involving only the ob_type field are rather uncommon -# but possible. Inspired by SF bug 1469629. - -import gc - -def leak(): - class T(type): - pass - class U(type): - __metaclass__ = T - U.__class__ = U - del U - gc.collect(); gc.collect(); gc.collect() diff --git a/sys/lib/python/test/list_tests.py b/sys/lib/python/test/list_tests.py deleted file mode 100644 index 7c6623a22..000000000 --- a/sys/lib/python/test/list_tests.py +++ /dev/null @@ -1,522 +0,0 @@ -""" -Tests common to list and UserList.UserList -""" - -import sys -import os - -import unittest -from test import test_support, seq_tests - -class CommonTest(seq_tests.CommonTest): - - def test_init(self): - # Iterable arg is optional - self.assertEqual(self.type2test([]), self.type2test()) - - # Init clears previous values - a = self.type2test([1, 2, 3]) - a.__init__() - self.assertEqual(a, self.type2test([])) - - # Init overwrites previous values - a = self.type2test([1, 2, 3]) - a.__init__([4, 5, 6]) - self.assertEqual(a, self.type2test([4, 5, 6])) - - # Mutables always return a new object - b = self.type2test(a) - self.assertNotEqual(id(a), id(b)) - self.assertEqual(a, b) - - def test_repr(self): - l0 = [] - l2 = [0, 1, 2] - a0 = self.type2test(l0) - a2 = self.type2test(l2) - - self.assertEqual(str(a0), str(l0)) - self.assertEqual(repr(a0), repr(l0)) - self.assertEqual(`a2`, `l2`) - self.assertEqual(str(a2), "[0, 1, 2]") - self.assertEqual(repr(a2), "[0, 1, 2]") - - a2.append(a2) - a2.append(3) - self.assertEqual(str(a2), "[0, 1, 2, [...], 3]") - self.assertEqual(repr(a2), "[0, 1, 2, [...], 3]") - - def test_print(self): - d = self.type2test(xrange(200)) - d.append(d) - d.extend(xrange(200,400)) - d.append(d) - d.append(400) - try: - fo = open(test_support.TESTFN, "wb") - print >> fo, d, - fo.close() - fo = open(test_support.TESTFN, "rb") - self.assertEqual(fo.read(), repr(d)) - finally: - fo.close() - os.remove(test_support.TESTFN) - - def test_set_subscript(self): - a = self.type2test(range(20)) - self.assertRaises(ValueError, a.__setitem__, slice(0, 10, 0), [1,2,3]) - self.assertRaises(TypeError, a.__setitem__, slice(0, 10), 1) - self.assertRaises(ValueError, a.__setitem__, slice(0, 10, 2), [1,2]) - self.assertRaises(TypeError, a.__getitem__, 'x', 1) - a[slice(2,10,3)] = [1,2,3] - self.assertEqual(a, self.type2test([0, 1, 1, 3, 4, 2, 6, 7, 3, - 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19])) - - def test_reversed(self): - a = self.type2test(range(20)) - r = reversed(a) - self.assertEqual(list(r), self.type2test(range(19, -1, -1))) - self.assertRaises(StopIteration, r.next) - self.assertEqual(list(reversed(self.type2test())), - self.type2test()) - - def test_setitem(self): - a = self.type2test([0, 1]) - a[0] = 0 - a[1] = 100 - self.assertEqual(a, self.type2test([0, 100])) - a[-1] = 200 - self.assertEqual(a, self.type2test([0, 200])) - a[-2] = 100 - self.assertEqual(a, self.type2test([100, 200])) - self.assertRaises(IndexError, a.__setitem__, -3, 200) - self.assertRaises(IndexError, a.__setitem__, 2, 200) - - a = self.type2test([]) - self.assertRaises(IndexError, a.__setitem__, 0, 200) - self.assertRaises(IndexError, a.__setitem__, -1, 200) - self.assertRaises(TypeError, a.__setitem__) - - a = self.type2test([0,1,2,3,4]) - a[0L] = 1 - a[1L] = 2 - a[2L] = 3 - self.assertEqual(a, self.type2test([1,2,3,3,4])) - a[0] = 5 - a[1] = 6 - a[2] = 7 - self.assertEqual(a, self.type2test([5,6,7,3,4])) - a[-2L] = 88 - a[-1L] = 99 - self.assertEqual(a, self.type2test([5,6,7,88,99])) - a[-2] = 8 - a[-1] = 9 - self.assertEqual(a, self.type2test([5,6,7,8,9])) - - def test_delitem(self): - a = self.type2test([0, 1]) - del a[1] - self.assertEqual(a, [0]) - del a[0] - self.assertEqual(a, []) - - a = self.type2test([0, 1]) - del a[-2] - self.assertEqual(a, [1]) - del a[-1] - self.assertEqual(a, []) - - a = self.type2test([0, 1]) - self.assertRaises(IndexError, a.__delitem__, -3) - self.assertRaises(IndexError, a.__delitem__, 2) - - a = self.type2test([]) - self.assertRaises(IndexError, a.__delitem__, 0) - - self.assertRaises(TypeError, a.__delitem__) - - def test_setslice(self): - l = [0, 1] - a = self.type2test(l) - - for i in range(-3, 4): - a[:i] = l[:i] - self.assertEqual(a, l) - a2 = a[:] - a2[:i] = a[:i] - self.assertEqual(a2, a) - a[i:] = l[i:] - self.assertEqual(a, l) - a2 = a[:] - a2[i:] = a[i:] - self.assertEqual(a2, a) - for j in range(-3, 4): - a[i:j] = l[i:j] - self.assertEqual(a, l) - a2 = a[:] - a2[i:j] = a[i:j] - self.assertEqual(a2, a) - - aa2 = a2[:] - aa2[:0] = [-2, -1] - self.assertEqual(aa2, [-2, -1, 0, 1]) - aa2[0:] = [] - self.assertEqual(aa2, []) - - a = self.type2test([1, 2, 3, 4, 5]) - a[:-1] = a - self.assertEqual(a, self.type2test([1, 2, 3, 4, 5, 5])) - a = self.type2test([1, 2, 3, 4, 5]) - a[1:] = a - self.assertEqual(a, self.type2test([1, 1, 2, 3, 4, 5])) - a = self.type2test([1, 2, 3, 4, 5]) - a[1:-1] = a - self.assertEqual(a, self.type2test([1, 1, 2, 3, 4, 5, 5])) - - a = self.type2test([]) - a[:] = tuple(range(10)) - self.assertEqual(a, self.type2test(range(10))) - - self.assertRaises(TypeError, a.__setslice__, 0, 1, 5) - - self.assertRaises(TypeError, a.__setslice__) - - def test_delslice(self): - a = self.type2test([0, 1]) - del a[1:2] - del a[0:1] - self.assertEqual(a, self.type2test([])) - - a = self.type2test([0, 1]) - del a[1L:2L] - del a[0L:1L] - self.assertEqual(a, self.type2test([])) - - a = self.type2test([0, 1]) - del a[-2:-1] - self.assertEqual(a, self.type2test([1])) - - a = self.type2test([0, 1]) - del a[-2L:-1L] - self.assertEqual(a, self.type2test([1])) - - a = self.type2test([0, 1]) - del a[1:] - del a[:1] - self.assertEqual(a, self.type2test([])) - - a = self.type2test([0, 1]) - del a[1L:] - del a[:1L] - self.assertEqual(a, self.type2test([])) - - a = self.type2test([0, 1]) - del a[-1:] - self.assertEqual(a, self.type2test([0])) - - a = self.type2test([0, 1]) - del a[-1L:] - self.assertEqual(a, self.type2test([0])) - - a = self.type2test([0, 1]) - del a[:] - self.assertEqual(a, self.type2test([])) - - def test_append(self): - a = self.type2test([]) - a.append(0) - a.append(1) - a.append(2) - self.assertEqual(a, self.type2test([0, 1, 2])) - - self.assertRaises(TypeError, a.append) - - def test_extend(self): - a1 = self.type2test([0]) - a2 = self.type2test((0, 1)) - a = a1[:] - a.extend(a2) - self.assertEqual(a, a1 + a2) - - a.extend(self.type2test([])) - self.assertEqual(a, a1 + a2) - - a.extend(a) - self.assertEqual(a, self.type2test([0, 0, 1, 0, 0, 1])) - - a = self.type2test("spam") - a.extend("eggs") - self.assertEqual(a, list("spameggs")) - - self.assertRaises(TypeError, a.extend, None) - - self.assertRaises(TypeError, a.extend) - - def test_insert(self): - a = self.type2test([0, 1, 2]) - a.insert(0, -2) - a.insert(1, -1) - a.insert(2, 0) - self.assertEqual(a, [-2, -1, 0, 0, 1, 2]) - - b = a[:] - b.insert(-2, "foo") - b.insert(-200, "left") - b.insert(200, "right") - self.assertEqual(b, self.type2test(["left",-2,-1,0,0,"foo",1,2,"right"])) - - self.assertRaises(TypeError, a.insert) - - def test_pop(self): - a = self.type2test([-1, 0, 1]) - a.pop() - self.assertEqual(a, [-1, 0]) - a.pop(0) - self.assertEqual(a, [0]) - self.assertRaises(IndexError, a.pop, 5) - a.pop(0) - self.assertEqual(a, []) - self.assertRaises(IndexError, a.pop) - self.assertRaises(TypeError, a.pop, 42, 42) - a = self.type2test([0, 10, 20, 30, 40]) - - def test_remove(self): - a = self.type2test([0, 0, 1]) - a.remove(1) - self.assertEqual(a, [0, 0]) - a.remove(0) - self.assertEqual(a, [0]) - a.remove(0) - self.assertEqual(a, []) - - self.assertRaises(ValueError, a.remove, 0) - - self.assertRaises(TypeError, a.remove) - - class BadExc(Exception): - pass - - class BadCmp: - def __eq__(self, other): - if other == 2: - raise BadExc() - return False - - a = self.type2test([0, 1, 2, 3]) - self.assertRaises(BadExc, a.remove, BadCmp()) - - class BadCmp2: - def __eq__(self, other): - raise BadExc() - - d = self.type2test('abcdefghcij') - d.remove('c') - self.assertEqual(d, self.type2test('abdefghcij')) - d.remove('c') - self.assertEqual(d, self.type2test('abdefghij')) - self.assertRaises(ValueError, d.remove, 'c') - self.assertEqual(d, self.type2test('abdefghij')) - - # Handle comparison errors - d = self.type2test(['a', 'b', BadCmp2(), 'c']) - e = self.type2test(d) - self.assertRaises(BadExc, d.remove, 'c') - for x, y in zip(d, e): - # verify that original order and values are retained. - self.assert_(x is y) - - def test_count(self): - a = self.type2test([0, 1, 2])*3 - self.assertEqual(a.count(0), 3) - self.assertEqual(a.count(1), 3) - self.assertEqual(a.count(3), 0) - - self.assertRaises(TypeError, a.count) - - class BadExc(Exception): - pass - - class BadCmp: - def __eq__(self, other): - if other == 2: - raise BadExc() - return False - - self.assertRaises(BadExc, a.count, BadCmp()) - - def test_index(self): - u = self.type2test([0, 1]) - self.assertEqual(u.index(0), 0) - self.assertEqual(u.index(1), 1) - self.assertRaises(ValueError, u.index, 2) - - u = self.type2test([-2, -1, 0, 0, 1, 2]) - self.assertEqual(u.count(0), 2) - self.assertEqual(u.index(0), 2) - self.assertEqual(u.index(0, 2), 2) - self.assertEqual(u.index(-2, -10), 0) - self.assertEqual(u.index(0, 3), 3) - self.assertEqual(u.index(0, 3, 4), 3) - self.assertRaises(ValueError, u.index, 2, 0, -10) - - self.assertRaises(TypeError, u.index) - - class BadExc(Exception): - pass - - class BadCmp: - def __eq__(self, other): - if other == 2: - raise BadExc() - return False - - a = self.type2test([0, 1, 2, 3]) - self.assertRaises(BadExc, a.index, BadCmp()) - - a = self.type2test([-2, -1, 0, 0, 1, 2]) - self.assertEqual(a.index(0), 2) - self.assertEqual(a.index(0, 2), 2) - self.assertEqual(a.index(0, -4), 2) - self.assertEqual(a.index(-2, -10), 0) - self.assertEqual(a.index(0, 3), 3) - self.assertEqual(a.index(0, -3), 3) - self.assertEqual(a.index(0, 3, 4), 3) - self.assertEqual(a.index(0, -3, -2), 3) - self.assertEqual(a.index(0, -4*sys.maxint, 4*sys.maxint), 2) - self.assertRaises(ValueError, a.index, 0, 4*sys.maxint,-4*sys.maxint) - self.assertRaises(ValueError, a.index, 2, 0, -10) - a.remove(0) - self.assertRaises(ValueError, a.index, 2, 0, 4) - self.assertEqual(a, self.type2test([-2, -1, 0, 1, 2])) - - # Test modifying the list during index's iteration - class EvilCmp: - def __init__(self, victim): - self.victim = victim - def __eq__(self, other): - del self.victim[:] - return False - a = self.type2test() - a[:] = [EvilCmp(a) for _ in xrange(100)] - # This used to seg fault before patch #1005778 - self.assertRaises(ValueError, a.index, None) - - def test_reverse(self): - u = self.type2test([-2, -1, 0, 1, 2]) - u2 = u[:] - u.reverse() - self.assertEqual(u, [2, 1, 0, -1, -2]) - u.reverse() - self.assertEqual(u, u2) - - self.assertRaises(TypeError, u.reverse, 42) - - def test_sort(self): - u = self.type2test([1, 0]) - u.sort() - self.assertEqual(u, [0, 1]) - - u = self.type2test([2,1,0,-1,-2]) - u.sort() - self.assertEqual(u, self.type2test([-2,-1,0,1,2])) - - self.assertRaises(TypeError, u.sort, 42, 42) - - def revcmp(a, b): - return cmp(b, a) - u.sort(revcmp) - self.assertEqual(u, self.type2test([2,1,0,-1,-2])) - - # The following dumps core in unpatched Python 1.5: - def myComparison(x,y): - return cmp(x%3, y%7) - z = self.type2test(range(12)) - z.sort(myComparison) - - self.assertRaises(TypeError, z.sort, 2) - - def selfmodifyingComparison(x,y): - z.append(1) - return cmp(x, y) - self.assertRaises(ValueError, z.sort, selfmodifyingComparison) - - self.assertRaises(TypeError, z.sort, lambda x, y: 's') - - self.assertRaises(TypeError, z.sort, 42, 42, 42, 42) - - def test_slice(self): - u = self.type2test("spam") - u[:2] = "h" - self.assertEqual(u, list("ham")) - - def test_iadd(self): - super(CommonTest, self).test_iadd() - u = self.type2test([0, 1]) - u2 = u - u += [2, 3] - self.assert_(u is u2) - - u = self.type2test("spam") - u += "eggs" - self.assertEqual(u, self.type2test("spameggs")) - - self.assertRaises(TypeError, u.__iadd__, None) - - def test_imul(self): - u = self.type2test([0, 1]) - u *= 3 - self.assertEqual(u, self.type2test([0, 1, 0, 1, 0, 1])) - u *= 0 - self.assertEqual(u, self.type2test([])) - s = self.type2test([]) - oldid = id(s) - s *= 10 - self.assertEqual(id(s), oldid) - - def test_extendedslicing(self): - # subscript - a = self.type2test([0,1,2,3,4]) - - # deletion - del a[::2] - self.assertEqual(a, self.type2test([1,3])) - a = self.type2test(range(5)) - del a[1::2] - self.assertEqual(a, self.type2test([0,2,4])) - a = self.type2test(range(5)) - del a[1::-2] - self.assertEqual(a, self.type2test([0,2,3,4])) - a = self.type2test(range(10)) - del a[::1000] - self.assertEqual(a, self.type2test([1, 2, 3, 4, 5, 6, 7, 8, 9])) - # assignment - a = self.type2test(range(10)) - a[::2] = [-1]*5 - self.assertEqual(a, self.type2test([-1, 1, -1, 3, -1, 5, -1, 7, -1, 9])) - a = self.type2test(range(10)) - a[::-4] = [10]*3 - self.assertEqual(a, self.type2test([0, 10, 2, 3, 4, 10, 6, 7, 8 ,10])) - a = self.type2test(range(4)) - a[::-1] = a - self.assertEqual(a, self.type2test([3, 2, 1, 0])) - a = self.type2test(range(10)) - b = a[:] - c = a[:] - a[2:3] = self.type2test(["two", "elements"]) - b[slice(2,3)] = self.type2test(["two", "elements"]) - c[2:3:] = self.type2test(["two", "elements"]) - self.assertEqual(a, b) - self.assertEqual(a, c) - a = self.type2test(range(10)) - a[::2] = tuple(range(5)) - self.assertEqual(a, self.type2test([0, 1, 1, 3, 2, 5, 3, 7, 4, 9])) - - def test_constructor_exception_handling(self): - # Bug #1242657 - class F(object): - def __iter__(self): - yield 23 - def __len__(self): - raise KeyboardInterrupt - self.assertRaises(KeyboardInterrupt, list, F()) diff --git a/sys/lib/python/test/mapping_tests.py b/sys/lib/python/test/mapping_tests.py deleted file mode 100644 index 4b0f797fb..000000000 --- a/sys/lib/python/test/mapping_tests.py +++ /dev/null @@ -1,672 +0,0 @@ -# tests common to dict and UserDict -import unittest -import UserDict - - -class BasicTestMappingProtocol(unittest.TestCase): - # This base class can be used to check that an object conforms to the - # mapping protocol - - # Functions that can be useful to override to adapt to dictionary - # semantics - type2test = None # which class is being tested (overwrite in subclasses) - - def _reference(self): - """Return a dictionary of values which are invariant by storage - in the object under test.""" - return {1:2, "key1":"value1", "key2":(1,2,3)} - def _empty_mapping(self): - """Return an empty mapping object""" - return self.type2test() - def _full_mapping(self, data): - """Return a mapping object with the value contained in data - dictionary""" - x = self._empty_mapping() - for key, value in data.items(): - x[key] = value - return x - - def __init__(self, *args, **kw): - unittest.TestCase.__init__(self, *args, **kw) - self.reference = self._reference().copy() - - # A (key, value) pair not in the mapping - key, value = self.reference.popitem() - self.other = {key:value} - - # A (key, value) pair in the mapping - key, value = self.reference.popitem() - self.inmapping = {key:value} - self.reference[key] = value - - def test_read(self): - # Test for read only operations on mapping - p = self._empty_mapping() - p1 = dict(p) #workaround for singleton objects - d = self._full_mapping(self.reference) - if d is p: - p = p1 - #Indexing - for key, value in self.reference.items(): - self.assertEqual(d[key], value) - knownkey = self.other.keys()[0] - self.failUnlessRaises(KeyError, lambda:d[knownkey]) - #len - self.assertEqual(len(p), 0) - self.assertEqual(len(d), len(self.reference)) - #has_key - for k in self.reference: - self.assert_(d.has_key(k)) - self.assert_(k in d) - for k in self.other: - self.failIf(d.has_key(k)) - self.failIf(k in d) - #cmp - self.assertEqual(cmp(p,p), 0) - self.assertEqual(cmp(d,d), 0) - self.assertEqual(cmp(p,d), -1) - self.assertEqual(cmp(d,p), 1) - #__non__zero__ - if p: self.fail("Empty mapping must compare to False") - if not d: self.fail("Full mapping must compare to True") - # keys(), items(), iterkeys() ... - def check_iterandlist(iter, lst, ref): - self.assert_(hasattr(iter, 'next')) - self.assert_(hasattr(iter, '__iter__')) - x = list(iter) - self.assert_(set(x)==set(lst)==set(ref)) - check_iterandlist(d.iterkeys(), d.keys(), self.reference.keys()) - check_iterandlist(iter(d), d.keys(), self.reference.keys()) - check_iterandlist(d.itervalues(), d.values(), self.reference.values()) - check_iterandlist(d.iteritems(), d.items(), self.reference.items()) - #get - key, value = d.iteritems().next() - knownkey, knownvalue = self.other.iteritems().next() - self.assertEqual(d.get(key, knownvalue), value) - self.assertEqual(d.get(knownkey, knownvalue), knownvalue) - self.failIf(knownkey in d) - - def test_write(self): - # Test for write operations on mapping - p = self._empty_mapping() - #Indexing - for key, value in self.reference.items(): - p[key] = value - self.assertEqual(p[key], value) - for key in self.reference.keys(): - del p[key] - self.failUnlessRaises(KeyError, lambda:p[key]) - p = self._empty_mapping() - #update - p.update(self.reference) - self.assertEqual(dict(p), self.reference) - items = p.items() - p = self._empty_mapping() - p.update(items) - self.assertEqual(dict(p), self.reference) - d = self._full_mapping(self.reference) - #setdefault - key, value = d.iteritems().next() - knownkey, knownvalue = self.other.iteritems().next() - self.assertEqual(d.setdefault(key, knownvalue), value) - self.assertEqual(d[key], value) - self.assertEqual(d.setdefault(knownkey, knownvalue), knownvalue) - self.assertEqual(d[knownkey], knownvalue) - #pop - self.assertEqual(d.pop(knownkey), knownvalue) - self.failIf(knownkey in d) - self.assertRaises(KeyError, d.pop, knownkey) - default = 909 - d[knownkey] = knownvalue - self.assertEqual(d.pop(knownkey, default), knownvalue) - self.failIf(knownkey in d) - self.assertEqual(d.pop(knownkey, default), default) - #popitem - key, value = d.popitem() - self.failIf(key in d) - self.assertEqual(value, self.reference[key]) - p=self._empty_mapping() - self.assertRaises(KeyError, p.popitem) - - def test_constructor(self): - self.assertEqual(self._empty_mapping(), self._empty_mapping()) - - def test_bool(self): - self.assert_(not self._empty_mapping()) - self.assert_(self.reference) - self.assert_(bool(self._empty_mapping()) is False) - self.assert_(bool(self.reference) is True) - - def test_keys(self): - d = self._empty_mapping() - self.assertEqual(d.keys(), []) - d = self.reference - self.assert_(self.inmapping.keys()[0] in d.keys()) - self.assert_(self.other.keys()[0] not in d.keys()) - self.assertRaises(TypeError, d.keys, None) - - def test_values(self): - d = self._empty_mapping() - self.assertEqual(d.values(), []) - - self.assertRaises(TypeError, d.values, None) - - def test_items(self): - d = self._empty_mapping() - self.assertEqual(d.items(), []) - - self.assertRaises(TypeError, d.items, None) - - def test_len(self): - d = self._empty_mapping() - self.assertEqual(len(d), 0) - - def test_getitem(self): - d = self.reference - self.assertEqual(d[self.inmapping.keys()[0]], self.inmapping.values()[0]) - - self.assertRaises(TypeError, d.__getitem__) - - def test_update(self): - # mapping argument - d = self._empty_mapping() - d.update(self.other) - self.assertEqual(d.items(), self.other.items()) - - # No argument - d = self._empty_mapping() - d.update() - self.assertEqual(d, self._empty_mapping()) - - # item sequence - d = self._empty_mapping() - d.update(self.other.items()) - self.assertEqual(d.items(), self.other.items()) - - # Iterator - d = self._empty_mapping() - d.update(self.other.iteritems()) - self.assertEqual(d.items(), self.other.items()) - - # FIXME: Doesn't work with UserDict - # self.assertRaises((TypeError, AttributeError), d.update, None) - self.assertRaises((TypeError, AttributeError), d.update, 42) - - outerself = self - class SimpleUserDict: - def __init__(self): - self.d = outerself.reference - def keys(self): - return self.d.keys() - def __getitem__(self, i): - return self.d[i] - d.clear() - d.update(SimpleUserDict()) - i1 = d.items() - i2 = self.reference.items() - i1.sort() - i2.sort() - self.assertEqual(i1, i2) - - class Exc(Exception): pass - - d = self._empty_mapping() - class FailingUserDict: - def keys(self): - raise Exc - self.assertRaises(Exc, d.update, FailingUserDict()) - - d.clear() - - class FailingUserDict: - def keys(self): - class BogonIter: - def __init__(self): - self.i = 1 - def __iter__(self): - return self - def next(self): - if self.i: - self.i = 0 - return 'a' - raise Exc - return BogonIter() - def __getitem__(self, key): - return key - self.assertRaises(Exc, d.update, FailingUserDict()) - - class FailingUserDict: - def keys(self): - class BogonIter: - def __init__(self): - self.i = ord('a') - def __iter__(self): - return self - def next(self): - if self.i <= ord('z'): - rtn = chr(self.i) - self.i += 1 - return rtn - raise StopIteration - return BogonIter() - def __getitem__(self, key): - raise Exc - self.assertRaises(Exc, d.update, FailingUserDict()) - - d = self._empty_mapping() - class badseq(object): - def __iter__(self): - return self - def next(self): - raise Exc() - - self.assertRaises(Exc, d.update, badseq()) - - self.assertRaises(ValueError, d.update, [(1, 2, 3)]) - - # no test_fromkeys or test_copy as both os.environ and selves don't support it - - def test_get(self): - d = self._empty_mapping() - self.assert_(d.get(self.other.keys()[0]) is None) - self.assertEqual(d.get(self.other.keys()[0], 3), 3) - d = self.reference - self.assert_(d.get(self.other.keys()[0]) is None) - self.assertEqual(d.get(self.other.keys()[0], 3), 3) - self.assertEqual(d.get(self.inmapping.keys()[0]), self.inmapping.values()[0]) - self.assertEqual(d.get(self.inmapping.keys()[0], 3), self.inmapping.values()[0]) - self.assertRaises(TypeError, d.get) - self.assertRaises(TypeError, d.get, None, None, None) - - def test_setdefault(self): - d = self._empty_mapping() - self.assertRaises(TypeError, d.setdefault) - - def test_popitem(self): - d = self._empty_mapping() - self.assertRaises(KeyError, d.popitem) - self.assertRaises(TypeError, d.popitem, 42) - - def test_pop(self): - d = self._empty_mapping() - k, v = self.inmapping.items()[0] - d[k] = v - self.assertRaises(KeyError, d.pop, self.other.keys()[0]) - - self.assertEqual(d.pop(k), v) - self.assertEqual(len(d), 0) - - self.assertRaises(KeyError, d.pop, k) - - -class TestMappingProtocol(BasicTestMappingProtocol): - def test_constructor(self): - BasicTestMappingProtocol.test_constructor(self) - self.assert_(self._empty_mapping() is not self._empty_mapping()) - self.assertEqual(self.type2test(x=1, y=2), {"x": 1, "y": 2}) - - def test_bool(self): - BasicTestMappingProtocol.test_bool(self) - self.assert_(not self._empty_mapping()) - self.assert_(self._full_mapping({"x": "y"})) - self.assert_(bool(self._empty_mapping()) is False) - self.assert_(bool(self._full_mapping({"x": "y"})) is True) - - def test_keys(self): - BasicTestMappingProtocol.test_keys(self) - d = self._empty_mapping() - self.assertEqual(d.keys(), []) - d = self._full_mapping({'a': 1, 'b': 2}) - k = d.keys() - self.assert_('a' in k) - self.assert_('b' in k) - self.assert_('c' not in k) - - def test_values(self): - BasicTestMappingProtocol.test_values(self) - d = self._full_mapping({1:2}) - self.assertEqual(d.values(), [2]) - - def test_items(self): - BasicTestMappingProtocol.test_items(self) - - d = self._full_mapping({1:2}) - self.assertEqual(d.items(), [(1, 2)]) - - def test_has_key(self): - d = self._empty_mapping() - self.assert_(not d.has_key('a')) - d = self._full_mapping({'a': 1, 'b': 2}) - k = d.keys() - k.sort() - self.assertEqual(k, ['a', 'b']) - - self.assertRaises(TypeError, d.has_key) - - def test_contains(self): - d = self._empty_mapping() - self.assert_(not ('a' in d)) - self.assert_('a' not in d) - d = self._full_mapping({'a': 1, 'b': 2}) - self.assert_('a' in d) - self.assert_('b' in d) - self.assert_('c' not in d) - - self.assertRaises(TypeError, d.__contains__) - - def test_len(self): - BasicTestMappingProtocol.test_len(self) - d = self._full_mapping({'a': 1, 'b': 2}) - self.assertEqual(len(d), 2) - - def test_getitem(self): - BasicTestMappingProtocol.test_getitem(self) - d = self._full_mapping({'a': 1, 'b': 2}) - self.assertEqual(d['a'], 1) - self.assertEqual(d['b'], 2) - d['c'] = 3 - d['a'] = 4 - self.assertEqual(d['c'], 3) - self.assertEqual(d['a'], 4) - del d['b'] - self.assertEqual(d, {'a': 4, 'c': 3}) - - self.assertRaises(TypeError, d.__getitem__) - - def test_clear(self): - d = self._full_mapping({1:1, 2:2, 3:3}) - d.clear() - self.assertEqual(d, {}) - - self.assertRaises(TypeError, d.clear, None) - - def test_update(self): - BasicTestMappingProtocol.test_update(self) - # mapping argument - d = self._empty_mapping() - d.update({1:100}) - d.update({2:20}) - d.update({1:1, 2:2, 3:3}) - self.assertEqual(d, {1:1, 2:2, 3:3}) - - # no argument - d.update() - self.assertEqual(d, {1:1, 2:2, 3:3}) - - # keyword arguments - d = self._empty_mapping() - d.update(x=100) - d.update(y=20) - d.update(x=1, y=2, z=3) - self.assertEqual(d, {"x":1, "y":2, "z":3}) - - # item sequence - d = self._empty_mapping() - d.update([("x", 100), ("y", 20)]) - self.assertEqual(d, {"x":100, "y":20}) - - # Both item sequence and keyword arguments - d = self._empty_mapping() - d.update([("x", 100), ("y", 20)], x=1, y=2) - self.assertEqual(d, {"x":1, "y":2}) - - # iterator - d = self._full_mapping({1:3, 2:4}) - d.update(self._full_mapping({1:2, 3:4, 5:6}).iteritems()) - self.assertEqual(d, {1:2, 2:4, 3:4, 5:6}) - - class SimpleUserDict: - def __init__(self): - self.d = {1:1, 2:2, 3:3} - def keys(self): - return self.d.keys() - def __getitem__(self, i): - return self.d[i] - d.clear() - d.update(SimpleUserDict()) - self.assertEqual(d, {1:1, 2:2, 3:3}) - - def test_fromkeys(self): - self.assertEqual(self.type2test.fromkeys('abc'), {'a':None, 'b':None, 'c':None}) - d = self._empty_mapping() - self.assert_(not(d.fromkeys('abc') is d)) - self.assertEqual(d.fromkeys('abc'), {'a':None, 'b':None, 'c':None}) - self.assertEqual(d.fromkeys((4,5),0), {4:0, 5:0}) - self.assertEqual(d.fromkeys([]), {}) - def g(): - yield 1 - self.assertEqual(d.fromkeys(g()), {1:None}) - self.assertRaises(TypeError, {}.fromkeys, 3) - class dictlike(self.type2test): pass - self.assertEqual(dictlike.fromkeys('a'), {'a':None}) - self.assertEqual(dictlike().fromkeys('a'), {'a':None}) - self.assert_(dictlike.fromkeys('a').__class__ is dictlike) - self.assert_(dictlike().fromkeys('a').__class__ is dictlike) - # FIXME: the following won't work with UserDict, because it's an old style class - # self.assert_(type(dictlike.fromkeys('a')) is dictlike) - class mydict(self.type2test): - def __new__(cls): - return UserDict.UserDict() - ud = mydict.fromkeys('ab') - self.assertEqual(ud, {'a':None, 'b':None}) - # FIXME: the following won't work with UserDict, because it's an old style class - # self.assert_(isinstance(ud, UserDict.UserDict)) - self.assertRaises(TypeError, dict.fromkeys) - - class Exc(Exception): pass - - class baddict1(self.type2test): - def __init__(self): - raise Exc() - - self.assertRaises(Exc, baddict1.fromkeys, [1]) - - class BadSeq(object): - def __iter__(self): - return self - def next(self): - raise Exc() - - self.assertRaises(Exc, self.type2test.fromkeys, BadSeq()) - - class baddict2(self.type2test): - def __setitem__(self, key, value): - raise Exc() - - self.assertRaises(Exc, baddict2.fromkeys, [1]) - - def test_copy(self): - d = self._full_mapping({1:1, 2:2, 3:3}) - self.assertEqual(d.copy(), {1:1, 2:2, 3:3}) - d = self._empty_mapping() - self.assertEqual(d.copy(), d) - self.assert_(isinstance(d.copy(), d.__class__)) - self.assertRaises(TypeError, d.copy, None) - - def test_get(self): - BasicTestMappingProtocol.test_get(self) - d = self._empty_mapping() - self.assert_(d.get('c') is None) - self.assertEqual(d.get('c', 3), 3) - d = self._full_mapping({'a' : 1, 'b' : 2}) - self.assert_(d.get('c') is None) - self.assertEqual(d.get('c', 3), 3) - self.assertEqual(d.get('a'), 1) - self.assertEqual(d.get('a', 3), 1) - - def test_setdefault(self): - BasicTestMappingProtocol.test_setdefault(self) - d = self._empty_mapping() - self.assert_(d.setdefault('key0') is None) - d.setdefault('key0', []) - self.assert_(d.setdefault('key0') is None) - d.setdefault('key', []).append(3) - self.assertEqual(d['key'][0], 3) - d.setdefault('key', []).append(4) - self.assertEqual(len(d['key']), 2) - - def test_popitem(self): - BasicTestMappingProtocol.test_popitem(self) - for copymode in -1, +1: - # -1: b has same structure as a - # +1: b is a.copy() - for log2size in range(12): - size = 2**log2size - a = self._empty_mapping() - b = self._empty_mapping() - for i in range(size): - a[repr(i)] = i - if copymode < 0: - b[repr(i)] = i - if copymode > 0: - b = a.copy() - for i in range(size): - ka, va = ta = a.popitem() - self.assertEqual(va, int(ka)) - kb, vb = tb = b.popitem() - self.assertEqual(vb, int(kb)) - self.assert_(not(copymode < 0 and ta != tb)) - self.assert_(not a) - self.assert_(not b) - - def test_pop(self): - BasicTestMappingProtocol.test_pop(self) - - # Tests for pop with specified key - d = self._empty_mapping() - k, v = 'abc', 'def' - - # verify longs/ints get same value when key > 32 bits (for 64-bit archs) - # see SF bug #689659 - x = 4503599627370496L - y = 4503599627370496 - h = self._full_mapping({x: 'anything', y: 'something else'}) - self.assertEqual(h[x], h[y]) - - self.assertEqual(d.pop(k, v), v) - d[k] = v - self.assertEqual(d.pop(k, 1), v) - - -class TestHashMappingProtocol(TestMappingProtocol): - - def test_getitem(self): - TestMappingProtocol.test_getitem(self) - class Exc(Exception): pass - - class BadEq(object): - def __eq__(self, other): - raise Exc() - - d = self._empty_mapping() - d[BadEq()] = 42 - self.assertRaises(KeyError, d.__getitem__, 23) - - class BadHash(object): - fail = False - def __hash__(self): - if self.fail: - raise Exc() - else: - return 42 - - d = self._empty_mapping() - x = BadHash() - d[x] = 42 - x.fail = True - self.assertRaises(Exc, d.__getitem__, x) - - def test_fromkeys(self): - TestMappingProtocol.test_fromkeys(self) - class mydict(self.type2test): - def __new__(cls): - return UserDict.UserDict() - ud = mydict.fromkeys('ab') - self.assertEqual(ud, {'a':None, 'b':None}) - self.assert_(isinstance(ud, UserDict.UserDict)) - - def test_pop(self): - TestMappingProtocol.test_pop(self) - - class Exc(Exception): pass - - class BadHash(object): - fail = False - def __hash__(self): - if self.fail: - raise Exc() - else: - return 42 - - d = self._empty_mapping() - x = BadHash() - d[x] = 42 - x.fail = True - self.assertRaises(Exc, d.pop, x) - - def test_mutatingiteration(self): - d = self._empty_mapping() - d[1] = 1 - try: - for i in d: - d[i+1] = 1 - except RuntimeError: - pass - else: - self.fail("changing dict size during iteration doesn't raise Error") - - def test_repr(self): - d = self._empty_mapping() - self.assertEqual(repr(d), '{}') - d[1] = 2 - self.assertEqual(repr(d), '{1: 2}') - d = self._empty_mapping() - d[1] = d - self.assertEqual(repr(d), '{1: {...}}') - - class Exc(Exception): pass - - class BadRepr(object): - def __repr__(self): - raise Exc() - - d = self._full_mapping({1: BadRepr()}) - self.assertRaises(Exc, repr, d) - - def test_le(self): - self.assert_(not (self._empty_mapping() < self._empty_mapping())) - self.assert_(not (self._full_mapping({1: 2}) < self._full_mapping({1L: 2L}))) - - class Exc(Exception): pass - - class BadCmp(object): - def __eq__(self, other): - raise Exc() - - d1 = self._full_mapping({BadCmp(): 1}) - d2 = self._full_mapping({1: 1}) - try: - d1 < d2 - except Exc: - pass - else: - self.fail("< didn't raise Exc") - - def test_setdefault(self): - TestMappingProtocol.test_setdefault(self) - - class Exc(Exception): pass - - class BadHash(object): - fail = False - def __hash__(self): - if self.fail: - raise Exc() - else: - return 42 - - d = self._empty_mapping() - x = BadHash() - d[x] = 42 - x.fail = True - self.assertRaises(Exc, d.setdefault, x, []) diff --git a/sys/lib/python/test/output/test_MimeWriter b/sys/lib/python/test/output/test_MimeWriter deleted file mode 100644 index 9b97d93ee..000000000 --- a/sys/lib/python/test/output/test_MimeWriter +++ /dev/null @@ -1,110 +0,0 @@ -test_MimeWriter -From: bwarsaw@cnri.reston.va.us -Date: Mon Feb 12 17:21:48 EST 1996 -To: kss-submit@cnri.reston.va.us -MIME-Version: 1.0 -Content-Type: multipart/knowbot; - boundary="801spam999"; - version="0.1" - -This is a multi-part message in MIME format. - ---801spam999 -Content-Type: multipart/knowbot-metadata; - boundary="802spam999" - - ---802spam999 -Content-Type: message/rfc822 -KP-Metadata-Type: simple -KP-Access: read-only - -KPMD-Interpreter: python -KPMD-Interpreter-Version: 1.3 -KPMD-Owner-Name: Barry Warsaw -KPMD-Owner-Rendezvous: bwarsaw@cnri.reston.va.us -KPMD-Home-KSS: kss.cnri.reston.va.us -KPMD-Identifier: hdl://cnri.kss/my_first_knowbot -KPMD-Launch-Date: Mon Feb 12 16:39:03 EST 1996 - ---802spam999 -Content-Type: text/isl -KP-Metadata-Type: complex -KP-Metadata-Key: connection -KP-Access: read-only -KP-Connection-Description: Barry's Big Bass Business -KP-Connection-Id: B4 -KP-Connection-Direction: client - -INTERFACE Seller-1; - -TYPE Seller = OBJECT - DOCUMENTATION "A simple Seller interface to test ILU" - METHODS - price():INTEGER, - END; - ---802spam999 -Content-Type: message/external-body; - access-type="URL"; - URL="hdl://cnri.kss/generic-knowbot" - -Content-Type: text/isl -KP-Metadata-Type: complex -KP-Metadata-Key: generic-interface -KP-Access: read-only -KP-Connection-Description: Generic Interface for All Knowbots -KP-Connection-Id: generic-kp -KP-Connection-Direction: client - - ---802spam999-- - ---801spam999 -Content-Type: multipart/knowbot-code; - boundary="803spam999" - - ---803spam999 -Content-Type: text/plain -KP-Module-Name: BuyerKP - -class Buyer: - def __setup__(self, maxprice): - self._maxprice = maxprice - - def __main__(self, kos): - """Entry point upon arrival at a new KOS.""" - broker = kos.broker() - # B4 == Barry's Big Bass Business :-) - seller = broker.lookup('Seller_1.Seller', 'B4') - if seller: - price = seller.price() - print 'Seller wants $', price, '... ' - if price > self._maxprice: - print 'too much!' - else: - print "I'll take it!" - else: - print 'no seller found here' - ---803spam999-- - ---801spam999 -Content-Type: multipart/knowbot-state; - boundary="804spam999" -KP-Main-Module: main - - ---804spam999 -Content-Type: text/plain -KP-Module-Name: main - -# instantiate a buyer instance and put it in a magic place for the KOS -# to find. -__kp__ = Buyer() -__kp__.__setup__(500) - ---804spam999-- - ---801spam999-- diff --git a/sys/lib/python/test/output/test_cProfile b/sys/lib/python/test/output/test_cProfile deleted file mode 100644 index fff3568ff..000000000 --- a/sys/lib/python/test/output/test_cProfile +++ /dev/null @@ -1,79 +0,0 @@ -test_cProfile - 126 function calls (106 primitive calls) in 1.000 CPU seconds - - Ordered by: standard name - - ncalls tottime percall cumtime percall filename:lineno(function) - 1 0.000 0.000 1.000 1.000 :1() - 8 0.064 0.008 0.080 0.010 test_cProfile.py:103(subhelper) - 28 0.028 0.001 0.028 0.001 test_cProfile.py:115(__getattr__) - 1 0.270 0.270 1.000 1.000 test_cProfile.py:30(testfunc) - 23/3 0.150 0.007 0.170 0.057 test_cProfile.py:40(factorial) - 20 0.020 0.001 0.020 0.001 test_cProfile.py:53(mul) - 2 0.040 0.020 0.600 0.300 test_cProfile.py:60(helper) - 4 0.116 0.029 0.120 0.030 test_cProfile.py:78(helper1) - 2 0.000 0.000 0.140 0.070 test_cProfile.py:89(helper2_indirect) - 8 0.312 0.039 0.400 0.050 test_cProfile.py:93(helper2) - 12 0.000 0.000 0.012 0.001 {hasattr} - 4 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects} - 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} - 8 0.000 0.000 0.000 0.000 {range} - 4 0.000 0.000 0.000 0.000 {sys.exc_info} - - - Ordered by: standard name - -Function called... - ncalls tottime cumtime -:1() -> 1 0.270 1.000 test_cProfile.py:30(testfunc) -test_cProfile.py:103(subhelper) -> 16 0.016 0.016 test_cProfile.py:115(__getattr__) - 8 0.000 0.000 {range} -test_cProfile.py:115(__getattr__) -> -test_cProfile.py:30(testfunc) -> 1 0.014 0.130 test_cProfile.py:40(factorial) - 2 0.040 0.600 test_cProfile.py:60(helper) -test_cProfile.py:40(factorial) -> 20/3 0.130 0.147 test_cProfile.py:40(factorial) - 20 0.020 0.020 test_cProfile.py:53(mul) -test_cProfile.py:53(mul) -> -test_cProfile.py:60(helper) -> 4 0.116 0.120 test_cProfile.py:78(helper1) - 2 0.000 0.140 test_cProfile.py:89(helper2_indirect) - 6 0.234 0.300 test_cProfile.py:93(helper2) -test_cProfile.py:78(helper1) -> 4 0.000 0.004 {hasattr} - 4 0.000 0.000 {method 'append' of 'list' objects} - 4 0.000 0.000 {sys.exc_info} -test_cProfile.py:89(helper2_indirect) -> 2 0.006 0.040 test_cProfile.py:40(factorial) - 2 0.078 0.100 test_cProfile.py:93(helper2) -test_cProfile.py:93(helper2) -> 8 0.064 0.080 test_cProfile.py:103(subhelper) - 8 0.000 0.008 {hasattr} -{hasattr} -> 12 0.012 0.012 test_cProfile.py:115(__getattr__) -{method 'append' of 'list' objects} -> -{method 'disable' of '_lsprof.Profiler' objects} -> -{range} -> -{sys.exc_info} -> - - - Ordered by: standard name - -Function was called by... - ncalls tottime cumtime -:1() <- -test_cProfile.py:103(subhelper) <- 8 0.064 0.080 test_cProfile.py:93(helper2) -test_cProfile.py:115(__getattr__) <- 16 0.016 0.016 test_cProfile.py:103(subhelper) - 12 0.012 0.012 {hasattr} -test_cProfile.py:30(testfunc) <- 1 0.270 1.000 :1() -test_cProfile.py:40(factorial) <- 1 0.014 0.130 test_cProfile.py:30(testfunc) - 20/3 0.130 0.147 test_cProfile.py:40(factorial) - 2 0.006 0.040 test_cProfile.py:89(helper2_indirect) -test_cProfile.py:53(mul) <- 20 0.020 0.020 test_cProfile.py:40(factorial) -test_cProfile.py:60(helper) <- 2 0.040 0.600 test_cProfile.py:30(testfunc) -test_cProfile.py:78(helper1) <- 4 0.116 0.120 test_cProfile.py:60(helper) -test_cProfile.py:89(helper2_indirect) <- 2 0.000 0.140 test_cProfile.py:60(helper) -test_cProfile.py:93(helper2) <- 6 0.234 0.300 test_cProfile.py:60(helper) - 2 0.078 0.100 test_cProfile.py:89(helper2_indirect) -{hasattr} <- 4 0.000 0.004 test_cProfile.py:78(helper1) - 8 0.000 0.008 test_cProfile.py:93(helper2) -{method 'append' of 'list' objects} <- 4 0.000 0.000 test_cProfile.py:78(helper1) -{method 'disable' of '_lsprof.Profiler' objects} <- -{range} <- 8 0.000 0.000 test_cProfile.py:103(subhelper) -{sys.exc_info} <- 4 0.000 0.000 test_cProfile.py:78(helper1) - - diff --git a/sys/lib/python/test/output/test_cgi b/sys/lib/python/test/output/test_cgi deleted file mode 100644 index 26eddfa91..000000000 --- a/sys/lib/python/test/output/test_cgi +++ /dev/null @@ -1,42 +0,0 @@ -test_cgi -'' => [] -'&' => [] -'&&' => [] -'=' => [('', '')] -'=a' => [('', 'a')] -'a' => [('a', '')] -'a=' => [('a', '')] -'a=' => [('a', '')] -'&a=b' => [('a', 'b')] -'a=a+b&b=b+c' => [('a', 'a b'), ('b', 'b c')] -'a=1&a=2' => [('a', '1'), ('a', '2')] -'' -'&' -'&&' -';' -';&;' -'=' -'=&=' -'=;=' -'=a' -'&=a' -'=a&' -'=&a' -'b=a' -'b+=a' -'a=b=a' -'a=+b=a' -'&b=a' -'b&=a' -'a=a+b&b=b+c' -'a=a+b&a=b+a' -'x=1&y=2.0&z=2-3.%2b0' -'x=1;y=2.0&z=2-3.%2b0' -'x=1;y=2.0;z=2-3.%2b0' -'Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=env' -'group_id=5470&set=custom&_assigned_to=31392&_status=1&_category=100&SUBMIT=Browse' -Testing log -Testing initlog 1 -Testing log 2 -Test FieldStorage methods that use readline -Test basic FieldStorage multipart parsing diff --git a/sys/lib/python/test/output/test_class b/sys/lib/python/test/output/test_class deleted file mode 100644 index 93827f17e..000000000 --- a/sys/lib/python/test/output/test_class +++ /dev/null @@ -1,101 +0,0 @@ -test_class -__init__: () -__coerce__: (1,) -__add__: (1,) -__coerce__: (1,) -__radd__: (1,) -__coerce__: (1,) -__sub__: (1,) -__coerce__: (1,) -__rsub__: (1,) -__coerce__: (1,) -__mul__: (1,) -__coerce__: (1,) -__rmul__: (1,) -__coerce__: (1,) -__div__: (1,) -__coerce__: (1,) -__rdiv__: (1,) -__coerce__: (1,) -__mod__: (1,) -__coerce__: (1,) -__rmod__: (1,) -__coerce__: (1,) -__divmod__: (1,) -__coerce__: (1,) -__rdivmod__: (1,) -__coerce__: (1,) -__pow__: (1,) -__coerce__: (1,) -__rpow__: (1,) -__coerce__: (1,) -__rshift__: (1,) -__coerce__: (1,) -__rrshift__: (1,) -__coerce__: (1,) -__lshift__: (1,) -__coerce__: (1,) -__rlshift__: (1,) -__coerce__: (1,) -__and__: (1,) -__coerce__: (1,) -__rand__: (1,) -__coerce__: (1,) -__or__: (1,) -__coerce__: (1,) -__ror__: (1,) -__coerce__: (1,) -__xor__: (1,) -__coerce__: (1,) -__rxor__: (1,) -__contains__: (1,) -__getitem__: (1,) -__setitem__: (1, 1) -__delitem__: (1,) -__getslice__: (0, 42) -__setslice__: (0, 42, 'The Answer') -__delslice__: (0, 42) -__getitem__: (slice(2, 1024, 10),) -__setitem__: (slice(2, 1024, 10), 'A lot') -__delitem__: (slice(2, 1024, 10),) -__getitem__: ((slice(None, 42, None), Ellipsis, slice(None, 24, None), 24, 100),) -__setitem__: ((slice(None, 42, None), Ellipsis, slice(None, 24, None), 24, 100), 'Strange') -__delitem__: ((slice(None, 42, None), Ellipsis, slice(None, 24, None), 24, 100),) -__getitem__: (slice(0, 42, None),) -__setitem__: (slice(0, 42, None), 'The Answer') -__delitem__: (slice(0, 42, None),) -__neg__: () -__pos__: () -__abs__: () -__int__: () -__long__: () -__float__: () -__oct__: () -__hex__: () -__hash__: () -__repr__: () -__str__: () -__coerce__: (1,) -__cmp__: (1,) -__coerce__: (1,) -__cmp__: (1,) -__coerce__: (1,) -__cmp__: (1,) -__coerce__: (1,) -__cmp__: (1,) -__coerce__: (1,) -__cmp__: (1,) -__coerce__: (1,) -__cmp__: (1,) -__coerce__: (1,) -__cmp__: (1,) -__coerce__: (1,) -__cmp__: (1,) -__coerce__: (1,) -__cmp__: (1,) -__coerce__: (1,) -__cmp__: (1,) -__del__: () -__getattr__: ('spam',) -__setattr__: ('eggs', 'spam, spam, spam and ham') -__delattr__: ('cardinal',) diff --git a/sys/lib/python/test/output/test_cookie b/sys/lib/python/test/output/test_cookie deleted file mode 100644 index 95c73283b..000000000 --- a/sys/lib/python/test/output/test_cookie +++ /dev/null @@ -1,32 +0,0 @@ -test_cookie - -Set-Cookie: chips=ahoy -Set-Cookie: vienna=finger - chips 'ahoy' 'ahoy' -Set-Cookie: chips=ahoy - vienna 'finger' 'finger' -Set-Cookie: vienna=finger - -Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;" - keebler 'E=mc2; L="Loves"; fudge=\n;' 'E=mc2; L="Loves"; fudge=\n;' -Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;" - -Set-Cookie: keebler=E=mc2 - keebler 'E=mc2' 'E=mc2' -Set-Cookie: keebler=E=mc2 -Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme - - - - - - -If anything blows up after this line, it's from Cookie's doctest. diff --git a/sys/lib/python/test/output/test_extcall b/sys/lib/python/test/output/test_extcall deleted file mode 100644 index cb93b0d83..000000000 --- a/sys/lib/python/test/output/test_extcall +++ /dev/null @@ -1,112 +0,0 @@ -test_extcall -() {} -(1,) {} -(1, 2) {} -(1, 2, 3) {} -(1, 2, 3, 4, 5) {} -(1, 2, 3, 4, 5) {} -(1, 2, 3, 4, 5) {} -(1, 2, 3) {'a': 4, 'b': 5} -(1, 2, 3, 4, 5) {'a': 6, 'b': 7} -(1, 2, 3, 6, 7) {'a': 8, 'b': 9, 'x': 4, 'y': 5} -TypeError: g() takes at least 1 argument (0 given) -TypeError: g() takes at least 1 argument (0 given) -TypeError: g() takes at least 1 argument (0 given) -1 () {} -1 (2,) {} -1 (2, 3) {} -1 (2, 3, 4, 5) {} -0 (1, 2) {} -0 (1, 2, 3) {} -1 () {'a': 1, 'b': 2, 'c': 3, 'd': 4} -{'a': 1, 'b': 2, 'c': 3} -{'a': 1, 'b': 2, 'c': 3} -g() got multiple values for keyword argument 'x' -g() got multiple values for keyword argument 'b' -f() keywords must be strings -h() got an unexpected keyword argument 'e' -h() argument after * must be a sequence -dir() argument after * must be a sequence -NoneType object argument after * must be a sequence -h() argument after ** must be a dictionary -dir() argument after ** must be a dictionary -NoneType object argument after ** must be a dictionary -dir() got multiple values for keyword argument 'b' -3 512 True -3 -3 -za () {} -> za() takes exactly 1 argument (0 given) -za () {'a': 'aa'} -> ok za aa B D E V a -za () {'d': 'dd'} -> za() got an unexpected keyword argument 'd' -za () {'a': 'aa', 'd': 'dd'} -> za() got an unexpected keyword argument 'd' -za () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got an unexpected keyword argument 'b' -za (1, 2) {} -> za() takes exactly 1 argument (2 given) -za (1, 2) {'a': 'aa'} -> za() takes exactly 1 non-keyword argument (2 given) -za (1, 2) {'d': 'dd'} -> za() takes exactly 1 non-keyword argument (2 given) -za (1, 2) {'a': 'aa', 'd': 'dd'} -> za() takes exactly 1 non-keyword argument (2 given) -za (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() takes exactly 1 non-keyword argument (2 given) -za (1, 2, 3, 4, 5) {} -> za() takes exactly 1 argument (5 given) -za (1, 2, 3, 4, 5) {'a': 'aa'} -> za() takes exactly 1 non-keyword argument (5 given) -za (1, 2, 3, 4, 5) {'d': 'dd'} -> za() takes exactly 1 non-keyword argument (5 given) -za (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> za() takes exactly 1 non-keyword argument (5 given) -za (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() takes exactly 1 non-keyword argument (5 given) -zade () {} -> zade() takes at least 1 argument (0 given) -zade () {'a': 'aa'} -> ok zade aa B d e V a -zade () {'d': 'dd'} -> zade() takes at least 1 non-keyword argument (0 given) -zade () {'a': 'aa', 'd': 'dd'} -> ok zade aa B dd e V d -zade () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() got an unexpected keyword argument 'b' -zade (1, 2) {} -> ok zade 1 B 2 e V e -zade (1, 2) {'a': 'aa'} -> zade() got multiple values for keyword argument 'a' -zade (1, 2) {'d': 'dd'} -> zade() got multiple values for keyword argument 'd' -zade (1, 2) {'a': 'aa', 'd': 'dd'} -> zade() got multiple values for keyword argument 'a' -zade (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() got multiple values for keyword argument 'a' -zade (1, 2, 3, 4, 5) {} -> zade() takes at most 3 arguments (5 given) -zade (1, 2, 3, 4, 5) {'a': 'aa'} -> zade() takes at most 3 non-keyword arguments (5 given) -zade (1, 2, 3, 4, 5) {'d': 'dd'} -> zade() takes at most 3 non-keyword arguments (5 given) -zade (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zade() takes at most 3 non-keyword arguments (5 given) -zade (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() takes at most 3 non-keyword arguments (5 given) -zabk () {} -> zabk() takes exactly 2 arguments (0 given) -zabk () {'a': 'aa'} -> zabk() takes exactly 2 non-keyword arguments (1 given) -zabk () {'d': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (0 given) -zabk () {'a': 'aa', 'd': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (1 given) -zabk () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> ok zabk aa bb D E V {'d': 'dd', 'e': 'ee'} -zabk (1, 2) {} -> ok zabk 1 2 D E V {} -zabk (1, 2) {'a': 'aa'} -> zabk() got multiple values for keyword argument 'a' -zabk (1, 2) {'d': 'dd'} -> ok zabk 1 2 D E V {'d': 'dd'} -zabk (1, 2) {'a': 'aa', 'd': 'dd'} -> zabk() got multiple values for keyword argument 'a' -zabk (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabk() got multiple values for keyword argument 'a' -zabk (1, 2, 3, 4, 5) {} -> zabk() takes exactly 2 arguments (5 given) -zabk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabk() takes exactly 2 non-keyword arguments (5 given) -zabk (1, 2, 3, 4, 5) {'d': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (5 given) -zabk (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (5 given) -zabk (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabk() takes exactly 2 non-keyword arguments (5 given) -zabdv () {} -> zabdv() takes at least 2 arguments (0 given) -zabdv () {'a': 'aa'} -> zabdv() takes at least 2 non-keyword arguments (1 given) -zabdv () {'d': 'dd'} -> zabdv() takes at least 2 non-keyword arguments (0 given) -zabdv () {'a': 'aa', 'd': 'dd'} -> zabdv() takes at least 2 non-keyword arguments (1 given) -zabdv () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got an unexpected keyword argument 'e' -zabdv (1, 2) {} -> ok zabdv 1 2 d E () e -zabdv (1, 2) {'a': 'aa'} -> zabdv() got multiple values for keyword argument 'a' -zabdv (1, 2) {'d': 'dd'} -> ok zabdv 1 2 dd E () d -zabdv (1, 2) {'a': 'aa', 'd': 'dd'} -> zabdv() got multiple values for keyword argument 'a' -zabdv (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got multiple values for keyword argument 'a' -zabdv (1, 2, 3, 4, 5) {} -> ok zabdv 1 2 3 E (4, 5) e -zabdv (1, 2, 3, 4, 5) {'a': 'aa'} -> zabdv() got multiple values for keyword argument 'a' -zabdv (1, 2, 3, 4, 5) {'d': 'dd'} -> zabdv() got multiple values for keyword argument 'd' -zabdv (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabdv() got multiple values for keyword argument 'a' -zabdv (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got multiple values for keyword argument 'a' -zabdevk () {} -> zabdevk() takes at least 2 arguments (0 given) -zabdevk () {'a': 'aa'} -> zabdevk() takes at least 2 non-keyword arguments (1 given) -zabdevk () {'d': 'dd'} -> zabdevk() takes at least 2 non-keyword arguments (0 given) -zabdevk () {'a': 'aa', 'd': 'dd'} -> zabdevk() takes at least 2 non-keyword arguments (1 given) -zabdevk () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> ok zabdevk aa bb dd ee () {} -zabdevk (1, 2) {} -> ok zabdevk 1 2 d e () {} -zabdevk (1, 2) {'a': 'aa'} -> zabdevk() got multiple values for keyword argument 'a' -zabdevk (1, 2) {'d': 'dd'} -> ok zabdevk 1 2 dd e () {} -zabdevk (1, 2) {'a': 'aa', 'd': 'dd'} -> zabdevk() got multiple values for keyword argument 'a' -zabdevk (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdevk() got multiple values for keyword argument 'a' -zabdevk (1, 2, 3, 4, 5) {} -> ok zabdevk 1 2 3 4 (5,) {} -zabdevk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabdevk() got multiple values for keyword argument 'a' -zabdevk (1, 2, 3, 4, 5) {'d': 'dd'} -> zabdevk() got multiple values for keyword argument 'd' -zabdevk (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabdevk() got multiple values for keyword argument 'a' -zabdevk (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdevk() got multiple values for keyword argument 'a' diff --git a/sys/lib/python/test/output/test_frozen b/sys/lib/python/test/output/test_frozen deleted file mode 100644 index 76f17dbfd..000000000 --- a/sys/lib/python/test/output/test_frozen +++ /dev/null @@ -1,4 +0,0 @@ -test_frozen -Hello world... -Hello world... -Hello world... diff --git a/sys/lib/python/test/output/test_global b/sys/lib/python/test/output/test_global deleted file mode 100644 index a427a29cb..000000000 --- a/sys/lib/python/test/output/test_global +++ /dev/null @@ -1,5 +0,0 @@ -test_global -got SyntaxError as expected -got SyntaxError as expected -got SyntaxError as expected -as expected, no SyntaxError diff --git a/sys/lib/python/test/output/test_grammar b/sys/lib/python/test/output/test_grammar deleted file mode 100644 index 4fa9cb03c..000000000 --- a/sys/lib/python/test/output/test_grammar +++ /dev/null @@ -1,69 +0,0 @@ -test_grammar -1. Parser -1.1 Tokens -1.1.1 Backslashes -1.1.2 Numeric literals -1.1.2.1 Plain integers -1.1.2.2 Long integers -1.1.2.3 Floating point -1.1.3 String literals -1.2 Grammar -single_input -file_input -expr_input -eval_input -funcdef -lambdef -simple_stmt -expr_stmt -print_stmt -1 2 3 -1 2 3 -1 1 1 -extended print_stmt -1 2 3 -1 2 3 -1 1 1 -hello world -del_stmt -pass_stmt -flow_stmt -break_stmt -continue_stmt -continue + try/except ok -continue + try/finally ok -testing continue and break in try/except in loop -return_stmt -yield_stmt -raise_stmt -import_name -import_from -global_stmt -exec_stmt -assert_stmt -if_stmt -while_stmt -for_stmt -try_stmt -suite -test -comparison -binary mask ops -shift ops -additive ops -multiplicative ops -unary ops -selectors - -[1, (1,), (1, 2), (1, 2, 3)] -atoms -classdef -['Apple', 'Banana', 'Coco nut'] -[3, 6, 9, 12, 15] -[3, 4, 5] -[(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] -[(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] -[[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]] -[False, False, False] -[[1, 2], [3, 4], [5, 6]] -[('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')] diff --git a/sys/lib/python/test/output/test_httplib b/sys/lib/python/test/output/test_httplib deleted file mode 100644 index 302b876d7..000000000 --- a/sys/lib/python/test/output/test_httplib +++ /dev/null @@ -1,13 +0,0 @@ -test_httplib -reply: 'HTTP/1.1 200 Ok\r\n' -Text -reply: 'HTTP/1.1 400.100 Not Ok\r\n' -BadStatusLine raised as expected -InvalidURL raised as expected -InvalidURL raised as expected -reply: 'HTTP/1.1 200 OK\r\n' -header: Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme" -header: Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme" -reply: 'HTTP/1.1 200 OK\r\n' -header: Content-Length: 14432 - diff --git a/sys/lib/python/test/output/test_linuxaudiodev b/sys/lib/python/test/output/test_linuxaudiodev deleted file mode 100644 index 3e8c69107..000000000 --- a/sys/lib/python/test/output/test_linuxaudiodev +++ /dev/null @@ -1,7 +0,0 @@ -test_linuxaudiodev -expected rate >= 0, not -1 -expected sample size >= 0, not -2 -nchannels must be 1 or 2, not 3 -unknown audio encoding: 177 -for linear unsigned 16-bit little-endian audio, expected sample size 16, not 8 -for linear unsigned 8-bit audio, expected sample size 8, not 16 diff --git a/sys/lib/python/test/output/test_logging b/sys/lib/python/test/output/test_logging deleted file mode 100644 index c0d6e0645..000000000 --- a/sys/lib/python/test/output/test_logging +++ /dev/null @@ -1,525 +0,0 @@ -test_logging --- log_test0 begin --------------------------------------------------- -CRITICAL:ERR:Message 0 -ERROR:ERR:Message 1 -CRITICAL:INF:Message 2 -ERROR:INF:Message 3 -WARNING:INF:Message 4 -INFO:INF:Message 5 -CRITICAL:INF.UNDEF:Message 6 -ERROR:INF.UNDEF:Message 7 -WARNING:INF.UNDEF:Message 8 -INFO:INF.UNDEF:Message 9 -CRITICAL:INF.ERR:Message 10 -ERROR:INF.ERR:Message 11 -CRITICAL:INF.ERR.UNDEF:Message 12 -ERROR:INF.ERR.UNDEF:Message 13 -CRITICAL:DEB:Message 14 -ERROR:DEB:Message 15 -WARNING:DEB:Message 16 -INFO:DEB:Message 17 -DEBUG:DEB:Message 18 -CRITICAL:UNDEF:Message 19 -ERROR:UNDEF:Message 20 -WARNING:UNDEF:Message 21 -INFO:UNDEF:Message 22 -CRITICAL:INF.BADPARENT.UNDEF:Message 23 -CRITICAL:INF.BADPARENT:Message 24 -INFO:INF:Finish up, it's closing time. Messages should bear numbers 0 through 24. --- log_test0 end --------------------------------------------------- --- log_test1 begin --------------------------------------------------- --- setting logging level to 'Boring' ----- -Boring:root:This should only be seen at the 'Boring' logging level (or lower) -Chatterbox:root:This should only be seen at the 'Chatterbox' logging level (or lower) -Garrulous:root:This should only be seen at the 'Garrulous' logging level (or lower) -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Chatterbox' ----- -Chatterbox:root:This should only be seen at the 'Chatterbox' logging level (or lower) -Garrulous:root:This should only be seen at the 'Garrulous' logging level (or lower) -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Garrulous' ----- -Garrulous:root:This should only be seen at the 'Garrulous' logging level (or lower) -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Talkative' ----- -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Verbose' ----- -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Sociable' ----- -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Effusive' ----- -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Terse' ----- -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Taciturn' ----- -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Silent' ----- -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- Filtering at handler level to SOCIABLE -- --- setting logging level to 'Boring' ----- -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Chatterbox' ----- -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Garrulous' ----- -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Talkative' ----- -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Verbose' ----- -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Sociable' ----- -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Effusive' ----- -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Terse' ----- -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Taciturn' ----- -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Silent' ----- -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- Filtering using GARRULOUS filter -- --- setting logging level to 'Boring' ----- -Boring:root:This should only be seen at the 'Boring' logging level (or lower) -Chatterbox:root:This should only be seen at the 'Chatterbox' logging level (or lower) -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Chatterbox' ----- -Chatterbox:root:This should only be seen at the 'Chatterbox' logging level (or lower) -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Garrulous' ----- -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Talkative' ----- -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Verbose' ----- -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Sociable' ----- -Sociable:root:This should only be seen at the 'Sociable' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Effusive' ----- -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Terse' ----- -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Taciturn' ----- -Taciturn:root:This should only be seen at the 'Taciturn' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Silent' ----- -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- Filtering using specific filter for SOCIABLE, TACITURN -- --- setting logging level to 'Boring' ----- -Boring:root:This should only be seen at the 'Boring' logging level (or lower) -Chatterbox:root:This should only be seen at the 'Chatterbox' logging level (or lower) -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Chatterbox' ----- -Chatterbox:root:This should only be seen at the 'Chatterbox' logging level (or lower) -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Garrulous' ----- -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Talkative' ----- -Talkative:root:This should only be seen at the 'Talkative' logging level (or lower) -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Verbose' ----- -Verbose:root:This should only be seen at the 'Verbose' logging level (or lower) -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Sociable' ----- -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Effusive' ----- -Effusive:root:This should only be seen at the 'Effusive' logging level (or lower) -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Terse' ----- -Terse:root:This should only be seen at the 'Terse' logging level (or lower) -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Taciturn' ----- -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- setting logging level to 'Silent' ----- -Silent:root:This should only be seen at the 'Silent' logging level (or lower) --- log_test1 end --------------------------------------------------- --- log_test2 begin --------------------------------------------------- --- logging at DEBUG, nothing should be seen yet -- --- logging at INFO, nothing should be seen yet -- --- logging at WARNING, 3 messages should be seen -- -DEBUG:root:Debug message -INFO:root:Info message -WARNING:root:Warn message --- logging 0 at INFO, messages should be seen every 10 events -- --- logging 1 at INFO, messages should be seen every 10 events -- --- logging 2 at INFO, messages should be seen every 10 events -- --- logging 3 at INFO, messages should be seen every 10 events -- --- logging 4 at INFO, messages should be seen every 10 events -- --- logging 5 at INFO, messages should be seen every 10 events -- --- logging 6 at INFO, messages should be seen every 10 events -- --- logging 7 at INFO, messages should be seen every 10 events -- --- logging 8 at INFO, messages should be seen every 10 events -- --- logging 9 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 0 -INFO:root:Info index = 1 -INFO:root:Info index = 2 -INFO:root:Info index = 3 -INFO:root:Info index = 4 -INFO:root:Info index = 5 -INFO:root:Info index = 6 -INFO:root:Info index = 7 -INFO:root:Info index = 8 -INFO:root:Info index = 9 --- logging 10 at INFO, messages should be seen every 10 events -- --- logging 11 at INFO, messages should be seen every 10 events -- --- logging 12 at INFO, messages should be seen every 10 events -- --- logging 13 at INFO, messages should be seen every 10 events -- --- logging 14 at INFO, messages should be seen every 10 events -- --- logging 15 at INFO, messages should be seen every 10 events -- --- logging 16 at INFO, messages should be seen every 10 events -- --- logging 17 at INFO, messages should be seen every 10 events -- --- logging 18 at INFO, messages should be seen every 10 events -- --- logging 19 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 10 -INFO:root:Info index = 11 -INFO:root:Info index = 12 -INFO:root:Info index = 13 -INFO:root:Info index = 14 -INFO:root:Info index = 15 -INFO:root:Info index = 16 -INFO:root:Info index = 17 -INFO:root:Info index = 18 -INFO:root:Info index = 19 --- logging 20 at INFO, messages should be seen every 10 events -- --- logging 21 at INFO, messages should be seen every 10 events -- --- logging 22 at INFO, messages should be seen every 10 events -- --- logging 23 at INFO, messages should be seen every 10 events -- --- logging 24 at INFO, messages should be seen every 10 events -- --- logging 25 at INFO, messages should be seen every 10 events -- --- logging 26 at INFO, messages should be seen every 10 events -- --- logging 27 at INFO, messages should be seen every 10 events -- --- logging 28 at INFO, messages should be seen every 10 events -- --- logging 29 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 20 -INFO:root:Info index = 21 -INFO:root:Info index = 22 -INFO:root:Info index = 23 -INFO:root:Info index = 24 -INFO:root:Info index = 25 -INFO:root:Info index = 26 -INFO:root:Info index = 27 -INFO:root:Info index = 28 -INFO:root:Info index = 29 --- logging 30 at INFO, messages should be seen every 10 events -- --- logging 31 at INFO, messages should be seen every 10 events -- --- logging 32 at INFO, messages should be seen every 10 events -- --- logging 33 at INFO, messages should be seen every 10 events -- --- logging 34 at INFO, messages should be seen every 10 events -- --- logging 35 at INFO, messages should be seen every 10 events -- --- logging 36 at INFO, messages should be seen every 10 events -- --- logging 37 at INFO, messages should be seen every 10 events -- --- logging 38 at INFO, messages should be seen every 10 events -- --- logging 39 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 30 -INFO:root:Info index = 31 -INFO:root:Info index = 32 -INFO:root:Info index = 33 -INFO:root:Info index = 34 -INFO:root:Info index = 35 -INFO:root:Info index = 36 -INFO:root:Info index = 37 -INFO:root:Info index = 38 -INFO:root:Info index = 39 --- logging 40 at INFO, messages should be seen every 10 events -- --- logging 41 at INFO, messages should be seen every 10 events -- --- logging 42 at INFO, messages should be seen every 10 events -- --- logging 43 at INFO, messages should be seen every 10 events -- --- logging 44 at INFO, messages should be seen every 10 events -- --- logging 45 at INFO, messages should be seen every 10 events -- --- logging 46 at INFO, messages should be seen every 10 events -- --- logging 47 at INFO, messages should be seen every 10 events -- --- logging 48 at INFO, messages should be seen every 10 events -- --- logging 49 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 40 -INFO:root:Info index = 41 -INFO:root:Info index = 42 -INFO:root:Info index = 43 -INFO:root:Info index = 44 -INFO:root:Info index = 45 -INFO:root:Info index = 46 -INFO:root:Info index = 47 -INFO:root:Info index = 48 -INFO:root:Info index = 49 --- logging 50 at INFO, messages should be seen every 10 events -- --- logging 51 at INFO, messages should be seen every 10 events -- --- logging 52 at INFO, messages should be seen every 10 events -- --- logging 53 at INFO, messages should be seen every 10 events -- --- logging 54 at INFO, messages should be seen every 10 events -- --- logging 55 at INFO, messages should be seen every 10 events -- --- logging 56 at INFO, messages should be seen every 10 events -- --- logging 57 at INFO, messages should be seen every 10 events -- --- logging 58 at INFO, messages should be seen every 10 events -- --- logging 59 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 50 -INFO:root:Info index = 51 -INFO:root:Info index = 52 -INFO:root:Info index = 53 -INFO:root:Info index = 54 -INFO:root:Info index = 55 -INFO:root:Info index = 56 -INFO:root:Info index = 57 -INFO:root:Info index = 58 -INFO:root:Info index = 59 --- logging 60 at INFO, messages should be seen every 10 events -- --- logging 61 at INFO, messages should be seen every 10 events -- --- logging 62 at INFO, messages should be seen every 10 events -- --- logging 63 at INFO, messages should be seen every 10 events -- --- logging 64 at INFO, messages should be seen every 10 events -- --- logging 65 at INFO, messages should be seen every 10 events -- --- logging 66 at INFO, messages should be seen every 10 events -- --- logging 67 at INFO, messages should be seen every 10 events -- --- logging 68 at INFO, messages should be seen every 10 events -- --- logging 69 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 60 -INFO:root:Info index = 61 -INFO:root:Info index = 62 -INFO:root:Info index = 63 -INFO:root:Info index = 64 -INFO:root:Info index = 65 -INFO:root:Info index = 66 -INFO:root:Info index = 67 -INFO:root:Info index = 68 -INFO:root:Info index = 69 --- logging 70 at INFO, messages should be seen every 10 events -- --- logging 71 at INFO, messages should be seen every 10 events -- --- logging 72 at INFO, messages should be seen every 10 events -- --- logging 73 at INFO, messages should be seen every 10 events -- --- logging 74 at INFO, messages should be seen every 10 events -- --- logging 75 at INFO, messages should be seen every 10 events -- --- logging 76 at INFO, messages should be seen every 10 events -- --- logging 77 at INFO, messages should be seen every 10 events -- --- logging 78 at INFO, messages should be seen every 10 events -- --- logging 79 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 70 -INFO:root:Info index = 71 -INFO:root:Info index = 72 -INFO:root:Info index = 73 -INFO:root:Info index = 74 -INFO:root:Info index = 75 -INFO:root:Info index = 76 -INFO:root:Info index = 77 -INFO:root:Info index = 78 -INFO:root:Info index = 79 --- logging 80 at INFO, messages should be seen every 10 events -- --- logging 81 at INFO, messages should be seen every 10 events -- --- logging 82 at INFO, messages should be seen every 10 events -- --- logging 83 at INFO, messages should be seen every 10 events -- --- logging 84 at INFO, messages should be seen every 10 events -- --- logging 85 at INFO, messages should be seen every 10 events -- --- logging 86 at INFO, messages should be seen every 10 events -- --- logging 87 at INFO, messages should be seen every 10 events -- --- logging 88 at INFO, messages should be seen every 10 events -- --- logging 89 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 80 -INFO:root:Info index = 81 -INFO:root:Info index = 82 -INFO:root:Info index = 83 -INFO:root:Info index = 84 -INFO:root:Info index = 85 -INFO:root:Info index = 86 -INFO:root:Info index = 87 -INFO:root:Info index = 88 -INFO:root:Info index = 89 --- logging 90 at INFO, messages should be seen every 10 events -- --- logging 91 at INFO, messages should be seen every 10 events -- --- logging 92 at INFO, messages should be seen every 10 events -- --- logging 93 at INFO, messages should be seen every 10 events -- --- logging 94 at INFO, messages should be seen every 10 events -- --- logging 95 at INFO, messages should be seen every 10 events -- --- logging 96 at INFO, messages should be seen every 10 events -- --- logging 97 at INFO, messages should be seen every 10 events -- --- logging 98 at INFO, messages should be seen every 10 events -- --- logging 99 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 90 -INFO:root:Info index = 91 -INFO:root:Info index = 92 -INFO:root:Info index = 93 -INFO:root:Info index = 94 -INFO:root:Info index = 95 -INFO:root:Info index = 96 -INFO:root:Info index = 97 -INFO:root:Info index = 98 -INFO:root:Info index = 99 --- logging 100 at INFO, messages should be seen every 10 events -- --- logging 101 at INFO, messages should be seen every 10 events -- -INFO:root:Info index = 100 -INFO:root:Info index = 101 --- log_test2 end --------------------------------------------------- --- log_test3 begin --------------------------------------------------- -Unfiltered... -INFO:a:Info 1 -INFO:a.b:Info 2 -INFO:a.c:Info 3 -INFO:a.b.c:Info 4 -INFO:a.b.c.d:Info 5 -INFO:a.bb.c:Info 6 -INFO:b:Info 7 -INFO:b.a:Info 8 -INFO:c.a.b:Info 9 -INFO:a.bb:Info 10 -Filtered with 'a.b'... -INFO:a.b:Info 2 -INFO:a.b.c:Info 4 -INFO:a.b.c.d:Info 5 --- log_test3 end --------------------------------------------------- --- log_test4 begin --------------------------------------------------- -config0: ok. -config1: ok. -config2: -config3: --- log_test4 end --------------------------------------------------- --- log_test5 begin --------------------------------------------------- -ERROR:root:just testing -... Don't panic! --- log_test5 end --------------------------------------------------- --- logrecv output begin --------------------------------------------------- -ERR -> CRITICAL: Message 0 (via logrecv.tcp.ERR) -ERR -> ERROR: Message 1 (via logrecv.tcp.ERR) -INF -> CRITICAL: Message 2 (via logrecv.tcp.INF) -INF -> ERROR: Message 3 (via logrecv.tcp.INF) -INF -> WARNING: Message 4 (via logrecv.tcp.INF) -INF -> INFO: Message 5 (via logrecv.tcp.INF) -INF.UNDEF -> CRITICAL: Message 6 (via logrecv.tcp.INF.UNDEF) -INF.UNDEF -> ERROR: Message 7 (via logrecv.tcp.INF.UNDEF) -INF.UNDEF -> WARNING: Message 8 (via logrecv.tcp.INF.UNDEF) -INF.UNDEF -> INFO: Message 9 (via logrecv.tcp.INF.UNDEF) -INF.ERR -> CRITICAL: Message 10 (via logrecv.tcp.INF.ERR) -INF.ERR -> ERROR: Message 11 (via logrecv.tcp.INF.ERR) -INF.ERR.UNDEF -> CRITICAL: Message 12 (via logrecv.tcp.INF.ERR.UNDEF) -INF.ERR.UNDEF -> ERROR: Message 13 (via logrecv.tcp.INF.ERR.UNDEF) -DEB -> CRITICAL: Message 14 (via logrecv.tcp.DEB) -DEB -> ERROR: Message 15 (via logrecv.tcp.DEB) -DEB -> WARNING: Message 16 (via logrecv.tcp.DEB) -DEB -> INFO: Message 17 (via logrecv.tcp.DEB) -DEB -> DEBUG: Message 18 (via logrecv.tcp.DEB) -UNDEF -> CRITICAL: Message 19 (via logrecv.tcp.UNDEF) -UNDEF -> ERROR: Message 20 (via logrecv.tcp.UNDEF) -UNDEF -> WARNING: Message 21 (via logrecv.tcp.UNDEF) -UNDEF -> INFO: Message 22 (via logrecv.tcp.UNDEF) -INF.BADPARENT.UNDEF -> CRITICAL: Message 23 (via logrecv.tcp.INF.BADPARENT.UNDEF) -INF.BADPARENT -> CRITICAL: Message 24 (via logrecv.tcp.INF.BADPARENT) -INF -> INFO: Finish up, it's closing time. Messages should bear numbers 0 through 24. (via logrecv.tcp.INF) --- logrecv output end --------------------------------------------------- diff --git a/sys/lib/python/test/output/test_math b/sys/lib/python/test/output/test_math deleted file mode 100644 index 4c8f77c95..000000000 --- a/sys/lib/python/test/output/test_math +++ /dev/null @@ -1,28 +0,0 @@ -test_math -math module, testing with eps 1e-05 -constants -acos -asin -atan -atan2 -ceil -cos -cosh -degrees -exp -fabs -floor -fmod -frexp -hypot -ldexp -log -log10 -modf -pow -radians -sin -sinh -sqrt -tan -tanh diff --git a/sys/lib/python/test/output/test_mmap b/sys/lib/python/test/output/test_mmap deleted file mode 100644 index 605f840f5..000000000 --- a/sys/lib/python/test/output/test_mmap +++ /dev/null @@ -1,38 +0,0 @@ -test_mmap - - Position of foo: 1.0 pages - Length of file: 2.0 pages - Contents of byte 0: '\x00' - Contents of first 3 bytes: '\x00\x00\x00' - - Modifying file's content... - Contents of byte 0: '3' - Contents of first 3 bytes: '3\x00\x00' - Contents of second page: '\x00foobar\x00' - Regex match on mmap (page start, length of match): 1.0 6 - Seek to zeroth byte - Seek to 42nd byte - Seek to last byte - Try to seek to negative position... - Try to seek beyond end of mmap... - Try to seek to negative position... - Attempting resize() - Creating 10 byte test data file. - Opening mmap with access=ACCESS_READ - Ensuring that readonly mmap can't be slice assigned. - Ensuring that readonly mmap can't be item assigned. - Ensuring that readonly mmap can't be write() to. - Ensuring that readonly mmap can't be write_byte() to. - Ensuring that readonly mmap can't be resized. - Opening mmap with size too big - Opening mmap with access=ACCESS_WRITE - Modifying write-through memory map. - Opening mmap with access=ACCESS_COPY - Modifying copy-on-write memory map. - Ensuring copy-on-write maps cannot be resized. - Ensuring invalid access parameter raises exception. - Try opening a bad file descriptor... - Ensuring that passing 0 as map length sets map size to current file size. - Ensuring that passing 0 as map length sets map size to current file size. - anonymous mmap.mmap(-1, PAGESIZE)... - Test passed diff --git a/sys/lib/python/test/output/test_new b/sys/lib/python/test/output/test_new deleted file mode 100644 index b7f2ed97f..000000000 --- a/sys/lib/python/test/output/test_new +++ /dev/null @@ -1,7 +0,0 @@ -test_new -new.module() -new.classobj() -new.instance() -new.instancemethod() -new.function() -new.code() diff --git a/sys/lib/python/test/output/test_nis b/sys/lib/python/test/output/test_nis deleted file mode 100644 index 0853ab477..000000000 --- a/sys/lib/python/test/output/test_nis +++ /dev/null @@ -1,2 +0,0 @@ -test_nis -nis.maps() diff --git a/sys/lib/python/test/output/test_opcodes b/sys/lib/python/test/output/test_opcodes deleted file mode 100644 index 4685571b4..000000000 --- a/sys/lib/python/test/output/test_opcodes +++ /dev/null @@ -1,6 +0,0 @@ -test_opcodes -2. Opcodes -XXX Not yet fully implemented -2.1 try inside for loop -2.2 raise class exceptions -2.3 comparing function objects diff --git a/sys/lib/python/test/output/test_openpty b/sys/lib/python/test/output/test_openpty deleted file mode 100644 index a8b8b5eeb..000000000 --- a/sys/lib/python/test/output/test_openpty +++ /dev/null @@ -1,2 +0,0 @@ -test_openpty -Ping! diff --git a/sys/lib/python/test/output/test_operations b/sys/lib/python/test/output/test_operations deleted file mode 100644 index 8a1bc2a22..000000000 --- a/sys/lib/python/test/output/test_operations +++ /dev/null @@ -1,21 +0,0 @@ -test_operations -3. Operations -XXX Mostly not yet implemented -3.1 Dictionary lookups fail if __cmp__() raises an exception -raising error -d[x2] = 2: caught the RuntimeError outside -raising error -z = d[x2]: caught the RuntimeError outside -raising error -x2 in d: caught the RuntimeError outside -raising error -d.has_key(x2): caught the RuntimeError outside -raising error -d.get(x2): caught the RuntimeError outside -raising error -d.setdefault(x2, 42): caught the RuntimeError outside -raising error -d.pop(x2): caught the RuntimeError outside -raising error -d.update({x2: 2}): caught the RuntimeError outside -resize bugs not triggered. diff --git a/sys/lib/python/test/output/test_ossaudiodev b/sys/lib/python/test/output/test_ossaudiodev deleted file mode 100644 index f0df5d2f6..000000000 --- a/sys/lib/python/test/output/test_ossaudiodev +++ /dev/null @@ -1,2 +0,0 @@ -test_ossaudiodev -playing test sound file (expected running time: 2.93 sec) diff --git a/sys/lib/python/test/output/test_pep277 b/sys/lib/python/test/output/test_pep277 deleted file mode 100644 index 75e50271c..000000000 --- a/sys/lib/python/test/output/test_pep277 +++ /dev/null @@ -1,3 +0,0 @@ -test_pep277 -u'\xdf-\u66e8\u66e9\u66eb' -[u'Gr\xfc\xdf-Gott', u'abc', u'ascii', u'\u0393\u03b5\u03b9\u03ac-\u03c3\u03b1\u03c2', u'\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435', u'\u05d4\u05e9\u05e7\u05e6\u05e5\u05e1', u'\u306b\u307d\u3093', u'\u66e8\u05e9\u3093\u0434\u0393\xdf', u'\u66e8\u66e9\u66eb'] diff --git a/sys/lib/python/test/output/test_pkg b/sys/lib/python/test/output/test_pkg deleted file mode 100644 index 8a5ab8de1..000000000 --- a/sys/lib/python/test/output/test_pkg +++ /dev/null @@ -1,45 +0,0 @@ -test_pkg -running test t1 -running test t2 -t2 loading -doc for t2 -t2.sub.subsub loading -t2 t2.sub t2.sub.subsub -['sub', 't2'] -t2.sub t2.sub.subsub -t2.sub.subsub -['spam', 'sub', 'subsub', 't2'] -t2 t2.sub t2.sub.subsub -['spam', 'sub', 'subsub', 't2'] -running test t3 -t3 loading -t3.sub.subsub loading -t3 t3.sub t3.sub.subsub -t3 loading -t3.sub.subsub loading -running test t4 -t4 loading -t4.sub.subsub loading -t4.sub.subsub.spam = 1 -running test t5 -t5.foo loading -t5.string loading -1 -['foo', 'string', 't5'] -['__doc__', '__file__', '__name__', '__path__', 'foo', 'string', 't5'] -['__doc__', '__file__', '__name__', 'string'] -['__doc__', '__file__', '__name__', 'spam'] -running test t6 -['__all__', '__doc__', '__file__', '__name__', '__path__'] -t6.spam loading -t6.ham loading -t6.eggs loading -['__all__', '__doc__', '__file__', '__name__', '__path__', 'eggs', 'ham', 'spam'] -['eggs', 'ham', 'spam', 't6'] -running test t7 -t7 loading -['__doc__', '__file__', '__name__', '__path__'] -['__doc__', '__file__', '__name__', '__path__'] -t7.sub.subsub loading -['__doc__', '__file__', '__name__', '__path__', 'spam'] -t7.sub.subsub.spam = 1 diff --git a/sys/lib/python/test/output/test_poll b/sys/lib/python/test/output/test_poll deleted file mode 100644 index ca61d377d..000000000 --- a/sys/lib/python/test/output/test_poll +++ /dev/null @@ -1,19 +0,0 @@ -test_poll -Running poll test 1 - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. -Poll test 1 complete -Running poll test 2 -Poll test 2 complete -Running poll test 3 -Poll test 3 complete diff --git a/sys/lib/python/test/output/test_popen b/sys/lib/python/test/output/test_popen deleted file mode 100644 index db2ac06d0..000000000 --- a/sys/lib/python/test/output/test_popen +++ /dev/null @@ -1,3 +0,0 @@ -test_popen -Test popen: -popen seemed to process the command-line correctly diff --git a/sys/lib/python/test/output/test_popen2 b/sys/lib/python/test/output/test_popen2 deleted file mode 100644 index a66cde934..000000000 --- a/sys/lib/python/test/output/test_popen2 +++ /dev/null @@ -1,9 +0,0 @@ -test_popen2 -Test popen2 module: -testing popen2... -testing popen3... -All OK -Testing os module: -testing popen2... -testing popen3... -All OK diff --git a/sys/lib/python/test/output/test_profile b/sys/lib/python/test/output/test_profile deleted file mode 100644 index 96bd77f68..000000000 --- a/sys/lib/python/test/output/test_profile +++ /dev/null @@ -1,84 +0,0 @@ -test_profile - 127 function calls (107 primitive calls) in 1.000 CPU seconds - - Ordered by: standard name - - ncalls tottime percall cumtime percall filename:lineno(function) - 4 0.000 0.000 0.000 0.000 :0(append) - 4 0.000 0.000 0.000 0.000 :0(exc_info) - 12 0.000 0.000 0.012 0.001 :0(hasattr) - 8 0.000 0.000 0.000 0.000 :0(range) - 1 0.000 0.000 0.000 0.000 :0(setprofile) - 1 0.000 0.000 1.000 1.000 :1() - 0 0.000 0.000 profile:0(profiler) - 1 0.000 0.000 1.000 1.000 profile:0(testfunc()) - 8 0.064 0.008 0.080 0.010 test_profile.py:103(subhelper) - 28 0.028 0.001 0.028 0.001 test_profile.py:115(__getattr__) - 1 0.270 0.270 1.000 1.000 test_profile.py:30(testfunc) - 23/3 0.150 0.007 0.170 0.057 test_profile.py:40(factorial) - 20 0.020 0.001 0.020 0.001 test_profile.py:53(mul) - 2 0.040 0.020 0.600 0.300 test_profile.py:60(helper) - 4 0.116 0.029 0.120 0.030 test_profile.py:78(helper1) - 2 0.000 0.000 0.140 0.070 test_profile.py:89(helper2_indirect) - 8 0.312 0.039 0.400 0.050 test_profile.py:93(helper2) - - - Ordered by: standard name - -Function called... -:0(append) -> -:0(exc_info) -> -:0(hasattr) -> test_profile.py:115(__getattr__)(12) 0.028 -:0(range) -> -:0(setprofile) -> -:1() -> test_profile.py:30(testfunc)(1) 1.000 -profile:0(profiler) -> profile:0(testfunc())(1) 1.000 -profile:0(testfunc()) -> :0(setprofile)(1) 0.000 - :1()(1) 1.000 -test_profile.py:103(subhelper) -> :0(range)(8) 0.000 - test_profile.py:115(__getattr__)(16) 0.028 -test_profile.py:115(__getattr__) -> -test_profile.py:30(testfunc) -> test_profile.py:40(factorial)(1) 0.170 - test_profile.py:60(helper)(2) 0.600 -test_profile.py:40(factorial) -> test_profile.py:40(factorial)(20) 0.170 - test_profile.py:53(mul)(20) 0.020 -test_profile.py:53(mul) -> -test_profile.py:60(helper) -> test_profile.py:78(helper1)(4) 0.120 - test_profile.py:89(helper2_indirect)(2) 0.140 - test_profile.py:93(helper2)(6) 0.400 -test_profile.py:78(helper1) -> :0(append)(4) 0.000 - :0(exc_info)(4) 0.000 - :0(hasattr)(4) 0.012 -test_profile.py:89(helper2_indirect) -> test_profile.py:40(factorial)(2) 0.170 - test_profile.py:93(helper2)(2) 0.400 -test_profile.py:93(helper2) -> :0(hasattr)(8) 0.012 - test_profile.py:103(subhelper)(8) 0.080 - - - Ordered by: standard name - -Function was called by... -:0(append) <- test_profile.py:78(helper1)(4) 0.120 -:0(exc_info) <- test_profile.py:78(helper1)(4) 0.120 -:0(hasattr) <- test_profile.py:78(helper1)(4) 0.120 - test_profile.py:93(helper2)(8) 0.400 -:0(range) <- test_profile.py:103(subhelper)(8) 0.080 -:0(setprofile) <- profile:0(testfunc())(1) 1.000 -:1() <- profile:0(testfunc())(1) 1.000 -profile:0(profiler) <- -profile:0(testfunc()) <- profile:0(profiler)(1) 0.000 -test_profile.py:103(subhelper) <- test_profile.py:93(helper2)(8) 0.400 -test_profile.py:115(__getattr__) <- :0(hasattr)(12) 0.012 - test_profile.py:103(subhelper)(16) 0.080 -test_profile.py:30(testfunc) <- :1()(1) 1.000 -test_profile.py:40(factorial) <- test_profile.py:30(testfunc)(1) 1.000 - test_profile.py:40(factorial)(20) 0.170 - test_profile.py:89(helper2_indirect)(2) 0.140 -test_profile.py:53(mul) <- test_profile.py:40(factorial)(20) 0.170 -test_profile.py:60(helper) <- test_profile.py:30(testfunc)(2) 1.000 -test_profile.py:78(helper1) <- test_profile.py:60(helper)(4) 0.600 -test_profile.py:89(helper2_indirect) <- test_profile.py:60(helper)(2) 0.600 -test_profile.py:93(helper2) <- test_profile.py:60(helper)(6) 0.600 - test_profile.py:89(helper2_indirect)(2) 0.140 - - diff --git a/sys/lib/python/test/output/test_pty b/sys/lib/python/test/output/test_pty deleted file mode 100644 index b6e0e32ac..000000000 --- a/sys/lib/python/test/output/test_pty +++ /dev/null @@ -1,3 +0,0 @@ -test_pty -I wish to buy a fish license. -For my pet fish, Eric. diff --git a/sys/lib/python/test/output/test_pyexpat b/sys/lib/python/test/output/test_pyexpat deleted file mode 100644 index 61fe81d63..000000000 --- a/sys/lib/python/test/output/test_pyexpat +++ /dev/null @@ -1,110 +0,0 @@ -test_pyexpat -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -PI: - 'xml-stylesheet' 'href="stylesheet.css"' -Comment: - ' comment data ' -Notation declared: ('notation', None, 'notation.jpeg', None) -Unparsed entity decl: - ('unparsed_entity', None, 'entity.file', None, 'notation') -Start element: - 'root' {'attr1': 'value1', 'attr2': 'value2\xe1\xbd\x80'} -NS decl: - 'myns' 'http://www.python.org/namespace' -Start element: - 'http://www.python.org/namespace!subelement' {} -Character data: - 'Contents of subelements' -End element: - 'http://www.python.org/namespace!subelement' -End of NS decl: - 'myns' -Start element: - 'sub2' {} -Start of CDATA section -Character data: - 'contents of CDATA section' -End of CDATA section -End element: - 'sub2' -External entity ref: (None, 'entity.file', None) -End element: - 'root' -PI: - u'xml-stylesheet' u'href="stylesheet.css"' -Comment: - u' comment data ' -Notation declared: (u'notation', None, u'notation.jpeg', None) -Unparsed entity decl: - (u'unparsed_entity', None, u'entity.file', None, u'notation') -Start element: - u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'} -NS decl: - u'myns' u'http://www.python.org/namespace' -Start element: - u'http://www.python.org/namespace!subelement' {} -Character data: - u'Contents of subelements' -End element: - u'http://www.python.org/namespace!subelement' -End of NS decl: - u'myns' -Start element: - u'sub2' {} -Start of CDATA section -Character data: - u'contents of CDATA section' -End of CDATA section -End element: - u'sub2' -External entity ref: (None, u'entity.file', None) -End element: - u'root' -PI: - u'xml-stylesheet' u'href="stylesheet.css"' -Comment: - u' comment data ' -Notation declared: (u'notation', None, u'notation.jpeg', None) -Unparsed entity decl: - (u'unparsed_entity', None, u'entity.file', None, u'notation') -Start element: - u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'} -NS decl: - u'myns' u'http://www.python.org/namespace' -Start element: - u'http://www.python.org/namespace!subelement' {} -Character data: - u'Contents of subelements' -End element: - u'http://www.python.org/namespace!subelement' -End of NS decl: - u'myns' -Start element: - u'sub2' {} -Start of CDATA section -Character data: - u'contents of CDATA section' -End of CDATA section -End element: - u'sub2' -External entity ref: (None, u'entity.file', None) -End element: - u'root' - -Testing constructor for proper handling of namespace_separator values: -Legal values tested o.k. -Caught expected TypeError: -ParserCreate() argument 2 must be string or None, not int -Caught expected ValueError: -namespace_separator must be at most one character, omitted, or None diff --git a/sys/lib/python/test/output/test_regex b/sys/lib/python/test/output/test_regex deleted file mode 100644 index 1deb26fe4..000000000 --- a/sys/lib/python/test/output/test_regex +++ /dev/null @@ -1,29 +0,0 @@ -test_regex -no match: -1 -successful search: 6 -caught expected exception -failed awk syntax: -1 -successful awk syntax: 2 -failed awk syntax: -1 -matching with group names and compile() --1 -caught expected exception -matching with group names and symcomp() -7 -801 999 -801 -('801', '999') -('801', '999') -realpat: \([0-9]+\) *\([0-9]+\) -groupindex: {'one': 1, 'two': 2} -not case folded search: -1 -case folded search: 6 -__members__: ['last', 'regs', 'translate', 'groupindex', 'realpat', 'givenpat'] -regs: ((6, 11), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1)) -last: HELLO WORLD -translate: 256 -givenpat: world -match with pos: -1 -search with pos: 18 -bogus group: ('world', None, None) -no name: caught expected exception diff --git a/sys/lib/python/test/output/test_resource b/sys/lib/python/test/output/test_resource deleted file mode 100644 index aafed8330..000000000 --- a/sys/lib/python/test/output/test_resource +++ /dev/null @@ -1,2 +0,0 @@ -test_resource -True diff --git a/sys/lib/python/test/output/test_rgbimg b/sys/lib/python/test/output/test_rgbimg deleted file mode 100644 index 8244b3bbc..000000000 --- a/sys/lib/python/test/output/test_rgbimg +++ /dev/null @@ -1,2 +0,0 @@ -test_rgbimg -RGBimg test suite: diff --git a/sys/lib/python/test/output/test_scope b/sys/lib/python/test/output/test_scope deleted file mode 100644 index a439e441e..000000000 --- a/sys/lib/python/test/output/test_scope +++ /dev/null @@ -1,24 +0,0 @@ -test_scope -1. simple nesting -2. extra nesting -3. simple nesting + rebinding -4. nesting with global but no free -5. nesting through class -6. nesting plus free ref to global -7. nearest enclosing scope -8. mixed freevars and cellvars -9. free variable in method -10. recursion -11. unoptimized namespaces -12. lambdas -13. UnboundLocal -14. complex definitions -15. scope of global statements -16. check leaks -17. class and global -18. verify that locals() works -19. var is bound and free in class -20. interaction with trace function -20. eval and exec with free variables -21. list comprehension with local variables -22. eval with free variables diff --git a/sys/lib/python/test/output/test_signal b/sys/lib/python/test/output/test_signal deleted file mode 100644 index aa6468910..000000000 --- a/sys/lib/python/test/output/test_signal +++ /dev/null @@ -1,2 +0,0 @@ -test_signal -starting pause() loop... diff --git a/sys/lib/python/test/output/test_thread b/sys/lib/python/test/output/test_thread deleted file mode 100644 index 68c6a92da..000000000 --- a/sys/lib/python/test/output/test_thread +++ /dev/null @@ -1,18 +0,0 @@ -test_thread -waiting for all tasks to complete -all tasks done - -*** Barrier Test *** -all tasks done - -*** Changing thread stack size *** -caught expected ValueError setting stack_size(4096) -successfully set stack_size(262144) -successfully set stack_size(1048576) -successfully set stack_size(0) -trying stack_size = 262144 -waiting for all tasks to complete -all tasks done -trying stack_size = 1048576 -waiting for all tasks to complete -all tasks done diff --git a/sys/lib/python/test/output/test_threadedtempfile b/sys/lib/python/test/output/test_threadedtempfile deleted file mode 100644 index 2552877a3..000000000 --- a/sys/lib/python/test/output/test_threadedtempfile +++ /dev/null @@ -1,5 +0,0 @@ -test_threadedtempfile -Creating -Starting -Reaping -Done: errors 0 ok 1000 diff --git a/sys/lib/python/test/output/test_tokenize b/sys/lib/python/test/output/test_tokenize deleted file mode 100644 index b78a22347..000000000 --- a/sys/lib/python/test/output/test_tokenize +++ /dev/null @@ -1,659 +0,0 @@ -test_tokenize -1,0-1,35: COMMENT "# Tests for the 'tokenize' module.\n" -2,0-2,43: COMMENT '# Large bits stolen from test_grammar.py. \n' -3,0-3,1: NL '\n' -4,0-4,11: COMMENT '# Comments\n' -5,0-5,3: STRING '"#"' -5,3-5,4: NEWLINE '\n' -6,0-6,3: COMMENT "#'\n" -7,0-7,3: COMMENT '#"\n' -8,0-8,3: COMMENT '#\\\n' -9,7-9,9: COMMENT '#\n' -10,4-10,10: COMMENT '# abc\n' -11,0-12,4: STRING "'''#\n#'''" -12,4-12,5: NEWLINE '\n' -13,0-13,1: NL '\n' -14,0-14,1: NAME 'x' -14,2-14,3: OP '=' -14,4-14,5: NUMBER '1' -14,7-14,8: COMMENT '#' -14,8-14,9: NEWLINE '\n' -15,0-15,1: NL '\n' -16,0-16,25: COMMENT '# Balancing continuation\n' -17,0-17,1: NL '\n' -18,0-18,1: NAME 'a' -18,2-18,3: OP '=' -18,4-18,5: OP '(' -18,5-18,6: NUMBER '3' -18,6-18,7: OP ',' -18,8-18,9: NUMBER '4' -18,9-18,10: OP ',' -18,10-18,11: NL '\n' -19,2-19,3: NUMBER '5' -19,3-19,4: OP ',' -19,5-19,6: NUMBER '6' -19,6-19,7: OP ')' -19,7-19,8: NEWLINE '\n' -20,0-20,1: NAME 'y' -20,2-20,3: OP '=' -20,4-20,5: OP '[' -20,5-20,6: NUMBER '3' -20,6-20,7: OP ',' -20,8-20,9: NUMBER '4' -20,9-20,10: OP ',' -20,10-20,11: NL '\n' -21,2-21,3: NUMBER '5' -21,3-21,4: OP ']' -21,4-21,5: NEWLINE '\n' -22,0-22,1: NAME 'z' -22,2-22,3: OP '=' -22,4-22,5: OP '{' -22,5-22,8: STRING "'a'" -22,8-22,9: OP ':' -22,9-22,10: NUMBER '5' -22,10-22,11: OP ',' -22,11-22,12: NL '\n' -23,2-23,5: STRING "'b'" -23,5-23,6: OP ':' -23,6-23,7: NUMBER '6' -23,7-23,8: OP '}' -23,8-23,9: NEWLINE '\n' -24,0-24,1: NAME 'x' -24,2-24,3: OP '=' -24,4-24,5: OP '(' -24,5-24,8: NAME 'len' -24,8-24,9: OP '(' -24,9-24,10: OP '`' -24,10-24,11: NAME 'y' -24,11-24,12: OP '`' -24,12-24,13: OP ')' -24,14-24,15: OP '+' -24,16-24,17: NUMBER '5' -24,17-24,18: OP '*' -24,18-24,19: NAME 'x' -24,20-24,21: OP '-' -24,22-24,23: NAME 'a' -24,23-24,24: OP '[' -24,24-24,25: NL '\n' -25,3-25,4: NUMBER '3' -25,5-25,6: OP ']' -25,6-25,7: NL '\n' -26,3-26,4: OP '-' -26,5-26,6: NAME 'x' -26,7-26,8: OP '+' -26,9-26,12: NAME 'len' -26,12-26,13: OP '(' -26,13-26,14: OP '{' -26,14-26,15: NL '\n' -27,3-27,4: OP '}' -27,4-27,5: NL '\n' -28,4-28,5: OP ')' -28,5-28,6: NL '\n' -29,2-29,3: OP ')' -29,3-29,4: NEWLINE '\n' -30,0-30,1: NL '\n' -31,0-31,37: COMMENT '# Backslash means line continuation:\n' -32,0-32,1: NAME 'x' -32,2-32,3: OP '=' -32,4-32,5: NUMBER '1' -33,0-33,1: OP '+' -33,2-33,3: NUMBER '1' -33,3-33,4: NEWLINE '\n' -34,0-34,1: NL '\n' -35,0-35,55: COMMENT '# Backslash does not means continuation in comments :\\\n' -36,0-36,1: NAME 'x' -36,2-36,3: OP '=' -36,4-36,5: NUMBER '0' -36,5-36,6: NEWLINE '\n' -37,0-37,1: NL '\n' -38,0-38,20: COMMENT '# Ordinary integers\n' -39,0-39,4: NUMBER '0xff' -39,5-39,7: OP '<>' -39,8-39,11: NUMBER '255' -39,11-39,12: NEWLINE '\n' -40,0-40,4: NUMBER '0377' -40,5-40,7: OP '<>' -40,8-40,11: NUMBER '255' -40,11-40,12: NEWLINE '\n' -41,0-41,10: NUMBER '2147483647' -41,13-41,15: OP '!=' -41,16-41,28: NUMBER '017777777777' -41,28-41,29: NEWLINE '\n' -42,0-42,1: OP '-' -42,1-42,11: NUMBER '2147483647' -42,11-42,12: OP '-' -42,12-42,13: NUMBER '1' -42,14-42,16: OP '!=' -42,17-42,29: NUMBER '020000000000' -42,29-42,30: NEWLINE '\n' -43,0-43,12: NUMBER '037777777777' -43,13-43,15: OP '!=' -43,16-43,17: OP '-' -43,17-43,18: NUMBER '1' -43,18-43,19: NEWLINE '\n' -44,0-44,10: NUMBER '0xffffffff' -44,11-44,13: OP '!=' -44,14-44,15: OP '-' -44,15-44,16: NUMBER '1' -44,16-44,17: NEWLINE '\n' -45,0-45,1: NL '\n' -46,0-46,16: COMMENT '# Long integers\n' -47,0-47,1: NAME 'x' -47,2-47,3: OP '=' -47,4-47,6: NUMBER '0L' -47,6-47,7: NEWLINE '\n' -48,0-48,1: NAME 'x' -48,2-48,3: OP '=' -48,4-48,6: NUMBER '0l' -48,6-48,7: NEWLINE '\n' -49,0-49,1: NAME 'x' -49,2-49,3: OP '=' -49,4-49,23: NUMBER '0xffffffffffffffffL' -49,23-49,24: NEWLINE '\n' -50,0-50,1: NAME 'x' -50,2-50,3: OP '=' -50,4-50,23: NUMBER '0xffffffffffffffffl' -50,23-50,24: NEWLINE '\n' -51,0-51,1: NAME 'x' -51,2-51,3: OP '=' -51,4-51,23: NUMBER '077777777777777777L' -51,23-51,24: NEWLINE '\n' -52,0-52,1: NAME 'x' -52,2-52,3: OP '=' -52,4-52,23: NUMBER '077777777777777777l' -52,23-52,24: NEWLINE '\n' -53,0-53,1: NAME 'x' -53,2-53,3: OP '=' -53,4-53,35: NUMBER '123456789012345678901234567890L' -53,35-53,36: NEWLINE '\n' -54,0-54,1: NAME 'x' -54,2-54,3: OP '=' -54,4-54,35: NUMBER '123456789012345678901234567890l' -54,35-54,36: NEWLINE '\n' -55,0-55,1: NL '\n' -56,0-56,25: COMMENT '# Floating-point numbers\n' -57,0-57,1: NAME 'x' -57,2-57,3: OP '=' -57,4-57,8: NUMBER '3.14' -57,8-57,9: NEWLINE '\n' -58,0-58,1: NAME 'x' -58,2-58,3: OP '=' -58,4-58,8: NUMBER '314.' -58,8-58,9: NEWLINE '\n' -59,0-59,1: NAME 'x' -59,2-59,3: OP '=' -59,4-59,9: NUMBER '0.314' -59,9-59,10: NEWLINE '\n' -60,0-60,18: COMMENT '# XXX x = 000.314\n' -61,0-61,1: NAME 'x' -61,2-61,3: OP '=' -61,4-61,8: NUMBER '.314' -61,8-61,9: NEWLINE '\n' -62,0-62,1: NAME 'x' -62,2-62,3: OP '=' -62,4-62,8: NUMBER '3e14' -62,8-62,9: NEWLINE '\n' -63,0-63,1: NAME 'x' -63,2-63,3: OP '=' -63,4-63,8: NUMBER '3E14' -63,8-63,9: NEWLINE '\n' -64,0-64,1: NAME 'x' -64,2-64,3: OP '=' -64,4-64,9: NUMBER '3e-14' -64,9-64,10: NEWLINE '\n' -65,0-65,1: NAME 'x' -65,2-65,3: OP '=' -65,4-65,9: NUMBER '3e+14' -65,9-65,10: NEWLINE '\n' -66,0-66,1: NAME 'x' -66,2-66,3: OP '=' -66,4-66,9: NUMBER '3.e14' -66,9-66,10: NEWLINE '\n' -67,0-67,1: NAME 'x' -67,2-67,3: OP '=' -67,4-67,9: NUMBER '.3e14' -67,9-67,10: NEWLINE '\n' -68,0-68,1: NAME 'x' -68,2-68,3: OP '=' -68,4-68,9: NUMBER '3.1e4' -68,9-68,10: NEWLINE '\n' -69,0-69,1: NL '\n' -70,0-70,18: COMMENT '# String literals\n' -71,0-71,1: NAME 'x' -71,2-71,3: OP '=' -71,4-71,6: STRING "''" -71,6-71,7: OP ';' -71,8-71,9: NAME 'y' -71,10-71,11: OP '=' -71,12-71,14: STRING '""' -71,14-71,15: OP ';' -71,15-71,16: NEWLINE '\n' -72,0-72,1: NAME 'x' -72,2-72,3: OP '=' -72,4-72,8: STRING "'\\''" -72,8-72,9: OP ';' -72,10-72,11: NAME 'y' -72,12-72,13: OP '=' -72,14-72,17: STRING '"\'"' -72,17-72,18: OP ';' -72,18-72,19: NEWLINE '\n' -73,0-73,1: NAME 'x' -73,2-73,3: OP '=' -73,4-73,7: STRING '\'"\'' -73,7-73,8: OP ';' -73,9-73,10: NAME 'y' -73,11-73,12: OP '=' -73,13-73,17: STRING '"\\""' -73,17-73,18: OP ';' -73,18-73,19: NEWLINE '\n' -74,0-74,1: NAME 'x' -74,2-74,3: OP '=' -74,4-74,32: STRING '"doesn\'t \\"shrink\\" does it"' -74,32-74,33: NEWLINE '\n' -75,0-75,1: NAME 'y' -75,2-75,3: OP '=' -75,4-75,31: STRING '\'doesn\\\'t "shrink" does it\'' -75,31-75,32: NEWLINE '\n' -76,0-76,1: NAME 'x' -76,2-76,3: OP '=' -76,4-76,32: STRING '"does \\"shrink\\" doesn\'t it"' -76,32-76,33: NEWLINE '\n' -77,0-77,1: NAME 'y' -77,2-77,3: OP '=' -77,4-77,31: STRING '\'does "shrink" doesn\\\'t it\'' -77,31-77,32: NEWLINE '\n' -78,0-78,1: NAME 'x' -78,2-78,3: OP '=' -78,4-83,3: STRING '"""\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n"""' -83,3-83,4: NEWLINE '\n' -84,0-84,1: NAME 'y' -84,2-84,3: OP '=' -84,4-84,63: STRING '\'\\nThe "quick"\\nbrown fox\\njumps over\\nthe \\\'lazy\\\' dog.\\n\'' -84,63-84,64: NEWLINE '\n' -85,0-85,1: NAME 'y' -85,2-85,3: OP '=' -85,4-90,3: STRING '\'\'\'\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n\'\'\'' -90,3-90,4: OP ';' -90,4-90,5: NEWLINE '\n' -91,0-91,1: NAME 'y' -91,2-91,3: OP '=' -91,4-96,1: STRING '"\\n\\\nThe \\"quick\\"\\n\\\nbrown fox\\n\\\njumps over\\n\\\nthe \'lazy\' dog.\\n\\\n"' -96,1-96,2: OP ';' -96,2-96,3: NEWLINE '\n' -97,0-97,1: NAME 'y' -97,2-97,3: OP '=' -97,4-102,1: STRING '\'\\n\\\nThe \\"quick\\"\\n\\\nbrown fox\\n\\\njumps over\\n\\\nthe \\\'lazy\\\' dog.\\n\\\n\'' -102,1-102,2: OP ';' -102,2-102,3: NEWLINE '\n' -103,0-103,1: NAME 'x' -103,2-103,3: OP '=' -103,4-103,9: STRING "r'\\\\'" -103,10-103,11: OP '+' -103,12-103,17: STRING "R'\\\\'" -103,17-103,18: NEWLINE '\n' -104,0-104,1: NAME 'x' -104,2-104,3: OP '=' -104,4-104,9: STRING "r'\\''" -104,10-104,11: OP '+' -104,12-104,14: STRING "''" -104,14-104,15: NEWLINE '\n' -105,0-105,1: NAME 'y' -105,2-105,3: OP '=' -105,4-107,6: STRING "r'''\nfoo bar \\\\\nbaz'''" -107,7-107,8: OP '+' -107,9-108,6: STRING "R'''\nfoo'''" -108,6-108,7: NEWLINE '\n' -109,0-109,1: NAME 'y' -109,2-109,3: OP '=' -109,4-111,3: STRING 'r"""foo\nbar \\\\ baz\n"""' -111,4-111,5: OP '+' -111,6-112,3: STRING "R'''spam\n'''" -112,3-112,4: NEWLINE '\n' -113,0-113,1: NAME 'x' -113,2-113,3: OP '=' -113,4-113,10: STRING "u'abc'" -113,11-113,12: OP '+' -113,13-113,19: STRING "U'ABC'" -113,19-113,20: NEWLINE '\n' -114,0-114,1: NAME 'y' -114,2-114,3: OP '=' -114,4-114,10: STRING 'u"abc"' -114,11-114,12: OP '+' -114,13-114,19: STRING 'U"ABC"' -114,19-114,20: NEWLINE '\n' -115,0-115,1: NAME 'x' -115,2-115,3: OP '=' -115,4-115,11: STRING "ur'abc'" -115,12-115,13: OP '+' -115,14-115,21: STRING "Ur'ABC'" -115,22-115,23: OP '+' -115,24-115,31: STRING "uR'ABC'" -115,32-115,33: OP '+' -115,34-115,41: STRING "UR'ABC'" -115,41-115,42: NEWLINE '\n' -116,0-116,1: NAME 'y' -116,2-116,3: OP '=' -116,4-116,11: STRING 'ur"abc"' -116,12-116,13: OP '+' -116,14-116,21: STRING 'Ur"ABC"' -116,22-116,23: OP '+' -116,24-116,31: STRING 'uR"ABC"' -116,32-116,33: OP '+' -116,34-116,41: STRING 'UR"ABC"' -116,41-116,42: NEWLINE '\n' -117,0-117,1: NAME 'x' -117,2-117,3: OP '=' -117,4-117,10: STRING "ur'\\\\'" -117,11-117,12: OP '+' -117,13-117,19: STRING "UR'\\\\'" -117,19-117,20: NEWLINE '\n' -118,0-118,1: NAME 'x' -118,2-118,3: OP '=' -118,4-118,10: STRING "ur'\\''" -118,11-118,12: OP '+' -118,13-118,15: STRING "''" -118,15-118,16: NEWLINE '\n' -119,0-119,1: NAME 'y' -119,2-119,3: OP '=' -119,4-121,6: STRING "ur'''\nfoo bar \\\\\nbaz'''" -121,7-121,8: OP '+' -121,9-122,6: STRING "UR'''\nfoo'''" -122,6-122,7: NEWLINE '\n' -123,0-123,1: NAME 'y' -123,2-123,3: OP '=' -123,4-125,3: STRING 'Ur"""foo\nbar \\\\ baz\n"""' -125,4-125,5: OP '+' -125,6-126,3: STRING "uR'''spam\n'''" -126,3-126,4: NEWLINE '\n' -127,0-127,1: NL '\n' -128,0-128,14: COMMENT '# Indentation\n' -129,0-129,2: NAME 'if' -129,3-129,4: NUMBER '1' -129,4-129,5: OP ':' -129,5-129,6: NEWLINE '\n' -130,0-130,4: INDENT ' ' -130,4-130,5: NAME 'x' -130,6-130,7: OP '=' -130,8-130,9: NUMBER '2' -130,9-130,10: NEWLINE '\n' -131,0-131,0: DEDENT '' -131,0-131,2: NAME 'if' -131,3-131,4: NUMBER '1' -131,4-131,5: OP ':' -131,5-131,6: NEWLINE '\n' -132,0-132,8: INDENT ' ' -132,8-132,9: NAME 'x' -132,10-132,11: OP '=' -132,12-132,13: NUMBER '2' -132,13-132,14: NEWLINE '\n' -133,0-133,0: DEDENT '' -133,0-133,2: NAME 'if' -133,3-133,4: NUMBER '1' -133,4-133,5: OP ':' -133,5-133,6: NEWLINE '\n' -134,0-134,4: INDENT ' ' -134,4-134,9: NAME 'while' -134,10-134,11: NUMBER '0' -134,11-134,12: OP ':' -134,12-134,13: NEWLINE '\n' -135,0-135,5: INDENT ' ' -135,5-135,7: NAME 'if' -135,8-135,9: NUMBER '0' -135,9-135,10: OP ':' -135,10-135,11: NEWLINE '\n' -136,0-136,11: INDENT ' ' -136,11-136,12: NAME 'x' -136,13-136,14: OP '=' -136,15-136,16: NUMBER '2' -136,16-136,17: NEWLINE '\n' -137,5-137,5: DEDENT '' -137,5-137,6: NAME 'x' -137,7-137,8: OP '=' -137,9-137,10: NUMBER '2' -137,10-137,11: NEWLINE '\n' -138,0-138,0: DEDENT '' -138,0-138,0: DEDENT '' -138,0-138,2: NAME 'if' -138,3-138,4: NUMBER '0' -138,4-138,5: OP ':' -138,5-138,6: NEWLINE '\n' -139,0-139,2: INDENT ' ' -139,2-139,4: NAME 'if' -139,5-139,6: NUMBER '2' -139,6-139,7: OP ':' -139,7-139,8: NEWLINE '\n' -140,0-140,3: INDENT ' ' -140,3-140,8: NAME 'while' -140,9-140,10: NUMBER '0' -140,10-140,11: OP ':' -140,11-140,12: NEWLINE '\n' -141,0-141,8: INDENT ' ' -141,8-141,10: NAME 'if' -141,11-141,12: NUMBER '1' -141,12-141,13: OP ':' -141,13-141,14: NEWLINE '\n' -142,0-142,10: INDENT ' ' -142,10-142,11: NAME 'x' -142,12-142,13: OP '=' -142,14-142,15: NUMBER '2' -142,15-142,16: NEWLINE '\n' -143,0-143,1: NL '\n' -144,0-144,12: COMMENT '# Operators\n' -145,0-145,1: NL '\n' -146,0-146,0: DEDENT '' -146,0-146,0: DEDENT '' -146,0-146,0: DEDENT '' -146,0-146,0: DEDENT '' -146,0-146,3: NAME 'def' -146,4-146,7: NAME 'd22' -146,7-146,8: OP '(' -146,8-146,9: NAME 'a' -146,9-146,10: OP ',' -146,11-146,12: NAME 'b' -146,12-146,13: OP ',' -146,14-146,15: NAME 'c' -146,15-146,16: OP '=' -146,16-146,17: NUMBER '1' -146,17-146,18: OP ',' -146,19-146,20: NAME 'd' -146,20-146,21: OP '=' -146,21-146,22: NUMBER '2' -146,22-146,23: OP ')' -146,23-146,24: OP ':' -146,25-146,29: NAME 'pass' -146,29-146,30: NEWLINE '\n' -147,0-147,3: NAME 'def' -147,4-147,8: NAME 'd01v' -147,8-147,9: OP '(' -147,9-147,10: NAME 'a' -147,10-147,11: OP '=' -147,11-147,12: NUMBER '1' -147,12-147,13: OP ',' -147,14-147,15: OP '*' -147,15-147,20: NAME 'restt' -147,20-147,21: OP ',' -147,22-147,24: OP '**' -147,24-147,29: NAME 'restd' -147,29-147,30: OP ')' -147,30-147,31: OP ':' -147,32-147,36: NAME 'pass' -147,36-147,37: NEWLINE '\n' -148,0-148,1: NL '\n' -149,0-149,1: OP '(' -149,1-149,2: NAME 'x' -149,2-149,3: OP ',' -149,4-149,5: NAME 'y' -149,5-149,6: OP ')' -149,7-149,9: OP '<>' -149,10-149,11: OP '(' -149,11-149,12: OP '{' -149,12-149,15: STRING "'a'" -149,15-149,16: OP ':' -149,16-149,17: NUMBER '1' -149,17-149,18: OP '}' -149,18-149,19: OP ',' -149,20-149,21: OP '{' -149,21-149,24: STRING "'b'" -149,24-149,25: OP ':' -149,25-149,26: NUMBER '2' -149,26-149,27: OP '}' -149,27-149,28: OP ')' -149,28-149,29: NEWLINE '\n' -150,0-150,1: NL '\n' -151,0-151,13: COMMENT '# comparison\n' -152,0-152,2: NAME 'if' -152,3-152,4: NUMBER '1' -152,5-152,6: OP '<' -152,7-152,8: NUMBER '1' -152,9-152,10: OP '>' -152,11-152,12: NUMBER '1' -152,13-152,15: OP '==' -152,16-152,17: NUMBER '1' -152,18-152,20: OP '>=' -152,21-152,22: NUMBER '1' -152,23-152,25: OP '<=' -152,26-152,27: NUMBER '1' -152,28-152,30: OP '<>' -152,31-152,32: NUMBER '1' -152,33-152,35: OP '!=' -152,36-152,37: NUMBER '1' -152,38-152,40: NAME 'in' -152,41-152,42: NUMBER '1' -152,43-152,46: NAME 'not' -152,47-152,49: NAME 'in' -152,50-152,51: NUMBER '1' -152,52-152,54: NAME 'is' -152,55-152,56: NUMBER '1' -152,57-152,59: NAME 'is' -152,60-152,63: NAME 'not' -152,64-152,65: NUMBER '1' -152,65-152,66: OP ':' -152,67-152,71: NAME 'pass' -152,71-152,72: NEWLINE '\n' -153,0-153,1: NL '\n' -154,0-154,9: COMMENT '# binary\n' -155,0-155,1: NAME 'x' -155,2-155,3: OP '=' -155,4-155,5: NUMBER '1' -155,6-155,7: OP '&' -155,8-155,9: NUMBER '1' -155,9-155,10: NEWLINE '\n' -156,0-156,1: NAME 'x' -156,2-156,3: OP '=' -156,4-156,5: NUMBER '1' -156,6-156,7: OP '^' -156,8-156,9: NUMBER '1' -156,9-156,10: NEWLINE '\n' -157,0-157,1: NAME 'x' -157,2-157,3: OP '=' -157,4-157,5: NUMBER '1' -157,6-157,7: OP '|' -157,8-157,9: NUMBER '1' -157,9-157,10: NEWLINE '\n' -158,0-158,1: NL '\n' -159,0-159,8: COMMENT '# shift\n' -160,0-160,1: NAME 'x' -160,2-160,3: OP '=' -160,4-160,5: NUMBER '1' -160,6-160,8: OP '<<' -160,9-160,10: NUMBER '1' -160,11-160,13: OP '>>' -160,14-160,15: NUMBER '1' -160,15-160,16: NEWLINE '\n' -161,0-161,1: NL '\n' -162,0-162,11: COMMENT '# additive\n' -163,0-163,1: NAME 'x' -163,2-163,3: OP '=' -163,4-163,5: NUMBER '1' -163,6-163,7: OP '-' -163,8-163,9: NUMBER '1' -163,10-163,11: OP '+' -163,12-163,13: NUMBER '1' -163,14-163,15: OP '-' -163,16-163,17: NUMBER '1' -163,18-163,19: OP '+' -163,20-163,21: NUMBER '1' -163,21-163,22: NEWLINE '\n' -164,0-164,1: NL '\n' -165,0-165,17: COMMENT '# multiplicative\n' -166,0-166,1: NAME 'x' -166,2-166,3: OP '=' -166,4-166,5: NUMBER '1' -166,6-166,7: OP '/' -166,8-166,9: NUMBER '1' -166,10-166,11: OP '*' -166,12-166,13: NUMBER '1' -166,14-166,15: OP '%' -166,16-166,17: NUMBER '1' -166,17-166,18: NEWLINE '\n' -167,0-167,1: NL '\n' -168,0-168,8: COMMENT '# unary\n' -169,0-169,1: NAME 'x' -169,2-169,3: OP '=' -169,4-169,5: OP '~' -169,5-169,6: NUMBER '1' -169,7-169,8: OP '^' -169,9-169,10: NUMBER '1' -169,11-169,12: OP '&' -169,13-169,14: NUMBER '1' -169,15-169,16: OP '|' -169,17-169,18: NUMBER '1' -169,19-169,20: OP '&' -169,21-169,22: NUMBER '1' -169,23-169,24: OP '^' -169,25-169,26: OP '-' -169,26-169,27: NUMBER '1' -169,27-169,28: NEWLINE '\n' -170,0-170,1: NAME 'x' -170,2-170,3: OP '=' -170,4-170,5: OP '-' -170,5-170,6: NUMBER '1' -170,6-170,7: OP '*' -170,7-170,8: NUMBER '1' -170,8-170,9: OP '/' -170,9-170,10: NUMBER '1' -170,11-170,12: OP '+' -170,13-170,14: NUMBER '1' -170,14-170,15: OP '*' -170,15-170,16: NUMBER '1' -170,17-170,18: OP '-' -170,19-170,20: OP '-' -170,20-170,21: OP '-' -170,21-170,22: OP '-' -170,22-170,23: NUMBER '1' -170,23-170,24: OP '*' -170,24-170,25: NUMBER '1' -170,25-170,26: NEWLINE '\n' -171,0-171,1: NL '\n' -172,0-172,11: COMMENT '# selector\n' -173,0-173,6: NAME 'import' -173,7-173,10: NAME 'sys' -173,10-173,11: OP ',' -173,12-173,16: NAME 'time' -173,16-173,17: NEWLINE '\n' -174,0-174,1: NAME 'x' -174,2-174,3: OP '=' -174,4-174,7: NAME 'sys' -174,7-174,8: OP '.' -174,8-174,15: NAME 'modules' -174,15-174,16: OP '[' -174,16-174,22: STRING "'time'" -174,22-174,23: OP ']' -174,23-174,24: OP '.' -174,24-174,28: NAME 'time' -174,28-174,29: OP '(' -174,29-174,30: OP ')' -174,30-174,31: NEWLINE '\n' -175,0-175,1: NL '\n' -176,0-176,1: OP '@' -176,1-176,13: NAME 'staticmethod' -176,13-176,14: NEWLINE '\n' -177,0-177,3: NAME 'def' -177,4-177,7: NAME 'foo' -177,7-177,8: OP '(' -177,8-177,9: OP ')' -177,9-177,10: OP ':' -177,11-177,15: NAME 'pass' -177,15-177,16: NEWLINE '\n' -178,0-178,1: NL '\n' -179,0-179,0: ENDMARKER '' diff --git a/sys/lib/python/test/output/test_types b/sys/lib/python/test/output/test_types deleted file mode 100644 index b49ce0d3a..000000000 --- a/sys/lib/python/test/output/test_types +++ /dev/null @@ -1,15 +0,0 @@ -test_types -6. Built-in types -6.1 Truth value testing -6.2 Boolean operations -6.3 Comparisons -6.4 Numeric types (mostly conversions) -6.4.1 32-bit integers -6.4.2 Long integers -6.4.3 Floating point numbers -6.5 Sequence types -6.5.1 Strings -6.5.2 Tuples [see test_tuple.py] -6.5.3 Lists [see test_list.py] -6.6 Mappings == Dictionaries [see test_dict.py] -Buffers diff --git a/sys/lib/python/test/output/test_winreg b/sys/lib/python/test/output/test_winreg deleted file mode 100644 index f47aa840f..000000000 --- a/sys/lib/python/test/output/test_winreg +++ /dev/null @@ -1,3 +0,0 @@ -test_winreg -Local registry tests worked -Remote registry calls can be tested using 'test_winreg.py --remote \\machine_name' diff --git a/sys/lib/python/test/output/test_xdrlib b/sys/lib/python/test/output/test_xdrlib deleted file mode 100644 index d86caa92c..000000000 --- a/sys/lib/python/test/output/test_xdrlib +++ /dev/null @@ -1,19 +0,0 @@ -test_xdrlib -pack test 0 succeeded -pack test 1 succeeded -pack test 2 succeeded -pack test 3 succeeded -pack test 4 succeeded -pack test 5 succeeded -pack test 6 succeeded -pack test 7 succeeded -pack test 8 succeeded -unpack test 0 succeeded : 9 -unpack test 1 succeeded : True -unpack test 2 succeeded : False -unpack test 3 succeeded : 45 -unpack test 4 succeeded : 1.89999997616 -unpack test 5 succeeded : 1.9 -unpack test 6 succeeded : hello world -unpack test 7 succeeded : [0, 1, 2, 3, 4] -unpack test 8 succeeded : ['what', 'is', 'hapnin', 'doctor'] diff --git a/sys/lib/python/test/output/xmltests b/sys/lib/python/test/output/xmltests deleted file mode 100644 index c798f6e33..000000000 --- a/sys/lib/python/test/output/xmltests +++ /dev/null @@ -1,364 +0,0 @@ -xmltests -Passed testAAA -Passed setAttribute() sets ownerDocument -Passed setAttribute() sets ownerElement -Test Succeeded testAAA -Passed assertion: len(Node.allnodes) == 0 -Passed testAAB -Test Succeeded testAAB -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Test Succeeded testAddAttr -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testAppendChild -Passed assertion: len(Node.allnodes) == 0 -Passed appendChild() -Test Succeeded testAppendChildFragment -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListItem -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListItemNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListItems -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListKeys -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListKeysNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListLength -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListValues -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrList__getitem__ -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrList__setitem__ -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testAttributeRepr -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Test Succeeded testChangeAttr -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testChildNodes -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCloneAttributeDeep -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCloneAttributeShallow -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCloneDocumentDeep -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCloneDocumentShallow -Passed assertion: len(Node.allnodes) == 0 -Passed clone of element has same attribute keys -Passed clone of attribute node has proper attribute values -Passed clone of attribute node correctly owned -Passed testCloneElementDeep -Test Succeeded testCloneElementDeep -Passed assertion: len(Node.allnodes) == 0 -Passed clone of element has same attribute keys -Passed clone of attribute node has proper attribute values -Passed clone of attribute node correctly owned -Passed testCloneElementShallow -Test Succeeded testCloneElementShallow -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testClonePIDeep -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testClonePIShallow -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testComment -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCreateAttributeNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCreateElementNS -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Passed Test -Test Succeeded testDeleteAttr -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testDocumentElement -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testElement -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testElementReprAndStr -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testFirstChild -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttrLength -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttrList -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttrValues -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttribute -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttributeNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttributeNode -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testGetElementsByTagName -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testGetElementsByTagNameNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetEmptyNodeListFromElementsByTagNameNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testHasChildNodes -Passed assertion: len(Node.allnodes) == 0 -Passed testInsertBefore -- node properly placed in tree -Passed testInsertBefore -- node properly placed in tree -Passed testInsertBefore -- node properly placed in tree -Test Succeeded testInsertBefore -Passed assertion: len(Node.allnodes) == 0 -Passed insertBefore(, None) -Passed insertBefore(, orig) -Test Succeeded testInsertBeforeFragment -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testLegalChildren -Passed assertion: len(Node.allnodes) == 0 -Passed NamedNodeMap.__setitem__() sets ownerDocument -Passed NamedNodeMap.__setitem__() sets ownerElement -Passed NamedNodeMap.__setitem__() sets value -Passed NamedNodeMap.__setitem__() sets nodeValue -Test Succeeded testNamedNodeMapSetItem -Passed assertion: len(Node.allnodes) == 0 -Passed test NodeList.item() -Test Succeeded testNodeListItem -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testNonZero -Passed assertion: len(Node.allnodes) == 0 -Passed testNormalize -- preparation -Passed testNormalize -- result -Passed testNormalize -- single empty node removed -Test Succeeded testNormalize -Passed assertion: len(Node.allnodes) == 0 -Passed testParents -Test Succeeded testParents -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParse -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseAttributeNamespaces -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseAttributes -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseElement -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseElementNamespaces -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testParseFromFile -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseProcessingInstructions -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseString -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testProcessingInstruction -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testProcessingInstructionRepr -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testRemoveAttr -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testRemoveAttrNS -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testRemoveAttributeNode -Passed assertion: len(Node.allnodes) == 0 -Passed replaceChild() -Test Succeeded testReplaceChildFragment -Passed assertion: len(Node.allnodes) == 0 -Passed testSAX2DOM - siblings -Passed testSAX2DOM - parents -Test Succeeded testSAX2DOM -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testSetAttrValueandNodeValue -Passed assertion: len(Node.allnodes) == 0 -Passed testSiblings -Test Succeeded testSiblings -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testTextNodeRepr -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testTextRepr -Passed assertion: len(Node.allnodes) == 0 -Caught expected exception when adding extra document element. -Test Succeeded testTooManyDocumentElements -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testUnlink -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testWriteText -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testWriteXML -Passed assertion: len(Node.allnodes) == 0 -All tests succeeded -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -PI: - 'xml-stylesheet' 'href="stylesheet.css"' -Comment: - ' comment data ' -Notation declared: ('notation', None, 'notation.jpeg', None) -Unparsed entity decl: - ('unparsed_entity', None, 'entity.file', None, 'notation') -Start element: - 'root' {'attr1': 'value1', 'attr2': 'value2\xe1\xbd\x80'} -NS decl: - 'myns' 'http://www.python.org/namespace' -Start element: - 'http://www.python.org/namespace!subelement' {} -Character data: - 'Contents of subelements' -End element: - 'http://www.python.org/namespace!subelement' -End of NS decl: - 'myns' -Start element: - 'sub2' {} -Start of CDATA section -Character data: - 'contents of CDATA section' -End of CDATA section -End element: - 'sub2' -External entity ref: (None, 'entity.file', None) -End element: - 'root' -PI: - u'xml-stylesheet' u'href="stylesheet.css"' -Comment: - u' comment data ' -Notation declared: (u'notation', None, u'notation.jpeg', None) -Unparsed entity decl: - (u'unparsed_entity', None, u'entity.file', None, u'notation') -Start element: - u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'} -NS decl: - u'myns' u'http://www.python.org/namespace' -Start element: - u'http://www.python.org/namespace!subelement' {} -Character data: - u'Contents of subelements' -End element: - u'http://www.python.org/namespace!subelement' -End of NS decl: - u'myns' -Start element: - u'sub2' {} -Start of CDATA section -Character data: - u'contents of CDATA section' -End of CDATA section -End element: - u'sub2' -External entity ref: (None, u'entity.file', None) -End element: - u'root' -PI: - u'xml-stylesheet' u'href="stylesheet.css"' -Comment: - u' comment data ' -Notation declared: (u'notation', None, u'notation.jpeg', None) -Unparsed entity decl: - (u'unparsed_entity', None, u'entity.file', None, u'notation') -Start element: - u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'} -NS decl: - u'myns' u'http://www.python.org/namespace' -Start element: - u'http://www.python.org/namespace!subelement' {} -Character data: - u'Contents of subelements' -End element: - u'http://www.python.org/namespace!subelement' -End of NS decl: - u'myns' -Start element: - u'sub2' {} -Start of CDATA section -Character data: - u'contents of CDATA section' -End of CDATA section -End element: - u'sub2' -External entity ref: (None, u'entity.file', None) -End element: - u'root' - -Testing constructor for proper handling of namespace_separator values: -Legal values tested o.k. -Caught expected TypeError: -ParserCreate() argument 2 must be string or None, not int -Caught expected ValueError: -namespace_separator must be at most one character, omitted, or None -Passed test_attrs_empty -Passed test_attrs_wattr -Passed test_double_quoteattr -Passed test_escape_all -Passed test_escape_basic -Passed test_escape_extra -Passed test_expat_attrs_empty -Passed test_expat_attrs_wattr -Passed test_expat_dtdhandler -Passed test_expat_entityresolver -Passed test_expat_file -Passed test_expat_incomplete -Passed test_expat_incremental -Passed test_expat_incremental_reset -Passed test_expat_inpsource_filename -Passed test_expat_inpsource_location -Passed test_expat_inpsource_stream -Passed test_expat_inpsource_sysid -Passed test_expat_locator_noinfo -Passed test_expat_locator_withinfo -Passed test_expat_nsattrs_empty -Passed test_expat_nsattrs_wattr -Passed test_filter_basic -Passed test_make_parser -Passed test_make_parser2 -Passed test_nsattrs_empty -Passed test_nsattrs_wattr -Passed test_quoteattr_basic -Passed test_single_double_quoteattr -Passed test_single_quoteattr -Passed test_xmlgen_attr_escape -Passed test_xmlgen_basic -Passed test_xmlgen_content -Passed test_xmlgen_content_escape -Passed test_xmlgen_ignorable -Passed test_xmlgen_ns -Passed test_xmlgen_pi -37 tests, 0 failures diff --git a/sys/lib/python/test/outstanding_bugs.py b/sys/lib/python/test/outstanding_bugs.py deleted file mode 100644 index 7e37c8502..000000000 --- a/sys/lib/python/test/outstanding_bugs.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# This file is for everybody to add tests for bugs that aren't -# fixed yet. Please add a test case and appropriate bug description. -# -# When you fix one of the bugs, please move the test to the correct -# test_ module. -# - -import unittest -from test import test_support - -class TestBug1385040(unittest.TestCase): - def testSyntaxError(self): - import compiler - - # The following snippet gives a SyntaxError in the interpreter - # - # If you compile and exec it, the call foo(7) returns (7, 1) - self.assertRaises(SyntaxError, compiler.compile, - "def foo(a=1, b): return a, b\n\n", "", "exec") - - -def test_main(): - test_support.run_unittest(TestBug1385040) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/pickletester.py b/sys/lib/python/test/pickletester.py deleted file mode 100644 index e1bc07815..000000000 --- a/sys/lib/python/test/pickletester.py +++ /dev/null @@ -1,1001 +0,0 @@ -import unittest -import pickle -import cPickle -import pickletools -import copy_reg - -from test.test_support import TestFailed, have_unicode, TESTFN, \ - run_with_locale - -# Tests that try a number of pickle protocols should have a -# for proto in protocols: -# kind of outer loop. -assert pickle.HIGHEST_PROTOCOL == cPickle.HIGHEST_PROTOCOL == 2 -protocols = range(pickle.HIGHEST_PROTOCOL + 1) - - -# Return True if opcode code appears in the pickle, else False. -def opcode_in_pickle(code, pickle): - for op, dummy, dummy in pickletools.genops(pickle): - if op.code == code: - return True - return False - -# Return the number of times opcode code appears in pickle. -def count_opcode(code, pickle): - n = 0 - for op, dummy, dummy in pickletools.genops(pickle): - if op.code == code: - n += 1 - return n - -# We can't very well test the extension registry without putting known stuff -# in it, but we have to be careful to restore its original state. Code -# should do this: -# -# e = ExtensionSaver(extension_code) -# try: -# fiddle w/ the extension registry's stuff for extension_code -# finally: -# e.restore() - -class ExtensionSaver: - # Remember current registration for code (if any), and remove it (if - # there is one). - def __init__(self, code): - self.code = code - if code in copy_reg._inverted_registry: - self.pair = copy_reg._inverted_registry[code] - copy_reg.remove_extension(self.pair[0], self.pair[1], code) - else: - self.pair = None - - # Restore previous registration for code. - def restore(self): - code = self.code - curpair = copy_reg._inverted_registry.get(code) - if curpair is not None: - copy_reg.remove_extension(curpair[0], curpair[1], code) - pair = self.pair - if pair is not None: - copy_reg.add_extension(pair[0], pair[1], code) - -class C: - def __cmp__(self, other): - return cmp(self.__dict__, other.__dict__) - -import __main__ -__main__.C = C -C.__module__ = "__main__" - -class myint(int): - def __init__(self, x): - self.str = str(x) - -class initarg(C): - - def __init__(self, a, b): - self.a = a - self.b = b - - def __getinitargs__(self): - return self.a, self.b - -class metaclass(type): - pass - -class use_metaclass(object): - __metaclass__ = metaclass - -# DATA0 .. DATA2 are the pickles we expect under the various protocols, for -# the object returned by create_data(). - -# break into multiple strings to avoid confusing font-lock-mode -DATA0 = """(lp1 -I0 -aL1L -aF2 -ac__builtin__ -complex -p2 -""" + \ -"""(F3 -F0 -tRp3 -aI1 -aI-1 -aI255 -aI-255 -aI-256 -aI65535 -aI-65535 -aI-65536 -aI2147483647 -aI-2147483647 -aI-2147483648 -a""" + \ -"""(S'abc' -p4 -g4 -""" + \ -"""(i__main__ -C -p5 -""" + \ -"""(dp6 -S'foo' -p7 -I1 -sS'bar' -p8 -I2 -sbg5 -tp9 -ag9 -aI5 -a. -""" - -# Disassembly of DATA0. -DATA0_DIS = """\ - 0: ( MARK - 1: l LIST (MARK at 0) - 2: p PUT 1 - 5: I INT 0 - 8: a APPEND - 9: L LONG 1L - 13: a APPEND - 14: F FLOAT 2.0 - 17: a APPEND - 18: c GLOBAL '__builtin__ complex' - 39: p PUT 2 - 42: ( MARK - 43: F FLOAT 3.0 - 46: F FLOAT 0.0 - 49: t TUPLE (MARK at 42) - 50: R REDUCE - 51: p PUT 3 - 54: a APPEND - 55: I INT 1 - 58: a APPEND - 59: I INT -1 - 63: a APPEND - 64: I INT 255 - 69: a APPEND - 70: I INT -255 - 76: a APPEND - 77: I INT -256 - 83: a APPEND - 84: I INT 65535 - 91: a APPEND - 92: I INT -65535 - 100: a APPEND - 101: I INT -65536 - 109: a APPEND - 110: I INT 2147483647 - 122: a APPEND - 123: I INT -2147483647 - 136: a APPEND - 137: I INT -2147483648 - 150: a APPEND - 151: ( MARK - 152: S STRING 'abc' - 159: p PUT 4 - 162: g GET 4 - 165: ( MARK - 166: i INST '__main__ C' (MARK at 165) - 178: p PUT 5 - 181: ( MARK - 182: d DICT (MARK at 181) - 183: p PUT 6 - 186: S STRING 'foo' - 193: p PUT 7 - 196: I INT 1 - 199: s SETITEM - 200: S STRING 'bar' - 207: p PUT 8 - 210: I INT 2 - 213: s SETITEM - 214: b BUILD - 215: g GET 5 - 218: t TUPLE (MARK at 151) - 219: p PUT 9 - 222: a APPEND - 223: g GET 9 - 226: a APPEND - 227: I INT 5 - 230: a APPEND - 231: . STOP -highest protocol among opcodes = 0 -""" - -DATA1 = (']q\x01(K\x00L1L\nG@\x00\x00\x00\x00\x00\x00\x00' - 'c__builtin__\ncomplex\nq\x02(G@\x08\x00\x00\x00\x00\x00' - '\x00G\x00\x00\x00\x00\x00\x00\x00\x00tRq\x03K\x01J\xff\xff' - '\xff\xffK\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xff' - 'J\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00' - '\x00\x80J\x00\x00\x00\x80(U\x03abcq\x04h\x04(c__main__\n' - 'C\nq\x05oq\x06}q\x07(U\x03fooq\x08K\x01U\x03barq\tK\x02ubh' - '\x06tq\nh\nK\x05e.' - ) - -# Disassembly of DATA1. -DATA1_DIS = """\ - 0: ] EMPTY_LIST - 1: q BINPUT 1 - 3: ( MARK - 4: K BININT1 0 - 6: L LONG 1L - 10: G BINFLOAT 2.0 - 19: c GLOBAL '__builtin__ complex' - 40: q BINPUT 2 - 42: ( MARK - 43: G BINFLOAT 3.0 - 52: G BINFLOAT 0.0 - 61: t TUPLE (MARK at 42) - 62: R REDUCE - 63: q BINPUT 3 - 65: K BININT1 1 - 67: J BININT -1 - 72: K BININT1 255 - 74: J BININT -255 - 79: J BININT -256 - 84: M BININT2 65535 - 87: J BININT -65535 - 92: J BININT -65536 - 97: J BININT 2147483647 - 102: J BININT -2147483647 - 107: J BININT -2147483648 - 112: ( MARK - 113: U SHORT_BINSTRING 'abc' - 118: q BINPUT 4 - 120: h BINGET 4 - 122: ( MARK - 123: c GLOBAL '__main__ C' - 135: q BINPUT 5 - 137: o OBJ (MARK at 122) - 138: q BINPUT 6 - 140: } EMPTY_DICT - 141: q BINPUT 7 - 143: ( MARK - 144: U SHORT_BINSTRING 'foo' - 149: q BINPUT 8 - 151: K BININT1 1 - 153: U SHORT_BINSTRING 'bar' - 158: q BINPUT 9 - 160: K BININT1 2 - 162: u SETITEMS (MARK at 143) - 163: b BUILD - 164: h BINGET 6 - 166: t TUPLE (MARK at 112) - 167: q BINPUT 10 - 169: h BINGET 10 - 171: K BININT1 5 - 173: e APPENDS (MARK at 3) - 174: . STOP -highest protocol among opcodes = 1 -""" - -DATA2 = ('\x80\x02]q\x01(K\x00\x8a\x01\x01G@\x00\x00\x00\x00\x00\x00\x00' - 'c__builtin__\ncomplex\nq\x02G@\x08\x00\x00\x00\x00\x00\x00G\x00' - '\x00\x00\x00\x00\x00\x00\x00\x86Rq\x03K\x01J\xff\xff\xff\xffK' - '\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xffJ\x01\x00\xff\xff' - 'J\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00\x00\x80J\x00\x00\x00' - '\x80(U\x03abcq\x04h\x04(c__main__\nC\nq\x05oq\x06}q\x07(U\x03foo' - 'q\x08K\x01U\x03barq\tK\x02ubh\x06tq\nh\nK\x05e.') - -# Disassembly of DATA2. -DATA2_DIS = """\ - 0: \x80 PROTO 2 - 2: ] EMPTY_LIST - 3: q BINPUT 1 - 5: ( MARK - 6: K BININT1 0 - 8: \x8a LONG1 1L - 11: G BINFLOAT 2.0 - 20: c GLOBAL '__builtin__ complex' - 41: q BINPUT 2 - 43: G BINFLOAT 3.0 - 52: G BINFLOAT 0.0 - 61: \x86 TUPLE2 - 62: R REDUCE - 63: q BINPUT 3 - 65: K BININT1 1 - 67: J BININT -1 - 72: K BININT1 255 - 74: J BININT -255 - 79: J BININT -256 - 84: M BININT2 65535 - 87: J BININT -65535 - 92: J BININT -65536 - 97: J BININT 2147483647 - 102: J BININT -2147483647 - 107: J BININT -2147483648 - 112: ( MARK - 113: U SHORT_BINSTRING 'abc' - 118: q BINPUT 4 - 120: h BINGET 4 - 122: ( MARK - 123: c GLOBAL '__main__ C' - 135: q BINPUT 5 - 137: o OBJ (MARK at 122) - 138: q BINPUT 6 - 140: } EMPTY_DICT - 141: q BINPUT 7 - 143: ( MARK - 144: U SHORT_BINSTRING 'foo' - 149: q BINPUT 8 - 151: K BININT1 1 - 153: U SHORT_BINSTRING 'bar' - 158: q BINPUT 9 - 160: K BININT1 2 - 162: u SETITEMS (MARK at 143) - 163: b BUILD - 164: h BINGET 6 - 166: t TUPLE (MARK at 112) - 167: q BINPUT 10 - 169: h BINGET 10 - 171: K BININT1 5 - 173: e APPENDS (MARK at 5) - 174: . STOP -highest protocol among opcodes = 2 -""" - -def create_data(): - c = C() - c.foo = 1 - c.bar = 2 - x = [0, 1L, 2.0, 3.0+0j] - # Append some integer test cases at cPickle.c's internal size - # cutoffs. - uint1max = 0xff - uint2max = 0xffff - int4max = 0x7fffffff - x.extend([1, -1, - uint1max, -uint1max, -uint1max-1, - uint2max, -uint2max, -uint2max-1, - int4max, -int4max, -int4max-1]) - y = ('abc', 'abc', c, c) - x.append(y) - x.append(y) - x.append(5) - return x - -class AbstractPickleTests(unittest.TestCase): - # Subclass must define self.dumps, self.loads, self.error. - - _testdata = create_data() - - def setUp(self): - pass - - def test_misc(self): - # test various datatypes not tested by testdata - for proto in protocols: - x = myint(4) - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - - x = (1, ()) - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - - x = initarg(1, x) - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - - # XXX test __reduce__ protocol? - - def test_roundtrip_equality(self): - expected = self._testdata - for proto in protocols: - s = self.dumps(expected, proto) - got = self.loads(s) - self.assertEqual(expected, got) - - def test_load_from_canned_string(self): - expected = self._testdata - for canned in DATA0, DATA1, DATA2: - got = self.loads(canned) - self.assertEqual(expected, got) - - # There are gratuitous differences between pickles produced by - # pickle and cPickle, largely because cPickle starts PUT indices at - # 1 and pickle starts them at 0. See XXX comment in cPickle's put2() -- - # there's a comment with an exclamation point there whose meaning - # is a mystery. cPickle also suppresses PUT for objects with a refcount - # of 1. - def dont_test_disassembly(self): - from cStringIO import StringIO - from pickletools import dis - - for proto, expected in (0, DATA0_DIS), (1, DATA1_DIS): - s = self.dumps(self._testdata, proto) - filelike = StringIO() - dis(s, out=filelike) - got = filelike.getvalue() - self.assertEqual(expected, got) - - def test_recursive_list(self): - l = [] - l.append(l) - for proto in protocols: - s = self.dumps(l, proto) - x = self.loads(s) - self.assertEqual(len(x), 1) - self.assert_(x is x[0]) - - def test_recursive_dict(self): - d = {} - d[1] = d - for proto in protocols: - s = self.dumps(d, proto) - x = self.loads(s) - self.assertEqual(x.keys(), [1]) - self.assert_(x[1] is x) - - def test_recursive_inst(self): - i = C() - i.attr = i - for proto in protocols: - s = self.dumps(i, 2) - x = self.loads(s) - self.assertEqual(dir(x), dir(i)) - self.assert_(x.attr is x) - - def test_recursive_multi(self): - l = [] - d = {1:l} - i = C() - i.attr = d - l.append(i) - for proto in protocols: - s = self.dumps(l, proto) - x = self.loads(s) - self.assertEqual(len(x), 1) - self.assertEqual(dir(x[0]), dir(i)) - self.assertEqual(x[0].attr.keys(), [1]) - self.assert_(x[0].attr[1] is x) - - def test_garyp(self): - self.assertRaises(self.error, self.loads, 'garyp') - - def test_insecure_strings(self): - insecure = ["abc", "2 + 2", # not quoted - #"'abc' + 'def'", # not a single quoted string - "'abc", # quote is not closed - "'abc\"", # open quote and close quote don't match - "'abc' ?", # junk after close quote - "'\\'", # trailing backslash - # some tests of the quoting rules - #"'abc\"\''", - #"'\\\\a\'\'\'\\\'\\\\\''", - ] - for s in insecure: - buf = "S" + s + "\012p0\012." - self.assertRaises(ValueError, self.loads, buf) - - if have_unicode: - def test_unicode(self): - endcases = [unicode(''), unicode('<\\u>'), unicode('<\\\u1234>'), - unicode('<\n>'), unicode('<\\>')] - for proto in protocols: - for u in endcases: - p = self.dumps(u, proto) - u2 = self.loads(p) - self.assertEqual(u2, u) - - def test_ints(self): - import sys - for proto in protocols: - n = sys.maxint - while n: - for expected in (-n, n): - s = self.dumps(expected, proto) - n2 = self.loads(s) - self.assertEqual(expected, n2) - n = n >> 1 - - def test_maxint64(self): - maxint64 = (1L << 63) - 1 - data = 'I' + str(maxint64) + '\n.' - got = self.loads(data) - self.assertEqual(got, maxint64) - - # Try too with a bogus literal. - data = 'I' + str(maxint64) + 'JUNK\n.' - self.assertRaises(ValueError, self.loads, data) - - def test_long(self): - for proto in protocols: - # 256 bytes is where LONG4 begins. - for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257: - nbase = 1L << nbits - for npos in nbase-1, nbase, nbase+1: - for n in npos, -npos: - pickle = self.dumps(n, proto) - got = self.loads(pickle) - self.assertEqual(n, got) - # Try a monster. This is quadratic-time in protos 0 & 1, so don't - # bother with those. - nbase = long("deadbeeffeedface", 16) - nbase += nbase << 1000000 - for n in nbase, -nbase: - p = self.dumps(n, 2) - got = self.loads(p) - self.assertEqual(n, got) - - @run_with_locale('LC_ALL', 'de_DE', 'fr_FR') - def test_float_format(self): - # make sure that floats are formatted locale independent - self.assertEqual(self.dumps(1.2)[0:3], 'F1.') - - def test_reduce(self): - pass - - def test_getinitargs(self): - pass - - def test_metaclass(self): - a = use_metaclass() - for proto in protocols: - s = self.dumps(a, proto) - b = self.loads(s) - self.assertEqual(a.__class__, b.__class__) - - def test_structseq(self): - import time - import os - - t = time.localtime() - for proto in protocols: - s = self.dumps(t, proto) - u = self.loads(s) - self.assertEqual(t, u) - if hasattr(os, "stat"): - t = os.stat(os.curdir) - s = self.dumps(t, proto) - u = self.loads(s) - self.assertEqual(t, u) - if hasattr(os, "statvfs"): - t = os.statvfs(os.curdir) - s = self.dumps(t, proto) - u = self.loads(s) - self.assertEqual(t, u) - - # Tests for protocol 2 - - def test_proto(self): - build_none = pickle.NONE + pickle.STOP - for proto in protocols: - expected = build_none - if proto >= 2: - expected = pickle.PROTO + chr(proto) + expected - p = self.dumps(None, proto) - self.assertEqual(p, expected) - - oob = protocols[-1] + 1 # a future protocol - badpickle = pickle.PROTO + chr(oob) + build_none - try: - self.loads(badpickle) - except ValueError, detail: - self.failUnless(str(detail).startswith( - "unsupported pickle protocol")) - else: - self.fail("expected bad protocol number to raise ValueError") - - def test_long1(self): - x = 12345678910111213141516178920L - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - self.assertEqual(opcode_in_pickle(pickle.LONG1, s), proto >= 2) - - def test_long4(self): - x = 12345678910111213141516178920L << (256*8) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - self.assertEqual(opcode_in_pickle(pickle.LONG4, s), proto >= 2) - - def test_short_tuples(self): - # Map (proto, len(tuple)) to expected opcode. - expected_opcode = {(0, 0): pickle.TUPLE, - (0, 1): pickle.TUPLE, - (0, 2): pickle.TUPLE, - (0, 3): pickle.TUPLE, - (0, 4): pickle.TUPLE, - - (1, 0): pickle.EMPTY_TUPLE, - (1, 1): pickle.TUPLE, - (1, 2): pickle.TUPLE, - (1, 3): pickle.TUPLE, - (1, 4): pickle.TUPLE, - - (2, 0): pickle.EMPTY_TUPLE, - (2, 1): pickle.TUPLE1, - (2, 2): pickle.TUPLE2, - (2, 3): pickle.TUPLE3, - (2, 4): pickle.TUPLE, - } - a = () - b = (1,) - c = (1, 2) - d = (1, 2, 3) - e = (1, 2, 3, 4) - for proto in protocols: - for x in a, b, c, d, e: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y, (proto, x, s, y)) - expected = expected_opcode[proto, len(x)] - self.assertEqual(opcode_in_pickle(expected, s), True) - - def test_singletons(self): - # Map (proto, singleton) to expected opcode. - expected_opcode = {(0, None): pickle.NONE, - (1, None): pickle.NONE, - (2, None): pickle.NONE, - - (0, True): pickle.INT, - (1, True): pickle.INT, - (2, True): pickle.NEWTRUE, - - (0, False): pickle.INT, - (1, False): pickle.INT, - (2, False): pickle.NEWFALSE, - } - for proto in protocols: - for x in None, False, True: - s = self.dumps(x, proto) - y = self.loads(s) - self.assert_(x is y, (proto, x, s, y)) - expected = expected_opcode[proto, x] - self.assertEqual(opcode_in_pickle(expected, s), True) - - def test_newobj_tuple(self): - x = MyTuple([1, 2, 3]) - x.foo = 42 - x.bar = "hello" - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(tuple(x), tuple(y)) - self.assertEqual(x.__dict__, y.__dict__) - - def test_newobj_list(self): - x = MyList([1, 2, 3]) - x.foo = 42 - x.bar = "hello" - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(list(x), list(y)) - self.assertEqual(x.__dict__, y.__dict__) - - def test_newobj_generic(self): - for proto in protocols: - for C in myclasses: - B = C.__base__ - x = C(C.sample) - x.foo = 42 - s = self.dumps(x, proto) - y = self.loads(s) - detail = (proto, C, B, x, y, type(y)) - self.assertEqual(B(x), B(y), detail) - self.assertEqual(x.__dict__, y.__dict__, detail) - - # Register a type with copy_reg, with extension code extcode. Pickle - # an object of that type. Check that the resulting pickle uses opcode - # (EXT[124]) under proto 2, and not in proto 1. - - def produce_global_ext(self, extcode, opcode): - e = ExtensionSaver(extcode) - try: - copy_reg.add_extension(__name__, "MyList", extcode) - x = MyList([1, 2, 3]) - x.foo = 42 - x.bar = "hello" - - # Dump using protocol 1 for comparison. - s1 = self.dumps(x, 1) - self.assert_(__name__ in s1) - self.assert_("MyList" in s1) - self.assertEqual(opcode_in_pickle(opcode, s1), False) - - y = self.loads(s1) - self.assertEqual(list(x), list(y)) - self.assertEqual(x.__dict__, y.__dict__) - - # Dump using protocol 2 for test. - s2 = self.dumps(x, 2) - self.assert_(__name__ not in s2) - self.assert_("MyList" not in s2) - self.assertEqual(opcode_in_pickle(opcode, s2), True) - - y = self.loads(s2) - self.assertEqual(list(x), list(y)) - self.assertEqual(x.__dict__, y.__dict__) - - finally: - e.restore() - - def test_global_ext1(self): - self.produce_global_ext(0x00000001, pickle.EXT1) # smallest EXT1 code - self.produce_global_ext(0x000000ff, pickle.EXT1) # largest EXT1 code - - def test_global_ext2(self): - self.produce_global_ext(0x00000100, pickle.EXT2) # smallest EXT2 code - self.produce_global_ext(0x0000ffff, pickle.EXT2) # largest EXT2 code - self.produce_global_ext(0x0000abcd, pickle.EXT2) # check endianness - - def test_global_ext4(self): - self.produce_global_ext(0x00010000, pickle.EXT4) # smallest EXT4 code - self.produce_global_ext(0x7fffffff, pickle.EXT4) # largest EXT4 code - self.produce_global_ext(0x12abcdef, pickle.EXT4) # check endianness - - def test_list_chunking(self): - n = 10 # too small to chunk - x = range(n) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - num_appends = count_opcode(pickle.APPENDS, s) - self.assertEqual(num_appends, proto > 0) - - n = 2500 # expect at least two chunks when proto > 0 - x = range(n) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - num_appends = count_opcode(pickle.APPENDS, s) - if proto == 0: - self.assertEqual(num_appends, 0) - else: - self.failUnless(num_appends >= 2) - - def test_dict_chunking(self): - n = 10 # too small to chunk - x = dict.fromkeys(range(n)) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - num_setitems = count_opcode(pickle.SETITEMS, s) - self.assertEqual(num_setitems, proto > 0) - - n = 2500 # expect at least two chunks when proto > 0 - x = dict.fromkeys(range(n)) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - num_setitems = count_opcode(pickle.SETITEMS, s) - if proto == 0: - self.assertEqual(num_setitems, 0) - else: - self.failUnless(num_setitems >= 2) - - def test_simple_newobj(self): - x = object.__new__(SimpleNewObj) # avoid __init__ - x.abc = 666 - for proto in protocols: - s = self.dumps(x, proto) - self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), proto >= 2) - y = self.loads(s) # will raise TypeError if __init__ called - self.assertEqual(y.abc, 666) - self.assertEqual(x.__dict__, y.__dict__) - - def test_newobj_list_slots(self): - x = SlotList([1, 2, 3]) - x.foo = 42 - x.bar = "hello" - s = self.dumps(x, 2) - y = self.loads(s) - self.assertEqual(list(x), list(y)) - self.assertEqual(x.__dict__, y.__dict__) - self.assertEqual(x.foo, y.foo) - self.assertEqual(x.bar, y.bar) - - def test_reduce_overrides_default_reduce_ex(self): - for proto in 0, 1, 2: - x = REX_one() - self.assertEqual(x._reduce_called, 0) - s = self.dumps(x, proto) - self.assertEqual(x._reduce_called, 1) - y = self.loads(s) - self.assertEqual(y._reduce_called, 0) - - def test_reduce_ex_called(self): - for proto in 0, 1, 2: - x = REX_two() - self.assertEqual(x._proto, None) - s = self.dumps(x, proto) - self.assertEqual(x._proto, proto) - y = self.loads(s) - self.assertEqual(y._proto, None) - - def test_reduce_ex_overrides_reduce(self): - for proto in 0, 1, 2: - x = REX_three() - self.assertEqual(x._proto, None) - s = self.dumps(x, proto) - self.assertEqual(x._proto, proto) - y = self.loads(s) - self.assertEqual(y._proto, None) - - def test_reduce_ex_calls_base(self): - for proto in 0, 1, 2: - x = REX_four() - self.assertEqual(x._proto, None) - s = self.dumps(x, proto) - self.assertEqual(x._proto, proto) - y = self.loads(s) - self.assertEqual(y._proto, proto) - - def test_reduce_calls_base(self): - for proto in 0, 1, 2: - x = REX_five() - self.assertEqual(x._reduce_called, 0) - s = self.dumps(x, proto) - self.assertEqual(x._reduce_called, 1) - y = self.loads(s) - self.assertEqual(y._reduce_called, 1) - -# Test classes for reduce_ex - -class REX_one(object): - _reduce_called = 0 - def __reduce__(self): - self._reduce_called = 1 - return REX_one, () - # No __reduce_ex__ here, but inheriting it from object - -class REX_two(object): - _proto = None - def __reduce_ex__(self, proto): - self._proto = proto - return REX_two, () - # No __reduce__ here, but inheriting it from object - -class REX_three(object): - _proto = None - def __reduce_ex__(self, proto): - self._proto = proto - return REX_two, () - def __reduce__(self): - raise TestFailed, "This __reduce__ shouldn't be called" - -class REX_four(object): - _proto = None - def __reduce_ex__(self, proto): - self._proto = proto - return object.__reduce_ex__(self, proto) - # Calling base class method should succeed - -class REX_five(object): - _reduce_called = 0 - def __reduce__(self): - self._reduce_called = 1 - return object.__reduce__(self) - # This one used to fail with infinite recursion - -# Test classes for newobj - -class MyInt(int): - sample = 1 - -class MyLong(long): - sample = 1L - -class MyFloat(float): - sample = 1.0 - -class MyComplex(complex): - sample = 1.0 + 0.0j - -class MyStr(str): - sample = "hello" - -class MyUnicode(unicode): - sample = u"hello \u1234" - -class MyTuple(tuple): - sample = (1, 2, 3) - -class MyList(list): - sample = [1, 2, 3] - -class MyDict(dict): - sample = {"a": 1, "b": 2} - -myclasses = [MyInt, MyLong, MyFloat, - MyComplex, - MyStr, MyUnicode, - MyTuple, MyList, MyDict] - - -class SlotList(MyList): - __slots__ = ["foo"] - -class SimpleNewObj(object): - def __init__(self, a, b, c): - # raise an error, to make sure this isn't called - raise TypeError("SimpleNewObj.__init__() didn't expect to get called") - -class AbstractPickleModuleTests(unittest.TestCase): - - def test_dump_closed_file(self): - import os - f = open(TESTFN, "w") - try: - f.close() - self.assertRaises(ValueError, self.module.dump, 123, f) - finally: - os.remove(TESTFN) - - def test_load_closed_file(self): - import os - f = open(TESTFN, "w") - try: - f.close() - self.assertRaises(ValueError, self.module.dump, 123, f) - finally: - os.remove(TESTFN) - - def test_highest_protocol(self): - # Of course this needs to be changed when HIGHEST_PROTOCOL changes. - self.assertEqual(self.module.HIGHEST_PROTOCOL, 2) - - def test_callapi(self): - from cStringIO import StringIO - f = StringIO() - # With and without keyword arguments - self.module.dump(123, f, -1) - self.module.dump(123, file=f, protocol=-1) - self.module.dumps(123, -1) - self.module.dumps(123, protocol=-1) - self.module.Pickler(f, -1) - self.module.Pickler(f, protocol=-1) - -class AbstractPersistentPicklerTests(unittest.TestCase): - - # This class defines persistent_id() and persistent_load() - # functions that should be used by the pickler. All even integers - # are pickled using persistent ids. - - def persistent_id(self, object): - if isinstance(object, int) and object % 2 == 0: - self.id_count += 1 - return str(object) - else: - return None - - def persistent_load(self, oid): - self.load_count += 1 - object = int(oid) - assert object % 2 == 0 - return object - - def test_persistence(self): - self.id_count = 0 - self.load_count = 0 - L = range(10) - self.assertEqual(self.loads(self.dumps(L)), L) - self.assertEqual(self.id_count, 5) - self.assertEqual(self.load_count, 5) - - def test_bin_persistence(self): - self.id_count = 0 - self.load_count = 0 - L = range(10) - self.assertEqual(self.loads(self.dumps(L, 1)), L) - self.assertEqual(self.id_count, 5) - self.assertEqual(self.load_count, 5) diff --git a/sys/lib/python/test/pyclbr_input.py b/sys/lib/python/test/pyclbr_input.py deleted file mode 100644 index 8efc9de75..000000000 --- a/sys/lib/python/test/pyclbr_input.py +++ /dev/null @@ -1,33 +0,0 @@ -"""Test cases for test_pyclbr.py""" - -def f(): pass - -class Other(object): - @classmethod - def foo(c): pass - - def om(self): pass - -class B (object): - def bm(self): pass - -class C (B): - foo = Other().foo - om = Other.om - - d = 10 - - # XXX: This causes test_pyclbr.py to fail, but only because the - # introspection-based is_method() code in the test can't - # distinguish between this and a geniune method function like m(). - # The pyclbr.py module gets this right as it parses the text. - # - #f = f - - def m(self): pass - - @staticmethod - def sm(self): pass - - @classmethod - def cm(self): pass diff --git a/sys/lib/python/test/pydocfodder.py b/sys/lib/python/test/pydocfodder.py deleted file mode 100644 index becdf2250..000000000 --- a/sys/lib/python/test/pydocfodder.py +++ /dev/null @@ -1,210 +0,0 @@ -"""Something just to look at via pydoc.""" - -class A_classic: - "A classic class." - def A_method(self): - "Method defined in A." - def AB_method(self): - "Method defined in A and B." - def AC_method(self): - "Method defined in A and C." - def AD_method(self): - "Method defined in A and D." - def ABC_method(self): - "Method defined in A, B and C." - def ABD_method(self): - "Method defined in A, B and D." - def ACD_method(self): - "Method defined in A, C and D." - def ABCD_method(self): - "Method defined in A, B, C and D." - - -class B_classic(A_classic): - "A classic class, derived from A_classic." - def AB_method(self): - "Method defined in A and B." - def ABC_method(self): - "Method defined in A, B and C." - def ABD_method(self): - "Method defined in A, B and D." - def ABCD_method(self): - "Method defined in A, B, C and D." - def B_method(self): - "Method defined in B." - def BC_method(self): - "Method defined in B and C." - def BD_method(self): - "Method defined in B and D." - def BCD_method(self): - "Method defined in B, C and D." - -class C_classic(A_classic): - "A classic class, derived from A_classic." - def AC_method(self): - "Method defined in A and C." - def ABC_method(self): - "Method defined in A, B and C." - def ACD_method(self): - "Method defined in A, C and D." - def ABCD_method(self): - "Method defined in A, B, C and D." - def BC_method(self): - "Method defined in B and C." - def BCD_method(self): - "Method defined in B, C and D." - def C_method(self): - "Method defined in C." - def CD_method(self): - "Method defined in C and D." - -class D_classic(B_classic, C_classic): - "A classic class, derived from B_classic and C_classic." - def AD_method(self): - "Method defined in A and D." - def ABD_method(self): - "Method defined in A, B and D." - def ACD_method(self): - "Method defined in A, C and D." - def ABCD_method(self): - "Method defined in A, B, C and D." - def BD_method(self): - "Method defined in B and D." - def BCD_method(self): - "Method defined in B, C and D." - def CD_method(self): - "Method defined in C and D." - def D_method(self): - "Method defined in D." - - -class A_new(object): - "A new-style class." - - def A_method(self): - "Method defined in A." - def AB_method(self): - "Method defined in A and B." - def AC_method(self): - "Method defined in A and C." - def AD_method(self): - "Method defined in A and D." - def ABC_method(self): - "Method defined in A, B and C." - def ABD_method(self): - "Method defined in A, B and D." - def ACD_method(self): - "Method defined in A, C and D." - def ABCD_method(self): - "Method defined in A, B, C and D." - - def A_classmethod(cls, x): - "A class method defined in A." - A_classmethod = classmethod(A_classmethod) - - def A_staticmethod(): - "A static method defined in A." - A_staticmethod = staticmethod(A_staticmethod) - - def _getx(self): - "A property getter function." - def _setx(self, value): - "A property setter function." - def _delx(self): - "A property deleter function." - A_property = property(fdel=_delx, fget=_getx, fset=_setx, - doc="A sample property defined in A.") - - A_int_alias = int - -class B_new(A_new): - "A new-style class, derived from A_new." - - def AB_method(self): - "Method defined in A and B." - def ABC_method(self): - "Method defined in A, B and C." - def ABD_method(self): - "Method defined in A, B and D." - def ABCD_method(self): - "Method defined in A, B, C and D." - def B_method(self): - "Method defined in B." - def BC_method(self): - "Method defined in B and C." - def BD_method(self): - "Method defined in B and D." - def BCD_method(self): - "Method defined in B, C and D." - -class C_new(A_new): - "A new-style class, derived from A_new." - - def AC_method(self): - "Method defined in A and C." - def ABC_method(self): - "Method defined in A, B and C." - def ACD_method(self): - "Method defined in A, C and D." - def ABCD_method(self): - "Method defined in A, B, C and D." - def BC_method(self): - "Method defined in B and C." - def BCD_method(self): - "Method defined in B, C and D." - def C_method(self): - "Method defined in C." - def CD_method(self): - "Method defined in C and D." - -class D_new(B_new, C_new): - """A new-style class, derived from B_new and C_new. - """ - - def AD_method(self): - "Method defined in A and D." - def ABD_method(self): - "Method defined in A, B and D." - def ACD_method(self): - "Method defined in A, C and D." - def ABCD_method(self): - "Method defined in A, B, C and D." - def BD_method(self): - "Method defined in B and D." - def BCD_method(self): - "Method defined in B, C and D." - def CD_method(self): - "Method defined in C and D." - def D_method(self): - "Method defined in D." - -class FunkyProperties(object): - """From SF bug 472347, by Roeland Rengelink. - - Property getters etc may not be vanilla functions or methods, - and this used to make GUI pydoc blow up. - """ - - def __init__(self): - self.desc = {'x':0} - - class get_desc: - def __init__(self, attr): - self.attr = attr - def __call__(self, inst): - print 'Get called', self, inst - return inst.desc[self.attr] - class set_desc: - def __init__(self, attr): - self.attr = attr - def __call__(self, inst, val): - print 'Set called', self, inst, val - inst.desc[self.attr] = val - class del_desc: - def __init__(self, attr): - self.attr = attr - def __call__(self, inst): - print 'Del called', self, inst - del inst.desc[self.attr] - - x = property(get_desc('x'), set_desc('x'), del_desc('x'), 'prop x') diff --git a/sys/lib/python/test/pystone.py b/sys/lib/python/test/pystone.py deleted file mode 100755 index 0a25981eb..000000000 --- a/sys/lib/python/test/pystone.py +++ /dev/null @@ -1,266 +0,0 @@ -#! /usr/bin/env python - -""" -"PYSTONE" Benchmark Program - -Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes) - -Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013. - - Translated from ADA to C by Rick Richardson. - Every method to preserve ADA-likeness has been used, - at the expense of C-ness. - - Translated from C to Python by Guido van Rossum. - -Version History: - - Version 1.1 corrects two bugs in version 1.0: - - First, it leaked memory: in Proc1(), NextRecord ends - up having a pointer to itself. I have corrected this - by zapping NextRecord.PtrComp at the end of Proc1(). - - Second, Proc3() used the operator != to compare a - record to None. This is rather inefficient and not - true to the intention of the original benchmark (where - a pointer comparison to None is intended; the != - operator attempts to find a method __cmp__ to do value - comparison of the record). Version 1.1 runs 5-10 - percent faster than version 1.0, so benchmark figures - of different versions can't be compared directly. - -""" - -LOOPS = 50000 - -from time import clock - -__version__ = "1.1" - -[Ident1, Ident2, Ident3, Ident4, Ident5] = range(1, 6) - -class Record: - - def __init__(self, PtrComp = None, Discr = 0, EnumComp = 0, - IntComp = 0, StringComp = 0): - self.PtrComp = PtrComp - self.Discr = Discr - self.EnumComp = EnumComp - self.IntComp = IntComp - self.StringComp = StringComp - - def copy(self): - return Record(self.PtrComp, self.Discr, self.EnumComp, - self.IntComp, self.StringComp) - -TRUE = 1 -FALSE = 0 - -def main(loops=LOOPS): - benchtime, stones = pystones(loops) - print "Pystone(%s) time for %d passes = %g" % \ - (__version__, loops, benchtime) - print "This machine benchmarks at %g pystones/second" % stones - - -def pystones(loops=LOOPS): - return Proc0(loops) - -IntGlob = 0 -BoolGlob = FALSE -Char1Glob = '\0' -Char2Glob = '\0' -Array1Glob = [0]*51 -Array2Glob = map(lambda x: x[:], [Array1Glob]*51) -PtrGlb = None -PtrGlbNext = None - -def Proc0(loops=LOOPS): - global IntGlob - global BoolGlob - global Char1Glob - global Char2Glob - global Array1Glob - global Array2Glob - global PtrGlb - global PtrGlbNext - - starttime = clock() - for i in range(loops): - pass - nulltime = clock() - starttime - - PtrGlbNext = Record() - PtrGlb = Record() - PtrGlb.PtrComp = PtrGlbNext - PtrGlb.Discr = Ident1 - PtrGlb.EnumComp = Ident3 - PtrGlb.IntComp = 40 - PtrGlb.StringComp = "DHRYSTONE PROGRAM, SOME STRING" - String1Loc = "DHRYSTONE PROGRAM, 1'ST STRING" - Array2Glob[8][7] = 10 - - starttime = clock() - - for i in range(loops): - Proc5() - Proc4() - IntLoc1 = 2 - IntLoc2 = 3 - String2Loc = "DHRYSTONE PROGRAM, 2'ND STRING" - EnumLoc = Ident2 - BoolGlob = not Func2(String1Loc, String2Loc) - while IntLoc1 < IntLoc2: - IntLoc3 = 5 * IntLoc1 - IntLoc2 - IntLoc3 = Proc7(IntLoc1, IntLoc2) - IntLoc1 = IntLoc1 + 1 - Proc8(Array1Glob, Array2Glob, IntLoc1, IntLoc3) - PtrGlb = Proc1(PtrGlb) - CharIndex = 'A' - while CharIndex <= Char2Glob: - if EnumLoc == Func1(CharIndex, 'C'): - EnumLoc = Proc6(Ident1) - CharIndex = chr(ord(CharIndex)+1) - IntLoc3 = IntLoc2 * IntLoc1 - IntLoc2 = IntLoc3 / IntLoc1 - IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1 - IntLoc1 = Proc2(IntLoc1) - - benchtime = clock() - starttime - nulltime - return benchtime, (loops / benchtime) - -def Proc1(PtrParIn): - PtrParIn.PtrComp = NextRecord = PtrGlb.copy() - PtrParIn.IntComp = 5 - NextRecord.IntComp = PtrParIn.IntComp - NextRecord.PtrComp = PtrParIn.PtrComp - NextRecord.PtrComp = Proc3(NextRecord.PtrComp) - if NextRecord.Discr == Ident1: - NextRecord.IntComp = 6 - NextRecord.EnumComp = Proc6(PtrParIn.EnumComp) - NextRecord.PtrComp = PtrGlb.PtrComp - NextRecord.IntComp = Proc7(NextRecord.IntComp, 10) - else: - PtrParIn = NextRecord.copy() - NextRecord.PtrComp = None - return PtrParIn - -def Proc2(IntParIO): - IntLoc = IntParIO + 10 - while 1: - if Char1Glob == 'A': - IntLoc = IntLoc - 1 - IntParIO = IntLoc - IntGlob - EnumLoc = Ident1 - if EnumLoc == Ident1: - break - return IntParIO - -def Proc3(PtrParOut): - global IntGlob - - if PtrGlb is not None: - PtrParOut = PtrGlb.PtrComp - else: - IntGlob = 100 - PtrGlb.IntComp = Proc7(10, IntGlob) - return PtrParOut - -def Proc4(): - global Char2Glob - - BoolLoc = Char1Glob == 'A' - BoolLoc = BoolLoc or BoolGlob - Char2Glob = 'B' - -def Proc5(): - global Char1Glob - global BoolGlob - - Char1Glob = 'A' - BoolGlob = FALSE - -def Proc6(EnumParIn): - EnumParOut = EnumParIn - if not Func3(EnumParIn): - EnumParOut = Ident4 - if EnumParIn == Ident1: - EnumParOut = Ident1 - elif EnumParIn == Ident2: - if IntGlob > 100: - EnumParOut = Ident1 - else: - EnumParOut = Ident4 - elif EnumParIn == Ident3: - EnumParOut = Ident2 - elif EnumParIn == Ident4: - pass - elif EnumParIn == Ident5: - EnumParOut = Ident3 - return EnumParOut - -def Proc7(IntParI1, IntParI2): - IntLoc = IntParI1 + 2 - IntParOut = IntParI2 + IntLoc - return IntParOut - -def Proc8(Array1Par, Array2Par, IntParI1, IntParI2): - global IntGlob - - IntLoc = IntParI1 + 5 - Array1Par[IntLoc] = IntParI2 - Array1Par[IntLoc+1] = Array1Par[IntLoc] - Array1Par[IntLoc+30] = IntLoc - for IntIndex in range(IntLoc, IntLoc+2): - Array2Par[IntLoc][IntIndex] = IntLoc - Array2Par[IntLoc][IntLoc-1] = Array2Par[IntLoc][IntLoc-1] + 1 - Array2Par[IntLoc+20][IntLoc] = Array1Par[IntLoc] - IntGlob = 5 - -def Func1(CharPar1, CharPar2): - CharLoc1 = CharPar1 - CharLoc2 = CharLoc1 - if CharLoc2 != CharPar2: - return Ident1 - else: - return Ident2 - -def Func2(StrParI1, StrParI2): - IntLoc = 1 - while IntLoc <= 1: - if Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1: - CharLoc = 'A' - IntLoc = IntLoc + 1 - if CharLoc >= 'W' and CharLoc <= 'Z': - IntLoc = 7 - if CharLoc == 'X': - return TRUE - else: - if StrParI1 > StrParI2: - IntLoc = IntLoc + 7 - return TRUE - else: - return FALSE - -def Func3(EnumParIn): - EnumLoc = EnumParIn - if EnumLoc == Ident3: return TRUE - return FALSE - -if __name__ == '__main__': - import sys - def error(msg): - print >>sys.stderr, msg, - print >>sys.stderr, "usage: %s [number_of_loops]" % sys.argv[0] - sys.exit(100) - nargs = len(sys.argv) - 1 - if nargs > 1: - error("%d arguments are too many;" % nargs) - elif nargs == 1: - try: loops = int(sys.argv[1]) - except ValueError: - error("Invalid argument %r;" % sys.argv[1]) - else: - loops = LOOPS - main(loops) diff --git a/sys/lib/python/test/re_tests.py b/sys/lib/python/test/re_tests.py deleted file mode 100755 index 25b1229d6..000000000 --- a/sys/lib/python/test/re_tests.py +++ /dev/null @@ -1,674 +0,0 @@ -#!/usr/bin/env python -# -*- mode: python -*- - -# Re test suite and benchmark suite v1.5 - -# The 3 possible outcomes for each pattern -[SUCCEED, FAIL, SYNTAX_ERROR] = range(3) - -# Benchmark suite (needs expansion) -# -# The benchmark suite does not test correctness, just speed. The -# first element of each tuple is the regex pattern; the second is a -# string to match it against. The benchmarking code will embed the -# second string inside several sizes of padding, to test how regex -# matching performs on large strings. - -benchmarks = [ - - # test common prefix - ('Python|Perl', 'Perl'), # Alternation - ('(Python|Perl)', 'Perl'), # Grouped alternation - - ('Python|Perl|Tcl', 'Perl'), # Alternation - ('(Python|Perl|Tcl)', 'Perl'), # Grouped alternation - - ('(Python)\\1', 'PythonPython'), # Backreference - ('([0a-z][a-z0-9]*,)+', 'a5,b7,c9,'), # Disable the fastmap optimization - ('([a-z][a-z0-9]*,)+', 'a5,b7,c9,'), # A few sets - - ('Python', 'Python'), # Simple text literal - ('.*Python', 'Python'), # Bad text literal - ('.*Python.*', 'Python'), # Worse text literal - ('.*(Python)', 'Python'), # Bad text literal with grouping - -] - -# Test suite (for verifying correctness) -# -# The test suite is a list of 5- or 3-tuples. The 5 parts of a -# complete tuple are: -# element 0: a string containing the pattern -# 1: the string to match against the pattern -# 2: the expected result (SUCCEED, FAIL, SYNTAX_ERROR) -# 3: a string that will be eval()'ed to produce a test string. -# This is an arbitrary Python expression; the available -# variables are "found" (the whole match), and "g1", "g2", ... -# up to "g99" contain the contents of each group, or the -# string 'None' if the group wasn't given a value, or the -# string 'Error' if the group index was out of range; -# also "groups", the return value of m.group() (a tuple). -# 4: The expected result of evaluating the expression. -# If the two don't match, an error is reported. -# -# If the regex isn't expected to work, the latter two elements can be omitted. - -tests = [ - # Test ?P< and ?P= extensions - ('(?Pa)', '', SYNTAX_ERROR), # Begins with a digit - ('(?Pa)', '', SYNTAX_ERROR), # Begins with an illegal char - ('(?Pa)', '', SYNTAX_ERROR), # Begins with an illegal char - - # Same tests, for the ?P= form - ('(?Pa)(?P=foo_123', 'aa', SYNTAX_ERROR), - ('(?Pa)(?P=1)', 'aa', SYNTAX_ERROR), - ('(?Pa)(?P=!)', 'aa', SYNTAX_ERROR), - ('(?Pa)(?P=foo_124', 'aa', SYNTAX_ERROR), # Backref to undefined group - - ('(?Pa)', 'a', SUCCEED, 'g1', 'a'), - ('(?Pa)(?P=foo_123)', 'aa', SUCCEED, 'g1', 'a'), - - # Test octal escapes - ('\\1', 'a', SYNTAX_ERROR), # Backreference - ('[\\1]', '\1', SUCCEED, 'found', '\1'), # Character - ('\\09', chr(0) + '9', SUCCEED, 'found', chr(0) + '9'), - ('\\141', 'a', SUCCEED, 'found', 'a'), - ('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k'), - - # Test \0 is handled everywhere - (r'\0', '\0', SUCCEED, 'found', '\0'), - (r'[\0a]', '\0', SUCCEED, 'found', '\0'), - (r'[a\0]', '\0', SUCCEED, 'found', '\0'), - (r'[^a\0]', '\0', FAIL), - - # Test various letter escapes - (r'\a[\b]\f\n\r\t\v', '\a\b\f\n\r\t\v', SUCCEED, 'found', '\a\b\f\n\r\t\v'), - (r'[\a][\b][\f][\n][\r][\t][\v]', '\a\b\f\n\r\t\v', SUCCEED, 'found', '\a\b\f\n\r\t\v'), - # NOTE: not an error under PCRE/PRE: - # (r'\u', '', SYNTAX_ERROR), # A Perl escape - (r'\c\e\g\h\i\j\k\m\o\p\q\y\z', 'ceghijkmopqyz', SUCCEED, 'found', 'ceghijkmopqyz'), - (r'\xff', '\377', SUCCEED, 'found', chr(255)), - # new \x semantics - (r'\x00ffffffffffffff', '\377', FAIL, 'found', chr(255)), - (r'\x00f', '\017', FAIL, 'found', chr(15)), - (r'\x00fe', '\376', FAIL, 'found', chr(254)), - # (r'\x00ffffffffffffff', '\377', SUCCEED, 'found', chr(255)), - # (r'\x00f', '\017', SUCCEED, 'found', chr(15)), - # (r'\x00fe', '\376', SUCCEED, 'found', chr(254)), - - (r"^\w+=(\\[\000-\277]|[^\n\\])*", "SRC=eval.c g.c blah blah blah \\\\\n\tapes.c", - SUCCEED, 'found', "SRC=eval.c g.c blah blah blah \\\\"), - - # Test that . only matches \n in DOTALL mode - ('a.b', 'acb', SUCCEED, 'found', 'acb'), - ('a.b', 'a\nb', FAIL), - ('a.*b', 'acc\nccb', FAIL), - ('a.{4,5}b', 'acc\nccb', FAIL), - ('a.b', 'a\rb', SUCCEED, 'found', 'a\rb'), - ('a.b(?s)', 'a\nb', SUCCEED, 'found', 'a\nb'), - ('a.*(?s)b', 'acc\nccb', SUCCEED, 'found', 'acc\nccb'), - ('(?s)a.{4,5}b', 'acc\nccb', SUCCEED, 'found', 'acc\nccb'), - ('(?s)a.b', 'a\nb', SUCCEED, 'found', 'a\nb'), - - (')', '', SYNTAX_ERROR), # Unmatched right bracket - ('', '', SUCCEED, 'found', ''), # Empty pattern - ('abc', 'abc', SUCCEED, 'found', 'abc'), - ('abc', 'xbc', FAIL), - ('abc', 'axc', FAIL), - ('abc', 'abx', FAIL), - ('abc', 'xabcy', SUCCEED, 'found', 'abc'), - ('abc', 'ababc', SUCCEED, 'found', 'abc'), - ('ab*c', 'abc', SUCCEED, 'found', 'abc'), - ('ab*bc', 'abc', SUCCEED, 'found', 'abc'), - ('ab*bc', 'abbc', SUCCEED, 'found', 'abbc'), - ('ab*bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'), - ('ab+bc', 'abbc', SUCCEED, 'found', 'abbc'), - ('ab+bc', 'abc', FAIL), - ('ab+bc', 'abq', FAIL), - ('ab+bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'), - ('ab?bc', 'abbc', SUCCEED, 'found', 'abbc'), - ('ab?bc', 'abc', SUCCEED, 'found', 'abc'), - ('ab?bc', 'abbbbc', FAIL), - ('ab?c', 'abc', SUCCEED, 'found', 'abc'), - ('^abc$', 'abc', SUCCEED, 'found', 'abc'), - ('^abc$', 'abcc', FAIL), - ('^abc', 'abcc', SUCCEED, 'found', 'abc'), - ('^abc$', 'aabc', FAIL), - ('abc$', 'aabc', SUCCEED, 'found', 'abc'), - ('^', 'abc', SUCCEED, 'found+"-"', '-'), - ('$', 'abc', SUCCEED, 'found+"-"', '-'), - ('a.c', 'abc', SUCCEED, 'found', 'abc'), - ('a.c', 'axc', SUCCEED, 'found', 'axc'), - ('a.*c', 'axyzc', SUCCEED, 'found', 'axyzc'), - ('a.*c', 'axyzd', FAIL), - ('a[bc]d', 'abc', FAIL), - ('a[bc]d', 'abd', SUCCEED, 'found', 'abd'), - ('a[b-d]e', 'abd', FAIL), - ('a[b-d]e', 'ace', SUCCEED, 'found', 'ace'), - ('a[b-d]', 'aac', SUCCEED, 'found', 'ac'), - ('a[-b]', 'a-', SUCCEED, 'found', 'a-'), - ('a[\\-b]', 'a-', SUCCEED, 'found', 'a-'), - # NOTE: not an error under PCRE/PRE: - # ('a[b-]', 'a-', SYNTAX_ERROR), - ('a[]b', '-', SYNTAX_ERROR), - ('a[', '-', SYNTAX_ERROR), - ('a\\', '-', SYNTAX_ERROR), - ('abc)', '-', SYNTAX_ERROR), - ('(abc', '-', SYNTAX_ERROR), - ('a]', 'a]', SUCCEED, 'found', 'a]'), - ('a[]]b', 'a]b', SUCCEED, 'found', 'a]b'), - ('a[\]]b', 'a]b', SUCCEED, 'found', 'a]b'), - ('a[^bc]d', 'aed', SUCCEED, 'found', 'aed'), - ('a[^bc]d', 'abd', FAIL), - ('a[^-b]c', 'adc', SUCCEED, 'found', 'adc'), - ('a[^-b]c', 'a-c', FAIL), - ('a[^]b]c', 'a]c', FAIL), - ('a[^]b]c', 'adc', SUCCEED, 'found', 'adc'), - ('\\ba\\b', 'a-', SUCCEED, '"-"', '-'), - ('\\ba\\b', '-a', SUCCEED, '"-"', '-'), - ('\\ba\\b', '-a-', SUCCEED, '"-"', '-'), - ('\\by\\b', 'xy', FAIL), - ('\\by\\b', 'yz', FAIL), - ('\\by\\b', 'xyz', FAIL), - ('x\\b', 'xyz', FAIL), - ('x\\B', 'xyz', SUCCEED, '"-"', '-'), - ('\\Bz', 'xyz', SUCCEED, '"-"', '-'), - ('z\\B', 'xyz', FAIL), - ('\\Bx', 'xyz', FAIL), - ('\\Ba\\B', 'a-', FAIL, '"-"', '-'), - ('\\Ba\\B', '-a', FAIL, '"-"', '-'), - ('\\Ba\\B', '-a-', FAIL, '"-"', '-'), - ('\\By\\B', 'xy', FAIL), - ('\\By\\B', 'yz', FAIL), - ('\\By\\b', 'xy', SUCCEED, '"-"', '-'), - ('\\by\\B', 'yz', SUCCEED, '"-"', '-'), - ('\\By\\B', 'xyz', SUCCEED, '"-"', '-'), - ('ab|cd', 'abc', SUCCEED, 'found', 'ab'), - ('ab|cd', 'abcd', SUCCEED, 'found', 'ab'), - ('()ef', 'def', SUCCEED, 'found+"-"+g1', 'ef-'), - ('$b', 'b', FAIL), - ('a\\(b', 'a(b', SUCCEED, 'found+"-"+g1', 'a(b-Error'), - ('a\\(*b', 'ab', SUCCEED, 'found', 'ab'), - ('a\\(*b', 'a((b', SUCCEED, 'found', 'a((b'), - ('a\\\\b', 'a\\b', SUCCEED, 'found', 'a\\b'), - ('((a))', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'a-a-a'), - ('(a)b(c)', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'abc-a-c'), - ('a+b+c', 'aabbabc', SUCCEED, 'found', 'abc'), - ('(a+|b)*', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'), - ('(a+|b)+', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'), - ('(a+|b)?', 'ab', SUCCEED, 'found+"-"+g1', 'a-a'), - (')(', '-', SYNTAX_ERROR), - ('[^ab]*', 'cde', SUCCEED, 'found', 'cde'), - ('abc', '', FAIL), - ('a*', '', SUCCEED, 'found', ''), - ('a|b|c|d|e', 'e', SUCCEED, 'found', 'e'), - ('(a|b|c|d|e)f', 'ef', SUCCEED, 'found+"-"+g1', 'ef-e'), - ('abcd*efg', 'abcdefg', SUCCEED, 'found', 'abcdefg'), - ('ab*', 'xabyabbbz', SUCCEED, 'found', 'ab'), - ('ab*', 'xayabbbz', SUCCEED, 'found', 'a'), - ('(ab|cd)e', 'abcde', SUCCEED, 'found+"-"+g1', 'cde-cd'), - ('[abhgefdc]ij', 'hij', SUCCEED, 'found', 'hij'), - ('^(ab|cd)e', 'abcde', FAIL, 'xg1y', 'xy'), - ('(abc|)ef', 'abcdef', SUCCEED, 'found+"-"+g1', 'ef-'), - ('(a|b)c*d', 'abcd', SUCCEED, 'found+"-"+g1', 'bcd-b'), - ('(ab|ab*)bc', 'abc', SUCCEED, 'found+"-"+g1', 'abc-a'), - ('a([bc]*)c*', 'abc', SUCCEED, 'found+"-"+g1', 'abc-bc'), - ('a([bc]*)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), - ('a([bc]+)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), - ('a([bc]*)(c+d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-b-cd'), - ('a[bcd]*dcdcde', 'adcdcde', SUCCEED, 'found', 'adcdcde'), - ('a[bcd]+dcdcde', 'adcdcde', FAIL), - ('(ab|a)b*c', 'abc', SUCCEED, 'found+"-"+g1', 'abc-ab'), - ('((a)(b)c)(d)', 'abcd', SUCCEED, 'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'), - ('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED, 'found', 'alpha'), - ('^a(bc+|b[eh])g|.h$', 'abh', SUCCEED, 'found+"-"+g1', 'bh-None'), - ('(bc+d$|ef*g.|h?i(j|k))', 'effgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), - ('(bc+d$|ef*g.|h?i(j|k))', 'ij', SUCCEED, 'found+"-"+g1+"-"+g2', 'ij-ij-j'), - ('(bc+d$|ef*g.|h?i(j|k))', 'effg', FAIL), - ('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', FAIL), - ('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), - ('(((((((((a)))))))))', 'a', SUCCEED, 'found', 'a'), - ('multiple words of text', 'uh-uh', FAIL), - ('multiple words', 'multiple words, yeah', SUCCEED, 'found', 'multiple words'), - ('(.*)c(.*)', 'abcde', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcde-ab-de'), - ('\\((.*), (.*)\\)', '(a, b)', SUCCEED, 'g2+"-"+g1', 'b-a'), - ('[k]', 'ab', FAIL), - ('a[-]?c', 'ac', SUCCEED, 'found', 'ac'), - ('(abc)\\1', 'abcabc', SUCCEED, 'g1', 'abc'), - ('([a-c]*)\\1', 'abcabc', SUCCEED, 'g1', 'abc'), - ('^(.+)?B', 'AB', SUCCEED, 'g1', 'A'), - ('(a+).\\1$', 'aaaaa', SUCCEED, 'found+"-"+g1', 'aaaaa-aa'), - ('^(a+).\\1$', 'aaaa', FAIL), - ('(abc)\\1', 'abcabc', SUCCEED, 'found+"-"+g1', 'abcabc-abc'), - ('([a-c]+)\\1', 'abcabc', SUCCEED, 'found+"-"+g1', 'abcabc-abc'), - ('(a)\\1', 'aa', SUCCEED, 'found+"-"+g1', 'aa-a'), - ('(a+)\\1', 'aa', SUCCEED, 'found+"-"+g1', 'aa-a'), - ('(a+)+\\1', 'aa', SUCCEED, 'found+"-"+g1', 'aa-a'), - ('(a).+\\1', 'aba', SUCCEED, 'found+"-"+g1', 'aba-a'), - ('(a)ba*\\1', 'aba', SUCCEED, 'found+"-"+g1', 'aba-a'), - ('(aa|a)a\\1$', 'aaa', SUCCEED, 'found+"-"+g1', 'aaa-a'), - ('(a|aa)a\\1$', 'aaa', SUCCEED, 'found+"-"+g1', 'aaa-a'), - ('(a+)a\\1$', 'aaa', SUCCEED, 'found+"-"+g1', 'aaa-a'), - ('([abc]*)\\1', 'abcabc', SUCCEED, 'found+"-"+g1', 'abcabc-abc'), - ('(a)(b)c|ab', 'ab', SUCCEED, 'found+"-"+g1+"-"+g2', 'ab-None-None'), - ('(a)+x', 'aaax', SUCCEED, 'found+"-"+g1', 'aaax-a'), - ('([ac])+x', 'aacx', SUCCEED, 'found+"-"+g1', 'aacx-c'), - ('([^/]*/)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', SUCCEED, 'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/'), - ('([^.]*)\\.([^:]*):[T ]+(.*)', 'track1.title:TBlah blah blah', SUCCEED, 'found+"-"+g1+"-"+g2+"-"+g3', 'track1.title:TBlah blah blah-track1-title-Blah blah blah'), - ('([^N]*N)+', 'abNNxyzN', SUCCEED, 'found+"-"+g1', 'abNNxyzN-xyzN'), - ('([^N]*N)+', 'abNNxyz', SUCCEED, 'found+"-"+g1', 'abNN-N'), - ('([abc]*)x', 'abcx', SUCCEED, 'found+"-"+g1', 'abcx-abc'), - ('([abc]*)x', 'abc', FAIL), - ('([xyz]*)x', 'abcx', SUCCEED, 'found+"-"+g1', 'x-'), - ('(a)+b|aac', 'aac', SUCCEED, 'found+"-"+g1', 'aac-None'), - - # Test symbolic groups - - ('(?Paaa)a', 'aaaa', SYNTAX_ERROR), - ('(?Paaa)a', 'aaaa', SUCCEED, 'found+"-"+id', 'aaaa-aaa'), - ('(?Paa)(?P=id)', 'aaaa', SUCCEED, 'found+"-"+id', 'aaaa-aa'), - ('(?Paa)(?P=xd)', 'aaaa', SYNTAX_ERROR), - - # Test octal escapes/memory references - - ('\\1', 'a', SYNTAX_ERROR), - ('\\09', chr(0) + '9', SUCCEED, 'found', chr(0) + '9'), - ('\\141', 'a', SUCCEED, 'found', 'a'), - ('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k'), - - # All tests from Perl - - ('abc', 'abc', SUCCEED, 'found', 'abc'), - ('abc', 'xbc', FAIL), - ('abc', 'axc', FAIL), - ('abc', 'abx', FAIL), - ('abc', 'xabcy', SUCCEED, 'found', 'abc'), - ('abc', 'ababc', SUCCEED, 'found', 'abc'), - ('ab*c', 'abc', SUCCEED, 'found', 'abc'), - ('ab*bc', 'abc', SUCCEED, 'found', 'abc'), - ('ab*bc', 'abbc', SUCCEED, 'found', 'abbc'), - ('ab*bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'), - ('ab{0,}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'), - ('ab+bc', 'abbc', SUCCEED, 'found', 'abbc'), - ('ab+bc', 'abc', FAIL), - ('ab+bc', 'abq', FAIL), - ('ab{1,}bc', 'abq', FAIL), - ('ab+bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'), - ('ab{1,}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'), - ('ab{1,3}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'), - ('ab{3,4}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'), - ('ab{4,5}bc', 'abbbbc', FAIL), - ('ab?bc', 'abbc', SUCCEED, 'found', 'abbc'), - ('ab?bc', 'abc', SUCCEED, 'found', 'abc'), - ('ab{0,1}bc', 'abc', SUCCEED, 'found', 'abc'), - ('ab?bc', 'abbbbc', FAIL), - ('ab?c', 'abc', SUCCEED, 'found', 'abc'), - ('ab{0,1}c', 'abc', SUCCEED, 'found', 'abc'), - ('^abc$', 'abc', SUCCEED, 'found', 'abc'), - ('^abc$', 'abcc', FAIL), - ('^abc', 'abcc', SUCCEED, 'found', 'abc'), - ('^abc$', 'aabc', FAIL), - ('abc$', 'aabc', SUCCEED, 'found', 'abc'), - ('^', 'abc', SUCCEED, 'found', ''), - ('$', 'abc', SUCCEED, 'found', ''), - ('a.c', 'abc', SUCCEED, 'found', 'abc'), - ('a.c', 'axc', SUCCEED, 'found', 'axc'), - ('a.*c', 'axyzc', SUCCEED, 'found', 'axyzc'), - ('a.*c', 'axyzd', FAIL), - ('a[bc]d', 'abc', FAIL), - ('a[bc]d', 'abd', SUCCEED, 'found', 'abd'), - ('a[b-d]e', 'abd', FAIL), - ('a[b-d]e', 'ace', SUCCEED, 'found', 'ace'), - ('a[b-d]', 'aac', SUCCEED, 'found', 'ac'), - ('a[-b]', 'a-', SUCCEED, 'found', 'a-'), - ('a[b-]', 'a-', SUCCEED, 'found', 'a-'), - ('a[b-a]', '-', SYNTAX_ERROR), - ('a[]b', '-', SYNTAX_ERROR), - ('a[', '-', SYNTAX_ERROR), - ('a]', 'a]', SUCCEED, 'found', 'a]'), - ('a[]]b', 'a]b', SUCCEED, 'found', 'a]b'), - ('a[^bc]d', 'aed', SUCCEED, 'found', 'aed'), - ('a[^bc]d', 'abd', FAIL), - ('a[^-b]c', 'adc', SUCCEED, 'found', 'adc'), - ('a[^-b]c', 'a-c', FAIL), - ('a[^]b]c', 'a]c', FAIL), - ('a[^]b]c', 'adc', SUCCEED, 'found', 'adc'), - ('ab|cd', 'abc', SUCCEED, 'found', 'ab'), - ('ab|cd', 'abcd', SUCCEED, 'found', 'ab'), - ('()ef', 'def', SUCCEED, 'found+"-"+g1', 'ef-'), - ('*a', '-', SYNTAX_ERROR), - ('(*)b', '-', SYNTAX_ERROR), - ('$b', 'b', FAIL), - ('a\\', '-', SYNTAX_ERROR), - ('a\\(b', 'a(b', SUCCEED, 'found+"-"+g1', 'a(b-Error'), - ('a\\(*b', 'ab', SUCCEED, 'found', 'ab'), - ('a\\(*b', 'a((b', SUCCEED, 'found', 'a((b'), - ('a\\\\b', 'a\\b', SUCCEED, 'found', 'a\\b'), - ('abc)', '-', SYNTAX_ERROR), - ('(abc', '-', SYNTAX_ERROR), - ('((a))', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'a-a-a'), - ('(a)b(c)', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'abc-a-c'), - ('a+b+c', 'aabbabc', SUCCEED, 'found', 'abc'), - ('a{1,}b{1,}c', 'aabbabc', SUCCEED, 'found', 'abc'), - ('a**', '-', SYNTAX_ERROR), - ('a.+?c', 'abcabc', SUCCEED, 'found', 'abc'), - ('(a+|b)*', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'), - ('(a+|b){0,}', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'), - ('(a+|b)+', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'), - ('(a+|b){1,}', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'), - ('(a+|b)?', 'ab', SUCCEED, 'found+"-"+g1', 'a-a'), - ('(a+|b){0,1}', 'ab', SUCCEED, 'found+"-"+g1', 'a-a'), - (')(', '-', SYNTAX_ERROR), - ('[^ab]*', 'cde', SUCCEED, 'found', 'cde'), - ('abc', '', FAIL), - ('a*', '', SUCCEED, 'found', ''), - ('([abc])*d', 'abbbcd', SUCCEED, 'found+"-"+g1', 'abbbcd-c'), - ('([abc])*bcd', 'abcd', SUCCEED, 'found+"-"+g1', 'abcd-a'), - ('a|b|c|d|e', 'e', SUCCEED, 'found', 'e'), - ('(a|b|c|d|e)f', 'ef', SUCCEED, 'found+"-"+g1', 'ef-e'), - ('abcd*efg', 'abcdefg', SUCCEED, 'found', 'abcdefg'), - ('ab*', 'xabyabbbz', SUCCEED, 'found', 'ab'), - ('ab*', 'xayabbbz', SUCCEED, 'found', 'a'), - ('(ab|cd)e', 'abcde', SUCCEED, 'found+"-"+g1', 'cde-cd'), - ('[abhgefdc]ij', 'hij', SUCCEED, 'found', 'hij'), - ('^(ab|cd)e', 'abcde', FAIL), - ('(abc|)ef', 'abcdef', SUCCEED, 'found+"-"+g1', 'ef-'), - ('(a|b)c*d', 'abcd', SUCCEED, 'found+"-"+g1', 'bcd-b'), - ('(ab|ab*)bc', 'abc', SUCCEED, 'found+"-"+g1', 'abc-a'), - ('a([bc]*)c*', 'abc', SUCCEED, 'found+"-"+g1', 'abc-bc'), - ('a([bc]*)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), - ('a([bc]+)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), - ('a([bc]*)(c+d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-b-cd'), - ('a[bcd]*dcdcde', 'adcdcde', SUCCEED, 'found', 'adcdcde'), - ('a[bcd]+dcdcde', 'adcdcde', FAIL), - ('(ab|a)b*c', 'abc', SUCCEED, 'found+"-"+g1', 'abc-ab'), - ('((a)(b)c)(d)', 'abcd', SUCCEED, 'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'), - ('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED, 'found', 'alpha'), - ('^a(bc+|b[eh])g|.h$', 'abh', SUCCEED, 'found+"-"+g1', 'bh-None'), - ('(bc+d$|ef*g.|h?i(j|k))', 'effgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), - ('(bc+d$|ef*g.|h?i(j|k))', 'ij', SUCCEED, 'found+"-"+g1+"-"+g2', 'ij-ij-j'), - ('(bc+d$|ef*g.|h?i(j|k))', 'effg', FAIL), - ('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', FAIL), - ('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), - ('((((((((((a))))))))))', 'a', SUCCEED, 'g10', 'a'), - ('((((((((((a))))))))))\\10', 'aa', SUCCEED, 'found', 'aa'), -# Python does not have the same rules for \\41 so this is a syntax error -# ('((((((((((a))))))))))\\41', 'aa', FAIL), -# ('((((((((((a))))))))))\\41', 'a!', SUCCEED, 'found', 'a!'), - ('((((((((((a))))))))))\\41', '', SYNTAX_ERROR), - ('(?i)((((((((((a))))))))))\\41', '', SYNTAX_ERROR), - ('(((((((((a)))))))))', 'a', SUCCEED, 'found', 'a'), - ('multiple words of text', 'uh-uh', FAIL), - ('multiple words', 'multiple words, yeah', SUCCEED, 'found', 'multiple words'), - ('(.*)c(.*)', 'abcde', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcde-ab-de'), - ('\\((.*), (.*)\\)', '(a, b)', SUCCEED, 'g2+"-"+g1', 'b-a'), - ('[k]', 'ab', FAIL), - ('a[-]?c', 'ac', SUCCEED, 'found', 'ac'), - ('(abc)\\1', 'abcabc', SUCCEED, 'g1', 'abc'), - ('([a-c]*)\\1', 'abcabc', SUCCEED, 'g1', 'abc'), - ('(?i)abc', 'ABC', SUCCEED, 'found', 'ABC'), - ('(?i)abc', 'XBC', FAIL), - ('(?i)abc', 'AXC', FAIL), - ('(?i)abc', 'ABX', FAIL), - ('(?i)abc', 'XABCY', SUCCEED, 'found', 'ABC'), - ('(?i)abc', 'ABABC', SUCCEED, 'found', 'ABC'), - ('(?i)ab*c', 'ABC', SUCCEED, 'found', 'ABC'), - ('(?i)ab*bc', 'ABC', SUCCEED, 'found', 'ABC'), - ('(?i)ab*bc', 'ABBC', SUCCEED, 'found', 'ABBC'), - ('(?i)ab*?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'), - ('(?i)ab{0,}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'), - ('(?i)ab+?bc', 'ABBC', SUCCEED, 'found', 'ABBC'), - ('(?i)ab+bc', 'ABC', FAIL), - ('(?i)ab+bc', 'ABQ', FAIL), - ('(?i)ab{1,}bc', 'ABQ', FAIL), - ('(?i)ab+bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'), - ('(?i)ab{1,}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'), - ('(?i)ab{1,3}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'), - ('(?i)ab{3,4}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'), - ('(?i)ab{4,5}?bc', 'ABBBBC', FAIL), - ('(?i)ab??bc', 'ABBC', SUCCEED, 'found', 'ABBC'), - ('(?i)ab??bc', 'ABC', SUCCEED, 'found', 'ABC'), - ('(?i)ab{0,1}?bc', 'ABC', SUCCEED, 'found', 'ABC'), - ('(?i)ab??bc', 'ABBBBC', FAIL), - ('(?i)ab??c', 'ABC', SUCCEED, 'found', 'ABC'), - ('(?i)ab{0,1}?c', 'ABC', SUCCEED, 'found', 'ABC'), - ('(?i)^abc$', 'ABC', SUCCEED, 'found', 'ABC'), - ('(?i)^abc$', 'ABCC', FAIL), - ('(?i)^abc', 'ABCC', SUCCEED, 'found', 'ABC'), - ('(?i)^abc$', 'AABC', FAIL), - ('(?i)abc$', 'AABC', SUCCEED, 'found', 'ABC'), - ('(?i)^', 'ABC', SUCCEED, 'found', ''), - ('(?i)$', 'ABC', SUCCEED, 'found', ''), - ('(?i)a.c', 'ABC', SUCCEED, 'found', 'ABC'), - ('(?i)a.c', 'AXC', SUCCEED, 'found', 'AXC'), - ('(?i)a.*?c', 'AXYZC', SUCCEED, 'found', 'AXYZC'), - ('(?i)a.*c', 'AXYZD', FAIL), - ('(?i)a[bc]d', 'ABC', FAIL), - ('(?i)a[bc]d', 'ABD', SUCCEED, 'found', 'ABD'), - ('(?i)a[b-d]e', 'ABD', FAIL), - ('(?i)a[b-d]e', 'ACE', SUCCEED, 'found', 'ACE'), - ('(?i)a[b-d]', 'AAC', SUCCEED, 'found', 'AC'), - ('(?i)a[-b]', 'A-', SUCCEED, 'found', 'A-'), - ('(?i)a[b-]', 'A-', SUCCEED, 'found', 'A-'), - ('(?i)a[b-a]', '-', SYNTAX_ERROR), - ('(?i)a[]b', '-', SYNTAX_ERROR), - ('(?i)a[', '-', SYNTAX_ERROR), - ('(?i)a]', 'A]', SUCCEED, 'found', 'A]'), - ('(?i)a[]]b', 'A]B', SUCCEED, 'found', 'A]B'), - ('(?i)a[^bc]d', 'AED', SUCCEED, 'found', 'AED'), - ('(?i)a[^bc]d', 'ABD', FAIL), - ('(?i)a[^-b]c', 'ADC', SUCCEED, 'found', 'ADC'), - ('(?i)a[^-b]c', 'A-C', FAIL), - ('(?i)a[^]b]c', 'A]C', FAIL), - ('(?i)a[^]b]c', 'ADC', SUCCEED, 'found', 'ADC'), - ('(?i)ab|cd', 'ABC', SUCCEED, 'found', 'AB'), - ('(?i)ab|cd', 'ABCD', SUCCEED, 'found', 'AB'), - ('(?i)()ef', 'DEF', SUCCEED, 'found+"-"+g1', 'EF-'), - ('(?i)*a', '-', SYNTAX_ERROR), - ('(?i)(*)b', '-', SYNTAX_ERROR), - ('(?i)$b', 'B', FAIL), - ('(?i)a\\', '-', SYNTAX_ERROR), - ('(?i)a\\(b', 'A(B', SUCCEED, 'found+"-"+g1', 'A(B-Error'), - ('(?i)a\\(*b', 'AB', SUCCEED, 'found', 'AB'), - ('(?i)a\\(*b', 'A((B', SUCCEED, 'found', 'A((B'), - ('(?i)a\\\\b', 'A\\B', SUCCEED, 'found', 'A\\B'), - ('(?i)abc)', '-', SYNTAX_ERROR), - ('(?i)(abc', '-', SYNTAX_ERROR), - ('(?i)((a))', 'ABC', SUCCEED, 'found+"-"+g1+"-"+g2', 'A-A-A'), - ('(?i)(a)b(c)', 'ABC', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABC-A-C'), - ('(?i)a+b+c', 'AABBABC', SUCCEED, 'found', 'ABC'), - ('(?i)a{1,}b{1,}c', 'AABBABC', SUCCEED, 'found', 'ABC'), - ('(?i)a**', '-', SYNTAX_ERROR), - ('(?i)a.+?c', 'ABCABC', SUCCEED, 'found', 'ABC'), - ('(?i)a.*?c', 'ABCABC', SUCCEED, 'found', 'ABC'), - ('(?i)a.{0,5}?c', 'ABCABC', SUCCEED, 'found', 'ABC'), - ('(?i)(a+|b)*', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'), - ('(?i)(a+|b){0,}', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'), - ('(?i)(a+|b)+', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'), - ('(?i)(a+|b){1,}', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'), - ('(?i)(a+|b)?', 'AB', SUCCEED, 'found+"-"+g1', 'A-A'), - ('(?i)(a+|b){0,1}', 'AB', SUCCEED, 'found+"-"+g1', 'A-A'), - ('(?i)(a+|b){0,1}?', 'AB', SUCCEED, 'found+"-"+g1', '-None'), - ('(?i))(', '-', SYNTAX_ERROR), - ('(?i)[^ab]*', 'CDE', SUCCEED, 'found', 'CDE'), - ('(?i)abc', '', FAIL), - ('(?i)a*', '', SUCCEED, 'found', ''), - ('(?i)([abc])*d', 'ABBBCD', SUCCEED, 'found+"-"+g1', 'ABBBCD-C'), - ('(?i)([abc])*bcd', 'ABCD', SUCCEED, 'found+"-"+g1', 'ABCD-A'), - ('(?i)a|b|c|d|e', 'E', SUCCEED, 'found', 'E'), - ('(?i)(a|b|c|d|e)f', 'EF', SUCCEED, 'found+"-"+g1', 'EF-E'), - ('(?i)abcd*efg', 'ABCDEFG', SUCCEED, 'found', 'ABCDEFG'), - ('(?i)ab*', 'XABYABBBZ', SUCCEED, 'found', 'AB'), - ('(?i)ab*', 'XAYABBBZ', SUCCEED, 'found', 'A'), - ('(?i)(ab|cd)e', 'ABCDE', SUCCEED, 'found+"-"+g1', 'CDE-CD'), - ('(?i)[abhgefdc]ij', 'HIJ', SUCCEED, 'found', 'HIJ'), - ('(?i)^(ab|cd)e', 'ABCDE', FAIL), - ('(?i)(abc|)ef', 'ABCDEF', SUCCEED, 'found+"-"+g1', 'EF-'), - ('(?i)(a|b)c*d', 'ABCD', SUCCEED, 'found+"-"+g1', 'BCD-B'), - ('(?i)(ab|ab*)bc', 'ABC', SUCCEED, 'found+"-"+g1', 'ABC-A'), - ('(?i)a([bc]*)c*', 'ABC', SUCCEED, 'found+"-"+g1', 'ABC-BC'), - ('(?i)a([bc]*)(c*d)', 'ABCD', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCD-BC-D'), - ('(?i)a([bc]+)(c*d)', 'ABCD', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCD-BC-D'), - ('(?i)a([bc]*)(c+d)', 'ABCD', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCD-B-CD'), - ('(?i)a[bcd]*dcdcde', 'ADCDCDE', SUCCEED, 'found', 'ADCDCDE'), - ('(?i)a[bcd]+dcdcde', 'ADCDCDE', FAIL), - ('(?i)(ab|a)b*c', 'ABC', SUCCEED, 'found+"-"+g1', 'ABC-AB'), - ('(?i)((a)(b)c)(d)', 'ABCD', SUCCEED, 'g1+"-"+g2+"-"+g3+"-"+g4', 'ABC-A-B-D'), - ('(?i)[a-zA-Z_][a-zA-Z0-9_]*', 'ALPHA', SUCCEED, 'found', 'ALPHA'), - ('(?i)^a(bc+|b[eh])g|.h$', 'ABH', SUCCEED, 'found+"-"+g1', 'BH-None'), - ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFGZ', SUCCEED, 'found+"-"+g1+"-"+g2', 'EFFGZ-EFFGZ-None'), - ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'IJ', SUCCEED, 'found+"-"+g1+"-"+g2', 'IJ-IJ-J'), - ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFG', FAIL), - ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'BCDD', FAIL), - ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'REFFGZ', SUCCEED, 'found+"-"+g1+"-"+g2', 'EFFGZ-EFFGZ-None'), - ('(?i)((((((((((a))))))))))', 'A', SUCCEED, 'g10', 'A'), - ('(?i)((((((((((a))))))))))\\10', 'AA', SUCCEED, 'found', 'AA'), - #('(?i)((((((((((a))))))))))\\41', 'AA', FAIL), - #('(?i)((((((((((a))))))))))\\41', 'A!', SUCCEED, 'found', 'A!'), - ('(?i)(((((((((a)))))))))', 'A', SUCCEED, 'found', 'A'), - ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))', 'A', SUCCEED, 'g1', 'A'), - ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))', 'C', SUCCEED, 'g1', 'C'), - ('(?i)multiple words of text', 'UH-UH', FAIL), - ('(?i)multiple words', 'MULTIPLE WORDS, YEAH', SUCCEED, 'found', 'MULTIPLE WORDS'), - ('(?i)(.*)c(.*)', 'ABCDE', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCDE-AB-DE'), - ('(?i)\\((.*), (.*)\\)', '(A, B)', SUCCEED, 'g2+"-"+g1', 'B-A'), - ('(?i)[k]', 'AB', FAIL), -# ('(?i)abcd', 'ABCD', SUCCEED, 'found+"-"+\\found+"-"+\\\\found', 'ABCD-$&-\\ABCD'), -# ('(?i)a(bc)d', 'ABCD', SUCCEED, 'g1+"-"+\\g1+"-"+\\\\g1', 'BC-$1-\\BC'), - ('(?i)a[-]?c', 'AC', SUCCEED, 'found', 'AC'), - ('(?i)(abc)\\1', 'ABCABC', SUCCEED, 'g1', 'ABC'), - ('(?i)([a-c]*)\\1', 'ABCABC', SUCCEED, 'g1', 'ABC'), - ('a(?!b).', 'abad', SUCCEED, 'found', 'ad'), - ('a(?=d).', 'abad', SUCCEED, 'found', 'ad'), - ('a(?=c|d).', 'abad', SUCCEED, 'found', 'ad'), - ('a(?:b|c|d)(.)', 'ace', SUCCEED, 'g1', 'e'), - ('a(?:b|c|d)*(.)', 'ace', SUCCEED, 'g1', 'e'), - ('a(?:b|c|d)+?(.)', 'ace', SUCCEED, 'g1', 'e'), - ('a(?:b|(c|e){1,2}?|d)+?(.)', 'ace', SUCCEED, 'g1 + g2', 'ce'), - ('^(.+)?B', 'AB', SUCCEED, 'g1', 'A'), - - # lookbehind: split by : but not if it is escaped by -. - ('(?]*?b', 'a>b', FAIL), - # bug 490573: minimizing repeat problem - (r'^a*?$', 'foo', FAIL), - # bug 470582: nested groups problem - (r'^((a)c)?(ab)$', 'ab', SUCCEED, 'g1+"-"+g2+"-"+g3', 'None-None-ab'), - # another minimizing repeat problem (capturing groups in assertions) - ('^([ab]*?)(?=(b)?)c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'), - ('^([ab]*?)(?!(b))c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'), - ('^([ab]*?)(?', 'ab', FAIL), -('a\>', 'a!', SUCCEED, 'found', 'a'), -('a\>', 'a', SUCCEED, 'found', 'a'), -] diff --git a/sys/lib/python/test/regrtest.py b/sys/lib/python/test/regrtest.py deleted file mode 100755 index f424f7b22..000000000 --- a/sys/lib/python/test/regrtest.py +++ /dev/null @@ -1,1384 +0,0 @@ -#! /usr/bin/env python - -"""Regression test. - -This will find all modules whose name is "test_*" in the test -directory, and run them. Various command line options provide -additional facilities. - -Command line options: - --v: verbose -- run tests in verbose mode with output to stdout --w: verbose2 -- re-run failed tests in verbose mode --q: quiet -- don't print anything except if a test fails --g: generate -- write the output file for a test instead of comparing it --x: exclude -- arguments are tests to *exclude* --s: single -- run only a single test (see below) --r: random -- randomize test execution order --f: fromfile -- read names of tests to run from a file (see below) --l: findleaks -- if GC is available detect tests that leak memory --u: use -- specify which special resource intensive tests to run --h: help -- print this text and exit --t: threshold -- call gc.set_threshold(N) --T: coverage -- turn on code coverage using the trace module --D: coverdir -- Directory where coverage files are put --N: nocoverdir -- Put coverage files alongside modules --L: runleaks -- run the leaks(1) command just before exit --R: huntrleaks -- search for reference leaks (needs debug build, v. slow) --M: memlimit -- run very large memory-consuming tests - -If non-option arguments are present, they are names for tests to run, -unless -x is given, in which case they are names for tests not to run. -If no test names are given, all tests are run. - --v is incompatible with -g and does not compare test output files. - --T turns on code coverage tracing with the trace module. - --D specifies the directory where coverage files are put. - --N Put coverage files alongside modules. - --s means to run only a single test and exit. This is useful when -doing memory analysis on the Python interpreter (which tend to consume -too many resources to run the full regression test non-stop). The -file /tmp/pynexttest is read to find the next test to run. If this -file is missing, the first test_*.py file in testdir or on the command -line is used. (actually tempfile.gettempdir() is used instead of -/tmp). - --f reads the names of tests from the file given as f's argument, one -or more test names per line. Whitespace is ignored. Blank lines and -lines beginning with '#' are ignored. This is especially useful for -whittling down failures involving interactions among tests. - --L causes the leaks(1) command to be run just before exit if it exists. -leaks(1) is available on Mac OS X and presumably on some other -FreeBSD-derived systems. - --R runs each test several times and examines sys.gettotalrefcount() to -see if the test appears to be leaking references. The argument should -be of the form stab:run:fname where 'stab' is the number of times the -test is run to let gettotalrefcount settle down, 'run' is the number -of times further it is run and 'fname' is the name of the file the -reports are written to. These parameters all have defaults (5, 4 and -"reflog.txt" respectively), so the minimal invocation is '-R ::'. - --M runs tests that require an exorbitant amount of memory. These tests -typically try to ascertain containers keep working when containing more than -2 billion objects, which only works on 64-bit systems. There are also some -tests that try to exhaust the address space of the process, which only makes -sense on 32-bit systems with at least 2Gb of memory. The passed-in memlimit, -which is a string in the form of '2.5Gb', determines howmuch memory the -tests will limit themselves to (but they may go slightly over.) The number -shouldn't be more memory than the machine has (including swap memory). You -should also keep in mind that swap memory is generally much, much slower -than RAM, and setting memlimit to all available RAM or higher will heavily -tax the machine. On the other hand, it is no use running these tests with a -limit of less than 2.5Gb, and many require more than 20Gb. Tests that expect -to use more than memlimit memory will be skipped. The big-memory tests -generally run very, very long. - --u is used to specify which special resource intensive tests to run, -such as those requiring large file support or network connectivity. -The argument is a comma-separated list of words indicating the -resources to test. Currently only the following are defined: - - all - Enable all special resources. - - audio - Tests that use the audio device. (There are known - cases of broken audio drivers that can crash Python or - even the Linux kernel.) - - curses - Tests that use curses and will modify the terminal's - state and output modes. - - largefile - It is okay to run some test that may create huge - files. These tests can take a long time and may - consume >2GB of disk space temporarily. - - network - It is okay to run tests that use external network - resource, e.g. testing SSL support for sockets. - - bsddb - It is okay to run the bsddb testsuite, which takes - a long time to complete. - - decimal - Test the decimal module against a large suite that - verifies compliance with standards. - - compiler - Test the compiler package by compiling all the source - in the standard library and test suite. This takes - a long time. Enabling this resource also allows - test_tokenize to verify round-trip lexing on every - file in the test library. - - subprocess Run all tests for the subprocess module. - - urlfetch - It is okay to download files required on testing. - -To enable all resources except one, use '-uall,-'. For -example, to run all the tests except for the bsddb tests, give the -option '-uall,-bsddb'. -""" - -import os -import sys -import getopt -import random -import warnings -import re -import cStringIO -import traceback - -# I see no other way to suppress these warnings; -# putting them in test_grammar.py has no effect: -warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, - ".*test.test_grammar$") -if sys.maxint > 0x7fffffff: - # Also suppress them in , because for 64-bit platforms, - # that's where test_grammar.py hides them. - warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, - "") - -# Ignore ImportWarnings that only occur in the source tree, -# (because of modules with the same name as source-directories in Modules/) -for mod in ("ctypes", "gzip", "zipfile", "tarfile", "encodings.zlib_codec", - "test.test_zipimport", "test.test_zlib", "test.test_zipfile", - "test.test_codecs", "test.string_tests"): - warnings.filterwarnings(module=".*%s$" % (mod,), - action="ignore", category=ImportWarning) - -# MacOSX (a.k.a. Darwin) has a default stack size that is too small -# for deeply recursive regular expressions. We see this as crashes in -# the Python test suite when running test_re.py and test_sre.py. The -# fix is to set the stack limit to 2048. -# This approach may also be useful for other Unixy platforms that -# suffer from small default stack limits. -if sys.platform == 'darwin': - try: - import resource - except ImportError: - pass - else: - soft, hard = resource.getrlimit(resource.RLIMIT_STACK) - newsoft = min(hard, max(soft, 1024*2048)) - resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard)) - -from test import test_support - -RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb', - 'decimal', 'compiler', 'subprocess', 'urlfetch') - - -def usage(code, msg=''): - print __doc__ - if msg: print msg - sys.exit(code) - - -def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, - exclude=False, single=False, randomize=False, fromfile=None, - findleaks=False, use_resources=None, trace=False, coverdir='coverage', - runleaks=False, huntrleaks=False, verbose2=False): - """Execute a test suite. - - This also parses command-line options and modifies its behavior - accordingly. - - tests -- a list of strings containing test names (optional) - testdir -- the directory in which to look for tests (optional) - - Users other than the Python test suite will certainly want to - specify testdir; if it's omitted, the directory containing the - Python test suite is searched for. - - If the tests argument is omitted, the tests listed on the - command-line will be used. If that's empty, too, then all *.py - files beginning with test_ will be used. - - The other default arguments (verbose, quiet, generate, exclude, single, - randomize, findleaks, use_resources, trace and coverdir) allow programmers - calling main() directly to set the values that would normally be set by - flags on the command line. - """ - - test_support.record_original_stdout(sys.stdout) - try: - opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:', - ['help', 'verbose', 'quiet', 'generate', - 'exclude', 'single', 'random', 'fromfile', - 'findleaks', 'use=', 'threshold=', 'trace', - 'coverdir=', 'nocoverdir', 'runleaks', - 'huntrleaks=', 'verbose2', 'memlimit=', - ]) - except getopt.error, msg: - usage(2, msg) - - # Defaults - if use_resources is None: - use_resources = [] - for o, a in opts: - if o in ('-h', '--help'): - usage(0) - elif o in ('-v', '--verbose'): - verbose += 1 - elif o in ('-w', '--verbose2'): - verbose2 = True - elif o in ('-q', '--quiet'): - quiet = True; - verbose = 0 - elif o in ('-g', '--generate'): - generate = True - elif o in ('-x', '--exclude'): - exclude = True - elif o in ('-s', '--single'): - single = True - elif o in ('-r', '--randomize'): - randomize = True - elif o in ('-f', '--fromfile'): - fromfile = a - elif o in ('-l', '--findleaks'): - findleaks = True - elif o in ('-L', '--runleaks'): - runleaks = True - elif o in ('-t', '--threshold'): - import gc - gc.set_threshold(int(a)) - elif o in ('-T', '--coverage'): - trace = True - elif o in ('-D', '--coverdir'): - coverdir = os.path.join(os.getcwd(), a) - elif o in ('-N', '--nocoverdir'): - coverdir = None - elif o in ('-R', '--huntrleaks'): - huntrleaks = a.split(':') - if len(huntrleaks) != 3: - print a, huntrleaks - usage(2, '-R takes three colon-separated arguments') - if len(huntrleaks[0]) == 0: - huntrleaks[0] = 5 - else: - huntrleaks[0] = int(huntrleaks[0]) - if len(huntrleaks[1]) == 0: - huntrleaks[1] = 4 - else: - huntrleaks[1] = int(huntrleaks[1]) - if len(huntrleaks[2]) == 0: - huntrleaks[2] = "reflog.txt" - elif o in ('-M', '--memlimit'): - test_support.set_memlimit(a) - elif o in ('-u', '--use'): - u = [x.lower() for x in a.split(',')] - for r in u: - if r == 'all': - use_resources[:] = RESOURCE_NAMES - continue - remove = False - if r[0] == '-': - remove = True - r = r[1:] - if r not in RESOURCE_NAMES: - usage(1, 'Invalid -u/--use option: ' + a) - if remove: - if r in use_resources: - use_resources.remove(r) - elif r not in use_resources: - use_resources.append(r) - if generate and verbose: - usage(2, "-g and -v don't go together!") - if single and fromfile: - usage(2, "-s and -f don't go together!") - - good = [] - bad = [] - skipped = [] - resource_denieds = [] - - if findleaks: - try: - import gc - except ImportError: - print 'No GC available, disabling findleaks.' - findleaks = False - else: - # Uncomment the line below to report garbage that is not - # freeable by reference counting alone. By default only - # garbage that is not collectable by the GC is reported. - #gc.set_debug(gc.DEBUG_SAVEALL) - found_garbage = [] - - if single: - from tempfile import gettempdir - filename = os.path.join(gettempdir(), 'pynexttest') - try: - fp = open(filename, 'r') - next = fp.read().strip() - tests = [next] - fp.close() - except IOError: - pass - - if fromfile: - tests = [] - fp = open(fromfile) - for line in fp: - guts = line.split() # assuming no test has whitespace in its name - if guts and not guts[0].startswith('#'): - tests.extend(guts) - fp.close() - - # Strip .py extensions. - if args: - args = map(removepy, args) - if tests: - tests = map(removepy, tests) - - stdtests = STDTESTS[:] - nottests = NOTTESTS[:] - if exclude: - for arg in args: - if arg in stdtests: - stdtests.remove(arg) - nottests[:0] = args - args = [] - tests = tests or args or findtests(testdir, stdtests, nottests) - if single: - tests = tests[:1] - if randomize: - random.shuffle(tests) - if trace: - import trace - tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix], - trace=False, count=True) - test_support.verbose = verbose # Tell tests to be moderately quiet - test_support.use_resources = use_resources - save_modules = sys.modules.keys() - for test in tests: - if not quiet: - print test - sys.stdout.flush() - if trace: - # If we're tracing code coverage, then we don't exit with status - # if on a false return value from main. - tracer.runctx('runtest(test, generate, verbose, quiet, testdir)', - globals=globals(), locals=vars()) - else: - try: - ok = runtest(test, generate, verbose, quiet, testdir, - huntrleaks) - except KeyboardInterrupt: - # print a newline separate from the ^C - print - break - except: - raise - if ok > 0: - good.append(test) - elif ok == 0: - bad.append(test) - else: - skipped.append(test) - if ok == -2: - resource_denieds.append(test) - if findleaks: - gc.collect() - if gc.garbage: - print "Warning: test created", len(gc.garbage), - print "uncollectable object(s)." - # move the uncollectable objects somewhere so we don't see - # them again - found_garbage.extend(gc.garbage) - del gc.garbage[:] - # Unload the newly imported modules (best effort finalization) - for module in sys.modules.keys(): - if module not in save_modules and module.startswith("test."): - test_support.unload(module) - - # The lists won't be sorted if running with -r - good.sort() - bad.sort() - skipped.sort() - - if good and not quiet: - if not bad and not skipped and len(good) > 1: - print "All", - print count(len(good), "test"), "OK." - if verbose: - print "CAUTION: stdout isn't compared in verbose mode:" - print "a test that passes in verbose mode may fail without it." - if bad: - print count(len(bad), "test"), "failed:" - printlist(bad) - if skipped and not quiet: - print count(len(skipped), "test"), "skipped:" - printlist(skipped) - - e = _ExpectedSkips() - plat = sys.platform - if e.isvalid(): - surprise = set(skipped) - e.getexpected() - set(resource_denieds) - if surprise: - print count(len(surprise), "skip"), \ - "unexpected on", plat + ":" - printlist(surprise) - else: - print "Those skips are all expected on", plat + "." - else: - print "Ask someone to teach regrtest.py about which tests are" - print "expected to get skipped on", plat + "." - - if verbose2 and bad: - print "Re-running failed tests in verbose mode" - for test in bad: - print "Re-running test %r in verbose mode" % test - sys.stdout.flush() - try: - test_support.verbose = 1 - ok = runtest(test, generate, 1, quiet, testdir, - huntrleaks) - except KeyboardInterrupt: - # print a newline separate from the ^C - print - break - except: - raise - - if single: - alltests = findtests(testdir, stdtests, nottests) - for i in range(len(alltests)): - if tests[0] == alltests[i]: - if i == len(alltests) - 1: - os.unlink(filename) - else: - fp = open(filename, 'w') - fp.write(alltests[i+1] + '\n') - fp.close() - break - else: - os.unlink(filename) - - if trace: - r = tracer.results() - r.write_results(show_missing=True, summary=True, coverdir=coverdir) - - if runleaks: - os.system("leaks %d" % os.getpid()) - - sys.exit(len(bad) > 0) - - -STDTESTS = [ - 'test_grammar', - 'test_opcodes', - 'test_operations', - 'test_builtin', - 'test_exceptions', - 'test_types', - 'test_unittest', - 'test_doctest', - 'test_doctest2', - ] - -NOTTESTS = [ - 'test_support', - 'test_future1', - 'test_future2', - 'test_future3', - ] - -def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS): - """Return a list of all applicable test modules.""" - if not testdir: testdir = findtestdir() - names = os.listdir(testdir) - tests = [] - for name in names: - if name[:5] == "test_" and name[-3:] == os.extsep+"py": - modname = name[:-3] - if modname not in stdtests and modname not in nottests: - tests.append(modname) - tests.sort() - return stdtests + tests - -def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False): - """Run a single test. - - test -- the name of the test - generate -- if true, generate output, instead of running the test - and comparing it to a previously created output file - verbose -- if true, print more messages - quiet -- if true, don't print 'skipped' messages (probably redundant) - testdir -- test directory - huntrleaks -- run multiple times to test for leaks; requires a debug - build; a triple corresponding to -R's three arguments - Return: - -2 test skipped because resource denied - -1 test skipped for some other reason - 0 test failed - 1 test passed - """ - - try: - return runtest_inner(test, generate, verbose, quiet, testdir, - huntrleaks) - finally: - cleanup_test_droppings(test, verbose) - -def runtest_inner(test, generate, verbose, quiet, - testdir=None, huntrleaks=False): - test_support.unload(test) - if not testdir: - testdir = findtestdir() - outputdir = os.path.join(testdir, "output") - outputfile = os.path.join(outputdir, test) - if verbose: - cfp = None - else: - cfp = cStringIO.StringIO() - - try: - save_stdout = sys.stdout - try: - if cfp: - sys.stdout = cfp - print test # Output file starts with test name - if test.startswith('test.'): - abstest = test - else: - # Always import it from the test package - abstest = 'test.' + test - the_package = __import__(abstest, globals(), locals(), []) - the_module = getattr(the_package, test) - # Most tests run to completion simply as a side-effect of - # being imported. For the benefit of tests that can't run - # that way (like test_threaded_import), explicitly invoke - # their test_main() function (if it exists). - indirect_test = getattr(the_module, "test_main", None) - if indirect_test is not None: - indirect_test() - if huntrleaks: - dash_R(the_module, test, indirect_test, huntrleaks) - finally: - sys.stdout = save_stdout - except test_support.ResourceDenied, msg: - if not quiet: - print test, "skipped --", msg - sys.stdout.flush() - return -2 - except (ImportError, test_support.TestSkipped), msg: - if not quiet: - print test, "skipped --", msg - sys.stdout.flush() - return -1 - except KeyboardInterrupt: - raise - except test_support.TestFailed, msg: - print "test", test, "failed --", msg - sys.stdout.flush() - return 0 - except: - type, value = sys.exc_info()[:2] - print "test", test, "crashed --", str(type) + ":", value - sys.stdout.flush() - if verbose: - traceback.print_exc(file=sys.stdout) - sys.stdout.flush() - return 0 - else: - if not cfp: - return 1 - output = cfp.getvalue() - if generate: - if output == test + "\n": - if os.path.exists(outputfile): - # Write it since it already exists (and the contents - # may have changed), but let the user know it isn't - # needed: - print "output file", outputfile, \ - "is no longer needed; consider removing it" - else: - # We don't need it, so don't create it. - return 1 - fp = open(outputfile, "w") - fp.write(output) - fp.close() - return 1 - if os.path.exists(outputfile): - fp = open(outputfile, "r") - expected = fp.read() - fp.close() - else: - expected = test + "\n" - if output == expected or huntrleaks: - return 1 - print "test", test, "produced unexpected output:" - sys.stdout.flush() - reportdiff(expected, output) - sys.stdout.flush() - return 0 - -def cleanup_test_droppings(testname, verbose): - import shutil - - # Try to clean up junk commonly left behind. While tests shouldn't leave - # any files or directories behind, when a test fails that can be tedious - # for it to arrange. The consequences can be especially nasty on Windows, - # since if a test leaves a file open, it cannot be deleted by name (while - # there's nothing we can do about that here either, we can display the - # name of the offending test, which is a real help). - for name in (test_support.TESTFN, - "db_home", - ): - if not os.path.exists(name): - continue - - if os.path.isdir(name): - kind, nuker = "directory", shutil.rmtree - elif os.path.isfile(name): - kind, nuker = "file", os.unlink - else: - raise SystemError("os.path says %r exists but is neither " - "directory nor file" % name) - - if verbose: - print "%r left behind %s %r" % (testname, kind, name) - try: - nuker(name) - except Exception, msg: - print >> sys.stderr, ("%r left behind %s %r and it couldn't be " - "removed: %s" % (testname, kind, name, msg)) - -def dash_R(the_module, test, indirect_test, huntrleaks): - # This code is hackish and inelegant, but it seems to do the job. - import copy_reg - - if not hasattr(sys, 'gettotalrefcount'): - raise Exception("Tracking reference leaks requires a debug build " - "of Python") - - # Save current values for dash_R_cleanup() to restore. - fs = warnings.filters[:] - ps = copy_reg.dispatch_table.copy() - pic = sys.path_importer_cache.copy() - - if indirect_test: - def run_the_test(): - indirect_test() - else: - def run_the_test(): - reload(the_module) - - deltas = [] - nwarmup, ntracked, fname = huntrleaks - repcount = nwarmup + ntracked - print >> sys.stderr, "beginning", repcount, "repetitions" - print >> sys.stderr, ("1234567890"*(repcount//10 + 1))[:repcount] - dash_R_cleanup(fs, ps, pic) - for i in range(repcount): - rc = sys.gettotalrefcount() - run_the_test() - sys.stderr.write('.') - dash_R_cleanup(fs, ps, pic) - if i >= nwarmup: - deltas.append(sys.gettotalrefcount() - rc - 2) - print >> sys.stderr - if any(deltas): - print >> sys.stderr, test, 'leaked', deltas, 'references' - refrep = open(fname, "a") - print >> refrep, test, 'leaked', deltas, 'references' - refrep.close() - -def dash_R_cleanup(fs, ps, pic): - import gc, copy_reg - import _strptime, linecache, dircache - import urlparse, urllib, urllib2, mimetypes, doctest - import struct, filecmp - from distutils.dir_util import _path_created - - # Restore some original values. - warnings.filters[:] = fs - copy_reg.dispatch_table.clear() - copy_reg.dispatch_table.update(ps) - sys.path_importer_cache.clear() - sys.path_importer_cache.update(pic) - - # Clear assorted module caches. - _path_created.clear() - re.purge() - _strptime._regex_cache.clear() - urlparse.clear_cache() - urllib.urlcleanup() - urllib2.install_opener(None) - dircache.reset() - linecache.clearcache() - mimetypes._default_mime_types() - struct._cache.clear() - filecmp._cache.clear() - doctest.master = None - - # Collect cyclic trash. - gc.collect() - -def reportdiff(expected, output): - import difflib - print "*" * 70 - a = expected.splitlines(1) - b = output.splitlines(1) - sm = difflib.SequenceMatcher(a=a, b=b) - tuples = sm.get_opcodes() - - def pair(x0, x1): - # x0:x1 are 0-based slice indices; convert to 1-based line indices. - x0 += 1 - if x0 >= x1: - return "line " + str(x0) - else: - return "lines %d-%d" % (x0, x1) - - for op, a0, a1, b0, b1 in tuples: - if op == 'equal': - pass - - elif op == 'delete': - print "***", pair(a0, a1), "of expected output missing:" - for line in a[a0:a1]: - print "-", line, - - elif op == 'replace': - print "*** mismatch between", pair(a0, a1), "of expected", \ - "output and", pair(b0, b1), "of actual output:" - for line in difflib.ndiff(a[a0:a1], b[b0:b1]): - print line, - - elif op == 'insert': - print "***", pair(b0, b1), "of actual output doesn't appear", \ - "in expected output after line", str(a1)+":" - for line in b[b0:b1]: - print "+", line, - - else: - print "get_opcodes() returned bad tuple?!?!", (op, a0, a1, b0, b1) - - print "*" * 70 - -def findtestdir(): - if __name__ == '__main__': - file = sys.argv[0] - else: - file = __file__ - testdir = os.path.dirname(file) or os.curdir - return testdir - -def removepy(name): - if name.endswith(os.extsep + "py"): - name = name[:-3] - return name - -def count(n, word): - if n == 1: - return "%d %s" % (n, word) - else: - return "%d %ss" % (n, word) - -def printlist(x, width=70, indent=4): - """Print the elements of iterable x to stdout. - - Optional arg width (default 70) is the maximum line length. - Optional arg indent (default 4) is the number of blanks with which to - begin each line. - """ - - from textwrap import fill - blanks = ' ' * indent - print fill(' '.join(map(str, x)), width, - initial_indent=blanks, subsequent_indent=blanks) - -# Map sys.platform to a string containing the basenames of tests -# expected to be skipped on that platform. -# -# Special cases: -# test_pep277 -# The _ExpectedSkips constructor adds this to the set of expected -# skips if not os.path.supports_unicode_filenames. -# test_socket_ssl -# Controlled by test_socket_ssl.skip_expected. Requires the network -# resource, and a socket module with ssl support. -# test_timeout -# Controlled by test_timeout.skip_expected. Requires the network -# resource and a socket module. - -_expectations = { - 'win32': - """ - test__locale - test_applesingle - test_al - test_bsddb185 - test_bsddb3 - test_cd - test_cl - test_commands - test_crypt - test_curses - test_dbm - test_dl - test_fcntl - test_fork1 - test_gdbm - test_gl - test_grp - test_imgfile - test_ioctl - test_largefile - test_linuxaudiodev - test_mhlib - test_nis - test_openpty - test_ossaudiodev - test_poll - test_posix - test_pty - test_pwd - test_resource - test_signal - test_sunaudiodev - test_threadsignals - test_timing - test_wait3 - test_wait4 - """, - 'linux2': - """ - test_al - test_applesingle - test_bsddb185 - test_cd - test_cl - test_curses - test_dl - test_gl - test_imgfile - test_largefile - test_linuxaudiodev - test_nis - test_ntpath - test_ossaudiodev - test_sqlite - test_startfile - test_sunaudiodev - """, - 'mac': - """ - test_al - test_atexit - test_bsddb - test_bsddb185 - test_bsddb3 - test_bz2 - test_cd - test_cl - test_commands - test_crypt - test_curses - test_dbm - test_dl - test_fcntl - test_fork1 - test_gl - test_grp - test_ioctl - test_imgfile - test_largefile - test_linuxaudiodev - test_locale - test_mmap - test_nis - test_ntpath - test_openpty - test_ossaudiodev - test_poll - test_popen - test_popen2 - test_posix - test_pty - test_pwd - test_resource - test_signal - test_sqlite - test_startfile - test_sunaudiodev - test_sundry - test_tarfile - test_timing - """, - 'unixware7': - """ - test_al - test_applesingle - test_bsddb - test_bsddb185 - test_cd - test_cl - test_dl - test_gl - test_imgfile - test_largefile - test_linuxaudiodev - test_minidom - test_nis - test_ntpath - test_openpty - test_pyexpat - test_sax - test_startfile - test_sqlite - test_sunaudiodev - test_sundry - """, - 'openunix8': - """ - test_al - test_applesingle - test_bsddb - test_bsddb185 - test_cd - test_cl - test_dl - test_gl - test_imgfile - test_largefile - test_linuxaudiodev - test_minidom - test_nis - test_ntpath - test_openpty - test_pyexpat - test_sax - test_sqlite - test_startfile - test_sunaudiodev - test_sundry - """, - 'sco_sv3': - """ - test_al - test_applesingle - test_asynchat - test_bsddb - test_bsddb185 - test_cd - test_cl - test_dl - test_fork1 - test_gettext - test_gl - test_imgfile - test_largefile - test_linuxaudiodev - test_locale - test_minidom - test_nis - test_ntpath - test_openpty - test_pyexpat - test_queue - test_sax - test_sqlite - test_startfile - test_sunaudiodev - test_sundry - test_thread - test_threaded_import - test_threadedtempfile - test_threading - """, - 'riscos': - """ - test_al - test_applesingle - test_asynchat - test_atexit - test_bsddb - test_bsddb185 - test_bsddb3 - test_cd - test_cl - test_commands - test_crypt - test_dbm - test_dl - test_fcntl - test_fork1 - test_gdbm - test_gl - test_grp - test_imgfile - test_largefile - test_linuxaudiodev - test_locale - test_mmap - test_nis - test_ntpath - test_openpty - test_poll - test_popen2 - test_pty - test_pwd - test_strop - test_sqlite - test_startfile - test_sunaudiodev - test_sundry - test_thread - test_threaded_import - test_threadedtempfile - test_threading - test_timing - """, - 'darwin': - """ - test__locale - test_al - test_bsddb - test_bsddb3 - test_cd - test_cl - test_curses - test_gdbm - test_gl - test_imgfile - test_largefile - test_linuxaudiodev - test_locale - test_minidom - test_nis - test_ntpath - test_ossaudiodev - test_poll - test_sqlite - test_startfile - test_sunaudiodev - """, - 'sunos5': - """ - test_al - test_applesingle - test_bsddb - test_bsddb185 - test_cd - test_cl - test_curses - test_dbm - test_gdbm - test_gl - test_gzip - test_imgfile - test_linuxaudiodev - test_openpty - test_sqlite - test_startfile - test_zipfile - test_zlib - """, - 'hp-ux11': - """ - test_al - test_applesingle - test_bsddb - test_bsddb185 - test_cd - test_cl - test_curses - test_dl - test_gdbm - test_gl - test_gzip - test_imgfile - test_largefile - test_linuxaudiodev - test_locale - test_minidom - test_nis - test_ntpath - test_openpty - test_pyexpat - test_sax - test_sqlite - test_startfile - test_sunaudiodev - test_zipfile - test_zlib - """, - 'atheos': - """ - test_al - test_applesingle - test_bsddb185 - test_cd - test_cl - test_curses - test_dl - test_gdbm - test_gl - test_imgfile - test_largefile - test_linuxaudiodev - test_locale - test_mhlib - test_mmap - test_nis - test_poll - test_popen2 - test_resource - test_sqlite - test_startfile - test_sunaudiodev - """, - 'cygwin': - """ - test_al - test_applesingle - test_bsddb185 - test_bsddb3 - test_cd - test_cl - test_curses - test_dbm - test_gl - test_imgfile - test_ioctl - test_largefile - test_linuxaudiodev - test_locale - test_nis - test_ossaudiodev - test_socketserver - test_sqlite - test_sunaudiodev - """, - 'os2emx': - """ - test_al - test_applesingle - test_audioop - test_bsddb185 - test_bsddb3 - test_cd - test_cl - test_commands - test_curses - test_dl - test_gl - test_imgfile - test_largefile - test_linuxaudiodev - test_mhlib - test_mmap - test_nis - test_openpty - test_ossaudiodev - test_pty - test_resource - test_signal - test_sqlite - test_startfile - test_sunaudiodev - """, - 'freebsd4': - """ - test_aepack - test_al - test_applesingle - test_bsddb - test_bsddb3 - test_cd - test_cl - test_gdbm - test_gl - test_imgfile - test_linuxaudiodev - test_locale - test_macfs - test_macostools - test_nis - test_ossaudiodev - test_pep277 - test_plistlib - test_pty - test_scriptpackages - test_socket_ssl - test_socketserver - test_sqlite - test_startfile - test_sunaudiodev - test_tcl - test_timeout - test_unicode_file - test_urllibnet - test_winreg - test_winsound - """, - 'aix5': - """ - test_aepack - test_al - test_applesingle - test_bsddb - test_bsddb185 - test_bsddb3 - test_bz2 - test_cd - test_cl - test_dl - test_gdbm - test_gl - test_gzip - test_imgfile - test_linuxaudiodev - test_macfs - test_macostools - test_nis - test_ossaudiodev - test_sqlite - test_startfile - test_sunaudiodev - test_tcl - test_winreg - test_winsound - test_zipimport - test_zlib - """, - 'openbsd3': - """ - test_aepack - test_al - test_applesingle - test_bsddb - test_bsddb3 - test_cd - test_cl - test_ctypes - test_dl - test_gdbm - test_gl - test_imgfile - test_linuxaudiodev - test_locale - test_macfs - test_macostools - test_nis - test_normalization - test_ossaudiodev - test_pep277 - test_plistlib - test_scriptpackages - test_tcl - test_sqlite - test_startfile - test_sunaudiodev - test_unicode_file - test_winreg - test_winsound - """, - 'netbsd3': - """ - test_aepack - test_al - test_applesingle - test_bsddb - test_bsddb185 - test_bsddb3 - test_cd - test_cl - test_ctypes - test_curses - test_dl - test_gdbm - test_gl - test_imgfile - test_linuxaudiodev - test_locale - test_macfs - test_macostools - test_nis - test_ossaudiodev - test_pep277 - test_sqlite - test_startfile - test_sunaudiodev - test_tcl - test_unicode_file - test_winreg - test_winsound - """, -} -_expectations['freebsd5'] = _expectations['freebsd4'] -_expectations['freebsd6'] = _expectations['freebsd4'] -_expectations['freebsd7'] = _expectations['freebsd4'] - -class _ExpectedSkips: - def __init__(self): - import os.path - from test import test_socket_ssl - from test import test_timeout - - self.valid = False - if sys.platform in _expectations: - s = _expectations[sys.platform] - self.expected = set(s.split()) - - if not os.path.supports_unicode_filenames: - self.expected.add('test_pep277') - - if test_socket_ssl.skip_expected: - self.expected.add('test_socket_ssl') - - if test_timeout.skip_expected: - self.expected.add('test_timeout') - - if sys.maxint == 9223372036854775807L: - self.expected.add('test_rgbimg') - self.expected.add('test_imageop') - - if not sys.platform in ("mac", "darwin"): - MAC_ONLY = ["test_macostools", "test_macfs", "test_aepack", - "test_plistlib", "test_scriptpackages"] - for skip in MAC_ONLY: - self.expected.add(skip) - - if sys.platform != "win32": - WIN_ONLY = ["test_unicode_file", "test_winreg", - "test_winsound"] - for skip in WIN_ONLY: - self.expected.add(skip) - - self.valid = True - - def isvalid(self): - "Return true iff _ExpectedSkips knows about the current platform." - return self.valid - - def getexpected(self): - """Return set of test names we expect to skip on current platform. - - self.isvalid() must be true. - """ - - assert self.isvalid() - return self.expected - -if __name__ == '__main__': - # Remove regrtest.py's own directory from the module search path. This - # prevents relative imports from working, and relative imports will screw - # up the testing framework. E.g. if both test.test_support and - # test_support are imported, they will not contain the same globals, and - # much of the testing framework relies on the globals in the - # test.test_support module. - mydir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0]))) - i = pathlen = len(sys.path) - while i >= 0: - i -= 1 - if os.path.abspath(os.path.normpath(sys.path[i])) == mydir: - del sys.path[i] - if len(sys.path) == pathlen: - print 'Could not find %r in sys.path to remove it' % mydir - main() diff --git a/sys/lib/python/test/reperf.py b/sys/lib/python/test/reperf.py deleted file mode 100644 index 68ac40f13..000000000 --- a/sys/lib/python/test/reperf.py +++ /dev/null @@ -1,23 +0,0 @@ -import re -import time - -def main(): - s = "\13hello\14 \13world\14 " * 1000 - p = re.compile(r"([\13\14])") - timefunc(10, p.sub, "", s) - timefunc(10, p.split, s) - timefunc(10, p.findall, s) - -def timefunc(n, func, *args, **kw): - t0 = time.clock() - try: - for i in range(n): - result = func(*args, **kw) - return result - finally: - t1 = time.clock() - if n > 1: - print n, "times", - print func.__name__, "%.3f" % (t1-t0), "CPU seconds" - -main() diff --git a/sys/lib/python/test/sample_doctest.py b/sys/lib/python/test/sample_doctest.py deleted file mode 100644 index e5adee0f6..000000000 --- a/sys/lib/python/test/sample_doctest.py +++ /dev/null @@ -1,76 +0,0 @@ -"""This is a sample module that doesn't really test anything all that - interesting. - -It simply has a few tests, some of which succeed and some of which fail. - -It's important that the numbers remain constant as another test is -testing the running of these tests. - - ->>> 2+2 -4 -""" - - -def foo(): - """ - - >>> 2+2 - 5 - - >>> 2+2 - 4 - """ - -def bar(): - """ - - >>> 2+2 - 4 - """ - -def test_silly_setup(): - """ - - >>> import test.test_doctest - >>> test.test_doctest.sillySetup - True - """ - -def w_blank(): - """ - >>> if 1: - ... print 'a' - ... print - ... print 'b' - a - - b - """ - -x = 1 -def x_is_one(): - """ - >>> x - 1 - """ - -def y_is_one(): - """ - >>> y - 1 - """ - -__test__ = {'good': """ - >>> 42 - 42 - """, - 'bad': """ - >>> 42 - 666 - """, - } - -def test_suite(): - import doctest - return doctest.DocTestSuite() diff --git a/sys/lib/python/test/seq_tests.py b/sys/lib/python/test/seq_tests.py deleted file mode 100644 index 18fb3b786..000000000 --- a/sys/lib/python/test/seq_tests.py +++ /dev/null @@ -1,323 +0,0 @@ -""" -Tests common to tuple, list and UserList.UserList -""" - -import unittest -from test import test_support - -# Various iterables -# This is used for checking the constructor (here and in test_deque.py) -def iterfunc(seqn): - 'Regular generator' - for i in seqn: - yield i - -class Sequence: - 'Sequence using __getitem__' - def __init__(self, seqn): - self.seqn = seqn - def __getitem__(self, i): - return self.seqn[i] - -class IterFunc: - 'Sequence using iterator protocol' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class IterGen: - 'Sequence using iterator protocol defined with a generator' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - for val in self.seqn: - yield val - -class IterNextOnly: - 'Missing __getitem__ and __iter__' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class IterNoNext: - 'Iterator missing next()' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - -class IterGenExc: - 'Test propagation of exceptions' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - 3 // 0 - -class IterFuncStop: - 'Test immediate stop' - def __init__(self, seqn): - pass - def __iter__(self): - return self - def next(self): - raise StopIteration - -from itertools import chain, imap -def itermulti(seqn): - 'Test multiple tiers of iterators' - return chain(imap(lambda x:x, iterfunc(IterGen(Sequence(seqn))))) - -class CommonTest(unittest.TestCase): - # The type to be tested - type2test = None - - def test_constructors(self): - l0 = [] - l1 = [0] - l2 = [0, 1] - - u = self.type2test() - u0 = self.type2test(l0) - u1 = self.type2test(l1) - u2 = self.type2test(l2) - - uu = self.type2test(u) - uu0 = self.type2test(u0) - uu1 = self.type2test(u1) - uu2 = self.type2test(u2) - - v = self.type2test(tuple(u)) - class OtherSeq: - def __init__(self, initseq): - self.__data = initseq - def __len__(self): - return len(self.__data) - def __getitem__(self, i): - return self.__data[i] - s = OtherSeq(u0) - v0 = self.type2test(s) - self.assertEqual(len(v0), len(s)) - - s = "this is also a sequence" - vv = self.type2test(s) - self.assertEqual(len(vv), len(s)) - - # Create from various iteratables - for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): - for g in (Sequence, IterFunc, IterGen, - itermulti, iterfunc): - self.assertEqual(self.type2test(g(s)), self.type2test(s)) - self.assertEqual(self.type2test(IterFuncStop(s)), self.type2test()) - self.assertEqual(self.type2test(c for c in "123"), self.type2test("123")) - self.assertRaises(TypeError, self.type2test, IterNextOnly(s)) - self.assertRaises(TypeError, self.type2test, IterNoNext(s)) - self.assertRaises(ZeroDivisionError, self.type2test, IterGenExc(s)) - - def test_truth(self): - self.assert_(not self.type2test()) - self.assert_(self.type2test([42])) - - def test_getitem(self): - u = self.type2test([0, 1, 2, 3, 4]) - for i in xrange(len(u)): - self.assertEqual(u[i], i) - self.assertEqual(u[long(i)], i) - for i in xrange(-len(u), -1): - self.assertEqual(u[i], len(u)+i) - self.assertEqual(u[long(i)], len(u)+i) - self.assertRaises(IndexError, u.__getitem__, -len(u)-1) - self.assertRaises(IndexError, u.__getitem__, len(u)) - self.assertRaises(ValueError, u.__getitem__, slice(0,10,0)) - - u = self.type2test() - self.assertRaises(IndexError, u.__getitem__, 0) - self.assertRaises(IndexError, u.__getitem__, -1) - - self.assertRaises(TypeError, u.__getitem__) - - a = self.type2test([10, 11]) - self.assertEqual(a[0], 10) - self.assertEqual(a[1], 11) - self.assertEqual(a[-2], 10) - self.assertEqual(a[-1], 11) - self.assertRaises(IndexError, a.__getitem__, -3) - self.assertRaises(IndexError, a.__getitem__, 3) - - def test_getslice(self): - l = [0, 1, 2, 3, 4] - u = self.type2test(l) - - self.assertEqual(u[0:0], self.type2test()) - self.assertEqual(u[1:2], self.type2test([1])) - self.assertEqual(u[-2:-1], self.type2test([3])) - self.assertEqual(u[-1000:1000], u) - self.assertEqual(u[1000:-1000], self.type2test([])) - self.assertEqual(u[:], u) - self.assertEqual(u[1:None], self.type2test([1, 2, 3, 4])) - self.assertEqual(u[None:3], self.type2test([0, 1, 2])) - - # Extended slices - self.assertEqual(u[::], u) - self.assertEqual(u[::2], self.type2test([0, 2, 4])) - self.assertEqual(u[1::2], self.type2test([1, 3])) - self.assertEqual(u[::-1], self.type2test([4, 3, 2, 1, 0])) - self.assertEqual(u[::-2], self.type2test([4, 2, 0])) - self.assertEqual(u[3::-2], self.type2test([3, 1])) - self.assertEqual(u[3:3:-2], self.type2test([])) - self.assertEqual(u[3:2:-2], self.type2test([3])) - self.assertEqual(u[3:1:-2], self.type2test([3])) - self.assertEqual(u[3:0:-2], self.type2test([3, 1])) - self.assertEqual(u[::-100], self.type2test([4])) - self.assertEqual(u[100:-100:], self.type2test([])) - self.assertEqual(u[-100:100:], u) - self.assertEqual(u[100:-100:-1], u[::-1]) - self.assertEqual(u[-100:100:-1], self.type2test([])) - self.assertEqual(u[-100L:100L:2L], self.type2test([0, 2, 4])) - - # Test extreme cases with long ints - a = self.type2test([0,1,2,3,4]) - self.assertEqual(a[ -pow(2,128L): 3 ], self.type2test([0,1,2])) - self.assertEqual(a[ 3: pow(2,145L) ], self.type2test([3,4])) - - self.assertRaises(TypeError, u.__getslice__) - - def test_contains(self): - u = self.type2test([0, 1, 2]) - for i in u: - self.assert_(i in u) - for i in min(u)-1, max(u)+1: - self.assert_(i not in u) - - self.assertRaises(TypeError, u.__contains__) - - def test_contains_fake(self): - class AllEq: - # Sequences must use rich comparison against each item - # (unless "is" is true, or an earlier item answered) - # So instances of AllEq must be found in all non-empty sequences. - def __eq__(self, other): - return True - def __hash__(self): - raise NotImplemented - self.assert_(AllEq() not in self.type2test([])) - self.assert_(AllEq() in self.type2test([1])) - - def test_contains_order(self): - # Sequences must test in-order. If a rich comparison has side - # effects, these will be visible to tests against later members. - # In this test, the "side effect" is a short-circuiting raise. - class DoNotTestEq(Exception): - pass - class StopCompares: - def __eq__(self, other): - raise DoNotTestEq - - checkfirst = self.type2test([1, StopCompares()]) - self.assert_(1 in checkfirst) - checklast = self.type2test([StopCompares(), 1]) - self.assertRaises(DoNotTestEq, checklast.__contains__, 1) - - def test_len(self): - self.assertEqual(len(self.type2test()), 0) - self.assertEqual(len(self.type2test([])), 0) - self.assertEqual(len(self.type2test([0])), 1) - self.assertEqual(len(self.type2test([0, 1, 2])), 3) - - def test_minmax(self): - u = self.type2test([0, 1, 2]) - self.assertEqual(min(u), 0) - self.assertEqual(max(u), 2) - - def test_addmul(self): - u1 = self.type2test([0]) - u2 = self.type2test([0, 1]) - self.assertEqual(u1, u1 + self.type2test()) - self.assertEqual(u1, self.type2test() + u1) - self.assertEqual(u1 + self.type2test([1]), u2) - self.assertEqual(self.type2test([-1]) + u1, self.type2test([-1, 0])) - self.assertEqual(self.type2test(), u2*0) - self.assertEqual(self.type2test(), 0*u2) - self.assertEqual(self.type2test(), u2*0L) - self.assertEqual(self.type2test(), 0L*u2) - self.assertEqual(u2, u2*1) - self.assertEqual(u2, 1*u2) - self.assertEqual(u2, u2*1L) - self.assertEqual(u2, 1L*u2) - self.assertEqual(u2+u2, u2*2) - self.assertEqual(u2+u2, 2*u2) - self.assertEqual(u2+u2, u2*2L) - self.assertEqual(u2+u2, 2L*u2) - self.assertEqual(u2+u2+u2, u2*3) - self.assertEqual(u2+u2+u2, 3*u2) - - class subclass(self.type2test): - pass - u3 = subclass([0, 1]) - self.assertEqual(u3, u3*1) - self.assert_(u3 is not u3*1) - - def test_iadd(self): - u = self.type2test([0, 1]) - u += self.type2test() - self.assertEqual(u, self.type2test([0, 1])) - u += self.type2test([2, 3]) - self.assertEqual(u, self.type2test([0, 1, 2, 3])) - u += self.type2test([4, 5]) - self.assertEqual(u, self.type2test([0, 1, 2, 3, 4, 5])) - - u = self.type2test("spam") - u += self.type2test("eggs") - self.assertEqual(u, self.type2test("spameggs")) - - def test_imul(self): - u = self.type2test([0, 1]) - u *= 3 - self.assertEqual(u, self.type2test([0, 1, 0, 1, 0, 1])) - - def test_getitemoverwriteiter(self): - # Verify that __getitem__ overrides are not recognized by __iter__ - class T(self.type2test): - def __getitem__(self, key): - return str(key) + '!!!' - self.assertEqual(iter(T((1,2))).next(), 1) - - def test_repeat(self): - for m in xrange(4): - s = tuple(range(m)) - for n in xrange(-3, 5): - self.assertEqual(self.type2test(s*n), self.type2test(s)*n) - self.assertEqual(self.type2test(s)*(-4), self.type2test([])) - self.assertEqual(id(s), id(s*1)) - - def test_subscript(self): - a = self.type2test([10, 11]) - self.assertEqual(a.__getitem__(0L), 10) - self.assertEqual(a.__getitem__(1L), 11) - self.assertEqual(a.__getitem__(-2L), 10) - self.assertEqual(a.__getitem__(-1L), 11) - self.assertRaises(IndexError, a.__getitem__, -3) - self.assertRaises(IndexError, a.__getitem__, 3) - self.assertEqual(a.__getitem__(slice(0,1)), self.type2test([10])) - self.assertEqual(a.__getitem__(slice(1,2)), self.type2test([11])) - self.assertEqual(a.__getitem__(slice(0,2)), self.type2test([10, 11])) - self.assertEqual(a.__getitem__(slice(0,3)), self.type2test([10, 11])) - self.assertEqual(a.__getitem__(slice(3,5)), self.type2test([])) - self.assertRaises(ValueError, a.__getitem__, slice(0, 10, 0)) - self.assertRaises(TypeError, a.__getitem__, 'x') diff --git a/sys/lib/python/test/sgml_input.html b/sys/lib/python/test/sgml_input.html deleted file mode 100644 index f4d2e6cc8..000000000 --- a/sys/lib/python/test/sgml_input.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - -
- - - - - -
-
- - - - - -
- - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
  MetalCristalDeuterioEnergía  
160.6363.40639.230-80/3.965
-
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Flotas (max. 9)
Num.MisiónCantidadComienzoSalidaObjetivoLlegadaOrden
1 - Espionaje - (F) - 3[2:250:6]Wed Aug 9 18:00:02[2:242:5]Wed Aug 9 18:01:02 -
- - -
-
2 - Espionaje - (V) - 3[2:250:6]Wed Aug 9 17:59:55[2:242:1]Wed Aug 9 18:01:55 -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Nueva misión: elegir naves
NavesDisponibles--
Nave pequeña de carga10máx
Nave grande de carga19máx
Crucero6máx
Reciclador1máx
Sonda de espionaje139máx
Ninguna naveTodas las naves
- -

-
- - diff --git a/sys/lib/python/test/sortperf.py b/sys/lib/python/test/sortperf.py deleted file mode 100644 index cc83ee43d..000000000 --- a/sys/lib/python/test/sortperf.py +++ /dev/null @@ -1,169 +0,0 @@ -"""Sort performance test. - -See main() for command line syntax. -See tabulate() for output format. - -""" - -import sys -import time -import random -import marshal -import tempfile -import os - -td = tempfile.gettempdir() - -def randfloats(n): - """Return a list of n random floats in [0, 1).""" - # Generating floats is expensive, so this writes them out to a file in - # a temp directory. If the file already exists, it just reads them - # back in and shuffles them a bit. - fn = os.path.join(td, "rr%06d" % n) - try: - fp = open(fn, "rb") - except IOError: - r = random.random - result = [r() for i in xrange(n)] - try: - try: - fp = open(fn, "wb") - marshal.dump(result, fp) - fp.close() - fp = None - finally: - if fp: - try: - os.unlink(fn) - except os.error: - pass - except IOError, msg: - print "can't write", fn, ":", msg - else: - result = marshal.load(fp) - fp.close() - # Shuffle it a bit... - for i in range(10): - i = random.randrange(n) - temp = result[:i] - del result[:i] - temp.reverse() - result.extend(temp) - del temp - assert len(result) == n - return result - -def flush(): - sys.stdout.flush() - -def doit(L): - t0 = time.clock() - L.sort() - t1 = time.clock() - print "%6.2f" % (t1-t0), - flush() - -def tabulate(r): - """Tabulate sort speed for lists of various sizes. - - The sizes are 2**i for i in r (the argument, a list). - - The output displays i, 2**i, and the time to sort arrays of 2**i - floating point numbers with the following properties: - - *sort: random data - \sort: descending data - /sort: ascending data - 3sort: ascending, then 3 random exchanges - +sort: ascending, then 10 random at the end - %sort: ascending, then randomly replace 1% of the elements w/ random values - ~sort: many duplicates - =sort: all equal - !sort: worst case scenario - - """ - cases = tuple([ch + "sort" for ch in r"*\/3+%~=!"]) - fmt = ("%2s %7s" + " %6s"*len(cases)) - print fmt % (("i", "2**i") + cases) - for i in r: - n = 1 << i - L = randfloats(n) - print "%2d %7d" % (i, n), - flush() - doit(L) # *sort - L.reverse() - doit(L) # \sort - doit(L) # /sort - - # Do 3 random exchanges. - for dummy in range(3): - i1 = random.randrange(n) - i2 = random.randrange(n) - L[i1], L[i2] = L[i2], L[i1] - doit(L) # 3sort - - # Replace the last 10 with random floats. - if n >= 10: - L[-10:] = [random.random() for dummy in range(10)] - doit(L) # +sort - - # Replace 1% of the elements at random. - for dummy in xrange(n // 100): - L[random.randrange(n)] = random.random() - doit(L) # %sort - - # Arrange for lots of duplicates. - if n > 4: - del L[4:] - L = L * (n // 4) - # Force the elements to be distinct objects, else timings can be - # artificially low. - L = map(lambda x: --x, L) - doit(L) # ~sort - del L - - # All equal. Again, force the elements to be distinct objects. - L = map(abs, [-0.5] * n) - doit(L) # =sort - del L - - # This one looks like [3, 2, 1, 0, 0, 1, 2, 3]. It was a bad case - # for an older implementation of quicksort, which used the median - # of the first, last and middle elements as the pivot. - half = n // 2 - L = range(half - 1, -1, -1) - L.extend(range(half)) - # Force to float, so that the timings are comparable. This is - # significantly faster if we leave tham as ints. - L = map(float, L) - doit(L) # !sort - print - -def main(): - """Main program when invoked as a script. - - One argument: tabulate a single row. - Two arguments: tabulate a range (inclusive). - Extra arguments are used to seed the random generator. - - """ - # default range (inclusive) - k1 = 15 - k2 = 20 - if sys.argv[1:]: - # one argument: single point - k1 = k2 = int(sys.argv[1]) - if sys.argv[2:]: - # two arguments: specify range - k2 = int(sys.argv[2]) - if sys.argv[3:]: - # derive random seed from remaining arguments - x = 1 - for a in sys.argv[3:]: - x = 69069 * x + hash(a) - random.seed(x) - r = range(k1, k2+1) # include the end point - tabulate(r) - -if __name__ == '__main__': - main() diff --git a/sys/lib/python/test/string_tests.py b/sys/lib/python/test/string_tests.py deleted file mode 100644 index 1aa68dedd..000000000 --- a/sys/lib/python/test/string_tests.py +++ /dev/null @@ -1,1173 +0,0 @@ -""" -Common tests shared by test_str, test_unicode, test_userstring and test_string. -""" - -import unittest, string, sys -from test import test_support -from UserList import UserList - -class Sequence: - def __init__(self, seq='wxyz'): self.seq = seq - def __len__(self): return len(self.seq) - def __getitem__(self, i): return self.seq[i] - -class BadSeq1(Sequence): - def __init__(self): self.seq = [7, 'hello', 123L] - -class BadSeq2(Sequence): - def __init__(self): self.seq = ['a', 'b', 'c'] - def __len__(self): return 8 - -class CommonTest(unittest.TestCase): - # This testcase contains test that can be used in all - # stringlike classes. Currently this is str, unicode - # UserString and the string module. - - # The type to be tested - # Change in subclasses to change the behaviour of fixtesttype() - type2test = None - - # All tests pass their arguments to the testing methods - # as str objects. fixtesttype() can be used to propagate - # these arguments to the appropriate type - def fixtype(self, obj): - if isinstance(obj, str): - return self.__class__.type2test(obj) - elif isinstance(obj, list): - return [self.fixtype(x) for x in obj] - elif isinstance(obj, tuple): - return tuple([self.fixtype(x) for x in obj]) - elif isinstance(obj, dict): - return dict([ - (self.fixtype(key), self.fixtype(value)) - for (key, value) in obj.iteritems() - ]) - else: - return obj - - # check that object.method(*args) returns result - def checkequal(self, result, object, methodname, *args): - result = self.fixtype(result) - object = self.fixtype(object) - args = self.fixtype(args) - realresult = getattr(object, methodname)(*args) - self.assertEqual( - result, - realresult - ) - # if the original is returned make sure that - # this doesn't happen with subclasses - if object == realresult: - class subtype(self.__class__.type2test): - pass - object = subtype(object) - realresult = getattr(object, methodname)(*args) - self.assert_(object is not realresult) - - # check that object.method(*args) raises exc - def checkraises(self, exc, object, methodname, *args): - object = self.fixtype(object) - args = self.fixtype(args) - self.assertRaises( - exc, - getattr(object, methodname), - *args - ) - - # call object.method(*args) without any checks - def checkcall(self, object, methodname, *args): - object = self.fixtype(object) - args = self.fixtype(args) - getattr(object, methodname)(*args) - - def test_hash(self): - # SF bug 1054139: += optimization was not invalidating cached hash value - a = self.type2test('DNSSEC') - b = self.type2test('') - for c in a: - b += c - hash(b) - self.assertEqual(hash(a), hash(b)) - - def test_capitalize(self): - self.checkequal(' hello ', ' hello ', 'capitalize') - self.checkequal('Hello ', 'Hello ','capitalize') - self.checkequal('Hello ', 'hello ','capitalize') - self.checkequal('Aaaa', 'aaaa', 'capitalize') - self.checkequal('Aaaa', 'AaAa', 'capitalize') - - self.checkraises(TypeError, 'hello', 'capitalize', 42) - - def test_count(self): - self.checkequal(3, 'aaa', 'count', 'a') - self.checkequal(0, 'aaa', 'count', 'b') - self.checkequal(3, 'aaa', 'count', 'a') - self.checkequal(0, 'aaa', 'count', 'b') - self.checkequal(3, 'aaa', 'count', 'a') - self.checkequal(0, 'aaa', 'count', 'b') - self.checkequal(0, 'aaa', 'count', 'b') - self.checkequal(2, 'aaa', 'count', 'a', 1) - self.checkequal(0, 'aaa', 'count', 'a', 10) - self.checkequal(1, 'aaa', 'count', 'a', -1) - self.checkequal(3, 'aaa', 'count', 'a', -10) - self.checkequal(1, 'aaa', 'count', 'a', 0, 1) - self.checkequal(3, 'aaa', 'count', 'a', 0, 10) - self.checkequal(2, 'aaa', 'count', 'a', 0, -1) - self.checkequal(0, 'aaa', 'count', 'a', 0, -10) - self.checkequal(3, 'aaa', 'count', '', 1) - self.checkequal(1, 'aaa', 'count', '', 3) - self.checkequal(0, 'aaa', 'count', '', 10) - self.checkequal(2, 'aaa', 'count', '', -1) - self.checkequal(4, 'aaa', 'count', '', -10) - - self.checkraises(TypeError, 'hello', 'count') - self.checkraises(TypeError, 'hello', 'count', 42) - - # For a variety of combinations, - # verify that str.count() matches an equivalent function - # replacing all occurrences and then differencing the string lengths - charset = ['', 'a', 'b'] - digits = 7 - base = len(charset) - teststrings = set() - for i in xrange(base ** digits): - entry = [] - for j in xrange(digits): - i, m = divmod(i, base) - entry.append(charset[m]) - teststrings.add(''.join(entry)) - teststrings = list(teststrings) - for i in teststrings: - i = self.fixtype(i) - n = len(i) - for j in teststrings: - r1 = i.count(j) - if j: - r2, rem = divmod(n - len(i.replace(j, '')), len(j)) - else: - r2, rem = len(i)+1, 0 - if rem or r1 != r2: - self.assertEqual(rem, 0, '%s != 0 for %s' % (rem, i)) - self.assertEqual(r1, r2, '%s != %s for %s' % (r1, r2, i)) - - def test_find(self): - self.checkequal(0, 'abcdefghiabc', 'find', 'abc') - self.checkequal(9, 'abcdefghiabc', 'find', 'abc', 1) - self.checkequal(-1, 'abcdefghiabc', 'find', 'def', 4) - - self.checkequal(0, 'abc', 'find', '', 0) - self.checkequal(3, 'abc', 'find', '', 3) - self.checkequal(-1, 'abc', 'find', '', 4) - - self.checkraises(TypeError, 'hello', 'find') - self.checkraises(TypeError, 'hello', 'find', 42) - - # For a variety of combinations, - # verify that str.find() matches __contains__ - # and that the found substring is really at that location - charset = ['', 'a', 'b', 'c'] - digits = 5 - base = len(charset) - teststrings = set() - for i in xrange(base ** digits): - entry = [] - for j in xrange(digits): - i, m = divmod(i, base) - entry.append(charset[m]) - teststrings.add(''.join(entry)) - teststrings = list(teststrings) - for i in teststrings: - i = self.fixtype(i) - for j in teststrings: - loc = i.find(j) - r1 = (loc != -1) - r2 = j in i - if r1 != r2: - self.assertEqual(r1, r2) - if loc != -1: - self.assertEqual(i[loc:loc+len(j)], j) - - def test_rfind(self): - self.checkequal(9, 'abcdefghiabc', 'rfind', 'abc') - self.checkequal(12, 'abcdefghiabc', 'rfind', '') - self.checkequal(0, 'abcdefghiabc', 'rfind', 'abcd') - self.checkequal(-1, 'abcdefghiabc', 'rfind', 'abcz') - - self.checkequal(3, 'abc', 'rfind', '', 0) - self.checkequal(3, 'abc', 'rfind', '', 3) - self.checkequal(-1, 'abc', 'rfind', '', 4) - - self.checkraises(TypeError, 'hello', 'rfind') - self.checkraises(TypeError, 'hello', 'rfind', 42) - - def test_index(self): - self.checkequal(0, 'abcdefghiabc', 'index', '') - self.checkequal(3, 'abcdefghiabc', 'index', 'def') - self.checkequal(0, 'abcdefghiabc', 'index', 'abc') - self.checkequal(9, 'abcdefghiabc', 'index', 'abc', 1) - - self.checkraises(ValueError, 'abcdefghiabc', 'index', 'hib') - self.checkraises(ValueError, 'abcdefghiab', 'index', 'abc', 1) - self.checkraises(ValueError, 'abcdefghi', 'index', 'ghi', 8) - self.checkraises(ValueError, 'abcdefghi', 'index', 'ghi', -1) - - self.checkraises(TypeError, 'hello', 'index') - self.checkraises(TypeError, 'hello', 'index', 42) - - def test_rindex(self): - self.checkequal(12, 'abcdefghiabc', 'rindex', '') - self.checkequal(3, 'abcdefghiabc', 'rindex', 'def') - self.checkequal(9, 'abcdefghiabc', 'rindex', 'abc') - self.checkequal(0, 'abcdefghiabc', 'rindex', 'abc', 0, -1) - - self.checkraises(ValueError, 'abcdefghiabc', 'rindex', 'hib') - self.checkraises(ValueError, 'defghiabc', 'rindex', 'def', 1) - self.checkraises(ValueError, 'defghiabc', 'rindex', 'abc', 0, -1) - self.checkraises(ValueError, 'abcdefghi', 'rindex', 'ghi', 0, 8) - self.checkraises(ValueError, 'abcdefghi', 'rindex', 'ghi', 0, -1) - - self.checkraises(TypeError, 'hello', 'rindex') - self.checkraises(TypeError, 'hello', 'rindex', 42) - - def test_lower(self): - self.checkequal('hello', 'HeLLo', 'lower') - self.checkequal('hello', 'hello', 'lower') - self.checkraises(TypeError, 'hello', 'lower', 42) - - def test_upper(self): - self.checkequal('HELLO', 'HeLLo', 'upper') - self.checkequal('HELLO', 'HELLO', 'upper') - self.checkraises(TypeError, 'hello', 'upper', 42) - - def test_expandtabs(self): - self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs') - self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs', 8) - self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs', 4) - self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi', 'expandtabs', 4) - self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs') - self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs', 8) - self.checkequal('abc\r\nab\r\ndef\ng\r\nhi', 'abc\r\nab\r\ndef\ng\r\nhi', 'expandtabs', 4) - - self.checkraises(TypeError, 'hello', 'expandtabs', 42, 42) - - def test_split(self): - self.checkequal(['this', 'is', 'the', 'split', 'function'], - 'this is the split function', 'split') - - # by whitespace - self.checkequal(['a', 'b', 'c', 'd'], 'a b c d ', 'split') - self.checkequal(['a', 'b c d'], 'a b c d', 'split', None, 1) - self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', None, 2) - self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 3) - self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 4) - self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, - sys.maxint-1) - self.checkequal(['a b c d'], 'a b c d', 'split', None, 0) - self.checkequal(['a b c d'], ' a b c d', 'split', None, 0) - self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', None, 2) - - self.checkequal([], ' ', 'split') - self.checkequal(['a'], ' a ', 'split') - self.checkequal(['a', 'b'], ' a b ', 'split') - self.checkequal(['a', 'b '], ' a b ', 'split', None, 1) - self.checkequal(['a', 'b c '], ' a b c ', 'split', None, 1) - self.checkequal(['a', 'b', 'c '], ' a b c ', 'split', None, 2) - self.checkequal(['a', 'b'], '\n\ta \t\r b \v ', 'split') - aaa = ' a '*20 - self.checkequal(['a']*20, aaa, 'split') - self.checkequal(['a'] + [aaa[4:]], aaa, 'split', None, 1) - self.checkequal(['a']*19 + ['a '], aaa, 'split', None, 19) - - # by a char - self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|') - self.checkequal(['a|b|c|d'], 'a|b|c|d', 'split', '|', 0) - self.checkequal(['a', 'b|c|d'], 'a|b|c|d', 'split', '|', 1) - self.checkequal(['a', 'b', 'c|d'], 'a|b|c|d', 'split', '|', 2) - self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|', 3) - self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|', 4) - self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|', - sys.maxint-2) - self.checkequal(['a|b|c|d'], 'a|b|c|d', 'split', '|', 0) - self.checkequal(['a', '', 'b||c||d'], 'a||b||c||d', 'split', '|', 2) - self.checkequal(['endcase ', ''], 'endcase |', 'split', '|') - self.checkequal(['', ' startcase'], '| startcase', 'split', '|') - self.checkequal(['', 'bothcase', ''], '|bothcase|', 'split', '|') - self.checkequal(['a', '', 'b\x00c\x00d'], 'a\x00\x00b\x00c\x00d', 'split', '\x00', 2) - - self.checkequal(['a']*20, ('a|'*20)[:-1], 'split', '|') - self.checkequal(['a']*15 +['a|a|a|a|a'], - ('a|'*20)[:-1], 'split', '|', 15) - - # by string - self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//') - self.checkequal(['a', 'b//c//d'], 'a//b//c//d', 'split', '//', 1) - self.checkequal(['a', 'b', 'c//d'], 'a//b//c//d', 'split', '//', 2) - self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//', 3) - self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//', 4) - self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//', - sys.maxint-10) - self.checkequal(['a//b//c//d'], 'a//b//c//d', 'split', '//', 0) - self.checkequal(['a', '', 'b////c////d'], 'a////b////c////d', 'split', '//', 2) - self.checkequal(['endcase ', ''], 'endcase test', 'split', 'test') - self.checkequal(['', ' begincase'], 'test begincase', 'split', 'test') - self.checkequal(['', ' bothcase ', ''], 'test bothcase test', - 'split', 'test') - self.checkequal(['a', 'bc'], 'abbbc', 'split', 'bb') - self.checkequal(['', ''], 'aaa', 'split', 'aaa') - self.checkequal(['aaa'], 'aaa', 'split', 'aaa', 0) - self.checkequal(['ab', 'ab'], 'abbaab', 'split', 'ba') - self.checkequal(['aaaa'], 'aaaa', 'split', 'aab') - self.checkequal([''], '', 'split', 'aaa') - self.checkequal(['aa'], 'aa', 'split', 'aaa') - self.checkequal(['A', 'bobb'], 'Abbobbbobb', 'split', 'bbobb') - self.checkequal(['A', 'B', ''], 'AbbobbBbbobb', 'split', 'bbobb') - - self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'split', 'BLAH') - self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'split', 'BLAH', 19) - self.checkequal(['a']*18 + ['aBLAHa'], ('aBLAH'*20)[:-4], - 'split', 'BLAH', 18) - - # mixed use of str and unicode - self.checkequal([u'a', u'b', u'c d'], 'a b c d', 'split', u' ', 2) - - # argument type - self.checkraises(TypeError, 'hello', 'split', 42, 42, 42) - - # null case - self.checkraises(ValueError, 'hello', 'split', '') - self.checkraises(ValueError, 'hello', 'split', '', 0) - - def test_rsplit(self): - self.checkequal(['this', 'is', 'the', 'rsplit', 'function'], - 'this is the rsplit function', 'rsplit') - - # by whitespace - self.checkequal(['a', 'b', 'c', 'd'], 'a b c d ', 'rsplit') - self.checkequal(['a b c', 'd'], 'a b c d', 'rsplit', None, 1) - self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2) - self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 3) - self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 4) - self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, - sys.maxint-20) - self.checkequal(['a b c d'], 'a b c d', 'rsplit', None, 0) - self.checkequal(['a b c d'], 'a b c d ', 'rsplit', None, 0) - self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2) - - self.checkequal([], ' ', 'rsplit') - self.checkequal(['a'], ' a ', 'rsplit') - self.checkequal(['a', 'b'], ' a b ', 'rsplit') - self.checkequal([' a', 'b'], ' a b ', 'rsplit', None, 1) - self.checkequal([' a b','c'], ' a b c ', 'rsplit', - None, 1) - self.checkequal([' a', 'b', 'c'], ' a b c ', 'rsplit', - None, 2) - self.checkequal(['a', 'b'], '\n\ta \t\r b \v ', 'rsplit', None, 88) - aaa = ' a '*20 - self.checkequal(['a']*20, aaa, 'rsplit') - self.checkequal([aaa[:-4]] + ['a'], aaa, 'rsplit', None, 1) - self.checkequal([' a a'] + ['a']*18, aaa, 'rsplit', None, 18) - - - # by a char - self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|') - self.checkequal(['a|b|c', 'd'], 'a|b|c|d', 'rsplit', '|', 1) - self.checkequal(['a|b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 2) - self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 3) - self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 4) - self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', - sys.maxint-100) - self.checkequal(['a|b|c|d'], 'a|b|c|d', 'rsplit', '|', 0) - self.checkequal(['a||b||c', '', 'd'], 'a||b||c||d', 'rsplit', '|', 2) - self.checkequal(['', ' begincase'], '| begincase', 'rsplit', '|') - self.checkequal(['endcase ', ''], 'endcase |', 'rsplit', '|') - self.checkequal(['', 'bothcase', ''], '|bothcase|', 'rsplit', '|') - - self.checkequal(['a\x00\x00b', 'c', 'd'], 'a\x00\x00b\x00c\x00d', 'rsplit', '\x00', 2) - - self.checkequal(['a']*20, ('a|'*20)[:-1], 'rsplit', '|') - self.checkequal(['a|a|a|a|a']+['a']*15, - ('a|'*20)[:-1], 'rsplit', '|', 15) - - # by string - self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//') - self.checkequal(['a//b//c', 'd'], 'a//b//c//d', 'rsplit', '//', 1) - self.checkequal(['a//b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 2) - self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 3) - self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 4) - self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', - sys.maxint-5) - self.checkequal(['a//b//c//d'], 'a//b//c//d', 'rsplit', '//', 0) - self.checkequal(['a////b////c', '', 'd'], 'a////b////c////d', 'rsplit', '//', 2) - self.checkequal(['', ' begincase'], 'test begincase', 'rsplit', 'test') - self.checkequal(['endcase ', ''], 'endcase test', 'rsplit', 'test') - self.checkequal(['', ' bothcase ', ''], 'test bothcase test', - 'rsplit', 'test') - self.checkequal(['ab', 'c'], 'abbbc', 'rsplit', 'bb') - self.checkequal(['', ''], 'aaa', 'rsplit', 'aaa') - self.checkequal(['aaa'], 'aaa', 'rsplit', 'aaa', 0) - self.checkequal(['ab', 'ab'], 'abbaab', 'rsplit', 'ba') - self.checkequal(['aaaa'], 'aaaa', 'rsplit', 'aab') - self.checkequal([''], '', 'rsplit', 'aaa') - self.checkequal(['aa'], 'aa', 'rsplit', 'aaa') - self.checkequal(['bbob', 'A'], 'bbobbbobbA', 'rsplit', 'bbobb') - self.checkequal(['', 'B', 'A'], 'bbobbBbbobbA', 'rsplit', 'bbobb') - - self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'rsplit', 'BLAH') - self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'rsplit', 'BLAH', 19) - self.checkequal(['aBLAHa'] + ['a']*18, ('aBLAH'*20)[:-4], - 'rsplit', 'BLAH', 18) - - # mixed use of str and unicode - self.checkequal([u'a b', u'c', u'd'], 'a b c d', 'rsplit', u' ', 2) - - # argument type - self.checkraises(TypeError, 'hello', 'rsplit', 42, 42, 42) - - # null case - self.checkraises(ValueError, 'hello', 'rsplit', '') - self.checkraises(ValueError, 'hello', 'rsplit', '', 0) - - def test_strip(self): - self.checkequal('hello', ' hello ', 'strip') - self.checkequal('hello ', ' hello ', 'lstrip') - self.checkequal(' hello', ' hello ', 'rstrip') - self.checkequal('hello', 'hello', 'strip') - - # strip/lstrip/rstrip with None arg - self.checkequal('hello', ' hello ', 'strip', None) - self.checkequal('hello ', ' hello ', 'lstrip', None) - self.checkequal(' hello', ' hello ', 'rstrip', None) - self.checkequal('hello', 'hello', 'strip', None) - - # strip/lstrip/rstrip with str arg - self.checkequal('hello', 'xyzzyhelloxyzzy', 'strip', 'xyz') - self.checkequal('helloxyzzy', 'xyzzyhelloxyzzy', 'lstrip', 'xyz') - self.checkequal('xyzzyhello', 'xyzzyhelloxyzzy', 'rstrip', 'xyz') - self.checkequal('hello', 'hello', 'strip', 'xyz') - - # strip/lstrip/rstrip with unicode arg - if test_support.have_unicode: - self.checkequal(unicode('hello', 'ascii'), 'xyzzyhelloxyzzy', - 'strip', unicode('xyz', 'ascii')) - self.checkequal(unicode('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy', - 'lstrip', unicode('xyz', 'ascii')) - self.checkequal(unicode('xyzzyhello', 'ascii'), 'xyzzyhelloxyzzy', - 'rstrip', unicode('xyz', 'ascii')) - self.checkequal(unicode('hello', 'ascii'), 'hello', - 'strip', unicode('xyz', 'ascii')) - - self.checkraises(TypeError, 'hello', 'strip', 42, 42) - self.checkraises(TypeError, 'hello', 'lstrip', 42, 42) - self.checkraises(TypeError, 'hello', 'rstrip', 42, 42) - - def test_ljust(self): - self.checkequal('abc ', 'abc', 'ljust', 10) - self.checkequal('abc ', 'abc', 'ljust', 6) - self.checkequal('abc', 'abc', 'ljust', 3) - self.checkequal('abc', 'abc', 'ljust', 2) - self.checkequal('abc*******', 'abc', 'ljust', 10, '*') - self.checkraises(TypeError, 'abc', 'ljust') - - def test_rjust(self): - self.checkequal(' abc', 'abc', 'rjust', 10) - self.checkequal(' abc', 'abc', 'rjust', 6) - self.checkequal('abc', 'abc', 'rjust', 3) - self.checkequal('abc', 'abc', 'rjust', 2) - self.checkequal('*******abc', 'abc', 'rjust', 10, '*') - self.checkraises(TypeError, 'abc', 'rjust') - - def test_center(self): - self.checkequal(' abc ', 'abc', 'center', 10) - self.checkequal(' abc ', 'abc', 'center', 6) - self.checkequal('abc', 'abc', 'center', 3) - self.checkequal('abc', 'abc', 'center', 2) - self.checkequal('***abc****', 'abc', 'center', 10, '*') - self.checkraises(TypeError, 'abc', 'center') - - def test_swapcase(self): - self.checkequal('hEllO CoMPuTErS', 'HeLLo cOmpUteRs', 'swapcase') - - self.checkraises(TypeError, 'hello', 'swapcase', 42) - - def test_replace(self): - EQ = self.checkequal - - # Operations on the empty string - EQ("", "", "replace", "", "") - EQ("A", "", "replace", "", "A") - EQ("", "", "replace", "A", "") - EQ("", "", "replace", "A", "A") - EQ("", "", "replace", "", "", 100) - EQ("", "", "replace", "", "", sys.maxint) - - # interleave (from=="", 'to' gets inserted everywhere) - EQ("A", "A", "replace", "", "") - EQ("*A*", "A", "replace", "", "*") - EQ("*1A*1", "A", "replace", "", "*1") - EQ("*-#A*-#", "A", "replace", "", "*-#") - EQ("*-A*-A*-", "AA", "replace", "", "*-") - EQ("*-A*-A*-", "AA", "replace", "", "*-", -1) - EQ("*-A*-A*-", "AA", "replace", "", "*-", sys.maxint) - EQ("*-A*-A*-", "AA", "replace", "", "*-", 4) - EQ("*-A*-A*-", "AA", "replace", "", "*-", 3) - EQ("*-A*-A", "AA", "replace", "", "*-", 2) - EQ("*-AA", "AA", "replace", "", "*-", 1) - EQ("AA", "AA", "replace", "", "*-", 0) - - # single character deletion (from=="A", to=="") - EQ("", "A", "replace", "A", "") - EQ("", "AAA", "replace", "A", "") - EQ("", "AAA", "replace", "A", "", -1) - EQ("", "AAA", "replace", "A", "", sys.maxint) - EQ("", "AAA", "replace", "A", "", 4) - EQ("", "AAA", "replace", "A", "", 3) - EQ("A", "AAA", "replace", "A", "", 2) - EQ("AA", "AAA", "replace", "A", "", 1) - EQ("AAA", "AAA", "replace", "A", "", 0) - EQ("", "AAAAAAAAAA", "replace", "A", "") - EQ("BCD", "ABACADA", "replace", "A", "") - EQ("BCD", "ABACADA", "replace", "A", "", -1) - EQ("BCD", "ABACADA", "replace", "A", "", sys.maxint) - EQ("BCD", "ABACADA", "replace", "A", "", 5) - EQ("BCD", "ABACADA", "replace", "A", "", 4) - EQ("BCDA", "ABACADA", "replace", "A", "", 3) - EQ("BCADA", "ABACADA", "replace", "A", "", 2) - EQ("BACADA", "ABACADA", "replace", "A", "", 1) - EQ("ABACADA", "ABACADA", "replace", "A", "", 0) - EQ("BCD", "ABCAD", "replace", "A", "") - EQ("BCD", "ABCADAA", "replace", "A", "") - EQ("BCD", "BCD", "replace", "A", "") - EQ("*************", "*************", "replace", "A", "") - EQ("^A^", "^"+"A"*1000+"^", "replace", "A", "", 999) - - # substring deletion (from=="the", to=="") - EQ("", "the", "replace", "the", "") - EQ("ater", "theater", "replace", "the", "") - EQ("", "thethe", "replace", "the", "") - EQ("", "thethethethe", "replace", "the", "") - EQ("aaaa", "theatheatheathea", "replace", "the", "") - EQ("that", "that", "replace", "the", "") - EQ("thaet", "thaet", "replace", "the", "") - EQ("here and re", "here and there", "replace", "the", "") - EQ("here and re and re", "here and there and there", - "replace", "the", "", sys.maxint) - EQ("here and re and re", "here and there and there", - "replace", "the", "", -1) - EQ("here and re and re", "here and there and there", - "replace", "the", "", 3) - EQ("here and re and re", "here and there and there", - "replace", "the", "", 2) - EQ("here and re and there", "here and there and there", - "replace", "the", "", 1) - EQ("here and there and there", "here and there and there", - "replace", "the", "", 0) - EQ("here and re and re", "here and there and there", "replace", "the", "") - - EQ("abc", "abc", "replace", "the", "") - EQ("abcdefg", "abcdefg", "replace", "the", "") - - # substring deletion (from=="bob", to=="") - EQ("bob", "bbobob", "replace", "bob", "") - EQ("bobXbob", "bbobobXbbobob", "replace", "bob", "") - EQ("aaaaaaa", "aaaaaaabob", "replace", "bob", "") - EQ("aaaaaaa", "aaaaaaa", "replace", "bob", "") - - # single character replace in place (len(from)==len(to)==1) - EQ("Who goes there?", "Who goes there?", "replace", "o", "o") - EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O") - EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", sys.maxint) - EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", -1) - EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", 3) - EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", 2) - EQ("WhO goes there?", "Who goes there?", "replace", "o", "O", 1) - EQ("Who goes there?", "Who goes there?", "replace", "o", "O", 0) - - EQ("Who goes there?", "Who goes there?", "replace", "a", "q") - EQ("who goes there?", "Who goes there?", "replace", "W", "w") - EQ("wwho goes there?ww", "WWho goes there?WW", "replace", "W", "w") - EQ("Who goes there!", "Who goes there?", "replace", "?", "!") - EQ("Who goes there!!", "Who goes there??", "replace", "?", "!") - - EQ("Who goes there?", "Who goes there?", "replace", ".", "!") - - # substring replace in place (len(from)==len(to) > 1) - EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**") - EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", sys.maxint) - EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", -1) - EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", 4) - EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", 3) - EQ("Th** ** a tissue", "This is a tissue", "replace", "is", "**", 2) - EQ("Th** is a tissue", "This is a tissue", "replace", "is", "**", 1) - EQ("This is a tissue", "This is a tissue", "replace", "is", "**", 0) - EQ("cobob", "bobob", "replace", "bob", "cob") - EQ("cobobXcobocob", "bobobXbobobob", "replace", "bob", "cob") - EQ("bobob", "bobob", "replace", "bot", "bot") - - # replace single character (len(from)==1, len(to)>1) - EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK") - EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", -1) - EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", sys.maxint) - EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", 2) - EQ("ReyKKjavik", "Reykjavik", "replace", "k", "KK", 1) - EQ("Reykjavik", "Reykjavik", "replace", "k", "KK", 0) - EQ("A----B----C----", "A.B.C.", "replace", ".", "----") - - EQ("Reykjavik", "Reykjavik", "replace", "q", "KK") - - # replace substring (len(from)>1, len(to)!=len(from)) - EQ("ham, ham, eggs and ham", "spam, spam, eggs and spam", - "replace", "spam", "ham") - EQ("ham, ham, eggs and ham", "spam, spam, eggs and spam", - "replace", "spam", "ham", sys.maxint) - EQ("ham, ham, eggs and ham", "spam, spam, eggs and spam", - "replace", "spam", "ham", -1) - EQ("ham, ham, eggs and ham", "spam, spam, eggs and spam", - "replace", "spam", "ham", 4) - EQ("ham, ham, eggs and ham", "spam, spam, eggs and spam", - "replace", "spam", "ham", 3) - EQ("ham, ham, eggs and spam", "spam, spam, eggs and spam", - "replace", "spam", "ham", 2) - EQ("ham, spam, eggs and spam", "spam, spam, eggs and spam", - "replace", "spam", "ham", 1) - EQ("spam, spam, eggs and spam", "spam, spam, eggs and spam", - "replace", "spam", "ham", 0) - - EQ("bobob", "bobobob", "replace", "bobob", "bob") - EQ("bobobXbobob", "bobobobXbobobob", "replace", "bobob", "bob") - EQ("BOBOBOB", "BOBOBOB", "replace", "bob", "bobby") - - ba = buffer('a') - bb = buffer('b') - EQ("bbc", "abc", "replace", ba, bb) - EQ("aac", "abc", "replace", bb, ba) - - # - self.checkequal('one@two!three!', 'one!two!three!', 'replace', '!', '@', 1) - self.checkequal('onetwothree', 'one!two!three!', 'replace', '!', '') - self.checkequal('one@two@three!', 'one!two!three!', 'replace', '!', '@', 2) - self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 3) - self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 4) - self.checkequal('one!two!three!', 'one!two!three!', 'replace', '!', '@', 0) - self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@') - self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@') - self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@', 2) - self.checkequal('-a-b-c-', 'abc', 'replace', '', '-') - self.checkequal('-a-b-c', 'abc', 'replace', '', '-', 3) - self.checkequal('abc', 'abc', 'replace', '', '-', 0) - self.checkequal('', '', 'replace', '', '') - self.checkequal('abc', 'abc', 'replace', 'ab', '--', 0) - self.checkequal('abc', 'abc', 'replace', 'xy', '--') - # Next three for SF bug 422088: [OSF1 alpha] string.replace(); died with - # MemoryError due to empty result (platform malloc issue when requesting - # 0 bytes). - self.checkequal('', '123', 'replace', '123', '') - self.checkequal('', '123123', 'replace', '123', '') - self.checkequal('x', '123x123', 'replace', '123', '') - - self.checkraises(TypeError, 'hello', 'replace') - self.checkraises(TypeError, 'hello', 'replace', 42) - self.checkraises(TypeError, 'hello', 'replace', 42, 'h') - self.checkraises(TypeError, 'hello', 'replace', 'h', 42) - - def test_replace_overflow(self): - # Check for overflow checking on 32 bit machines - if sys.maxint != 2147483647: - return - A2_16 = "A" * (2**16) - self.checkraises(OverflowError, A2_16, "replace", "", A2_16) - self.checkraises(OverflowError, A2_16, "replace", "A", A2_16) - self.checkraises(OverflowError, A2_16, "replace", "AA", A2_16+A2_16) - - def test_zfill(self): - self.checkequal('123', '123', 'zfill', 2) - self.checkequal('123', '123', 'zfill', 3) - self.checkequal('0123', '123', 'zfill', 4) - self.checkequal('+123', '+123', 'zfill', 3) - self.checkequal('+123', '+123', 'zfill', 4) - self.checkequal('+0123', '+123', 'zfill', 5) - self.checkequal('-123', '-123', 'zfill', 3) - self.checkequal('-123', '-123', 'zfill', 4) - self.checkequal('-0123', '-123', 'zfill', 5) - self.checkequal('000', '', 'zfill', 3) - self.checkequal('34', '34', 'zfill', 1) - self.checkequal('0034', '34', 'zfill', 4) - - self.checkraises(TypeError, '123', 'zfill') - -class MixinStrUnicodeUserStringTest: - # additional tests that only work for - # stringlike objects, i.e. str, unicode, UserString - # (but not the string module) - - def test_islower(self): - self.checkequal(False, '', 'islower') - self.checkequal(True, 'a', 'islower') - self.checkequal(False, 'A', 'islower') - self.checkequal(False, '\n', 'islower') - self.checkequal(True, 'abc', 'islower') - self.checkequal(False, 'aBc', 'islower') - self.checkequal(True, 'abc\n', 'islower') - self.checkraises(TypeError, 'abc', 'islower', 42) - - def test_isupper(self): - self.checkequal(False, '', 'isupper') - self.checkequal(False, 'a', 'isupper') - self.checkequal(True, 'A', 'isupper') - self.checkequal(False, '\n', 'isupper') - self.checkequal(True, 'ABC', 'isupper') - self.checkequal(False, 'AbC', 'isupper') - self.checkequal(True, 'ABC\n', 'isupper') - self.checkraises(TypeError, 'abc', 'isupper', 42) - - def test_istitle(self): - self.checkequal(False, '', 'istitle') - self.checkequal(False, 'a', 'istitle') - self.checkequal(True, 'A', 'istitle') - self.checkequal(False, '\n', 'istitle') - self.checkequal(True, 'A Titlecased Line', 'istitle') - self.checkequal(True, 'A\nTitlecased Line', 'istitle') - self.checkequal(True, 'A Titlecased, Line', 'istitle') - self.checkequal(False, 'Not a capitalized String', 'istitle') - self.checkequal(False, 'Not\ta Titlecase String', 'istitle') - self.checkequal(False, 'Not--a Titlecase String', 'istitle') - self.checkequal(False, 'NOT', 'istitle') - self.checkraises(TypeError, 'abc', 'istitle', 42) - - def test_isspace(self): - self.checkequal(False, '', 'isspace') - self.checkequal(False, 'a', 'isspace') - self.checkequal(True, ' ', 'isspace') - self.checkequal(True, '\t', 'isspace') - self.checkequal(True, '\r', 'isspace') - self.checkequal(True, '\n', 'isspace') - self.checkequal(True, ' \t\r\n', 'isspace') - self.checkequal(False, ' \t\r\na', 'isspace') - self.checkraises(TypeError, 'abc', 'isspace', 42) - - def test_isalpha(self): - self.checkequal(False, '', 'isalpha') - self.checkequal(True, 'a', 'isalpha') - self.checkequal(True, 'A', 'isalpha') - self.checkequal(False, '\n', 'isalpha') - self.checkequal(True, 'abc', 'isalpha') - self.checkequal(False, 'aBc123', 'isalpha') - self.checkequal(False, 'abc\n', 'isalpha') - self.checkraises(TypeError, 'abc', 'isalpha', 42) - - def test_isalnum(self): - self.checkequal(False, '', 'isalnum') - self.checkequal(True, 'a', 'isalnum') - self.checkequal(True, 'A', 'isalnum') - self.checkequal(False, '\n', 'isalnum') - self.checkequal(True, '123abc456', 'isalnum') - self.checkequal(True, 'a1b3c', 'isalnum') - self.checkequal(False, 'aBc000 ', 'isalnum') - self.checkequal(False, 'abc\n', 'isalnum') - self.checkraises(TypeError, 'abc', 'isalnum', 42) - - def test_isdigit(self): - self.checkequal(False, '', 'isdigit') - self.checkequal(False, 'a', 'isdigit') - self.checkequal(True, '0', 'isdigit') - self.checkequal(True, '0123456789', 'isdigit') - self.checkequal(False, '0123456789a', 'isdigit') - - self.checkraises(TypeError, 'abc', 'isdigit', 42) - - def test_title(self): - self.checkequal(' Hello ', ' hello ', 'title') - self.checkequal('Hello ', 'hello ', 'title') - self.checkequal('Hello ', 'Hello ', 'title') - self.checkequal('Format This As Title String', "fOrMaT thIs aS titLe String", 'title') - self.checkequal('Format,This-As*Title;String', "fOrMaT,thIs-aS*titLe;String", 'title', ) - self.checkequal('Getint', "getInt", 'title') - self.checkraises(TypeError, 'hello', 'title', 42) - - def test_splitlines(self): - self.checkequal(['abc', 'def', '', 'ghi'], "abc\ndef\n\rghi", 'splitlines') - self.checkequal(['abc', 'def', '', 'ghi'], "abc\ndef\n\r\nghi", 'splitlines') - self.checkequal(['abc', 'def', 'ghi'], "abc\ndef\r\nghi", 'splitlines') - self.checkequal(['abc', 'def', 'ghi'], "abc\ndef\r\nghi\n", 'splitlines') - self.checkequal(['abc', 'def', 'ghi', ''], "abc\ndef\r\nghi\n\r", 'splitlines') - self.checkequal(['', 'abc', 'def', 'ghi', ''], "\nabc\ndef\r\nghi\n\r", 'splitlines') - self.checkequal(['\n', 'abc\n', 'def\r\n', 'ghi\n', '\r'], "\nabc\ndef\r\nghi\n\r", 'splitlines', 1) - - self.checkraises(TypeError, 'abc', 'splitlines', 42, 42) - - def test_startswith(self): - self.checkequal(True, 'hello', 'startswith', 'he') - self.checkequal(True, 'hello', 'startswith', 'hello') - self.checkequal(False, 'hello', 'startswith', 'hello world') - self.checkequal(True, 'hello', 'startswith', '') - self.checkequal(False, 'hello', 'startswith', 'ello') - self.checkequal(True, 'hello', 'startswith', 'ello', 1) - self.checkequal(True, 'hello', 'startswith', 'o', 4) - self.checkequal(False, 'hello', 'startswith', 'o', 5) - self.checkequal(True, 'hello', 'startswith', '', 5) - self.checkequal(False, 'hello', 'startswith', 'lo', 6) - self.checkequal(True, 'helloworld', 'startswith', 'lowo', 3) - self.checkequal(True, 'helloworld', 'startswith', 'lowo', 3, 7) - self.checkequal(False, 'helloworld', 'startswith', 'lowo', 3, 6) - - # test negative indices - self.checkequal(True, 'hello', 'startswith', 'he', 0, -1) - self.checkequal(True, 'hello', 'startswith', 'he', -53, -1) - self.checkequal(False, 'hello', 'startswith', 'hello', 0, -1) - self.checkequal(False, 'hello', 'startswith', 'hello world', -1, -10) - self.checkequal(False, 'hello', 'startswith', 'ello', -5) - self.checkequal(True, 'hello', 'startswith', 'ello', -4) - self.checkequal(False, 'hello', 'startswith', 'o', -2) - self.checkequal(True, 'hello', 'startswith', 'o', -1) - self.checkequal(True, 'hello', 'startswith', '', -3, -3) - self.checkequal(False, 'hello', 'startswith', 'lo', -9) - - self.checkraises(TypeError, 'hello', 'startswith') - self.checkraises(TypeError, 'hello', 'startswith', 42) - - # test tuple arguments - self.checkequal(True, 'hello', 'startswith', ('he', 'ha')) - self.checkequal(False, 'hello', 'startswith', ('lo', 'llo')) - self.checkequal(True, 'hello', 'startswith', ('hellox', 'hello')) - self.checkequal(False, 'hello', 'startswith', ()) - self.checkequal(True, 'helloworld', 'startswith', ('hellowo', - 'rld', 'lowo'), 3) - self.checkequal(False, 'helloworld', 'startswith', ('hellowo', 'ello', - 'rld'), 3) - self.checkequal(True, 'hello', 'startswith', ('lo', 'he'), 0, -1) - self.checkequal(False, 'hello', 'startswith', ('he', 'hel'), 0, 1) - self.checkequal(True, 'hello', 'startswith', ('he', 'hel'), 0, 2) - - self.checkraises(TypeError, 'hello', 'startswith', (42,)) - - def test_endswith(self): - self.checkequal(True, 'hello', 'endswith', 'lo') - self.checkequal(False, 'hello', 'endswith', 'he') - self.checkequal(True, 'hello', 'endswith', '') - self.checkequal(False, 'hello', 'endswith', 'hello world') - self.checkequal(False, 'helloworld', 'endswith', 'worl') - self.checkequal(True, 'helloworld', 'endswith', 'worl', 3, 9) - self.checkequal(True, 'helloworld', 'endswith', 'world', 3, 12) - self.checkequal(True, 'helloworld', 'endswith', 'lowo', 1, 7) - self.checkequal(True, 'helloworld', 'endswith', 'lowo', 2, 7) - self.checkequal(True, 'helloworld', 'endswith', 'lowo', 3, 7) - self.checkequal(False, 'helloworld', 'endswith', 'lowo', 4, 7) - self.checkequal(False, 'helloworld', 'endswith', 'lowo', 3, 8) - self.checkequal(False, 'ab', 'endswith', 'ab', 0, 1) - self.checkequal(False, 'ab', 'endswith', 'ab', 0, 0) - - # test negative indices - self.checkequal(True, 'hello', 'endswith', 'lo', -2) - self.checkequal(False, 'hello', 'endswith', 'he', -2) - self.checkequal(True, 'hello', 'endswith', '', -3, -3) - self.checkequal(False, 'hello', 'endswith', 'hello world', -10, -2) - self.checkequal(False, 'helloworld', 'endswith', 'worl', -6) - self.checkequal(True, 'helloworld', 'endswith', 'worl', -5, -1) - self.checkequal(True, 'helloworld', 'endswith', 'worl', -5, 9) - self.checkequal(True, 'helloworld', 'endswith', 'world', -7, 12) - self.checkequal(True, 'helloworld', 'endswith', 'lowo', -99, -3) - self.checkequal(True, 'helloworld', 'endswith', 'lowo', -8, -3) - self.checkequal(True, 'helloworld', 'endswith', 'lowo', -7, -3) - self.checkequal(False, 'helloworld', 'endswith', 'lowo', 3, -4) - self.checkequal(False, 'helloworld', 'endswith', 'lowo', -8, -2) - - self.checkraises(TypeError, 'hello', 'endswith') - self.checkraises(TypeError, 'hello', 'endswith', 42) - - # test tuple arguments - self.checkequal(False, 'hello', 'endswith', ('he', 'ha')) - self.checkequal(True, 'hello', 'endswith', ('lo', 'llo')) - self.checkequal(True, 'hello', 'endswith', ('hellox', 'hello')) - self.checkequal(False, 'hello', 'endswith', ()) - self.checkequal(True, 'helloworld', 'endswith', ('hellowo', - 'rld', 'lowo'), 3) - self.checkequal(False, 'helloworld', 'endswith', ('hellowo', 'ello', - 'rld'), 3, -1) - self.checkequal(True, 'hello', 'endswith', ('hell', 'ell'), 0, -1) - self.checkequal(False, 'hello', 'endswith', ('he', 'hel'), 0, 1) - self.checkequal(True, 'hello', 'endswith', ('he', 'hell'), 0, 4) - - self.checkraises(TypeError, 'hello', 'endswith', (42,)) - - def test___contains__(self): - self.checkequal(True, '', '__contains__', '') # vereq('' in '', True) - self.checkequal(True, 'abc', '__contains__', '') # vereq('' in 'abc', True) - self.checkequal(False, 'abc', '__contains__', '\0') # vereq('\0' in 'abc', False) - self.checkequal(True, '\0abc', '__contains__', '\0') # vereq('\0' in '\0abc', True) - self.checkequal(True, 'abc\0', '__contains__', '\0') # vereq('\0' in 'abc\0', True) - self.checkequal(True, '\0abc', '__contains__', 'a') # vereq('a' in '\0abc', True) - self.checkequal(True, 'asdf', '__contains__', 'asdf') # vereq('asdf' in 'asdf', True) - self.checkequal(False, 'asd', '__contains__', 'asdf') # vereq('asdf' in 'asd', False) - self.checkequal(False, '', '__contains__', 'asdf') # vereq('asdf' in '', False) - - def test_subscript(self): - self.checkequal(u'a', 'abc', '__getitem__', 0) - self.checkequal(u'c', 'abc', '__getitem__', -1) - self.checkequal(u'a', 'abc', '__getitem__', 0L) - self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 3)) - self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 1000)) - self.checkequal(u'a', 'abc', '__getitem__', slice(0, 1)) - self.checkequal(u'', 'abc', '__getitem__', slice(0, 0)) - # FIXME What about negative indices? This is handled differently by [] and __getitem__(slice) - - self.checkraises(TypeError, 'abc', '__getitem__', 'def') - - def test_slice(self): - self.checkequal('abc', 'abc', '__getslice__', 0, 1000) - self.checkequal('abc', 'abc', '__getslice__', 0, 3) - self.checkequal('ab', 'abc', '__getslice__', 0, 2) - self.checkequal('bc', 'abc', '__getslice__', 1, 3) - self.checkequal('b', 'abc', '__getslice__', 1, 2) - self.checkequal('', 'abc', '__getslice__', 2, 2) - self.checkequal('', 'abc', '__getslice__', 1000, 1000) - self.checkequal('', 'abc', '__getslice__', 2000, 1000) - self.checkequal('', 'abc', '__getslice__', 2, 1) - # FIXME What about negative indizes? This is handled differently by [] and __getslice__ - - self.checkraises(TypeError, 'abc', '__getslice__', 'def') - - def test_mul(self): - self.checkequal('', 'abc', '__mul__', -1) - self.checkequal('', 'abc', '__mul__', 0) - self.checkequal('abc', 'abc', '__mul__', 1) - self.checkequal('abcabcabc', 'abc', '__mul__', 3) - self.checkraises(TypeError, 'abc', '__mul__') - self.checkraises(TypeError, 'abc', '__mul__', '') - # XXX: on a 64-bit system, this doesn't raise an overflow error, - # but either raises a MemoryError, or succeeds (if you have 54TiB) - #self.checkraises(OverflowError, 10000*'abc', '__mul__', 2000000000) - - def test_join(self): - # join now works with any sequence type - # moved here, because the argument order is - # different in string.join (see the test in - # test.test_string.StringTest.test_join) - self.checkequal('a b c d', ' ', 'join', ['a', 'b', 'c', 'd']) - self.checkequal('abcd', '', 'join', ('a', 'b', 'c', 'd')) - self.checkequal('bd', '', 'join', ('', 'b', '', 'd')) - self.checkequal('ac', '', 'join', ('a', '', 'c', '')) - self.checkequal('w x y z', ' ', 'join', Sequence()) - self.checkequal('abc', 'a', 'join', ('abc',)) - self.checkequal('z', 'a', 'join', UserList(['z'])) - if test_support.have_unicode: - self.checkequal(unicode('a.b.c'), unicode('.'), 'join', ['a', 'b', 'c']) - self.checkequal(unicode('a.b.c'), '.', 'join', [unicode('a'), 'b', 'c']) - self.checkequal(unicode('a.b.c'), '.', 'join', ['a', unicode('b'), 'c']) - self.checkequal(unicode('a.b.c'), '.', 'join', ['a', 'b', unicode('c')]) - self.checkraises(TypeError, '.', 'join', ['a', unicode('b'), 3]) - for i in [5, 25, 125]: - self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join', - ['a' * i] * i) - self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join', - ('a' * i,) * i) - - self.checkraises(TypeError, ' ', 'join', BadSeq1()) - self.checkequal('a b c', ' ', 'join', BadSeq2()) - - self.checkraises(TypeError, ' ', 'join') - self.checkraises(TypeError, ' ', 'join', 7) - self.checkraises(TypeError, ' ', 'join', Sequence([7, 'hello', 123L])) - try: - def f(): - yield 4 + "" - self.fixtype(' ').join(f()) - except TypeError, e: - if '+' not in str(e): - self.fail('join() ate exception message') - else: - self.fail('exception not raised') - - def test_formatting(self): - self.checkequal('+hello+', '+%s+', '__mod__', 'hello') - self.checkequal('+10+', '+%d+', '__mod__', 10) - self.checkequal('a', "%c", '__mod__', "a") - self.checkequal('a', "%c", '__mod__', "a") - self.checkequal('"', "%c", '__mod__', 34) - self.checkequal('$', "%c", '__mod__', 36) - self.checkequal('10', "%d", '__mod__', 10) - self.checkequal('\x7f', "%c", '__mod__', 0x7f) - - for ordinal in (-100, 0x200000): - # unicode raises ValueError, str raises OverflowError - self.checkraises((ValueError, OverflowError), '%c', '__mod__', ordinal) - - self.checkequal(' 42', '%3ld', '__mod__', 42) - self.checkequal('0042.00', '%07.2f', '__mod__', 42) - self.checkequal('0042.00', '%07.2F', '__mod__', 42) - - self.checkraises(TypeError, 'abc', '__mod__') - self.checkraises(TypeError, '%(foo)s', '__mod__', 42) - self.checkraises(TypeError, '%s%s', '__mod__', (42,)) - self.checkraises(TypeError, '%c', '__mod__', (None,)) - self.checkraises(ValueError, '%(foo', '__mod__', {}) - self.checkraises(TypeError, '%(foo)s %(bar)s', '__mod__', ('foo', 42)) - - # argument names with properly nested brackets are supported - self.checkequal('bar', '%((foo))s', '__mod__', {'(foo)': 'bar'}) - - # 100 is a magic number in PyUnicode_Format, this forces a resize - self.checkequal(103*'a'+'x', '%sx', '__mod__', 103*'a') - - self.checkraises(TypeError, '%*s', '__mod__', ('foo', 'bar')) - self.checkraises(TypeError, '%10.*f', '__mod__', ('foo', 42.)) - self.checkraises(ValueError, '%10', '__mod__', (42,)) - - def test_floatformatting(self): - # float formatting - for prec in xrange(100): - format = '%%.%if' % prec - value = 0.01 - for x in xrange(60): - value = value * 3.141592655 / 3.0 * 10.0 - # The formatfloat() code in stringobject.c and - # unicodeobject.c uses a 120 byte buffer and switches from - # 'f' formatting to 'g' at precision 50, so we expect - # OverflowErrors for the ranges x < 50 and prec >= 67. - if x < 50 and prec >= 67: - self.checkraises(OverflowError, format, "__mod__", value) - else: - self.checkcall(format, "__mod__", value) - - def test_inplace_rewrites(self): - # Check that strings don't copy and modify cached single-character strings - self.checkequal('a', 'A', 'lower') - self.checkequal(True, 'A', 'isupper') - self.checkequal('A', 'a', 'upper') - self.checkequal(True, 'a', 'islower') - - self.checkequal('a', 'A', 'replace', 'A', 'a') - self.checkequal(True, 'A', 'isupper') - - self.checkequal('A', 'a', 'capitalize') - self.checkequal(True, 'a', 'islower') - - self.checkequal('A', 'a', 'swapcase') - self.checkequal(True, 'a', 'islower') - - self.checkequal('A', 'a', 'title') - self.checkequal(True, 'a', 'islower') - - def test_partition(self): - - self.checkequal(('this is the par', 'ti', 'tion method'), - 'this is the partition method', 'partition', 'ti') - - # from raymond's original specification - S = 'http://www.python.org' - self.checkequal(('http', '://', 'www.python.org'), S, 'partition', '://') - self.checkequal(('http://www.python.org', '', ''), S, 'partition', '?') - self.checkequal(('', 'http://', 'www.python.org'), S, 'partition', 'http://') - self.checkequal(('http://www.python.', 'org', ''), S, 'partition', 'org') - - self.checkraises(ValueError, S, 'partition', '') - self.checkraises(TypeError, S, 'partition', None) - - def test_rpartition(self): - - self.checkequal(('this is the rparti', 'ti', 'on method'), - 'this is the rpartition method', 'rpartition', 'ti') - - # from raymond's original specification - S = 'http://www.python.org' - self.checkequal(('http', '://', 'www.python.org'), S, 'rpartition', '://') - self.checkequal(('', '', 'http://www.python.org'), S, 'rpartition', '?') - self.checkequal(('', 'http://', 'www.python.org'), S, 'rpartition', 'http://') - self.checkequal(('http://www.python.', 'org', ''), S, 'rpartition', 'org') - - self.checkraises(ValueError, S, 'rpartition', '') - self.checkraises(TypeError, S, 'rpartition', None) - - -class MixinStrStringUserStringTest: - # Additional tests for 8bit strings, i.e. str, UserString and - # the string module - - def test_maketrans(self): - self.assertEqual( - ''.join(map(chr, xrange(256))).replace('abc', 'xyz'), - string.maketrans('abc', 'xyz') - ) - self.assertRaises(ValueError, string.maketrans, 'abc', 'xyzw') - - def test_translate(self): - table = string.maketrans('abc', 'xyz') - self.checkequal('xyzxyz', 'xyzabcdef', 'translate', table, 'def') - - table = string.maketrans('a', 'A') - self.checkequal('Abc', 'abc', 'translate', table) - self.checkequal('xyz', 'xyz', 'translate', table) - self.checkequal('yz', 'xyz', 'translate', table, 'x') - self.checkraises(ValueError, 'xyz', 'translate', 'too short', 'strip') - self.checkraises(ValueError, 'xyz', 'translate', 'too short') - - -class MixinStrUserStringTest: - # Additional tests that only work with - # 8bit compatible object, i.e. str and UserString - - if test_support.have_unicode: - def test_encoding_decoding(self): - codecs = [('rot13', 'uryyb jbeyq'), - ('base64', 'aGVsbG8gd29ybGQ=\n'), - ('hex', '68656c6c6f20776f726c64'), - ('uu', 'begin 666 \n+:&5L;&\\@=V]R;&0 \n \nend\n')] - for encoding, data in codecs: - self.checkequal(data, 'hello world', 'encode', encoding) - self.checkequal('hello world', data, 'decode', encoding) - # zlib is optional, so we make the test optional too... - try: - import zlib - except ImportError: - pass - else: - data = 'x\x9c\xcbH\xcd\xc9\xc9W(\xcf/\xcaI\x01\x00\x1a\x0b\x04]' - self.checkequal(data, 'hello world', 'encode', 'zlib') - self.checkequal('hello world', data, 'decode', 'zlib') - - self.checkraises(TypeError, 'xyz', 'decode', 42) - self.checkraises(TypeError, 'xyz', 'encode', 42) - - -class MixinStrUnicodeTest: - # Additional tests that only work with str and unicode. - - def test_bug1001011(self): - # Make sure join returns a NEW object for single item sequences - # involving a subclass. - # Make sure that it is of the appropriate type. - # Check the optimisation still occurs for standard objects. - t = self.type2test - class subclass(t): - pass - s1 = subclass("abcd") - s2 = t().join([s1]) - self.assert_(s1 is not s2) - self.assert_(type(s2) is t) - - s1 = t("abcd") - s2 = t().join([s1]) - self.assert_(s1 is s2) - - # Should also test mixed-type join. - if t is unicode: - s1 = subclass("abcd") - s2 = "".join([s1]) - self.assert_(s1 is not s2) - self.assert_(type(s2) is t) - - s1 = t("abcd") - s2 = "".join([s1]) - self.assert_(s1 is s2) - - elif t is str: - s1 = subclass("abcd") - s2 = u"".join([s1]) - self.assert_(s1 is not s2) - self.assert_(type(s2) is unicode) # promotes! - - s1 = t("abcd") - s2 = u"".join([s1]) - self.assert_(s1 is not s2) - self.assert_(type(s2) is unicode) # promotes! - - else: - self.fail("unexpected type for MixinStrUnicodeTest %r" % t) diff --git a/sys/lib/python/test/test.xml b/sys/lib/python/test/test.xml deleted file mode 100644 index 9af92fb43..000000000 --- a/sys/lib/python/test/test.xml +++ /dev/null @@ -1,115 +0,0 @@ - - -Introduction to XSL -

Introduction to XSL

- - - -
-

Overview -

-
    - -
  • 1.Intro
  • - -
  • 2.History
  • - -
  • 3.XSL Basics
  • - -
  • Lunch
  • - -
  • 4.An XML Data Model
  • - -
  • 5.XSL Patterns
  • - -
  • 6.XSL Templates
  • - -
  • 7.XSL Formatting Model -
  • - -
- - - - - - -
-

Intro

-
    - -
  • Who am I?
  • - -
  • Who are you?
  • - -
  • Why are we here? -
  • - -
- - - - - - -
-

History: XML and SGML

-
    - -
  • XML is a subset of SGML.
  • - -
  • SGML allows the separation of abstract content from formatting.
  • - -
  • Also one of XML's primary virtues (in the doc publishing domain). -
  • - -
- - - - - - -
-

History: What are stylesheets?

-
    - -
  • Stylesheets specify the formatting of SGML/XML documents.
  • - -
  • Stylesheets put the "style" back into documents.
  • - -
  • New York Times content+NYT Stylesheet = NYT paper -
  • - -
- - - - - - -
-

History: FOSI

-
    - -
  • FOSI: "Formatted Output Specification Instance" -
      -
    • MIL-STD-28001 -
    • - -
    • FOSI's are SGML documents -
    • - -
    • A stylesheet for another document -
    • -
  • - -
  • Obsolete but implemented... -
  • - -
- - - - - diff --git a/sys/lib/python/test/test.xml.out b/sys/lib/python/test/test.xml.out deleted file mode 100644 index d4ab1abcb..000000000 --- a/sys/lib/python/test/test.xml.out +++ /dev/null @@ -1,115 +0,0 @@ - - -Introduction to XSL -

Introduction to XSL

- - - -
-

Overview -

-
    - -
  • 1.Intro
  • - -
  • 2.History
  • - -
  • 3.XSL Basics
  • - -
  • Lunch
  • - -
  • 4.An XML Data Model
  • - -
  • 5.XSL Patterns
  • - -
  • 6.XSL Templates
  • - -
  • 7.XSL Formatting Model -
  • - -
- - - - - - -
-

Intro

-
    - -
  • Who am I?
  • - -
  • Who are you?
  • - -
  • Why are we here? -
  • - -
- - - - - - -
-

History: XML and SGML

-
    - -
  • XML is a subset of SGML.
  • - -
  • SGML allows the separation of abstract content from formatting.
  • - -
  • Also one of XML's primary virtues (in the doc publishing domain). -
  • - -
- - - - - - -
-

History: What are stylesheets?

-
    - -
  • Stylesheets specify the formatting of SGML/XML documents.
  • - -
  • Stylesheets put the "style" back into documents.
  • - -
  • New York Times content+NYT Stylesheet = NYT paper -
  • - -
- - - - - - -
-

History: FOSI

-
    - -
  • FOSI: "Formatted Output Specification Instance" -
      -
    • MIL-STD-28001 -
    • - -
    • FOSI's are SGML documents -
    • - -
    • A stylesheet for another document -
    • -
  • - -
  • Obsolete but implemented... -
  • - -
- - - - - \ No newline at end of file diff --git a/sys/lib/python/test/test_MimeWriter.py b/sys/lib/python/test/test_MimeWriter.py deleted file mode 100644 index 50411058d..000000000 --- a/sys/lib/python/test/test_MimeWriter.py +++ /dev/null @@ -1,170 +0,0 @@ -"""Test program for MimeWriter module. - -The test program was too big to comfortably fit in the MimeWriter -class, so it's here in its own file. - -This should generate Barry's example, modulo some quotes and newlines. - -""" - - -from MimeWriter import MimeWriter - -SELLER = '''\ -INTERFACE Seller-1; - -TYPE Seller = OBJECT - DOCUMENTATION "A simple Seller interface to test ILU" - METHODS - price():INTEGER, - END; -''' - -BUYER = '''\ -class Buyer: - def __setup__(self, maxprice): - self._maxprice = maxprice - - def __main__(self, kos): - """Entry point upon arrival at a new KOS.""" - broker = kos.broker() - # B4 == Barry's Big Bass Business :-) - seller = broker.lookup('Seller_1.Seller', 'B4') - if seller: - price = seller.price() - print 'Seller wants $', price, '... ' - if price > self._maxprice: - print 'too much!' - else: - print "I'll take it!" - else: - print 'no seller found here' -''' # Don't ask why this comment is here - -STATE = '''\ -# instantiate a buyer instance and put it in a magic place for the KOS -# to find. -__kp__ = Buyer() -__kp__.__setup__(500) -''' - -SIMPLE_METADATA = [ - ("Interpreter", "python"), - ("Interpreter-Version", "1.3"), - ("Owner-Name", "Barry Warsaw"), - ("Owner-Rendezvous", "bwarsaw@cnri.reston.va.us"), - ("Home-KSS", "kss.cnri.reston.va.us"), - ("Identifier", "hdl://cnri.kss/my_first_knowbot"), - ("Launch-Date", "Mon Feb 12 16:39:03 EST 1996"), - ] - -COMPLEX_METADATA = [ - ("Metadata-Type", "complex"), - ("Metadata-Key", "connection"), - ("Access", "read-only"), - ("Connection-Description", "Barry's Big Bass Business"), - ("Connection-Id", "B4"), - ("Connection-Direction", "client"), - ] - -EXTERNAL_METADATA = [ - ("Metadata-Type", "complex"), - ("Metadata-Key", "generic-interface"), - ("Access", "read-only"), - ("Connection-Description", "Generic Interface for All Knowbots"), - ("Connection-Id", "generic-kp"), - ("Connection-Direction", "client"), - ] - - -def main(): - import sys - - # Toplevel headers - - toplevel = MimeWriter(sys.stdout) - toplevel.addheader("From", "bwarsaw@cnri.reston.va.us") - toplevel.addheader("Date", "Mon Feb 12 17:21:48 EST 1996") - toplevel.addheader("To", "kss-submit@cnri.reston.va.us") - toplevel.addheader("MIME-Version", "1.0") - - # Toplevel body parts - - f = toplevel.startmultipartbody("knowbot", "801spam999", - [("version", "0.1")], prefix=0) - f.write("This is a multi-part message in MIME format.\n") - - # First toplevel body part: metadata - - md = toplevel.nextpart() - md.startmultipartbody("knowbot-metadata", "802spam999") - - # Metadata part 1 - - md1 = md.nextpart() - md1.addheader("KP-Metadata-Type", "simple") - md1.addheader("KP-Access", "read-only") - m = MimeWriter(md1.startbody("message/rfc822")) - for key, value in SIMPLE_METADATA: - m.addheader("KPMD-" + key, value) - m.flushheaders() - del md1 - - # Metadata part 2 - - md2 = md.nextpart() - for key, value in COMPLEX_METADATA: - md2.addheader("KP-" + key, value) - f = md2.startbody("text/isl") - f.write(SELLER) - del md2 - - # Metadata part 3 - - md3 = md.nextpart() - f = md3.startbody("message/external-body", - [("access-type", "URL"), - ("URL", "hdl://cnri.kss/generic-knowbot")]) - m = MimeWriter(f) - for key, value in EXTERNAL_METADATA: - md3.addheader("KP-" + key, value) - md3.startbody("text/isl") - # Phantom body doesn't need to be written - - md.lastpart() - - # Second toplevel body part: code - - code = toplevel.nextpart() - code.startmultipartbody("knowbot-code", "803spam999") - - # Code: buyer program source - - buyer = code.nextpart() - buyer.addheader("KP-Module-Name", "BuyerKP") - f = buyer.startbody("text/plain") - f.write(BUYER) - - code.lastpart() - - # Third toplevel body part: state - - state = toplevel.nextpart() - state.addheader("KP-Main-Module", "main") - state.startmultipartbody("knowbot-state", "804spam999") - - # State: a bunch of assignments - - st = state.nextpart() - st.addheader("KP-Module-Name", "main") - f = st.startbody("text/plain") - f.write(STATE) - - state.lastpart() - - # End toplevel body parts - - toplevel.lastpart() - - -main() diff --git a/sys/lib/python/test/test_StringIO.py b/sys/lib/python/test/test_StringIO.py deleted file mode 100644 index aa36b0984..000000000 --- a/sys/lib/python/test/test_StringIO.py +++ /dev/null @@ -1,167 +0,0 @@ -# Tests StringIO and cStringIO - -import unittest -import StringIO -import cStringIO -import types -from test import test_support - - -class TestGenericStringIO(unittest.TestCase): - # use a class variable MODULE to define which module is being tested - - # Line of data to test as string - _line = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!' - - # Constructor to use for the test data (._line is passed to this - # constructor) - constructor = str - - def setUp(self): - self._line = self.constructor(self._line) - self._lines = self.constructor((self._line + '\n') * 5) - self._fp = self.MODULE.StringIO(self._lines) - - def test_reads(self): - eq = self.assertEqual - self.assertRaises(TypeError, self._fp.seek) - eq(self._fp.read(10), self._line[:10]) - eq(self._fp.readline(), self._line[10:] + '\n') - eq(len(self._fp.readlines(60)), 2) - - def test_writes(self): - f = self.MODULE.StringIO() - self.assertRaises(TypeError, f.seek) - f.write(self._line[:6]) - f.seek(3) - f.write(self._line[20:26]) - f.write(self._line[52]) - self.assertEqual(f.getvalue(), 'abcuvwxyz!') - - def test_writelines(self): - f = self.MODULE.StringIO() - f.writelines([self._line[0], self._line[1], self._line[2]]) - f.seek(0) - self.assertEqual(f.getvalue(), 'abc') - - def test_writelines_error(self): - def errorGen(): - yield 'a' - raise KeyboardInterrupt() - f = self.MODULE.StringIO() - self.assertRaises(KeyboardInterrupt, f.writelines, errorGen()) - - def test_truncate(self): - eq = self.assertEqual - f = self.MODULE.StringIO() - f.write(self._lines) - f.seek(10) - f.truncate() - eq(f.getvalue(), 'abcdefghij') - f.truncate(5) - eq(f.getvalue(), 'abcde') - f.write('xyz') - eq(f.getvalue(), 'abcdexyz') - f.close() - self.assertRaises(ValueError, f.write, 'frobnitz') - - def test_closed_flag(self): - f = self.MODULE.StringIO() - self.assertEqual(f.closed, False) - f.close() - self.assertEqual(f.closed, True) - f = self.MODULE.StringIO("abc") - self.assertEqual(f.closed, False) - f.close() - self.assertEqual(f.closed, True) - - def test_isatty(self): - f = self.MODULE.StringIO() - self.assertRaises(TypeError, f.isatty, None) - self.assertEqual(f.isatty(), False) - f.close() - self.assertRaises(ValueError, f.isatty) - - def test_iterator(self): - eq = self.assertEqual - unless = self.failUnless - eq(iter(self._fp), self._fp) - # Does this object support the iteration protocol? - unless(hasattr(self._fp, '__iter__')) - unless(hasattr(self._fp, 'next')) - i = 0 - for line in self._fp: - eq(line, self._line + '\n') - i += 1 - eq(i, 5) - self._fp.close() - self.assertRaises(ValueError, self._fp.next) - -class TestStringIO(TestGenericStringIO): - MODULE = StringIO - - def test_unicode(self): - - if not test_support.have_unicode: return - - # The StringIO module also supports concatenating Unicode - # snippets to larger Unicode strings. This is tested by this - # method. Note that cStringIO does not support this extension. - - f = self.MODULE.StringIO() - f.write(self._line[:6]) - f.seek(3) - f.write(unicode(self._line[20:26])) - f.write(unicode(self._line[52])) - s = f.getvalue() - self.assertEqual(s, unicode('abcuvwxyz!')) - self.assertEqual(type(s), types.UnicodeType) - -class TestcStringIO(TestGenericStringIO): - MODULE = cStringIO - - def test_unicode(self): - - if not test_support.have_unicode: return - - # The cStringIO module converts Unicode strings to character - # strings when writing them to cStringIO objects. - # Check that this works. - - f = self.MODULE.StringIO() - f.write(unicode(self._line[:5])) - s = f.getvalue() - self.assertEqual(s, 'abcde') - self.assertEqual(type(s), types.StringType) - - f = self.MODULE.StringIO(unicode(self._line[:5])) - s = f.getvalue() - self.assertEqual(s, 'abcde') - self.assertEqual(type(s), types.StringType) - - self.assertRaises(UnicodeEncodeError, self.MODULE.StringIO, - unicode('\xf4', 'latin-1')) - -import sys -if sys.platform.startswith('java'): - # Jython doesn't have a buffer object, so we just do a useless - # fake of the buffer tests. - buffer = str - -class TestBufferStringIO(TestStringIO): - constructor = buffer - -class TestBuffercStringIO(TestcStringIO): - constructor = buffer - - -def test_main(): - test_support.run_unittest( - TestStringIO, - TestcStringIO, - TestBufferStringIO, - TestBuffercStringIO - ) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test___all__.py b/sys/lib/python/test/test___all__.py deleted file mode 100644 index c45e13997..000000000 --- a/sys/lib/python/test/test___all__.py +++ /dev/null @@ -1,185 +0,0 @@ -import unittest -from test import test_support - -from test.test_support import verify, verbose -import sys -import warnings - -warnings.filterwarnings("ignore", - "the gopherlib module is deprecated", - DeprecationWarning, - "") - -class AllTest(unittest.TestCase): - - def check_all(self, modname): - names = {} - try: - exec "import %s" % modname in names - except ImportError: - # Silent fail here seems the best route since some modules - # may not be available in all environments. - return - verify(hasattr(sys.modules[modname], "__all__"), - "%s has no __all__ attribute" % modname) - names = {} - exec "from %s import *" % modname in names - if names.has_key("__builtins__"): - del names["__builtins__"] - keys = set(names) - all = set(sys.modules[modname].__all__) - verify(keys==all, "%s != %s" % (keys, all)) - - def test_all(self): - if not sys.platform.startswith('java'): - # In case _socket fails to build, make this test fail more gracefully - # than an AttributeError somewhere deep in CGIHTTPServer. - import _socket - - self.check_all("BaseHTTPServer") - self.check_all("Bastion") - self.check_all("CGIHTTPServer") - self.check_all("ConfigParser") - self.check_all("Cookie") - self.check_all("MimeWriter") - self.check_all("Queue") - self.check_all("SimpleHTTPServer") - self.check_all("SocketServer") - self.check_all("StringIO") - self.check_all("UserString") - self.check_all("aifc") - self.check_all("atexit") - self.check_all("audiodev") - self.check_all("base64") - self.check_all("bdb") - self.check_all("binhex") - self.check_all("calendar") - self.check_all("cgi") - self.check_all("cmd") - self.check_all("code") - self.check_all("codecs") - self.check_all("codeop") - self.check_all("colorsys") - self.check_all("commands") - self.check_all("compileall") - self.check_all("copy") - self.check_all("copy_reg") - self.check_all("csv") - self.check_all("dbhash") - self.check_all("decimal") - self.check_all("difflib") - self.check_all("dircache") - self.check_all("dis") - self.check_all("doctest") - self.check_all("dummy_thread") - self.check_all("dummy_threading") - self.check_all("filecmp") - self.check_all("fileinput") - self.check_all("fnmatch") - self.check_all("fpformat") - self.check_all("ftplib") - self.check_all("getopt") - self.check_all("getpass") - self.check_all("gettext") - self.check_all("glob") - self.check_all("gopherlib") - self.check_all("gzip") - self.check_all("heapq") - self.check_all("htmllib") - self.check_all("httplib") - self.check_all("ihooks") - self.check_all("imaplib") - self.check_all("imghdr") - self.check_all("imputil") - self.check_all("keyword") - self.check_all("linecache") - self.check_all("locale") - self.check_all("macpath") - self.check_all("macurl2path") - self.check_all("mailbox") - self.check_all("mailcap") - self.check_all("mhlib") - self.check_all("mimetools") - self.check_all("mimetypes") - self.check_all("mimify") - self.check_all("multifile") - self.check_all("netrc") - self.check_all("nntplib") - self.check_all("ntpath") - self.check_all("opcode") - self.check_all("optparse") - self.check_all("os") - self.check_all("os2emxpath") - self.check_all("pdb") - self.check_all("pickle") - self.check_all("pickletools") - self.check_all("pipes") - self.check_all("popen2") - self.check_all("poplib") - self.check_all("posixpath") - self.check_all("pprint") - self.check_all("profile") - self.check_all("pstats") - self.check_all("pty") - self.check_all("py_compile") - self.check_all("pyclbr") - self.check_all("quopri") - self.check_all("random") - self.check_all("re") - self.check_all("repr") - self.check_all("rexec") - self.check_all("rfc822") - self.check_all("rlcompleter") - self.check_all("robotparser") - self.check_all("sched") - self.check_all("sets") - self.check_all("sgmllib") - self.check_all("shelve") - self.check_all("shlex") - self.check_all("shutil") - self.check_all("smtpd") - self.check_all("smtplib") - self.check_all("sndhdr") - self.check_all("socket") - self.check_all("_strptime") - self.check_all("symtable") - self.check_all("tabnanny") - self.check_all("tarfile") - self.check_all("telnetlib") - self.check_all("tempfile") - self.check_all("textwrap") - self.check_all("threading") - self.check_all("timeit") - self.check_all("toaiff") - self.check_all("tokenize") - self.check_all("traceback") - self.check_all("tty") - self.check_all("unittest") - self.check_all("urllib") - self.check_all("urlparse") - self.check_all("uu") - self.check_all("warnings") - self.check_all("wave") - self.check_all("weakref") - self.check_all("webbrowser") - self.check_all("xdrlib") - self.check_all("zipfile") - - # rlcompleter needs special consideration; it import readline which - # initializes GNU readline which calls setlocale(LC_CTYPE, "")... :-( - try: - self.check_all("rlcompleter") - finally: - try: - import locale - except ImportError: - pass - else: - locale.setlocale(locale.LC_CTYPE, 'C') - - -def test_main(): - test_support.run_unittest(AllTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test___future__.py b/sys/lib/python/test/test___future__.py deleted file mode 100644 index 7d2b2ae44..000000000 --- a/sys/lib/python/test/test___future__.py +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/env python -from test.test_support import verbose, verify -from types import TupleType, StringType, IntType -import __future__ - -GOOD_SERIALS = ("alpha", "beta", "candidate", "final") - -features = __future__.all_feature_names - -# Verify that all_feature_names appears correct. -given_feature_names = features[:] -for name in dir(__future__): - obj = getattr(__future__, name, None) - if obj is not None and isinstance(obj, __future__._Feature): - verify(name in given_feature_names, - "%r should have been in all_feature_names" % name) - given_feature_names.remove(name) -verify(len(given_feature_names) == 0, - "all_feature_names has too much: %r" % given_feature_names) -del given_feature_names - -for feature in features: - value = getattr(__future__, feature) - if verbose: - print "Checking __future__ ", feature, "value", value - - optional = value.getOptionalRelease() - mandatory = value.getMandatoryRelease() - - verify(type(optional) is TupleType, "optional isn't tuple") - verify(len(optional) == 5, "optional isn't 5-tuple") - major, minor, micro, level, serial = optional - verify(type(major) is IntType, "optional major isn't int") - verify(type(minor) is IntType, "optional minor isn't int") - verify(type(micro) is IntType, "optional micro isn't int") - verify(isinstance(level, basestring), "optional level isn't string") - verify(level in GOOD_SERIALS, - "optional level string has unknown value") - verify(type(serial) is IntType, "optional serial isn't int") - - verify(type(mandatory) is TupleType or - mandatory is None, "mandatory isn't tuple or None") - if mandatory is not None: - verify(len(mandatory) == 5, "mandatory isn't 5-tuple") - major, minor, micro, level, serial = mandatory - verify(type(major) is IntType, "mandatory major isn't int") - verify(type(minor) is IntType, "mandatory minor isn't int") - verify(type(micro) is IntType, "mandatory micro isn't int") - verify(isinstance(level, basestring), "mandatory level isn't string") - verify(level in GOOD_SERIALS, - "mandatory serial string has unknown value") - verify(type(serial) is IntType, "mandatory serial isn't int") - verify(optional < mandatory, - "optional not less than mandatory, and mandatory not None") - - verify(hasattr(value, "compiler_flag"), - "feature is missing a .compiler_flag attr") - verify(type(getattr(value, "compiler_flag")) is IntType, - ".compiler_flag isn't int") diff --git a/sys/lib/python/test/test__locale.py b/sys/lib/python/test/test__locale.py deleted file mode 100644 index ec59d7121..000000000 --- a/sys/lib/python/test/test__locale.py +++ /dev/null @@ -1,124 +0,0 @@ -from test.test_support import verbose, TestSkipped, run_unittest -from _locale import (setlocale, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo, - localeconv, Error) -import unittest -from platform import uname - -if uname()[0] == "Darwin": - maj, min, mic = [int(part) for part in uname()[2].split(".")] - if (maj, min, mic) < (8, 0, 0): - raise TestSkipped("locale support broken for OS X < 10.4") - -candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT', - 'et_EE', 'es_PY', 'no_NO', 'nl_NL', 'lv_LV', 'el_GR', 'be_BY', 'fr_BE', - 'ro_RO', 'ru_UA', 'ru_RU', 'es_VE', 'ca_ES', 'se_NO', 'es_EC', 'id_ID', - 'ka_GE', 'es_CL', 'hu_HU', 'wa_BE', 'lt_LT', 'sl_SI', 'hr_HR', 'es_AR', - 'es_ES', 'oc_FR', 'gl_ES', 'bg_BG', 'is_IS', 'mk_MK', 'de_AT', 'pt_BR', - 'da_DK', 'nn_NO', 'cs_CZ', 'de_LU', 'es_BO', 'sq_AL', 'sk_SK', 'fr_CH', - 'de_DE', 'sr_YU', 'br_FR', 'nl_BE', 'sv_FI', 'pl_PL', 'fr_CA', 'fo_FO', - 'bs_BA', 'fr_LU', 'kl_GL', 'fa_IR', 'de_BE', 'sv_SE', 'it_CH', 'uk_UA', - 'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ', 'en_US', - 'es_ES.ISO8859-1', 'fr_FR.ISO8859-15', 'ru_RU.KOI8-R', 'ko_KR.eucKR'] - -# List known locale values to test against when available. -# Dict formatted as `` : (, )``. If a -# value is not known, use '' . -known_numerics = {'fr_FR' : (',', ''), 'en_US':('.', ',')} - -class _LocaleTests(unittest.TestCase): - - def setUp(self): - self.oldlocale = setlocale(LC_NUMERIC) - - def tearDown(self): - setlocale(LC_NUMERIC, self.oldlocale) - - # Want to know what value was calculated, what it was compared against, - # what function was used for the calculation, what type of data was used, - # the locale that was supposedly set, and the actual locale that is set. - lc_numeric_err_msg = "%s != %s (%s for %s; set to %s, using %s)" - - def numeric_tester(self, calc_type, calc_value, data_type, used_locale): - """Compare calculation against known value, if available""" - try: - set_locale = setlocale(LC_NUMERIC) - except Error: - set_locale = "" - known_value = known_numerics.get(used_locale, - ('', ''))[data_type is 'thousands_sep'] - if known_value and calc_value: - self.assertEquals(calc_value, known_value, - self.lc_numeric_err_msg % ( - calc_value, known_value, - calc_type, data_type, set_locale, - used_locale)) - - def test_lc_numeric_nl_langinfo(self): - # Test nl_langinfo against known values - for loc in candidate_locales: - try: - setlocale(LC_NUMERIC, loc) - except Error: - continue - for li, lc in ((RADIXCHAR, "decimal_point"), - (THOUSEP, "thousands_sep")): - self.numeric_tester('nl_langinfo', nl_langinfo(li), lc, loc) - - def test_lc_numeric_localeconv(self): - # Test localeconv against known values - for loc in candidate_locales: - try: - setlocale(LC_NUMERIC, loc) - except Error: - continue - for li, lc in ((RADIXCHAR, "decimal_point"), - (THOUSEP, "thousands_sep")): - self.numeric_tester('localeconv', localeconv()[lc], lc, loc) - - def test_lc_numeric_basic(self): - # Test nl_langinfo against localeconv - for loc in candidate_locales: - try: - setlocale(LC_NUMERIC, loc) - except Error: - continue - for li, lc in ((RADIXCHAR, "decimal_point"), - (THOUSEP, "thousands_sep")): - nl_radixchar = nl_langinfo(li) - li_radixchar = localeconv()[lc] - try: - set_locale = setlocale(LC_NUMERIC) - except Error: - set_locale = "" - self.assertEquals(nl_radixchar, li_radixchar, - "%s (nl_langinfo) != %s (localeconv) " - "(set to %s, using %s)" % ( - nl_radixchar, li_radixchar, - loc, set_locale)) - - def test_float_parsing(self): - # Bug #1391872: Test whether float parsing is okay on European - # locales. - for loc in candidate_locales: - try: - setlocale(LC_NUMERIC, loc) - except Error: - continue - - # Ignore buggy locale databases. (Mac OS 10.4 and some other BSDs) - if loc == 'eu_ES' and localeconv()['decimal_point'] == "' ": - continue - - self.assertEquals(int(eval('3.14') * 100), 314, - "using eval('3.14') failed for %s" % loc) - self.assertEquals(int(float('3.14') * 100), 314, - "using float('3.14') failed for %s" % loc) - if localeconv()['decimal_point'] != '.': - self.assertRaises(ValueError, float, - localeconv()['decimal_point'].join(['1', '23'])) - -def test_main(): - run_unittest(_LocaleTests) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_aepack.py b/sys/lib/python/test/test_aepack.py deleted file mode 100755 index 8a4b035f0..000000000 --- a/sys/lib/python/test/test_aepack.py +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright (C) 2003 Python Software Foundation - -import unittest -import aepack -import aetypes -import os -from test import test_support - -class TestAepack(unittest.TestCase): - OBJECTS = [ - aetypes.Enum('enum'), - aetypes.Type('type'), - aetypes.Keyword('kwrd'), - aetypes.Range(1, 10), - aetypes.Comparison(1, '< ', 10), - aetypes.Logical('not ', 1), - aetypes.IntlText(0, 0, 'international text'), - aetypes.IntlWritingCode(0,0), - aetypes.QDPoint(50,100), - aetypes.QDRectangle(50,100,150,200), - aetypes.RGBColor(0x7000, 0x6000, 0x5000), - aetypes.Unknown('xxxx', 'unknown type data'), - aetypes.Character(1), - aetypes.Character(2, aetypes.Line(2)), - ] - - def test_roundtrip_string(self): - o = 'a string' - packed = aepack.pack(o) - unpacked = aepack.unpack(packed) - self.assertEqual(o, unpacked) - - def test_roundtrip_int(self): - o = 12 - packed = aepack.pack(o) - unpacked = aepack.unpack(packed) - self.assertEqual(o, unpacked) - - def test_roundtrip_float(self): - o = 12.1 - packed = aepack.pack(o) - unpacked = aepack.unpack(packed) - self.assertEqual(o, unpacked) - - def test_roundtrip_None(self): - o = None - packed = aepack.pack(o) - unpacked = aepack.unpack(packed) - self.assertEqual(o, unpacked) - - def test_roundtrip_aeobjects(self): - for o in self.OBJECTS: - packed = aepack.pack(o) - unpacked = aepack.unpack(packed) - self.assertEqual(repr(o), repr(unpacked)) - - def test_roundtrip_FSSpec(self): - try: - import Carbon.File - except: - return - o = Carbon.File.FSSpec(os.curdir) - packed = aepack.pack(o) - unpacked = aepack.unpack(packed) - self.assertEqual(o.as_pathname(), unpacked.as_pathname()) - - def test_roundtrip_Alias(self): - try: - import Carbon.File - except: - return - o = Carbon.File.FSSpec(os.curdir).NewAliasMinimal() - packed = aepack.pack(o) - unpacked = aepack.unpack(packed) - self.assertEqual(o.FSResolveAlias(None)[0].as_pathname(), - unpacked.FSResolveAlias(None)[0].as_pathname()) - - -def test_main(): - test_support.run_unittest(TestAepack) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_al.py b/sys/lib/python/test/test_al.py deleted file mode 100755 index 02876f0b3..000000000 --- a/sys/lib/python/test/test_al.py +++ /dev/null @@ -1,23 +0,0 @@ -#! /usr/bin/env python -"""Whimpy test script for the al module - Roger E. Masse -""" -import al -from test.test_support import verbose - -alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams', - 'newconfig', 'openport', 'queryparams', 'setparams'] - -# This is a very unobtrusive test for the existence of the al module and all its -# attributes. More comprehensive examples can be found in Demo/al - -def main(): - # touch all the attributes of al without doing anything - if verbose: - print 'Touching al module attributes...' - for attr in alattrs: - if verbose: - print 'touching: ', attr - getattr(al, attr) - -main() diff --git a/sys/lib/python/test/test_anydbm.py b/sys/lib/python/test/test_anydbm.py deleted file mode 100644 index 0cdc2c321..000000000 --- a/sys/lib/python/test/test_anydbm.py +++ /dev/null @@ -1,95 +0,0 @@ -#! /usr/bin/env python -"""Test script for the anydbm module - based on testdumbdbm.py -""" - -import os -import unittest -import anydbm -import glob -from test import test_support - -_fname = test_support.TESTFN - -def _delete_files(): - # we don't know the precise name the underlying database uses - # so we use glob to locate all names - for f in glob.glob(_fname + "*"): - try: - os.unlink(f) - except OSError: - pass - -class AnyDBMTestCase(unittest.TestCase): - _dict = {'0': '', - 'a': 'Python:', - 'b': 'Programming', - 'c': 'the', - 'd': 'way', - 'f': 'Guido', - 'g': 'intended' - } - - def __init__(self, *args): - unittest.TestCase.__init__(self, *args) - - def test_anydbm_creation(self): - f = anydbm.open(_fname, 'c') - self.assertEqual(f.keys(), []) - for key in self._dict: - f[key] = self._dict[key] - self.read_helper(f) - f.close() - - def test_anydbm_modification(self): - self.init_db() - f = anydbm.open(_fname, 'c') - self._dict['g'] = f['g'] = "indented" - self.read_helper(f) - f.close() - - def test_anydbm_read(self): - self.init_db() - f = anydbm.open(_fname, 'r') - self.read_helper(f) - f.close() - - def test_anydbm_keys(self): - self.init_db() - f = anydbm.open(_fname, 'r') - keys = self.keys_helper(f) - f.close() - - def read_helper(self, f): - keys = self.keys_helper(f) - for key in self._dict: - self.assertEqual(self._dict[key], f[key]) - - def init_db(self): - f = anydbm.open(_fname, 'n') - for k in self._dict: - f[k] = self._dict[k] - f.close() - - def keys_helper(self, f): - keys = f.keys() - keys.sort() - dkeys = self._dict.keys() - dkeys.sort() - self.assertEqual(keys, dkeys) - return keys - - def tearDown(self): - _delete_files() - - def setUp(self): - _delete_files() - -def test_main(): - try: - test_support.run_unittest(AnyDBMTestCase) - finally: - _delete_files() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_applesingle.py b/sys/lib/python/test/test_applesingle.py deleted file mode 100644 index d533f1abc..000000000 --- a/sys/lib/python/test/test_applesingle.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (C) 2003 Python Software Foundation - -import unittest -import macostools -import Carbon.File -import MacOS -import os -import sys -from test import test_support -import struct -import applesingle - -AS_MAGIC=0x00051600 -AS_VERSION=0x00020000 -dataforkdata = 'hello\r\0world\n' -resourceforkdata = 'goodbye\ncruel\0world\r' - -applesingledata = struct.pack(">ll16sh", AS_MAGIC, AS_VERSION, "foo", 2) + \ - struct.pack(">llllll", 1, 50, len(dataforkdata), - 2, 50+len(dataforkdata), len(resourceforkdata)) + \ - dataforkdata + \ - resourceforkdata -TESTFN2 = test_support.TESTFN + '2' - -class TestApplesingle(unittest.TestCase): - - def setUp(self): - fp = open(test_support.TESTFN, 'w') - fp.write(applesingledata) - fp.close() - - def tearDown(self): - try: - os.unlink(test_support.TESTFN) - except: - pass - try: - os.unlink(TESTFN2) - except: - pass - - def compareData(self, isrf, data): - if isrf: - fp = MacOS.openrf(TESTFN2, '*rb') - else: - fp = open(TESTFN2, 'rb') - filedata = fp.read(1000) - self.assertEqual(data, filedata) - - def test_applesingle(self): - try: - os.unlink(TESTFN2) - except: - pass - applesingle.decode(test_support.TESTFN, TESTFN2) - self.compareData(False, dataforkdata) - self.compareData(True, resourceforkdata) - - def test_applesingle_resonly(self): - try: - os.unlink(TESTFN2) - except: - pass - applesingle.decode(test_support.TESTFN, TESTFN2, resonly=True) - self.compareData(False, resourceforkdata) - -def test_main(): - test_support.run_unittest(TestApplesingle) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_array.py b/sys/lib/python/test/test_array.py deleted file mode 100755 index 597f3b242..000000000 --- a/sys/lib/python/test/test_array.py +++ /dev/null @@ -1,996 +0,0 @@ -#! /usr/bin/env python -"""Test the arraymodule. - Roger E. Masse -""" - -import unittest -from test import test_support -from weakref import proxy -import array, cStringIO, math -from cPickle import loads, dumps - -class ArraySubclass(array.array): - pass - -class ArraySubclassWithKwargs(array.array): - def __init__(self, typecode, newarg=None): - array.array.__init__(typecode) - -tests = [] # list to accumulate all tests -typecodes = "cubBhHiIlLfd" - -class BadConstructorTest(unittest.TestCase): - - def test_constructor(self): - self.assertRaises(TypeError, array.array) - self.assertRaises(TypeError, array.array, spam=42) - self.assertRaises(TypeError, array.array, 'xx') - self.assertRaises(ValueError, array.array, 'x') - -tests.append(BadConstructorTest) - -class BaseTest(unittest.TestCase): - # Required class attributes (provided by subclasses - # typecode: the typecode to test - # example: an initializer usable in the constructor for this type - # smallerexample: the same length as example, but smaller - # biggerexample: the same length as example, but bigger - # outside: An entry that is not in example - # minitemsize: the minimum guaranteed itemsize - - def assertEntryEqual(self, entry1, entry2): - self.assertEqual(entry1, entry2) - - def badtypecode(self): - # Return a typecode that is different from our own - return typecodes[(typecodes.index(self.typecode)+1) % len(typecodes)] - - def test_constructor(self): - a = array.array(self.typecode) - self.assertEqual(a.typecode, self.typecode) - self.assert_(a.itemsize>=self.minitemsize) - self.assertRaises(TypeError, array.array, self.typecode, None) - - def test_len(self): - a = array.array(self.typecode) - a.append(self.example[0]) - self.assertEqual(len(a), 1) - - a = array.array(self.typecode, self.example) - self.assertEqual(len(a), len(self.example)) - - def test_buffer_info(self): - a = array.array(self.typecode, self.example) - self.assertRaises(TypeError, a.buffer_info, 42) - bi = a.buffer_info() - self.assert_(isinstance(bi, tuple)) - self.assertEqual(len(bi), 2) - self.assert_(isinstance(bi[0], (int, long))) - self.assert_(isinstance(bi[1], int)) - self.assertEqual(bi[1], len(a)) - - def test_byteswap(self): - a = array.array(self.typecode, self.example) - self.assertRaises(TypeError, a.byteswap, 42) - if a.itemsize in (1, 2, 4, 8): - b = array.array(self.typecode, self.example) - b.byteswap() - if a.itemsize==1: - self.assertEqual(a, b) - else: - self.assertNotEqual(a, b) - b.byteswap() - self.assertEqual(a, b) - - def test_copy(self): - import copy - a = array.array(self.typecode, self.example) - b = copy.copy(a) - self.assertNotEqual(id(a), id(b)) - self.assertEqual(a, b) - - def test_deepcopy(self): - import copy - a = array.array(self.typecode, self.example) - b = copy.deepcopy(a) - self.assertNotEqual(id(a), id(b)) - self.assertEqual(a, b) - - def test_pickle(self): - for protocol in (0, 1, 2): - a = array.array(self.typecode, self.example) - b = loads(dumps(a, protocol)) - self.assertNotEqual(id(a), id(b)) - self.assertEqual(a, b) - - a = ArraySubclass(self.typecode, self.example) - a.x = 10 - b = loads(dumps(a, protocol)) - self.assertNotEqual(id(a), id(b)) - self.assertEqual(a, b) - self.assertEqual(a.x, b.x) - self.assertEqual(type(a), type(b)) - - def test_pickle_for_empty_array(self): - for protocol in (0, 1, 2): - a = array.array(self.typecode) - b = loads(dumps(a, protocol)) - self.assertNotEqual(id(a), id(b)) - self.assertEqual(a, b) - - a = ArraySubclass(self.typecode) - a.x = 10 - b = loads(dumps(a, protocol)) - self.assertNotEqual(id(a), id(b)) - self.assertEqual(a, b) - self.assertEqual(a.x, b.x) - self.assertEqual(type(a), type(b)) - - def test_insert(self): - a = array.array(self.typecode, self.example) - a.insert(0, self.example[0]) - self.assertEqual(len(a), 1+len(self.example)) - self.assertEqual(a[0], a[1]) - self.assertRaises(TypeError, a.insert) - self.assertRaises(TypeError, a.insert, None) - self.assertRaises(TypeError, a.insert, 0, None) - - a = array.array(self.typecode, self.example) - a.insert(-1, self.example[0]) - self.assertEqual( - a, - array.array( - self.typecode, - self.example[:-1] + self.example[:1] + self.example[-1:] - ) - ) - - a = array.array(self.typecode, self.example) - a.insert(-1000, self.example[0]) - self.assertEqual( - a, - array.array(self.typecode, self.example[:1] + self.example) - ) - - a = array.array(self.typecode, self.example) - a.insert(1000, self.example[0]) - self.assertEqual( - a, - array.array(self.typecode, self.example + self.example[:1]) - ) - - def test_tofromfile(self): - a = array.array(self.typecode, 2*self.example) - self.assertRaises(TypeError, a.tofile) - self.assertRaises(TypeError, a.tofile, cStringIO.StringIO()) - f = open(test_support.TESTFN, 'wb') - try: - a.tofile(f) - f.close() - b = array.array(self.typecode) - f = open(test_support.TESTFN, 'rb') - self.assertRaises(TypeError, b.fromfile) - self.assertRaises( - TypeError, - b.fromfile, - cStringIO.StringIO(), len(self.example) - ) - b.fromfile(f, len(self.example)) - self.assertEqual(b, array.array(self.typecode, self.example)) - self.assertNotEqual(a, b) - b.fromfile(f, len(self.example)) - self.assertEqual(a, b) - self.assertRaises(EOFError, b.fromfile, f, 1) - f.close() - finally: - if not f.closed: - f.close() - test_support.unlink(test_support.TESTFN) - - def test_tofromlist(self): - a = array.array(self.typecode, 2*self.example) - b = array.array(self.typecode) - self.assertRaises(TypeError, a.tolist, 42) - self.assertRaises(TypeError, b.fromlist) - self.assertRaises(TypeError, b.fromlist, 42) - self.assertRaises(TypeError, b.fromlist, [None]) - b.fromlist(a.tolist()) - self.assertEqual(a, b) - - def test_tofromstring(self): - a = array.array(self.typecode, 2*self.example) - b = array.array(self.typecode) - self.assertRaises(TypeError, a.tostring, 42) - self.assertRaises(TypeError, b.fromstring) - self.assertRaises(TypeError, b.fromstring, 42) - b.fromstring(a.tostring()) - self.assertEqual(a, b) - if a.itemsize>1: - self.assertRaises(ValueError, b.fromstring, "x") - - def test_repr(self): - a = array.array(self.typecode, 2*self.example) - self.assertEqual(a, eval(repr(a), {"array": array.array})) - - a = array.array(self.typecode) - self.assertEqual(repr(a), "array('%s')" % self.typecode) - - def test_str(self): - a = array.array(self.typecode, 2*self.example) - str(a) - - def test_cmp(self): - a = array.array(self.typecode, self.example) - self.assert_((a == 42) is False) - self.assert_((a != 42) is True) - - self.assert_((a == a) is True) - self.assert_((a != a) is False) - self.assert_((a < a) is False) - self.assert_((a <= a) is True) - self.assert_((a > a) is False) - self.assert_((a >= a) is True) - - al = array.array(self.typecode, self.smallerexample) - ab = array.array(self.typecode, self.biggerexample) - - self.assert_((a == 2*a) is False) - self.assert_((a != 2*a) is True) - self.assert_((a < 2*a) is True) - self.assert_((a <= 2*a) is True) - self.assert_((a > 2*a) is False) - self.assert_((a >= 2*a) is False) - - self.assert_((a == al) is False) - self.assert_((a != al) is True) - self.assert_((a < al) is False) - self.assert_((a <= al) is False) - self.assert_((a > al) is True) - self.assert_((a >= al) is True) - - self.assert_((a == ab) is False) - self.assert_((a != ab) is True) - self.assert_((a < ab) is True) - self.assert_((a <= ab) is True) - self.assert_((a > ab) is False) - self.assert_((a >= ab) is False) - - def test_add(self): - a = array.array(self.typecode, self.example) \ - + array.array(self.typecode, self.example[::-1]) - self.assertEqual( - a, - array.array(self.typecode, self.example + self.example[::-1]) - ) - - b = array.array(self.badtypecode()) - self.assertRaises(TypeError, a.__add__, b) - - self.assertRaises(TypeError, a.__add__, "bad") - - def test_iadd(self): - a = array.array(self.typecode, self.example[::-1]) - b = a - a += array.array(self.typecode, 2*self.example) - self.assert_(a is b) - self.assertEqual( - a, - array.array(self.typecode, self.example[::-1]+2*self.example) - ) - - b = array.array(self.badtypecode()) - self.assertRaises(TypeError, a.__add__, b) - - self.assertRaises(TypeError, a.__iadd__, "bad") - - def test_mul(self): - a = 5*array.array(self.typecode, self.example) - self.assertEqual( - a, - array.array(self.typecode, 5*self.example) - ) - - a = array.array(self.typecode, self.example)*5 - self.assertEqual( - a, - array.array(self.typecode, self.example*5) - ) - - a = 0*array.array(self.typecode, self.example) - self.assertEqual( - a, - array.array(self.typecode) - ) - - a = (-1)*array.array(self.typecode, self.example) - self.assertEqual( - a, - array.array(self.typecode) - ) - - self.assertRaises(TypeError, a.__mul__, "bad") - - def test_imul(self): - a = array.array(self.typecode, self.example) - b = a - - a *= 5 - self.assert_(a is b) - self.assertEqual( - a, - array.array(self.typecode, 5*self.example) - ) - - a *= 0 - self.assert_(a is b) - self.assertEqual(a, array.array(self.typecode)) - - a *= 1000 - self.assert_(a is b) - self.assertEqual(a, array.array(self.typecode)) - - a *= -1 - self.assert_(a is b) - self.assertEqual(a, array.array(self.typecode)) - - a = array.array(self.typecode, self.example) - a *= -1 - self.assertEqual(a, array.array(self.typecode)) - - self.assertRaises(TypeError, a.__imul__, "bad") - - def test_getitem(self): - a = array.array(self.typecode, self.example) - self.assertEntryEqual(a[0], self.example[0]) - self.assertEntryEqual(a[0L], self.example[0]) - self.assertEntryEqual(a[-1], self.example[-1]) - self.assertEntryEqual(a[-1L], self.example[-1]) - self.assertEntryEqual(a[len(self.example)-1], self.example[-1]) - self.assertEntryEqual(a[-len(self.example)], self.example[0]) - self.assertRaises(TypeError, a.__getitem__) - self.assertRaises(IndexError, a.__getitem__, len(self.example)) - self.assertRaises(IndexError, a.__getitem__, -len(self.example)-1) - - def test_setitem(self): - a = array.array(self.typecode, self.example) - a[0] = a[-1] - self.assertEntryEqual(a[0], a[-1]) - - a = array.array(self.typecode, self.example) - a[0L] = a[-1] - self.assertEntryEqual(a[0], a[-1]) - - a = array.array(self.typecode, self.example) - a[-1] = a[0] - self.assertEntryEqual(a[0], a[-1]) - - a = array.array(self.typecode, self.example) - a[-1L] = a[0] - self.assertEntryEqual(a[0], a[-1]) - - a = array.array(self.typecode, self.example) - a[len(self.example)-1] = a[0] - self.assertEntryEqual(a[0], a[-1]) - - a = array.array(self.typecode, self.example) - a[-len(self.example)] = a[-1] - self.assertEntryEqual(a[0], a[-1]) - - self.assertRaises(TypeError, a.__setitem__) - self.assertRaises(TypeError, a.__setitem__, None) - self.assertRaises(TypeError, a.__setitem__, 0, None) - self.assertRaises( - IndexError, - a.__setitem__, - len(self.example), self.example[0] - ) - self.assertRaises( - IndexError, - a.__setitem__, - -len(self.example)-1, self.example[0] - ) - - def test_delitem(self): - a = array.array(self.typecode, self.example) - del a[0] - self.assertEqual( - a, - array.array(self.typecode, self.example[1:]) - ) - - a = array.array(self.typecode, self.example) - del a[-1] - self.assertEqual( - a, - array.array(self.typecode, self.example[:-1]) - ) - - a = array.array(self.typecode, self.example) - del a[len(self.example)-1] - self.assertEqual( - a, - array.array(self.typecode, self.example[:-1]) - ) - - a = array.array(self.typecode, self.example) - del a[-len(self.example)] - self.assertEqual( - a, - array.array(self.typecode, self.example[1:]) - ) - - self.assertRaises(TypeError, a.__delitem__) - self.assertRaises(TypeError, a.__delitem__, None) - self.assertRaises(IndexError, a.__delitem__, len(self.example)) - self.assertRaises(IndexError, a.__delitem__, -len(self.example)-1) - - def test_getslice(self): - a = array.array(self.typecode, self.example) - self.assertEqual(a[:], a) - - self.assertEqual( - a[1:], - array.array(self.typecode, self.example[1:]) - ) - - self.assertEqual( - a[:1], - array.array(self.typecode, self.example[:1]) - ) - - self.assertEqual( - a[:-1], - array.array(self.typecode, self.example[:-1]) - ) - - self.assertEqual( - a[-1:], - array.array(self.typecode, self.example[-1:]) - ) - - self.assertEqual( - a[-1:-1], - array.array(self.typecode) - ) - - self.assertEqual( - a[2:1], - array.array(self.typecode) - ) - - self.assertEqual( - a[1000:], - array.array(self.typecode) - ) - self.assertEqual(a[-1000:], a) - self.assertEqual(a[:1000], a) - self.assertEqual( - a[:-1000], - array.array(self.typecode) - ) - self.assertEqual(a[-1000:1000], a) - self.assertEqual( - a[2000:1000], - array.array(self.typecode) - ) - - def test_setslice(self): - a = array.array(self.typecode, self.example) - a[:1] = a - self.assertEqual( - a, - array.array(self.typecode, self.example + self.example[1:]) - ) - - a = array.array(self.typecode, self.example) - a[:-1] = a - self.assertEqual( - a, - array.array(self.typecode, self.example + self.example[-1:]) - ) - - a = array.array(self.typecode, self.example) - a[-1:] = a - self.assertEqual( - a, - array.array(self.typecode, self.example[:-1] + self.example) - ) - - a = array.array(self.typecode, self.example) - a[1:] = a - self.assertEqual( - a, - array.array(self.typecode, self.example[:1] + self.example) - ) - - a = array.array(self.typecode, self.example) - a[1:-1] = a - self.assertEqual( - a, - array.array( - self.typecode, - self.example[:1] + self.example + self.example[-1:] - ) - ) - - a = array.array(self.typecode, self.example) - a[1000:] = a - self.assertEqual( - a, - array.array(self.typecode, 2*self.example) - ) - - a = array.array(self.typecode, self.example) - a[-1000:] = a - self.assertEqual( - a, - array.array(self.typecode, self.example) - ) - - a = array.array(self.typecode, self.example) - a[:1000] = a - self.assertEqual( - a, - array.array(self.typecode, self.example) - ) - - a = array.array(self.typecode, self.example) - a[:-1000] = a - self.assertEqual( - a, - array.array(self.typecode, 2*self.example) - ) - - a = array.array(self.typecode, self.example) - a[1:0] = a - self.assertEqual( - a, - array.array(self.typecode, self.example[:1] + self.example + self.example[1:]) - ) - - a = array.array(self.typecode, self.example) - a[2000:1000] = a - self.assertEqual( - a, - array.array(self.typecode, 2*self.example) - ) - - a = array.array(self.typecode, self.example) - self.assertRaises(TypeError, a.__setslice__, 0, 0, None) - self.assertRaises(TypeError, a.__setitem__, slice(0, 1), None) - - b = array.array(self.badtypecode()) - self.assertRaises(TypeError, a.__setslice__, 0, 0, b) - self.assertRaises(TypeError, a.__setitem__, slice(0, 1), b) - - def test_index(self): - example = 2*self.example - a = array.array(self.typecode, example) - self.assertRaises(TypeError, a.index) - for x in example: - self.assertEqual(a.index(x), example.index(x)) - self.assertRaises(ValueError, a.index, None) - self.assertRaises(ValueError, a.index, self.outside) - - def test_count(self): - example = 2*self.example - a = array.array(self.typecode, example) - self.assertRaises(TypeError, a.count) - for x in example: - self.assertEqual(a.count(x), example.count(x)) - self.assertEqual(a.count(self.outside), 0) - self.assertEqual(a.count(None), 0) - - def test_remove(self): - for x in self.example: - example = 2*self.example - a = array.array(self.typecode, example) - pos = example.index(x) - example2 = example[:pos] + example[pos+1:] - a.remove(x) - self.assertEqual(a, array.array(self.typecode, example2)) - - a = array.array(self.typecode, self.example) - self.assertRaises(ValueError, a.remove, self.outside) - - self.assertRaises(ValueError, a.remove, None) - - def test_pop(self): - a = array.array(self.typecode) - self.assertRaises(IndexError, a.pop) - - a = array.array(self.typecode, 2*self.example) - self.assertRaises(TypeError, a.pop, 42, 42) - self.assertRaises(TypeError, a.pop, None) - self.assertRaises(IndexError, a.pop, len(a)) - self.assertRaises(IndexError, a.pop, -len(a)-1) - - self.assertEntryEqual(a.pop(0), self.example[0]) - self.assertEqual( - a, - array.array(self.typecode, self.example[1:]+self.example) - ) - self.assertEntryEqual(a.pop(1), self.example[2]) - self.assertEqual( - a, - array.array(self.typecode, self.example[1:2]+self.example[3:]+self.example) - ) - self.assertEntryEqual(a.pop(0), self.example[1]) - self.assertEntryEqual(a.pop(), self.example[-1]) - self.assertEqual( - a, - array.array(self.typecode, self.example[3:]+self.example[:-1]) - ) - - def test_reverse(self): - a = array.array(self.typecode, self.example) - self.assertRaises(TypeError, a.reverse, 42) - a.reverse() - self.assertEqual( - a, - array.array(self.typecode, self.example[::-1]) - ) - - def test_extend(self): - a = array.array(self.typecode, self.example) - self.assertRaises(TypeError, a.extend) - a.extend(array.array(self.typecode, self.example[::-1])) - self.assertEqual( - a, - array.array(self.typecode, self.example+self.example[::-1]) - ) - - b = array.array(self.badtypecode()) - self.assertRaises(TypeError, a.extend, b) - - a = array.array(self.typecode, self.example) - a.extend(self.example[::-1]) - self.assertEqual( - a, - array.array(self.typecode, self.example+self.example[::-1]) - ) - - def test_constructor_with_iterable_argument(self): - a = array.array(self.typecode, iter(self.example)) - b = array.array(self.typecode, self.example) - self.assertEqual(a, b) - - # non-iterable argument - self.assertRaises(TypeError, array.array, self.typecode, 10) - - # pass through errors raised in __iter__ - class A: - def __iter__(self): - raise UnicodeError - self.assertRaises(UnicodeError, array.array, self.typecode, A()) - - # pass through errors raised in next() - def B(): - raise UnicodeError - yield None - self.assertRaises(UnicodeError, array.array, self.typecode, B()) - - def test_coveritertraverse(self): - try: - import gc - except ImportError: - return - a = array.array(self.typecode) - l = [iter(a)] - l.append(l) - gc.collect() - - def test_buffer(self): - a = array.array(self.typecode, self.example) - b = buffer(a) - self.assertEqual(b[0], a.tostring()[0]) - - def test_weakref(self): - s = array.array(self.typecode, self.example) - p = proxy(s) - self.assertEqual(p.tostring(), s.tostring()) - s = None - self.assertRaises(ReferenceError, len, p) - - def test_bug_782369(self): - import sys - if hasattr(sys, "getrefcount"): - for i in range(10): - b = array.array('B', range(64)) - rc = sys.getrefcount(10) - for i in range(10): - b = array.array('B', range(64)) - self.assertEqual(rc, sys.getrefcount(10)) - - def test_subclass_with_kwargs(self): - # SF bug #1486663 -- this used to erroneously raise a TypeError - ArraySubclassWithKwargs('b', newarg=1) - - -class StringTest(BaseTest): - - def test_setitem(self): - super(StringTest, self).test_setitem() - a = array.array(self.typecode, self.example) - self.assertRaises(TypeError, a.__setitem__, 0, self.example[:2]) - -class CharacterTest(StringTest): - typecode = 'c' - example = '\x01azAZ\x00\xfe' - smallerexample = '\x01azAY\x00\xfe' - biggerexample = '\x01azAZ\x00\xff' - outside = '\x33' - minitemsize = 1 - - def test_subbclassing(self): - class EditableString(array.array): - def __new__(cls, s, *args, **kwargs): - return array.array.__new__(cls, 'c', s) - - def __init__(self, s, color='blue'): - array.array.__init__(self, 'c', s) - self.color = color - - def strip(self): - self[:] = array.array('c', self.tostring().strip()) - - def __repr__(self): - return 'EditableString(%r)' % self.tostring() - - s = EditableString("\ttest\r\n") - s.strip() - self.assertEqual(s.tostring(), "test") - - self.assertEqual(s.color, "blue") - s.color = "red" - self.assertEqual(s.color, "red") - self.assertEqual(s.__dict__.keys(), ["color"]) - - def test_nounicode(self): - a = array.array(self.typecode, self.example) - self.assertRaises(ValueError, a.fromunicode, unicode('')) - self.assertRaises(ValueError, a.tounicode) - -tests.append(CharacterTest) - -if test_support.have_unicode: - class UnicodeTest(StringTest): - typecode = 'u' - example = unicode(r'\x01\u263a\x00\ufeff', 'unicode-escape') - smallerexample = unicode(r'\x01\u263a\x00\ufefe', 'unicode-escape') - biggerexample = unicode(r'\x01\u263a\x01\ufeff', 'unicode-escape') - outside = unicode('\x33') - minitemsize = 2 - - def test_unicode(self): - self.assertRaises(TypeError, array.array, 'b', unicode('foo', 'ascii')) - - a = array.array('u', unicode(r'\xa0\xc2\u1234', 'unicode-escape')) - a.fromunicode(unicode(' ', 'ascii')) - a.fromunicode(unicode('', 'ascii')) - a.fromunicode(unicode('', 'ascii')) - a.fromunicode(unicode(r'\x11abc\xff\u1234', 'unicode-escape')) - s = a.tounicode() - self.assertEqual( - s, - unicode(r'\xa0\xc2\u1234 \x11abc\xff\u1234', 'unicode-escape') - ) - - s = unicode(r'\x00="\'a\\b\x80\xff\u0000\u0001\u1234', 'unicode-escape') - a = array.array('u', s) - self.assertEqual( - repr(a), - r"""array('u', u'\x00="\'a\\b\x80\xff\x00\x01\u1234')""" - ) - - self.assertRaises(TypeError, a.fromunicode) - - tests.append(UnicodeTest) - -class NumberTest(BaseTest): - - def test_extslice(self): - a = array.array(self.typecode, range(5)) - self.assertEqual(a[::], a) - self.assertEqual(a[::2], array.array(self.typecode, [0,2,4])) - self.assertEqual(a[1::2], array.array(self.typecode, [1,3])) - self.assertEqual(a[::-1], array.array(self.typecode, [4,3,2,1,0])) - self.assertEqual(a[::-2], array.array(self.typecode, [4,2,0])) - self.assertEqual(a[3::-2], array.array(self.typecode, [3,1])) - self.assertEqual(a[-100:100:], a) - self.assertEqual(a[100:-100:-1], a[::-1]) - self.assertEqual(a[-100L:100L:2L], array.array(self.typecode, [0,2,4])) - self.assertEqual(a[1000:2000:2], array.array(self.typecode, [])) - self.assertEqual(a[-1000:-2000:-2], array.array(self.typecode, [])) - - def test_delslice(self): - a = array.array(self.typecode, range(5)) - del a[::2] - self.assertEqual(a, array.array(self.typecode, [1,3])) - a = array.array(self.typecode, range(5)) - del a[1::2] - self.assertEqual(a, array.array(self.typecode, [0,2,4])) - a = array.array(self.typecode, range(5)) - del a[1::-2] - self.assertEqual(a, array.array(self.typecode, [0,2,3,4])) - a = array.array(self.typecode, range(10)) - del a[::1000] - self.assertEqual(a, array.array(self.typecode, [1,2,3,4,5,6,7,8,9])) - - def test_assignment(self): - a = array.array(self.typecode, range(10)) - a[::2] = array.array(self.typecode, [42]*5) - self.assertEqual(a, array.array(self.typecode, [42, 1, 42, 3, 42, 5, 42, 7, 42, 9])) - a = array.array(self.typecode, range(10)) - a[::-4] = array.array(self.typecode, [10]*3) - self.assertEqual(a, array.array(self.typecode, [0, 10, 2, 3, 4, 10, 6, 7, 8 ,10])) - a = array.array(self.typecode, range(4)) - a[::-1] = a - self.assertEqual(a, array.array(self.typecode, [3, 2, 1, 0])) - a = array.array(self.typecode, range(10)) - b = a[:] - c = a[:] - ins = array.array(self.typecode, range(2)) - a[2:3] = ins - b[slice(2,3)] = ins - c[2:3:] = ins - - def test_iterationcontains(self): - a = array.array(self.typecode, range(10)) - self.assertEqual(list(a), range(10)) - b = array.array(self.typecode, [20]) - self.assertEqual(a[-1] in a, True) - self.assertEqual(b[0] not in a, True) - - def check_overflow(self, lower, upper): - # method to be used by subclasses - - # should not overflow assigning lower limit - a = array.array(self.typecode, [lower]) - a[0] = lower - # should overflow assigning less than lower limit - self.assertRaises(OverflowError, array.array, self.typecode, [lower-1]) - self.assertRaises(OverflowError, a.__setitem__, 0, lower-1) - # should not overflow assigning upper limit - a = array.array(self.typecode, [upper]) - a[0] = upper - # should overflow assigning more than upper limit - self.assertRaises(OverflowError, array.array, self.typecode, [upper+1]) - self.assertRaises(OverflowError, a.__setitem__, 0, upper+1) - - def test_subclassing(self): - typecode = self.typecode - class ExaggeratingArray(array.array): - __slots__ = ['offset'] - - def __new__(cls, typecode, data, offset): - return array.array.__new__(cls, typecode, data) - - def __init__(self, typecode, data, offset): - self.offset = offset - - def __getitem__(self, i): - return array.array.__getitem__(self, i) + self.offset - - a = ExaggeratingArray(self.typecode, [3, 6, 7, 11], 4) - self.assertEntryEqual(a[0], 7) - - self.assertRaises(AttributeError, setattr, a, "color", "blue") - -class SignedNumberTest(NumberTest): - example = [-1, 0, 1, 42, 0x7f] - smallerexample = [-1, 0, 1, 42, 0x7e] - biggerexample = [-1, 0, 1, 43, 0x7f] - outside = 23 - - def test_overflow(self): - a = array.array(self.typecode) - lower = -1 * long(pow(2, a.itemsize * 8 - 1)) - upper = long(pow(2, a.itemsize * 8 - 1)) - 1L - self.check_overflow(lower, upper) - -class UnsignedNumberTest(NumberTest): - example = [0, 1, 17, 23, 42, 0xff] - smallerexample = [0, 1, 17, 23, 42, 0xfe] - biggerexample = [0, 1, 17, 23, 43, 0xff] - outside = 0xaa - - def test_overflow(self): - a = array.array(self.typecode) - lower = 0 - upper = long(pow(2, a.itemsize * 8)) - 1L - self.check_overflow(lower, upper) - - -class ByteTest(SignedNumberTest): - typecode = 'b' - minitemsize = 1 -tests.append(ByteTest) - -class UnsignedByteTest(UnsignedNumberTest): - typecode = 'B' - minitemsize = 1 -tests.append(UnsignedByteTest) - -class ShortTest(SignedNumberTest): - typecode = 'h' - minitemsize = 2 -tests.append(ShortTest) - -class UnsignedShortTest(UnsignedNumberTest): - typecode = 'H' - minitemsize = 2 -tests.append(UnsignedShortTest) - -class IntTest(SignedNumberTest): - typecode = 'i' - minitemsize = 2 -tests.append(IntTest) - -class UnsignedIntTest(UnsignedNumberTest): - typecode = 'I' - minitemsize = 2 -tests.append(UnsignedIntTest) - -class LongTest(SignedNumberTest): - typecode = 'l' - minitemsize = 4 -tests.append(LongTest) - -class UnsignedLongTest(UnsignedNumberTest): - typecode = 'L' - minitemsize = 4 -tests.append(UnsignedLongTest) - -class FPTest(NumberTest): - example = [-42.0, 0, 42, 1e5, -1e10] - smallerexample = [-42.0, 0, 42, 1e5, -2e10] - biggerexample = [-42.0, 0, 42, 1e5, 1e10] - outside = 23 - - def assertEntryEqual(self, entry1, entry2): - self.assertAlmostEqual(entry1, entry2) - - def test_byteswap(self): - a = array.array(self.typecode, self.example) - self.assertRaises(TypeError, a.byteswap, 42) - if a.itemsize in (1, 2, 4, 8): - b = array.array(self.typecode, self.example) - b.byteswap() - if a.itemsize==1: - self.assertEqual(a, b) - else: - # On alphas treating the byte swapped bit patters as - # floats/doubles results in floating point exceptions - # => compare the 8bit string values instead - self.assertNotEqual(a.tostring(), b.tostring()) - b.byteswap() - self.assertEqual(a, b) - -class FloatTest(FPTest): - typecode = 'f' - minitemsize = 4 -tests.append(FloatTest) - -class DoubleTest(FPTest): - typecode = 'd' - minitemsize = 8 -tests.append(DoubleTest) - -def test_main(verbose=None): - import sys - - test_support.run_unittest(*tests) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*tests) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_ast.py b/sys/lib/python/test/test_ast.py deleted file mode 100644 index 14fc01026..000000000 --- a/sys/lib/python/test/test_ast.py +++ /dev/null @@ -1,204 +0,0 @@ -import sys, itertools -import _ast - -def to_tuple(t): - if t is None or isinstance(t, (basestring, int, long, complex)): - return t - elif isinstance(t, list): - return [to_tuple(e) for e in t] - result = [t.__class__.__name__] - if hasattr(t, 'lineno') and hasattr(t, 'col_offset'): - result.append((t.lineno, t.col_offset)) - if t._fields is None: - return tuple(result) - for f in t._fields: - result.append(to_tuple(getattr(t, f))) - return tuple(result) - -# These tests are compiled through "exec" -# There should be atleast one test per statement -exec_tests = [ - # FunctionDef - "def f(): pass", - # ClassDef - "class C:pass", - # Return - "def f():return 1", - # Delete - "del v", - # Assign - "v = 1", - # AugAssign - "v += 1", - # Print - "print >>f, 1, ", - # For - "for v in v:pass", - # While - "while v:pass", - # If - "if v:pass", - # Raise - "raise Exception, 'string'", - # TryExcept - "try:\n pass\nexcept Exception:\n pass", - # TryFinally - "try:\n pass\nfinally:\n pass", - # Assert - "assert v", - # Import - "import sys", - # ImportFrom - "from sys import v", - # Exec - "exec 'v'", - # Global - "global v", - # Expr - "1", - # Pass, - "pass", - # Break - "break", - # Continue - "continue", -] - -# These are compiled through "single" -# because of overlap with "eval", it just tests what -# can't be tested with "eval" -single_tests = [ - "1+2" -] - -# These are compiled through "eval" -# It should test all expressions -eval_tests = [ - # BoolOp - "a and b", - # BinOp - "a + b", - # UnaryOp - "not v", - # Lambda - "lambda:None", - # Dict - "{ 1:2 }", - # ListComp - "[a for b in c if d]", - # GeneratorExp - "(a for b in c if d)", - # Yield - yield expressions can't work outside a function - # - # Compare - "1 < 2 < 3", - # Call - "f(1,2,c=3,*d,**e)", - # Repr - "`v`", - # Num - "10L", - # Str - "'string'", - # Attribute - "a.b", - # Subscript - "a[b:c]", - # Name - "v", - # List - "[1,2,3]", - # Tuple - "1,2,3", - # Combination - "a.b.c.d(a.b[1:2])", - -] - -# TODO: expr_context, slice, boolop, operator, unaryop, cmpop, comprehension -# excepthandler, arguments, keywords, alias - -if __name__=='__main__' and sys.argv[1:] == ['-g']: - for statements, kind in ((exec_tests, "exec"), (single_tests, "single"), - (eval_tests, "eval")): - print kind+"_results = [" - for s in statements: - print repr(to_tuple(compile(s, "?", kind, 0x400)))+"," - print "]" - print "run_tests()" - raise SystemExit - -def test_order(ast_node, parent_pos): - - if not isinstance(ast_node, _ast.AST) or ast_node._fields == None: - return - if isinstance(ast_node, (_ast.expr, _ast.stmt, _ast.excepthandler)): - node_pos = (ast_node.lineno, ast_node.col_offset) - assert node_pos >= parent_pos, (node_pos, parent_pos) - parent_pos = (ast_node.lineno, ast_node.col_offset) - for name in ast_node._fields: - value = getattr(ast_node, name) - if isinstance(value, list): - for child in value: - test_order(child, parent_pos) - elif value != None: - test_order(value, parent_pos) - -def run_tests(): - for input, output, kind in ((exec_tests, exec_results, "exec"), - (single_tests, single_results, "single"), - (eval_tests, eval_results, "eval")): - for i, o in itertools.izip(input, output): - ast_tree = compile(i, "?", kind, 0x400) - assert to_tuple(ast_tree) == o - test_order(ast_tree, (0, 0)) - -#### EVERYTHING BELOW IS GENERATED ##### -exec_results = [ -('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, None, []), [('Pass', (1, 9))], [])]), -('Module', [('ClassDef', (1, 0), 'C', [], [('Pass', (1, 8))])]), -('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, None, []), [('Return', (1, 8), ('Num', (1, 15), 1))], [])]), -('Module', [('Delete', (1, 0), [('Name', (1, 4), 'v', ('Del',))])]), -('Module', [('Assign', (1, 0), [('Name', (1, 0), 'v', ('Store',))], ('Num', (1, 4), 1))]), -('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Store',)), ('Add',), ('Num', (1, 5), 1))]), -('Module', [('Print', (1, 0), ('Name', (1, 8), 'f', ('Load',)), [('Num', (1, 11), 1)], False)]), -('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Pass', (1, 11))], [])]), -('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])]), -('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])]), -('Module', [('Raise', (1, 0), ('Name', (1, 6), 'Exception', ('Load',)), ('Str', (1, 17), 'string'), None)]), -('Module', [('TryExcept', (1, 0), [('Pass', (2, 2))], [('excepthandler', (3, 0), ('Name', (3, 7), 'Exception', ('Load',)), None, [('Pass', (4, 2))], 3, 0)], [])]), -('Module', [('TryFinally', (1, 0), [('Pass', (2, 2))], [('Pass', (4, 2))])]), -('Module', [('Assert', (1, 0), ('Name', (1, 7), 'v', ('Load',)), None)]), -('Module', [('Import', (1, 0), [('alias', 'sys', None)])]), -('Module', [('ImportFrom', (1, 0), 'sys', [('alias', 'v', None)], 0)]), -('Module', [('Exec', (1, 0), ('Str', (1, 5), 'v'), None, None)]), -('Module', [('Global', (1, 0), ['v'])]), -('Module', [('Expr', (1, 0), ('Num', (1, 0), 1))]), -('Module', [('Pass', (1, 0))]), -('Module', [('Break', (1, 0))]), -('Module', [('Continue', (1, 0))]), -] -single_results = [ -('Interactive', [('Expr', (1, 0), ('BinOp', (1, 0), ('Num', (1, 0), 1), ('Add',), ('Num', (1, 2), 2)))]), -] -eval_results = [ -('Expression', ('BoolOp', (1, 0), ('And',), [('Name', (1, 0), 'a', ('Load',)), ('Name', (1, 6), 'b', ('Load',))])), -('Expression', ('BinOp', (1, 0), ('Name', (1, 0), 'a', ('Load',)), ('Add',), ('Name', (1, 4), 'b', ('Load',)))), -('Expression', ('UnaryOp', (1, 0), ('Not',), ('Name', (1, 4), 'v', ('Load',)))), -('Expression', ('Lambda', (1, 0), ('arguments', [], None, None, []), ('Name', (1, 7), 'None', ('Load',)))), -('Expression', ('Dict', (1, 0), [('Num', (1, 2), 1)], [('Num', (1, 4), 2)])), -('Expression', ('ListComp', (1, 1), ('Name', (1, 1), 'a', ('Load',)), [('comprehension', ('Name', (1, 7), 'b', ('Store',)), ('Name', (1, 12), 'c', ('Load',)), [('Name', (1, 17), 'd', ('Load',))])])), -('Expression', ('GeneratorExp', (1, 1), ('Name', (1, 1), 'a', ('Load',)), [('comprehension', ('Name', (1, 7), 'b', ('Store',)), ('Name', (1, 12), 'c', ('Load',)), [('Name', (1, 17), 'd', ('Load',))])])), -('Expression', ('Compare', (1, 0), ('Num', (1, 0), 1), [('Lt',), ('Lt',)], [('Num', (1, 4), 2), ('Num', (1, 8), 3)])), -('Expression', ('Call', (1, 0), ('Name', (1, 0), 'f', ('Load',)), [('Num', (1, 2), 1), ('Num', (1, 4), 2)], [('keyword', 'c', ('Num', (1, 8), 3))], ('Name', (1, 11), 'd', ('Load',)), ('Name', (1, 15), 'e', ('Load',)))), -('Expression', ('Repr', (1, 0), ('Name', (1, 1), 'v', ('Load',)))), -('Expression', ('Num', (1, 0), 10L)), -('Expression', ('Str', (1, 0), 'string')), -('Expression', ('Attribute', (1, 0), ('Name', (1, 0), 'a', ('Load',)), 'b', ('Load',))), -('Expression', ('Subscript', (1, 0), ('Name', (1, 0), 'a', ('Load',)), ('Slice', ('Name', (1, 2), 'b', ('Load',)), ('Name', (1, 4), 'c', ('Load',)), None), ('Load',))), -('Expression', ('Name', (1, 0), 'v', ('Load',))), -('Expression', ('List', (1, 0), [('Num', (1, 1), 1), ('Num', (1, 3), 2), ('Num', (1, 5), 3)], ('Load',))), -('Expression', ('Tuple', (1, 0), [('Num', (1, 0), 1), ('Num', (1, 2), 2), ('Num', (1, 4), 3)], ('Load',))), -('Expression', ('Call', (1, 0), ('Attribute', (1, 0), ('Attribute', (1, 0), ('Attribute', (1, 0), ('Name', (1, 0), 'a', ('Load',)), 'b', ('Load',)), 'c', ('Load',)), 'd', ('Load',)), [('Subscript', (1, 8), ('Attribute', (1, 8), ('Name', (1, 8), 'a', ('Load',)), 'b', ('Load',)), ('Slice', ('Num', (1, 12), 1), ('Num', (1, 14), 2), None), ('Load',))], [], None, None)), -] -run_tests() diff --git a/sys/lib/python/test/test_asynchat.py b/sys/lib/python/test/test_asynchat.py deleted file mode 100644 index 992616796..000000000 --- a/sys/lib/python/test/test_asynchat.py +++ /dev/null @@ -1,93 +0,0 @@ -# test asynchat -- requires threading - -import thread # If this fails, we can't test this module -import asyncore, asynchat, socket, threading, time -import unittest -from test import test_support - -HOST = "127.0.0.1" -PORT = 54322 - -class echo_server(threading.Thread): - - def run(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - global PORT - PORT = test_support.bind_port(sock, HOST, PORT) - sock.listen(1) - conn, client = sock.accept() - buffer = "" - while "\n" not in buffer: - data = conn.recv(1) - if not data: - break - buffer = buffer + data - while buffer: - n = conn.send(buffer) - buffer = buffer[n:] - conn.close() - sock.close() - -class echo_client(asynchat.async_chat): - - def __init__(self, terminator): - asynchat.async_chat.__init__(self) - self.contents = None - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.connect((HOST, PORT)) - self.set_terminator(terminator) - self.buffer = "" - - def handle_connect(self): - pass - ##print "Connected" - - def collect_incoming_data(self, data): - self.buffer = self.buffer + data - - def found_terminator(self): - #print "Received:", repr(self.buffer) - self.contents = self.buffer - self.buffer = "" - self.close() - - -class TestAsynchat(unittest.TestCase): - def setUp (self): - pass - - def tearDown (self): - pass - - def test_line_terminator(self): - s = echo_server() - s.start() - time.sleep(1) # Give server time to initialize - c = echo_client('\n') - c.push("hello ") - c.push("world\n") - asyncore.loop() - s.join() - - self.assertEqual(c.contents, 'hello world') - - def test_numeric_terminator(self): - # Try reading a fixed number of bytes - s = echo_server() - s.start() - time.sleep(1) # Give server time to initialize - c = echo_client(6L) - c.push("hello ") - c.push("world\n") - asyncore.loop() - s.join() - - self.assertEqual(c.contents, 'hello ') - - -def test_main(verbose=None): - test_support.run_unittest(TestAsynchat) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_atexit.py b/sys/lib/python/test/test_atexit.py deleted file mode 100644 index 684d6079c..000000000 --- a/sys/lib/python/test/test_atexit.py +++ /dev/null @@ -1,100 +0,0 @@ -import sys -import unittest -import StringIO -import atexit -from test import test_support - -class TestCase(unittest.TestCase): - def test_args(self): - # be sure args are handled properly - s = StringIO.StringIO() - sys.stdout = sys.stderr = s - save_handlers = atexit._exithandlers - atexit._exithandlers = [] - try: - atexit.register(self.h1) - atexit.register(self.h4) - atexit.register(self.h4, 4, kw="abc") - atexit._run_exitfuncs() - finally: - sys.stdout = sys.__stdout__ - sys.stderr = sys.__stderr__ - atexit._exithandlers = save_handlers - self.assertEqual(s.getvalue(), "h4 (4,) {'kw': 'abc'}\nh4 () {}\nh1\n") - - def test_order(self): - # be sure handlers are executed in reverse order - s = StringIO.StringIO() - sys.stdout = sys.stderr = s - save_handlers = atexit._exithandlers - atexit._exithandlers = [] - try: - atexit.register(self.h1) - atexit.register(self.h2) - atexit.register(self.h3) - atexit._run_exitfuncs() - finally: - sys.stdout = sys.__stdout__ - sys.stderr = sys.__stderr__ - atexit._exithandlers = save_handlers - self.assertEqual(s.getvalue(), "h3\nh2\nh1\n") - - def test_sys_override(self): - # be sure a preset sys.exitfunc is handled properly - s = StringIO.StringIO() - sys.stdout = sys.stderr = s - save_handlers = atexit._exithandlers - atexit._exithandlers = [] - exfunc = sys.exitfunc - sys.exitfunc = self.h1 - reload(atexit) - try: - atexit.register(self.h2) - atexit._run_exitfuncs() - finally: - sys.stdout = sys.__stdout__ - sys.stderr = sys.__stderr__ - atexit._exithandlers = save_handlers - sys.exitfunc = exfunc - self.assertEqual(s.getvalue(), "h2\nh1\n") - - def test_raise(self): - # be sure raises are handled properly - s = StringIO.StringIO() - sys.stdout = sys.stderr = s - save_handlers = atexit._exithandlers - atexit._exithandlers = [] - try: - atexit.register(self.raise1) - atexit.register(self.raise2) - self.assertRaises(TypeError, atexit._run_exitfuncs) - finally: - sys.stdout = sys.__stdout__ - sys.stderr = sys.__stderr__ - atexit._exithandlers = save_handlers - - ### helpers - def h1(self): - print "h1" - - def h2(self): - print "h2" - - def h3(self): - print "h3" - - def h4(self, *args, **kwargs): - print "h4", args, kwargs - - def raise1(self): - raise TypeError - - def raise2(self): - raise SystemError - -def test_main(): - test_support.run_unittest(TestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_audioop.py b/sys/lib/python/test/test_audioop.py deleted file mode 100644 index f585733ea..000000000 --- a/sys/lib/python/test/test_audioop.py +++ /dev/null @@ -1,282 +0,0 @@ -# Test audioop. -import audioop -from test.test_support import verbose - -def gendata1(): - return '\0\1\2' - -def gendata2(): - if verbose: - print 'getsample' - if audioop.getsample('\0\1', 2, 0) == 1: - return '\0\0\0\1\0\2' - else: - return '\0\0\1\0\2\0' - -def gendata4(): - if verbose: - print 'getsample' - if audioop.getsample('\0\0\0\1', 4, 0) == 1: - return '\0\0\0\0\0\0\0\1\0\0\0\2' - else: - return '\0\0\0\0\1\0\0\0\2\0\0\0' - -def testmax(data): - if verbose: - print 'max' - if audioop.max(data[0], 1) != 2 or \ - audioop.max(data[1], 2) != 2 or \ - audioop.max(data[2], 4) != 2: - return 0 - return 1 - -def testminmax(data): - if verbose: - print 'minmax' - if audioop.minmax(data[0], 1) != (0, 2) or \ - audioop.minmax(data[1], 2) != (0, 2) or \ - audioop.minmax(data[2], 4) != (0, 2): - return 0 - return 1 - -def testmaxpp(data): - if verbose: - print 'maxpp' - if audioop.maxpp(data[0], 1) != 0 or \ - audioop.maxpp(data[1], 2) != 0 or \ - audioop.maxpp(data[2], 4) != 0: - return 0 - return 1 - -def testavg(data): - if verbose: - print 'avg' - if audioop.avg(data[0], 1) != 1 or \ - audioop.avg(data[1], 2) != 1 or \ - audioop.avg(data[2], 4) != 1: - return 0 - return 1 - -def testavgpp(data): - if verbose: - print 'avgpp' - if audioop.avgpp(data[0], 1) != 0 or \ - audioop.avgpp(data[1], 2) != 0 or \ - audioop.avgpp(data[2], 4) != 0: - return 0 - return 1 - -def testrms(data): - if audioop.rms(data[0], 1) != 1 or \ - audioop.rms(data[1], 2) != 1 or \ - audioop.rms(data[2], 4) != 1: - return 0 - return 1 - -def testcross(data): - if verbose: - print 'cross' - if audioop.cross(data[0], 1) != 0 or \ - audioop.cross(data[1], 2) != 0 or \ - audioop.cross(data[2], 4) != 0: - return 0 - return 1 - -def testadd(data): - if verbose: - print 'add' - data2 = [] - for d in data: - str = '' - for s in d: - str = str + chr(ord(s)*2) - data2.append(str) - if audioop.add(data[0], data[0], 1) != data2[0] or \ - audioop.add(data[1], data[1], 2) != data2[1] or \ - audioop.add(data[2], data[2], 4) != data2[2]: - return 0 - return 1 - -def testbias(data): - if verbose: - print 'bias' - # Note: this test assumes that avg() works - d1 = audioop.bias(data[0], 1, 100) - d2 = audioop.bias(data[1], 2, 100) - d4 = audioop.bias(data[2], 4, 100) - if audioop.avg(d1, 1) != 101 or \ - audioop.avg(d2, 2) != 101 or \ - audioop.avg(d4, 4) != 101: - return 0 - return 1 - -def testlin2lin(data): - if verbose: - print 'lin2lin' - # too simple: we test only the size - for d1 in data: - for d2 in data: - got = len(d1)//3 - wtd = len(d2)//3 - if len(audioop.lin2lin(d1, got, wtd)) != len(d2): - return 0 - return 1 - -def testadpcm2lin(data): - # Very cursory test - if audioop.adpcm2lin('\0\0', 1, None) != ('\0\0\0\0', (0,0)): - return 0 - return 1 - -def testlin2adpcm(data): - if verbose: - print 'lin2adpcm' - # Very cursory test - if audioop.lin2adpcm('\0\0\0\0', 1, None) != ('\0\0', (0,0)): - return 0 - return 1 - -def testlin2alaw(data): - if verbose: - print 'lin2alaw' - if audioop.lin2alaw(data[0], 1) != '\xd5\xc5\xf5' or \ - audioop.lin2alaw(data[1], 2) != '\xd5\xd5\xd5' or \ - audioop.lin2alaw(data[2], 4) != '\xd5\xd5\xd5': - return 0 - return 1 - -def testalaw2lin(data): - if verbose: - print 'alaw2lin' - # Cursory - d = audioop.lin2alaw(data[0], 1) - if audioop.alaw2lin(d, 1) != data[0]: - return 0 - return 1 - -def testlin2ulaw(data): - if verbose: - print 'lin2ulaw' - if audioop.lin2ulaw(data[0], 1) != '\xff\xe7\xdb' or \ - audioop.lin2ulaw(data[1], 2) != '\xff\xff\xff' or \ - audioop.lin2ulaw(data[2], 4) != '\xff\xff\xff': - return 0 - return 1 - -def testulaw2lin(data): - if verbose: - print 'ulaw2lin' - # Cursory - d = audioop.lin2ulaw(data[0], 1) - if audioop.ulaw2lin(d, 1) != data[0]: - return 0 - return 1 - -def testmul(data): - if verbose: - print 'mul' - data2 = [] - for d in data: - str = '' - for s in d: - str = str + chr(ord(s)*2) - data2.append(str) - if audioop.mul(data[0], 1, 2) != data2[0] or \ - audioop.mul(data[1],2, 2) != data2[1] or \ - audioop.mul(data[2], 4, 2) != data2[2]: - return 0 - return 1 - -def testratecv(data): - if verbose: - print 'ratecv' - state = None - d1, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) - d2, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) - if d1 + d2 != '\000\000\001\001\002\001\000\000\001\001\002': - return 0 - return 1 - -def testreverse(data): - if verbose: - print 'reverse' - if audioop.reverse(data[0], 1) != '\2\1\0': - return 0 - return 1 - -def testtomono(data): - if verbose: - print 'tomono' - data2 = '' - for d in data[0]: - data2 = data2 + d + d - if audioop.tomono(data2, 1, 0.5, 0.5) != data[0]: - return 0 - return 1 - -def testtostereo(data): - if verbose: - print 'tostereo' - data2 = '' - for d in data[0]: - data2 = data2 + d + d - if audioop.tostereo(data[0], 1, 1, 1) != data2: - return 0 - return 1 - -def testfindfactor(data): - if verbose: - print 'findfactor' - if audioop.findfactor(data[1], data[1]) != 1.0: - return 0 - return 1 - -def testfindfit(data): - if verbose: - print 'findfit' - if audioop.findfit(data[1], data[1]) != (0, 1.0): - return 0 - return 1 - -def testfindmax(data): - if verbose: - print 'findmax' - if audioop.findmax(data[1], 1) != 2: - return 0 - return 1 - -def testgetsample(data): - if verbose: - print 'getsample' - for i in range(3): - if audioop.getsample(data[0], 1, i) != i or \ - audioop.getsample(data[1], 2, i) != i or \ - audioop.getsample(data[2], 4, i) != i: - return 0 - return 1 - -def testone(name, data): - try: - func = eval('test'+name) - except NameError: - print 'No test found for audioop.'+name+'()' - return - try: - rv = func(data) - except 'xx': - print 'Test FAILED for audioop.'+name+'() (with an exception)' - return - if not rv: - print 'Test FAILED for audioop.'+name+'()' - -def testall(): - data = [gendata1(), gendata2(), gendata4()] - names = dir(audioop) - # We know there is a routine 'add' - routines = [] - for n in names: - if type(eval('audioop.'+n)) == type(audioop.add): - routines.append(n) - for n in routines: - testone(n, data) -testall() diff --git a/sys/lib/python/test/test_augassign.py b/sys/lib/python/test/test_augassign.py deleted file mode 100644 index dbf71bc28..000000000 --- a/sys/lib/python/test/test_augassign.py +++ /dev/null @@ -1,327 +0,0 @@ -# Augmented assignment test. - -from test.test_support import run_unittest -import unittest - - -class AugAssignTest(unittest.TestCase): - def testBasic(self): - x = 2 - x += 1 - x *= 2 - x **= 2 - x -= 8 - x //= 5 - x %= 3 - x &= 2 - x |= 5 - x ^= 1 - x /= 2 - if 1/2 == 0: - # classic division - self.assertEquals(x, 3) - else: - # new-style division (with -Qnew) - self.assertEquals(x, 3.0) - - def testInList(self): - x = [2] - x[0] += 1 - x[0] *= 2 - x[0] **= 2 - x[0] -= 8 - x[0] //= 5 - x[0] %= 3 - x[0] &= 2 - x[0] |= 5 - x[0] ^= 1 - x[0] /= 2 - if 1/2 == 0: - self.assertEquals(x[0], 3) - else: - self.assertEquals(x[0], 3.0) - - def testInDict(self): - x = {0: 2} - x[0] += 1 - x[0] *= 2 - x[0] **= 2 - x[0] -= 8 - x[0] //= 5 - x[0] %= 3 - x[0] &= 2 - x[0] |= 5 - x[0] ^= 1 - x[0] /= 2 - if 1/2 == 0: - self.assertEquals(x[0], 3) - else: - self.assertEquals(x[0], 3.0) - - def testSequences(self): - x = [1,2] - x += [3,4] - x *= 2 - - self.assertEquals(x, [1, 2, 3, 4, 1, 2, 3, 4]) - - x = [1, 2, 3] - y = x - x[1:2] *= 2 - y[1:2] += [1] - - self.assertEquals(x, [1, 2, 1, 2, 3]) - self.assert_(x is y) - - def testCustomMethods1(self): - - class aug_test: - def __init__(self, value): - self.val = value - def __radd__(self, val): - return self.val + val - def __add__(self, val): - return aug_test(self.val + val) - - class aug_test2(aug_test): - def __iadd__(self, val): - self.val = self.val + val - return self - - class aug_test3(aug_test): - def __iadd__(self, val): - return aug_test3(self.val + val) - - x = aug_test(1) - y = x - x += 10 - - self.assert_(isinstance(x, aug_test)) - self.assert_(y is not x) - self.assertEquals(x.val, 11) - - x = aug_test2(2) - y = x - x += 10 - - self.assert_(y is x) - self.assertEquals(x.val, 12) - - x = aug_test3(3) - y = x - x += 10 - - self.assert_(isinstance(x, aug_test3)) - self.assert_(y is not x) - self.assertEquals(x.val, 13) - - - def testCustomMethods2(test_self): - output = [] - - class testall: - def __add__(self, val): - output.append("__add__ called") - def __radd__(self, val): - output.append("__radd__ called") - def __iadd__(self, val): - output.append("__iadd__ called") - return self - - def __sub__(self, val): - output.append("__sub__ called") - def __rsub__(self, val): - output.append("__rsub__ called") - def __isub__(self, val): - output.append("__isub__ called") - return self - - def __mul__(self, val): - output.append("__mul__ called") - def __rmul__(self, val): - output.append("__rmul__ called") - def __imul__(self, val): - output.append("__imul__ called") - return self - - def __div__(self, val): - output.append("__div__ called") - def __rdiv__(self, val): - output.append("__rdiv__ called") - def __idiv__(self, val): - output.append("__idiv__ called") - return self - - def __floordiv__(self, val): - output.append("__floordiv__ called") - return self - def __ifloordiv__(self, val): - output.append("__ifloordiv__ called") - return self - def __rfloordiv__(self, val): - output.append("__rfloordiv__ called") - return self - - def __truediv__(self, val): - output.append("__truediv__ called") - return self - def __itruediv__(self, val): - output.append("__itruediv__ called") - return self - - def __mod__(self, val): - output.append("__mod__ called") - def __rmod__(self, val): - output.append("__rmod__ called") - def __imod__(self, val): - output.append("__imod__ called") - return self - - def __pow__(self, val): - output.append("__pow__ called") - def __rpow__(self, val): - output.append("__rpow__ called") - def __ipow__(self, val): - output.append("__ipow__ called") - return self - - def __or__(self, val): - output.append("__or__ called") - def __ror__(self, val): - output.append("__ror__ called") - def __ior__(self, val): - output.append("__ior__ called") - return self - - def __and__(self, val): - output.append("__and__ called") - def __rand__(self, val): - output.append("__rand__ called") - def __iand__(self, val): - output.append("__iand__ called") - return self - - def __xor__(self, val): - output.append("__xor__ called") - def __rxor__(self, val): - output.append("__rxor__ called") - def __ixor__(self, val): - output.append("__ixor__ called") - return self - - def __rshift__(self, val): - output.append("__rshift__ called") - def __rrshift__(self, val): - output.append("__rrshift__ called") - def __irshift__(self, val): - output.append("__irshift__ called") - return self - - def __lshift__(self, val): - output.append("__lshift__ called") - def __rlshift__(self, val): - output.append("__rlshift__ called") - def __ilshift__(self, val): - output.append("__ilshift__ called") - return self - - x = testall() - x + 1 - 1 + x - x += 1 - - x - 1 - 1 - x - x -= 1 - - x * 1 - 1 * x - x *= 1 - - if 1/2 == 0: - x / 1 - 1 / x - x /= 1 - else: - # True division is in effect, so "/" doesn't map to __div__ etc; - # but the canned expected-output file requires that those get called. - x.__div__(1) - x.__rdiv__(1) - x.__idiv__(1) - - x // 1 - 1 // x - x //= 1 - - x % 1 - 1 % x - x %= 1 - - x ** 1 - 1 ** x - x **= 1 - - x | 1 - 1 | x - x |= 1 - - x & 1 - 1 & x - x &= 1 - - x ^ 1 - 1 ^ x - x ^= 1 - - x >> 1 - 1 >> x - x >>= 1 - - x << 1 - 1 << x - x <<= 1 - - test_self.assertEquals(output, '''\ -__add__ called -__radd__ called -__iadd__ called -__sub__ called -__rsub__ called -__isub__ called -__mul__ called -__rmul__ called -__imul__ called -__div__ called -__rdiv__ called -__idiv__ called -__floordiv__ called -__rfloordiv__ called -__ifloordiv__ called -__mod__ called -__rmod__ called -__imod__ called -__pow__ called -__rpow__ called -__ipow__ called -__or__ called -__ror__ called -__ior__ called -__and__ called -__rand__ called -__iand__ called -__xor__ called -__rxor__ called -__ixor__ called -__rshift__ called -__rrshift__ called -__irshift__ called -__lshift__ called -__rlshift__ called -__ilshift__ called -'''.splitlines()) - -def test_main(): - run_unittest(AugAssignTest) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_base64.py b/sys/lib/python/test/test_base64.py deleted file mode 100644 index 997a41336..000000000 --- a/sys/lib/python/test/test_base64.py +++ /dev/null @@ -1,198 +0,0 @@ -import unittest -from test import test_support -import base64 - - - -class LegacyBase64TestCase(unittest.TestCase): - def test_encodestring(self): - eq = self.assertEqual - eq(base64.encodestring("www.python.org"), "d3d3LnB5dGhvbi5vcmc=\n") - eq(base64.encodestring("a"), "YQ==\n") - eq(base64.encodestring("ab"), "YWI=\n") - eq(base64.encodestring("abc"), "YWJj\n") - eq(base64.encodestring(""), "") - eq(base64.encodestring("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789!@#0^&*();:<>,. []{}"), - "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" - "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" - "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n") - - def test_decodestring(self): - eq = self.assertEqual - eq(base64.decodestring("d3d3LnB5dGhvbi5vcmc=\n"), "www.python.org") - eq(base64.decodestring("YQ==\n"), "a") - eq(base64.decodestring("YWI=\n"), "ab") - eq(base64.decodestring("YWJj\n"), "abc") - eq(base64.decodestring("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" - "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" - "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"), - "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789!@#0^&*();:<>,. []{}") - eq(base64.decodestring(''), '') - - def test_encode(self): - eq = self.assertEqual - from cStringIO import StringIO - infp = StringIO('abcdefghijklmnopqrstuvwxyz' - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - '0123456789!@#0^&*();:<>,. []{}') - outfp = StringIO() - base64.encode(infp, outfp) - eq(outfp.getvalue(), - 'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE' - 'RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT' - 'Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n') - - def test_decode(self): - from cStringIO import StringIO - infp = StringIO('d3d3LnB5dGhvbi5vcmc=') - outfp = StringIO() - base64.decode(infp, outfp) - self.assertEqual(outfp.getvalue(), 'www.python.org') - - - -class BaseXYTestCase(unittest.TestCase): - def test_b64encode(self): - eq = self.assertEqual - # Test default alphabet - eq(base64.b64encode("www.python.org"), "d3d3LnB5dGhvbi5vcmc=") - eq(base64.b64encode('\x00'), 'AA==') - eq(base64.b64encode("a"), "YQ==") - eq(base64.b64encode("ab"), "YWI=") - eq(base64.b64encode("abc"), "YWJj") - eq(base64.b64encode(""), "") - eq(base64.b64encode("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789!@#0^&*();:<>,. []{}"), - "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" - "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NT" - "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==") - # Test with arbitrary alternative characters - eq(base64.b64encode('\xd3V\xbeo\xf7\x1d', altchars='*$'), '01a*b$cd') - # Test standard alphabet - eq(base64.standard_b64encode("www.python.org"), "d3d3LnB5dGhvbi5vcmc=") - eq(base64.standard_b64encode("a"), "YQ==") - eq(base64.standard_b64encode("ab"), "YWI=") - eq(base64.standard_b64encode("abc"), "YWJj") - eq(base64.standard_b64encode(""), "") - eq(base64.standard_b64encode("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789!@#0^&*();:<>,. []{}"), - "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" - "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NT" - "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==") - # Test with 'URL safe' alternative characters - eq(base64.urlsafe_b64encode('\xd3V\xbeo\xf7\x1d'), '01a-b_cd') - - def test_b64decode(self): - eq = self.assertEqual - eq(base64.b64decode("d3d3LnB5dGhvbi5vcmc="), "www.python.org") - eq(base64.b64decode('AA=='), '\x00') - eq(base64.b64decode("YQ=="), "a") - eq(base64.b64decode("YWI="), "ab") - eq(base64.b64decode("YWJj"), "abc") - eq(base64.b64decode("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" - "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" - "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ=="), - "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789!@#0^&*();:<>,. []{}") - eq(base64.b64decode(''), '') - # Test with arbitrary alternative characters - eq(base64.b64decode('01a*b$cd', altchars='*$'), '\xd3V\xbeo\xf7\x1d') - # Test standard alphabet - eq(base64.standard_b64decode("d3d3LnB5dGhvbi5vcmc="), "www.python.org") - eq(base64.standard_b64decode("YQ=="), "a") - eq(base64.standard_b64decode("YWI="), "ab") - eq(base64.standard_b64decode("YWJj"), "abc") - eq(base64.standard_b64decode(""), "") - eq(base64.standard_b64decode("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" - "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NT" - "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ=="), - "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789!@#0^&*();:<>,. []{}") - # Test with 'URL safe' alternative characters - eq(base64.urlsafe_b64decode('01a-b_cd'), '\xd3V\xbeo\xf7\x1d') - - def test_b64decode_error(self): - self.assertRaises(TypeError, base64.b64decode, 'abc') - - def test_b32encode(self): - eq = self.assertEqual - eq(base64.b32encode(''), '') - eq(base64.b32encode('\x00'), 'AA======') - eq(base64.b32encode('a'), 'ME======') - eq(base64.b32encode('ab'), 'MFRA====') - eq(base64.b32encode('abc'), 'MFRGG===') - eq(base64.b32encode('abcd'), 'MFRGGZA=') - eq(base64.b32encode('abcde'), 'MFRGGZDF') - - def test_b32decode(self): - eq = self.assertEqual - eq(base64.b32decode(''), '') - eq(base64.b32decode('AA======'), '\x00') - eq(base64.b32decode('ME======'), 'a') - eq(base64.b32decode('MFRA===='), 'ab') - eq(base64.b32decode('MFRGG==='), 'abc') - eq(base64.b32decode('MFRGGZA='), 'abcd') - eq(base64.b32decode('MFRGGZDF'), 'abcde') - - def test_b32decode_casefold(self): - eq = self.assertEqual - eq(base64.b32decode('', True), '') - eq(base64.b32decode('ME======', True), 'a') - eq(base64.b32decode('MFRA====', True), 'ab') - eq(base64.b32decode('MFRGG===', True), 'abc') - eq(base64.b32decode('MFRGGZA=', True), 'abcd') - eq(base64.b32decode('MFRGGZDF', True), 'abcde') - # Lower cases - eq(base64.b32decode('me======', True), 'a') - eq(base64.b32decode('mfra====', True), 'ab') - eq(base64.b32decode('mfrgg===', True), 'abc') - eq(base64.b32decode('mfrggza=', True), 'abcd') - eq(base64.b32decode('mfrggzdf', True), 'abcde') - # Expected exceptions - self.assertRaises(TypeError, base64.b32decode, 'me======') - # Mapping zero and one - eq(base64.b32decode('MLO23456'), 'b\xdd\xad\xf3\xbe') - eq(base64.b32decode('M1023456', map01='L'), 'b\xdd\xad\xf3\xbe') - eq(base64.b32decode('M1023456', map01='I'), 'b\x1d\xad\xf3\xbe') - - def test_b32decode_error(self): - self.assertRaises(TypeError, base64.b32decode, 'abc') - self.assertRaises(TypeError, base64.b32decode, 'ABCDEF==') - - def test_b16encode(self): - eq = self.assertEqual - eq(base64.b16encode('\x01\x02\xab\xcd\xef'), '0102ABCDEF') - eq(base64.b16encode('\x00'), '00') - - def test_b16decode(self): - eq = self.assertEqual - eq(base64.b16decode('0102ABCDEF'), '\x01\x02\xab\xcd\xef') - eq(base64.b16decode('00'), '\x00') - # Lower case is not allowed without a flag - self.assertRaises(TypeError, base64.b16decode, '0102abcdef') - # Case fold - eq(base64.b16decode('0102abcdef', True), '\x01\x02\xab\xcd\xef') - - - -def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(LegacyBase64TestCase)) - suite.addTest(unittest.makeSuite(BaseXYTestCase)) - return suite - - -def test_main(): - test_support.run_suite(suite()) - - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/sys/lib/python/test/test_bastion.py b/sys/lib/python/test/test_bastion.py deleted file mode 100644 index 4760ec875..000000000 --- a/sys/lib/python/test/test_bastion.py +++ /dev/null @@ -1,3 +0,0 @@ -##import Bastion -## -##Bastion._test() diff --git a/sys/lib/python/test/test_bigaddrspace.py b/sys/lib/python/test/test_bigaddrspace.py deleted file mode 100644 index 8c215fe09..000000000 --- a/sys/lib/python/test/test_bigaddrspace.py +++ /dev/null @@ -1,46 +0,0 @@ -from test import test_support -from test.test_support import bigaddrspacetest, MAX_Py_ssize_t - -import unittest -import operator -import sys - - -class StrTest(unittest.TestCase): - - @bigaddrspacetest - def test_concat(self): - s1 = 'x' * MAX_Py_ssize_t - self.assertRaises(OverflowError, operator.add, s1, '?') - - @bigaddrspacetest - def test_optimized_concat(self): - x = 'x' * MAX_Py_ssize_t - try: - x = x + '?' # this statement uses a fast path in ceval.c - except OverflowError: - pass - else: - self.fail("should have raised OverflowError") - try: - x += '?' # this statement uses a fast path in ceval.c - except OverflowError: - pass - else: - self.fail("should have raised OverflowError") - self.assertEquals(len(x), MAX_Py_ssize_t) - - ### the following test is pending a patch - # (http://mail.python.org/pipermail/python-dev/2006-July/067774.html) - #@bigaddrspacetest - #def test_repeat(self): - # self.assertRaises(OverflowError, operator.mul, 'x', MAX_Py_ssize_t + 1) - - -def test_main(): - test_support.run_unittest(StrTest) - -if __name__ == '__main__': - if len(sys.argv) > 1: - test_support.set_memlimit(sys.argv[1]) - test_main() diff --git a/sys/lib/python/test/test_bigmem.py b/sys/lib/python/test/test_bigmem.py deleted file mode 100644 index 6d6c37cee..000000000 --- a/sys/lib/python/test/test_bigmem.py +++ /dev/null @@ -1,964 +0,0 @@ -from test import test_support -from test.test_support import bigmemtest, _1G, _2G - -import unittest -import operator -import string -import sys - -# Bigmem testing houserules: -# -# - Try not to allocate too many large objects. It's okay to rely on -# refcounting semantics, but don't forget that 's = create_largestring()' -# doesn't release the old 's' (if it exists) until well after its new -# value has been created. Use 'del s' before the create_largestring call. -# -# - Do *not* compare large objects using assertEquals or similar. It's a -# lengty operation and the errormessage will be utterly useless due to -# its size. To make sure whether a result has the right contents, better -# to use the strip or count methods, or compare meaningful slices. -# -# - Don't forget to test for large indices, offsets and results and such, -# in addition to large sizes. -# -# - When repeating an object (say, a substring, or a small list) to create -# a large object, make the subobject of a length that is not a power of -# 2. That way, int-wrapping problems are more easily detected. -# -# - While the bigmemtest decorator speaks of 'minsize', all tests will -# actually be called with a much smaller number too, in the normal -# test run (5Kb currently.) This is so the tests themselves get frequent -# testing. Consequently, always make all large allocations based on the -# passed-in 'size', and don't rely on the size being very large. Also, -# memuse-per-size should remain sane (less than a few thousand); if your -# test uses more, adjust 'size' upward, instead. - -class StrTest(unittest.TestCase): - @bigmemtest(minsize=_2G, memuse=2) - def test_capitalize(self, size): - SUBSTR = ' abc def ghi' - s = '-' * size + SUBSTR - caps = s.capitalize() - self.assertEquals(caps[-len(SUBSTR):], - SUBSTR.capitalize()) - self.assertEquals(caps.lstrip('-'), SUBSTR) - - @bigmemtest(minsize=_2G + 10, memuse=1) - def test_center(self, size): - SUBSTR = ' abc def ghi' - s = SUBSTR.center(size) - self.assertEquals(len(s), size) - lpadsize = rpadsize = (len(s) - len(SUBSTR)) // 2 - if len(s) % 2: - lpadsize += 1 - self.assertEquals(s[lpadsize:-rpadsize], SUBSTR) - self.assertEquals(s.strip(), SUBSTR.strip()) - - @bigmemtest(minsize=_2G, memuse=2) - def test_count(self, size): - SUBSTR = ' abc def ghi' - s = '.' * size + SUBSTR - self.assertEquals(s.count('.'), size) - s += '.' - self.assertEquals(s.count('.'), size + 1) - self.assertEquals(s.count(' '), 3) - self.assertEquals(s.count('i'), 1) - self.assertEquals(s.count('j'), 0) - - @bigmemtest(minsize=0, memuse=1) - def test_decode(self, size): - pass - - @bigmemtest(minsize=0, memuse=1) - def test_encode(self, size): - pass - - @bigmemtest(minsize=_2G, memuse=2) - def test_endswith(self, size): - SUBSTR = ' abc def ghi' - s = '-' * size + SUBSTR - self.failUnless(s.endswith(SUBSTR)) - self.failUnless(s.endswith(s)) - s2 = '...' + s - self.failUnless(s2.endswith(s)) - self.failIf(s.endswith('a' + SUBSTR)) - self.failIf(SUBSTR.endswith(s)) - - @bigmemtest(minsize=_2G + 10, memuse=2) - def test_expandtabs(self, size): - s = '-' * size - tabsize = 8 - self.assertEquals(s.expandtabs(), s) - del s - slen, remainder = divmod(size, tabsize) - s = ' \t' * slen - s = s.expandtabs(tabsize) - self.assertEquals(len(s), size - remainder) - self.assertEquals(len(s.strip(' ')), 0) - - @bigmemtest(minsize=_2G, memuse=2) - def test_find(self, size): - SUBSTR = ' abc def ghi' - sublen = len(SUBSTR) - s = ''.join([SUBSTR, '-' * size, SUBSTR]) - self.assertEquals(s.find(' '), 0) - self.assertEquals(s.find(SUBSTR), 0) - self.assertEquals(s.find(' ', sublen), sublen + size) - self.assertEquals(s.find(SUBSTR, len(SUBSTR)), sublen + size) - self.assertEquals(s.find('i'), SUBSTR.find('i')) - self.assertEquals(s.find('i', sublen), - sublen + size + SUBSTR.find('i')) - self.assertEquals(s.find('i', size), - sublen + size + SUBSTR.find('i')) - self.assertEquals(s.find('j'), -1) - - @bigmemtest(minsize=_2G, memuse=2) - def test_index(self, size): - SUBSTR = ' abc def ghi' - sublen = len(SUBSTR) - s = ''.join([SUBSTR, '-' * size, SUBSTR]) - self.assertEquals(s.index(' '), 0) - self.assertEquals(s.index(SUBSTR), 0) - self.assertEquals(s.index(' ', sublen), sublen + size) - self.assertEquals(s.index(SUBSTR, sublen), sublen + size) - self.assertEquals(s.index('i'), SUBSTR.index('i')) - self.assertEquals(s.index('i', sublen), - sublen + size + SUBSTR.index('i')) - self.assertEquals(s.index('i', size), - sublen + size + SUBSTR.index('i')) - self.assertRaises(ValueError, s.index, 'j') - - @bigmemtest(minsize=_2G, memuse=2) - def test_isalnum(self, size): - SUBSTR = '123456' - s = 'a' * size + SUBSTR - self.failUnless(s.isalnum()) - s += '.' - self.failIf(s.isalnum()) - - @bigmemtest(minsize=_2G, memuse=2) - def test_isalpha(self, size): - SUBSTR = 'zzzzzzz' - s = 'a' * size + SUBSTR - self.failUnless(s.isalpha()) - s += '.' - self.failIf(s.isalpha()) - - @bigmemtest(minsize=_2G, memuse=2) - def test_isdigit(self, size): - SUBSTR = '123456' - s = '9' * size + SUBSTR - self.failUnless(s.isdigit()) - s += 'z' - self.failIf(s.isdigit()) - - @bigmemtest(minsize=_2G, memuse=2) - def test_islower(self, size): - chars = ''.join([ chr(c) for c in range(255) if not chr(c).isupper() ]) - repeats = size // len(chars) + 2 - s = chars * repeats - self.failUnless(s.islower()) - s += 'A' - self.failIf(s.islower()) - - @bigmemtest(minsize=_2G, memuse=2) - def test_isspace(self, size): - whitespace = ' \f\n\r\t\v' - repeats = size // len(whitespace) + 2 - s = whitespace * repeats - self.failUnless(s.isspace()) - s += 'j' - self.failIf(s.isspace()) - - @bigmemtest(minsize=_2G, memuse=2) - def test_istitle(self, size): - SUBSTR = '123456' - s = ''.join(['A', 'a' * size, SUBSTR]) - self.failUnless(s.istitle()) - s += 'A' - self.failUnless(s.istitle()) - s += 'aA' - self.failIf(s.istitle()) - - @bigmemtest(minsize=_2G, memuse=2) - def test_isupper(self, size): - chars = ''.join([ chr(c) for c in range(255) if not chr(c).islower() ]) - repeats = size // len(chars) + 2 - s = chars * repeats - self.failUnless(s.isupper()) - s += 'a' - self.failIf(s.isupper()) - - @bigmemtest(minsize=_2G, memuse=2) - def test_join(self, size): - s = 'A' * size - x = s.join(['aaaaa', 'bbbbb']) - self.assertEquals(x.count('a'), 5) - self.assertEquals(x.count('b'), 5) - self.failUnless(x.startswith('aaaaaA')) - self.failUnless(x.endswith('Abbbbb')) - - @bigmemtest(minsize=_2G + 10, memuse=1) - def test_ljust(self, size): - SUBSTR = ' abc def ghi' - s = SUBSTR.ljust(size) - self.failUnless(s.startswith(SUBSTR + ' ')) - self.assertEquals(len(s), size) - self.assertEquals(s.strip(), SUBSTR.strip()) - - @bigmemtest(minsize=_2G + 10, memuse=2) - def test_lower(self, size): - s = 'A' * size - s = s.lower() - self.assertEquals(len(s), size) - self.assertEquals(s.count('a'), size) - - @bigmemtest(minsize=_2G + 10, memuse=1) - def test_lstrip(self, size): - SUBSTR = 'abc def ghi' - s = SUBSTR.rjust(size) - self.assertEquals(len(s), size) - self.assertEquals(s.lstrip(), SUBSTR.lstrip()) - del s - s = SUBSTR.ljust(size) - self.assertEquals(len(s), size) - stripped = s.lstrip() - self.failUnless(stripped is s) - - @bigmemtest(minsize=_2G + 10, memuse=2) - def test_replace(self, size): - replacement = 'a' - s = ' ' * size - s = s.replace(' ', replacement) - self.assertEquals(len(s), size) - self.assertEquals(s.count(replacement), size) - s = s.replace(replacement, ' ', size - 4) - self.assertEquals(len(s), size) - self.assertEquals(s.count(replacement), 4) - self.assertEquals(s[-10:], ' aaaa') - - @bigmemtest(minsize=_2G, memuse=2) - def test_rfind(self, size): - SUBSTR = ' abc def ghi' - sublen = len(SUBSTR) - s = ''.join([SUBSTR, '-' * size, SUBSTR]) - self.assertEquals(s.rfind(' '), sublen + size + SUBSTR.rfind(' ')) - self.assertEquals(s.rfind(SUBSTR), sublen + size) - self.assertEquals(s.rfind(' ', 0, size), SUBSTR.rfind(' ')) - self.assertEquals(s.rfind(SUBSTR, 0, sublen + size), 0) - self.assertEquals(s.rfind('i'), sublen + size + SUBSTR.rfind('i')) - self.assertEquals(s.rfind('i', 0, sublen), SUBSTR.rfind('i')) - self.assertEquals(s.rfind('i', 0, sublen + size), - SUBSTR.rfind('i')) - self.assertEquals(s.rfind('j'), -1) - - @bigmemtest(minsize=_2G, memuse=2) - def test_rindex(self, size): - SUBSTR = ' abc def ghi' - sublen = len(SUBSTR) - s = ''.join([SUBSTR, '-' * size, SUBSTR]) - self.assertEquals(s.rindex(' '), - sublen + size + SUBSTR.rindex(' ')) - self.assertEquals(s.rindex(SUBSTR), sublen + size) - self.assertEquals(s.rindex(' ', 0, sublen + size - 1), - SUBSTR.rindex(' ')) - self.assertEquals(s.rindex(SUBSTR, 0, sublen + size), 0) - self.assertEquals(s.rindex('i'), - sublen + size + SUBSTR.rindex('i')) - self.assertEquals(s.rindex('i', 0, sublen), SUBSTR.rindex('i')) - self.assertEquals(s.rindex('i', 0, sublen + size), - SUBSTR.rindex('i')) - self.assertRaises(ValueError, s.rindex, 'j') - - @bigmemtest(minsize=_2G + 10, memuse=1) - def test_rjust(self, size): - SUBSTR = ' abc def ghi' - s = SUBSTR.ljust(size) - self.failUnless(s.startswith(SUBSTR + ' ')) - self.assertEquals(len(s), size) - self.assertEquals(s.strip(), SUBSTR.strip()) - - @bigmemtest(minsize=_2G + 10, memuse=1) - def test_rstrip(self, size): - SUBSTR = ' abc def ghi' - s = SUBSTR.ljust(size) - self.assertEquals(len(s), size) - self.assertEquals(s.rstrip(), SUBSTR.rstrip()) - del s - s = SUBSTR.rjust(size) - self.assertEquals(len(s), size) - stripped = s.rstrip() - self.failUnless(stripped is s) - - # The test takes about size bytes to build a string, and then about - # sqrt(size) substrings of sqrt(size) in size and a list to - # hold sqrt(size) items. It's close but just over 2x size. - @bigmemtest(minsize=_2G, memuse=2.1) - def test_split_small(self, size): - # Crudely calculate an estimate so that the result of s.split won't - # take up an inordinate amount of memory - chunksize = int(size ** 0.5 + 2) - SUBSTR = 'a' + ' ' * chunksize - s = SUBSTR * chunksize - l = s.split() - self.assertEquals(len(l), chunksize) - self.assertEquals(set(l), set(['a'])) - del l - l = s.split('a') - self.assertEquals(len(l), chunksize + 1) - self.assertEquals(set(l), set(['', ' ' * chunksize])) - - # Allocates a string of twice size (and briefly two) and a list of - # size. Because of internal affairs, the s.split() call produces a - # list of size times the same one-character string, so we only - # suffer for the list size. (Otherwise, it'd cost another 48 times - # size in bytes!) Nevertheless, a list of size takes - # 8*size bytes. - @bigmemtest(minsize=_2G + 5, memuse=10) - def test_split_large(self, size): - s = ' a' * size + ' ' - l = s.split() - self.assertEquals(len(l), size) - self.assertEquals(set(l), set(['a'])) - del l - l = s.split('a') - self.assertEquals(len(l), size + 1) - self.assertEquals(set(l), set([' '])) - - @bigmemtest(minsize=_2G, memuse=2.1) - def test_splitlines(self, size): - # Crudely calculate an estimate so that the result of s.split won't - # take up an inordinate amount of memory - chunksize = int(size ** 0.5 + 2) // 2 - SUBSTR = ' ' * chunksize + '\n' + ' ' * chunksize + '\r\n' - s = SUBSTR * chunksize - l = s.splitlines() - self.assertEquals(len(l), chunksize * 2) - self.assertEquals(set(l), set([' ' * chunksize])) - - @bigmemtest(minsize=_2G, memuse=2) - def test_startswith(self, size): - SUBSTR = ' abc def ghi' - s = '-' * size + SUBSTR - self.failUnless(s.startswith(s)) - self.failUnless(s.startswith('-' * size)) - self.failIf(s.startswith(SUBSTR)) - - @bigmemtest(minsize=_2G, memuse=1) - def test_strip(self, size): - SUBSTR = ' abc def ghi ' - s = SUBSTR.rjust(size) - self.assertEquals(len(s), size) - self.assertEquals(s.strip(), SUBSTR.strip()) - del s - s = SUBSTR.ljust(size) - self.assertEquals(len(s), size) - self.assertEquals(s.strip(), SUBSTR.strip()) - - @bigmemtest(minsize=_2G, memuse=2) - def test_swapcase(self, size): - SUBSTR = "aBcDeFG12.'\xa9\x00" - sublen = len(SUBSTR) - repeats = size // sublen + 2 - s = SUBSTR * repeats - s = s.swapcase() - self.assertEquals(len(s), sublen * repeats) - self.assertEquals(s[:sublen * 3], SUBSTR.swapcase() * 3) - self.assertEquals(s[-sublen * 3:], SUBSTR.swapcase() * 3) - - @bigmemtest(minsize=_2G, memuse=2) - def test_title(self, size): - SUBSTR = 'SpaaHAaaAaham' - s = SUBSTR * (size // len(SUBSTR) + 2) - s = s.title() - self.failUnless(s.startswith((SUBSTR * 3).title())) - self.failUnless(s.endswith(SUBSTR.lower() * 3)) - - @bigmemtest(minsize=_2G, memuse=2) - def test_translate(self, size): - trans = string.maketrans('.aZ', '-!$') - SUBSTR = 'aZz.z.Aaz.' - sublen = len(SUBSTR) - repeats = size // sublen + 2 - s = SUBSTR * repeats - s = s.translate(trans) - self.assertEquals(len(s), repeats * sublen) - self.assertEquals(s[:sublen], SUBSTR.translate(trans)) - self.assertEquals(s[-sublen:], SUBSTR.translate(trans)) - self.assertEquals(s.count('.'), 0) - self.assertEquals(s.count('!'), repeats * 2) - self.assertEquals(s.count('z'), repeats * 3) - - @bigmemtest(minsize=_2G + 5, memuse=2) - def test_upper(self, size): - s = 'a' * size - s = s.upper() - self.assertEquals(len(s), size) - self.assertEquals(s.count('A'), size) - - @bigmemtest(minsize=_2G + 20, memuse=1) - def test_zfill(self, size): - SUBSTR = '-568324723598234' - s = SUBSTR.zfill(size) - self.failUnless(s.endswith('0' + SUBSTR[1:])) - self.failUnless(s.startswith('-0')) - self.assertEquals(len(s), size) - self.assertEquals(s.count('0'), size - len(SUBSTR)) - - @bigmemtest(minsize=_2G + 10, memuse=2) - def test_format(self, size): - s = '-' * size - sf = '%s' % (s,) - self.failUnless(s == sf) - del sf - sf = '..%s..' % (s,) - self.assertEquals(len(sf), len(s) + 4) - self.failUnless(sf.startswith('..-')) - self.failUnless(sf.endswith('-..')) - del s, sf - - size //= 2 - edge = '-' * size - s = ''.join([edge, '%s', edge]) - del edge - s = s % '...' - self.assertEquals(len(s), size * 2 + 3) - self.assertEquals(s.count('.'), 3) - self.assertEquals(s.count('-'), size * 2) - - @bigmemtest(minsize=_2G + 10, memuse=2) - def test_repr_small(self, size): - s = '-' * size - s = repr(s) - self.assertEquals(len(s), size + 2) - self.assertEquals(s[0], "'") - self.assertEquals(s[-1], "'") - self.assertEquals(s.count('-'), size) - del s - # repr() will create a string four times as large as this 'binary - # string', but we don't want to allocate much more than twice - # size in total. (We do extra testing in test_repr_large()) - size = size // 5 * 2 - s = '\x00' * size - s = repr(s) - self.assertEquals(len(s), size * 4 + 2) - self.assertEquals(s[0], "'") - self.assertEquals(s[-1], "'") - self.assertEquals(s.count('\\'), size) - self.assertEquals(s.count('0'), size * 2) - - @bigmemtest(minsize=_2G + 10, memuse=5) - def test_repr_large(self, size): - s = '\x00' * size - s = repr(s) - self.assertEquals(len(s), size * 4 + 2) - self.assertEquals(s[0], "'") - self.assertEquals(s[-1], "'") - self.assertEquals(s.count('\\'), size) - self.assertEquals(s.count('0'), size * 2) - - # This test is meaningful even with size < 2G, as long as the - # doubled string is > 2G (but it tests more if both are > 2G :) - @bigmemtest(minsize=_1G + 2, memuse=3) - def test_concat(self, size): - s = '.' * size - self.assertEquals(len(s), size) - s = s + s - self.assertEquals(len(s), size * 2) - self.assertEquals(s.count('.'), size * 2) - - # This test is meaningful even with size < 2G, as long as the - # repeated string is > 2G (but it tests more if both are > 2G :) - @bigmemtest(minsize=_1G + 2, memuse=3) - def test_repeat(self, size): - s = '.' * size - self.assertEquals(len(s), size) - s = s * 2 - self.assertEquals(len(s), size * 2) - self.assertEquals(s.count('.'), size * 2) - - @bigmemtest(minsize=_2G + 20, memuse=1) - def test_slice_and_getitem(self, size): - SUBSTR = '0123456789' - sublen = len(SUBSTR) - s = SUBSTR * (size // sublen) - stepsize = len(s) // 100 - stepsize = stepsize - (stepsize % sublen) - for i in range(0, len(s) - stepsize, stepsize): - self.assertEquals(s[i], SUBSTR[0]) - self.assertEquals(s[i:i + sublen], SUBSTR) - self.assertEquals(s[i:i + sublen:2], SUBSTR[::2]) - if i > 0: - self.assertEquals(s[i + sublen - 1:i - 1:-3], - SUBSTR[sublen::-3]) - # Make sure we do some slicing and indexing near the end of the - # string, too. - self.assertEquals(s[len(s) - 1], SUBSTR[-1]) - self.assertEquals(s[-1], SUBSTR[-1]) - self.assertEquals(s[len(s) - 10], SUBSTR[0]) - self.assertEquals(s[-sublen], SUBSTR[0]) - self.assertEquals(s[len(s):], '') - self.assertEquals(s[len(s) - 1:], SUBSTR[-1]) - self.assertEquals(s[-1:], SUBSTR[-1]) - self.assertEquals(s[len(s) - sublen:], SUBSTR) - self.assertEquals(s[-sublen:], SUBSTR) - self.assertEquals(len(s[:]), len(s)) - self.assertEquals(len(s[:len(s) - 5]), len(s) - 5) - self.assertEquals(len(s[5:-5]), len(s) - 10) - - self.assertRaises(IndexError, operator.getitem, s, len(s)) - self.assertRaises(IndexError, operator.getitem, s, len(s) + 1) - self.assertRaises(IndexError, operator.getitem, s, len(s) + 1<<31) - - @bigmemtest(minsize=_2G, memuse=2) - def test_contains(self, size): - SUBSTR = '0123456789' - edge = '-' * (size // 2) - s = ''.join([edge, SUBSTR, edge]) - del edge - self.failUnless(SUBSTR in s) - self.failIf(SUBSTR * 2 in s) - self.failUnless('-' in s) - self.failIf('a' in s) - s += 'a' - self.failUnless('a' in s) - - @bigmemtest(minsize=_2G + 10, memuse=2) - def test_compare(self, size): - s1 = '-' * size - s2 = '-' * size - self.failUnless(s1 == s2) - del s2 - s2 = s1 + 'a' - self.failIf(s1 == s2) - del s2 - s2 = '.' * size - self.failIf(s1 == s2) - - @bigmemtest(minsize=_2G + 10, memuse=1) - def test_hash(self, size): - # Not sure if we can do any meaningful tests here... Even if we - # start relying on the exact algorithm used, the result will be - # different depending on the size of the C 'long int'. Even this - # test is dodgy (there's no *guarantee* that the two things should - # have a different hash, even if they, in the current - # implementation, almost always do.) - s = '\x00' * size - h1 = hash(s) - del s - s = '\x00' * (size + 1) - self.failIf(h1 == hash(s)) - -class TupleTest(unittest.TestCase): - - # Tuples have a small, fixed-sized head and an array of pointers to - # data. Since we're testing 64-bit addressing, we can assume that the - # pointers are 8 bytes, and that thus that the tuples take up 8 bytes - # per size. - - # As a side-effect of testing long tuples, these tests happen to test - # having more than 2<<31 references to any given object. Hence the - # use of different types of objects as contents in different tests. - - @bigmemtest(minsize=_2G + 2, memuse=16) - def test_compare(self, size): - t1 = (u'',) * size - t2 = (u'',) * size - self.failUnless(t1 == t2) - del t2 - t2 = (u'',) * (size + 1) - self.failIf(t1 == t2) - del t2 - t2 = (1,) * size - self.failIf(t1 == t2) - - # Test concatenating into a single tuple of more than 2G in length, - # and concatenating a tuple of more than 2G in length separately, so - # the smaller test still gets run even if there isn't memory for the - # larger test (but we still let the tester know the larger test is - # skipped, in verbose mode.) - def basic_concat_test(self, size): - t = ((),) * size - self.assertEquals(len(t), size) - t = t + t - self.assertEquals(len(t), size * 2) - - @bigmemtest(minsize=_2G // 2 + 2, memuse=24) - def test_concat_small(self, size): - return self.basic_concat_test(size) - - @bigmemtest(minsize=_2G + 2, memuse=24) - def test_concat_large(self, size): - return self.basic_concat_test(size) - - @bigmemtest(minsize=_2G // 5 + 10, memuse=8 * 5) - def test_contains(self, size): - t = (1, 2, 3, 4, 5) * size - self.assertEquals(len(t), size * 5) - self.failUnless(5 in t) - self.failIf((1, 2, 3, 4, 5) in t) - self.failIf(0 in t) - - @bigmemtest(minsize=_2G + 10, memuse=8) - def test_hash(self, size): - t1 = (0,) * size - h1 = hash(t1) - del t1 - t2 = (0,) * (size + 1) - self.failIf(h1 == hash(t2)) - - @bigmemtest(minsize=_2G + 10, memuse=8) - def test_index_and_slice(self, size): - t = (None,) * size - self.assertEquals(len(t), size) - self.assertEquals(t[-1], None) - self.assertEquals(t[5], None) - self.assertEquals(t[size - 1], None) - self.assertRaises(IndexError, operator.getitem, t, size) - self.assertEquals(t[:5], (None,) * 5) - self.assertEquals(t[-5:], (None,) * 5) - self.assertEquals(t[20:25], (None,) * 5) - self.assertEquals(t[-25:-20], (None,) * 5) - self.assertEquals(t[size - 5:], (None,) * 5) - self.assertEquals(t[size - 5:size], (None,) * 5) - self.assertEquals(t[size - 6:size - 2], (None,) * 4) - self.assertEquals(t[size:size], ()) - self.assertEquals(t[size:size+5], ()) - - # Like test_concat, split in two. - def basic_test_repeat(self, size): - t = ('',) * size - self.assertEquals(len(t), size) - t = t * 2 - self.assertEquals(len(t), size * 2) - - @bigmemtest(minsize=_2G // 2 + 2, memuse=24) - def test_repeat_small(self, size): - return self.basic_test_repeat(size) - - @bigmemtest(minsize=_2G + 2, memuse=24) - def test_repeat_large(self, size): - return self.basic_test_repeat(size) - - # Like test_concat, split in two. - def basic_test_repr(self, size): - t = (0,) * size - s = repr(t) - # The repr of a tuple of 0's is exactly three times the tuple length. - self.assertEquals(len(s), size * 3) - self.assertEquals(s[:5], '(0, 0') - self.assertEquals(s[-5:], '0, 0)') - self.assertEquals(s.count('0'), size) - - @bigmemtest(minsize=_2G // 3 + 2, memuse=8 + 3) - def test_repr_small(self, size): - return self.basic_test_repr(size) - - @bigmemtest(minsize=_2G + 2, memuse=8 + 3) - def test_repr_large(self, size): - return self.basic_test_repr(size) - -class ListTest(unittest.TestCase): - - # Like tuples, lists have a small, fixed-sized head and an array of - # pointers to data, so 8 bytes per size. Also like tuples, we make the - # lists hold references to various objects to test their refcount - # limits. - - @bigmemtest(minsize=_2G + 2, memuse=16) - def test_compare(self, size): - l1 = [u''] * size - l2 = [u''] * size - self.failUnless(l1 == l2) - del l2 - l2 = [u''] * (size + 1) - self.failIf(l1 == l2) - del l2 - l2 = [2] * size - self.failIf(l1 == l2) - - # Test concatenating into a single list of more than 2G in length, - # and concatenating a list of more than 2G in length separately, so - # the smaller test still gets run even if there isn't memory for the - # larger test (but we still let the tester know the larger test is - # skipped, in verbose mode.) - def basic_test_concat(self, size): - l = [[]] * size - self.assertEquals(len(l), size) - l = l + l - self.assertEquals(len(l), size * 2) - - @bigmemtest(minsize=_2G // 2 + 2, memuse=24) - def test_concat_small(self, size): - return self.basic_test_concat(size) - - @bigmemtest(minsize=_2G + 2, memuse=24) - def test_concat_large(self, size): - return self.basic_test_concat(size) - - def basic_test_inplace_concat(self, size): - l = [sys.stdout] * size - l += l - self.assertEquals(len(l), size * 2) - self.failUnless(l[0] is l[-1]) - self.failUnless(l[size - 1] is l[size + 1]) - - @bigmemtest(minsize=_2G // 2 + 2, memuse=24) - def test_inplace_concat_small(self, size): - return self.basic_test_inplace_concat(size) - - @bigmemtest(minsize=_2G + 2, memuse=24) - def test_inplace_concat_large(self, size): - return self.basic_test_inplace_concat(size) - - @bigmemtest(minsize=_2G // 5 + 10, memuse=8 * 5) - def test_contains(self, size): - l = [1, 2, 3, 4, 5] * size - self.assertEquals(len(l), size * 5) - self.failUnless(5 in l) - self.failIf([1, 2, 3, 4, 5] in l) - self.failIf(0 in l) - - @bigmemtest(minsize=_2G + 10, memuse=8) - def test_hash(self, size): - l = [0] * size - self.failUnlessRaises(TypeError, hash, l) - - @bigmemtest(minsize=_2G + 10, memuse=8) - def test_index_and_slice(self, size): - l = [None] * size - self.assertEquals(len(l), size) - self.assertEquals(l[-1], None) - self.assertEquals(l[5], None) - self.assertEquals(l[size - 1], None) - self.assertRaises(IndexError, operator.getitem, l, size) - self.assertEquals(l[:5], [None] * 5) - self.assertEquals(l[-5:], [None] * 5) - self.assertEquals(l[20:25], [None] * 5) - self.assertEquals(l[-25:-20], [None] * 5) - self.assertEquals(l[size - 5:], [None] * 5) - self.assertEquals(l[size - 5:size], [None] * 5) - self.assertEquals(l[size - 6:size - 2], [None] * 4) - self.assertEquals(l[size:size], []) - self.assertEquals(l[size:size+5], []) - - l[size - 2] = 5 - self.assertEquals(len(l), size) - self.assertEquals(l[-3:], [None, 5, None]) - self.assertEquals(l.count(5), 1) - self.assertRaises(IndexError, operator.setitem, l, size, 6) - self.assertEquals(len(l), size) - - l[size - 7:] = [1, 2, 3, 4, 5] - size -= 2 - self.assertEquals(len(l), size) - self.assertEquals(l[-7:], [None, None, 1, 2, 3, 4, 5]) - - l[:7] = [1, 2, 3, 4, 5] - size -= 2 - self.assertEquals(len(l), size) - self.assertEquals(l[:7], [1, 2, 3, 4, 5, None, None]) - - del l[size - 1] - size -= 1 - self.assertEquals(len(l), size) - self.assertEquals(l[-1], 4) - - del l[-2:] - size -= 2 - self.assertEquals(len(l), size) - self.assertEquals(l[-1], 2) - - del l[0] - size -= 1 - self.assertEquals(len(l), size) - self.assertEquals(l[0], 2) - - del l[:2] - size -= 2 - self.assertEquals(len(l), size) - self.assertEquals(l[0], 4) - - # Like test_concat, split in two. - def basic_test_repeat(self, size): - l = [] * size - self.failIf(l) - l = [''] * size - self.assertEquals(len(l), size) - l = l * 2 - self.assertEquals(len(l), size * 2) - - @bigmemtest(minsize=_2G // 2 + 2, memuse=24) - def test_repeat_small(self, size): - return self.basic_test_repeat(size) - - @bigmemtest(minsize=_2G + 2, memuse=24) - def test_repeat_large(self, size): - return self.basic_test_repeat(size) - - def basic_test_inplace_repeat(self, size): - l = [''] - l *= size - self.assertEquals(len(l), size) - self.failUnless(l[0] is l[-1]) - del l - - l = [''] * size - l *= 2 - self.assertEquals(len(l), size * 2) - self.failUnless(l[size - 1] is l[-1]) - - @bigmemtest(minsize=_2G // 2 + 2, memuse=16) - def test_inplace_repeat_small(self, size): - return self.basic_test_inplace_repeat(size) - - @bigmemtest(minsize=_2G + 2, memuse=16) - def test_inplace_repeat_large(self, size): - return self.basic_test_inplace_repeat(size) - - def basic_test_repr(self, size): - l = [0] * size - s = repr(l) - # The repr of a list of 0's is exactly three times the list length. - self.assertEquals(len(s), size * 3) - self.assertEquals(s[:5], '[0, 0') - self.assertEquals(s[-5:], '0, 0]') - self.assertEquals(s.count('0'), size) - - @bigmemtest(minsize=_2G // 3 + 2, memuse=8 + 3) - def test_repr_small(self, size): - return self.basic_test_repr(size) - - @bigmemtest(minsize=_2G + 2, memuse=8 + 3) - def test_repr_large(self, size): - return self.basic_test_repr(size) - - # list overallocates ~1/8th of the total size (on first expansion) so - # the single list.append call puts memuse at 9 bytes per size. - @bigmemtest(minsize=_2G, memuse=9) - def test_append(self, size): - l = [object()] * size - l.append(object()) - self.assertEquals(len(l), size+1) - self.failUnless(l[-3] is l[-2]) - self.failIf(l[-2] is l[-1]) - - @bigmemtest(minsize=_2G // 5 + 2, memuse=8 * 5) - def test_count(self, size): - l = [1, 2, 3, 4, 5] * size - self.assertEquals(l.count(1), size) - self.assertEquals(l.count("1"), 0) - - def basic_test_extend(self, size): - l = [file] * size - l.extend(l) - self.assertEquals(len(l), size * 2) - self.failUnless(l[0] is l[-1]) - self.failUnless(l[size - 1] is l[size + 1]) - - @bigmemtest(minsize=_2G // 2 + 2, memuse=16) - def test_extend_small(self, size): - return self.basic_test_extend(size) - - @bigmemtest(minsize=_2G + 2, memuse=16) - def test_extend_large(self, size): - return self.basic_test_extend(size) - - @bigmemtest(minsize=_2G // 5 + 2, memuse=8 * 5) - def test_index(self, size): - l = [1L, 2L, 3L, 4L, 5L] * size - size *= 5 - self.assertEquals(l.index(1), 0) - self.assertEquals(l.index(5, size - 5), size - 1) - self.assertEquals(l.index(5, size - 5, size), size - 1) - self.assertRaises(ValueError, l.index, 1, size - 4, size) - self.assertRaises(ValueError, l.index, 6L) - - # This tests suffers from overallocation, just like test_append. - @bigmemtest(minsize=_2G + 10, memuse=9) - def test_insert(self, size): - l = [1.0] * size - l.insert(size - 1, "A") - size += 1 - self.assertEquals(len(l), size) - self.assertEquals(l[-3:], [1.0, "A", 1.0]) - - l.insert(size + 1, "B") - size += 1 - self.assertEquals(len(l), size) - self.assertEquals(l[-3:], ["A", 1.0, "B"]) - - l.insert(1, "C") - size += 1 - self.assertEquals(len(l), size) - self.assertEquals(l[:3], [1.0, "C", 1.0]) - self.assertEquals(l[size - 3:], ["A", 1.0, "B"]) - - @bigmemtest(minsize=_2G // 5 + 4, memuse=8 * 5) - def test_pop(self, size): - l = [u"a", u"b", u"c", u"d", u"e"] * size - size *= 5 - self.assertEquals(len(l), size) - - item = l.pop() - size -= 1 - self.assertEquals(len(l), size) - self.assertEquals(item, u"e") - self.assertEquals(l[-2:], [u"c", u"d"]) - - item = l.pop(0) - size -= 1 - self.assertEquals(len(l), size) - self.assertEquals(item, u"a") - self.assertEquals(l[:2], [u"b", u"c"]) - - item = l.pop(size - 2) - size -= 1 - self.assertEquals(len(l), size) - self.assertEquals(item, u"c") - self.assertEquals(l[-2:], [u"b", u"d"]) - - @bigmemtest(minsize=_2G + 10, memuse=8) - def test_remove(self, size): - l = [10] * size - self.assertEquals(len(l), size) - - l.remove(10) - size -= 1 - self.assertEquals(len(l), size) - - # Because of the earlier l.remove(), this append doesn't trigger - # a resize. - l.append(5) - size += 1 - self.assertEquals(len(l), size) - self.assertEquals(l[-2:], [10, 5]) - l.remove(5) - size -= 1 - self.assertEquals(len(l), size) - self.assertEquals(l[-2:], [10, 10]) - - @bigmemtest(minsize=_2G // 5 + 2, memuse=8 * 5) - def test_reverse(self, size): - l = [1, 2, 3, 4, 5] * size - l.reverse() - self.assertEquals(len(l), size * 5) - self.assertEquals(l[-5:], [5, 4, 3, 2, 1]) - self.assertEquals(l[:5], [5, 4, 3, 2, 1]) - - @bigmemtest(minsize=_2G // 5 + 2, memuse=8 * 5) - def test_sort(self, size): - l = [1, 2, 3, 4, 5] * size - l.sort() - self.assertEquals(len(l), size * 5) - self.assertEquals(l.count(1), size) - self.assertEquals(l[:10], [1] * 10) - self.assertEquals(l[-10:], [5] * 10) - -def test_main(): - test_support.run_unittest(StrTest, TupleTest, ListTest) - -if __name__ == '__main__': - if len(sys.argv) > 1: - test_support.set_memlimit(sys.argv[1]) - test_main() diff --git a/sys/lib/python/test/test_binascii.py b/sys/lib/python/test/test_binascii.py deleted file mode 100755 index 8272ad91a..000000000 --- a/sys/lib/python/test/test_binascii.py +++ /dev/null @@ -1,165 +0,0 @@ -"""Test the binascii C module.""" - -from test import test_support -import unittest -import binascii - -class BinASCIITest(unittest.TestCase): - - # Create binary test data - data = "The quick brown fox jumps over the lazy dog.\r\n" - # Be slow so we don't depend on other modules - data += "".join(map(chr, xrange(256))) - data += "\r\nHello world.\n" - - def test_exceptions(self): - # Check module exceptions - self.assert_(issubclass(binascii.Error, Exception)) - self.assert_(issubclass(binascii.Incomplete, Exception)) - - def test_functions(self): - # Check presence of all functions - funcs = [] - for suffix in "base64", "hqx", "uu", "hex": - prefixes = ["a2b_", "b2a_"] - if suffix == "hqx": - prefixes.extend(["crc_", "rlecode_", "rledecode_"]) - for prefix in prefixes: - name = prefix + suffix - self.assert_(callable(getattr(binascii, name))) - self.assertRaises(TypeError, getattr(binascii, name)) - for name in ("hexlify", "unhexlify"): - self.assert_(callable(getattr(binascii, name))) - self.assertRaises(TypeError, getattr(binascii, name)) - - def test_base64valid(self): - # Test base64 with valid data - MAX_BASE64 = 57 - lines = [] - for i in range(0, len(self.data), MAX_BASE64): - b = self.data[i:i+MAX_BASE64] - a = binascii.b2a_base64(b) - lines.append(a) - res = "" - for line in lines: - b = binascii.a2b_base64(line) - res = res + b - self.assertEqual(res, self.data) - - def test_base64invalid(self): - # Test base64 with random invalid characters sprinkled throughout - # (This requires a new version of binascii.) - MAX_BASE64 = 57 - lines = [] - for i in range(0, len(self.data), MAX_BASE64): - b = self.data[i:i+MAX_BASE64] - a = binascii.b2a_base64(b) - lines.append(a) - - fillers = "" - valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/" - for i in xrange(256): - c = chr(i) - if c not in valid: - fillers += c - def addnoise(line): - noise = fillers - ratio = len(line) // len(noise) - res = "" - while line and noise: - if len(line) // len(noise) > ratio: - c, line = line[0], line[1:] - else: - c, noise = noise[0], noise[1:] - res += c - return res + noise + line - res = "" - for line in map(addnoise, lines): - b = binascii.a2b_base64(line) - res += b - self.assertEqual(res, self.data) - - # Test base64 with just invalid characters, which should return - # empty strings. TBD: shouldn't it raise an exception instead ? - self.assertEqual(binascii.a2b_base64(fillers), '') - - def test_uu(self): - MAX_UU = 45 - lines = [] - for i in range(0, len(self.data), MAX_UU): - b = self.data[i:i+MAX_UU] - a = binascii.b2a_uu(b) - lines.append(a) - res = "" - for line in lines: - b = binascii.a2b_uu(line) - res += b - self.assertEqual(res, self.data) - - self.assertEqual(binascii.a2b_uu("\x7f"), "\x00"*31) - self.assertEqual(binascii.a2b_uu("\x80"), "\x00"*32) - self.assertEqual(binascii.a2b_uu("\xff"), "\x00"*31) - self.assertRaises(binascii.Error, binascii.a2b_uu, "\xff\x00") - self.assertRaises(binascii.Error, binascii.a2b_uu, "!!!!") - - self.assertRaises(binascii.Error, binascii.b2a_uu, 46*"!") - - def test_crc32(self): - crc = binascii.crc32("Test the CRC-32 of") - crc = binascii.crc32(" this string.", crc) - self.assertEqual(crc, 1571220330) - - self.assertRaises(TypeError, binascii.crc32) - - # The hqx test is in test_binhex.py - - def test_hex(self): - # test hexlification - s = '{s\005\000\000\000worldi\002\000\000\000s\005\000\000\000helloi\001\000\000\0000' - t = binascii.b2a_hex(s) - u = binascii.a2b_hex(t) - self.assertEqual(s, u) - self.assertRaises(TypeError, binascii.a2b_hex, t[:-1]) - self.assertRaises(TypeError, binascii.a2b_hex, t[:-1] + 'q') - - # Verify the treatment of Unicode strings - if test_support.have_unicode: - self.assertEqual(binascii.hexlify(unicode('a', 'ascii')), '61') - - def test_qp(self): - # A test for SF bug 534347 (segfaults without the proper fix) - try: - binascii.a2b_qp("", **{1:1}) - except TypeError: - pass - else: - self.fail("binascii.a2b_qp(**{1:1}) didn't raise TypeError") - self.assertEqual(binascii.a2b_qp("= "), "= ") - self.assertEqual(binascii.a2b_qp("=="), "=") - self.assertEqual(binascii.a2b_qp("=AX"), "=AX") - self.assertRaises(TypeError, binascii.b2a_qp, foo="bar") - self.assertEqual(binascii.a2b_qp("=00\r\n=00"), "\x00\r\n\x00") - self.assertEqual( - binascii.b2a_qp("\xff\r\n\xff\n\xff"), - "=FF\r\n=FF\r\n=FF" - ) - self.assertEqual( - binascii.b2a_qp("0"*75+"\xff\r\n\xff\r\n\xff"), - "0"*75+"=\r\n=FF\r\n=FF\r\n=FF" - ) - - def test_empty_string(self): - # A test for SF bug #1022953. Make sure SystemError is not raised. - for n in ['b2a_qp', 'a2b_hex', 'b2a_base64', 'a2b_uu', 'a2b_qp', - 'b2a_hex', 'unhexlify', 'hexlify', 'crc32', 'b2a_hqx', - 'a2b_hqx', 'a2b_base64', 'rlecode_hqx', 'b2a_uu', - 'rledecode_hqx']: - f = getattr(binascii, n) - f('') - binascii.crc_hqx('', 0) - -def test_main(): - test_support.run_unittest(BinASCIITest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_binhex.py b/sys/lib/python/test/test_binhex.py deleted file mode 100755 index 2f89703b4..000000000 --- a/sys/lib/python/test/test_binhex.py +++ /dev/null @@ -1,49 +0,0 @@ -#! /usr/bin/env python -"""Test script for the binhex C module - - Uses the mechanism of the python binhex module - Based on an original test by Roger E. Masse. -""" -import binhex -import os -import unittest -from test import test_support - - -class BinHexTestCase(unittest.TestCase): - - def setUp(self): - self.fname1 = test_support.TESTFN + "1" - self.fname2 = test_support.TESTFN + "2" - - def tearDown(self): - try: os.unlink(self.fname1) - except OSError: pass - - try: os.unlink(self.fname2) - except OSError: pass - - DATA = 'Jack is my hero' - - def test_binhex(self): - f = open(self.fname1, 'w') - f.write(self.DATA) - f.close() - - binhex.binhex(self.fname1, self.fname2) - - binhex.hexbin(self.fname2, self.fname1) - - f = open(self.fname1, 'r') - finish = f.readline() - f.close() - - self.assertEqual(self.DATA, finish) - - -def test_main(): - test_support.run_unittest(BinHexTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_binop.py b/sys/lib/python/test/test_binop.py deleted file mode 100644 index b3d9a625f..000000000 --- a/sys/lib/python/test/test_binop.py +++ /dev/null @@ -1,328 +0,0 @@ -"""Tests for binary operators on subtypes of built-in types.""" - -import unittest -from test import test_support - -def gcd(a, b): - """Greatest common divisor using Euclid's algorithm.""" - while a: - a, b = b%a, a - return b - -def isint(x): - """Test whether an object is an instance of int or long.""" - return isinstance(x, int) or isinstance(x, long) - -def isnum(x): - """Test whether an object is an instance of a built-in numeric type.""" - for T in int, long, float, complex: - if isinstance(x, T): - return 1 - return 0 - -def isRat(x): - """Test wheter an object is an instance of the Rat class.""" - return isinstance(x, Rat) - -class Rat(object): - - """Rational number implemented as a normalized pair of longs.""" - - __slots__ = ['_Rat__num', '_Rat__den'] - - def __init__(self, num=0L, den=1L): - """Constructor: Rat([num[, den]]). - - The arguments must be ints or longs, and default to (0, 1).""" - if not isint(num): - raise TypeError, "Rat numerator must be int or long (%r)" % num - if not isint(den): - raise TypeError, "Rat denominator must be int or long (%r)" % den - # But the zero is always on - if den == 0: - raise ZeroDivisionError, "zero denominator" - g = gcd(den, num) - self.__num = long(num//g) - self.__den = long(den//g) - - def _get_num(self): - """Accessor function for read-only 'num' attribute of Rat.""" - return self.__num - num = property(_get_num, None) - - def _get_den(self): - """Accessor function for read-only 'den' attribute of Rat.""" - return self.__den - den = property(_get_den, None) - - def __repr__(self): - """Convert a Rat to an string resembling a Rat constructor call.""" - return "Rat(%d, %d)" % (self.__num, self.__den) - - def __str__(self): - """Convert a Rat to a string resembling a decimal numeric value.""" - return str(float(self)) - - def __float__(self): - """Convert a Rat to a float.""" - return self.__num*1.0/self.__den - - def __int__(self): - """Convert a Rat to an int; self.den must be 1.""" - if self.__den == 1: - try: - return int(self.__num) - except OverflowError: - raise OverflowError, ("%s too large to convert to int" % - repr(self)) - raise ValueError, "can't convert %s to int" % repr(self) - - def __long__(self): - """Convert a Rat to an long; self.den must be 1.""" - if self.__den == 1: - return long(self.__num) - raise ValueError, "can't convert %s to long" % repr(self) - - def __add__(self, other): - """Add two Rats, or a Rat and a number.""" - if isint(other): - other = Rat(other) - if isRat(other): - return Rat(self.__num*other.__den + other.__num*self.__den, - self.__den*other.__den) - if isnum(other): - return float(self) + other - return NotImplemented - - __radd__ = __add__ - - def __sub__(self, other): - """Subtract two Rats, or a Rat and a number.""" - if isint(other): - other = Rat(other) - if isRat(other): - return Rat(self.__num*other.__den - other.__num*self.__den, - self.__den*other.__den) - if isnum(other): - return float(self) - other - return NotImplemented - - def __rsub__(self, other): - """Subtract two Rats, or a Rat and a number (reversed args).""" - if isint(other): - other = Rat(other) - if isRat(other): - return Rat(other.__num*self.__den - self.__num*other.__den, - self.__den*other.__den) - if isnum(other): - return other - float(self) - return NotImplemented - - def __mul__(self, other): - """Multiply two Rats, or a Rat and a number.""" - if isRat(other): - return Rat(self.__num*other.__num, self.__den*other.__den) - if isint(other): - return Rat(self.__num*other, self.__den) - if isnum(other): - return float(self)*other - return NotImplemented - - __rmul__ = __mul__ - - def __truediv__(self, other): - """Divide two Rats, or a Rat and a number.""" - if isRat(other): - return Rat(self.__num*other.__den, self.__den*other.__num) - if isint(other): - return Rat(self.__num, self.__den*other) - if isnum(other): - return float(self) / other - return NotImplemented - - __div__ = __truediv__ - - def __rtruediv__(self, other): - """Divide two Rats, or a Rat and a number (reversed args).""" - if isRat(other): - return Rat(other.__num*self.__den, other.__den*self.__num) - if isint(other): - return Rat(other*self.__den, self.__num) - if isnum(other): - return other / float(self) - return NotImplemented - - __rdiv__ = __rtruediv__ - - def __floordiv__(self, other): - """Divide two Rats, returning the floored result.""" - if isint(other): - other = Rat(other) - elif not isRat(other): - return NotImplemented - x = self/other - return x.__num // x.__den - - def __rfloordiv__(self, other): - """Divide two Rats, returning the floored result (reversed args).""" - x = other/self - return x.__num // x.__den - - def __divmod__(self, other): - """Divide two Rats, returning quotient and remainder.""" - if isint(other): - other = Rat(other) - elif not isRat(other): - return NotImplemented - x = self//other - return (x, self - other * x) - - def __rdivmod__(self, other): - """Divide two Rats, returning quotient and remainder (reversed args).""" - if isint(other): - other = Rat(other) - elif not isRat(other): - return NotImplemented - return divmod(other, self) - - def __mod__(self, other): - """Take one Rat modulo another.""" - return divmod(self, other)[1] - - def __rmod__(self, other): - """Take one Rat modulo another (reversed args).""" - return divmod(other, self)[1] - - def __eq__(self, other): - """Compare two Rats for equality.""" - if isint(other): - return self.__den == 1 and self.__num == other - if isRat(other): - return self.__num == other.__num and self.__den == other.__den - if isnum(other): - return float(self) == other - return NotImplemented - - def __ne__(self, other): - """Compare two Rats for inequality.""" - return not self == other - -class RatTestCase(unittest.TestCase): - """Unit tests for Rat class and its support utilities.""" - - def test_gcd(self): - self.assertEqual(gcd(10, 12), 2) - self.assertEqual(gcd(10, 15), 5) - self.assertEqual(gcd(10, 11), 1) - self.assertEqual(gcd(100, 15), 5) - self.assertEqual(gcd(-10, 2), -2) - self.assertEqual(gcd(10, -2), 2) - self.assertEqual(gcd(-10, -2), -2) - for i in range(1, 20): - for j in range(1, 20): - self.assert_(gcd(i, j) > 0) - self.assert_(gcd(-i, j) < 0) - self.assert_(gcd(i, -j) > 0) - self.assert_(gcd(-i, -j) < 0) - - def test_constructor(self): - a = Rat(10, 15) - self.assertEqual(a.num, 2) - self.assertEqual(a.den, 3) - a = Rat(10L, 15L) - self.assertEqual(a.num, 2) - self.assertEqual(a.den, 3) - a = Rat(10, -15) - self.assertEqual(a.num, -2) - self.assertEqual(a.den, 3) - a = Rat(-10, 15) - self.assertEqual(a.num, -2) - self.assertEqual(a.den, 3) - a = Rat(-10, -15) - self.assertEqual(a.num, 2) - self.assertEqual(a.den, 3) - a = Rat(7) - self.assertEqual(a.num, 7) - self.assertEqual(a.den, 1) - try: - a = Rat(1, 0) - except ZeroDivisionError: - pass - else: - self.fail("Rat(1, 0) didn't raise ZeroDivisionError") - for bad in "0", 0.0, 0j, (), [], {}, None, Rat, unittest: - try: - a = Rat(bad) - except TypeError: - pass - else: - self.fail("Rat(%r) didn't raise TypeError" % bad) - try: - a = Rat(1, bad) - except TypeError: - pass - else: - self.fail("Rat(1, %r) didn't raise TypeError" % bad) - - def test_add(self): - self.assertEqual(Rat(2, 3) + Rat(1, 3), 1) - self.assertEqual(Rat(2, 3) + 1, Rat(5, 3)) - self.assertEqual(1 + Rat(2, 3), Rat(5, 3)) - self.assertEqual(1.0 + Rat(1, 2), 1.5) - self.assertEqual(Rat(1, 2) + 1.0, 1.5) - - def test_sub(self): - self.assertEqual(Rat(7, 2) - Rat(7, 5), Rat(21, 10)) - self.assertEqual(Rat(7, 5) - 1, Rat(2, 5)) - self.assertEqual(1 - Rat(3, 5), Rat(2, 5)) - self.assertEqual(Rat(3, 2) - 1.0, 0.5) - self.assertEqual(1.0 - Rat(1, 2), 0.5) - - def test_mul(self): - self.assertEqual(Rat(2, 3) * Rat(5, 7), Rat(10, 21)) - self.assertEqual(Rat(10, 3) * 3, 10) - self.assertEqual(3 * Rat(10, 3), 10) - self.assertEqual(Rat(10, 5) * 0.5, 1.0) - self.assertEqual(0.5 * Rat(10, 5), 1.0) - - def test_div(self): - self.assertEqual(Rat(10, 3) / Rat(5, 7), Rat(14, 3)) - self.assertEqual(Rat(10, 3) / 3, Rat(10, 9)) - self.assertEqual(2 / Rat(5), Rat(2, 5)) - self.assertEqual(3.0 * Rat(1, 2), 1.5) - self.assertEqual(Rat(1, 2) * 3.0, 1.5) - - def test_floordiv(self): - self.assertEqual(Rat(10) // Rat(4), 2) - self.assertEqual(Rat(10, 3) // Rat(4, 3), 2) - self.assertEqual(Rat(10) // 4, 2) - self.assertEqual(10 // Rat(4), 2) - - def test_eq(self): - self.assertEqual(Rat(10), Rat(20, 2)) - self.assertEqual(Rat(10), 10) - self.assertEqual(10, Rat(10)) - self.assertEqual(Rat(10), 10.0) - self.assertEqual(10.0, Rat(10)) - - def test_future_div(self): - exec future_test - - # XXX Ran out of steam; TO DO: divmod, div, future division - -future_test = """ -from __future__ import division -self.assertEqual(Rat(10, 3) / Rat(5, 7), Rat(14, 3)) -self.assertEqual(Rat(10, 3) / 3, Rat(10, 9)) -self.assertEqual(2 / Rat(5), Rat(2, 5)) -self.assertEqual(3.0 * Rat(1, 2), 1.5) -self.assertEqual(Rat(1, 2) * 3.0, 1.5) -self.assertEqual(eval('1/2'), 0.5) -""" - -def test_main(): - test_support.run_unittest(RatTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_bisect.py b/sys/lib/python/test/test_bisect.py deleted file mode 100644 index f6e24a699..000000000 --- a/sys/lib/python/test/test_bisect.py +++ /dev/null @@ -1,253 +0,0 @@ -import unittest -from test import test_support -from bisect import bisect_right, bisect_left, insort_left, insort_right, insort, bisect -from UserList import UserList - -class TestBisect(unittest.TestCase): - - precomputedCases = [ - (bisect_right, [], 1, 0), - (bisect_right, [1], 0, 0), - (bisect_right, [1], 1, 1), - (bisect_right, [1], 2, 1), - (bisect_right, [1, 1], 0, 0), - (bisect_right, [1, 1], 1, 2), - (bisect_right, [1, 1], 2, 2), - (bisect_right, [1, 1, 1], 0, 0), - (bisect_right, [1, 1, 1], 1, 3), - (bisect_right, [1, 1, 1], 2, 3), - (bisect_right, [1, 1, 1, 1], 0, 0), - (bisect_right, [1, 1, 1, 1], 1, 4), - (bisect_right, [1, 1, 1, 1], 2, 4), - (bisect_right, [1, 2], 0, 0), - (bisect_right, [1, 2], 1, 1), - (bisect_right, [1, 2], 1.5, 1), - (bisect_right, [1, 2], 2, 2), - (bisect_right, [1, 2], 3, 2), - (bisect_right, [1, 1, 2, 2], 0, 0), - (bisect_right, [1, 1, 2, 2], 1, 2), - (bisect_right, [1, 1, 2, 2], 1.5, 2), - (bisect_right, [1, 1, 2, 2], 2, 4), - (bisect_right, [1, 1, 2, 2], 3, 4), - (bisect_right, [1, 2, 3], 0, 0), - (bisect_right, [1, 2, 3], 1, 1), - (bisect_right, [1, 2, 3], 1.5, 1), - (bisect_right, [1, 2, 3], 2, 2), - (bisect_right, [1, 2, 3], 2.5, 2), - (bisect_right, [1, 2, 3], 3, 3), - (bisect_right, [1, 2, 3], 4, 3), - (bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 0, 0), - (bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 1, 1), - (bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 1.5, 1), - (bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 2, 3), - (bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 2.5, 3), - (bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 3, 6), - (bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 3.5, 6), - (bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 4, 10), - (bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 5, 10), - - (bisect_left, [], 1, 0), - (bisect_left, [1], 0, 0), - (bisect_left, [1], 1, 0), - (bisect_left, [1], 2, 1), - (bisect_left, [1, 1], 0, 0), - (bisect_left, [1, 1], 1, 0), - (bisect_left, [1, 1], 2, 2), - (bisect_left, [1, 1, 1], 0, 0), - (bisect_left, [1, 1, 1], 1, 0), - (bisect_left, [1, 1, 1], 2, 3), - (bisect_left, [1, 1, 1, 1], 0, 0), - (bisect_left, [1, 1, 1, 1], 1, 0), - (bisect_left, [1, 1, 1, 1], 2, 4), - (bisect_left, [1, 2], 0, 0), - (bisect_left, [1, 2], 1, 0), - (bisect_left, [1, 2], 1.5, 1), - (bisect_left, [1, 2], 2, 1), - (bisect_left, [1, 2], 3, 2), - (bisect_left, [1, 1, 2, 2], 0, 0), - (bisect_left, [1, 1, 2, 2], 1, 0), - (bisect_left, [1, 1, 2, 2], 1.5, 2), - (bisect_left, [1, 1, 2, 2], 2, 2), - (bisect_left, [1, 1, 2, 2], 3, 4), - (bisect_left, [1, 2, 3], 0, 0), - (bisect_left, [1, 2, 3], 1, 0), - (bisect_left, [1, 2, 3], 1.5, 1), - (bisect_left, [1, 2, 3], 2, 1), - (bisect_left, [1, 2, 3], 2.5, 2), - (bisect_left, [1, 2, 3], 3, 2), - (bisect_left, [1, 2, 3], 4, 3), - (bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 0, 0), - (bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 1, 0), - (bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 1.5, 1), - (bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 2, 1), - (bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 2.5, 3), - (bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 3, 3), - (bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 3.5, 6), - (bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 4, 6), - (bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 5, 10) - ] - - def test_precomputed(self): - for func, data, elem, expected in self.precomputedCases: - self.assertEqual(func(data, elem), expected) - self.assertEqual(func(UserList(data), elem), expected) - - def test_random(self, n=25): - from random import randrange - for i in xrange(n): - data = [randrange(0, n, 2) for j in xrange(i)] - data.sort() - elem = randrange(-1, n+1) - ip = bisect_left(data, elem) - if ip < len(data): - self.failUnless(elem <= data[ip]) - if ip > 0: - self.failUnless(data[ip-1] < elem) - ip = bisect_right(data, elem) - if ip < len(data): - self.failUnless(elem < data[ip]) - if ip > 0: - self.failUnless(data[ip-1] <= elem) - - def test_optionalSlicing(self): - for func, data, elem, expected in self.precomputedCases: - for lo in xrange(4): - lo = min(len(data), lo) - for hi in xrange(3,8): - hi = min(len(data), hi) - ip = func(data, elem, lo, hi) - self.failUnless(lo <= ip <= hi) - if func is bisect_left and ip < hi: - self.failUnless(elem <= data[ip]) - if func is bisect_left and ip > lo: - self.failUnless(data[ip-1] < elem) - if func is bisect_right and ip < hi: - self.failUnless(elem < data[ip]) - if func is bisect_right and ip > lo: - self.failUnless(data[ip-1] <= elem) - self.assertEqual(ip, max(lo, min(hi, expected))) - - def test_backcompatibility(self): - self.assertEqual(bisect, bisect_right) - - def test_keyword_args(self): - data = [10, 20, 30, 40, 50] - self.assertEqual(bisect_left(a=data, x=25, lo=1, hi=3), 2) - self.assertEqual(bisect_right(a=data, x=25, lo=1, hi=3), 2) - self.assertEqual(bisect(a=data, x=25, lo=1, hi=3), 2) - insort_left(a=data, x=25, lo=1, hi=3) - insort_right(a=data, x=25, lo=1, hi=3) - insort(a=data, x=25, lo=1, hi=3) - self.assertEqual(data, [10, 20, 25, 25, 25, 30, 40, 50]) - -#============================================================================== - -class TestInsort(unittest.TestCase): - - def test_vsBuiltinSort(self, n=500): - from random import choice - for insorted in (list(), UserList()): - for i in xrange(n): - digit = choice("0123456789") - if digit in "02468": - f = insort_left - else: - f = insort_right - f(insorted, digit) - self.assertEqual(sorted(insorted), insorted) - - def test_backcompatibility(self): - self.assertEqual(insort, insort_right) - -#============================================================================== - - -class LenOnly: - "Dummy sequence class defining __len__ but not __getitem__." - def __len__(self): - return 10 - -class GetOnly: - "Dummy sequence class defining __getitem__ but not __len__." - def __getitem__(self, ndx): - return 10 - -class CmpErr: - "Dummy element that always raises an error during comparison" - def __cmp__(self, other): - raise ZeroDivisionError - -class TestErrorHandling(unittest.TestCase): - - def test_non_sequence(self): - for f in (bisect_left, bisect_right, insort_left, insort_right): - self.assertRaises(TypeError, f, 10, 10) - - def test_len_only(self): - for f in (bisect_left, bisect_right, insort_left, insort_right): - self.assertRaises(AttributeError, f, LenOnly(), 10) - - def test_get_only(self): - for f in (bisect_left, bisect_right, insort_left, insort_right): - self.assertRaises(AttributeError, f, GetOnly(), 10) - - def test_cmp_err(self): - seq = [CmpErr(), CmpErr(), CmpErr()] - for f in (bisect_left, bisect_right, insort_left, insort_right): - self.assertRaises(ZeroDivisionError, f, seq, 10) - - def test_arg_parsing(self): - for f in (bisect_left, bisect_right, insort_left, insort_right): - self.assertRaises(TypeError, f, 10) - -#============================================================================== - -libreftest = """ -Example from the Library Reference: Doc/lib/libbisect.tex - -The bisect() function is generally useful for categorizing numeric data. -This example uses bisect() to look up a letter grade for an exam total -(say) based on a set of ordered numeric breakpoints: 85 and up is an `A', -75..84 is a `B', etc. - - >>> grades = "FEDCBA" - >>> breakpoints = [30, 44, 66, 75, 85] - >>> from bisect import bisect - >>> def grade(total): - ... return grades[bisect(breakpoints, total)] - ... - >>> grade(66) - 'C' - >>> map(grade, [33, 99, 77, 44, 12, 88]) - ['E', 'A', 'B', 'D', 'F', 'A'] - -""" - -#------------------------------------------------------------------------------ - -__test__ = {'libreftest' : libreftest} - -def test_main(verbose=None): - from test import test_bisect - from types import BuiltinFunctionType - import sys - - test_classes = [TestBisect, TestInsort] - if isinstance(bisect_left, BuiltinFunctionType): - test_classes.append(TestErrorHandling) - - test_support.run_unittest(*test_classes) - test_support.run_doctest(test_bisect, verbose) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_bool.py b/sys/lib/python/test/test_bool.py deleted file mode 100644 index 33185a05d..000000000 --- a/sys/lib/python/test/test_bool.py +++ /dev/null @@ -1,348 +0,0 @@ -# Test properties of bool promised by PEP 285 - -import unittest -from test import test_support - -import os - -class BoolTest(unittest.TestCase): - - def assertIs(self, a, b): - self.assert_(a is b) - - def assertIsNot(self, a, b): - self.assert_(a is not b) - - def test_subclass(self): - try: - class C(bool): - pass - except TypeError: - pass - else: - self.fail("bool should not be subclassable") - - self.assertRaises(TypeError, int.__new__, bool, 0) - - def test_print(self): - try: - fo = open(test_support.TESTFN, "wb") - print >> fo, False, True - fo.close() - fo = open(test_support.TESTFN, "rb") - self.assertEqual(fo.read(), 'False True\n') - finally: - fo.close() - os.remove(test_support.TESTFN) - - def test_repr(self): - self.assertEqual(repr(False), 'False') - self.assertEqual(repr(True), 'True') - self.assertEqual(eval(repr(False)), False) - self.assertEqual(eval(repr(True)), True) - - def test_str(self): - self.assertEqual(str(False), 'False') - self.assertEqual(str(True), 'True') - - def test_int(self): - self.assertEqual(int(False), 0) - self.assertIsNot(int(False), False) - self.assertEqual(int(True), 1) - self.assertIsNot(int(True), True) - - def test_math(self): - self.assertEqual(+False, 0) - self.assertIsNot(+False, False) - self.assertEqual(-False, 0) - self.assertIsNot(-False, False) - self.assertEqual(abs(False), 0) - self.assertIsNot(abs(False), False) - self.assertEqual(+True, 1) - self.assertIsNot(+True, True) - self.assertEqual(-True, -1) - self.assertEqual(abs(True), 1) - self.assertIsNot(abs(True), True) - self.assertEqual(~False, -1) - self.assertEqual(~True, -2) - - self.assertEqual(False+2, 2) - self.assertEqual(True+2, 3) - self.assertEqual(2+False, 2) - self.assertEqual(2+True, 3) - - self.assertEqual(False+False, 0) - self.assertIsNot(False+False, False) - self.assertEqual(False+True, 1) - self.assertIsNot(False+True, True) - self.assertEqual(True+False, 1) - self.assertIsNot(True+False, True) - self.assertEqual(True+True, 2) - - self.assertEqual(True-True, 0) - self.assertIsNot(True-True, False) - self.assertEqual(False-False, 0) - self.assertIsNot(False-False, False) - self.assertEqual(True-False, 1) - self.assertIsNot(True-False, True) - self.assertEqual(False-True, -1) - - self.assertEqual(True*1, 1) - self.assertEqual(False*1, 0) - self.assertIsNot(False*1, False) - - self.assertEqual(True/1, 1) - self.assertIsNot(True/1, True) - self.assertEqual(False/1, 0) - self.assertIsNot(False/1, False) - - for b in False, True: - for i in 0, 1, 2: - self.assertEqual(b**i, int(b)**i) - self.assertIsNot(b**i, bool(int(b)**i)) - - for a in False, True: - for b in False, True: - self.assertIs(a&b, bool(int(a)&int(b))) - self.assertIs(a|b, bool(int(a)|int(b))) - self.assertIs(a^b, bool(int(a)^int(b))) - self.assertEqual(a&int(b), int(a)&int(b)) - self.assertIsNot(a&int(b), bool(int(a)&int(b))) - self.assertEqual(a|int(b), int(a)|int(b)) - self.assertIsNot(a|int(b), bool(int(a)|int(b))) - self.assertEqual(a^int(b), int(a)^int(b)) - self.assertIsNot(a^int(b), bool(int(a)^int(b))) - self.assertEqual(int(a)&b, int(a)&int(b)) - self.assertIsNot(int(a)&b, bool(int(a)&int(b))) - self.assertEqual(int(a)|b, int(a)|int(b)) - self.assertIsNot(int(a)|b, bool(int(a)|int(b))) - self.assertEqual(int(a)^b, int(a)^int(b)) - self.assertIsNot(int(a)^b, bool(int(a)^int(b))) - - self.assertIs(1==1, True) - self.assertIs(1==0, False) - self.assertIs(0<1, True) - self.assertIs(1<0, False) - self.assertIs(0<=0, True) - self.assertIs(1<=0, False) - self.assertIs(1>0, True) - self.assertIs(1>1, False) - self.assertIs(1>=1, True) - self.assertIs(0>=1, False) - self.assertIs(0!=1, True) - self.assertIs(0!=0, False) - - x = [1] - self.assertIs(x is x, True) - self.assertIs(x is not x, False) - - self.assertIs(1 in x, True) - self.assertIs(0 in x, False) - self.assertIs(1 not in x, False) - self.assertIs(0 not in x, True) - - x = {1: 2} - self.assertIs(x is x, True) - self.assertIs(x is not x, False) - - self.assertIs(1 in x, True) - self.assertIs(0 in x, False) - self.assertIs(1 not in x, False) - self.assertIs(0 not in x, True) - - self.assertIs(not True, False) - self.assertIs(not False, True) - - def test_convert(self): - self.assertRaises(TypeError, bool, 42, 42) - self.assertIs(bool(10), True) - self.assertIs(bool(1), True) - self.assertIs(bool(-1), True) - self.assertIs(bool(0), False) - self.assertIs(bool("hello"), True) - self.assertIs(bool(""), False) - self.assertIs(bool(), False) - - def test_hasattr(self): - self.assertIs(hasattr([], "append"), True) - self.assertIs(hasattr([], "wobble"), False) - - def test_callable(self): - self.assertIs(callable(len), True) - self.assertIs(callable(1), False) - - def test_isinstance(self): - self.assertIs(isinstance(True, bool), True) - self.assertIs(isinstance(False, bool), True) - self.assertIs(isinstance(True, int), True) - self.assertIs(isinstance(False, int), True) - self.assertIs(isinstance(1, bool), False) - self.assertIs(isinstance(0, bool), False) - - def test_issubclass(self): - self.assertIs(issubclass(bool, int), True) - self.assertIs(issubclass(int, bool), False) - - def test_haskey(self): - self.assertIs({}.has_key(1), False) - self.assertIs({1:1}.has_key(1), True) - - def test_string(self): - self.assertIs("xyz".endswith("z"), True) - self.assertIs("xyz".endswith("x"), False) - self.assertIs("xyz0123".isalnum(), True) - self.assertIs("@#$%".isalnum(), False) - self.assertIs("xyz".isalpha(), True) - self.assertIs("@#$%".isalpha(), False) - self.assertIs("0123".isdigit(), True) - self.assertIs("xyz".isdigit(), False) - self.assertIs("xyz".islower(), True) - self.assertIs("XYZ".islower(), False) - self.assertIs(" ".isspace(), True) - self.assertIs("XYZ".isspace(), False) - self.assertIs("X".istitle(), True) - self.assertIs("x".istitle(), False) - self.assertIs("XYZ".isupper(), True) - self.assertIs("xyz".isupper(), False) - self.assertIs("xyz".startswith("x"), True) - self.assertIs("xyz".startswith("z"), False) - - if test_support.have_unicode: - self.assertIs(unicode("xyz", 'ascii').endswith(unicode("z", 'ascii')), True) - self.assertIs(unicode("xyz", 'ascii').endswith(unicode("x", 'ascii')), False) - self.assertIs(unicode("xyz0123", 'ascii').isalnum(), True) - self.assertIs(unicode("@#$%", 'ascii').isalnum(), False) - self.assertIs(unicode("xyz", 'ascii').isalpha(), True) - self.assertIs(unicode("@#$%", 'ascii').isalpha(), False) - self.assertIs(unicode("0123", 'ascii').isdecimal(), True) - self.assertIs(unicode("xyz", 'ascii').isdecimal(), False) - self.assertIs(unicode("0123", 'ascii').isdigit(), True) - self.assertIs(unicode("xyz", 'ascii').isdigit(), False) - self.assertIs(unicode("xyz", 'ascii').islower(), True) - self.assertIs(unicode("XYZ", 'ascii').islower(), False) - self.assertIs(unicode("0123", 'ascii').isnumeric(), True) - self.assertIs(unicode("xyz", 'ascii').isnumeric(), False) - self.assertIs(unicode(" ", 'ascii').isspace(), True) - self.assertIs(unicode("XYZ", 'ascii').isspace(), False) - self.assertIs(unicode("X", 'ascii').istitle(), True) - self.assertIs(unicode("x", 'ascii').istitle(), False) - self.assertIs(unicode("XYZ", 'ascii').isupper(), True) - self.assertIs(unicode("xyz", 'ascii').isupper(), False) - self.assertIs(unicode("xyz", 'ascii').startswith(unicode("x", 'ascii')), True) - self.assertIs(unicode("xyz", 'ascii').startswith(unicode("z", 'ascii')), False) - - def test_boolean(self): - self.assertEqual(True & 1, 1) - self.assert_(not isinstance(True & 1, bool)) - self.assertIs(True & True, True) - - self.assertEqual(True | 1, 1) - self.assert_(not isinstance(True | 1, bool)) - self.assertIs(True | True, True) - - self.assertEqual(True ^ 1, 0) - self.assert_(not isinstance(True ^ 1, bool)) - self.assertIs(True ^ True, False) - - def test_fileclosed(self): - try: - f = file(test_support.TESTFN, "w") - self.assertIs(f.closed, False) - f.close() - self.assertIs(f.closed, True) - finally: - os.remove(test_support.TESTFN) - - def test_operator(self): - import operator - self.assertIs(operator.truth(0), False) - self.assertIs(operator.truth(1), True) - self.assertIs(operator.isCallable(0), False) - self.assertIs(operator.isCallable(len), True) - self.assertIs(operator.isNumberType(None), False) - self.assertIs(operator.isNumberType(0), True) - self.assertIs(operator.not_(1), False) - self.assertIs(operator.not_(0), True) - self.assertIs(operator.isSequenceType(0), False) - self.assertIs(operator.isSequenceType([]), True) - self.assertIs(operator.contains([], 1), False) - self.assertIs(operator.contains([1], 1), True) - self.assertIs(operator.isMappingType(1), False) - self.assertIs(operator.isMappingType({}), True) - self.assertIs(operator.lt(0, 0), False) - self.assertIs(operator.lt(0, 1), True) - self.assertIs(operator.is_(True, True), True) - self.assertIs(operator.is_(True, False), False) - self.assertIs(operator.is_not(True, True), False) - self.assertIs(operator.is_not(True, False), True) - - def test_marshal(self): - import marshal - self.assertIs(marshal.loads(marshal.dumps(True)), True) - self.assertIs(marshal.loads(marshal.dumps(False)), False) - - def test_pickle(self): - import pickle - self.assertIs(pickle.loads(pickle.dumps(True)), True) - self.assertIs(pickle.loads(pickle.dumps(False)), False) - self.assertIs(pickle.loads(pickle.dumps(True, True)), True) - self.assertIs(pickle.loads(pickle.dumps(False, True)), False) - - def test_cpickle(self): - import cPickle - self.assertIs(cPickle.loads(cPickle.dumps(True)), True) - self.assertIs(cPickle.loads(cPickle.dumps(False)), False) - self.assertIs(cPickle.loads(cPickle.dumps(True, True)), True) - self.assertIs(cPickle.loads(cPickle.dumps(False, True)), False) - - def test_mixedpickle(self): - import pickle, cPickle - self.assertIs(pickle.loads(cPickle.dumps(True)), True) - self.assertIs(pickle.loads(cPickle.dumps(False)), False) - self.assertIs(pickle.loads(cPickle.dumps(True, True)), True) - self.assertIs(pickle.loads(cPickle.dumps(False, True)), False) - - self.assertIs(cPickle.loads(pickle.dumps(True)), True) - self.assertIs(cPickle.loads(pickle.dumps(False)), False) - self.assertIs(cPickle.loads(pickle.dumps(True, True)), True) - self.assertIs(cPickle.loads(pickle.dumps(False, True)), False) - - def test_picklevalues(self): - import pickle, cPickle - - # Test for specific backwards-compatible pickle values - self.assertEqual(pickle.dumps(True), "I01\n.") - self.assertEqual(pickle.dumps(False), "I00\n.") - self.assertEqual(cPickle.dumps(True), "I01\n.") - self.assertEqual(cPickle.dumps(False), "I00\n.") - self.assertEqual(pickle.dumps(True, True), "I01\n.") - self.assertEqual(pickle.dumps(False, True), "I00\n.") - self.assertEqual(cPickle.dumps(True, True), "I01\n.") - self.assertEqual(cPickle.dumps(False, True), "I00\n.") - - def test_convert_to_bool(self): - # Verify that TypeError occurs when bad things are returned - # from __nonzero__(). This isn't really a bool test, but - # it's related. - check = lambda o: self.assertRaises(TypeError, bool, o) - class Foo(object): - def __nonzero__(self): - return self - check(Foo()) - - class Bar(object): - def __nonzero__(self): - return "Yes" - check(Bar()) - - class Baz(int): - def __nonzero__(self): - return self - check(Baz()) - - -def test_main(): - test_support.run_unittest(BoolTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_bsddb.py b/sys/lib/python/test/test_bsddb.py deleted file mode 100755 index 474f3da42..000000000 --- a/sys/lib/python/test/test_bsddb.py +++ /dev/null @@ -1,297 +0,0 @@ -#! /usr/bin/env python -"""Test script for the bsddb C module by Roger E. Masse - Adapted to unittest format and expanded scope by Raymond Hettinger -""" -import os, sys -import copy -import bsddb -import dbhash # Just so we know it's imported -import unittest -from test import test_support - -class TestBSDDB(unittest.TestCase): - openflag = 'c' - - def setUp(self): - self.f = self.openmethod[0](self.fname, self.openflag, cachesize=32768) - self.d = dict(q='Guido', w='van', e='Rossum', r='invented', t='Python', y='') - for k, v in self.d.iteritems(): - self.f[k] = v - - def tearDown(self): - self.f.sync() - self.f.close() - if self.fname is None: - return - try: - os.remove(self.fname) - except os.error: - pass - - def test_getitem(self): - for k, v in self.d.iteritems(): - self.assertEqual(self.f[k], v) - - def test_len(self): - self.assertEqual(len(self.f), len(self.d)) - - def test_change(self): - self.f['r'] = 'discovered' - self.assertEqual(self.f['r'], 'discovered') - self.assert_('r' in self.f.keys()) - self.assert_('discovered' in self.f.values()) - - def test_close_and_reopen(self): - if self.fname is None: - # if we're using an in-memory only db, we can't reopen it - # so finish here. - return - self.f.close() - self.f = self.openmethod[0](self.fname, 'w') - for k, v in self.d.iteritems(): - self.assertEqual(self.f[k], v) - - def assertSetEquals(self, seqn1, seqn2): - self.assertEqual(set(seqn1), set(seqn2)) - - def test_mapping_iteration_methods(self): - f = self.f - d = self.d - self.assertSetEquals(d, f) - self.assertSetEquals(d.keys(), f.keys()) - self.assertSetEquals(d.values(), f.values()) - self.assertSetEquals(d.items(), f.items()) - self.assertSetEquals(d.iterkeys(), f.iterkeys()) - self.assertSetEquals(d.itervalues(), f.itervalues()) - self.assertSetEquals(d.iteritems(), f.iteritems()) - - def test_iter_while_modifying_values(self): - if not hasattr(self.f, '__iter__'): - return - - di = iter(self.d) - while 1: - try: - key = di.next() - self.d[key] = 'modified '+key - except StopIteration: - break - - # it should behave the same as a dict. modifying values - # of existing keys should not break iteration. (adding - # or removing keys should) - fi = iter(self.f) - while 1: - try: - key = fi.next() - self.f[key] = 'modified '+key - except StopIteration: - break - - self.test_mapping_iteration_methods() - - def test_iteritems_while_modifying_values(self): - if not hasattr(self.f, 'iteritems'): - return - - di = self.d.iteritems() - while 1: - try: - k, v = di.next() - self.d[k] = 'modified '+v - except StopIteration: - break - - # it should behave the same as a dict. modifying values - # of existing keys should not break iteration. (adding - # or removing keys should) - fi = self.f.iteritems() - while 1: - try: - k, v = fi.next() - self.f[k] = 'modified '+v - except StopIteration: - break - - self.test_mapping_iteration_methods() - - def test_first_next_looping(self): - items = [self.f.first()] - for i in xrange(1, len(self.f)): - items.append(self.f.next()) - self.assertSetEquals(items, self.d.items()) - - def test_previous_last_looping(self): - items = [self.f.last()] - for i in xrange(1, len(self.f)): - items.append(self.f.previous()) - self.assertSetEquals(items, self.d.items()) - - def test_set_location(self): - self.assertEqual(self.f.set_location('e'), ('e', self.d['e'])) - - def test_contains(self): - for k in self.d: - self.assert_(k in self.f) - self.assert_('not here' not in self.f) - - def test_has_key(self): - for k in self.d: - self.assert_(self.f.has_key(k)) - self.assert_(not self.f.has_key('not here')) - - def test_clear(self): - self.f.clear() - self.assertEqual(len(self.f), 0) - - def test__no_deadlock_first(self, debug=0): - # do this so that testers can see what function we're in in - # verbose mode when we deadlock. - sys.stdout.flush() - - # in pybsddb's _DBWithCursor this causes an internal DBCursor - # object is created. Other test_ methods in this class could - # inadvertently cause the deadlock but an explicit test is needed. - if debug: print "A" - k,v = self.f.first() - if debug: print "B", k - self.f[k] = "deadlock. do not pass go. do not collect $200." - if debug: print "C" - # if the bsddb implementation leaves the DBCursor open during - # the database write and locking+threading support is enabled - # the cursor's read lock will deadlock the write lock request.. - - # test the iterator interface (if present) - if hasattr(self.f, 'iteritems'): - if debug: print "D" - i = self.f.iteritems() - k,v = i.next() - if debug: print "E" - self.f[k] = "please don't deadlock" - if debug: print "F" - while 1: - try: - k,v = i.next() - except StopIteration: - break - if debug: print "F2" - - i = iter(self.f) - if debug: print "G" - while i: - try: - if debug: print "H" - k = i.next() - if debug: print "I" - self.f[k] = "deadlocks-r-us" - if debug: print "J" - except StopIteration: - i = None - if debug: print "K" - - # test the legacy cursor interface mixed with writes - self.assert_(self.f.first()[0] in self.d) - k = self.f.next()[0] - self.assert_(k in self.d) - self.f[k] = "be gone with ye deadlocks" - self.assert_(self.f[k], "be gone with ye deadlocks") - - def test_for_cursor_memleak(self): - if not hasattr(self.f, 'iteritems'): - return - - # do the bsddb._DBWithCursor _iter_mixin internals leak cursors? - nc1 = len(self.f._cursor_refs) - # create iterator - i = self.f.iteritems() - nc2 = len(self.f._cursor_refs) - # use the iterator (should run to the first yeild, creating the cursor) - k, v = i.next() - nc3 = len(self.f._cursor_refs) - # destroy the iterator; this should cause the weakref callback - # to remove the cursor object from self.f._cursor_refs - del i - nc4 = len(self.f._cursor_refs) - - self.assertEqual(nc1, nc2) - self.assertEqual(nc1, nc4) - self.assert_(nc3 == nc1+1) - - def test_popitem(self): - k, v = self.f.popitem() - self.assert_(k in self.d) - self.assert_(v in self.d.values()) - self.assert_(k not in self.f) - self.assertEqual(len(self.d)-1, len(self.f)) - - def test_pop(self): - k = 'w' - v = self.f.pop(k) - self.assertEqual(v, self.d[k]) - self.assert_(k not in self.f) - self.assert_(v not in self.f.values()) - self.assertEqual(len(self.d)-1, len(self.f)) - - def test_get(self): - self.assertEqual(self.f.get('NotHere'), None) - self.assertEqual(self.f.get('NotHere', 'Default'), 'Default') - self.assertEqual(self.f.get('q', 'Default'), self.d['q']) - - def test_setdefault(self): - self.assertEqual(self.f.setdefault('new', 'dog'), 'dog') - self.assertEqual(self.f.setdefault('r', 'cat'), self.d['r']) - - def test_update(self): - new = dict(y='life', u='of', i='brian') - self.f.update(new) - self.d.update(new) - for k, v in self.d.iteritems(): - self.assertEqual(self.f[k], v) - - def test_keyordering(self): - if self.openmethod[0] is not bsddb.btopen: - return - keys = self.d.keys() - keys.sort() - self.assertEqual(self.f.first()[0], keys[0]) - self.assertEqual(self.f.next()[0], keys[1]) - self.assertEqual(self.f.last()[0], keys[-1]) - self.assertEqual(self.f.previous()[0], keys[-2]) - self.assertEqual(list(self.f), keys) - -class TestBTree(TestBSDDB): - fname = test_support.TESTFN - openmethod = [bsddb.btopen] - -class TestBTree_InMemory(TestBSDDB): - fname = None - openmethod = [bsddb.btopen] - -class TestBTree_InMemory_Truncate(TestBSDDB): - fname = None - openflag = 'n' - openmethod = [bsddb.btopen] - -class TestHashTable(TestBSDDB): - fname = test_support.TESTFN - openmethod = [bsddb.hashopen] - -class TestHashTable_InMemory(TestBSDDB): - fname = None - openmethod = [bsddb.hashopen] - -## # (bsddb.rnopen,'Record Numbers'), 'put' for RECNO for bsddb 1.85 -## # appears broken... at least on -## # Solaris Intel - rmasse 1/97 - -def test_main(verbose=None): - test_support.run_unittest( - TestBTree, - TestHashTable, - TestBTree_InMemory, - TestHashTable_InMemory, - TestBTree_InMemory_Truncate, - ) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_bsddb185.py b/sys/lib/python/test/test_bsddb185.py deleted file mode 100644 index df1ece09c..000000000 --- a/sys/lib/python/test/test_bsddb185.py +++ /dev/null @@ -1,43 +0,0 @@ -"""Tests for the bsddb185 module. - -The file 185test.db found in Lib/test/ is for testing purposes with this -testing suite. - -""" -from test.test_support import verbose, run_unittest, findfile -import unittest -import bsddb185 -import anydbm -import whichdb -import os -import tempfile -import shutil - -class Bsddb185Tests(unittest.TestCase): - - def test_open_existing_hash(self): - # Verify we can open a file known to be a hash v2 file - db = bsddb185.hashopen(findfile("185test.db")) - self.assertEqual(db["1"], "1") - db.close() - - def test_whichdb(self): - # Verify that whichdb correctly sniffs the known hash v2 file - self.assertEqual(whichdb.whichdb(findfile("185test.db")), "bsddb185") - - def test_anydbm_create(self): - # Verify that anydbm.open does *not* create a bsddb185 file - tmpdir = tempfile.mkdtemp() - try: - dbfile = os.path.join(tmpdir, "foo.db") - anydbm.open(dbfile, "c").close() - ftype = whichdb.whichdb(dbfile) - self.assertNotEqual(ftype, "bsddb185") - finally: - shutil.rmtree(tmpdir) - -def test_main(): - run_unittest(Bsddb185Tests) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_bsddb3.py b/sys/lib/python/test/test_bsddb3.py deleted file mode 100644 index 8b0c50c8c..000000000 --- a/sys/lib/python/test/test_bsddb3.py +++ /dev/null @@ -1,76 +0,0 @@ -# Test driver for bsddb package. -""" -Run all test cases. -""" -import sys -import unittest -from test.test_support import requires, verbose, run_suite, unlink - -# When running as a script instead of within the regrtest framework, skip the -# requires test, since it's obvious we want to run them. -if __name__ <> '__main__': - requires('bsddb') - -verbose = False -if 'verbose' in sys.argv: - verbose = True - sys.argv.remove('verbose') - -if 'silent' in sys.argv: # take care of old flag, just in case - verbose = False - sys.argv.remove('silent') - - -def suite(): - try: - # this is special, it used to segfault the interpreter - import bsddb.test.test_1413192 - except: - for f in ['__db.001', '__db.002', '__db.003', 'log.0000000001']: - unlink(f) - - test_modules = [ - 'test_associate', - 'test_basics', - 'test_compat', - 'test_dbobj', - 'test_dbshelve', - 'test_dbtables', - 'test_env_close', - 'test_get_none', - 'test_join', - 'test_lock', - 'test_misc', - 'test_queue', - 'test_recno', - 'test_thread', - 'test_sequence', - 'test_cursor_pget_bug', - ] - - alltests = unittest.TestSuite() - for name in test_modules: - module = __import__("bsddb.test."+name, globals(), locals(), name) - #print module,name - alltests.addTest(module.test_suite()) - return alltests - - -# For invocation through regrtest -def test_main(): - tests = suite() - run_suite(tests) - - -# For invocation as a script -if __name__ == '__main__': - from bsddb import db - print '-=' * 38 - print db.DB_VERSION_STRING - print 'bsddb.db.version(): %s' % (db.version(),) - print 'bsddb.db.__version__: %s' % db.__version__ - print 'bsddb.db.cvsid: %s' % db.cvsid - print 'python version: %s' % sys.version - print '-=' * 38 - - unittest.main(defaultTest='suite') diff --git a/sys/lib/python/test/test_bufio.py b/sys/lib/python/test/test_bufio.py deleted file mode 100644 index 611cd695d..000000000 --- a/sys/lib/python/test/test_bufio.py +++ /dev/null @@ -1,60 +0,0 @@ -from test.test_support import verify, TestFailed, TESTFN - -# Simple test to ensure that optimizations in fileobject.c deliver -# the expected results. For best testing, run this under a debug-build -# Python too (to exercise asserts in the C code). - -# Repeat string 'pattern' as often as needed to reach total length -# 'length'. Then call try_one with that string, a string one larger -# than that, and a string one smaller than that. The main driver -# feeds this all small sizes and various powers of 2, so we exercise -# all likely stdio buffer sizes, and "off by one" errors on both -# sides. -def drive_one(pattern, length): - q, r = divmod(length, len(pattern)) - teststring = pattern * q + pattern[:r] - verify(len(teststring) == length) - try_one(teststring) - try_one(teststring + "x") - try_one(teststring[:-1]) - -# Write s + "\n" + s to file, then open it and ensure that successive -# .readline()s deliver what we wrote. -def try_one(s): - # Since C doesn't guarantee we can write/read arbitrary bytes in text - # files, use binary mode. - f = open(TESTFN, "wb") - # write once with \n and once without - f.write(s) - f.write("\n") - f.write(s) - f.close() - f = open(TESTFN, "rb") - line = f.readline() - if line != s + "\n": - raise TestFailed("Expected %r got %r" % (s + "\n", line)) - line = f.readline() - if line != s: - raise TestFailed("Expected %r got %r" % (s, line)) - line = f.readline() - if line: - raise TestFailed("Expected EOF but got %r" % line) - f.close() - -# A pattern with prime length, to avoid simple relationships with -# stdio buffer sizes. -primepat = "1234567890\00\01\02\03\04\05\06" - -nullpat = "\0" * 1000 - -try: - for size in range(1, 257) + [512, 1000, 1024, 2048, 4096, 8192, 10000, - 16384, 32768, 65536, 1000000]: - drive_one(primepat, size) - drive_one(nullpat, size) -finally: - try: - import os - os.unlink(TESTFN) - except: - pass diff --git a/sys/lib/python/test/test_builtin.py b/sys/lib/python/test/test_builtin.py deleted file mode 100644 index da2afbac3..000000000 --- a/sys/lib/python/test/test_builtin.py +++ /dev/null @@ -1,1783 +0,0 @@ -# Python test set -- built-in functions - -import test.test_support, unittest -from test.test_support import fcmp, have_unicode, TESTFN, unlink, \ - run_unittest, run_with_locale -from operator import neg - -import sys, warnings, cStringIO, random, UserDict -warnings.filterwarnings("ignore", "hex../oct.. of negative int", - FutureWarning, __name__) -warnings.filterwarnings("ignore", "integer argument expected", - DeprecationWarning, "unittest") - -# count the number of test runs. -# used to skip running test_execfile() multiple times -numruns = 0 - -class Squares: - - def __init__(self, max): - self.max = max - self.sofar = [] - - def __len__(self): return len(self.sofar) - - def __getitem__(self, i): - if not 0 <= i < self.max: raise IndexError - n = len(self.sofar) - while n <= i: - self.sofar.append(n*n) - n += 1 - return self.sofar[i] - -class StrSquares: - - def __init__(self, max): - self.max = max - self.sofar = [] - - def __len__(self): - return len(self.sofar) - - def __getitem__(self, i): - if not 0 <= i < self.max: - raise IndexError - n = len(self.sofar) - while n <= i: - self.sofar.append(str(n*n)) - n += 1 - return self.sofar[i] - -class BitBucket: - def write(self, line): - pass - -L = [ - ('0', 0), - ('1', 1), - ('9', 9), - ('10', 10), - ('99', 99), - ('100', 100), - ('314', 314), - (' 314', 314), - ('314 ', 314), - (' \t\t 314 \t\t ', 314), - (repr(sys.maxint), sys.maxint), - (' 1x', ValueError), - (' 1 ', 1), - (' 1\02 ', ValueError), - ('', ValueError), - (' ', ValueError), - (' \t\t ', ValueError) -] -if have_unicode: - L += [ - (unicode('0'), 0), - (unicode('1'), 1), - (unicode('9'), 9), - (unicode('10'), 10), - (unicode('99'), 99), - (unicode('100'), 100), - (unicode('314'), 314), - (unicode(' 314'), 314), - (unicode('\u0663\u0661\u0664 ','raw-unicode-escape'), 314), - (unicode(' \t\t 314 \t\t '), 314), - (unicode(' 1x'), ValueError), - (unicode(' 1 '), 1), - (unicode(' 1\02 '), ValueError), - (unicode(''), ValueError), - (unicode(' '), ValueError), - (unicode(' \t\t '), ValueError), - (unichr(0x200), ValueError), -] - -class TestFailingBool: - def __nonzero__(self): - raise RuntimeError - -class TestFailingIter: - def __iter__(self): - raise RuntimeError - -class BuiltinTest(unittest.TestCase): - - def test_import(self): - __import__('sys') - __import__('time') - __import__('string') - self.assertRaises(ImportError, __import__, 'spamspam') - self.assertRaises(TypeError, __import__, 1, 2, 3, 4) - self.assertRaises(ValueError, __import__, '') - - def test_abs(self): - # int - self.assertEqual(abs(0), 0) - self.assertEqual(abs(1234), 1234) - self.assertEqual(abs(-1234), 1234) - self.assertTrue(abs(-sys.maxint-1) > 0) - # float - self.assertEqual(abs(0.0), 0.0) - self.assertEqual(abs(3.14), 3.14) - self.assertEqual(abs(-3.14), 3.14) - # long - self.assertEqual(abs(0L), 0L) - self.assertEqual(abs(1234L), 1234L) - self.assertEqual(abs(-1234L), 1234L) - # str - self.assertRaises(TypeError, abs, 'a') - - def test_all(self): - self.assertEqual(all([2, 4, 6]), True) - self.assertEqual(all([2, None, 6]), False) - self.assertRaises(RuntimeError, all, [2, TestFailingBool(), 6]) - self.assertRaises(RuntimeError, all, TestFailingIter()) - self.assertRaises(TypeError, all, 10) # Non-iterable - self.assertRaises(TypeError, all) # No args - self.assertRaises(TypeError, all, [2, 4, 6], []) # Too many args - self.assertEqual(all([]), True) # Empty iterator - S = [50, 60] - self.assertEqual(all(x > 42 for x in S), True) - S = [50, 40, 60] - self.assertEqual(all(x > 42 for x in S), False) - - def test_any(self): - self.assertEqual(any([None, None, None]), False) - self.assertEqual(any([None, 4, None]), True) - self.assertRaises(RuntimeError, any, [None, TestFailingBool(), 6]) - self.assertRaises(RuntimeError, all, TestFailingIter()) - self.assertRaises(TypeError, any, 10) # Non-iterable - self.assertRaises(TypeError, any) # No args - self.assertRaises(TypeError, any, [2, 4, 6], []) # Too many args - self.assertEqual(any([]), False) # Empty iterator - S = [40, 60, 30] - self.assertEqual(any(x > 42 for x in S), True) - S = [10, 20, 30] - self.assertEqual(any(x > 42 for x in S), False) - - def test_neg(self): - x = -sys.maxint-1 - self.assert_(isinstance(x, int)) - self.assertEqual(-x, sys.maxint+1) - - def test_apply(self): - def f0(*args): - self.assertEqual(args, ()) - def f1(a1): - self.assertEqual(a1, 1) - def f2(a1, a2): - self.assertEqual(a1, 1) - self.assertEqual(a2, 2) - def f3(a1, a2, a3): - self.assertEqual(a1, 1) - self.assertEqual(a2, 2) - self.assertEqual(a3, 3) - apply(f0, ()) - apply(f1, (1,)) - apply(f2, (1, 2)) - apply(f3, (1, 2, 3)) - - # A PyCFunction that takes only positional parameters should allow an - # empty keyword dictionary to pass without a complaint, but raise a - # TypeError if the dictionary is non-empty. - apply(id, (1,), {}) - self.assertRaises(TypeError, apply, id, (1,), {"foo": 1}) - self.assertRaises(TypeError, apply) - self.assertRaises(TypeError, apply, id, 42) - self.assertRaises(TypeError, apply, id, (42,), 42) - - def test_callable(self): - self.assert_(callable(len)) - def f(): pass - self.assert_(callable(f)) - class C: - def meth(self): pass - self.assert_(callable(C)) - x = C() - self.assert_(callable(x.meth)) - self.assert_(not callable(x)) - class D(C): - def __call__(self): pass - y = D() - self.assert_(callable(y)) - y() - - def test_chr(self): - self.assertEqual(chr(32), ' ') - self.assertEqual(chr(65), 'A') - self.assertEqual(chr(97), 'a') - self.assertEqual(chr(0xff), '\xff') - self.assertRaises(ValueError, chr, 256) - self.assertRaises(TypeError, chr) - - def test_cmp(self): - self.assertEqual(cmp(-1, 1), -1) - self.assertEqual(cmp(1, -1), 1) - self.assertEqual(cmp(1, 1), 0) - # verify that circular objects are not handled - a = []; a.append(a) - b = []; b.append(b) - from UserList import UserList - c = UserList(); c.append(c) - self.assertRaises(RuntimeError, cmp, a, b) - self.assertRaises(RuntimeError, cmp, b, c) - self.assertRaises(RuntimeError, cmp, c, a) - self.assertRaises(RuntimeError, cmp, a, c) - # okay, now break the cycles - a.pop(); b.pop(); c.pop() - self.assertRaises(TypeError, cmp) - - def test_coerce(self): - self.assert_(not fcmp(coerce(1, 1.1), (1.0, 1.1))) - self.assertEqual(coerce(1, 1L), (1L, 1L)) - self.assert_(not fcmp(coerce(1L, 1.1), (1.0, 1.1))) - self.assertRaises(TypeError, coerce) - class BadNumber: - def __coerce__(self, other): - raise ValueError - self.assertRaises(ValueError, coerce, 42, BadNumber()) - self.assertRaises(OverflowError, coerce, 0.5, int("12345" * 1000)) - - def test_compile(self): - compile('print 1\n', '', 'exec') - bom = '\xef\xbb\xbf' - compile(bom + 'print 1\n', '', 'exec') - self.assertRaises(TypeError, compile) - self.assertRaises(ValueError, compile, 'print 42\n', '', 'badmode') - self.assertRaises(ValueError, compile, 'print 42\n', '', 'single', 0xff) - self.assertRaises(TypeError, compile, chr(0), 'f', 'exec') - if have_unicode: - compile(unicode('print u"\xc3\xa5"\n', 'utf8'), '', 'exec') - self.assertRaises(TypeError, compile, unichr(0), 'f', 'exec') - self.assertRaises(ValueError, compile, unicode('a = 1'), 'f', 'bad') - - def test_delattr(self): - import sys - sys.spam = 1 - delattr(sys, 'spam') - self.assertRaises(TypeError, delattr) - - def test_dir(self): - x = 1 - self.assert_('x' in dir()) - import sys - self.assert_('modules' in dir(sys)) - self.assertRaises(TypeError, dir, 42, 42) - - def test_divmod(self): - self.assertEqual(divmod(12, 7), (1, 5)) - self.assertEqual(divmod(-12, 7), (-2, 2)) - self.assertEqual(divmod(12, -7), (-2, -2)) - self.assertEqual(divmod(-12, -7), (1, -5)) - - self.assertEqual(divmod(12L, 7L), (1L, 5L)) - self.assertEqual(divmod(-12L, 7L), (-2L, 2L)) - self.assertEqual(divmod(12L, -7L), (-2L, -2L)) - self.assertEqual(divmod(-12L, -7L), (1L, -5L)) - - self.assertEqual(divmod(12, 7L), (1, 5L)) - self.assertEqual(divmod(-12, 7L), (-2, 2L)) - self.assertEqual(divmod(12L, -7), (-2L, -2)) - self.assertEqual(divmod(-12L, -7), (1L, -5)) - - self.assertEqual(divmod(-sys.maxint-1, -1), - (sys.maxint+1, 0)) - - self.assert_(not fcmp(divmod(3.25, 1.0), (3.0, 0.25))) - self.assert_(not fcmp(divmod(-3.25, 1.0), (-4.0, 0.75))) - self.assert_(not fcmp(divmod(3.25, -1.0), (-4.0, -0.75))) - self.assert_(not fcmp(divmod(-3.25, -1.0), (3.0, -0.25))) - - self.assertRaises(TypeError, divmod) - - def test_eval(self): - self.assertEqual(eval('1+1'), 2) - self.assertEqual(eval(' 1+1\n'), 2) - globals = {'a': 1, 'b': 2} - locals = {'b': 200, 'c': 300} - self.assertEqual(eval('a', globals) , 1) - self.assertEqual(eval('a', globals, locals), 1) - self.assertEqual(eval('b', globals, locals), 200) - self.assertEqual(eval('c', globals, locals), 300) - if have_unicode: - self.assertEqual(eval(unicode('1+1')), 2) - self.assertEqual(eval(unicode(' 1+1\n')), 2) - globals = {'a': 1, 'b': 2} - locals = {'b': 200, 'c': 300} - if have_unicode: - self.assertEqual(eval(unicode('a'), globals), 1) - self.assertEqual(eval(unicode('a'), globals, locals), 1) - self.assertEqual(eval(unicode('b'), globals, locals), 200) - self.assertEqual(eval(unicode('c'), globals, locals), 300) - bom = '\xef\xbb\xbf' - self.assertEqual(eval(bom + 'a', globals, locals), 1) - self.assertEqual(eval(unicode('u"\xc3\xa5"', 'utf8'), globals), - unicode('\xc3\xa5', 'utf8')) - self.assertRaises(TypeError, eval) - self.assertRaises(TypeError, eval, ()) - - def test_general_eval(self): - # Tests that general mappings can be used for the locals argument - - class M: - "Test mapping interface versus possible calls from eval()." - def __getitem__(self, key): - if key == 'a': - return 12 - raise KeyError - def keys(self): - return list('xyz') - - m = M() - g = globals() - self.assertEqual(eval('a', g, m), 12) - self.assertRaises(NameError, eval, 'b', g, m) - self.assertEqual(eval('dir()', g, m), list('xyz')) - self.assertEqual(eval('globals()', g, m), g) - self.assertEqual(eval('locals()', g, m), m) - self.assertRaises(TypeError, eval, 'a', m) - class A: - "Non-mapping" - pass - m = A() - self.assertRaises(TypeError, eval, 'a', g, m) - - # Verify that dict subclasses work as well - class D(dict): - def __getitem__(self, key): - if key == 'a': - return 12 - return dict.__getitem__(self, key) - def keys(self): - return list('xyz') - - d = D() - self.assertEqual(eval('a', g, d), 12) - self.assertRaises(NameError, eval, 'b', g, d) - self.assertEqual(eval('dir()', g, d), list('xyz')) - self.assertEqual(eval('globals()', g, d), g) - self.assertEqual(eval('locals()', g, d), d) - - # Verify locals stores (used by list comps) - eval('[locals() for i in (2,3)]', g, d) - eval('[locals() for i in (2,3)]', g, UserDict.UserDict()) - - class SpreadSheet: - "Sample application showing nested, calculated lookups." - _cells = {} - def __setitem__(self, key, formula): - self._cells[key] = formula - def __getitem__(self, key): - return eval(self._cells[key], globals(), self) - - ss = SpreadSheet() - ss['a1'] = '5' - ss['a2'] = 'a1*6' - ss['a3'] = 'a2*7' - self.assertEqual(ss['a3'], 210) - - # Verify that dir() catches a non-list returned by eval - # SF bug #1004669 - class C: - def __getitem__(self, item): - raise KeyError(item) - def keys(self): - return 'a' - self.assertRaises(TypeError, eval, 'dir()', globals(), C()) - - # Done outside of the method test_z to get the correct scope - z = 0 - f = open(TESTFN, 'w') - f.write('z = z+1\n') - f.write('z = z*2\n') - f.close() - execfile(TESTFN) - - def test_execfile(self): - global numruns - if numruns: - return - numruns += 1 - - globals = {'a': 1, 'b': 2} - locals = {'b': 200, 'c': 300} - - self.assertEqual(self.__class__.z, 2) - globals['z'] = 0 - execfile(TESTFN, globals) - self.assertEqual(globals['z'], 2) - locals['z'] = 0 - execfile(TESTFN, globals, locals) - self.assertEqual(locals['z'], 2) - - class M: - "Test mapping interface versus possible calls from execfile()." - def __init__(self): - self.z = 10 - def __getitem__(self, key): - if key == 'z': - return self.z - raise KeyError - def __setitem__(self, key, value): - if key == 'z': - self.z = value - return - raise KeyError - - locals = M() - locals['z'] = 0 - execfile(TESTFN, globals, locals) - self.assertEqual(locals['z'], 2) - - unlink(TESTFN) - self.assertRaises(TypeError, execfile) - self.assertRaises(TypeError, execfile, TESTFN, {}, ()) - import os - self.assertRaises(IOError, execfile, os.curdir) - self.assertRaises(IOError, execfile, "I_dont_exist") - - def test_filter(self): - self.assertEqual(filter(lambda c: 'a' <= c <= 'z', 'Hello World'), 'elloorld') - self.assertEqual(filter(None, [1, 'hello', [], [3], '', None, 9, 0]), [1, 'hello', [3], 9]) - self.assertEqual(filter(lambda x: x > 0, [1, -3, 9, 0, 2]), [1, 9, 2]) - self.assertEqual(filter(None, Squares(10)), [1, 4, 9, 16, 25, 36, 49, 64, 81]) - self.assertEqual(filter(lambda x: x%2, Squares(10)), [1, 9, 25, 49, 81]) - def identity(item): - return 1 - filter(identity, Squares(5)) - self.assertRaises(TypeError, filter) - class BadSeq(object): - def __getitem__(self, index): - if index<4: - return 42 - raise ValueError - self.assertRaises(ValueError, filter, lambda x: x, BadSeq()) - def badfunc(): - pass - self.assertRaises(TypeError, filter, badfunc, range(5)) - - # test bltinmodule.c::filtertuple() - self.assertEqual(filter(None, (1, 2)), (1, 2)) - self.assertEqual(filter(lambda x: x>=3, (1, 2, 3, 4)), (3, 4)) - self.assertRaises(TypeError, filter, 42, (1, 2)) - - # test bltinmodule.c::filterstring() - self.assertEqual(filter(None, "12"), "12") - self.assertEqual(filter(lambda x: x>="3", "1234"), "34") - self.assertRaises(TypeError, filter, 42, "12") - class badstr(str): - def __getitem__(self, index): - raise ValueError - self.assertRaises(ValueError, filter, lambda x: x >="3", badstr("1234")) - - class badstr2(str): - def __getitem__(self, index): - return 42 - self.assertRaises(TypeError, filter, lambda x: x >=42, badstr2("1234")) - - class weirdstr(str): - def __getitem__(self, index): - return weirdstr(2*str.__getitem__(self, index)) - self.assertEqual(filter(lambda x: x>="33", weirdstr("1234")), "3344") - - class shiftstr(str): - def __getitem__(self, index): - return chr(ord(str.__getitem__(self, index))+1) - self.assertEqual(filter(lambda x: x>="3", shiftstr("1234")), "345") - - if have_unicode: - # test bltinmodule.c::filterunicode() - self.assertEqual(filter(None, unicode("12")), unicode("12")) - self.assertEqual(filter(lambda x: x>="3", unicode("1234")), unicode("34")) - self.assertRaises(TypeError, filter, 42, unicode("12")) - self.assertRaises(ValueError, filter, lambda x: x >="3", badstr(unicode("1234"))) - - class badunicode(unicode): - def __getitem__(self, index): - return 42 - self.assertRaises(TypeError, filter, lambda x: x >=42, badunicode("1234")) - - class weirdunicode(unicode): - def __getitem__(self, index): - return weirdunicode(2*unicode.__getitem__(self, index)) - self.assertEqual( - filter(lambda x: x>=unicode("33"), weirdunicode("1234")), unicode("3344")) - - class shiftunicode(unicode): - def __getitem__(self, index): - return unichr(ord(unicode.__getitem__(self, index))+1) - self.assertEqual( - filter(lambda x: x>=unicode("3"), shiftunicode("1234")), - unicode("345") - ) - - def test_filter_subclasses(self): - # test that filter() never returns tuple, str or unicode subclasses - # and that the result always goes through __getitem__ - funcs = (None, bool, lambda x: True) - class tuple2(tuple): - def __getitem__(self, index): - return 2*tuple.__getitem__(self, index) - class str2(str): - def __getitem__(self, index): - return 2*str.__getitem__(self, index) - inputs = { - tuple2: {(): (), (1, 2, 3): (2, 4, 6)}, - str2: {"": "", "123": "112233"} - } - if have_unicode: - class unicode2(unicode): - def __getitem__(self, index): - return 2*unicode.__getitem__(self, index) - inputs[unicode2] = { - unicode(): unicode(), - unicode("123"): unicode("112233") - } - - for (cls, inps) in inputs.iteritems(): - for (inp, exp) in inps.iteritems(): - # make sure the output goes through __getitem__ - # even if func is None - self.assertEqual( - filter(funcs[0], cls(inp)), - filter(funcs[1], cls(inp)) - ) - for func in funcs: - outp = filter(func, cls(inp)) - self.assertEqual(outp, exp) - self.assert_(not isinstance(outp, cls)) - - def test_float(self): - self.assertEqual(float(3.14), 3.14) - self.assertEqual(float(314), 314.0) - self.assertEqual(float(314L), 314.0) - self.assertEqual(float(" 3.14 "), 3.14) - self.assertRaises(ValueError, float, " 0x3.1 ") - self.assertRaises(ValueError, float, " -0x3.p-1 ") - if have_unicode: - self.assertEqual(float(unicode(" 3.14 ")), 3.14) - self.assertEqual(float(unicode(" \u0663.\u0661\u0664 ",'raw-unicode-escape')), 3.14) - # Implementation limitation in PyFloat_FromString() - self.assertRaises(ValueError, float, unicode("1"*10000)) - - @run_with_locale('LC_NUMERIC', 'fr_FR', 'de_DE') - def test_float_with_comma(self): - # set locale to something that doesn't use '.' for the decimal point - # float must not accept the locale specific decimal point but - # it still has to accept the normal python syntac - import locale - if not locale.localeconv()['decimal_point'] == ',': - return - - self.assertEqual(float(" 3.14 "), 3.14) - self.assertEqual(float("+3.14 "), 3.14) - self.assertEqual(float("-3.14 "), -3.14) - self.assertEqual(float(".14 "), .14) - self.assertEqual(float("3. "), 3.0) - self.assertEqual(float("3.e3 "), 3000.0) - self.assertEqual(float("3.2e3 "), 3200.0) - self.assertEqual(float("2.5e-1 "), 0.25) - self.assertEqual(float("5e-1"), 0.5) - self.assertRaises(ValueError, float, " 3,14 ") - self.assertRaises(ValueError, float, " +3,14 ") - self.assertRaises(ValueError, float, " -3,14 ") - self.assertRaises(ValueError, float, " 0x3.1 ") - self.assertRaises(ValueError, float, " -0x3.p-1 ") - self.assertEqual(float(" 25.e-1 "), 2.5) - self.assertEqual(fcmp(float(" .25e-1 "), .025), 0) - - def test_floatconversion(self): - # Make sure that calls to __float__() work properly - class Foo0: - def __float__(self): - return 42. - - class Foo1(object): - def __float__(self): - return 42. - - class Foo2(float): - def __float__(self): - return 42. - - class Foo3(float): - def __new__(cls, value=0.): - return float.__new__(cls, 2*value) - - def __float__(self): - return self - - class Foo4(float): - def __float__(self): - return 42 - - self.assertAlmostEqual(float(Foo0()), 42.) - self.assertAlmostEqual(float(Foo1()), 42.) - self.assertAlmostEqual(float(Foo2()), 42.) - self.assertAlmostEqual(float(Foo3(21)), 42.) - self.assertRaises(TypeError, float, Foo4(42)) - - def test_getattr(self): - import sys - self.assert_(getattr(sys, 'stdout') is sys.stdout) - self.assertRaises(TypeError, getattr, sys, 1) - self.assertRaises(TypeError, getattr, sys, 1, "foo") - self.assertRaises(TypeError, getattr) - if have_unicode: - self.assertRaises(UnicodeError, getattr, sys, unichr(sys.maxunicode)) - - def test_hasattr(self): - import sys - self.assert_(hasattr(sys, 'stdout')) - self.assertRaises(TypeError, hasattr, sys, 1) - self.assertRaises(TypeError, hasattr) - if have_unicode: - self.assertRaises(UnicodeError, hasattr, sys, unichr(sys.maxunicode)) - - def test_hash(self): - hash(None) - self.assertEqual(hash(1), hash(1L)) - self.assertEqual(hash(1), hash(1.0)) - hash('spam') - if have_unicode: - self.assertEqual(hash('spam'), hash(unicode('spam'))) - hash((0,1,2,3)) - def f(): pass - self.assertRaises(TypeError, hash, []) - self.assertRaises(TypeError, hash, {}) - # Bug 1536021: Allow hash to return long objects - class X: - def __hash__(self): - return 2**100 - self.assertEquals(type(hash(X())), int) - class Y(object): - def __hash__(self): - return 2**100 - self.assertEquals(type(hash(Y())), int) - class Z(long): - def __hash__(self): - return self - self.assertEquals(hash(Z(42)), hash(42L)) - - def test_hex(self): - self.assertEqual(hex(16), '0x10') - self.assertEqual(hex(16L), '0x10L') - self.assertEqual(hex(-16), '-0x10') - self.assertEqual(hex(-16L), '-0x10L') - self.assertRaises(TypeError, hex, {}) - - def test_id(self): - id(None) - id(1) - id(1L) - id(1.0) - id('spam') - id((0,1,2,3)) - id([0,1,2,3]) - id({'spam': 1, 'eggs': 2, 'ham': 3}) - - # Test input() later, together with raw_input - - def test_int(self): - self.assertEqual(int(314), 314) - self.assertEqual(int(3.14), 3) - self.assertEqual(int(314L), 314) - # Check that conversion from float truncates towards zero - self.assertEqual(int(-3.14), -3) - self.assertEqual(int(3.9), 3) - self.assertEqual(int(-3.9), -3) - self.assertEqual(int(3.5), 3) - self.assertEqual(int(-3.5), -3) - # Different base: - self.assertEqual(int("10",16), 16L) - if have_unicode: - self.assertEqual(int(unicode("10"),16), 16L) - # Test conversion from strings and various anomalies - for s, v in L: - for sign in "", "+", "-": - for prefix in "", " ", "\t", " \t\t ": - ss = prefix + sign + s - vv = v - if sign == "-" and v is not ValueError: - vv = -v - try: - self.assertEqual(int(ss), vv) - except v: - pass - - s = repr(-1-sys.maxint) - x = int(s) - self.assertEqual(x+1, -sys.maxint) - self.assert_(isinstance(x, int)) - # should return long - self.assertEqual(int(s[1:]), sys.maxint+1) - - # should return long - x = int(1e100) - self.assert_(isinstance(x, long)) - x = int(-1e100) - self.assert_(isinstance(x, long)) - - - # SF bug 434186: 0x80000000/2 != 0x80000000>>1. - # Worked by accident in Windows release build, but failed in debug build. - # Failed in all Linux builds. - x = -1-sys.maxint - self.assertEqual(x >> 1, x//2) - - self.assertRaises(ValueError, int, '123\0') - self.assertRaises(ValueError, int, '53', 40) - - # SF bug 1545497: embedded NULs were not detected with - # explicit base - self.assertRaises(ValueError, int, '123\0', 10) - self.assertRaises(ValueError, int, '123\x00 245', 20) - - x = int('1' * 600) - self.assert_(isinstance(x, long)) - - if have_unicode: - x = int(unichr(0x661) * 600) - self.assert_(isinstance(x, long)) - - self.assertRaises(TypeError, int, 1, 12) - - self.assertEqual(int('0123', 0), 83) - self.assertEqual(int('0x123', 16), 291) - - # SF bug 1334662: int(string, base) wrong answers - # Various representations of 2**32 evaluated to 0 - # rather than 2**32 in previous versions - - self.assertEqual(int('100000000000000000000000000000000', 2), 4294967296L) - self.assertEqual(int('102002022201221111211', 3), 4294967296L) - self.assertEqual(int('10000000000000000', 4), 4294967296L) - self.assertEqual(int('32244002423141', 5), 4294967296L) - self.assertEqual(int('1550104015504', 6), 4294967296L) - self.assertEqual(int('211301422354', 7), 4294967296L) - self.assertEqual(int('40000000000', 8), 4294967296L) - self.assertEqual(int('12068657454', 9), 4294967296L) - self.assertEqual(int('4294967296', 10), 4294967296L) - self.assertEqual(int('1904440554', 11), 4294967296L) - self.assertEqual(int('9ba461594', 12), 4294967296L) - self.assertEqual(int('535a79889', 13), 4294967296L) - self.assertEqual(int('2ca5b7464', 14), 4294967296L) - self.assertEqual(int('1a20dcd81', 15), 4294967296L) - self.assertEqual(int('100000000', 16), 4294967296L) - self.assertEqual(int('a7ffda91', 17), 4294967296L) - self.assertEqual(int('704he7g4', 18), 4294967296L) - self.assertEqual(int('4f5aff66', 19), 4294967296L) - self.assertEqual(int('3723ai4g', 20), 4294967296L) - self.assertEqual(int('281d55i4', 21), 4294967296L) - self.assertEqual(int('1fj8b184', 22), 4294967296L) - self.assertEqual(int('1606k7ic', 23), 4294967296L) - self.assertEqual(int('mb994ag', 24), 4294967296L) - self.assertEqual(int('hek2mgl', 25), 4294967296L) - self.assertEqual(int('dnchbnm', 26), 4294967296L) - self.assertEqual(int('b28jpdm', 27), 4294967296L) - self.assertEqual(int('8pfgih4', 28), 4294967296L) - self.assertEqual(int('76beigg', 29), 4294967296L) - self.assertEqual(int('5qmcpqg', 30), 4294967296L) - self.assertEqual(int('4q0jto4', 31), 4294967296L) - self.assertEqual(int('4000000', 32), 4294967296L) - self.assertEqual(int('3aokq94', 33), 4294967296L) - self.assertEqual(int('2qhxjli', 34), 4294967296L) - self.assertEqual(int('2br45qb', 35), 4294967296L) - self.assertEqual(int('1z141z4', 36), 4294967296L) - - # SF bug 1334662: int(string, base) wrong answers - # Checks for proper evaluation of 2**32 + 1 - self.assertEqual(int('100000000000000000000000000000001', 2), 4294967297L) - self.assertEqual(int('102002022201221111212', 3), 4294967297L) - self.assertEqual(int('10000000000000001', 4), 4294967297L) - self.assertEqual(int('32244002423142', 5), 4294967297L) - self.assertEqual(int('1550104015505', 6), 4294967297L) - self.assertEqual(int('211301422355', 7), 4294967297L) - self.assertEqual(int('40000000001', 8), 4294967297L) - self.assertEqual(int('12068657455', 9), 4294967297L) - self.assertEqual(int('4294967297', 10), 4294967297L) - self.assertEqual(int('1904440555', 11), 4294967297L) - self.assertEqual(int('9ba461595', 12), 4294967297L) - self.assertEqual(int('535a7988a', 13), 4294967297L) - self.assertEqual(int('2ca5b7465', 14), 4294967297L) - self.assertEqual(int('1a20dcd82', 15), 4294967297L) - self.assertEqual(int('100000001', 16), 4294967297L) - self.assertEqual(int('a7ffda92', 17), 4294967297L) - self.assertEqual(int('704he7g5', 18), 4294967297L) - self.assertEqual(int('4f5aff67', 19), 4294967297L) - self.assertEqual(int('3723ai4h', 20), 4294967297L) - self.assertEqual(int('281d55i5', 21), 4294967297L) - self.assertEqual(int('1fj8b185', 22), 4294967297L) - self.assertEqual(int('1606k7id', 23), 4294967297L) - self.assertEqual(int('mb994ah', 24), 4294967297L) - self.assertEqual(int('hek2mgm', 25), 4294967297L) - self.assertEqual(int('dnchbnn', 26), 4294967297L) - self.assertEqual(int('b28jpdn', 27), 4294967297L) - self.assertEqual(int('8pfgih5', 28), 4294967297L) - self.assertEqual(int('76beigh', 29), 4294967297L) - self.assertEqual(int('5qmcpqh', 30), 4294967297L) - self.assertEqual(int('4q0jto5', 31), 4294967297L) - self.assertEqual(int('4000001', 32), 4294967297L) - self.assertEqual(int('3aokq95', 33), 4294967297L) - self.assertEqual(int('2qhxjlj', 34), 4294967297L) - self.assertEqual(int('2br45qc', 35), 4294967297L) - self.assertEqual(int('1z141z5', 36), 4294967297L) - - def test_intconversion(self): - # Test __int__() - class Foo0: - def __int__(self): - return 42 - - class Foo1(object): - def __int__(self): - return 42 - - class Foo2(int): - def __int__(self): - return 42 - - class Foo3(int): - def __int__(self): - return self - - class Foo4(int): - def __int__(self): - return 42L - - class Foo5(int): - def __int__(self): - return 42. - - self.assertEqual(int(Foo0()), 42) - self.assertEqual(int(Foo1()), 42) - self.assertEqual(int(Foo2()), 42) - self.assertEqual(int(Foo3()), 0) - self.assertEqual(int(Foo4()), 42L) - self.assertRaises(TypeError, int, Foo5()) - - def test_intern(self): - self.assertRaises(TypeError, intern) - s = "never interned before" - self.assert_(intern(s) is s) - s2 = s.swapcase().swapcase() - self.assert_(intern(s2) is s) - - # Subclasses of string can't be interned, because they - # provide too much opportunity for insane things to happen. - # We don't want them in the interned dict and if they aren't - # actually interned, we don't want to create the appearance - # that they are by allowing intern() to succeeed. - class S(str): - def __hash__(self): - return 123 - - self.assertRaises(TypeError, intern, S("abc")) - - # It's still safe to pass these strings to routines that - # call intern internally, e.g. PyObject_SetAttr(). - s = S("abc") - setattr(s, s, s) - self.assertEqual(getattr(s, s), s) - - def test_iter(self): - self.assertRaises(TypeError, iter) - self.assertRaises(TypeError, iter, 42, 42) - lists = [("1", "2"), ["1", "2"], "12"] - if have_unicode: - lists.append(unicode("12")) - for l in lists: - i = iter(l) - self.assertEqual(i.next(), '1') - self.assertEqual(i.next(), '2') - self.assertRaises(StopIteration, i.next) - - def test_isinstance(self): - class C: - pass - class D(C): - pass - class E: - pass - c = C() - d = D() - e = E() - self.assert_(isinstance(c, C)) - self.assert_(isinstance(d, C)) - self.assert_(not isinstance(e, C)) - self.assert_(not isinstance(c, D)) - self.assert_(not isinstance('foo', E)) - self.assertRaises(TypeError, isinstance, E, 'foo') - self.assertRaises(TypeError, isinstance) - - def test_issubclass(self): - class C: - pass - class D(C): - pass - class E: - pass - c = C() - d = D() - e = E() - self.assert_(issubclass(D, C)) - self.assert_(issubclass(C, C)) - self.assert_(not issubclass(C, D)) - self.assertRaises(TypeError, issubclass, 'foo', E) - self.assertRaises(TypeError, issubclass, E, 'foo') - self.assertRaises(TypeError, issubclass) - - def test_len(self): - self.assertEqual(len('123'), 3) - self.assertEqual(len(()), 0) - self.assertEqual(len((1, 2, 3, 4)), 4) - self.assertEqual(len([1, 2, 3, 4]), 4) - self.assertEqual(len({}), 0) - self.assertEqual(len({'a':1, 'b': 2}), 2) - class BadSeq: - def __len__(self): - raise ValueError - self.assertRaises(ValueError, len, BadSeq()) - - def test_list(self): - self.assertEqual(list([]), []) - l0_3 = [0, 1, 2, 3] - l0_3_bis = list(l0_3) - self.assertEqual(l0_3, l0_3_bis) - self.assert_(l0_3 is not l0_3_bis) - self.assertEqual(list(()), []) - self.assertEqual(list((0, 1, 2, 3)), [0, 1, 2, 3]) - self.assertEqual(list(''), []) - self.assertEqual(list('spam'), ['s', 'p', 'a', 'm']) - - if sys.maxint == 0x7fffffff: - # This test can currently only work on 32-bit machines. - # XXX If/when PySequence_Length() returns a ssize_t, it should be - # XXX re-enabled. - # Verify clearing of bug #556025. - # This assumes that the max data size (sys.maxint) == max - # address size this also assumes that the address size is at - # least 4 bytes with 8 byte addresses, the bug is not well - # tested - # - # Note: This test is expected to SEGV under Cygwin 1.3.12 or - # earlier due to a newlib bug. See the following mailing list - # thread for the details: - - # http://sources.redhat.com/ml/newlib/2002/msg00369.html - self.assertRaises(MemoryError, list, xrange(sys.maxint // 2)) - - # This code used to segfault in Py2.4a3 - x = [] - x.extend(-y for y in x) - self.assertEqual(x, []) - - def test_long(self): - self.assertEqual(long(314), 314L) - self.assertEqual(long(3.14), 3L) - self.assertEqual(long(314L), 314L) - # Check that conversion from float truncates towards zero - self.assertEqual(long(-3.14), -3L) - self.assertEqual(long(3.9), 3L) - self.assertEqual(long(-3.9), -3L) - self.assertEqual(long(3.5), 3L) - self.assertEqual(long(-3.5), -3L) - self.assertEqual(long("-3"), -3L) - if have_unicode: - self.assertEqual(long(unicode("-3")), -3L) - # Different base: - self.assertEqual(long("10",16), 16L) - if have_unicode: - self.assertEqual(long(unicode("10"),16), 16L) - # Check conversions from string (same test set as for int(), and then some) - LL = [ - ('1' + '0'*20, 10L**20), - ('1' + '0'*100, 10L**100) - ] - L2 = L[:] - if have_unicode: - L2 += [ - (unicode('1') + unicode('0')*20, 10L**20), - (unicode('1') + unicode('0')*100, 10L**100), - ] - for s, v in L2 + LL: - for sign in "", "+", "-": - for prefix in "", " ", "\t", " \t\t ": - ss = prefix + sign + s - vv = v - if sign == "-" and v is not ValueError: - vv = -v - try: - self.assertEqual(long(ss), long(vv)) - except v: - pass - - self.assertRaises(ValueError, long, '123\0') - self.assertRaises(ValueError, long, '53', 40) - self.assertRaises(TypeError, long, 1, 12) - - # SF patch #1638879: embedded NULs were not detected with - # explicit base - self.assertRaises(ValueError, long, '123\0', 10) - self.assertRaises(ValueError, long, '123\x00 245', 20) - - self.assertEqual(long('100000000000000000000000000000000', 2), - 4294967296) - self.assertEqual(long('102002022201221111211', 3), 4294967296) - self.assertEqual(long('10000000000000000', 4), 4294967296) - self.assertEqual(long('32244002423141', 5), 4294967296) - self.assertEqual(long('1550104015504', 6), 4294967296) - self.assertEqual(long('211301422354', 7), 4294967296) - self.assertEqual(long('40000000000', 8), 4294967296) - self.assertEqual(long('12068657454', 9), 4294967296) - self.assertEqual(long('4294967296', 10), 4294967296) - self.assertEqual(long('1904440554', 11), 4294967296) - self.assertEqual(long('9ba461594', 12), 4294967296) - self.assertEqual(long('535a79889', 13), 4294967296) - self.assertEqual(long('2ca5b7464', 14), 4294967296) - self.assertEqual(long('1a20dcd81', 15), 4294967296) - self.assertEqual(long('100000000', 16), 4294967296) - self.assertEqual(long('a7ffda91', 17), 4294967296) - self.assertEqual(long('704he7g4', 18), 4294967296) - self.assertEqual(long('4f5aff66', 19), 4294967296) - self.assertEqual(long('3723ai4g', 20), 4294967296) - self.assertEqual(long('281d55i4', 21), 4294967296) - self.assertEqual(long('1fj8b184', 22), 4294967296) - self.assertEqual(long('1606k7ic', 23), 4294967296) - self.assertEqual(long('mb994ag', 24), 4294967296) - self.assertEqual(long('hek2mgl', 25), 4294967296) - self.assertEqual(long('dnchbnm', 26), 4294967296) - self.assertEqual(long('b28jpdm', 27), 4294967296) - self.assertEqual(long('8pfgih4', 28), 4294967296) - self.assertEqual(long('76beigg', 29), 4294967296) - self.assertEqual(long('5qmcpqg', 30), 4294967296) - self.assertEqual(long('4q0jto4', 31), 4294967296) - self.assertEqual(long('4000000', 32), 4294967296) - self.assertEqual(long('3aokq94', 33), 4294967296) - self.assertEqual(long('2qhxjli', 34), 4294967296) - self.assertEqual(long('2br45qb', 35), 4294967296) - self.assertEqual(long('1z141z4', 36), 4294967296) - - self.assertEqual(long('100000000000000000000000000000001', 2), - 4294967297) - self.assertEqual(long('102002022201221111212', 3), 4294967297) - self.assertEqual(long('10000000000000001', 4), 4294967297) - self.assertEqual(long('32244002423142', 5), 4294967297) - self.assertEqual(long('1550104015505', 6), 4294967297) - self.assertEqual(long('211301422355', 7), 4294967297) - self.assertEqual(long('40000000001', 8), 4294967297) - self.assertEqual(long('12068657455', 9), 4294967297) - self.assertEqual(long('4294967297', 10), 4294967297) - self.assertEqual(long('1904440555', 11), 4294967297) - self.assertEqual(long('9ba461595', 12), 4294967297) - self.assertEqual(long('535a7988a', 13), 4294967297) - self.assertEqual(long('2ca5b7465', 14), 4294967297) - self.assertEqual(long('1a20dcd82', 15), 4294967297) - self.assertEqual(long('100000001', 16), 4294967297) - self.assertEqual(long('a7ffda92', 17), 4294967297) - self.assertEqual(long('704he7g5', 18), 4294967297) - self.assertEqual(long('4f5aff67', 19), 4294967297) - self.assertEqual(long('3723ai4h', 20), 4294967297) - self.assertEqual(long('281d55i5', 21), 4294967297) - self.assertEqual(long('1fj8b185', 22), 4294967297) - self.assertEqual(long('1606k7id', 23), 4294967297) - self.assertEqual(long('mb994ah', 24), 4294967297) - self.assertEqual(long('hek2mgm', 25), 4294967297) - self.assertEqual(long('dnchbnn', 26), 4294967297) - self.assertEqual(long('b28jpdn', 27), 4294967297) - self.assertEqual(long('8pfgih5', 28), 4294967297) - self.assertEqual(long('76beigh', 29), 4294967297) - self.assertEqual(long('5qmcpqh', 30), 4294967297) - self.assertEqual(long('4q0jto5', 31), 4294967297) - self.assertEqual(long('4000001', 32), 4294967297) - self.assertEqual(long('3aokq95', 33), 4294967297) - self.assertEqual(long('2qhxjlj', 34), 4294967297) - self.assertEqual(long('2br45qc', 35), 4294967297) - self.assertEqual(long('1z141z5', 36), 4294967297) - - - def test_longconversion(self): - # Test __long__() - class Foo0: - def __long__(self): - return 42L - - class Foo1(object): - def __long__(self): - return 42L - - class Foo2(long): - def __long__(self): - return 42L - - class Foo3(long): - def __long__(self): - return self - - class Foo4(long): - def __long__(self): - return 42 - - class Foo5(long): - def __long__(self): - return 42. - - self.assertEqual(long(Foo0()), 42L) - self.assertEqual(long(Foo1()), 42L) - self.assertEqual(long(Foo2()), 42L) - self.assertEqual(long(Foo3()), 0) - self.assertEqual(long(Foo4()), 42) - self.assertRaises(TypeError, long, Foo5()) - - def test_map(self): - self.assertEqual( - map(None, 'hello world'), - ['h','e','l','l','o',' ','w','o','r','l','d'] - ) - self.assertEqual( - map(None, 'abcd', 'efg'), - [('a', 'e'), ('b', 'f'), ('c', 'g'), ('d', None)] - ) - self.assertEqual( - map(None, range(10)), - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - ) - self.assertEqual( - map(lambda x: x*x, range(1,4)), - [1, 4, 9] - ) - try: - from math import sqrt - except ImportError: - def sqrt(x): - return pow(x, 0.5) - self.assertEqual( - map(lambda x: map(sqrt,x), [[16, 4], [81, 9]]), - [[4.0, 2.0], [9.0, 3.0]] - ) - self.assertEqual( - map(lambda x, y: x+y, [1,3,2], [9,1,4]), - [10, 4, 6] - ) - - def plus(*v): - accu = 0 - for i in v: accu = accu + i - return accu - self.assertEqual( - map(plus, [1, 3, 7]), - [1, 3, 7] - ) - self.assertEqual( - map(plus, [1, 3, 7], [4, 9, 2]), - [1+4, 3+9, 7+2] - ) - self.assertEqual( - map(plus, [1, 3, 7], [4, 9, 2], [1, 1, 0]), - [1+4+1, 3+9+1, 7+2+0] - ) - self.assertEqual( - map(None, Squares(10)), - [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] - ) - self.assertEqual( - map(int, Squares(10)), - [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] - ) - self.assertEqual( - map(None, Squares(3), Squares(2)), - [(0,0), (1,1), (4,None)] - ) - self.assertEqual( - map(max, Squares(3), Squares(2)), - [0, 1, 4] - ) - self.assertRaises(TypeError, map) - self.assertRaises(TypeError, map, lambda x: x, 42) - self.assertEqual(map(None, [42]), [42]) - class BadSeq: - def __getitem__(self, index): - raise ValueError - self.assertRaises(ValueError, map, lambda x: x, BadSeq()) - def badfunc(x): - raise RuntimeError - self.assertRaises(RuntimeError, map, badfunc, range(5)) - - def test_max(self): - self.assertEqual(max('123123'), '3') - self.assertEqual(max(1, 2, 3), 3) - self.assertEqual(max((1, 2, 3, 1, 2, 3)), 3) - self.assertEqual(max([1, 2, 3, 1, 2, 3]), 3) - - self.assertEqual(max(1, 2L, 3.0), 3.0) - self.assertEqual(max(1L, 2.0, 3), 3) - self.assertEqual(max(1.0, 2, 3L), 3L) - - for stmt in ( - "max(key=int)", # no args - "max(1, key=int)", # single arg not iterable - "max(1, 2, keystone=int)", # wrong keyword - "max(1, 2, key=int, abc=int)", # two many keywords - "max(1, 2, key=1)", # keyfunc is not callable - ): - try: - exec(stmt) in globals() - except TypeError: - pass - else: - self.fail(stmt) - - self.assertEqual(max((1,), key=neg), 1) # one elem iterable - self.assertEqual(max((1,2), key=neg), 1) # two elem iterable - self.assertEqual(max(1, 2, key=neg), 1) # two elems - - data = [random.randrange(200) for i in range(100)] - keys = dict((elem, random.randrange(50)) for elem in data) - f = keys.__getitem__ - self.assertEqual(max(data, key=f), - sorted(reversed(data), key=f)[-1]) - - def test_min(self): - self.assertEqual(min('123123'), '1') - self.assertEqual(min(1, 2, 3), 1) - self.assertEqual(min((1, 2, 3, 1, 2, 3)), 1) - self.assertEqual(min([1, 2, 3, 1, 2, 3]), 1) - - self.assertEqual(min(1, 2L, 3.0), 1) - self.assertEqual(min(1L, 2.0, 3), 1L) - self.assertEqual(min(1.0, 2, 3L), 1.0) - - self.assertRaises(TypeError, min) - self.assertRaises(TypeError, min, 42) - self.assertRaises(ValueError, min, ()) - class BadSeq: - def __getitem__(self, index): - raise ValueError - self.assertRaises(ValueError, min, BadSeq()) - class BadNumber: - def __cmp__(self, other): - raise ValueError - self.assertRaises(ValueError, min, (42, BadNumber())) - - for stmt in ( - "min(key=int)", # no args - "min(1, key=int)", # single arg not iterable - "min(1, 2, keystone=int)", # wrong keyword - "min(1, 2, key=int, abc=int)", # two many keywords - "min(1, 2, key=1)", # keyfunc is not callable - ): - try: - exec(stmt) in globals() - except TypeError: - pass - else: - self.fail(stmt) - - self.assertEqual(min((1,), key=neg), 1) # one elem iterable - self.assertEqual(min((1,2), key=neg), 2) # two elem iterable - self.assertEqual(min(1, 2, key=neg), 2) # two elems - - data = [random.randrange(200) for i in range(100)] - keys = dict((elem, random.randrange(50)) for elem in data) - f = keys.__getitem__ - self.assertEqual(min(data, key=f), - sorted(data, key=f)[0]) - - def test_oct(self): - self.assertEqual(oct(100), '0144') - self.assertEqual(oct(100L), '0144L') - self.assertEqual(oct(-100), '-0144') - self.assertEqual(oct(-100L), '-0144L') - self.assertRaises(TypeError, oct, ()) - - def write_testfile(self): - # NB the first 4 lines are also used to test input and raw_input, below - fp = open(TESTFN, 'w') - try: - fp.write('1+1\n') - fp.write('1+1\n') - fp.write('The quick brown fox jumps over the lazy dog') - fp.write('.\n') - fp.write('Dear John\n') - fp.write('XXX'*100) - fp.write('YYY'*100) - finally: - fp.close() - - def test_open(self): - self.write_testfile() - fp = open(TESTFN, 'r') - try: - self.assertEqual(fp.readline(4), '1+1\n') - self.assertEqual(fp.readline(4), '1+1\n') - self.assertEqual(fp.readline(), 'The quick brown fox jumps over the lazy dog.\n') - self.assertEqual(fp.readline(4), 'Dear') - self.assertEqual(fp.readline(100), ' John\n') - self.assertEqual(fp.read(300), 'XXX'*100) - self.assertEqual(fp.read(1000), 'YYY'*100) - finally: - fp.close() - unlink(TESTFN) - - def test_ord(self): - self.assertEqual(ord(' '), 32) - self.assertEqual(ord('A'), 65) - self.assertEqual(ord('a'), 97) - if have_unicode: - self.assertEqual(ord(unichr(sys.maxunicode)), sys.maxunicode) - self.assertRaises(TypeError, ord, 42) - if have_unicode: - self.assertRaises(TypeError, ord, unicode("12")) - - def test_pow(self): - self.assertEqual(pow(0,0), 1) - self.assertEqual(pow(0,1), 0) - self.assertEqual(pow(1,0), 1) - self.assertEqual(pow(1,1), 1) - - self.assertEqual(pow(2,0), 1) - self.assertEqual(pow(2,10), 1024) - self.assertEqual(pow(2,20), 1024*1024) - self.assertEqual(pow(2,30), 1024*1024*1024) - - self.assertEqual(pow(-2,0), 1) - self.assertEqual(pow(-2,1), -2) - self.assertEqual(pow(-2,2), 4) - self.assertEqual(pow(-2,3), -8) - - self.assertEqual(pow(0L,0), 1) - self.assertEqual(pow(0L,1), 0) - self.assertEqual(pow(1L,0), 1) - self.assertEqual(pow(1L,1), 1) - - self.assertEqual(pow(2L,0), 1) - self.assertEqual(pow(2L,10), 1024) - self.assertEqual(pow(2L,20), 1024*1024) - self.assertEqual(pow(2L,30), 1024*1024*1024) - - self.assertEqual(pow(-2L,0), 1) - self.assertEqual(pow(-2L,1), -2) - self.assertEqual(pow(-2L,2), 4) - self.assertEqual(pow(-2L,3), -8) - - self.assertAlmostEqual(pow(0.,0), 1.) - self.assertAlmostEqual(pow(0.,1), 0.) - self.assertAlmostEqual(pow(1.,0), 1.) - self.assertAlmostEqual(pow(1.,1), 1.) - - self.assertAlmostEqual(pow(2.,0), 1.) - self.assertAlmostEqual(pow(2.,10), 1024.) - self.assertAlmostEqual(pow(2.,20), 1024.*1024.) - self.assertAlmostEqual(pow(2.,30), 1024.*1024.*1024.) - - self.assertAlmostEqual(pow(-2.,0), 1.) - self.assertAlmostEqual(pow(-2.,1), -2.) - self.assertAlmostEqual(pow(-2.,2), 4.) - self.assertAlmostEqual(pow(-2.,3), -8.) - - for x in 2, 2L, 2.0: - for y in 10, 10L, 10.0: - for z in 1000, 1000L, 1000.0: - if isinstance(x, float) or \ - isinstance(y, float) or \ - isinstance(z, float): - self.assertRaises(TypeError, pow, x, y, z) - else: - self.assertAlmostEqual(pow(x, y, z), 24.0) - - self.assertRaises(TypeError, pow, -1, -2, 3) - self.assertRaises(ValueError, pow, 1, 2, 0) - self.assertRaises(TypeError, pow, -1L, -2L, 3L) - self.assertRaises(ValueError, pow, 1L, 2L, 0L) - self.assertRaises(ValueError, pow, -342.43, 0.234) - - self.assertRaises(TypeError, pow) - - def test_range(self): - self.assertEqual(range(3), [0, 1, 2]) - self.assertEqual(range(1, 5), [1, 2, 3, 4]) - self.assertEqual(range(0), []) - self.assertEqual(range(-3), []) - self.assertEqual(range(1, 10, 3), [1, 4, 7]) - self.assertEqual(range(5, -5, -3), [5, 2, -1, -4]) - - # Now test range() with longs - self.assertEqual(range(-2**100), []) - self.assertEqual(range(0, -2**100), []) - self.assertEqual(range(0, 2**100, -1), []) - self.assertEqual(range(0, 2**100, -1), []) - - a = long(10 * sys.maxint) - b = long(100 * sys.maxint) - c = long(50 * sys.maxint) - - self.assertEqual(range(a, a+2), [a, a+1]) - self.assertEqual(range(a+2, a, -1L), [a+2, a+1]) - self.assertEqual(range(a+4, a, -2), [a+4, a+2]) - - seq = range(a, b, c) - self.assert_(a in seq) - self.assert_(b not in seq) - self.assertEqual(len(seq), 2) - - seq = range(b, a, -c) - self.assert_(b in seq) - self.assert_(a not in seq) - self.assertEqual(len(seq), 2) - - seq = range(-a, -b, -c) - self.assert_(-a in seq) - self.assert_(-b not in seq) - self.assertEqual(len(seq), 2) - - self.assertRaises(TypeError, range) - self.assertRaises(TypeError, range, 1, 2, 3, 4) - self.assertRaises(ValueError, range, 1, 2, 0) - self.assertRaises(ValueError, range, a, a + 1, long(0)) - - class badzero(int): - def __cmp__(self, other): - raise RuntimeError - self.assertRaises(RuntimeError, range, a, a + 1, badzero(1)) - - # Reject floats when it would require PyLongs to represent. - # (smaller floats still accepted, but deprecated) - self.assertRaises(TypeError, range, 1e100, 1e101, 1e101) - - self.assertRaises(TypeError, range, 0, "spam") - self.assertRaises(TypeError, range, 0, 42, "spam") - - self.assertRaises(OverflowError, range, -sys.maxint, sys.maxint) - self.assertRaises(OverflowError, range, 0, 2*sys.maxint) - - def test_input_and_raw_input(self): - self.write_testfile() - fp = open(TESTFN, 'r') - savestdin = sys.stdin - savestdout = sys.stdout # Eats the echo - try: - sys.stdin = fp - sys.stdout = BitBucket() - self.assertEqual(input(), 2) - self.assertEqual(input('testing\n'), 2) - self.assertEqual(raw_input(), 'The quick brown fox jumps over the lazy dog.') - self.assertEqual(raw_input('testing\n'), 'Dear John') - - # SF 1535165: don't segfault on closed stdin - # sys.stdout must be a regular file for triggering - sys.stdout = savestdout - sys.stdin.close() - self.assertRaises(ValueError, input) - - sys.stdout = BitBucket() - sys.stdin = cStringIO.StringIO("NULL\0") - self.assertRaises(TypeError, input, 42, 42) - sys.stdin = cStringIO.StringIO(" 'whitespace'") - self.assertEqual(input(), 'whitespace') - sys.stdin = cStringIO.StringIO() - self.assertRaises(EOFError, input) - - # SF 876178: make sure input() respect future options. - sys.stdin = cStringIO.StringIO('1/2') - sys.stdout = cStringIO.StringIO() - exec compile('print input()', 'test_builtin_tmp', 'exec') - sys.stdin.seek(0, 0) - exec compile('from __future__ import division;print input()', - 'test_builtin_tmp', 'exec') - sys.stdin.seek(0, 0) - exec compile('print input()', 'test_builtin_tmp', 'exec') - # The result we expect depends on whether new division semantics - # are already in effect. - if 1/2 == 0: - # This test was compiled with old semantics. - expected = ['0', '0.5', '0'] - else: - # This test was compiled with new semantics (e.g., -Qnew - # was given on the command line. - expected = ['0.5', '0.5', '0.5'] - self.assertEqual(sys.stdout.getvalue().splitlines(), expected) - - del sys.stdout - self.assertRaises(RuntimeError, input, 'prompt') - del sys.stdin - self.assertRaises(RuntimeError, input, 'prompt') - finally: - sys.stdin = savestdin - sys.stdout = savestdout - fp.close() - unlink(TESTFN) - - def test_reduce(self): - self.assertEqual(reduce(lambda x, y: x+y, ['a', 'b', 'c'], ''), 'abc') - self.assertEqual( - reduce(lambda x, y: x+y, [['a', 'c'], [], ['d', 'w']], []), - ['a','c','d','w'] - ) - self.assertEqual(reduce(lambda x, y: x*y, range(2,8), 1), 5040) - self.assertEqual( - reduce(lambda x, y: x*y, range(2,21), 1L), - 2432902008176640000L - ) - self.assertEqual(reduce(lambda x, y: x+y, Squares(10)), 285) - self.assertEqual(reduce(lambda x, y: x+y, Squares(10), 0), 285) - self.assertEqual(reduce(lambda x, y: x+y, Squares(0), 0), 0) - self.assertRaises(TypeError, reduce) - self.assertRaises(TypeError, reduce, 42, 42) - self.assertRaises(TypeError, reduce, 42, 42, 42) - self.assertEqual(reduce(42, "1"), "1") # func is never called with one item - self.assertEqual(reduce(42, "", "1"), "1") # func is never called with one item - self.assertRaises(TypeError, reduce, 42, (42, 42)) - - class BadSeq: - def __getitem__(self, index): - raise ValueError - self.assertRaises(ValueError, reduce, 42, BadSeq()) - - def test_reload(self): - import marshal - reload(marshal) - import string - reload(string) - ## import sys - ## self.assertRaises(ImportError, reload, sys) - - def test_repr(self): - self.assertEqual(repr(''), '\'\'') - self.assertEqual(repr(0), '0') - self.assertEqual(repr(0L), '0L') - self.assertEqual(repr(()), '()') - self.assertEqual(repr([]), '[]') - self.assertEqual(repr({}), '{}') - a = [] - a.append(a) - self.assertEqual(repr(a), '[[...]]') - a = {} - a[0] = a - self.assertEqual(repr(a), '{0: {...}}') - - def test_round(self): - self.assertEqual(round(0.0), 0.0) - self.assertEqual(round(1.0), 1.0) - self.assertEqual(round(10.0), 10.0) - self.assertEqual(round(1000000000.0), 1000000000.0) - self.assertEqual(round(1e20), 1e20) - - self.assertEqual(round(-1.0), -1.0) - self.assertEqual(round(-10.0), -10.0) - self.assertEqual(round(-1000000000.0), -1000000000.0) - self.assertEqual(round(-1e20), -1e20) - - self.assertEqual(round(0.1), 0.0) - self.assertEqual(round(1.1), 1.0) - self.assertEqual(round(10.1), 10.0) - self.assertEqual(round(1000000000.1), 1000000000.0) - - self.assertEqual(round(-1.1), -1.0) - self.assertEqual(round(-10.1), -10.0) - self.assertEqual(round(-1000000000.1), -1000000000.0) - - self.assertEqual(round(0.9), 1.0) - self.assertEqual(round(9.9), 10.0) - self.assertEqual(round(999999999.9), 1000000000.0) - - self.assertEqual(round(-0.9), -1.0) - self.assertEqual(round(-9.9), -10.0) - self.assertEqual(round(-999999999.9), -1000000000.0) - - self.assertEqual(round(-8.0, -1), -10.0) - - # test new kwargs - self.assertEqual(round(number=-8.0, ndigits=-1), -10.0) - - self.assertRaises(TypeError, round) - - def test_setattr(self): - setattr(sys, 'spam', 1) - self.assertEqual(sys.spam, 1) - self.assertRaises(TypeError, setattr, sys, 1, 'spam') - self.assertRaises(TypeError, setattr) - - def test_str(self): - self.assertEqual(str(''), '') - self.assertEqual(str(0), '0') - self.assertEqual(str(0L), '0') - self.assertEqual(str(()), '()') - self.assertEqual(str([]), '[]') - self.assertEqual(str({}), '{}') - a = [] - a.append(a) - self.assertEqual(str(a), '[[...]]') - a = {} - a[0] = a - self.assertEqual(str(a), '{0: {...}}') - - def test_sum(self): - self.assertEqual(sum([]), 0) - self.assertEqual(sum(range(2,8)), 27) - self.assertEqual(sum(iter(range(2,8))), 27) - self.assertEqual(sum(Squares(10)), 285) - self.assertEqual(sum(iter(Squares(10))), 285) - self.assertEqual(sum([[1], [2], [3]], []), [1, 2, 3]) - - self.assertRaises(TypeError, sum) - self.assertRaises(TypeError, sum, 42) - self.assertRaises(TypeError, sum, ['a', 'b', 'c']) - self.assertRaises(TypeError, sum, ['a', 'b', 'c'], '') - self.assertRaises(TypeError, sum, [[1], [2], [3]]) - self.assertRaises(TypeError, sum, [{2:3}]) - self.assertRaises(TypeError, sum, [{2:3}]*2, {2:3}) - - class BadSeq: - def __getitem__(self, index): - raise ValueError - self.assertRaises(ValueError, sum, BadSeq()) - - def test_tuple(self): - self.assertEqual(tuple(()), ()) - t0_3 = (0, 1, 2, 3) - t0_3_bis = tuple(t0_3) - self.assert_(t0_3 is t0_3_bis) - self.assertEqual(tuple([]), ()) - self.assertEqual(tuple([0, 1, 2, 3]), (0, 1, 2, 3)) - self.assertEqual(tuple(''), ()) - self.assertEqual(tuple('spam'), ('s', 'p', 'a', 'm')) - - def test_type(self): - self.assertEqual(type(''), type('123')) - self.assertNotEqual(type(''), type(())) - - def test_unichr(self): - if have_unicode: - self.assertEqual(unichr(32), unicode(' ')) - self.assertEqual(unichr(65), unicode('A')) - self.assertEqual(unichr(97), unicode('a')) - self.assertEqual( - unichr(sys.maxunicode), - unicode('\\U%08x' % (sys.maxunicode), 'unicode-escape') - ) - self.assertRaises(ValueError, unichr, sys.maxunicode+1) - self.assertRaises(TypeError, unichr) - - # We don't want self in vars(), so these are static methods - - @staticmethod - def get_vars_f0(): - return vars() - - @staticmethod - def get_vars_f2(): - BuiltinTest.get_vars_f0() - a = 1 - b = 2 - return vars() - - def test_vars(self): - self.assertEqual(set(vars()), set(dir())) - import sys - self.assertEqual(set(vars(sys)), set(dir(sys))) - self.assertEqual(self.get_vars_f0(), {}) - self.assertEqual(self.get_vars_f2(), {'a': 1, 'b': 2}) - self.assertRaises(TypeError, vars, 42, 42) - self.assertRaises(TypeError, vars, 42) - - def test_zip(self): - a = (1, 2, 3) - b = (4, 5, 6) - t = [(1, 4), (2, 5), (3, 6)] - self.assertEqual(zip(a, b), t) - b = [4, 5, 6] - self.assertEqual(zip(a, b), t) - b = (4, 5, 6, 7) - self.assertEqual(zip(a, b), t) - class I: - def __getitem__(self, i): - if i < 0 or i > 2: raise IndexError - return i + 4 - self.assertEqual(zip(a, I()), t) - self.assertEqual(zip(), []) - self.assertEqual(zip(*[]), []) - self.assertRaises(TypeError, zip, None) - class G: - pass - self.assertRaises(TypeError, zip, a, G()) - - # Make sure zip doesn't try to allocate a billion elements for the - # result list when one of its arguments doesn't say how long it is. - # A MemoryError is the most likely failure mode. - class SequenceWithoutALength: - def __getitem__(self, i): - if i == 5: - raise IndexError - else: - return i - self.assertEqual( - zip(SequenceWithoutALength(), xrange(2**30)), - list(enumerate(range(5))) - ) - - class BadSeq: - def __getitem__(self, i): - if i == 5: - raise ValueError - else: - return i - self.assertRaises(ValueError, zip, BadSeq(), BadSeq()) - -class TestSorted(unittest.TestCase): - - def test_basic(self): - data = range(100) - copy = data[:] - random.shuffle(copy) - self.assertEqual(data, sorted(copy)) - self.assertNotEqual(data, copy) - - data.reverse() - random.shuffle(copy) - self.assertEqual(data, sorted(copy, cmp=lambda x, y: cmp(y,x))) - self.assertNotEqual(data, copy) - random.shuffle(copy) - self.assertEqual(data, sorted(copy, key=lambda x: -x)) - self.assertNotEqual(data, copy) - random.shuffle(copy) - self.assertEqual(data, sorted(copy, reverse=1)) - self.assertNotEqual(data, copy) - - def test_inputtypes(self): - s = 'abracadabra' - types = [list, tuple] - if have_unicode: - types.insert(0, unicode) - for T in types: - self.assertEqual(sorted(s), sorted(T(s))) - - s = ''.join(dict.fromkeys(s).keys()) # unique letters only - types = [set, frozenset, list, tuple, dict.fromkeys] - if have_unicode: - types.insert(0, unicode) - for T in types: - self.assertEqual(sorted(s), sorted(T(s))) - - def test_baddecorator(self): - data = 'The quick Brown fox Jumped over The lazy Dog'.split() - self.assertRaises(TypeError, sorted, data, None, lambda x,y: 0) - -def test_main(verbose=None): - test_classes = (BuiltinTest, TestSorted) - - run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_bz2.py b/sys/lib/python/test/test_bz2.py deleted file mode 100644 index 709850d22..000000000 --- a/sys/lib/python/test/test_bz2.py +++ /dev/null @@ -1,371 +0,0 @@ -#!/usr/bin/python -from test import test_support -from test.test_support import TESTFN - -import unittest -from cStringIO import StringIO -import os -import popen2 -import sys - -import bz2 -from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor - -has_cmdline_bunzip2 = sys.platform not in ("win32", "os2emx", "riscos") - -class BaseTest(unittest.TestCase): - "Base for other testcases." - TEXT = 'root:x:0:0:root:/root:/bin/bash\nbin:x:1:1:bin:/bin:\ndaemon:x:2:2:daemon:/sbin:\nadm:x:3:4:adm:/var/adm:\nlp:x:4:7:lp:/var/spool/lpd:\nsync:x:5:0:sync:/sbin:/bin/sync\nshutdown:x:6:0:shutdown:/sbin:/sbin/shutdown\nhalt:x:7:0:halt:/sbin:/sbin/halt\nmail:x:8:12:mail:/var/spool/mail:\nnews:x:9:13:news:/var/spool/news:\nuucp:x:10:14:uucp:/var/spool/uucp:\noperator:x:11:0:operator:/root:\ngames:x:12:100:games:/usr/games:\ngopher:x:13:30:gopher:/usr/lib/gopher-data:\nftp:x:14:50:FTP User:/var/ftp:/bin/bash\nnobody:x:65534:65534:Nobody:/home:\npostfix:x:100:101:postfix:/var/spool/postfix:\nniemeyer:x:500:500::/home/niemeyer:/bin/bash\npostgres:x:101:102:PostgreSQL Server:/var/lib/pgsql:/bin/bash\nmysql:x:102:103:MySQL server:/var/lib/mysql:/bin/bash\nwww:x:103:104::/var/www:/bin/false\n' - DATA = 'BZh91AY&SY.\xc8N\x18\x00\x01>_\x80\x00\x10@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe00\x01\x99\xaa\x00\xc0\x03F\x86\x8c#&\x83F\x9a\x03\x06\xa6\xd0\xa6\x93M\x0fQ\xa7\xa8\x06\x804hh\x12$\x11\xa4i4\xf14S\xd2\x88\xe5\xcd9gd6\x0b\n\xe9\x9b\xd5\x8a\x99\xf7\x08.K\x8ev\xfb\xf7xw\xbb\xdf\xa1\x92\xf1\xdd|/";\xa2\xba\x9f\xd5\xb1#A\xb6\xf6\xb3o\xc9\xc5y\\\xebO\xe7\x85\x9a\xbc\xb6f8\x952\xd5\xd7"%\x89>V,\xf7\xa6z\xe2\x9f\xa3\xdf\x11\x11"\xd6E)I\xa9\x13^\xca\xf3r\xd0\x03U\x922\xf26\xec\xb6\xed\x8b\xc3U\x13\x9d\xc5\x170\xa4\xfa^\x92\xacDF\x8a\x97\xd6\x19\xfe\xdd\xb8\xbd\x1a\x9a\x19\xa3\x80ankR\x8b\xe5\xd83]\xa9\xc6\x08\x82f\xf6\xb9"6l$\xb8j@\xc0\x8a\xb0l1..\xbak\x83ls\x15\xbc\xf4\xc1\x13\xbe\xf8E\xb8\x9d\r\xa8\x9dk\x84\xd3n\xfa\xacQ\x07\xb1%y\xaav\xb4\x08\xe0z\x1b\x16\xf5\x04\xe9\xcc\xb9\x08z\x1en7.G\xfc]\xc9\x14\xe1B@\xbb!8`' - DATA_CRLF = 'BZh91AY&SY\xaez\xbbN\x00\x01H\xdf\x80\x00\x12@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe0@\x01\xbc\xc6`\x86*\x8d=M\xa9\x9a\x86\xd0L@\x0fI\xa6!\xa1\x13\xc8\x88jdi\x8d@\x03@\x1a\x1a\x0c\x0c\x83 \x00\xc4h2\x19\x01\x82D\x84e\t\xe8\x99\x89\x19\x1ah\x00\r\x1a\x11\xaf\x9b\x0fG\xf5(\x1b\x1f?\t\x12\xcf\xb5\xfc\x95E\x00ps\x89\x12^\xa4\xdd\xa2&\x05(\x87\x04\x98\x89u\xe40%\xb6\x19\'\x8c\xc4\x89\xca\x07\x0e\x1b!\x91UIFU%C\x994!DI\xd2\xfa\xf0\xf1N8W\xde\x13A\xf5\x9cr%?\x9f3;I45A\xd1\x8bT\xb1\xa4\xc7\x8d\x1a\\"\xad\xa1\xabyBg\x15\xb9l\x88\x88\x91k"\x94\xa4\xd4\x89\xae*\xa6\x0b\x10\x0c\xd6\xd4m\xe86\xec\xb5j\x8a\x86j\';\xca.\x01I\xf2\xaaJ\xe8\x88\x8cU+t3\xfb\x0c\n\xa33\x13r2\r\x16\xe0\xb3(\xbf\x1d\x83r\xe7M\xf0D\x1365\xd8\x88\xd3\xa4\x92\xcb2\x06\x04\\\xc1\xb0\xea//\xbek&\xd8\xe6+t\xe5\xa1\x13\xada\x16\xder5"w]\xa2i\xb7[\x97R \xe2IT\xcd;Z\x04dk4\xad\x8a\t\xd3\x81z\x10\xf1:^`\xab\x1f\xc5\xdc\x91N\x14$+\x9e\xae\xd3\x80' - - if has_cmdline_bunzip2: - def decompress(self, data): - pop = popen2.Popen3("bunzip2", capturestderr=1) - pop.tochild.write(data) - pop.tochild.close() - ret = pop.fromchild.read() - pop.fromchild.close() - if pop.wait() != 0: - ret = bz2.decompress(data) - return ret - - else: - # popen2.Popen3 doesn't exist on Windows, and even if it did, bunzip2 - # isn't available to run. - def decompress(self, data): - return bz2.decompress(data) - -class BZ2FileTest(BaseTest): - "Test BZ2File type miscellaneous methods." - - def setUp(self): - self.filename = TESTFN - - def tearDown(self): - if os.path.isfile(self.filename): - os.unlink(self.filename) - - def createTempFile(self, crlf=0): - f = open(self.filename, "wb") - if crlf: - data = self.DATA_CRLF - else: - data = self.DATA - f.write(data) - f.close() - - def testRead(self): - # "Test BZ2File.read()" - self.createTempFile() - bz2f = BZ2File(self.filename) - self.assertRaises(TypeError, bz2f.read, None) - self.assertEqual(bz2f.read(), self.TEXT) - bz2f.close() - - def testReadChunk10(self): - # "Test BZ2File.read() in chunks of 10 bytes" - self.createTempFile() - bz2f = BZ2File(self.filename) - text = '' - while 1: - str = bz2f.read(10) - if not str: - break - text += str - self.assertEqual(text, text) - bz2f.close() - - def testRead100(self): - # "Test BZ2File.read(100)" - self.createTempFile() - bz2f = BZ2File(self.filename) - self.assertEqual(bz2f.read(100), self.TEXT[:100]) - bz2f.close() - - def testReadLine(self): - # "Test BZ2File.readline()" - self.createTempFile() - bz2f = BZ2File(self.filename) - self.assertRaises(TypeError, bz2f.readline, None) - sio = StringIO(self.TEXT) - for line in sio.readlines(): - self.assertEqual(bz2f.readline(), line) - bz2f.close() - - def testReadLines(self): - # "Test BZ2File.readlines()" - self.createTempFile() - bz2f = BZ2File(self.filename) - self.assertRaises(TypeError, bz2f.readlines, None) - sio = StringIO(self.TEXT) - self.assertEqual(bz2f.readlines(), sio.readlines()) - bz2f.close() - - def testIterator(self): - # "Test iter(BZ2File)" - self.createTempFile() - bz2f = BZ2File(self.filename) - sio = StringIO(self.TEXT) - self.assertEqual(list(iter(bz2f)), sio.readlines()) - bz2f.close() - - def testXReadLines(self): - # "Test BZ2File.xreadlines()" - self.createTempFile() - bz2f = BZ2File(self.filename) - sio = StringIO(self.TEXT) - self.assertEqual(list(bz2f.xreadlines()), sio.readlines()) - bz2f.close() - - def testUniversalNewlinesLF(self): - # "Test BZ2File.read() with universal newlines (\\n)" - self.createTempFile() - bz2f = BZ2File(self.filename, "rU") - self.assertEqual(bz2f.read(), self.TEXT) - self.assertEqual(bz2f.newlines, "\n") - bz2f.close() - - def testUniversalNewlinesCRLF(self): - # "Test BZ2File.read() with universal newlines (\\r\\n)" - self.createTempFile(crlf=1) - bz2f = BZ2File(self.filename, "rU") - self.assertEqual(bz2f.read(), self.TEXT) - self.assertEqual(bz2f.newlines, "\r\n") - bz2f.close() - - def testWrite(self): - # "Test BZ2File.write()" - bz2f = BZ2File(self.filename, "w") - self.assertRaises(TypeError, bz2f.write) - bz2f.write(self.TEXT) - bz2f.close() - f = open(self.filename, 'rb') - self.assertEqual(self.decompress(f.read()), self.TEXT) - f.close() - - def testWriteChunks10(self): - # "Test BZ2File.write() with chunks of 10 bytes" - bz2f = BZ2File(self.filename, "w") - n = 0 - while 1: - str = self.TEXT[n*10:(n+1)*10] - if not str: - break - bz2f.write(str) - n += 1 - bz2f.close() - f = open(self.filename, 'rb') - self.assertEqual(self.decompress(f.read()), self.TEXT) - f.close() - - def testWriteLines(self): - # "Test BZ2File.writelines()" - bz2f = BZ2File(self.filename, "w") - self.assertRaises(TypeError, bz2f.writelines) - sio = StringIO(self.TEXT) - bz2f.writelines(sio.readlines()) - bz2f.close() - # patch #1535500 - self.assertRaises(ValueError, bz2f.writelines, ["a"]) - f = open(self.filename, 'rb') - self.assertEqual(self.decompress(f.read()), self.TEXT) - f.close() - - def testWriteMethodsOnReadOnlyFile(self): - bz2f = BZ2File(self.filename, "w") - bz2f.write("abc") - bz2f.close() - - bz2f = BZ2File(self.filename, "r") - self.assertRaises(IOError, bz2f.write, "a") - self.assertRaises(IOError, bz2f.writelines, ["a"]) - - def testSeekForward(self): - # "Test BZ2File.seek(150, 0)" - self.createTempFile() - bz2f = BZ2File(self.filename) - self.assertRaises(TypeError, bz2f.seek) - bz2f.seek(150) - self.assertEqual(bz2f.read(), self.TEXT[150:]) - bz2f.close() - - def testSeekBackwards(self): - # "Test BZ2File.seek(-150, 1)" - self.createTempFile() - bz2f = BZ2File(self.filename) - bz2f.read(500) - bz2f.seek(-150, 1) - self.assertEqual(bz2f.read(), self.TEXT[500-150:]) - bz2f.close() - - def testSeekBackwardsFromEnd(self): - # "Test BZ2File.seek(-150, 2)" - self.createTempFile() - bz2f = BZ2File(self.filename) - bz2f.seek(-150, 2) - self.assertEqual(bz2f.read(), self.TEXT[len(self.TEXT)-150:]) - bz2f.close() - - def testSeekPostEnd(self): - # "Test BZ2File.seek(150000)" - self.createTempFile() - bz2f = BZ2File(self.filename) - bz2f.seek(150000) - self.assertEqual(bz2f.tell(), len(self.TEXT)) - self.assertEqual(bz2f.read(), "") - bz2f.close() - - def testSeekPostEndTwice(self): - # "Test BZ2File.seek(150000) twice" - self.createTempFile() - bz2f = BZ2File(self.filename) - bz2f.seek(150000) - bz2f.seek(150000) - self.assertEqual(bz2f.tell(), len(self.TEXT)) - self.assertEqual(bz2f.read(), "") - bz2f.close() - - def testSeekPreStart(self): - # "Test BZ2File.seek(-150, 0)" - self.createTempFile() - bz2f = BZ2File(self.filename) - bz2f.seek(-150) - self.assertEqual(bz2f.tell(), 0) - self.assertEqual(bz2f.read(), self.TEXT) - bz2f.close() - - def testOpenDel(self): - # "Test opening and deleting a file many times" - self.createTempFile() - for i in xrange(10000): - o = BZ2File(self.filename) - del o - - def testOpenNonexistent(self): - # "Test opening a nonexistent file" - self.assertRaises(IOError, BZ2File, "/non/existent") - - def testModeU(self): - # Bug #1194181: bz2.BZ2File opened for write with mode "U" - self.createTempFile() - bz2f = BZ2File(self.filename, "U") - bz2f.close() - f = file(self.filename) - f.seek(0, 2) - self.assertEqual(f.tell(), len(self.DATA)) - f.close() - - def testBug1191043(self): - # readlines() for files containing no newline - data = 'BZh91AY&SY\xd9b\x89]\x00\x00\x00\x03\x80\x04\x00\x02\x00\x0c\x00 \x00!\x9ah3M\x13<]\xc9\x14\xe1BCe\x8a%t' - f = open(self.filename, "wb") - f.write(data) - f.close() - bz2f = BZ2File(self.filename) - lines = bz2f.readlines() - bz2f.close() - self.assertEqual(lines, ['Test']) - bz2f = BZ2File(self.filename) - xlines = list(bz2f.xreadlines()) - bz2f.close() - self.assertEqual(xlines, ['Test']) - - -class BZ2CompressorTest(BaseTest): - def testCompress(self): - # "Test BZ2Compressor.compress()/flush()" - bz2c = BZ2Compressor() - self.assertRaises(TypeError, bz2c.compress) - data = bz2c.compress(self.TEXT) - data += bz2c.flush() - self.assertEqual(self.decompress(data), self.TEXT) - - def testCompressChunks10(self): - # "Test BZ2Compressor.compress()/flush() with chunks of 10 bytes" - bz2c = BZ2Compressor() - n = 0 - data = '' - while 1: - str = self.TEXT[n*10:(n+1)*10] - if not str: - break - data += bz2c.compress(str) - n += 1 - data += bz2c.flush() - self.assertEqual(self.decompress(data), self.TEXT) - -class BZ2DecompressorTest(BaseTest): - def test_Constructor(self): - self.assertRaises(TypeError, BZ2Decompressor, 42) - - def testDecompress(self): - # "Test BZ2Decompressor.decompress()" - bz2d = BZ2Decompressor() - self.assertRaises(TypeError, bz2d.decompress) - text = bz2d.decompress(self.DATA) - self.assertEqual(text, self.TEXT) - - def testDecompressChunks10(self): - # "Test BZ2Decompressor.decompress() with chunks of 10 bytes" - bz2d = BZ2Decompressor() - text = '' - n = 0 - while 1: - str = self.DATA[n*10:(n+1)*10] - if not str: - break - text += bz2d.decompress(str) - n += 1 - self.assertEqual(text, self.TEXT) - - def testDecompressUnusedData(self): - # "Test BZ2Decompressor.decompress() with unused data" - bz2d = BZ2Decompressor() - unused_data = "this is unused data" - text = bz2d.decompress(self.DATA+unused_data) - self.assertEqual(text, self.TEXT) - self.assertEqual(bz2d.unused_data, unused_data) - - def testEOFError(self): - # "Calling BZ2Decompressor.decompress() after EOS must raise EOFError" - bz2d = BZ2Decompressor() - text = bz2d.decompress(self.DATA) - self.assertRaises(EOFError, bz2d.decompress, "anything") - - -class FuncTest(BaseTest): - "Test module functions" - - def testCompress(self): - # "Test compress() function" - data = bz2.compress(self.TEXT) - self.assertEqual(self.decompress(data), self.TEXT) - - def testDecompress(self): - # "Test decompress() function" - text = bz2.decompress(self.DATA) - self.assertEqual(text, self.TEXT) - - def testDecompressEmpty(self): - # "Test decompress() function with empty string" - text = bz2.decompress("") - self.assertEqual(text, "") - - def testDecompressIncomplete(self): - # "Test decompress() function with incomplete data" - self.assertRaises(ValueError, bz2.decompress, self.DATA[:-10]) - -def test_main(): - test_support.run_unittest( - BZ2FileTest, - BZ2CompressorTest, - BZ2DecompressorTest, - FuncTest - ) - test_support.reap_children() - -if __name__ == '__main__': - test_main() - -# vim:ts=4:sw=4 diff --git a/sys/lib/python/test/test_cProfile.py b/sys/lib/python/test/test_cProfile.py deleted file mode 100644 index 07b2a9b54..000000000 --- a/sys/lib/python/test/test_cProfile.py +++ /dev/null @@ -1,123 +0,0 @@ -"""Test suite for the cProfile module.""" - -import cProfile, pstats, sys - -# In order to have reproducible time, we simulate a timer in the global -# variable 'ticks', which represents simulated time in milliseconds. -# (We can't use a helper function increment the timer since it would be -# included in the profile and would appear to consume all the time.) -ticks = 0 - -# IMPORTANT: this is an output test. *ALL* NUMBERS in the expected -# output are relevant. If you change the formatting of pstats, -# please don't just regenerate output/test_cProfile without checking -# very carefully that not a single number has changed. - -def test_main(): - global ticks - ticks = 42000 - prof = cProfile.Profile(timer, 0.001) - prof.runctx("testfunc()", globals(), locals()) - assert ticks == 43000, ticks - st = pstats.Stats(prof) - st.strip_dirs().sort_stats('stdname').print_stats() - st.print_callees() - st.print_callers() - -def timer(): - return ticks - -def testfunc(): - # 1 call - # 1000 ticks total: 270 ticks local, 730 ticks in subfunctions - global ticks - ticks += 99 - helper() # 300 - helper() # 300 - ticks += 171 - factorial(14) # 130 - -def factorial(n): - # 23 calls total - # 170 ticks total, 150 ticks local - # 3 primitive calls, 130, 20 and 20 ticks total - # including 116, 17, 17 ticks local - global ticks - if n > 0: - ticks += n - return mul(n, factorial(n-1)) - else: - ticks += 11 - return 1 - -def mul(a, b): - # 20 calls - # 1 tick, local - global ticks - ticks += 1 - return a * b - -def helper(): - # 2 calls - # 300 ticks total: 20 ticks local, 260 ticks in subfunctions - global ticks - ticks += 1 - helper1() # 30 - ticks += 2 - helper1() # 30 - ticks += 6 - helper2() # 50 - ticks += 3 - helper2() # 50 - ticks += 2 - helper2() # 50 - ticks += 5 - helper2_indirect() # 70 - ticks += 1 - -def helper1(): - # 4 calls - # 30 ticks total: 29 ticks local, 1 tick in subfunctions - global ticks - ticks += 10 - hasattr(C(), "foo") # 1 - ticks += 19 - lst = [] - lst.append(42) # 0 - sys.exc_info() # 0 - -def helper2_indirect(): - helper2() # 50 - factorial(3) # 20 - -def helper2(): - # 8 calls - # 50 ticks local: 39 ticks local, 11 ticks in subfunctions - global ticks - ticks += 11 - hasattr(C(), "bar") # 1 - ticks += 13 - subhelper() # 10 - ticks += 15 - -def subhelper(): - # 8 calls - # 10 ticks total: 8 ticks local, 2 ticks in subfunctions - global ticks - ticks += 2 - for i in range(2): # 0 - try: - C().foo # 1 x 2 - except AttributeError: - ticks += 3 # 3 x 2 - -class C: - def __getattr__(self, name): - # 28 calls - # 1 tick, local - global ticks - ticks += 1 - raise AttributeError - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_calendar.py b/sys/lib/python/test/test_calendar.py deleted file mode 100644 index e414324d6..000000000 --- a/sys/lib/python/test/test_calendar.py +++ /dev/null @@ -1,393 +0,0 @@ -import calendar -import unittest - -from test import test_support - - -result_2004_text = """ - 2004 - - January February March -Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su - 1 2 3 4 1 1 2 3 4 5 6 7 - 5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14 -12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21 -19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28 -26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31 - - April May June -Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su - 1 2 3 4 1 2 1 2 3 4 5 6 - 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13 -12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20 -19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27 -26 27 28 29 30 24 25 26 27 28 29 30 28 29 30 - 31 - - July August September -Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su - 1 2 3 4 1 1 2 3 4 5 - 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12 -12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19 -19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26 -26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30 - 30 31 - - October November December -Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su - 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 - 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12 -11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19 -18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26 -25 26 27 28 29 30 31 29 30 27 28 29 30 31 -""" - -result_2004_html = """ - - - - - - -Calendar for 2004 - - -
2004
- - - - - - - -
January
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 
-
- - - - - - - -
February
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
-
- - - - - - - -
March
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
293031    
-
- - - - - - - -
April
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
2627282930  
-
- - - - - - - - -
May
MonTueWedThuFriSatSun
     12
3456789
10111213141516
17181920212223
24252627282930
31      
-
- - - - - - - -
June
MonTueWedThuFriSatSun
 123456
78910111213
14151617181920
21222324252627
282930    
-
- - - - - - - -
July
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 
-
- - - - - - - - -
August
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
-
- - - - - - - -
September
MonTueWedThuFriSatSun
  12345
6789101112
13141516171819
20212223242526
27282930   
-
- - - - - - - -
October
MonTueWedThuFriSatSun
    123
45678910
11121314151617
18192021222324
25262728293031
-
- - - - - - - -
November
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
2930     
-
- - - - - - - -
December
MonTueWedThuFriSatSun
  12345
6789101112
13141516171819
20212223242526
2728293031  
-
- -""" - - -class OutputTestCase(unittest.TestCase): - def normalize_calendar(self, s): - # Filters out locale dependant strings - def neitherspacenordigit(c): - return not c.isspace() and not c.isdigit() - - lines = [] - for line in s.splitlines(False): - # Drop texts, as they are locale dependent - if line and not filter(neitherspacenordigit, line): - lines.append(line) - return lines - - def test_output(self): - self.assertEqual( - self.normalize_calendar(calendar.calendar(2004)), - self.normalize_calendar(result_2004_text) - ) - - def test_output_textcalendar(self): - self.assertEqual( - calendar.TextCalendar().formatyear(2004).strip(), - result_2004_text.strip() - ) - - def test_output_htmlcalendar(self): - self.assertEqual( - calendar.HTMLCalendar().formatyearpage(2004).strip(), - result_2004_html.strip() - ) - - -class CalendarTestCase(unittest.TestCase): - def test_isleap(self): - # Make sure that the return is right for a few years, and - # ensure that the return values are 1 or 0, not just true or - # false (see SF bug #485794). Specific additional tests may - # be appropriate; this tests a single "cycle". - self.assertEqual(calendar.isleap(2000), 1) - self.assertEqual(calendar.isleap(2001), 0) - self.assertEqual(calendar.isleap(2002), 0) - self.assertEqual(calendar.isleap(2003), 0) - - def test_setfirstweekday(self): - self.assertRaises(ValueError, calendar.setfirstweekday, 'flabber') - self.assertRaises(ValueError, calendar.setfirstweekday, -1) - self.assertRaises(ValueError, calendar.setfirstweekday, 200) - orig = calendar.firstweekday() - calendar.setfirstweekday(calendar.SUNDAY) - self.assertEqual(calendar.firstweekday(), calendar.SUNDAY) - calendar.setfirstweekday(calendar.MONDAY) - self.assertEqual(calendar.firstweekday(), calendar.MONDAY) - calendar.setfirstweekday(orig) - - def test_enumerateweekdays(self): - self.assertRaises(IndexError, calendar.day_abbr.__getitem__, -10) - self.assertRaises(IndexError, calendar.day_name.__getitem__, 10) - self.assertEqual(len([d for d in calendar.day_abbr]), 7) - - def test_days(self): - for attr in "day_name", "day_abbr": - value = getattr(calendar, attr) - self.assertEqual(len(value), 7) - self.assertEqual(len(value[:]), 7) - # ensure they're all unique - self.assertEqual(len(set(value)), 7) - # verify it "acts like a sequence" in two forms of iteration - self.assertEqual(value[::-1], list(reversed(value))) - - def test_months(self): - for attr in "month_name", "month_abbr": - value = getattr(calendar, attr) - self.assertEqual(len(value), 13) - self.assertEqual(len(value[:]), 13) - self.assertEqual(value[0], "") - # ensure they're all unique - self.assertEqual(len(set(value)), 13) - # verify it "acts like a sequence" in two forms of iteration - self.assertEqual(value[::-1], list(reversed(value))) - - -class MonthCalendarTestCase(unittest.TestCase): - def setUp(self): - self.oldfirstweekday = calendar.firstweekday() - calendar.setfirstweekday(self.firstweekday) - - def tearDown(self): - calendar.setfirstweekday(self.oldfirstweekday) - - def check_weeks(self, year, month, weeks): - cal = calendar.monthcalendar(year, month) - self.assertEqual(len(cal), len(weeks)) - for i in xrange(len(weeks)): - self.assertEqual(weeks[i], sum(day != 0 for day in cal[i])) - - -class MondayTestCase(MonthCalendarTestCase): - firstweekday = calendar.MONDAY - - def test_february(self): - # A 28-day february starting on monday (7+7+7+7 days) - self.check_weeks(1999, 2, (7, 7, 7, 7)) - - # A 28-day february starting on tuesday (6+7+7+7+1 days) - self.check_weeks(2005, 2, (6, 7, 7, 7, 1)) - - # A 28-day february starting on sunday (1+7+7+7+6 days) - self.check_weeks(1987, 2, (1, 7, 7, 7, 6)) - - # A 29-day february starting on monday (7+7+7+7+1 days) - self.check_weeks(1988, 2, (7, 7, 7, 7, 1)) - - # A 29-day february starting on tuesday (6+7+7+7+2 days) - self.check_weeks(1972, 2, (6, 7, 7, 7, 2)) - - # A 29-day february starting on sunday (1+7+7+7+7 days) - self.check_weeks(2004, 2, (1, 7, 7, 7, 7)) - - def test_april(self): - # A 30-day april starting on monday (7+7+7+7+2 days) - self.check_weeks(1935, 4, (7, 7, 7, 7, 2)) - - # A 30-day april starting on tuesday (6+7+7+7+3 days) - self.check_weeks(1975, 4, (6, 7, 7, 7, 3)) - - # A 30-day april starting on sunday (1+7+7+7+7+1 days) - self.check_weeks(1945, 4, (1, 7, 7, 7, 7, 1)) - - # A 30-day april starting on saturday (2+7+7+7+7 days) - self.check_weeks(1995, 4, (2, 7, 7, 7, 7)) - - # A 30-day april starting on friday (3+7+7+7+6 days) - self.check_weeks(1994, 4, (3, 7, 7, 7, 6)) - - def test_december(self): - # A 31-day december starting on monday (7+7+7+7+3 days) - self.check_weeks(1980, 12, (7, 7, 7, 7, 3)) - - # A 31-day december starting on tuesday (6+7+7+7+4 days) - self.check_weeks(1987, 12, (6, 7, 7, 7, 4)) - - # A 31-day december starting on sunday (1+7+7+7+7+2 days) - self.check_weeks(1968, 12, (1, 7, 7, 7, 7, 2)) - - # A 31-day december starting on thursday (4+7+7+7+6 days) - self.check_weeks(1988, 12, (4, 7, 7, 7, 6)) - - # A 31-day december starting on friday (3+7+7+7+7 days) - self.check_weeks(2017, 12, (3, 7, 7, 7, 7)) - - # A 31-day december starting on saturday (2+7+7+7+7+1 days) - self.check_weeks(2068, 12, (2, 7, 7, 7, 7, 1)) - - -class SundayTestCase(MonthCalendarTestCase): - firstweekday = calendar.SUNDAY - - def test_february(self): - # A 28-day february starting on sunday (7+7+7+7 days) - self.check_weeks(2009, 2, (7, 7, 7, 7)) - - # A 28-day february starting on monday (6+7+7+7+1 days) - self.check_weeks(1999, 2, (6, 7, 7, 7, 1)) - - # A 28-day february starting on saturday (1+7+7+7+6 days) - self.check_weeks(1997, 2, (1, 7, 7, 7, 6)) - - # A 29-day february starting on sunday (7+7+7+7+1 days) - self.check_weeks(2004, 2, (7, 7, 7, 7, 1)) - - # A 29-day february starting on monday (6+7+7+7+2 days) - self.check_weeks(1960, 2, (6, 7, 7, 7, 2)) - - # A 29-day february starting on saturday (1+7+7+7+7 days) - self.check_weeks(1964, 2, (1, 7, 7, 7, 7)) - - def test_april(self): - # A 30-day april starting on sunday (7+7+7+7+2 days) - self.check_weeks(1923, 4, (7, 7, 7, 7, 2)) - - # A 30-day april starting on monday (6+7+7+7+3 days) - self.check_weeks(1918, 4, (6, 7, 7, 7, 3)) - - # A 30-day april starting on saturday (1+7+7+7+7+1 days) - self.check_weeks(1950, 4, (1, 7, 7, 7, 7, 1)) - - # A 30-day april starting on friday (2+7+7+7+7 days) - self.check_weeks(1960, 4, (2, 7, 7, 7, 7)) - - # A 30-day april starting on thursday (3+7+7+7+6 days) - self.check_weeks(1909, 4, (3, 7, 7, 7, 6)) - - def test_december(self): - # A 31-day december starting on sunday (7+7+7+7+3 days) - self.check_weeks(2080, 12, (7, 7, 7, 7, 3)) - - # A 31-day december starting on monday (6+7+7+7+4 days) - self.check_weeks(1941, 12, (6, 7, 7, 7, 4)) - - # A 31-day december starting on saturday (1+7+7+7+7+2 days) - self.check_weeks(1923, 12, (1, 7, 7, 7, 7, 2)) - - # A 31-day december starting on wednesday (4+7+7+7+6 days) - self.check_weeks(1948, 12, (4, 7, 7, 7, 6)) - - # A 31-day december starting on thursday (3+7+7+7+7 days) - self.check_weeks(1927, 12, (3, 7, 7, 7, 7)) - - # A 31-day december starting on friday (2+7+7+7+7+1 days) - self.check_weeks(1995, 12, (2, 7, 7, 7, 7, 1)) - - -def test_main(): - test_support.run_unittest( - OutputTestCase, - CalendarTestCase, - MondayTestCase, - SundayTestCase - ) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_call.py b/sys/lib/python/test/test_call.py deleted file mode 100644 index f3c7c8c39..000000000 --- a/sys/lib/python/test/test_call.py +++ /dev/null @@ -1,131 +0,0 @@ -import unittest -from test import test_support - -# The test cases here cover several paths through the function calling -# code. They depend on the METH_XXX flag that is used to define a C -# function, which can't be verified from Python. If the METH_XXX decl -# for a C function changes, these tests may not cover the right paths. - -class CFunctionCalls(unittest.TestCase): - - def test_varargs0(self): - self.assertRaises(TypeError, {}.has_key) - - def test_varargs1(self): - {}.has_key(0) - - def test_varargs2(self): - self.assertRaises(TypeError, {}.has_key, 0, 1) - - def test_varargs0_ext(self): - try: - {}.has_key(*()) - except TypeError: - pass - - def test_varargs1_ext(self): - {}.has_key(*(0,)) - - def test_varargs2_ext(self): - try: - {}.has_key(*(1, 2)) - except TypeError: - pass - else: - raise RuntimeError - - def test_varargs0_kw(self): - self.assertRaises(TypeError, {}.has_key, x=2) - - def test_varargs1_kw(self): - self.assertRaises(TypeError, {}.has_key, x=2) - - def test_varargs2_kw(self): - self.assertRaises(TypeError, {}.has_key, x=2, y=2) - - def test_oldargs0_0(self): - {}.keys() - - def test_oldargs0_1(self): - self.assertRaises(TypeError, {}.keys, 0) - - def test_oldargs0_2(self): - self.assertRaises(TypeError, {}.keys, 0, 1) - - def test_oldargs0_0_ext(self): - {}.keys(*()) - - def test_oldargs0_1_ext(self): - try: - {}.keys(*(0,)) - except TypeError: - pass - else: - raise RuntimeError - - def test_oldargs0_2_ext(self): - try: - {}.keys(*(1, 2)) - except TypeError: - pass - else: - raise RuntimeError - - def test_oldargs0_0_kw(self): - try: - {}.keys(x=2) - except TypeError: - pass - else: - raise RuntimeError - - def test_oldargs0_1_kw(self): - self.assertRaises(TypeError, {}.keys, x=2) - - def test_oldargs0_2_kw(self): - self.assertRaises(TypeError, {}.keys, x=2, y=2) - - def test_oldargs1_0(self): - self.assertRaises(TypeError, [].count) - - def test_oldargs1_1(self): - [].count(1) - - def test_oldargs1_2(self): - self.assertRaises(TypeError, [].count, 1, 2) - - def test_oldargs1_0_ext(self): - try: - [].count(*()) - except TypeError: - pass - else: - raise RuntimeError - - def test_oldargs1_1_ext(self): - [].count(*(1,)) - - def test_oldargs1_2_ext(self): - try: - [].count(*(1, 2)) - except TypeError: - pass - else: - raise RuntimeError - - def test_oldargs1_0_kw(self): - self.assertRaises(TypeError, [].count, x=2) - - def test_oldargs1_1_kw(self): - self.assertRaises(TypeError, [].count, {}, x=2) - - def test_oldargs1_2_kw(self): - self.assertRaises(TypeError, [].count, x=2, y=2) - - -def test_main(): - test_support.run_unittest(CFunctionCalls) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_capi.py b/sys/lib/python/test/test_capi.py deleted file mode 100644 index cdd84bb22..000000000 --- a/sys/lib/python/test/test_capi.py +++ /dev/null @@ -1,55 +0,0 @@ -# Run the _testcapi module tests (tests for the Python/C API): by defn, -# these are all functions _testcapi exports whose name begins with 'test_'. - -import sys -from test import test_support -import _testcapi - -def test_main(): - - for name in dir(_testcapi): - if name.startswith('test_'): - test = getattr(_testcapi, name) - if test_support.verbose: - print "internal", name - try: - test() - except _testcapi.error: - raise test_support.TestFailed, sys.exc_info()[1] - - # some extra thread-state tests driven via _testcapi - def TestThreadState(): - import thread - import time - - if test_support.verbose: - print "auto-thread-state" - - idents = [] - - def callback(): - idents.append(thread.get_ident()) - - _testcapi._test_thread_state(callback) - a = b = callback - time.sleep(1) - # Check our main thread is in the list exactly 3 times. - if idents.count(thread.get_ident()) != 3: - raise test_support.TestFailed, \ - "Couldn't find main thread correctly in the list" - - try: - _testcapi._test_thread_state - have_thread_state = True - except AttributeError: - have_thread_state = False - - if have_thread_state: - TestThreadState() - import threading - t=threading.Thread(target=TestThreadState) - t.start() - t.join() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_cd.py b/sys/lib/python/test/test_cd.py deleted file mode 100755 index d85621178..000000000 --- a/sys/lib/python/test/test_cd.py +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/bin/env python -"""Whimpy test script for the cd module - Roger E. Masse -""" -import cd -from test.test_support import verbose - -cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY', - 'STILL', '__doc__', '__name__', 'atime', 'audio', 'catalog', 'control', 'createparser', 'error', - 'ident', 'index', 'msftoframe', 'open', 'pnum', 'ptime'] - - -# This is a very inobtrusive test for the existence of the cd module and all its -# attributes. More comprehensive examples can be found in Demo/cd and -# require that you have a CD and a CD ROM drive - -def main(): - # touch all the attributes of cd without doing anything - if verbose: - print 'Touching cd module attributes...' - for attr in cdattrs: - if verbose: - print 'touching: ', attr - getattr(cd, attr) - -main() diff --git a/sys/lib/python/test/test_cfgparser.py b/sys/lib/python/test/test_cfgparser.py deleted file mode 100644 index 66fecf1ac..000000000 --- a/sys/lib/python/test/test_cfgparser.py +++ /dev/null @@ -1,426 +0,0 @@ -import ConfigParser -import StringIO -import unittest - -from test import test_support - - -class TestCaseBase(unittest.TestCase): - def newconfig(self, defaults=None): - if defaults is None: - self.cf = self.config_class() - else: - self.cf = self.config_class(defaults) - return self.cf - - def fromstring(self, string, defaults=None): - cf = self.newconfig(defaults) - sio = StringIO.StringIO(string) - cf.readfp(sio) - return cf - - def test_basic(self): - cf = self.fromstring( - "[Foo Bar]\n" - "foo=bar\n" - "[Spacey Bar]\n" - "foo = bar\n" - "[Commented Bar]\n" - "foo: bar ; comment\n" - "[Long Line]\n" - "foo: this line is much, much longer than my editor\n" - " likes it.\n" - "[Section\\with$weird%characters[\t]\n" - "[Internationalized Stuff]\n" - "foo[bg]: Bulgarian\n" - "foo=Default\n" - "foo[en]=English\n" - "foo[de]=Deutsch\n" - "[Spaces]\n" - "key with spaces : value\n" - "another with spaces = splat!\n" - ) - L = cf.sections() - L.sort() - eq = self.assertEqual - eq(L, [r'Commented Bar', - r'Foo Bar', - r'Internationalized Stuff', - r'Long Line', - r'Section\with$weird%characters[' '\t', - r'Spaces', - r'Spacey Bar', - ]) - - # The use of spaces in the section names serves as a - # regression test for SourceForge bug #583248: - # http://www.python.org/sf/583248 - eq(cf.get('Foo Bar', 'foo'), 'bar') - eq(cf.get('Spacey Bar', 'foo'), 'bar') - eq(cf.get('Commented Bar', 'foo'), 'bar') - eq(cf.get('Spaces', 'key with spaces'), 'value') - eq(cf.get('Spaces', 'another with spaces'), 'splat!') - - self.failIf('__name__' in cf.options("Foo Bar"), - '__name__ "option" should not be exposed by the API!') - - # Make sure the right things happen for remove_option(); - # added to include check for SourceForge bug #123324: - self.failUnless(cf.remove_option('Foo Bar', 'foo'), - "remove_option() failed to report existance of option") - self.failIf(cf.has_option('Foo Bar', 'foo'), - "remove_option() failed to remove option") - self.failIf(cf.remove_option('Foo Bar', 'foo'), - "remove_option() failed to report non-existance of option" - " that was removed") - - self.assertRaises(ConfigParser.NoSectionError, - cf.remove_option, 'No Such Section', 'foo') - - eq(cf.get('Long Line', 'foo'), - 'this line is much, much longer than my editor\nlikes it.') - - def test_case_sensitivity(self): - cf = self.newconfig() - cf.add_section("A") - cf.add_section("a") - L = cf.sections() - L.sort() - eq = self.assertEqual - eq(L, ["A", "a"]) - cf.set("a", "B", "value") - eq(cf.options("a"), ["b"]) - eq(cf.get("a", "b"), "value", - "could not locate option, expecting case-insensitive option names") - self.failUnless(cf.has_option("a", "b")) - cf.set("A", "A-B", "A-B value") - for opt in ("a-b", "A-b", "a-B", "A-B"): - self.failUnless( - cf.has_option("A", opt), - "has_option() returned false for option which should exist") - eq(cf.options("A"), ["a-b"]) - eq(cf.options("a"), ["b"]) - cf.remove_option("a", "B") - eq(cf.options("a"), []) - - # SF bug #432369: - cf = self.fromstring( - "[MySection]\nOption: first line\n\tsecond line\n") - eq(cf.options("MySection"), ["option"]) - eq(cf.get("MySection", "Option"), "first line\nsecond line") - - # SF bug #561822: - cf = self.fromstring("[section]\nnekey=nevalue\n", - defaults={"key":"value"}) - self.failUnless(cf.has_option("section", "Key")) - - - def test_default_case_sensitivity(self): - cf = self.newconfig({"foo": "Bar"}) - self.assertEqual( - cf.get("DEFAULT", "Foo"), "Bar", - "could not locate option, expecting case-insensitive option names") - cf = self.newconfig({"Foo": "Bar"}) - self.assertEqual( - cf.get("DEFAULT", "Foo"), "Bar", - "could not locate option, expecting case-insensitive defaults") - - def test_parse_errors(self): - self.newconfig() - self.parse_error(ConfigParser.ParsingError, - "[Foo]\n extra-spaces: splat\n") - self.parse_error(ConfigParser.ParsingError, - "[Foo]\n extra-spaces= splat\n") - self.parse_error(ConfigParser.ParsingError, - "[Foo]\noption-without-value\n") - self.parse_error(ConfigParser.ParsingError, - "[Foo]\n:value-without-option-name\n") - self.parse_error(ConfigParser.ParsingError, - "[Foo]\n=value-without-option-name\n") - self.parse_error(ConfigParser.MissingSectionHeaderError, - "No Section!\n") - - def parse_error(self, exc, src): - sio = StringIO.StringIO(src) - self.assertRaises(exc, self.cf.readfp, sio) - - def test_query_errors(self): - cf = self.newconfig() - self.assertEqual(cf.sections(), [], - "new ConfigParser should have no defined sections") - self.failIf(cf.has_section("Foo"), - "new ConfigParser should have no acknowledged sections") - self.assertRaises(ConfigParser.NoSectionError, - cf.options, "Foo") - self.assertRaises(ConfigParser.NoSectionError, - cf.set, "foo", "bar", "value") - self.get_error(ConfigParser.NoSectionError, "foo", "bar") - cf.add_section("foo") - self.get_error(ConfigParser.NoOptionError, "foo", "bar") - - def get_error(self, exc, section, option): - try: - self.cf.get(section, option) - except exc, e: - return e - else: - self.fail("expected exception type %s.%s" - % (exc.__module__, exc.__name__)) - - def test_boolean(self): - cf = self.fromstring( - "[BOOLTEST]\n" - "T1=1\n" - "T2=TRUE\n" - "T3=True\n" - "T4=oN\n" - "T5=yes\n" - "F1=0\n" - "F2=FALSE\n" - "F3=False\n" - "F4=oFF\n" - "F5=nO\n" - "E1=2\n" - "E2=foo\n" - "E3=-1\n" - "E4=0.1\n" - "E5=FALSE AND MORE" - ) - for x in range(1, 5): - self.failUnless(cf.getboolean('BOOLTEST', 't%d' % x)) - self.failIf(cf.getboolean('BOOLTEST', 'f%d' % x)) - self.assertRaises(ValueError, - cf.getboolean, 'BOOLTEST', 'e%d' % x) - - def test_weird_errors(self): - cf = self.newconfig() - cf.add_section("Foo") - self.assertRaises(ConfigParser.DuplicateSectionError, - cf.add_section, "Foo") - - def test_write(self): - cf = self.fromstring( - "[Long Line]\n" - "foo: this line is much, much longer than my editor\n" - " likes it.\n" - "[DEFAULT]\n" - "foo: another very\n" - " long line" - ) - output = StringIO.StringIO() - cf.write(output) - self.assertEqual( - output.getvalue(), - "[DEFAULT]\n" - "foo = another very\n" - "\tlong line\n" - "\n" - "[Long Line]\n" - "foo = this line is much, much longer than my editor\n" - "\tlikes it.\n" - "\n" - ) - - def test_set_string_types(self): - cf = self.fromstring("[sect]\n" - "option1=foo\n") - # Check that we don't get an exception when setting values in - # an existing section using strings: - class mystr(str): - pass - cf.set("sect", "option1", "splat") - cf.set("sect", "option1", mystr("splat")) - cf.set("sect", "option2", "splat") - cf.set("sect", "option2", mystr("splat")) - try: - unicode - except NameError: - pass - else: - cf.set("sect", "option1", unicode("splat")) - cf.set("sect", "option2", unicode("splat")) - - def test_read_returns_file_list(self): - file1 = test_support.findfile("cfgparser.1") - # check when we pass a mix of readable and non-readable files: - cf = self.newconfig() - parsed_files = cf.read([file1, "nonexistant-file"]) - self.assertEqual(parsed_files, [file1]) - self.assertEqual(cf.get("Foo Bar", "foo"), "newbar") - # check when we pass only a filename: - cf = self.newconfig() - parsed_files = cf.read(file1) - self.assertEqual(parsed_files, [file1]) - self.assertEqual(cf.get("Foo Bar", "foo"), "newbar") - # check when we pass only missing files: - cf = self.newconfig() - parsed_files = cf.read(["nonexistant-file"]) - self.assertEqual(parsed_files, []) - # check when we pass no files: - cf = self.newconfig() - parsed_files = cf.read([]) - self.assertEqual(parsed_files, []) - - # shared by subclasses - def get_interpolation_config(self): - return self.fromstring( - "[Foo]\n" - "bar=something %(with1)s interpolation (1 step)\n" - "bar9=something %(with9)s lots of interpolation (9 steps)\n" - "bar10=something %(with10)s lots of interpolation (10 steps)\n" - "bar11=something %(with11)s lots of interpolation (11 steps)\n" - "with11=%(with10)s\n" - "with10=%(with9)s\n" - "with9=%(with8)s\n" - "with8=%(With7)s\n" - "with7=%(WITH6)s\n" - "with6=%(with5)s\n" - "With5=%(with4)s\n" - "WITH4=%(with3)s\n" - "with3=%(with2)s\n" - "with2=%(with1)s\n" - "with1=with\n" - "\n" - "[Mutual Recursion]\n" - "foo=%(bar)s\n" - "bar=%(foo)s\n" - "\n" - "[Interpolation Error]\n" - "name=%(reference)s\n", - # no definition for 'reference' - defaults={"getname": "%(__name__)s"}) - - def check_items_config(self, expected): - cf = self.fromstring( - "[section]\n" - "name = value\n" - "key: |%(name)s| \n" - "getdefault: |%(default)s|\n" - "getname: |%(__name__)s|", - defaults={"default": ""}) - L = list(cf.items("section")) - L.sort() - self.assertEqual(L, expected) - - -class ConfigParserTestCase(TestCaseBase): - config_class = ConfigParser.ConfigParser - - def test_interpolation(self): - cf = self.get_interpolation_config() - eq = self.assertEqual - eq(cf.get("Foo", "getname"), "Foo") - eq(cf.get("Foo", "bar"), "something with interpolation (1 step)") - eq(cf.get("Foo", "bar9"), - "something with lots of interpolation (9 steps)") - eq(cf.get("Foo", "bar10"), - "something with lots of interpolation (10 steps)") - self.get_error(ConfigParser.InterpolationDepthError, "Foo", "bar11") - - def test_interpolation_missing_value(self): - cf = self.get_interpolation_config() - e = self.get_error(ConfigParser.InterpolationError, - "Interpolation Error", "name") - self.assertEqual(e.reference, "reference") - self.assertEqual(e.section, "Interpolation Error") - self.assertEqual(e.option, "name") - - def test_items(self): - self.check_items_config([('default', ''), - ('getdefault', '||'), - ('getname', '|section|'), - ('key', '|value|'), - ('name', 'value')]) - - def test_set_nonstring_types(self): - cf = self.newconfig() - cf.add_section('non-string') - cf.set('non-string', 'int', 1) - cf.set('non-string', 'list', [0, 1, 1, 2, 3, 5, 8, 13, '%(']) - cf.set('non-string', 'dict', {'pi': 3.14159, '%(': 1, - '%(list)': '%(list)'}) - cf.set('non-string', 'string_with_interpolation', '%(list)s') - self.assertEqual(cf.get('non-string', 'int', raw=True), 1) - self.assertRaises(TypeError, cf.get, 'non-string', 'int') - self.assertEqual(cf.get('non-string', 'list', raw=True), - [0, 1, 1, 2, 3, 5, 8, 13, '%(']) - self.assertRaises(TypeError, cf.get, 'non-string', 'list') - self.assertEqual(cf.get('non-string', 'dict', raw=True), - {'pi': 3.14159, '%(': 1, '%(list)': '%(list)'}) - self.assertRaises(TypeError, cf.get, 'non-string', 'dict') - self.assertEqual(cf.get('non-string', 'string_with_interpolation', - raw=True), '%(list)s') - self.assertRaises(ValueError, cf.get, 'non-string', - 'string_with_interpolation', raw=False) - - -class RawConfigParserTestCase(TestCaseBase): - config_class = ConfigParser.RawConfigParser - - def test_interpolation(self): - cf = self.get_interpolation_config() - eq = self.assertEqual - eq(cf.get("Foo", "getname"), "%(__name__)s") - eq(cf.get("Foo", "bar"), - "something %(with1)s interpolation (1 step)") - eq(cf.get("Foo", "bar9"), - "something %(with9)s lots of interpolation (9 steps)") - eq(cf.get("Foo", "bar10"), - "something %(with10)s lots of interpolation (10 steps)") - eq(cf.get("Foo", "bar11"), - "something %(with11)s lots of interpolation (11 steps)") - - def test_items(self): - self.check_items_config([('default', ''), - ('getdefault', '|%(default)s|'), - ('getname', '|%(__name__)s|'), - ('key', '|%(name)s|'), - ('name', 'value')]) - - def test_set_nonstring_types(self): - cf = self.newconfig() - cf.add_section('non-string') - cf.set('non-string', 'int', 1) - cf.set('non-string', 'list', [0, 1, 1, 2, 3, 5, 8, 13]) - cf.set('non-string', 'dict', {'pi': 3.14159}) - self.assertEqual(cf.get('non-string', 'int'), 1) - self.assertEqual(cf.get('non-string', 'list'), - [0, 1, 1, 2, 3, 5, 8, 13]) - self.assertEqual(cf.get('non-string', 'dict'), {'pi': 3.14159}) - - -class SafeConfigParserTestCase(ConfigParserTestCase): - config_class = ConfigParser.SafeConfigParser - - def test_safe_interpolation(self): - # See http://www.python.org/sf/511737 - cf = self.fromstring("[section]\n" - "option1=xxx\n" - "option2=%(option1)s/xxx\n" - "ok=%(option1)s/%%s\n" - "not_ok=%(option2)s/%%s") - self.assertEqual(cf.get("section", "ok"), "xxx/%s") - self.assertEqual(cf.get("section", "not_ok"), "xxx/xxx/%s") - - def test_set_nonstring_types(self): - cf = self.fromstring("[sect]\n" - "option1=foo\n") - # Check that we get a TypeError when setting non-string values - # in an existing section: - self.assertRaises(TypeError, cf.set, "sect", "option1", 1) - self.assertRaises(TypeError, cf.set, "sect", "option1", 1.0) - self.assertRaises(TypeError, cf.set, "sect", "option1", object()) - self.assertRaises(TypeError, cf.set, "sect", "option2", 1) - self.assertRaises(TypeError, cf.set, "sect", "option2", 1.0) - self.assertRaises(TypeError, cf.set, "sect", "option2", object()) - - -def test_main(): - test_support.run_unittest( - ConfigParserTestCase, - RawConfigParserTestCase, - SafeConfigParserTestCase - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_cgi.py b/sys/lib/python/test/test_cgi.py deleted file mode 100644 index 557f4dc0c..000000000 --- a/sys/lib/python/test/test_cgi.py +++ /dev/null @@ -1,275 +0,0 @@ -from test.test_support import verify, verbose -import cgi -import os -import sys -import tempfile -from StringIO import StringIO - -class HackedSysModule: - # The regression test will have real values in sys.argv, which - # will completely confuse the test of the cgi module - argv = [] - stdin = sys.stdin - -cgi.sys = HackedSysModule() - -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO - -class ComparableException: - def __init__(self, err): - self.err = err - - def __str__(self): - return str(self.err) - - def __cmp__(self, anExc): - if not isinstance(anExc, Exception): - return -1 - x = cmp(self.err.__class__, anExc.__class__) - if x != 0: - return x - return cmp(self.err.args, anExc.args) - - def __getattr__(self, attr): - return getattr(self.err, attr) - -def do_test(buf, method): - env = {} - if method == "GET": - fp = None - env['REQUEST_METHOD'] = 'GET' - env['QUERY_STRING'] = buf - elif method == "POST": - fp = StringIO(buf) - env['REQUEST_METHOD'] = 'POST' - env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded' - env['CONTENT_LENGTH'] = str(len(buf)) - else: - raise ValueError, "unknown method: %s" % method - try: - return cgi.parse(fp, env, strict_parsing=1) - except StandardError, err: - return ComparableException(err) - -# A list of test cases. Each test case is a a two-tuple that contains -# a string with the query and a dictionary with the expected result. - -parse_qsl_test_cases = [ - ("", []), - ("&", []), - ("&&", []), - ("=", [('', '')]), - ("=a", [('', 'a')]), - ("a", [('a', '')]), - ("a=", [('a', '')]), - ("a=", [('a', '')]), - ("&a=b", [('a', 'b')]), - ("a=a+b&b=b+c", [('a', 'a b'), ('b', 'b c')]), - ("a=1&a=2", [('a', '1'), ('a', '2')]), -] - -parse_strict_test_cases = [ - ("", ValueError("bad query field: ''")), - ("&", ValueError("bad query field: ''")), - ("&&", ValueError("bad query field: ''")), - (";", ValueError("bad query field: ''")), - (";&;", ValueError("bad query field: ''")), - # Should the next few really be valid? - ("=", {}), - ("=&=", {}), - ("=;=", {}), - # This rest seem to make sense - ("=a", {'': ['a']}), - ("&=a", ValueError("bad query field: ''")), - ("=a&", ValueError("bad query field: ''")), - ("=&a", ValueError("bad query field: 'a'")), - ("b=a", {'b': ['a']}), - ("b+=a", {'b ': ['a']}), - ("a=b=a", {'a': ['b=a']}), - ("a=+b=a", {'a': [' b=a']}), - ("&b=a", ValueError("bad query field: ''")), - ("b&=a", ValueError("bad query field: 'b'")), - ("a=a+b&b=b+c", {'a': ['a b'], 'b': ['b c']}), - ("a=a+b&a=b+a", {'a': ['a b', 'b a']}), - ("x=1&y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), - ("x=1;y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), - ("x=1;y=2.0;z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), - ("Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=env", - {'Hbc5161168c542333633315dee1182227:key_store_seqid': ['400006'], - 'cuyer': ['r'], - 'expire': ['964546263'], - 'kid': ['130003.300038'], - 'lobale': ['en-US'], - 'order_id': ['0bb2e248638833d48cb7fed300000f1b'], - 'ss': ['env'], - 'view': ['bustomer'], - }), - - ("group_id=5470&set=custom&_assigned_to=31392&_status=1&_category=100&SUBMIT=Browse", - {'SUBMIT': ['Browse'], - '_assigned_to': ['31392'], - '_category': ['100'], - '_status': ['1'], - 'group_id': ['5470'], - 'set': ['custom'], - }) - ] - -def norm(list): - if type(list) == type([]): - list.sort() - return list - -def first_elts(list): - return map(lambda x:x[0], list) - -def first_second_elts(list): - return map(lambda p:(p[0], p[1][0]), list) - -def main(): - for orig, expect in parse_qsl_test_cases: - result = cgi.parse_qsl(orig, keep_blank_values=True) - print repr(orig), '=>', result - verify(result == expect, "Error parsing %s" % repr(orig)) - - for orig, expect in parse_strict_test_cases: - # Test basic parsing - print repr(orig) - d = do_test(orig, "GET") - verify(d == expect, "Error parsing %s" % repr(orig)) - d = do_test(orig, "POST") - verify(d == expect, "Error parsing %s" % repr(orig)) - - env = {'QUERY_STRING': orig} - fcd = cgi.FormContentDict(env) - sd = cgi.SvFormContentDict(env) - fs = cgi.FieldStorage(environ=env) - if type(expect) == type({}): - # test dict interface - verify(len(expect) == len(fcd)) - verify(norm(expect.keys()) == norm(fcd.keys())) - verify(norm(expect.values()) == norm(fcd.values())) - verify(norm(expect.items()) == norm(fcd.items())) - verify(fcd.get("nonexistent field", "default") == "default") - verify(len(sd) == len(fs)) - verify(norm(sd.keys()) == norm(fs.keys())) - verify(fs.getvalue("nonexistent field", "default") == "default") - # test individual fields - for key in expect.keys(): - expect_val = expect[key] - verify(fcd.has_key(key)) - verify(norm(fcd[key]) == norm(expect[key])) - verify(fcd.get(key, "default") == fcd[key]) - verify(fs.has_key(key)) - if len(expect_val) > 1: - single_value = 0 - else: - single_value = 1 - try: - val = sd[key] - except IndexError: - verify(not single_value) - verify(fs.getvalue(key) == expect_val) - else: - verify(single_value) - verify(val == expect_val[0]) - verify(fs.getvalue(key) == expect_val[0]) - verify(norm(sd.getlist(key)) == norm(expect_val)) - if single_value: - verify(norm(sd.values()) == \ - first_elts(norm(expect.values()))) - verify(norm(sd.items()) == \ - first_second_elts(norm(expect.items()))) - - # Test the weird FormContentDict classes - env = {'QUERY_STRING': "x=1&y=2.0&z=2-3.%2b0&1=1abc"} - expect = {'x': 1, 'y': 2.0, 'z': '2-3.+0', '1': '1abc'} - d = cgi.InterpFormContentDict(env) - for k, v in expect.items(): - verify(d[k] == v) - for k, v in d.items(): - verify(expect[k] == v) - verify(norm(expect.values()) == norm(d.values())) - - print "Testing log" - cgi.log("Testing") - cgi.logfp = sys.stdout - cgi.initlog("%s", "Testing initlog 1") - cgi.log("%s", "Testing log 2") - if os.path.exists("/dev/null"): - cgi.logfp = None - cgi.logfile = "/dev/null" - cgi.initlog("%s", "Testing log 3") - cgi.log("Testing log 4") - - print "Test FieldStorage methods that use readline" - # FieldStorage uses readline, which has the capacity to read all - # contents of the input file into memory; we use readline's size argument - # to prevent that for files that do not contain any newlines in - # non-GET/HEAD requests - class TestReadlineFile: - def __init__(self, file): - self.file = file - self.numcalls = 0 - - def readline(self, size=None): - self.numcalls += 1 - if size: - return self.file.readline(size) - else: - return self.file.readline() - - def __getattr__(self, name): - file = self.__dict__['file'] - a = getattr(file, name) - if not isinstance(a, int): - setattr(self, name, a) - return a - - f = TestReadlineFile(tempfile.TemporaryFile()) - f.write('x' * 256 * 1024) - f.seek(0) - env = {'REQUEST_METHOD':'PUT'} - fs = cgi.FieldStorage(fp=f, environ=env) - # if we're not chunking properly, readline is only called twice - # (by read_binary); if we are chunking properly, it will be called 5 times - # as long as the chunksize is 1 << 16. - verify(f.numcalls > 2) - - print "Test basic FieldStorage multipart parsing" - env = {'REQUEST_METHOD':'POST', 'CONTENT_TYPE':'multipart/form-data; boundary=---------------------------721837373350705526688164684', 'CONTENT_LENGTH':'558'} - postdata = """-----------------------------721837373350705526688164684 -Content-Disposition: form-data; name="id" - -1234 ------------------------------721837373350705526688164684 -Content-Disposition: form-data; name="title" - - ------------------------------721837373350705526688164684 -Content-Disposition: form-data; name="file"; filename="test.txt" -Content-Type: text/plain - -Testing 123. - ------------------------------721837373350705526688164684 -Content-Disposition: form-data; name="submit" - - Add\x20 ------------------------------721837373350705526688164684-- -""" - fs = cgi.FieldStorage(fp=StringIO(postdata), environ=env) - verify(len(fs.list) == 4) - expect = [{'name':'id', 'filename':None, 'value':'1234'}, - {'name':'title', 'filename':None, 'value':''}, - {'name':'file', 'filename':'test.txt','value':'Testing 123.\n'}, - {'name':'submit', 'filename':None, 'value':' Add '}] - for x in range(len(fs.list)): - for k, exp in expect[x].items(): - got = getattr(fs.list[x], k) - verify(got == exp) - -main() diff --git a/sys/lib/python/test/test_charmapcodec.py b/sys/lib/python/test/test_charmapcodec.py deleted file mode 100644 index 286698400..000000000 --- a/sys/lib/python/test/test_charmapcodec.py +++ /dev/null @@ -1,56 +0,0 @@ -""" Python character mapping codec test - -This uses the test codec in testcodec.py and thus also tests the -encodings package lookup scheme. - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright 2000 Guido van Rossum. - -"""#" - -import test.test_support, unittest - -import codecs - -# Register a search function which knows about our codec -def codec_search_function(encoding): - if encoding == 'testcodec': - from test import testcodec - return tuple(testcodec.getregentry()) - return None - -codecs.register(codec_search_function) - -# test codec's name (see test/testcodec.py) -codecname = 'testcodec' - -class CharmapCodecTest(unittest.TestCase): - def test_constructorx(self): - self.assertEquals(unicode('abc', codecname), u'abc') - self.assertEquals(unicode('xdef', codecname), u'abcdef') - self.assertEquals(unicode('defx', codecname), u'defabc') - self.assertEquals(unicode('dxf', codecname), u'dabcf') - self.assertEquals(unicode('dxfx', codecname), u'dabcfabc') - - def test_encodex(self): - self.assertEquals(u'abc'.encode(codecname), 'abc') - self.assertEquals(u'xdef'.encode(codecname), 'abcdef') - self.assertEquals(u'defx'.encode(codecname), 'defabc') - self.assertEquals(u'dxf'.encode(codecname), 'dabcf') - self.assertEquals(u'dxfx'.encode(codecname), 'dabcfabc') - - def test_constructory(self): - self.assertEquals(unicode('ydef', codecname), u'def') - self.assertEquals(unicode('defy', codecname), u'def') - self.assertEquals(unicode('dyf', codecname), u'df') - self.assertEquals(unicode('dyfy', codecname), u'df') - - def test_maptoundefined(self): - self.assertRaises(UnicodeError, unicode, 'abc\001', codecname) - -def test_main(): - test.test_support.run_unittest(CharmapCodecTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_cl.py b/sys/lib/python/test/test_cl.py deleted file mode 100755 index abfe3c19f..000000000 --- a/sys/lib/python/test/test_cl.py +++ /dev/null @@ -1,78 +0,0 @@ -#! /usr/bin/env python -"""Whimpy test script for the cl module - Roger E. Masse -""" -import cl -from test.test_support import verbose - -clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID', -'ALGORITHM_VERSION', 'AUDIO', 'AWARE_ERROR', 'AWARE_MPEG_AUDIO', -'AWARE_MULTIRATE', 'AWCMP_CONST_QUAL', 'AWCMP_FIXED_RATE', -'AWCMP_INDEPENDENT', 'AWCMP_JOINT_STEREO', 'AWCMP_LOSSLESS', -'AWCMP_MPEG_LAYER_I', 'AWCMP_MPEG_LAYER_II', 'AWCMP_STEREO', -'Algorithm', 'AlgorithmNumber', 'AlgorithmType', 'AudioFormatName', -'BAD_ALGORITHM_NAME', 'BAD_ALGORITHM_TYPE', 'BAD_BLOCK_SIZE', -'BAD_BOARD', 'BAD_BUFFERING', 'BAD_BUFFERLENGTH_NEG', -'BAD_BUFFERLENGTH_ODD', 'BAD_BUFFER_EXISTS', 'BAD_BUFFER_HANDLE', -'BAD_BUFFER_POINTER', 'BAD_BUFFER_QUERY_SIZE', 'BAD_BUFFER_SIZE', -'BAD_BUFFER_SIZE_POINTER', 'BAD_BUFFER_TYPE', -'BAD_COMPRESSION_SCHEME', 'BAD_COMPRESSOR_HANDLE', -'BAD_COMPRESSOR_HANDLE_POINTER', 'BAD_FRAME_SIZE', -'BAD_FUNCTIONALITY', 'BAD_FUNCTION_POINTER', 'BAD_HEADER_SIZE', -'BAD_INITIAL_VALUE', 'BAD_INTERNAL_FORMAT', 'BAD_LICENSE', -'BAD_MIN_GT_MAX', 'BAD_NO_BUFFERSPACE', 'BAD_NUMBER_OF_BLOCKS', -'BAD_PARAM', 'BAD_PARAM_ID_POINTER', 'BAD_PARAM_TYPE', 'BAD_POINTER', -'BAD_PVBUFFER', 'BAD_SCHEME_POINTER', 'BAD_STREAM_HEADER', -'BAD_STRING_POINTER', 'BAD_TEXT_STRING_PTR', 'BEST_FIT', -'BIDIRECTIONAL', 'BITRATE_POLICY', 'BITRATE_TARGET', -'BITS_PER_COMPONENT', 'BLENDING', 'BLOCK_SIZE', 'BOTTOM_UP', -'BUFFER_NOT_CREATED', 'BUF_DATA', 'BUF_FRAME', 'BytesPerPixel', -'BytesPerSample', 'CHANNEL_POLICY', 'CHROMA_THRESHOLD', 'CODEC', -'COMPONENTS', 'COMPRESSED_BUFFER_SIZE', 'COMPRESSION_RATIO', -'COMPRESSOR', 'CONTINUOUS_BLOCK', 'CONTINUOUS_NONBLOCK', -'CompressImage', 'DATA', 'DECOMPRESSOR', 'DecompressImage', -'EDGE_THRESHOLD', 'ENABLE_IMAGEINFO', 'END_OF_SEQUENCE', 'ENUM_VALUE', -'EXACT_COMPRESSION_RATIO', 'EXTERNAL_DEVICE', 'FLOATING_ENUM_VALUE', -'FLOATING_RANGE_VALUE', 'FRAME', 'FRAME_BUFFER_SIZE', -'FRAME_BUFFER_SIZE_ZERO', 'FRAME_RATE', 'FRAME_TYPE', 'G711_ALAW', -'G711_ULAW', 'GRAYSCALE', 'GetAlgorithmName', 'HDCC', -'HDCC_SAMPLES_PER_TILE', 'HDCC_TILE_THRESHOLD', 'HEADER_START_CODE', -'IMAGE_HEIGHT', 'IMAGE_WIDTH', 'INTERNAL_FORMAT', -'INTERNAL_IMAGE_HEIGHT', 'INTERNAL_IMAGE_WIDTH', 'INTRA', 'JPEG', -'JPEG_ERROR', 'JPEG_NUM_PARAMS', 'JPEG_QUALITY_FACTOR', -'JPEG_QUANTIZATION_TABLES', 'JPEG_SOFTWARE', 'JPEG_STREAM_HEADERS', -'KEYFRAME', 'LAST_FRAME_INDEX', 'LAYER', 'LUMA_THRESHOLD', -'MAX_NUMBER_OF_AUDIO_ALGORITHMS', 'MAX_NUMBER_OF_ORIGINAL_FORMATS', -'MAX_NUMBER_OF_PARAMS', 'MAX_NUMBER_OF_VIDEO_ALGORITHMS', 'MONO', -'MPEG_VIDEO', 'MVC1', 'MVC2', 'MVC2_BLENDING', 'MVC2_BLENDING_OFF', -'MVC2_BLENDING_ON', 'MVC2_CHROMA_THRESHOLD', 'MVC2_EDGE_THRESHOLD', -'MVC2_ERROR', 'MVC2_LUMA_THRESHOLD', 'NEXT_NOT_AVAILABLE', -'NOISE_MARGIN', 'NONE', 'NUMBER_OF_FRAMES', 'NUMBER_OF_PARAMS', -'ORIENTATION', 'ORIGINAL_FORMAT', 'OpenCompressor', -'OpenDecompressor', 'PARAM_OUT_OF_RANGE', 'PREDICTED', 'PREROLL', -'ParamID', 'ParamNumber', 'ParamType', 'QUALITY_FACTOR', -'QUALITY_LEVEL', 'QueryAlgorithms', 'QueryMaxHeaderSize', -'QueryScheme', 'QuerySchemeFromName', 'RANGE_VALUE', 'RGB', 'RGB332', -'RGB8', 'RGBA', 'RGBX', 'RLE', 'RLE24', 'RTR', 'RTR1', -'RTR_QUALITY_LEVEL', 'SAMPLES_PER_TILE', 'SCHEME_BUSY', -'SCHEME_NOT_AVAILABLE', 'SPEED', 'STEREO_INTERLEAVED', -'STREAM_HEADERS', 'SetDefault', 'SetMax', 'SetMin', 'TILE_THRESHOLD', -'TOP_DOWN', 'ULAW', 'UNCOMPRESSED', 'UNCOMPRESSED_AUDIO', -'UNCOMPRESSED_VIDEO', 'UNKNOWN_SCHEME', 'VIDEO', 'VideoFormatName', -'Y', 'YCbCr', 'YCbCr422', 'YCbCr422DC', 'YCbCr422HC', 'YUV', 'YUV422', -'YUV422DC', 'YUV422HC', '__doc__', '__name__', 'cvt_type', 'error'] - - -# This is a very inobtrusive test for the existence of the cl -# module and all its attributes. - -def main(): - # touch all the attributes of al without doing anything - if verbose: - print 'Touching cl module attributes...' - for attr in clattrs: - if verbose: - print 'touching: ', attr - getattr(cl, attr) - -main() diff --git a/sys/lib/python/test/test_class.py b/sys/lib/python/test/test_class.py deleted file mode 100644 index 26b8e7a13..000000000 --- a/sys/lib/python/test/test_class.py +++ /dev/null @@ -1,412 +0,0 @@ -"Test the functionality of Python classes implementing operators." - -from test.test_support import TestFailed - -testmeths = [ - -# Binary operations - "add", - "radd", - "sub", - "rsub", - "mul", - "rmul", - "div", - "rdiv", - "mod", - "rmod", - "divmod", - "rdivmod", - "pow", - "rpow", - "rshift", - "rrshift", - "lshift", - "rlshift", - "and", - "rand", - "or", - "ror", - "xor", - "rxor", - -# List/dict operations - "contains", - "getitem", - "getslice", - "setitem", - "setslice", - "delitem", - "delslice", - -# Unary operations - "neg", - "pos", - "abs", - -# generic operations - "init", - ] - -# These need to return something other than None -# "coerce", -# "hash", -# "str", -# "repr", -# "int", -# "long", -# "float", -# "oct", -# "hex", - -# These are separate because they can influence the test of other methods. -# "getattr", -# "setattr", -# "delattr", - -class AllTests: - def __coerce__(self, *args): - print "__coerce__:", args - return (self,) + args - - def __hash__(self, *args): - print "__hash__:", args - return hash(id(self)) - - def __str__(self, *args): - print "__str__:", args - return "AllTests" - - def __repr__(self, *args): - print "__repr__:", args - return "AllTests" - - def __int__(self, *args): - print "__int__:", args - return 1 - - def __float__(self, *args): - print "__float__:", args - return 1.0 - - def __long__(self, *args): - print "__long__:", args - return 1L - - def __oct__(self, *args): - print "__oct__:", args - return '01' - - def __hex__(self, *args): - print "__hex__:", args - return '0x1' - - def __cmp__(self, *args): - print "__cmp__:", args - return 0 - - def __del__(self, *args): - print "__del__:", args - -# Synthesize AllTests methods from the names in testmeths. - -method_template = """\ -def __%(method)s__(self, *args): - print "__%(method)s__:", args -""" - -for method in testmeths: - exec method_template % locals() in AllTests.__dict__ - -del method, method_template - -# this also tests __init__ of course. -testme = AllTests() - -# Binary operations - -testme + 1 -1 + testme - -testme - 1 -1 - testme - -testme * 1 -1 * testme - -if 1/2 == 0: - testme / 1 - 1 / testme -else: - # True division is in effect, so "/" doesn't map to __div__ etc; but - # the canned expected-output file requires that __div__ etc get called. - testme.__coerce__(1) - testme.__div__(1) - testme.__coerce__(1) - testme.__rdiv__(1) - -testme % 1 -1 % testme - -divmod(testme,1) -divmod(1, testme) - -testme ** 1 -1 ** testme - -testme >> 1 -1 >> testme - -testme << 1 -1 << testme - -testme & 1 -1 & testme - -testme | 1 -1 | testme - -testme ^ 1 -1 ^ testme - - -# List/dict operations - -class Empty: pass - -try: - 1 in Empty() - print 'failed, should have raised TypeError' -except TypeError: - pass - -1 in testme - -testme[1] -testme[1] = 1 -del testme[1] - -testme[:42] -testme[:42] = "The Answer" -del testme[:42] - -testme[2:1024:10] -testme[2:1024:10] = "A lot" -del testme[2:1024:10] - -testme[:42, ..., :24:, 24, 100] -testme[:42, ..., :24:, 24, 100] = "Strange" -del testme[:42, ..., :24:, 24, 100] - - -# Now remove the slice hooks to see if converting normal slices to slice -# object works. - -del AllTests.__getslice__ -del AllTests.__setslice__ -del AllTests.__delslice__ - -import sys -if sys.platform[:4] != 'java': - testme[:42] - testme[:42] = "The Answer" - del testme[:42] -else: - # This works under Jython, but the actual slice values are - # different. - print "__getitem__: (slice(0, 42, None),)" - print "__setitem__: (slice(0, 42, None), 'The Answer')" - print "__delitem__: (slice(0, 42, None),)" - -# Unary operations - --testme -+testme -abs(testme) -int(testme) -long(testme) -float(testme) -oct(testme) -hex(testme) - -# And the rest... - -hash(testme) -repr(testme) -str(testme) - -testme == 1 -testme < 1 -testme > 1 -testme <> 1 -testme != 1 -1 == testme -1 < testme -1 > testme -1 <> testme -1 != testme - -# This test has to be last (duh.) - -del testme -if sys.platform[:4] == 'java': - import java - java.lang.System.gc() - -# Interfering tests - -class ExtraTests: - def __getattr__(self, *args): - print "__getattr__:", args - return "SomeVal" - - def __setattr__(self, *args): - print "__setattr__:", args - - def __delattr__(self, *args): - print "__delattr__:", args - -testme = ExtraTests() -testme.spam -testme.eggs = "spam, spam, spam and ham" -del testme.cardinal - - -# return values of some method are type-checked -class BadTypeClass: - def __int__(self): - return None - __float__ = __int__ - __long__ = __int__ - __str__ = __int__ - __repr__ = __int__ - __oct__ = __int__ - __hex__ = __int__ - -def check_exc(stmt, exception): - """Raise TestFailed if executing 'stmt' does not raise 'exception' - """ - try: - exec stmt - except exception: - pass - else: - raise TestFailed, "%s should raise %s" % (stmt, exception) - -check_exc("int(BadTypeClass())", TypeError) -check_exc("float(BadTypeClass())", TypeError) -check_exc("long(BadTypeClass())", TypeError) -check_exc("str(BadTypeClass())", TypeError) -check_exc("repr(BadTypeClass())", TypeError) -check_exc("oct(BadTypeClass())", TypeError) -check_exc("hex(BadTypeClass())", TypeError) - -# mixing up ints and longs is okay -class IntLongMixClass: - def __int__(self): - return 0L - - def __long__(self): - return 0 - -try: - int(IntLongMixClass()) -except TypeError: - raise TestFailed, "TypeError should not be raised" - -try: - long(IntLongMixClass()) -except TypeError: - raise TestFailed, "TypeError should not be raised" - - -# Test correct errors from hash() on objects with comparisons but no __hash__ - -class C0: - pass - -hash(C0()) # This should work; the next two should raise TypeError - -class C1: - def __cmp__(self, other): return 0 - -check_exc("hash(C1())", TypeError) - -class C2: - def __eq__(self, other): return 1 - -check_exc("hash(C2())", TypeError) - -# Test for SF bug 532646 - -class A: - pass -A.__call__ = A() -a = A() -try: - a() # This should not segfault -except RuntimeError: - pass -else: - raise TestFailed, "how could this not have overflowed the stack?" - - -# Tests for exceptions raised in instance_getattr2(). - -def booh(self): - raise AttributeError, "booh" - -class A: - a = property(booh) -try: - A().a # Raised AttributeError: A instance has no attribute 'a' -except AttributeError, x: - if str(x) != "booh": - print "attribute error for A().a got masked:", str(x) - -class E: - __eq__ = property(booh) -E() == E() # In debug mode, caused a C-level assert() to fail - -class I: - __init__ = property(booh) -try: - I() # In debug mode, printed XXX undetected error and raises AttributeError -except AttributeError, x: - pass -else: - print "attribute error for I.__init__ got masked" - - -# Test comparison and hash of methods -class A: - def __init__(self, x): - self.x = x - def f(self): - pass - def g(self): - pass - def __eq__(self, other): - return self.x == other.x - def __hash__(self): - return self.x -class B(A): - pass - -a1 = A(1) -a2 = A(2) -assert a1.f == a1.f -assert a1.f != a2.f -assert a1.f != a1.g -assert a1.f == A(1).f -assert hash(a1.f) == hash(a1.f) -assert hash(a1.f) == hash(A(1).f) - -assert A.f != a1.f -assert A.f != A.g -assert B.f == A.f -assert hash(B.f) == hash(A.f) - -# the following triggers a SystemError in 2.4 -a = A(hash(A.f.im_func)^(-1)) -hash(a.f) diff --git a/sys/lib/python/test/test_cmath.py b/sys/lib/python/test/test_cmath.py deleted file mode 100755 index 6e392928c..000000000 --- a/sys/lib/python/test/test_cmath.py +++ /dev/null @@ -1,52 +0,0 @@ -#! /usr/bin/env python -""" Simple test script for cmathmodule.c - Roger E. Masse -""" -import cmath, math -from test.test_support import verbose, verify, TestFailed - -verify(abs(cmath.log(10) - math.log(10)) < 1e-9) -verify(abs(cmath.log(10,2) - math.log(10,2)) < 1e-9) -try: - cmath.log('a') -except TypeError: - pass -else: - raise TestFailed - -try: - cmath.log(10, 'a') -except TypeError: - pass -else: - raise TestFailed - - -testdict = {'acos' : 1.0, - 'acosh' : 1.0, - 'asin' : 1.0, - 'asinh' : 1.0, - 'atan' : 0.2, - 'atanh' : 0.2, - 'cos' : 1.0, - 'cosh' : 1.0, - 'exp' : 1.0, - 'log' : 1.0, - 'log10' : 1.0, - 'sin' : 1.0, - 'sinh' : 1.0, - 'sqrt' : 1.0, - 'tan' : 1.0, - 'tanh' : 1.0} - -for func in testdict.keys(): - f = getattr(cmath, func) - r = f(testdict[func]) - if verbose: - print 'Calling %s(%f) = %f' % (func, testdict[func], abs(r)) - -p = cmath.pi -e = cmath.e -if verbose: - print 'PI = ', abs(p) - print 'E = ', abs(e) diff --git a/sys/lib/python/test/test_cmd_line.py b/sys/lib/python/test/test_cmd_line.py deleted file mode 100644 index cacae7a69..000000000 --- a/sys/lib/python/test/test_cmd_line.py +++ /dev/null @@ -1,93 +0,0 @@ - -import test.test_support, unittest -import sys -import popen2 -import subprocess - -class CmdLineTest(unittest.TestCase): - def start_python(self, cmd_line): - outfp, infp = popen2.popen4('"%s" %s' % (sys.executable, cmd_line)) - infp.close() - data = outfp.read() - outfp.close() - # try to cleanup the child so we don't appear to leak when running - # with regrtest -R. This should be a no-op on Windows. - popen2._cleanup() - return data - - def exit_code(self, *args): - cmd_line = [sys.executable] - cmd_line.extend(args) - return subprocess.call(cmd_line, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - - def test_directories(self): - self.assertNotEqual(self.exit_code('.'), 0) - self.assertNotEqual(self.exit_code('< .'), 0) - - def verify_valid_flag(self, cmd_line): - data = self.start_python(cmd_line) - self.assertTrue(data == '' or data.endswith('\n')) - self.assertTrue('Traceback' not in data) - - def test_environment(self): - self.verify_valid_flag('-E') - - def test_optimize(self): - self.verify_valid_flag('-O') - self.verify_valid_flag('-OO') - - def test_q(self): - self.verify_valid_flag('-Qold') - self.verify_valid_flag('-Qnew') - self.verify_valid_flag('-Qwarn') - self.verify_valid_flag('-Qwarnall') - - def test_site_flag(self): - self.verify_valid_flag('-S') - - def test_usage(self): - self.assertTrue('usage' in self.start_python('-h')) - - def test_version(self): - version = 'Python %d.%d' % sys.version_info[:2] - self.assertTrue(self.start_python('-V').startswith(version)) - - def test_run_module(self): - # Test expected operation of the '-m' switch - # Switch needs an argument - self.assertNotEqual(self.exit_code('-m'), 0) - # Check we get an error for a nonexistent module - self.assertNotEqual( - self.exit_code('-m', 'fnord43520xyz'), - 0) - # Check the runpy module also gives an error for - # a nonexistent module - self.assertNotEqual( - self.exit_code('-m', 'runpy', 'fnord43520xyz'), - 0) - # All good if module is located and run successfully - self.assertEqual( - self.exit_code('-m', 'timeit', '-n', '1'), - 0) - - def test_run_code(self): - # Test expected operation of the '-c' switch - # Switch needs an argument - self.assertNotEqual(self.exit_code('-c'), 0) - # Check we get an error for an uncaught exception - self.assertNotEqual( - self.exit_code('-c', 'raise Exception'), - 0) - # All good if execution is successful - self.assertEqual( - self.exit_code('-c', 'pass'), - 0) - - -def test_main(): - test.test_support.run_unittest(CmdLineTest) - test.test_support.reap_children() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_code.py b/sys/lib/python/test/test_code.py deleted file mode 100644 index 4e6863856..000000000 --- a/sys/lib/python/test/test_code.py +++ /dev/null @@ -1,102 +0,0 @@ -"""This module includes tests of the code object representation. - ->>> def f(x): -... def g(y): -... return x + y -... return g -... - ->>> dump(f.func_code) -name: f -argcount: 1 -names: () -varnames: ('x', 'g') -cellvars: ('x',) -freevars: () -nlocals: 2 -flags: 3 -consts: ('None', '') - ->>> dump(f(4).func_code) -name: g -argcount: 1 -names: () -varnames: ('y',) -cellvars: () -freevars: ('x',) -nlocals: 1 -flags: 19 -consts: ('None',) - ->>> def h(x, y): -... a = x + y -... b = x - y -... c = a * b -... return c -... ->>> dump(h.func_code) -name: h -argcount: 2 -names: () -varnames: ('x', 'y', 'a', 'b', 'c') -cellvars: () -freevars: () -nlocals: 5 -flags: 67 -consts: ('None',) - ->>> def attrs(obj): -... print obj.attr1 -... print obj.attr2 -... print obj.attr3 - ->>> dump(attrs.func_code) -name: attrs -argcount: 1 -names: ('attr1', 'attr2', 'attr3') -varnames: ('obj',) -cellvars: () -freevars: () -nlocals: 1 -flags: 67 -consts: ('None',) - ->>> def optimize_away(): -... 'doc string' -... 'not a docstring' -... 53 -... 53L - ->>> dump(optimize_away.func_code) -name: optimize_away -argcount: 0 -names: () -varnames: () -cellvars: () -freevars: () -nlocals: 0 -flags: 67 -consts: ("'doc string'", 'None') - -""" - -def consts(t): - """Yield a doctest-safe sequence of object reprs.""" - for elt in t: - r = repr(elt) - if r.startswith("" % elt.co_name - else: - yield r - -def dump(co): - """Print out a text representation of a code object.""" - for attr in ["name", "argcount", "names", "varnames", "cellvars", - "freevars", "nlocals", "flags"]: - print "%s: %s" % (attr, getattr(co, "co_" + attr)) - print "consts:", tuple(consts(co.co_consts)) - -def test_main(verbose=None): - from test.test_support import run_doctest - from test import test_code - run_doctest(test_code, verbose) diff --git a/sys/lib/python/test/test_codeccallbacks.py b/sys/lib/python/test/test_codeccallbacks.py deleted file mode 100644 index 159c86d10..000000000 --- a/sys/lib/python/test/test_codeccallbacks.py +++ /dev/null @@ -1,800 +0,0 @@ -import test.test_support, unittest -import sys, codecs, htmlentitydefs, unicodedata - -class PosReturn: - # this can be used for configurable callbacks - - def __init__(self): - self.pos = 0 - - def handle(self, exc): - oldpos = self.pos - realpos = oldpos - if realpos<0: - realpos = len(exc.object) + realpos - # if we don't advance this time, terminate on the next call - # otherwise we'd get an endless loop - if realpos <= exc.start: - self.pos = len(exc.object) - return (u"", oldpos) - -# A UnicodeEncodeError object with a bad start attribute -class BadStartUnicodeEncodeError(UnicodeEncodeError): - def __init__(self): - UnicodeEncodeError.__init__(self, "ascii", u"", 0, 1, "bad") - self.start = [] - -# A UnicodeEncodeError object with a bad object attribute -class BadObjectUnicodeEncodeError(UnicodeEncodeError): - def __init__(self): - UnicodeEncodeError.__init__(self, "ascii", u"", 0, 1, "bad") - self.object = [] - -# A UnicodeDecodeError object without an end attribute -class NoEndUnicodeDecodeError(UnicodeDecodeError): - def __init__(self): - UnicodeDecodeError.__init__(self, "ascii", "", 0, 1, "bad") - del self.end - -# A UnicodeDecodeError object with a bad object attribute -class BadObjectUnicodeDecodeError(UnicodeDecodeError): - def __init__(self): - UnicodeDecodeError.__init__(self, "ascii", "", 0, 1, "bad") - self.object = [] - -# A UnicodeTranslateError object without a start attribute -class NoStartUnicodeTranslateError(UnicodeTranslateError): - def __init__(self): - UnicodeTranslateError.__init__(self, u"", 0, 1, "bad") - del self.start - -# A UnicodeTranslateError object without an end attribute -class NoEndUnicodeTranslateError(UnicodeTranslateError): - def __init__(self): - UnicodeTranslateError.__init__(self, u"", 0, 1, "bad") - del self.end - -# A UnicodeTranslateError object without an object attribute -class NoObjectUnicodeTranslateError(UnicodeTranslateError): - def __init__(self): - UnicodeTranslateError.__init__(self, u"", 0, 1, "bad") - del self.object - -class CodecCallbackTest(unittest.TestCase): - - def test_xmlcharrefreplace(self): - # replace unencodable characters which numeric character entities. - # For ascii, latin-1 and charmaps this is completely implemented - # in C and should be reasonably fast. - s = u"\u30b9\u30d1\u30e2 \xe4nd eggs" - self.assertEqual( - s.encode("ascii", "xmlcharrefreplace"), - "スパモ änd eggs" - ) - self.assertEqual( - s.encode("latin-1", "xmlcharrefreplace"), - "スパモ \xe4nd eggs" - ) - - def test_xmlcharnamereplace(self): - # This time use a named character entity for unencodable - # characters, if one is available. - - def xmlcharnamereplace(exc): - if not isinstance(exc, UnicodeEncodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [] - for c in exc.object[exc.start:exc.end]: - try: - l.append(u"&%s;" % htmlentitydefs.codepoint2name[ord(c)]) - except KeyError: - l.append(u"&#%d;" % ord(c)) - return (u"".join(l), exc.end) - - codecs.register_error( - "test.xmlcharnamereplace", xmlcharnamereplace) - - sin = u"\xab\u211c\xbb = \u2329\u1234\u20ac\u232a" - sout = "«ℜ» = ⟨ሴ€⟩" - self.assertEqual(sin.encode("ascii", "test.xmlcharnamereplace"), sout) - sout = "\xabℜ\xbb = ⟨ሴ€⟩" - self.assertEqual(sin.encode("latin-1", "test.xmlcharnamereplace"), sout) - sout = "\xabℜ\xbb = ⟨ሴ\xa4⟩" - self.assertEqual(sin.encode("iso-8859-15", "test.xmlcharnamereplace"), sout) - - def test_uninamereplace(self): - # We're using the names from the unicode database this time, - # and we're doing "syntax highlighting" here, i.e. we include - # the replaced text in ANSI escape sequences. For this it is - # useful that the error handler is not called for every single - # unencodable character, but for a complete sequence of - # unencodable characters, otherwise we would output many - # unneccessary escape sequences. - - def uninamereplace(exc): - if not isinstance(exc, UnicodeEncodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [] - for c in exc.object[exc.start:exc.end]: - l.append(unicodedata.name(c, u"0x%x" % ord(c))) - return (u"\033[1m%s\033[0m" % u", ".join(l), exc.end) - - codecs.register_error( - "test.uninamereplace", uninamereplace) - - sin = u"\xac\u1234\u20ac\u8000" - sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(sin.encode("ascii", "test.uninamereplace"), sout) - - sout = "\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(sin.encode("latin-1", "test.uninamereplace"), sout) - - sout = "\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1mCJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(sin.encode("iso-8859-15", "test.uninamereplace"), sout) - - def test_backslashescape(self): - # Does the same as the "unicode-escape" encoding, but with different - # base encodings. - sin = u"a\xac\u1234\u20ac\u8000" - if sys.maxunicode > 0xffff: - sin += unichr(sys.maxunicode) - sout = "a\\xac\\u1234\\u20ac\\u8000" - if sys.maxunicode > 0xffff: - sout += "\\U%08x" % sys.maxunicode - self.assertEqual(sin.encode("ascii", "backslashreplace"), sout) - - sout = "a\xac\\u1234\\u20ac\\u8000" - if sys.maxunicode > 0xffff: - sout += "\\U%08x" % sys.maxunicode - self.assertEqual(sin.encode("latin-1", "backslashreplace"), sout) - - sout = "a\xac\\u1234\xa4\\u8000" - if sys.maxunicode > 0xffff: - sout += "\\U%08x" % sys.maxunicode - self.assertEqual(sin.encode("iso-8859-15", "backslashreplace"), sout) - - def test_decoderelaxedutf8(self): - # This is the test for a decoding callback handler, - # that relaxes the UTF-8 minimal encoding restriction. - # A null byte that is encoded as "\xc0\x80" will be - # decoded as a null byte. All other illegal sequences - # will be handled strictly. - def relaxedutf8(exc): - if not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - if exc.object[exc.start:exc.end].startswith("\xc0\x80"): - return (u"\x00", exc.start+2) # retry after two bytes - else: - raise exc - - codecs.register_error( - "test.relaxedutf8", relaxedutf8) - - sin = "a\x00b\xc0\x80c\xc3\xbc\xc0\x80\xc0\x80" - sout = u"a\x00b\x00c\xfc\x00\x00" - self.assertEqual(sin.decode("utf-8", "test.relaxedutf8"), sout) - sin = "\xc0\x80\xc0\x81" - self.assertRaises(UnicodeError, sin.decode, "utf-8", "test.relaxedutf8") - - def test_charmapencode(self): - # For charmap encodings the replacement string will be - # mapped through the encoding again. This means, that - # to be able to use e.g. the "replace" handler, the - # charmap has to have a mapping for "?". - charmap = dict([ (ord(c), 2*c.upper()) for c in "abcdefgh"]) - sin = u"abc" - sout = "AABBCC" - self.assertEquals(codecs.charmap_encode(sin, "strict", charmap)[0], sout) - - sin = u"abcA" - self.assertRaises(UnicodeError, codecs.charmap_encode, sin, "strict", charmap) - - charmap[ord("?")] = "XYZ" - sin = u"abcDEF" - sout = "AABBCCXYZXYZXYZ" - self.assertEquals(codecs.charmap_encode(sin, "replace", charmap)[0], sout) - - charmap[ord("?")] = u"XYZ" - self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) - - charmap[ord("?")] = u"XYZ" - self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) - - def test_decodeunicodeinternal(self): - self.assertRaises( - UnicodeDecodeError, - "\x00\x00\x00\x00\x00".decode, - "unicode-internal", - ) - if sys.maxunicode > 0xffff: - def handler_unicodeinternal(exc): - if not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - return (u"\x01", 1) - - self.assertEqual( - "\x00\x00\x00\x00\x00".decode("unicode-internal", "ignore"), - u"\u0000" - ) - - self.assertEqual( - "\x00\x00\x00\x00\x00".decode("unicode-internal", "replace"), - u"\u0000\ufffd" - ) - - codecs.register_error("test.hui", handler_unicodeinternal) - - self.assertEqual( - "\x00\x00\x00\x00\x00".decode("unicode-internal", "test.hui"), - u"\u0000\u0001\u0000" - ) - - def test_callbacks(self): - def handler1(exc): - if not isinstance(exc, UnicodeEncodeError) \ - and not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] - return (u"[%s]" % u"".join(l), exc.end) - - codecs.register_error("test.handler1", handler1) - - def handler2(exc): - if not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] - return (u"[%s]" % u"".join(l), exc.end+1) # skip one character - - codecs.register_error("test.handler2", handler2) - - s = "\x00\x81\x7f\x80\xff" - - self.assertEqual( - s.decode("ascii", "test.handler1"), - u"\x00[<129>]\x7f[<128>][<255>]" - ) - self.assertEqual( - s.decode("ascii", "test.handler2"), - u"\x00[<129>][<128>]" - ) - - self.assertEqual( - "\\u3042\u3xxx".decode("unicode-escape", "test.handler1"), - u"\u3042[<92><117><51><120>]xx" - ) - - self.assertEqual( - "\\u3042\u3xx".decode("unicode-escape", "test.handler1"), - u"\u3042[<92><117><51><120><120>]" - ) - - self.assertEqual( - codecs.charmap_decode("abc", "test.handler1", {ord("a"): u"z"})[0], - u"z[<98>][<99>]" - ) - - self.assertEqual( - u"g\xfc\xdfrk".encode("ascii", "test.handler1"), - u"g[<252><223>]rk" - ) - - self.assertEqual( - u"g\xfc\xdf".encode("ascii", "test.handler1"), - u"g[<252><223>]" - ) - - def test_longstrings(self): - # test long strings to check for memory overflow problems - errors = [ "strict", "ignore", "replace", "xmlcharrefreplace", "backslashreplace"] - # register the handlers under different names, - # to prevent the codec from recognizing the name - for err in errors: - codecs.register_error("test." + err, codecs.lookup_error(err)) - l = 1000 - errors += [ "test." + err for err in errors ] - for uni in [ s*l for s in (u"x", u"\u3042", u"a\xe4") ]: - for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): - for err in errors: - try: - uni.encode(enc, err) - except UnicodeError: - pass - - def check_exceptionobjectargs(self, exctype, args, msg): - # Test UnicodeError subclasses: construction, attribute assignment and __str__ conversion - # check with one missing argument - self.assertRaises(TypeError, exctype, *args[:-1]) - # check with one argument too much - self.assertRaises(TypeError, exctype, *(args + ["too much"])) - # check with one argument of the wrong type - wrongargs = [ "spam", u"eggs", 42, 1.0, None ] - for i in xrange(len(args)): - for wrongarg in wrongargs: - if type(wrongarg) is type(args[i]): - continue - # build argument array - callargs = [] - for j in xrange(len(args)): - if i==j: - callargs.append(wrongarg) - else: - callargs.append(args[i]) - self.assertRaises(TypeError, exctype, *callargs) - - # check with the correct number and type of arguments - exc = exctype(*args) - self.assertEquals(str(exc), msg) - - def test_unicodeencodeerror(self): - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 2, "ouch"], - "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 4, "ouch"], - "'ascii' codec can't encode characters in position 1-3: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\xfcx", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\u0100x", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\uffffx", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" - ) - if sys.maxunicode > 0xffff: - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\U00010000x", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" - ) - - def test_unicodedecodeerror(self): - self.check_exceptionobjectargs( - UnicodeDecodeError, - ["ascii", "g\xfcrk", 1, 2, "ouch"], - "'ascii' codec can't decode byte 0xfc in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeDecodeError, - ["ascii", "g\xfcrk", 1, 3, "ouch"], - "'ascii' codec can't decode bytes in position 1-2: ouch" - ) - - def test_unicodetranslateerror(self): - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\xfcrk", 1, 2, "ouch"], - "can't translate character u'\\xfc' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\u0100rk", 1, 2, "ouch"], - "can't translate character u'\\u0100' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\uffffrk", 1, 2, "ouch"], - "can't translate character u'\\uffff' in position 1: ouch" - ) - if sys.maxunicode > 0xffff: - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\U00010000rk", 1, 2, "ouch"], - "can't translate character u'\\U00010000' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\xfcrk", 1, 3, "ouch"], - "can't translate characters in position 1-2: ouch" - ) - - def test_badandgoodstrictexceptions(self): - # "strict" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.strict_errors, - 42 - ) - # "strict" complains about the wrong exception type - self.assertRaises( - Exception, - codecs.strict_errors, - Exception("ouch") - ) - - # If the correct exception is passed in, "strict" raises it - self.assertRaises( - UnicodeEncodeError, - codecs.strict_errors, - UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch") - ) - - def test_badandgoodignoreexceptions(self): - # "ignore" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.ignore_errors, - 42 - ) - # "ignore" complains about the wrong exception type - self.assertRaises( - TypeError, - codecs.ignore_errors, - UnicodeError("ouch") - ) - # If the correct exception is passed in, "ignore" returns an empty replacement - self.assertEquals( - codecs.ignore_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"", 1) - ) - self.assertEquals( - codecs.ignore_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), - (u"", 1) - ) - self.assertEquals( - codecs.ignore_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), - (u"", 1) - ) - - def test_badandgoodreplaceexceptions(self): - # "replace" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.replace_errors, - 42 - ) - # "replace" complains about the wrong exception type - self.assertRaises( - TypeError, - codecs.replace_errors, - UnicodeError("ouch") - ) - self.assertRaises( - TypeError, - codecs.replace_errors, - BadObjectUnicodeEncodeError() - ) - self.assertRaises( - TypeError, - codecs.replace_errors, - BadObjectUnicodeDecodeError() - ) - # With the correct exception, "replace" returns an "?" or u"\ufffd" replacement - self.assertEquals( - codecs.replace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"?", 1) - ) - self.assertEquals( - codecs.replace_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), - (u"\ufffd", 1) - ) - self.assertEquals( - codecs.replace_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), - (u"\ufffd", 1) - ) - - def test_badandgoodxmlcharrefreplaceexceptions(self): - # "xmlcharrefreplace" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - 42 - ) - # "xmlcharrefreplace" complains about the wrong exception types - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - UnicodeError("ouch") - ) - # "xmlcharrefreplace" can only be used for encoding - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") - ) - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - UnicodeTranslateError(u"\u3042", 0, 1, "ouch") - ) - # Use the correct exception - cs = (0, 1, 9, 10, 99, 100, 999, 1000, 9999, 10000, 0x3042) - s = "".join(unichr(c) for c in cs) - self.assertEquals( - codecs.xmlcharrefreplace_errors( - UnicodeEncodeError("ascii", s, 0, len(s), "ouch") - ), - (u"".join(u"&#%d;" % ord(c) for c in s), len(s)) - ) - - def test_badandgoodbackslashreplaceexceptions(self): - # "backslashreplace" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - 42 - ) - # "backslashreplace" complains about the wrong exception types - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - UnicodeError("ouch") - ) - # "backslashreplace" can only be used for encoding - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") - ) - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - UnicodeTranslateError(u"\u3042", 0, 1, "ouch") - ) - # Use the correct exception - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"\\u3042", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\x00", 0, 1, "ouch")), - (u"\\x00", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\xff", 0, 1, "ouch")), - (u"\\xff", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u0100", 0, 1, "ouch")), - (u"\\u0100", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\uffff", 0, 1, "ouch")), - (u"\\uffff", 1) - ) - if sys.maxunicode>0xffff: - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U00010000", 0, 1, "ouch")), - (u"\\U00010000", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U0010ffff", 0, 1, "ouch")), - (u"\\U0010ffff", 1) - ) - - def test_badhandlerresults(self): - results = ( 42, u"foo", (1,2,3), (u"foo", 1, 3), (u"foo", None), (u"foo",), ("foo", 1, 3), ("foo", None), ("foo",) ) - encs = ("ascii", "latin-1", "iso-8859-1", "iso-8859-15") - - for res in results: - codecs.register_error("test.badhandler", lambda: res) - for enc in encs: - self.assertRaises( - TypeError, - u"\u3042".encode, - enc, - "test.badhandler" - ) - for (enc, bytes) in ( - ("ascii", "\xff"), - ("utf-8", "\xff"), - ("utf-7", "+x-"), - ("unicode-internal", "\x00"), - ): - self.assertRaises( - TypeError, - bytes.decode, - enc, - "test.badhandler" - ) - - def test_lookup(self): - self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) - self.assertEquals(codecs.ignore_errors, codecs.lookup_error("ignore")) - self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) - self.assertEquals( - codecs.xmlcharrefreplace_errors, - codecs.lookup_error("xmlcharrefreplace") - ) - self.assertEquals( - codecs.backslashreplace_errors, - codecs.lookup_error("backslashreplace") - ) - - def test_unencodablereplacement(self): - def unencrepl(exc): - if isinstance(exc, UnicodeEncodeError): - return (u"\u4242", exc.end) - else: - raise TypeError("don't know how to handle %r" % exc) - codecs.register_error("test.unencreplhandler", unencrepl) - for enc in ("ascii", "iso-8859-1", "iso-8859-15"): - self.assertRaises( - UnicodeEncodeError, - u"\u4242".encode, - enc, - "test.unencreplhandler" - ) - - def test_badregistercall(self): - # enhance coverage of: - # Modules/_codecsmodule.c::register_error() - # Python/codecs.c::PyCodec_RegisterError() - self.assertRaises(TypeError, codecs.register_error, 42) - self.assertRaises(TypeError, codecs.register_error, "test.dummy", 42) - - def test_badlookupcall(self): - # enhance coverage of: - # Modules/_codecsmodule.c::lookup_error() - self.assertRaises(TypeError, codecs.lookup_error) - - def test_unknownhandler(self): - # enhance coverage of: - # Modules/_codecsmodule.c::lookup_error() - self.assertRaises(LookupError, codecs.lookup_error, "test.unknown") - - def test_xmlcharrefvalues(self): - # enhance coverage of: - # Python/codecs.c::PyCodec_XMLCharRefReplaceErrors() - # and inline implementations - v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000) - if sys.maxunicode>=100000: - v += (100000, 500000, 1000000) - s = u"".join([unichr(x) for x in v]) - codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) - for enc in ("ascii", "iso-8859-15"): - for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): - s.encode(enc, err) - - def test_decodehelper(self): - # enhance coverage of: - # Objects/unicodeobject.c::unicode_decode_call_errorhandler() - # and callers - self.assertRaises(LookupError, "\xff".decode, "ascii", "test.unknown") - - def baddecodereturn1(exc): - return 42 - codecs.register_error("test.baddecodereturn1", baddecodereturn1) - self.assertRaises(TypeError, "\xff".decode, "ascii", "test.baddecodereturn1") - self.assertRaises(TypeError, "\\".decode, "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, "\\x0".decode, "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, "\\x0y".decode, "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, "\\Uffffeeee".decode, "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, "\\uyyyy".decode, "raw-unicode-escape", "test.baddecodereturn1") - - def baddecodereturn2(exc): - return (u"?", None) - codecs.register_error("test.baddecodereturn2", baddecodereturn2) - self.assertRaises(TypeError, "\xff".decode, "ascii", "test.baddecodereturn2") - - handler = PosReturn() - codecs.register_error("test.posreturn", handler.handle) - - # Valid negative position - handler.pos = -1 - self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"0") - - # Valid negative position - handler.pos = -2 - self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"") - - # Negative position out of bounds - handler.pos = -3 - self.assertRaises(IndexError, "\xff0".decode, "ascii", "test.posreturn") - - # Valid positive position - handler.pos = 1 - self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"0") - - # Largest valid positive position (one beyond end of input) - handler.pos = 2 - self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"") - - # Invalid positive position - handler.pos = 3 - self.assertRaises(IndexError, "\xff0".decode, "ascii", "test.posreturn") - - # Restart at the "0" - handler.pos = 6 - self.assertEquals("\\uyyyy0".decode("raw-unicode-escape", "test.posreturn"), u"0") - - class D(dict): - def __getitem__(self, key): - raise ValueError - self.assertRaises(UnicodeError, codecs.charmap_decode, "\xff", "strict", {0xff: None}) - self.assertRaises(ValueError, codecs.charmap_decode, "\xff", "strict", D()) - self.assertRaises(TypeError, codecs.charmap_decode, "\xff", "strict", {0xff: sys.maxunicode+1}) - - def test_encodehelper(self): - # enhance coverage of: - # Objects/unicodeobject.c::unicode_encode_call_errorhandler() - # and callers - self.assertRaises(LookupError, u"\xff".encode, "ascii", "test.unknown") - - def badencodereturn1(exc): - return 42 - codecs.register_error("test.badencodereturn1", badencodereturn1) - self.assertRaises(TypeError, u"\xff".encode, "ascii", "test.badencodereturn1") - - def badencodereturn2(exc): - return (u"?", None) - codecs.register_error("test.badencodereturn2", badencodereturn2) - self.assertRaises(TypeError, u"\xff".encode, "ascii", "test.badencodereturn2") - - handler = PosReturn() - codecs.register_error("test.posreturn", handler.handle) - - # Valid negative position - handler.pos = -1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") - - # Valid negative position - handler.pos = -2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") - - # Negative position out of bounds - handler.pos = -3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") - - # Valid positive position - handler.pos = 1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") - - # Largest valid positive position (one beyond end of input - handler.pos = 2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") - - # Invalid positive position - handler.pos = 3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") - - handler.pos = 0 - - class D(dict): - def __getitem__(self, key): - raise ValueError - for err in ("strict", "replace", "xmlcharrefreplace", "backslashreplace", "test.posreturn"): - self.assertRaises(UnicodeError, codecs.charmap_encode, u"\xff", err, {0xff: None}) - self.assertRaises(ValueError, codecs.charmap_encode, u"\xff", err, D()) - self.assertRaises(TypeError, codecs.charmap_encode, u"\xff", err, {0xff: 300}) - - def test_translatehelper(self): - # enhance coverage of: - # Objects/unicodeobject.c::unicode_encode_call_errorhandler() - # and callers - # (Unfortunately the errors argument is not directly accessible - # from Python, so we can't test that much) - class D(dict): - def __getitem__(self, key): - raise ValueError - self.assertRaises(ValueError, u"\xff".translate, D()) - self.assertRaises(TypeError, u"\xff".translate, {0xff: sys.maxunicode+1}) - self.assertRaises(TypeError, u"\xff".translate, {0xff: ()}) - - def test_bug828737(self): - charmap = { - ord("&"): u"&", - ord("<"): u"<", - ord(">"): u">", - ord('"'): u""", - } - - for n in (1, 10, 100, 1000): - text = u'abcghi'*n - text.translate(charmap) - -def test_main(): - test.test_support.run_unittest(CodecCallbackTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecencodings_cn.py b/sys/lib/python/test/test_codecencodings_cn.py deleted file mode 100644 index c558f1bb9..000000000 --- a/sys/lib/python/test/test_codecencodings_cn.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -# test_codecencodings_cn.py -# Codec encoding tests for PRC encodings. -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class Test_GB2312(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'gb2312' - tstring = test_multibytecodec_support.load_teststring('gb2312') - codectests = ( - # invalid bytes - ("abc\x81\x81\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x81\x81\xc1\xc4", "replace", u"abc\ufffd\u804a"), - ("abc\x81\x81\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"), - ("abc\x81\x81\xc1\xc4", "ignore", u"abc\u804a"), - ("\xc1\x64", "strict", None), - ) - -class Test_GBK(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'gbk' - tstring = test_multibytecodec_support.load_teststring('gbk') - codectests = ( - # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u804a"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u804a"), - ("\x83\x34\x83\x31", "strict", None), - (u"\u30fb", "strict", None), - ) - -class Test_GB18030(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'gb18030' - tstring = test_multibytecodec_support.load_teststring('gb18030') - codectests = ( - # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u804a"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u804a"), - ("abc\x84\x39\x84\x39\xc1\xc4", "replace", u"abc\ufffd\u804a"), - (u"\u30fb", "strict", "\x819\xa79"), - ) - has_iso10646 = True - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_GB2312)) - suite.addTest(unittest.makeSuite(Test_GBK)) - suite.addTest(unittest.makeSuite(Test_GB18030)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecencodings_hk.py b/sys/lib/python/test/test_codecencodings_hk.py deleted file mode 100644 index 1cd020fc3..000000000 --- a/sys/lib/python/test/test_codecencodings_hk.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python -# -# test_codecencodings_hk.py -# Codec encoding tests for HongKong encodings. -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class Test_Big5HKSCS(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'big5hkscs' - tstring = test_multibytecodec_support.load_teststring('big5hkscs') - codectests = ( - # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u8b10"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u8b10\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u8b10"), - ) - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_Big5HKSCS)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecencodings_jp.py b/sys/lib/python/test/test_codecencodings_jp.py deleted file mode 100644 index 558598a95..000000000 --- a/sys/lib/python/test/test_codecencodings_jp.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python -# -# test_codecencodings_jp.py -# Codec encoding tests for Japanese encodings. -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class Test_CP932(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'cp932' - tstring = test_multibytecodec_support.load_teststring('shift_jis') - codectests = ( - # invalid bytes - ("abc\x81\x00\x81\x00\x82\x84", "strict", None), - ("abc\xf8", "strict", None), - ("abc\x81\x00\x82\x84", "replace", u"abc\ufffd\uff44"), - ("abc\x81\x00\x82\x84\x88", "replace", u"abc\ufffd\uff44\ufffd"), - ("abc\x81\x00\x82\x84", "ignore", u"abc\uff44"), - # sjis vs cp932 - ("\\\x7e", "replace", u"\\\x7e"), - ("\x81\x5f\x81\x61\x81\x7c", "replace", u"\uff3c\u2225\uff0d"), - ) - -class Test_EUC_JISX0213(test_multibytecodec_support.TestBase, - unittest.TestCase): - encoding = 'euc_jisx0213' - tstring = test_multibytecodec_support.load_teststring('euc_jisx0213') - codectests = ( - # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u7956"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u7956\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u7956"), - ("abc\x8f\x83\x83", "replace", u"abc\ufffd"), - ("\xc1\x64", "strict", None), - ("\xa1\xc0", "strict", u"\uff3c"), - ) - xmlcharnametest = ( - u"\xab\u211c\xbb = \u2329\u1234\u232a", - "\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩" - ) - -eucjp_commontests = ( - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u7956"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u7956\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u7956"), - ("abc\x8f\x83\x83", "replace", u"abc\ufffd"), - ("\xc1\x64", "strict", None), -) - -class Test_EUC_JP_COMPAT(test_multibytecodec_support.TestBase, - unittest.TestCase): - encoding = 'euc_jp' - tstring = test_multibytecodec_support.load_teststring('euc_jp') - codectests = eucjp_commontests + ( - ("\xa1\xc0\\", "strict", u"\uff3c\\"), - (u"\xa5", "strict", "\x5c"), - (u"\u203e", "strict", "\x7e"), - ) - -shiftjis_commonenctests = ( - ("abc\x80\x80\x82\x84", "strict", None), - ("abc\xf8", "strict", None), - ("abc\x80\x80\x82\x84", "replace", u"abc\ufffd\uff44"), - ("abc\x80\x80\x82\x84\x88", "replace", u"abc\ufffd\uff44\ufffd"), - ("abc\x80\x80\x82\x84def", "ignore", u"abc\uff44def"), -) - -class Test_SJIS_COMPAT(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'shift_jis' - tstring = test_multibytecodec_support.load_teststring('shift_jis') - codectests = shiftjis_commonenctests + ( - ("\\\x7e", "strict", u"\\\x7e"), - ("\x81\x5f\x81\x61\x81\x7c", "strict", u"\uff3c\u2016\u2212"), - ) - -class Test_SJISX0213(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'shift_jisx0213' - tstring = test_multibytecodec_support.load_teststring('shift_jisx0213') - codectests = ( - # invalid bytes - ("abc\x80\x80\x82\x84", "strict", None), - ("abc\xf8", "strict", None), - ("abc\x80\x80\x82\x84", "replace", u"abc\ufffd\uff44"), - ("abc\x80\x80\x82\x84\x88", "replace", u"abc\ufffd\uff44\ufffd"), - ("abc\x80\x80\x82\x84def", "ignore", u"abc\uff44def"), - # sjis vs cp932 - ("\\\x7e", "replace", u"\xa5\u203e"), - ("\x81\x5f\x81\x61\x81\x7c", "replace", u"\x5c\u2016\u2212"), - ) - xmlcharnametest = ( - u"\xab\u211c\xbb = \u2329\u1234\u232a", - "\x85Gℜ\x85Q = ⟨ሴ⟩" - ) - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_CP932)) - suite.addTest(unittest.makeSuite(Test_EUC_JISX0213)) - suite.addTest(unittest.makeSuite(Test_EUC_JP_COMPAT)) - suite.addTest(unittest.makeSuite(Test_SJIS_COMPAT)) - suite.addTest(unittest.makeSuite(Test_SJISX0213)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecencodings_kr.py b/sys/lib/python/test/test_codecencodings_kr.py deleted file mode 100644 index 8139f76bc..000000000 --- a/sys/lib/python/test/test_codecencodings_kr.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# -# test_codecencodings_kr.py -# Codec encoding tests for ROK encodings. -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class Test_CP949(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'cp949' - tstring = test_multibytecodec_support.load_teststring('cp949') - codectests = ( - # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\uc894"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\uc894\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\uc894"), - ) - -class Test_EUCKR(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'euc_kr' - tstring = test_multibytecodec_support.load_teststring('euc_kr') - codectests = ( - # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\uc894"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\uc894\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\uc894"), - ) - -class Test_JOHAB(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'johab' - tstring = test_multibytecodec_support.load_teststring('johab') - codectests = ( - # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\ucd27"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\ucd27\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\ucd27"), - ) - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_CP949)) - suite.addTest(unittest.makeSuite(Test_EUCKR)) - suite.addTest(unittest.makeSuite(Test_JOHAB)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecencodings_tw.py b/sys/lib/python/test/test_codecencodings_tw.py deleted file mode 100644 index 7c59478bd..000000000 --- a/sys/lib/python/test/test_codecencodings_tw.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python -# -# test_codecencodings_tw.py -# Codec encoding tests for ROC encodings. -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class Test_Big5(test_multibytecodec_support.TestBase, unittest.TestCase): - encoding = 'big5' - tstring = test_multibytecodec_support.load_teststring('big5') - codectests = ( - # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u8b10"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u8b10\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u8b10"), - ) - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_Big5)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecmaps_cn.py b/sys/lib/python/test/test_codecmaps_cn.py deleted file mode 100644 index 8cbee766c..000000000 --- a/sys/lib/python/test/test_codecmaps_cn.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python -# -# test_codecmaps_cn.py -# Codec mapping tests for PRC encodings -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class TestGB2312Map(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'gb2312' - mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-CN.TXT' - -class TestGBKMap(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'gbk' - mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/' \ - 'MICSFT/WINDOWS/CP936.TXT' - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestGB2312Map)) - suite.addTest(unittest.makeSuite(TestGBKMap)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecmaps_hk.py b/sys/lib/python/test/test_codecmaps_hk.py deleted file mode 100644 index e7f7b9673..000000000 --- a/sys/lib/python/test/test_codecmaps_hk.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -# -# test_codecmaps_hk.py -# Codec mapping tests for HongKong encodings -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class TestBig5HKSCSMap(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'big5hkscs' - mapfileurl = 'http://people.freebsd.org/~perky/i18n/BIG5HKSCS.TXT' - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestBig5HKSCSMap)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecmaps_jp.py b/sys/lib/python/test/test_codecmaps_jp.py deleted file mode 100644 index 08052d43a..000000000 --- a/sys/lib/python/test/test_codecmaps_jp.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# -# test_codecmaps_jp.py -# Codec mapping tests for Japanese encodings -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class TestCP932Map(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'cp932' - mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \ - 'WINDOWS/CP932.TXT' - supmaps = [ - ('\x80', u'\u0080'), - ('\xa0', u'\uf8f0'), - ('\xfd', u'\uf8f1'), - ('\xfe', u'\uf8f2'), - ('\xff', u'\uf8f3'), - ] - for i in range(0xa1, 0xe0): - supmaps.append((chr(i), unichr(i+0xfec0))) - - -class TestEUCJPCOMPATMap(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'euc_jp' - mapfilename = 'EUC-JP.TXT' - mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-JP.TXT' - - -class TestSJISCOMPATMap(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'shift_jis' - mapfilename = 'SHIFTJIS.TXT' - mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE' \ - '/EASTASIA/JIS/SHIFTJIS.TXT' - pass_enctest = [ - ('\x81_', u'\\'), - ] - pass_dectest = [ - ('\\', u'\xa5'), - ('~', u'\u203e'), - ('\x81_', u'\\'), - ] - -class TestEUCJISX0213Map(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'euc_jisx0213' - mapfilename = 'EUC-JISX0213.TXT' - mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-JISX0213.TXT' - - -class TestSJISX0213Map(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'shift_jisx0213' - mapfilename = 'SHIFT_JISX0213.TXT' - mapfileurl = 'http://people.freebsd.org/~perky/i18n/SHIFT_JISX0213.TXT' - - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestCP932Map)) - suite.addTest(unittest.makeSuite(TestEUCJPCOMPATMap)) - suite.addTest(unittest.makeSuite(TestSJISCOMPATMap)) - suite.addTest(unittest.makeSuite(TestEUCJISX0213Map)) - suite.addTest(unittest.makeSuite(TestSJISX0213Map)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecmaps_kr.py b/sys/lib/python/test/test_codecmaps_kr.py deleted file mode 100644 index 7484a6620..000000000 --- a/sys/lib/python/test/test_codecmaps_kr.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -# -# test_codecmaps_kr.py -# Codec mapping tests for ROK encodings -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class TestCP949Map(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'cp949' - mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT' \ - '/WINDOWS/CP949.TXT' - - -class TestEUCKRMap(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'euc_kr' - mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-KR.TXT' - - -class TestJOHABMap(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'johab' - mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/' \ - 'KSC/JOHAB.TXT' - # KS X 1001 standard assigned 0x5c as WON SIGN. - # but, in early 90s that is the only era used johab widely, - # the most softwares implements it as REVERSE SOLIDUS. - # So, we ignore the standard here. - pass_enctest = [('\\', u'\u20a9')] - pass_dectest = [('\\', u'\u20a9')] - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestCP949Map)) - suite.addTest(unittest.makeSuite(TestEUCKRMap)) - suite.addTest(unittest.makeSuite(TestJOHABMap)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecmaps_tw.py b/sys/lib/python/test/test_codecmaps_tw.py deleted file mode 100644 index 0b195f47d..000000000 --- a/sys/lib/python/test/test_codecmaps_tw.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python -# -# test_codecmaps_tw.py -# Codec mapping tests for ROC encodings -# - -from test import test_support -from test import test_multibytecodec_support -import unittest - -class TestBIG5Map(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'big5' - mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE/' \ - 'EASTASIA/OTHER/BIG5.TXT' - -class TestCP950Map(test_multibytecodec_support.TestBase_Mapping, - unittest.TestCase): - encoding = 'cp950' - mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \ - 'WINDOWS/CP950.TXT' - pass_enctest = [ - ('\xa2\xcc', u'\u5341'), - ('\xa2\xce', u'\u5345'), - ] - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestBIG5Map)) - suite.addTest(unittest.makeSuite(TestCP950Map)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codecs.py b/sys/lib/python/test/test_codecs.py deleted file mode 100644 index 185670bb1..000000000 --- a/sys/lib/python/test/test_codecs.py +++ /dev/null @@ -1,1279 +0,0 @@ -from __future__ import with_statement -from test import test_support -import unittest -import codecs -import sys, StringIO, _testcapi - -class Queue(object): - """ - queue: write bytes at one end, read bytes from the other end - """ - def __init__(self): - self._buffer = "" - - def write(self, chars): - self._buffer += chars - - def read(self, size=-1): - if size<0: - s = self._buffer - self._buffer = "" - return s - else: - s = self._buffer[:size] - self._buffer = self._buffer[size:] - return s - -class ReadTest(unittest.TestCase): - def check_partial(self, input, partialresults): - # get a StreamReader for the encoding and feed the bytestring version - # of input to the reader byte by byte. Read every available from - # the StreamReader and check that the results equal the appropriate - # entries from partialresults. - q = Queue() - r = codecs.getreader(self.encoding)(q) - result = u"" - for (c, partialresult) in zip(input.encode(self.encoding), partialresults): - q.write(c) - result += r.read() - self.assertEqual(result, partialresult) - # check that there's nothing left in the buffers - self.assertEqual(r.read(), u"") - self.assertEqual(r.bytebuffer, "") - self.assertEqual(r.charbuffer, u"") - - # do the check again, this time using a incremental decoder - d = codecs.getincrementaldecoder(self.encoding)() - result = u"" - for (c, partialresult) in zip(input.encode(self.encoding), partialresults): - result += d.decode(c) - self.assertEqual(result, partialresult) - # check that there's nothing left in the buffers - self.assertEqual(d.decode("", True), u"") - self.assertEqual(d.buffer, "") - - # Check whether the rest method works properly - d.reset() - result = u"" - for (c, partialresult) in zip(input.encode(self.encoding), partialresults): - result += d.decode(c) - self.assertEqual(result, partialresult) - # check that there's nothing left in the buffers - self.assertEqual(d.decode("", True), u"") - self.assertEqual(d.buffer, "") - - # check iterdecode() - encoded = input.encode(self.encoding) - self.assertEqual( - input, - u"".join(codecs.iterdecode(encoded, self.encoding)) - ) - - def test_readline(self): - def getreader(input): - stream = StringIO.StringIO(input.encode(self.encoding)) - return codecs.getreader(self.encoding)(stream) - - def readalllines(input, keepends=True, size=None): - reader = getreader(input) - lines = [] - while True: - line = reader.readline(size=size, keepends=keepends) - if not line: - break - lines.append(line) - return "|".join(lines) - - s = u"foo\nbar\r\nbaz\rspam\u2028eggs" - sexpected = u"foo\n|bar\r\n|baz\r|spam\u2028|eggs" - sexpectednoends = u"foo|bar|baz|spam|eggs" - self.assertEqual(readalllines(s, True), sexpected) - self.assertEqual(readalllines(s, False), sexpectednoends) - self.assertEqual(readalllines(s, True, 10), sexpected) - self.assertEqual(readalllines(s, False, 10), sexpectednoends) - - # Test long lines (multiple calls to read() in readline()) - vw = [] - vwo = [] - for (i, lineend) in enumerate(u"\n \r\n \r \u2028".split()): - vw.append((i*200)*u"\3042" + lineend) - vwo.append((i*200)*u"\3042") - self.assertEqual(readalllines("".join(vw), True), "".join(vw)) - self.assertEqual(readalllines("".join(vw), False),"".join(vwo)) - - # Test lines where the first read might end with \r, so the - # reader has to look ahead whether this is a lone \r or a \r\n - for size in xrange(80): - for lineend in u"\n \r\n \r \u2028".split(): - s = 10*(size*u"a" + lineend + u"xxx\n") - reader = getreader(s) - for i in xrange(10): - self.assertEqual( - reader.readline(keepends=True), - size*u"a" + lineend, - ) - reader = getreader(s) - for i in xrange(10): - self.assertEqual( - reader.readline(keepends=False), - size*u"a", - ) - - def test_bug1175396(self): - s = [ - '<%!--===================================================\r\n', - ' BLOG index page: show recent articles,\r\n', - ' today\'s articles, or articles of a specific date.\r\n', - '========================================================--%>\r\n', - '<%@inputencoding="ISO-8859-1"%>\r\n', - '<%@pagetemplate=TEMPLATE.y%>\r\n', - '<%@import=import frog.util, frog%>\r\n', - '<%@import=import frog.objects%>\r\n', - '<%@import=from frog.storageerrors import StorageError%>\r\n', - '<%\r\n', - '\r\n', - 'import logging\r\n', - 'log=logging.getLogger("Snakelets.logger")\r\n', - '\r\n', - '\r\n', - 'user=self.SessionCtx.user\r\n', - 'storageEngine=self.SessionCtx.storageEngine\r\n', - '\r\n', - '\r\n', - 'def readArticlesFromDate(date, count=None):\r\n', - ' entryids=storageEngine.listBlogEntries(date)\r\n', - ' entryids.reverse() # descending\r\n', - ' if count:\r\n', - ' entryids=entryids[:count]\r\n', - ' try:\r\n', - ' return [ frog.objects.BlogEntry.load(storageEngine, date, Id) for Id in entryids ]\r\n', - ' except StorageError,x:\r\n', - ' log.error("Error loading articles: "+str(x))\r\n', - ' self.abort("cannot load articles")\r\n', - '\r\n', - 'showdate=None\r\n', - '\r\n', - 'arg=self.Request.getArg()\r\n', - 'if arg=="today":\r\n', - ' #-------------------- TODAY\'S ARTICLES\r\n', - ' self.write("

Today\'s articles

")\r\n', - ' showdate = frog.util.isodatestr() \r\n', - ' entries = readArticlesFromDate(showdate)\r\n', - 'elif arg=="active":\r\n', - ' #-------------------- ACTIVE ARTICLES redirect\r\n', - ' self.Yredirect("active.y")\r\n', - 'elif arg=="login":\r\n', - ' #-------------------- LOGIN PAGE redirect\r\n', - ' self.Yredirect("login.y")\r\n', - 'elif arg=="date":\r\n', - ' #-------------------- ARTICLES OF A SPECIFIC DATE\r\n', - ' showdate = self.Request.getParameter("date")\r\n', - ' self.write("

Articles written on %s

"% frog.util.mediumdatestr(showdate))\r\n', - ' entries = readArticlesFromDate(showdate)\r\n', - 'else:\r\n', - ' #-------------------- RECENT ARTICLES\r\n', - ' self.write("

Recent articles

")\r\n', - ' dates=storageEngine.listBlogEntryDates()\r\n', - ' if dates:\r\n', - ' entries=[]\r\n', - ' SHOWAMOUNT=10\r\n', - ' for showdate in dates:\r\n', - ' entries.extend( readArticlesFromDate(showdate, SHOWAMOUNT-len(entries)) )\r\n', - ' if len(entries)>=SHOWAMOUNT:\r\n', - ' break\r\n', - ' \r\n', - ] - stream = StringIO.StringIO("".join(s).encode(self.encoding)) - reader = codecs.getreader(self.encoding)(stream) - for (i, line) in enumerate(reader): - self.assertEqual(line, s[i]) - - def test_readlinequeue(self): - q = Queue() - writer = codecs.getwriter(self.encoding)(q) - reader = codecs.getreader(self.encoding)(q) - - # No lineends - writer.write(u"foo\r") - self.assertEqual(reader.readline(keepends=False), u"foo") - writer.write(u"\nbar\r") - self.assertEqual(reader.readline(keepends=False), u"") - self.assertEqual(reader.readline(keepends=False), u"bar") - writer.write(u"baz") - self.assertEqual(reader.readline(keepends=False), u"baz") - self.assertEqual(reader.readline(keepends=False), u"") - - # Lineends - writer.write(u"foo\r") - self.assertEqual(reader.readline(keepends=True), u"foo\r") - writer.write(u"\nbar\r") - self.assertEqual(reader.readline(keepends=True), u"\n") - self.assertEqual(reader.readline(keepends=True), u"bar\r") - writer.write(u"baz") - self.assertEqual(reader.readline(keepends=True), u"baz") - self.assertEqual(reader.readline(keepends=True), u"") - writer.write(u"foo\r\n") - self.assertEqual(reader.readline(keepends=True), u"foo\r\n") - - def test_bug1098990_a(self): - s1 = u"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\r\n" - s2 = u"offending line: ladfj askldfj klasdj fskla dfzaskdj fasklfj laskd fjasklfzzzzaa%whereisthis!!!\r\n" - s3 = u"next line.\r\n" - - s = (s1+s2+s3).encode(self.encoding) - stream = StringIO.StringIO(s) - reader = codecs.getreader(self.encoding)(stream) - self.assertEqual(reader.readline(), s1) - self.assertEqual(reader.readline(), s2) - self.assertEqual(reader.readline(), s3) - self.assertEqual(reader.readline(), u"") - - def test_bug1098990_b(self): - s1 = u"aaaaaaaaaaaaaaaaaaaaaaaa\r\n" - s2 = u"bbbbbbbbbbbbbbbbbbbbbbbb\r\n" - s3 = u"stillokay:bbbbxx\r\n" - s4 = u"broken!!!!badbad\r\n" - s5 = u"againokay.\r\n" - - s = (s1+s2+s3+s4+s5).encode(self.encoding) - stream = StringIO.StringIO(s) - reader = codecs.getreader(self.encoding)(stream) - self.assertEqual(reader.readline(), s1) - self.assertEqual(reader.readline(), s2) - self.assertEqual(reader.readline(), s3) - self.assertEqual(reader.readline(), s4) - self.assertEqual(reader.readline(), s5) - self.assertEqual(reader.readline(), u"") - -class UTF16Test(ReadTest): - encoding = "utf-16" - - spamle = '\xff\xfes\x00p\x00a\x00m\x00s\x00p\x00a\x00m\x00' - spambe = '\xfe\xff\x00s\x00p\x00a\x00m\x00s\x00p\x00a\x00m' - - def test_only_one_bom(self): - _,_,reader,writer = codecs.lookup(self.encoding) - # encode some stream - s = StringIO.StringIO() - f = writer(s) - f.write(u"spam") - f.write(u"spam") - d = s.getvalue() - # check whether there is exactly one BOM in it - self.assert_(d == self.spamle or d == self.spambe) - # try to read it back - s = StringIO.StringIO(d) - f = reader(s) - self.assertEquals(f.read(), u"spamspam") - - def test_badbom(self): - s = StringIO.StringIO("\xff\xff") - f = codecs.getreader(self.encoding)(s) - self.assertRaises(UnicodeError, f.read) - - s = StringIO.StringIO("\xff\xff\xff\xff") - f = codecs.getreader(self.encoding)(s) - self.assertRaises(UnicodeError, f.read) - - def test_partial(self): - self.check_partial( - u"\x00\xff\u0100\uffff", - [ - u"", # first byte of BOM read - u"", # second byte of BOM read => byteorder known - u"", - u"\x00", - u"\x00", - u"\x00\xff", - u"\x00\xff", - u"\x00\xff\u0100", - u"\x00\xff\u0100", - u"\x00\xff\u0100\uffff", - ] - ) - - def test_errors(self): - self.assertRaises(UnicodeDecodeError, codecs.utf_16_decode, "\xff", "strict", True) - -class UTF16LETest(ReadTest): - encoding = "utf-16-le" - - def test_partial(self): - self.check_partial( - u"\x00\xff\u0100\uffff", - [ - u"", - u"\x00", - u"\x00", - u"\x00\xff", - u"\x00\xff", - u"\x00\xff\u0100", - u"\x00\xff\u0100", - u"\x00\xff\u0100\uffff", - ] - ) - - def test_errors(self): - self.assertRaises(UnicodeDecodeError, codecs.utf_16_le_decode, "\xff", "strict", True) - -class UTF16BETest(ReadTest): - encoding = "utf-16-be" - - def test_partial(self): - self.check_partial( - u"\x00\xff\u0100\uffff", - [ - u"", - u"\x00", - u"\x00", - u"\x00\xff", - u"\x00\xff", - u"\x00\xff\u0100", - u"\x00\xff\u0100", - u"\x00\xff\u0100\uffff", - ] - ) - - def test_errors(self): - self.assertRaises(UnicodeDecodeError, codecs.utf_16_be_decode, "\xff", "strict", True) - -class UTF8Test(ReadTest): - encoding = "utf-8" - - def test_partial(self): - self.check_partial( - u"\x00\xff\u07ff\u0800\uffff", - [ - u"\x00", - u"\x00", - u"\x00\xff", - u"\x00\xff", - u"\x00\xff\u07ff", - u"\x00\xff\u07ff", - u"\x00\xff\u07ff", - u"\x00\xff\u07ff\u0800", - u"\x00\xff\u07ff\u0800", - u"\x00\xff\u07ff\u0800", - u"\x00\xff\u07ff\u0800\uffff", - ] - ) - -class UTF7Test(ReadTest): - encoding = "utf-7" - - # No test_partial() yet, because UTF-7 doesn't support it. - -class UTF16ExTest(unittest.TestCase): - - def test_errors(self): - self.assertRaises(UnicodeDecodeError, codecs.utf_16_ex_decode, "\xff", "strict", 0, True) - - def test_bad_args(self): - self.assertRaises(TypeError, codecs.utf_16_ex_decode) - -class ReadBufferTest(unittest.TestCase): - - def test_array(self): - import array - self.assertEqual( - codecs.readbuffer_encode(array.array("c", "spam")), - ("spam", 4) - ) - - def test_empty(self): - self.assertEqual(codecs.readbuffer_encode(""), ("", 0)) - - def test_bad_args(self): - self.assertRaises(TypeError, codecs.readbuffer_encode) - self.assertRaises(TypeError, codecs.readbuffer_encode, 42) - -class CharBufferTest(unittest.TestCase): - - def test_string(self): - self.assertEqual(codecs.charbuffer_encode("spam"), ("spam", 4)) - - def test_empty(self): - self.assertEqual(codecs.charbuffer_encode(""), ("", 0)) - - def test_bad_args(self): - self.assertRaises(TypeError, codecs.charbuffer_encode) - self.assertRaises(TypeError, codecs.charbuffer_encode, 42) - -class UTF8SigTest(ReadTest): - encoding = "utf-8-sig" - - def test_partial(self): - self.check_partial( - u"\ufeff\x00\xff\u07ff\u0800\uffff", - [ - u"", - u"", - u"", # First BOM has been read and skipped - u"", - u"", - u"\ufeff", # Second BOM has been read and emitted - u"\ufeff\x00", # "\x00" read and emitted - u"\ufeff\x00", # First byte of encoded u"\xff" read - u"\ufeff\x00\xff", # Second byte of encoded u"\xff" read - u"\ufeff\x00\xff", # First byte of encoded u"\u07ff" read - u"\ufeff\x00\xff\u07ff", # Second byte of encoded u"\u07ff" read - u"\ufeff\x00\xff\u07ff", - u"\ufeff\x00\xff\u07ff", - u"\ufeff\x00\xff\u07ff\u0800", - u"\ufeff\x00\xff\u07ff\u0800", - u"\ufeff\x00\xff\u07ff\u0800", - u"\ufeff\x00\xff\u07ff\u0800\uffff", - ] - ) - - def test_bug1601501(self): - # SF bug #1601501: check that the codec works with a buffer - unicode("\xef\xbb\xbf", "utf-8-sig") - -class EscapeDecodeTest(unittest.TestCase): - def test_empty(self): - self.assertEquals(codecs.escape_decode(""), ("", 0)) - -class RecodingTest(unittest.TestCase): - def test_recoding(self): - f = StringIO.StringIO() - f2 = codecs.EncodedFile(f, "unicode_internal", "utf-8") - f2.write(u"a") - f2.close() - # Python used to crash on this at exit because of a refcount - # bug in _codecsmodule.c - -# From RFC 3492 -punycode_testcases = [ - # A Arabic (Egyptian): - (u"\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" - u"\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F", - "egbpdaj6bu4bxfgehfvwxn"), - # B Chinese (simplified): - (u"\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587", - "ihqwcrb4cv8a8dqg056pqjye"), - # C Chinese (traditional): - (u"\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587", - "ihqwctvzc91f659drss3x8bo0yb"), - # D Czech: Proprostnemluvesky - (u"\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074" - u"\u011B\u006E\u0065\u006D\u006C\u0075\u0076\u00ED\u010D" - u"\u0065\u0073\u006B\u0079", - "Proprostnemluvesky-uyb24dma41a"), - # E Hebrew: - (u"\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8" - u"\u05DC\u05D0\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2" - u"\u05D1\u05E8\u05D9\u05EA", - "4dbcagdahymbxekheh6e0a7fei0b"), - # F Hindi (Devanagari): - (u"\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D" - u"\u0926\u0940\u0915\u094D\u092F\u094B\u0902\u0928\u0939" - u"\u0940\u0902\u092C\u094B\u0932\u0938\u0915\u0924\u0947" - u"\u0939\u0948\u0902", - "i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd"), - - #(G) Japanese (kanji and hiragana): - (u"\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092" - u"\u8A71\u3057\u3066\u304F\u308C\u306A\u3044\u306E\u304B", - "n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa"), - - # (H) Korean (Hangul syllables): - (u"\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774" - u"\uD55C\uAD6D\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74" - u"\uC5BC\uB9C8\uB098\uC88B\uC744\uAE4C", - "989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5j" - "psd879ccm6fea98c"), - - # (I) Russian (Cyrillic): - (u"\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E" - u"\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440" - u"\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A" - u"\u0438", - "b1abfaaepdrnnbgefbaDotcwatmq2g4l"), - - # (J) Spanish: PorqunopuedensimplementehablarenEspaol - (u"\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070" - u"\u0075\u0065\u0064\u0065\u006E\u0073\u0069\u006D\u0070" - u"\u006C\u0065\u006D\u0065\u006E\u0074\u0065\u0068\u0061" - u"\u0062\u006C\u0061\u0072\u0065\u006E\u0045\u0073\u0070" - u"\u0061\u00F1\u006F\u006C", - "PorqunopuedensimplementehablarenEspaol-fmd56a"), - - # (K) Vietnamese: - # Tisaohkhngthch\ - # nitingVit - (u"\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B" - u"\u0068\u00F4\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068" - u"\u1EC9\u006E\u00F3\u0069\u0074\u0069\u1EBF\u006E\u0067" - u"\u0056\u0069\u1EC7\u0074", - "TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g"), - - #(L) 3B - (u"\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F", - "3B-ww4c5e180e575a65lsy2b"), - - # (M) -with-SUPER-MONKEYS - (u"\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074" - u"\u0068\u002D\u0053\u0055\u0050\u0045\u0052\u002D\u004D" - u"\u004F\u004E\u004B\u0045\u0059\u0053", - "-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n"), - - # (N) Hello-Another-Way- - (u"\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F" - u"\u0074\u0068\u0065\u0072\u002D\u0057\u0061\u0079\u002D" - u"\u305D\u308C\u305E\u308C\u306E\u5834\u6240", - "Hello-Another-Way--fc4qua05auwb3674vfr0b"), - - # (O) 2 - (u"\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032", - "2-u9tlzr9756bt3uc0v"), - - # (P) MajiKoi5 - (u"\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" - u"\u308B\u0035\u79D2\u524D", - "MajiKoi5-783gue6qz075azm5e"), - - # (Q) de - (u"\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", - "de-jg4avhby1noc0d"), - - # (R) - (u"\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067", - "d9juau41awczczp"), - - # (S) -> $1.00 <- - (u"\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020" - u"\u003C\u002D", - "-> $1.00 <--") - ] - -for i in punycode_testcases: - if len(i)!=2: - print repr(i) - -class PunycodeTest(unittest.TestCase): - def test_encode(self): - for uni, puny in punycode_testcases: - # Need to convert both strings to lower case, since - # some of the extended encodings use upper case, but our - # code produces only lower case. Converting just puny to - # lower is also insufficient, since some of the input characters - # are upper case. - self.assertEquals(uni.encode("punycode").lower(), puny.lower()) - - def test_decode(self): - for uni, puny in punycode_testcases: - self.assertEquals(uni, puny.decode("punycode")) - -class UnicodeInternalTest(unittest.TestCase): - def test_bug1251300(self): - # Decoding with unicode_internal used to not correctly handle "code - # points" above 0x10ffff on UCS-4 builds. - if sys.maxunicode > 0xffff: - ok = [ - ("\x00\x10\xff\xff", u"\U0010ffff"), - ("\x00\x00\x01\x01", u"\U00000101"), - ("", u""), - ] - not_ok = [ - "\x7f\xff\xff\xff", - "\x80\x00\x00\x00", - "\x81\x00\x00\x00", - "\x00", - "\x00\x00\x00\x00\x00", - ] - for internal, uni in ok: - if sys.byteorder == "little": - internal = "".join(reversed(internal)) - self.assertEquals(uni, internal.decode("unicode_internal")) - for internal in not_ok: - if sys.byteorder == "little": - internal = "".join(reversed(internal)) - self.assertRaises(UnicodeDecodeError, internal.decode, - "unicode_internal") - - def test_decode_error_attributes(self): - if sys.maxunicode > 0xffff: - try: - "\x00\x00\x00\x00\x00\x11\x11\x00".decode("unicode_internal") - except UnicodeDecodeError, ex: - self.assertEquals("unicode_internal", ex.encoding) - self.assertEquals("\x00\x00\x00\x00\x00\x11\x11\x00", ex.object) - self.assertEquals(4, ex.start) - self.assertEquals(8, ex.end) - else: - self.fail() - - def test_decode_callback(self): - if sys.maxunicode > 0xffff: - codecs.register_error("UnicodeInternalTest", codecs.ignore_errors) - decoder = codecs.getdecoder("unicode_internal") - ab = u"ab".encode("unicode_internal") - ignored = decoder("%s\x22\x22\x22\x22%s" % (ab[:4], ab[4:]), - "UnicodeInternalTest") - self.assertEquals((u"ab", 12), ignored) - -# From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html -nameprep_tests = [ - # 3.1 Map to nothing. - ('foo\xc2\xad\xcd\x8f\xe1\xa0\x86\xe1\xa0\x8bbar' - '\xe2\x80\x8b\xe2\x81\xa0baz\xef\xb8\x80\xef\xb8\x88\xef' - '\xb8\x8f\xef\xbb\xbf', - 'foobarbaz'), - # 3.2 Case folding ASCII U+0043 U+0041 U+0046 U+0045. - ('CAFE', - 'cafe'), - # 3.3 Case folding 8bit U+00DF (german sharp s). - # The original test case is bogus; it says \xc3\xdf - ('\xc3\x9f', - 'ss'), - # 3.4 Case folding U+0130 (turkish capital I with dot). - ('\xc4\xb0', - 'i\xcc\x87'), - # 3.5 Case folding multibyte U+0143 U+037A. - ('\xc5\x83\xcd\xba', - '\xc5\x84 \xce\xb9'), - # 3.6 Case folding U+2121 U+33C6 U+1D7BB. - # XXX: skip this as it fails in UCS-2 mode - #('\xe2\x84\xa1\xe3\x8f\x86\xf0\x9d\x9e\xbb', - # 'telc\xe2\x88\x95kg\xcf\x83'), - (None, None), - # 3.7 Normalization of U+006a U+030c U+00A0 U+00AA. - ('j\xcc\x8c\xc2\xa0\xc2\xaa', - '\xc7\xb0 a'), - # 3.8 Case folding U+1FB7 and normalization. - ('\xe1\xbe\xb7', - '\xe1\xbe\xb6\xce\xb9'), - # 3.9 Self-reverting case folding U+01F0 and normalization. - # The original test case is bogus, it says `\xc7\xf0' - ('\xc7\xb0', - '\xc7\xb0'), - # 3.10 Self-reverting case folding U+0390 and normalization. - ('\xce\x90', - '\xce\x90'), - # 3.11 Self-reverting case folding U+03B0 and normalization. - ('\xce\xb0', - '\xce\xb0'), - # 3.12 Self-reverting case folding U+1E96 and normalization. - ('\xe1\xba\x96', - '\xe1\xba\x96'), - # 3.13 Self-reverting case folding U+1F56 and normalization. - ('\xe1\xbd\x96', - '\xe1\xbd\x96'), - # 3.14 ASCII space character U+0020. - (' ', - ' '), - # 3.15 Non-ASCII 8bit space character U+00A0. - ('\xc2\xa0', - ' '), - # 3.16 Non-ASCII multibyte space character U+1680. - ('\xe1\x9a\x80', - None), - # 3.17 Non-ASCII multibyte space character U+2000. - ('\xe2\x80\x80', - ' '), - # 3.18 Zero Width Space U+200b. - ('\xe2\x80\x8b', - ''), - # 3.19 Non-ASCII multibyte space character U+3000. - ('\xe3\x80\x80', - ' '), - # 3.20 ASCII control characters U+0010 U+007F. - ('\x10\x7f', - '\x10\x7f'), - # 3.21 Non-ASCII 8bit control character U+0085. - ('\xc2\x85', - None), - # 3.22 Non-ASCII multibyte control character U+180E. - ('\xe1\xa0\x8e', - None), - # 3.23 Zero Width No-Break Space U+FEFF. - ('\xef\xbb\xbf', - ''), - # 3.24 Non-ASCII control character U+1D175. - ('\xf0\x9d\x85\xb5', - None), - # 3.25 Plane 0 private use character U+F123. - ('\xef\x84\xa3', - None), - # 3.26 Plane 15 private use character U+F1234. - ('\xf3\xb1\x88\xb4', - None), - # 3.27 Plane 16 private use character U+10F234. - ('\xf4\x8f\x88\xb4', - None), - # 3.28 Non-character code point U+8FFFE. - ('\xf2\x8f\xbf\xbe', - None), - # 3.29 Non-character code point U+10FFFF. - ('\xf4\x8f\xbf\xbf', - None), - # 3.30 Surrogate code U+DF42. - ('\xed\xbd\x82', - None), - # 3.31 Non-plain text character U+FFFD. - ('\xef\xbf\xbd', - None), - # 3.32 Ideographic description character U+2FF5. - ('\xe2\xbf\xb5', - None), - # 3.33 Display property character U+0341. - ('\xcd\x81', - '\xcc\x81'), - # 3.34 Left-to-right mark U+200E. - ('\xe2\x80\x8e', - None), - # 3.35 Deprecated U+202A. - ('\xe2\x80\xaa', - None), - # 3.36 Language tagging character U+E0001. - ('\xf3\xa0\x80\x81', - None), - # 3.37 Language tagging character U+E0042. - ('\xf3\xa0\x81\x82', - None), - # 3.38 Bidi: RandALCat character U+05BE and LCat characters. - ('foo\xd6\xbebar', - None), - # 3.39 Bidi: RandALCat character U+FD50 and LCat characters. - ('foo\xef\xb5\x90bar', - None), - # 3.40 Bidi: RandALCat character U+FB38 and LCat characters. - ('foo\xef\xb9\xb6bar', - 'foo \xd9\x8ebar'), - # 3.41 Bidi: RandALCat without trailing RandALCat U+0627 U+0031. - ('\xd8\xa71', - None), - # 3.42 Bidi: RandALCat character U+0627 U+0031 U+0628. - ('\xd8\xa71\xd8\xa8', - '\xd8\xa71\xd8\xa8'), - # 3.43 Unassigned code point U+E0002. - # Skip this test as we allow unassigned - #('\xf3\xa0\x80\x82', - # None), - (None, None), - # 3.44 Larger test (shrinking). - # Original test case reads \xc3\xdf - ('X\xc2\xad\xc3\x9f\xc4\xb0\xe2\x84\xa1j\xcc\x8c\xc2\xa0\xc2' - '\xaa\xce\xb0\xe2\x80\x80', - 'xssi\xcc\x87tel\xc7\xb0 a\xce\xb0 '), - # 3.45 Larger test (expanding). - # Original test case reads \xc3\x9f - ('X\xc3\x9f\xe3\x8c\x96\xc4\xb0\xe2\x84\xa1\xe2\x92\x9f\xe3\x8c' - '\x80', - 'xss\xe3\x82\xad\xe3\x83\xad\xe3\x83\xa1\xe3\x83\xbc\xe3' - '\x83\x88\xe3\x83\xabi\xcc\x87tel\x28d\x29\xe3\x82' - '\xa2\xe3\x83\x91\xe3\x83\xbc\xe3\x83\x88') - ] - - -class NameprepTest(unittest.TestCase): - def test_nameprep(self): - from encodings.idna import nameprep - for pos, (orig, prepped) in enumerate(nameprep_tests): - if orig is None: - # Skipped - continue - # The Unicode strings are given in UTF-8 - orig = unicode(orig, "utf-8") - if prepped is None: - # Input contains prohibited characters - self.assertRaises(UnicodeError, nameprep, orig) - else: - prepped = unicode(prepped, "utf-8") - try: - self.assertEquals(nameprep(orig), prepped) - except Exception,e: - raise test_support.TestFailed("Test 3.%d: %s" % (pos+1, str(e))) - -class IDNACodecTest(unittest.TestCase): - def test_builtin_decode(self): - self.assertEquals(unicode("python.org", "idna"), u"python.org") - self.assertEquals(unicode("python.org.", "idna"), u"python.org.") - self.assertEquals(unicode("xn--pythn-mua.org", "idna"), u"pyth\xf6n.org") - self.assertEquals(unicode("xn--pythn-mua.org.", "idna"), u"pyth\xf6n.org.") - - def test_builtin_encode(self): - self.assertEquals(u"python.org".encode("idna"), "python.org") - self.assertEquals("python.org.".encode("idna"), "python.org.") - self.assertEquals(u"pyth\xf6n.org".encode("idna"), "xn--pythn-mua.org") - self.assertEquals(u"pyth\xf6n.org.".encode("idna"), "xn--pythn-mua.org.") - - def test_stream(self): - import StringIO - r = codecs.getreader("idna")(StringIO.StringIO("abc")) - r.read(3) - self.assertEquals(r.read(), u"") - - def test_incremental_decode(self): - self.assertEquals( - "".join(codecs.iterdecode("python.org", "idna")), - u"python.org" - ) - self.assertEquals( - "".join(codecs.iterdecode("python.org.", "idna")), - u"python.org." - ) - self.assertEquals( - "".join(codecs.iterdecode("xn--pythn-mua.org.", "idna")), - u"pyth\xf6n.org." - ) - self.assertEquals( - "".join(codecs.iterdecode("xn--pythn-mua.org.", "idna")), - u"pyth\xf6n.org." - ) - - decoder = codecs.getincrementaldecoder("idna")() - self.assertEquals(decoder.decode("xn--xam", ), u"") - self.assertEquals(decoder.decode("ple-9ta.o", ), u"\xe4xample.") - self.assertEquals(decoder.decode(u"rg"), u"") - self.assertEquals(decoder.decode(u"", True), u"org") - - decoder.reset() - self.assertEquals(decoder.decode("xn--xam", ), u"") - self.assertEquals(decoder.decode("ple-9ta.o", ), u"\xe4xample.") - self.assertEquals(decoder.decode("rg."), u"org.") - self.assertEquals(decoder.decode("", True), u"") - - def test_incremental_encode(self): - self.assertEquals( - "".join(codecs.iterencode(u"python.org", "idna")), - "python.org" - ) - self.assertEquals( - "".join(codecs.iterencode(u"python.org.", "idna")), - "python.org." - ) - self.assertEquals( - "".join(codecs.iterencode(u"pyth\xf6n.org.", "idna")), - "xn--pythn-mua.org." - ) - self.assertEquals( - "".join(codecs.iterencode(u"pyth\xf6n.org.", "idna")), - "xn--pythn-mua.org." - ) - - encoder = codecs.getincrementalencoder("idna")() - self.assertEquals(encoder.encode(u"\xe4x"), "") - self.assertEquals(encoder.encode(u"ample.org"), "xn--xample-9ta.") - self.assertEquals(encoder.encode(u"", True), "org") - - encoder.reset() - self.assertEquals(encoder.encode(u"\xe4x"), "") - self.assertEquals(encoder.encode(u"ample.org."), "xn--xample-9ta.org.") - self.assertEquals(encoder.encode(u"", True), "") - -class CodecsModuleTest(unittest.TestCase): - - def test_decode(self): - self.assertEquals(codecs.decode('\xe4\xf6\xfc', 'latin-1'), - u'\xe4\xf6\xfc') - self.assertRaises(TypeError, codecs.decode) - self.assertEquals(codecs.decode('abc'), u'abc') - self.assertRaises(UnicodeDecodeError, codecs.decode, '\xff', 'ascii') - - def test_encode(self): - self.assertEquals(codecs.encode(u'\xe4\xf6\xfc', 'latin-1'), - '\xe4\xf6\xfc') - self.assertRaises(TypeError, codecs.encode) - self.assertRaises(LookupError, codecs.encode, "foo", "__spam__") - self.assertEquals(codecs.encode(u'abc'), 'abc') - self.assertRaises(UnicodeEncodeError, codecs.encode, u'\xffff', 'ascii') - - def test_register(self): - self.assertRaises(TypeError, codecs.register) - self.assertRaises(TypeError, codecs.register, 42) - - def test_lookup(self): - self.assertRaises(TypeError, codecs.lookup) - self.assertRaises(LookupError, codecs.lookup, "__spam__") - self.assertRaises(LookupError, codecs.lookup, " ") - - def test_getencoder(self): - self.assertRaises(TypeError, codecs.getencoder) - self.assertRaises(LookupError, codecs.getencoder, "__spam__") - - def test_getdecoder(self): - self.assertRaises(TypeError, codecs.getdecoder) - self.assertRaises(LookupError, codecs.getdecoder, "__spam__") - - def test_getreader(self): - self.assertRaises(TypeError, codecs.getreader) - self.assertRaises(LookupError, codecs.getreader, "__spam__") - - def test_getwriter(self): - self.assertRaises(TypeError, codecs.getwriter) - self.assertRaises(LookupError, codecs.getwriter, "__spam__") - -class StreamReaderTest(unittest.TestCase): - - def setUp(self): - self.reader = codecs.getreader('utf-8') - self.stream = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') - - def test_readlines(self): - f = self.reader(self.stream) - self.assertEquals(f.readlines(), [u'\ud55c\n', u'\uae00']) - -class EncodedFileTest(unittest.TestCase): - - def test_basic(self): - f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') - ef = codecs.EncodedFile(f, 'utf-16-le', 'utf-8') - self.assertEquals(ef.read(), '\\\xd5\n\x00\x00\xae') - - f = StringIO.StringIO() - ef = codecs.EncodedFile(f, 'utf-8', 'latin1') - ef.write('\xc3\xbc') - self.assertEquals(f.getvalue(), '\xfc') - -class Str2StrTest(unittest.TestCase): - - def test_read(self): - sin = "\x80".encode("base64_codec") - reader = codecs.getreader("base64_codec")(StringIO.StringIO(sin)) - sout = reader.read() - self.assertEqual(sout, "\x80") - self.assert_(isinstance(sout, str)) - - def test_readline(self): - sin = "\x80".encode("base64_codec") - reader = codecs.getreader("base64_codec")(StringIO.StringIO(sin)) - sout = reader.readline() - self.assertEqual(sout, "\x80") - self.assert_(isinstance(sout, str)) - -all_unicode_encodings = [ - "ascii", - "base64_codec", - "big5", - "big5hkscs", - "charmap", - "cp037", - "cp1006", - "cp1026", - "cp1140", - "cp1250", - "cp1251", - "cp1252", - "cp1253", - "cp1254", - "cp1255", - "cp1256", - "cp1257", - "cp1258", - "cp424", - "cp437", - "cp500", - "cp737", - "cp775", - "cp850", - "cp852", - "cp855", - "cp856", - "cp857", - "cp860", - "cp861", - "cp862", - "cp863", - "cp864", - "cp865", - "cp866", - "cp869", - "cp874", - "cp875", - "cp932", - "cp949", - "cp950", - "euc_jis_2004", - "euc_jisx0213", - "euc_jp", - "euc_kr", - "gb18030", - "gb2312", - "gbk", - "hex_codec", - "hp_roman8", - "hz", - "idna", - "iso2022_jp", - "iso2022_jp_1", - "iso2022_jp_2", - "iso2022_jp_2004", - "iso2022_jp_3", - "iso2022_jp_ext", - "iso2022_kr", - "iso8859_1", - "iso8859_10", - "iso8859_11", - "iso8859_13", - "iso8859_14", - "iso8859_15", - "iso8859_16", - "iso8859_2", - "iso8859_3", - "iso8859_4", - "iso8859_5", - "iso8859_6", - "iso8859_7", - "iso8859_8", - "iso8859_9", - "johab", - "koi8_r", - "koi8_u", - "latin_1", - "mac_cyrillic", - "mac_greek", - "mac_iceland", - "mac_latin2", - "mac_roman", - "mac_turkish", - "palmos", - "ptcp154", - "punycode", - "raw_unicode_escape", - "rot_13", - "shift_jis", - "shift_jis_2004", - "shift_jisx0213", - "tis_620", - "unicode_escape", - "unicode_internal", - "utf_16", - "utf_16_be", - "utf_16_le", - "utf_7", - "utf_8", -] - -if hasattr(codecs, "mbcs_encode"): - all_unicode_encodings.append("mbcs") - -# The following encodings work only with str, not unicode -all_string_encodings = [ - "quopri_codec", - "string_escape", - "uu_codec", -] - -# The following encoding is not tested, because it's not supposed -# to work: -# "undefined" - -# The following encodings don't work in stateful mode -broken_unicode_with_streams = [ - "base64_codec", - "hex_codec", - "punycode", - "unicode_internal" -] -broken_incremental_coders = broken_unicode_with_streams[:] - -try: - import bz2 -except ImportError: - pass -else: - all_unicode_encodings.append("bz2_codec") - broken_unicode_with_streams.append("bz2_codec") - -try: - import zlib -except ImportError: - pass -else: - all_unicode_encodings.append("zlib_codec") - broken_unicode_with_streams.append("zlib_codec") - -class BasicUnicodeTest(unittest.TestCase): - def test_basics(self): - s = u"abc123" # all codecs should be able to encode these - for encoding in all_unicode_encodings: - name = codecs.lookup(encoding).name - if encoding.endswith("_codec"): - name += "_codec" - elif encoding == "latin_1": - name = "latin_1" - self.assertEqual(encoding.replace("_", "-"), name.replace("_", "-")) - (bytes, size) = codecs.getencoder(encoding)(s) - if encoding != "unicode_internal": - self.assertEqual(size, len(s), "%r != %r (encoding=%r)" % (size, len(s), encoding)) - (chars, size) = codecs.getdecoder(encoding)(bytes) - self.assertEqual(chars, s, "%r != %r (encoding=%r)" % (chars, s, encoding)) - - if encoding not in broken_unicode_with_streams: - # check stream reader/writer - q = Queue() - writer = codecs.getwriter(encoding)(q) - encodedresult = "" - for c in s: - writer.write(c) - encodedresult += q.read() - q = Queue() - reader = codecs.getreader(encoding)(q) - decodedresult = u"" - for c in encodedresult: - q.write(c) - decodedresult += reader.read() - self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) - - if encoding not in broken_incremental_coders: - # check incremental decoder/encoder (fetched via the Python - # and C API) and iterencode()/iterdecode() - try: - encoder = codecs.getincrementalencoder(encoding)() - cencoder = _testcapi.codec_incrementalencoder(encoding) - except LookupError: # no IncrementalEncoder - pass - else: - # check incremental decoder/encoder - encodedresult = "" - for c in s: - encodedresult += encoder.encode(c) - encodedresult += encoder.encode(u"", True) - decoder = codecs.getincrementaldecoder(encoding)() - decodedresult = u"" - for c in encodedresult: - decodedresult += decoder.decode(c) - decodedresult += decoder.decode("", True) - self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) - - # check C API - encodedresult = "" - for c in s: - encodedresult += cencoder.encode(c) - encodedresult += cencoder.encode(u"", True) - cdecoder = _testcapi.codec_incrementaldecoder(encoding) - decodedresult = u"" - for c in encodedresult: - decodedresult += cdecoder.decode(c) - decodedresult += cdecoder.decode("", True) - self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) - - # check iterencode()/iterdecode() - result = u"".join(codecs.iterdecode(codecs.iterencode(s, encoding), encoding)) - self.assertEqual(result, s, "%r != %r (encoding=%r)" % (result, s, encoding)) - - # check iterencode()/iterdecode() with empty string - result = u"".join(codecs.iterdecode(codecs.iterencode(u"", encoding), encoding)) - self.assertEqual(result, u"") - - def test_seek(self): - # all codecs should be able to encode these - s = u"%s\n%s\n" % (100*u"abc123", 100*u"def456") - for encoding in all_unicode_encodings: - if encoding == "idna": # FIXME: See SF bug #1163178 - continue - if encoding in broken_unicode_with_streams: - continue - reader = codecs.getreader(encoding)(StringIO.StringIO(s.encode(encoding))) - for t in xrange(5): - # Test that calling seek resets the internal codec state and buffers - reader.seek(0, 0) - line = reader.readline() - self.assertEqual(s[:len(line)], line) - - def test_bad_decode_args(self): - for encoding in all_unicode_encodings: - decoder = codecs.getdecoder(encoding) - self.assertRaises(TypeError, decoder) - if encoding not in ("idna", "punycode"): - self.assertRaises(TypeError, decoder, 42) - - def test_bad_encode_args(self): - for encoding in all_unicode_encodings: - encoder = codecs.getencoder(encoding) - self.assertRaises(TypeError, encoder) - - def test_encoding_map_type_initialized(self): - from encodings import cp1140 - # This used to crash, we are only verifying there's no crash. - table_type = type(cp1140.encoding_table) - self.assertEqual(table_type, table_type) - -class BasicStrTest(unittest.TestCase): - def test_basics(self): - s = "abc123" - for encoding in all_string_encodings: - (bytes, size) = codecs.getencoder(encoding)(s) - self.assertEqual(size, len(s)) - (chars, size) = codecs.getdecoder(encoding)(bytes) - self.assertEqual(chars, s, "%r != %r (encoding=%r)" % (chars, s, encoding)) - -class CharmapTest(unittest.TestCase): - def test_decode_with_string_map(self): - self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "strict", u"abc"), - (u"abc", 3) - ) - - self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "replace", u"ab"), - (u"ab\ufffd", 3) - ) - - self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "replace", u"ab\ufffe"), - (u"ab\ufffd", 3) - ) - - self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "ignore", u"ab"), - (u"ab", 3) - ) - - self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "ignore", u"ab\ufffe"), - (u"ab", 3) - ) - - allbytes = "".join(chr(i) for i in xrange(256)) - self.assertEquals( - codecs.charmap_decode(allbytes, "ignore", u""), - (u"", len(allbytes)) - ) - -class WithStmtTest(unittest.TestCase): - def test_encodedfile(self): - f = StringIO.StringIO("\xc3\xbc") - with codecs.EncodedFile(f, "latin-1", "utf-8") as ef: - self.assertEquals(ef.read(), "\xfc") - - def test_streamreaderwriter(self): - f = StringIO.StringIO("\xc3\xbc") - info = codecs.lookup("utf-8") - with codecs.StreamReaderWriter(f, info.streamreader, - info.streamwriter, 'strict') as srw: - self.assertEquals(srw.read(), u"\xfc") - - -def test_main(): - test_support.run_unittest( - UTF16Test, - UTF16LETest, - UTF16BETest, - UTF8Test, - UTF8SigTest, - UTF7Test, - UTF16ExTest, - ReadBufferTest, - CharBufferTest, - EscapeDecodeTest, - RecodingTest, - PunycodeTest, - UnicodeInternalTest, - NameprepTest, - IDNACodecTest, - CodecsModuleTest, - StreamReaderTest, - EncodedFileTest, - Str2StrTest, - BasicUnicodeTest, - BasicStrTest, - CharmapTest, - WithStmtTest, - ) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_codeop.py b/sys/lib/python/test/test_codeop.py deleted file mode 100644 index 5d06f2c32..000000000 --- a/sys/lib/python/test/test_codeop.py +++ /dev/null @@ -1,192 +0,0 @@ -""" - Test cases for codeop.py - Nick Mathewson -""" -import unittest -from test.test_support import run_unittest, is_jython - -from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT - -if is_jython: - import sys - import cStringIO - - def unify_callables(d): - for n,v in d.items(): - if callable(v): - d[n] = callable - return d - -class CodeopTests(unittest.TestCase): - - def assertValid(self, str, symbol='single'): - '''succeed iff str is a valid piece of code''' - if is_jython: - code = compile_command(str, "", symbol) - self.assert_(code) - if symbol == "single": - d,r = {},{} - saved_stdout = sys.stdout - sys.stdout = cStringIO.StringIO() - try: - exec code in d - exec compile(str,"","single") in r - finally: - sys.stdout = saved_stdout - elif symbol == 'eval': - ctx = {'a': 2} - d = { 'value': eval(code,ctx) } - r = { 'value': eval(str,ctx) } - self.assertEquals(unify_callables(r),unify_callables(d)) - else: - expected = compile(str, "", symbol, PyCF_DONT_IMPLY_DEDENT) - self.assertEquals( compile_command(str, "", symbol), expected) - - def assertIncomplete(self, str, symbol='single'): - '''succeed iff str is the start of a valid piece of code''' - self.assertEquals( compile_command(str, symbol=symbol), None) - - def assertInvalid(self, str, symbol='single', is_syntax=1): - '''succeed iff str is the start of an invalid piece of code''' - try: - compile_command(str,symbol=symbol) - self.fail("No exception thrown for invalid code") - except SyntaxError: - self.assert_(is_syntax) - except OverflowError: - self.assert_(not is_syntax) - - def test_valid(self): - av = self.assertValid - - # special case - if not is_jython: - self.assertEquals(compile_command(""), - compile("pass", "", 'single', - PyCF_DONT_IMPLY_DEDENT)) - self.assertEquals(compile_command("\n"), - compile("pass", "", 'single', - PyCF_DONT_IMPLY_DEDENT)) - else: - av("") - av("\n") - - av("a = 1") - av("\na = 1") - av("a = 1\n") - av("a = 1\n\n") - av("\n\na = 1\n\n") - - av("def x():\n pass\n") - av("if 1:\n pass\n") - - av("\n\nif 1: pass\n") - av("\n\nif 1: pass\n\n") - - av("def x():\n\n pass\n") - av("def x():\n pass\n \n") - av("def x():\n pass\n \n") - - av("pass\n") - av("3**3\n") - - av("if 9==3:\n pass\nelse:\n pass\n") - av("if 1:\n pass\n if 1:\n pass\n else:\n pass\n") - - av("#a\n#b\na = 3\n") - av("#a\n\n \na=3\n") - av("a=3\n\n") - av("a = 9+ \\\n3") - - av("3**3","eval") - av("(lambda z: \n z**3)","eval") - - av("9+ \\\n3","eval") - av("9+ \\\n3\n","eval") - - av("\n\na**3","eval") - av("\n \na**3","eval") - av("#a\n#b\na**3","eval") - - def test_incomplete(self): - ai = self.assertIncomplete - - ai("(a **") - ai("(a,b,") - ai("(a,b,(") - ai("(a,b,(") - ai("a = (") - ai("a = {") - ai("b + {") - - ai("if 9==3:\n pass\nelse:") - ai("if 9==3:\n pass\nelse:\n") - ai("if 9==3:\n pass\nelse:\n pass") - ai("if 1:") - ai("if 1:\n") - ai("if 1:\n pass\n if 1:\n pass\n else:") - ai("if 1:\n pass\n if 1:\n pass\n else:\n") - ai("if 1:\n pass\n if 1:\n pass\n else:\n pass") - - ai("def x():") - ai("def x():\n") - ai("def x():\n\n") - - ai("def x():\n pass") - ai("def x():\n pass\n ") - ai("def x():\n pass\n ") - ai("\n\ndef x():\n pass") - - ai("a = 9+ \\") - ai("a = 'a\\") - ai("a = '''xy") - - ai("","eval") - ai("\n","eval") - ai("(","eval") - ai("(\n\n\n","eval") - ai("(9+","eval") - ai("9+ \\","eval") - ai("lambda z: \\","eval") - - def test_invalid(self): - ai = self.assertInvalid - ai("a b") - - ai("a @") - ai("a b @") - ai("a ** @") - - ai("a = ") - ai("a = 9 +") - - ai("def x():\n\npass\n") - - ai("\n\n if 1: pass\n\npass") - - ai("a = 9+ \\\n") - ai("a = 'a\\ ") - ai("a = 'a\\\n") - - ai("a = 1","eval") - ai("a = (","eval") - ai("]","eval") - ai("())","eval") - ai("[}","eval") - ai("9+","eval") - ai("lambda z:","eval") - ai("a b","eval") - - def test_filename(self): - self.assertEquals(compile_command("a = 1\n", "abc").co_filename, - compile("a = 1\n", "abc", 'single').co_filename) - self.assertNotEquals(compile_command("a = 1\n", "abc").co_filename, - compile("a = 1\n", "def", 'single').co_filename) - - -def test_main(): - run_unittest(CodeopTests) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_coding.py b/sys/lib/python/test/test_coding.py deleted file mode 100644 index e83015e54..000000000 --- a/sys/lib/python/test/test_coding.py +++ /dev/null @@ -1,28 +0,0 @@ - -import test.test_support, unittest -import os - -class CodingTest(unittest.TestCase): - def test_bad_coding(self): - module_name = 'bad_coding' - self.verify_bad_module(module_name) - - def test_bad_coding2(self): - module_name = 'bad_coding2' - self.verify_bad_module(module_name) - - def verify_bad_module(self, module_name): - self.assertRaises(SyntaxError, __import__, 'test.' + module_name) - - path = os.path.dirname(__file__) - filename = os.path.join(path, module_name + '.py') - fp = open(filename) - text = fp.read() - fp.close() - self.assertRaises(SyntaxError, compile, text, filename, 'exec') - -def test_main(): - test.test_support.run_unittest(CodingTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_coercion.py b/sys/lib/python/test/test_coercion.py deleted file mode 100644 index d704e4b73..000000000 --- a/sys/lib/python/test/test_coercion.py +++ /dev/null @@ -1,347 +0,0 @@ -import copy -import sys -import warnings -import unittest -from test.test_support import run_unittest, TestFailed - -# Fake a number that implements numeric methods through __coerce__ -class CoerceNumber: - def __init__(self, arg): - self.arg = arg - - def __repr__(self): - return '' % repr(self.arg) - - def __coerce__(self, other): - if isinstance(other, CoerceNumber): - return self.arg, other.arg - else: - return (self.arg, other) - -# New-style class version of CoerceNumber -class CoerceTo(object): - def __init__(self, arg): - self.arg = arg - def __coerce__(self, other): - if isinstance(other, CoerceTo): - return self.arg, other.arg - else: - return self.arg, other - - -# Fake a number that implements numeric ops through methods. -class MethodNumber: - def __init__(self,arg): - self.arg = arg - - def __repr__(self): - return '' % repr(self.arg) - - def __add__(self,other): - return self.arg + other - - def __radd__(self,other): - return other + self.arg - - def __sub__(self,other): - return self.arg - other - - def __rsub__(self,other): - return other - self.arg - - def __mul__(self,other): - return self.arg * other - - def __rmul__(self,other): - return other * self.arg - - def __div__(self,other): - return self.arg / other - - def __rdiv__(self,other): - return other / self.arg - - def __truediv__(self,other): - return self.arg / other - - def __rtruediv__(self,other): - return other / self.arg - - def __floordiv__(self,other): - return self.arg // other - - def __rfloordiv__(self,other): - return other // self.arg - - def __pow__(self,other): - return self.arg ** other - - def __rpow__(self,other): - return other ** self.arg - - def __mod__(self,other): - return self.arg % other - - def __rmod__(self,other): - return other % self.arg - - def __cmp__(self, other): - return cmp(self.arg, other) - - -candidates = [2, 2L, 4.0, 2+0j, [1], (2,), None, - MethodNumber(2), CoerceNumber(2)] - -infix_binops = [ '+', '-', '*', '**', '%', '//', '/' ] - -TE = TypeError -# b = both normal and augmented give same result list -# s = single result lists for normal and augmented -# e = equals other results -# result lists: ['+', '-', '*', '**', '%', '//', ('classic /', 'new /')] -# ^^^^^^^^^^^^^^^^^^^^^^ -# 2-tuple if results differ -# else only one value -infix_results = { - # 2 - (0,0): ('b', [4, 0, 4, 4, 0, 1, (1, 1.0)]), - (0,1): ('e', (0,0)), - (0,2): ('b', [6.0, -2.0, 8.0, 16.0, 2.0, 0.0, 0.5]), - (0,3): ('b', [4+0j, 0+0j, 4+0j, 4+0j, 0+0j, 1+0j, 1+0j]), - (0,4): ('b', [TE, TE, [1, 1], TE, TE, TE, TE]), - (0,5): ('b', [TE, TE, (2, 2), TE, TE, TE, TE]), - (0,6): ('b', [TE, TE, TE, TE, TE, TE, TE]), - (0,7): ('e', (0,0)), - (0,8): ('e', (0,0)), - - # 2L - (1,0): ('e', (0,0)), - (1,1): ('e', (0,1)), - (1,2): ('e', (0,2)), - (1,3): ('e', (0,3)), - (1,4): ('e', (0,4)), - (1,5): ('e', (0,5)), - (1,6): ('e', (0,6)), - (1,7): ('e', (0,7)), - (1,8): ('e', (0,8)), - - # 4.0 - (2,0): ('b', [6.0, 2.0, 8.0, 16.0, 0.0, 2.0, 2.0]), - (2,1): ('e', (2,0)), - (2,2): ('b', [8.0, 0.0, 16.0, 256.0, 0.0, 1.0, 1.0]), - (2,3): ('b', [6+0j, 2+0j, 8+0j, 16+0j, 0+0j, 2+0j, 2+0j]), - (2,4): ('b', [TE, TE, TE, TE, TE, TE, TE]), - (2,5): ('e', (2,4)), - (2,6): ('e', (2,4)), - (2,7): ('e', (2,0)), - (2,8): ('e', (2,0)), - - # (2+0j) - (3,0): ('b', [4+0j, 0+0j, 4+0j, 4+0j, 0+0j, 1+0j, 1+0j]), - (3,1): ('e', (3,0)), - (3,2): ('b', [6+0j, -2+0j, 8+0j, 16+0j, 2+0j, 0+0j, 0.5+0j]), - (3,3): ('b', [4+0j, 0+0j, 4+0j, 4+0j, 0+0j, 1+0j, 1+0j]), - (3,4): ('b', [TE, TE, TE, TE, TE, TE, TE]), - (3,5): ('e', (3,4)), - (3,6): ('e', (3,4)), - (3,7): ('e', (3,0)), - (3,8): ('e', (3,0)), - - # [1] - (4,0): ('b', [TE, TE, [1, 1], TE, TE, TE, TE]), - (4,1): ('e', (4,0)), - (4,2): ('b', [TE, TE, TE, TE, TE, TE, TE]), - (4,3): ('b', [TE, TE, TE, TE, TE, TE, TE]), - (4,4): ('b', [[1, 1], TE, TE, TE, TE, TE, TE]), - (4,5): ('s', [TE, TE, TE, TE, TE, TE, TE], [[1, 2], TE, TE, TE, TE, TE, TE]), - (4,6): ('b', [TE, TE, TE, TE, TE, TE, TE]), - (4,7): ('e', (4,0)), - (4,8): ('e', (4,0)), - - # (2,) - (5,0): ('b', [TE, TE, (2, 2), TE, TE, TE, TE]), - (5,1): ('e', (5,0)), - (5,2): ('b', [TE, TE, TE, TE, TE, TE, TE]), - (5,3): ('e', (5,2)), - (5,4): ('e', (5,2)), - (5,5): ('b', [(2, 2), TE, TE, TE, TE, TE, TE]), - (5,6): ('b', [TE, TE, TE, TE, TE, TE, TE]), - (5,7): ('e', (5,0)), - (5,8): ('e', (5,0)), - - # None - (6,0): ('b', [TE, TE, TE, TE, TE, TE, TE]), - (6,1): ('e', (6,0)), - (6,2): ('e', (6,0)), - (6,3): ('e', (6,0)), - (6,4): ('e', (6,0)), - (6,5): ('e', (6,0)), - (6,6): ('e', (6,0)), - (6,7): ('e', (6,0)), - (6,8): ('e', (6,0)), - - # MethodNumber(2) - (7,0): ('e', (0,0)), - (7,1): ('e', (0,1)), - (7,2): ('e', (0,2)), - (7,3): ('e', (0,3)), - (7,4): ('e', (0,4)), - (7,5): ('e', (0,5)), - (7,6): ('e', (0,6)), - (7,7): ('e', (0,7)), - (7,8): ('e', (0,8)), - - # CoerceNumber(2) - (8,0): ('e', (0,0)), - (8,1): ('e', (0,1)), - (8,2): ('e', (0,2)), - (8,3): ('e', (0,3)), - (8,4): ('e', (0,4)), - (8,5): ('e', (0,5)), - (8,6): ('e', (0,6)), - (8,7): ('e', (0,7)), - (8,8): ('e', (0,8)), -} - -def process_infix_results(): - for key in sorted(infix_results): - val = infix_results[key] - if val[0] == 'e': - infix_results[key] = infix_results[val[1]] - else: - if val[0] == 's': - res = (val[1], val[2]) - elif val[0] == 'b': - res = (val[1], val[1]) - for i in range(1): - if isinstance(res[i][6], tuple): - if 1/2 == 0: - # testing with classic (floor) division - res[i][6] = res[i][6][0] - else: - # testing with -Qnew - res[i][6] = res[i][6][1] - infix_results[key] = res - - - -process_infix_results() -# now infix_results has two lists of results for every pairing. - -prefix_binops = [ 'divmod' ] -prefix_results = [ - [(1,0), (1L,0L), (0.0,2.0), ((1+0j),0j), TE, TE, TE, TE, (1,0)], - [(1L,0L), (1L,0L), (0.0,2.0), ((1+0j),0j), TE, TE, TE, TE, (1L,0L)], - [(2.0,0.0), (2.0,0.0), (1.0,0.0), ((2+0j),0j), TE, TE, TE, TE, (2.0,0.0)], - [((1+0j),0j), ((1+0j),0j), (0j,(2+0j)), ((1+0j),0j), TE, TE, TE, TE, ((1+0j),0j)], - [TE, TE, TE, TE, TE, TE, TE, TE, TE], - [TE, TE, TE, TE, TE, TE, TE, TE, TE], - [TE, TE, TE, TE, TE, TE, TE, TE, TE], - [TE, TE, TE, TE, TE, TE, TE, TE, TE], - [(1,0), (1L,0L), (0.0,2.0), ((1+0j),0j), TE, TE, TE, TE, (1,0)] -] - -def format_float(value): - if abs(value) < 0.01: - return '0.0' - else: - return '%.1f' % value - -# avoid testing platform fp quirks -def format_result(value): - if isinstance(value, complex): - return '(%s + %sj)' % (format_float(value.real), - format_float(value.imag)) - elif isinstance(value, float): - return format_float(value) - return str(value) - -class CoercionTest(unittest.TestCase): - def test_infix_binops(self): - for ia, a in enumerate(candidates): - for ib, b in enumerate(candidates): - results = infix_results[(ia, ib)] - for op, res, ires in zip(infix_binops, results[0], results[1]): - if res is TE: - self.assertRaises(TypeError, eval, - 'a %s b' % op, {'a': a, 'b': b}) - else: - self.assertEquals(format_result(res), - format_result(eval('a %s b' % op)), - '%s %s %s == %s failed' % (a, op, b, res)) - try: - z = copy.copy(a) - except copy.Error: - z = a # assume it has no inplace ops - if ires is TE: - try: - exec 'z %s= b' % op - except TypeError: - pass - else: - self.fail("TypeError not raised") - else: - exec('z %s= b' % op) - self.assertEquals(ires, z) - - def test_prefix_binops(self): - for ia, a in enumerate(candidates): - for ib, b in enumerate(candidates): - for op in prefix_binops: - res = prefix_results[ia][ib] - if res is TE: - self.assertRaises(TypeError, eval, - '%s(a, b)' % op, {'a': a, 'b': b}) - else: - self.assertEquals(format_result(res), - format_result(eval('%s(a, b)' % op)), - '%s(%s, %s) == %s failed' % (op, a, b, res)) - - def test_cmptypes(self): - # Built-in tp_compare slots expect their arguments to have the - # same type, but a user-defined __coerce__ doesn't have to obey. - # SF #980352 - evil_coercer = CoerceTo(42) - # Make sure these don't crash any more - self.assertNotEquals(cmp(u'fish', evil_coercer), 0) - self.assertNotEquals(cmp(slice(1), evil_coercer), 0) - # ...but that this still works - class WackyComparer(object): - def __cmp__(slf, other): - self.assert_(other == 42, 'expected evil_coercer, got %r' % other) - return 0 - self.assertEquals(cmp(WackyComparer(), evil_coercer), 0) - # ...and classic classes too, since that code path is a little different - class ClassicWackyComparer: - def __cmp__(slf, other): - self.assert_(other == 42, 'expected evil_coercer, got %r' % other) - return 0 - self.assertEquals(cmp(ClassicWackyComparer(), evil_coercer), 0) - - def test_infinite_rec_classic_classes(self): - # if __coerce__() returns its arguments reversed it causes an infinite - # recursion for classic classes. - class Tester: - def __coerce__(self, other): - return other, self - - exc = TestFailed("__coerce__() returning its arguments reverse " - "should raise RuntimeError") - try: - Tester() + 1 - except (RuntimeError, TypeError): - return - except: - raise exc - else: - raise exc - -def test_main(): - warnings.filterwarnings("ignore", - r'complex divmod\(\), // and % are deprecated', - DeprecationWarning, - r'test.test_coercion$') - run_unittest(CoercionTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_colorsys.py b/sys/lib/python/test/test_colorsys.py deleted file mode 100644 index a8cd885db..000000000 --- a/sys/lib/python/test/test_colorsys.py +++ /dev/null @@ -1,76 +0,0 @@ -import unittest, test.test_support -import colorsys - -def frange(start, stop, step): - while start <= stop: - yield start - start += step - -class ColorsysTest(unittest.TestCase): - - def assertTripleEqual(self, tr1, tr2): - self.assertEqual(len(tr1), 3) - self.assertEqual(len(tr2), 3) - self.assertAlmostEqual(tr1[0], tr2[0]) - self.assertAlmostEqual(tr1[1], tr2[1]) - self.assertAlmostEqual(tr1[2], tr2[2]) - - def test_hsv_roundtrip(self): - for r in frange(0.0, 1.0, 0.2): - for g in frange(0.0, 1.0, 0.2): - for b in frange(0.0, 1.0, 0.2): - rgb = (r, g, b) - self.assertTripleEqual( - rgb, - colorsys.hsv_to_rgb(*colorsys.rgb_to_hsv(*rgb)) - ) - - def test_hsv_values(self): - values = [ - # rgb, hsv - ((0.0, 0.0, 0.0), ( 0 , 0.0, 0.0)), # black - ((0.0, 0.0, 1.0), (4./6., 1.0, 1.0)), # blue - ((0.0, 1.0, 0.0), (2./6., 1.0, 1.0)), # green - ((0.0, 1.0, 1.0), (3./6., 1.0, 1.0)), # cyan - ((1.0, 0.0, 0.0), ( 0 , 1.0, 1.0)), # red - ((1.0, 0.0, 1.0), (5./6., 1.0, 1.0)), # purple - ((1.0, 1.0, 0.0), (1./6., 1.0, 1.0)), # yellow - ((1.0, 1.0, 1.0), ( 0 , 0.0, 1.0)), # white - ((0.5, 0.5, 0.5), ( 0 , 0.0, 0.5)), # grey - ] - for (rgb, hsv) in values: - self.assertTripleEqual(hsv, colorsys.rgb_to_hsv(*rgb)) - self.assertTripleEqual(rgb, colorsys.hsv_to_rgb(*hsv)) - - def test_hls_roundtrip(self): - for r in frange(0.0, 1.0, 0.2): - for g in frange(0.0, 1.0, 0.2): - for b in frange(0.0, 1.0, 0.2): - rgb = (r, g, b) - self.assertTripleEqual( - rgb, - colorsys.hls_to_rgb(*colorsys.rgb_to_hls(*rgb)) - ) - - def test_hls_values(self): - values = [ - # rgb, hls - ((0.0, 0.0, 0.0), ( 0 , 0.0, 0.0)), # black - ((0.0, 0.0, 1.0), (4./6., 0.5, 1.0)), # blue - ((0.0, 1.0, 0.0), (2./6., 0.5, 1.0)), # green - ((0.0, 1.0, 1.0), (3./6., 0.5, 1.0)), # cyan - ((1.0, 0.0, 0.0), ( 0 , 0.5, 1.0)), # red - ((1.0, 0.0, 1.0), (5./6., 0.5, 1.0)), # purple - ((1.0, 1.0, 0.0), (1./6., 0.5, 1.0)), # yellow - ((1.0, 1.0, 1.0), ( 0 , 1.0, 0.0)), # white - ((0.5, 0.5, 0.5), ( 0 , 0.5, 0.0)), # grey - ] - for (rgb, hls) in values: - self.assertTripleEqual(hls, colorsys.rgb_to_hls(*rgb)) - self.assertTripleEqual(rgb, colorsys.hls_to_rgb(*hls)) - -def test_main(): - test.test_support.run_unittest(ColorsysTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_commands.py b/sys/lib/python/test/test_commands.py deleted file mode 100644 index b72a1b9b6..000000000 --- a/sys/lib/python/test/test_commands.py +++ /dev/null @@ -1,65 +0,0 @@ -''' - Tests for commands module - Nick Mathewson -''' -import unittest -import os, tempfile, re - -from test.test_support import TestSkipped, run_unittest, reap_children -from commands import * - -# The module says: -# "NB This only works (and is only relevant) for UNIX." -# -# Actually, getoutput should work on any platform with an os.popen, but -# I'll take the comment as given, and skip this suite. - -if os.name != 'posix': - raise TestSkipped('Not posix; skipping test_commands') - - -class CommandTests(unittest.TestCase): - - def test_getoutput(self): - self.assertEquals(getoutput('echo xyzzy'), 'xyzzy') - self.assertEquals(getstatusoutput('echo xyzzy'), (0, 'xyzzy')) - - # we use mkdtemp in the next line to create an empty directory - # under our exclusive control; from that, we can invent a pathname - # that we _know_ won't exist. This is guaranteed to fail. - dir = None - try: - dir = tempfile.mkdtemp() - name = os.path.join(dir, "foo") - - status, output = getstatusoutput('cat ' + name) - self.assertNotEquals(status, 0) - finally: - if dir is not None: - os.rmdir(dir) - - def test_getstatus(self): - # This pattern should match 'ls -ld /.' on any posix - # system, however perversely configured. Even on systems - # (e.g., Cygwin) where user and group names can have spaces: - # drwxr-xr-x 15 Administ Domain U 4096 Aug 12 12:50 / - # drwxr-xr-x 15 Joe User My Group 4096 Aug 12 12:50 / - # Note that the first case above has a space in the group name - # while the second one has a space in both names. - pat = r'''d......... # It is a directory. - \+? # It may have ACLs. - \s+\d+ # It has some number of links. - [^/]* # Skip user, group, size, and date. - /\. # and end with the name of the file. - ''' - - self.assert_(re.match(pat, getstatus("/."), re.VERBOSE)) - - -def test_main(): - run_unittest(CommandTests) - reap_children() - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_compare.py b/sys/lib/python/test/test_compare.py deleted file mode 100644 index 2fde614dd..000000000 --- a/sys/lib/python/test/test_compare.py +++ /dev/null @@ -1,59 +0,0 @@ -import sys -import unittest -from test import test_support - -class Empty: - def __repr__(self): - return '' - -class Coerce: - def __init__(self, arg): - self.arg = arg - - def __repr__(self): - return '' % self.arg - - def __coerce__(self, other): - if isinstance(other, Coerce): - return self.arg, other.arg - else: - return self.arg, other - -class Cmp: - def __init__(self,arg): - self.arg = arg - - def __repr__(self): - return '' % self.arg - - def __cmp__(self, other): - return cmp(self.arg, other) - -class ComparisonTest(unittest.TestCase): - set1 = [2, 2.0, 2L, 2+0j, Coerce(2), Cmp(2.0)] - set2 = [[1], (3,), None, Empty()] - candidates = set1 + set2 - - def test_comparisons(self): - for a in self.candidates: - for b in self.candidates: - if ((a in self.set1) and (b in self.set1)) or a is b: - self.assertEqual(a, b) - else: - self.assertNotEqual(a, b) - - def test_id_comparisons(self): - # Ensure default comparison compares id() of args - L = [] - for i in range(10): - L.insert(len(L)//2, Empty()) - for a in L: - for b in L: - self.assertEqual(cmp(a, b), cmp(id(a), id(b)), - 'a=%r, b=%r' % (a, b)) - -def test_main(): - test_support.run_unittest(ComparisonTest) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_compile.py b/sys/lib/python/test/test_compile.py deleted file mode 100644 index a3f15bf65..000000000 --- a/sys/lib/python/test/test_compile.py +++ /dev/null @@ -1,402 +0,0 @@ -import unittest -import warnings -import sys -from test import test_support - -class TestSpecifics(unittest.TestCase): - - def test_debug_assignment(self): - # catch assignments to __debug__ - self.assertRaises(SyntaxError, compile, '__debug__ = 1', '?', 'single') - import __builtin__ - prev = __builtin__.__debug__ - setattr(__builtin__, '__debug__', 'sure') - setattr(__builtin__, '__debug__', prev) - - def test_argument_handling(self): - # detect duplicate positional and keyword arguments - self.assertRaises(SyntaxError, eval, 'lambda a,a:0') - self.assertRaises(SyntaxError, eval, 'lambda a,a=1:0') - self.assertRaises(SyntaxError, eval, 'lambda a=1,a=1:0') - try: - exec 'def f(a, a): pass' - self.fail("duplicate arguments") - except SyntaxError: - pass - try: - exec 'def f(a = 0, a = 1): pass' - self.fail("duplicate keyword arguments") - except SyntaxError: - pass - try: - exec 'def f(a): global a; a = 1' - self.fail("variable is global and local") - except SyntaxError: - pass - - def test_syntax_error(self): - self.assertRaises(SyntaxError, compile, "1+*3", "filename", "exec") - - def test_duplicate_global_local(self): - try: - exec 'def f(a): global a; a = 1' - self.fail("variable is global and local") - except SyntaxError: - pass - - def test_exec_with_general_mapping_for_locals(self): - - class M: - "Test mapping interface versus possible calls from eval()." - def __getitem__(self, key): - if key == 'a': - return 12 - raise KeyError - def __setitem__(self, key, value): - self.results = (key, value) - def keys(self): - return list('xyz') - - m = M() - g = globals() - exec 'z = a' in g, m - self.assertEqual(m.results, ('z', 12)) - try: - exec 'z = b' in g, m - except NameError: - pass - else: - self.fail('Did not detect a KeyError') - exec 'z = dir()' in g, m - self.assertEqual(m.results, ('z', list('xyz'))) - exec 'z = globals()' in g, m - self.assertEqual(m.results, ('z', g)) - exec 'z = locals()' in g, m - self.assertEqual(m.results, ('z', m)) - try: - exec 'z = b' in m - except TypeError: - pass - else: - self.fail('Did not validate globals as a real dict') - - class A: - "Non-mapping" - pass - m = A() - try: - exec 'z = a' in g, m - except TypeError: - pass - else: - self.fail('Did not validate locals as a mapping') - - # Verify that dict subclasses work as well - class D(dict): - def __getitem__(self, key): - if key == 'a': - return 12 - return dict.__getitem__(self, key) - d = D() - exec 'z = a' in g, d - self.assertEqual(d['z'], 12) - - def test_extended_arg(self): - longexpr = 'x = x or ' + '-x' * 2500 - code = ''' -def f(x): - %s - %s - %s - %s - %s - %s - %s - %s - %s - %s - # the expressions above have no effect, x == argument - while x: - x -= 1 - # EXTENDED_ARG/JUMP_ABSOLUTE here - return x -''' % ((longexpr,)*10) - exec code - self.assertEqual(f(5), 0) - - def test_complex_args(self): - - def comp_args((a, b)): - return a,b - self.assertEqual(comp_args((1, 2)), (1, 2)) - - def comp_args((a, b)=(3, 4)): - return a, b - self.assertEqual(comp_args((1, 2)), (1, 2)) - self.assertEqual(comp_args(), (3, 4)) - - def comp_args(a, (b, c)): - return a, b, c - self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) - - def comp_args(a=2, (b, c)=(3, 4)): - return a, b, c - self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) - self.assertEqual(comp_args(), (2, 3, 4)) - - def test_argument_order(self): - try: - exec 'def f(a=1, (b, c)): pass' - self.fail("non-default args after default") - except SyntaxError: - pass - - def test_float_literals(self): - # testing bad float literals - self.assertRaises(SyntaxError, eval, "2e") - self.assertRaises(SyntaxError, eval, "2.0e+") - self.assertRaises(SyntaxError, eval, "1e-") - self.assertRaises(SyntaxError, eval, "3-4e/21") - - def test_indentation(self): - # testing compile() of indented block w/o trailing newline" - s = """ -if 1: - if 2: - pass""" - compile(s, "", "exec") - - # This test is probably specific to CPython and may not generalize - # to other implementations. We are trying to ensure that when - # the first line of code starts after 256, correct line numbers - # in tracebacks are still produced. - def test_leading_newlines(self): - s256 = "".join(["\n"] * 256 + ["spam"]) - co = compile(s256, 'fn', 'exec') - self.assertEqual(co.co_firstlineno, 257) - self.assertEqual(co.co_lnotab, '') - - def test_literals_with_leading_zeroes(self): - for arg in ["077787", "0xj", "0x.", "0e", "090000000000000", - "080000000000000", "000000000000009", "000000000000008"]: - self.assertRaises(SyntaxError, eval, arg) - - self.assertEqual(eval("0777"), 511) - self.assertEqual(eval("0777L"), 511) - self.assertEqual(eval("000777"), 511) - self.assertEqual(eval("0xff"), 255) - self.assertEqual(eval("0xffL"), 255) - self.assertEqual(eval("0XfF"), 255) - self.assertEqual(eval("0777."), 777) - self.assertEqual(eval("0777.0"), 777) - self.assertEqual(eval("000000000000000000000000000000000000000000000000000777e0"), 777) - self.assertEqual(eval("0777e1"), 7770) - self.assertEqual(eval("0e0"), 0) - self.assertEqual(eval("0000E-012"), 0) - self.assertEqual(eval("09.5"), 9.5) - self.assertEqual(eval("0777j"), 777j) - self.assertEqual(eval("00j"), 0j) - self.assertEqual(eval("00.0"), 0) - self.assertEqual(eval("0e3"), 0) - self.assertEqual(eval("090000000000000."), 90000000000000.) - self.assertEqual(eval("090000000000000.0000000000000000000000"), 90000000000000.) - self.assertEqual(eval("090000000000000e0"), 90000000000000.) - self.assertEqual(eval("090000000000000e-0"), 90000000000000.) - self.assertEqual(eval("090000000000000j"), 90000000000000j) - self.assertEqual(eval("000000000000007"), 7) - self.assertEqual(eval("000000000000008."), 8.) - self.assertEqual(eval("000000000000009."), 9.) - - def test_unary_minus(self): - # Verify treatment of unary minus on negative numbers SF bug #660455 - if sys.maxint == 2147483647: - # 32-bit machine - all_one_bits = '0xffffffff' - self.assertEqual(eval(all_one_bits), 4294967295L) - self.assertEqual(eval("-" + all_one_bits), -4294967295L) - elif sys.maxint == 9223372036854775807: - # 64-bit machine - all_one_bits = '0xffffffffffffffff' - self.assertEqual(eval(all_one_bits), 18446744073709551615L) - self.assertEqual(eval("-" + all_one_bits), -18446744073709551615L) - else: - self.fail("How many bits *does* this machine have???") - # Verify treatment of contant folding on -(sys.maxint+1) - # i.e. -2147483648 on 32 bit platforms. Should return int, not long. - self.assertTrue(isinstance(eval("%s" % (-sys.maxint - 1)), int)) - self.assertTrue(isinstance(eval("%s" % (-sys.maxint - 2)), long)) - - if sys.maxint == 9223372036854775807: - def test_32_63_bit_values(self): - a = +4294967296 # 1 << 32 - b = -4294967296 # 1 << 32 - c = +281474976710656 # 1 << 48 - d = -281474976710656 # 1 << 48 - e = +4611686018427387904 # 1 << 62 - f = -4611686018427387904 # 1 << 62 - g = +9223372036854775807 # 1 << 63 - 1 - h = -9223372036854775807 # 1 << 63 - 1 - - for variable in self.test_32_63_bit_values.func_code.co_consts: - if variable is not None: - self.assertTrue(isinstance(variable, int)) - - def test_sequence_unpacking_error(self): - # Verify sequence packing/unpacking with "or". SF bug #757818 - i,j = (1, -1) or (-1, 1) - self.assertEqual(i, 1) - self.assertEqual(j, -1) - - def test_none_assignment(self): - stmts = [ - 'None = 0', - 'None += 0', - '__builtins__.None = 0', - 'def None(): pass', - 'class None: pass', - '(a, None) = 0, 0', - 'for None in range(10): pass', - 'def f(None): pass', - ] - for stmt in stmts: - stmt += "\n" - self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'single') - self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'exec') - - def test_import(self): - succeed = [ - 'import sys', - 'import os, sys', - 'import os as bar', - 'import os.path as bar', - 'from __future__ import nested_scopes, generators', - 'from __future__ import (nested_scopes,\ngenerators)', - 'from __future__ import (nested_scopes,\ngenerators,)', - 'from sys import stdin, stderr, stdout', - 'from sys import (stdin, stderr,\nstdout)', - 'from sys import (stdin, stderr,\nstdout,)', - 'from sys import (stdin\n, stderr, stdout)', - 'from sys import (stdin\n, stderr, stdout,)', - 'from sys import stdin as si, stdout as so, stderr as se', - 'from sys import (stdin as si, stdout as so, stderr as se)', - 'from sys import (stdin as si, stdout as so, stderr as se,)', - ] - fail = [ - 'import (os, sys)', - 'import (os), (sys)', - 'import ((os), (sys))', - 'import (sys', - 'import sys)', - 'import (os,)', - 'import os As bar', - 'import os.path a bar', - 'from sys import stdin As stdout', - 'from sys import stdin a stdout', - 'from (sys) import stdin', - 'from __future__ import (nested_scopes', - 'from __future__ import nested_scopes)', - 'from __future__ import nested_scopes,\ngenerators', - 'from sys import (stdin', - 'from sys import stdin)', - 'from sys import stdin, stdout,\nstderr', - 'from sys import stdin si', - 'from sys import stdin,' - 'from sys import (*)', - 'from sys import (stdin,, stdout, stderr)', - 'from sys import (stdin, stdout),', - ] - for stmt in succeed: - compile(stmt, 'tmp', 'exec') - for stmt in fail: - self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'exec') - - def test_for_distinct_code_objects(self): - # SF bug 1048870 - def f(): - f1 = lambda x=1: x - f2 = lambda x=2: x - return f1, f2 - f1, f2 = f() - self.assertNotEqual(id(f1.func_code), id(f2.func_code)) - - def test_unicode_encoding(self): - code = u"# -*- coding: utf-8 -*-\npass\n" - self.assertRaises(SyntaxError, compile, code, "tmp", "exec") - - def test_subscripts(self): - # SF bug 1448804 - # Class to make testing subscript results easy - class str_map(object): - def __init__(self): - self.data = {} - def __getitem__(self, key): - return self.data[str(key)] - def __setitem__(self, key, value): - self.data[str(key)] = value - def __delitem__(self, key): - del self.data[str(key)] - def __contains__(self, key): - return str(key) in self.data - d = str_map() - # Index - d[1] = 1 - self.assertEqual(d[1], 1) - d[1] += 1 - self.assertEqual(d[1], 2) - del d[1] - self.assertEqual(1 in d, False) - # Tuple of indices - d[1, 1] = 1 - self.assertEqual(d[1, 1], 1) - d[1, 1] += 1 - self.assertEqual(d[1, 1], 2) - del d[1, 1] - self.assertEqual((1, 1) in d, False) - # Simple slice - d[1:2] = 1 - self.assertEqual(d[1:2], 1) - d[1:2] += 1 - self.assertEqual(d[1:2], 2) - del d[1:2] - self.assertEqual(slice(1, 2) in d, False) - # Tuple of simple slices - d[1:2, 1:2] = 1 - self.assertEqual(d[1:2, 1:2], 1) - d[1:2, 1:2] += 1 - self.assertEqual(d[1:2, 1:2], 2) - del d[1:2, 1:2] - self.assertEqual((slice(1, 2), slice(1, 2)) in d, False) - # Extended slice - d[1:2:3] = 1 - self.assertEqual(d[1:2:3], 1) - d[1:2:3] += 1 - self.assertEqual(d[1:2:3], 2) - del d[1:2:3] - self.assertEqual(slice(1, 2, 3) in d, False) - # Tuple of extended slices - d[1:2:3, 1:2:3] = 1 - self.assertEqual(d[1:2:3, 1:2:3], 1) - d[1:2:3, 1:2:3] += 1 - self.assertEqual(d[1:2:3, 1:2:3], 2) - del d[1:2:3, 1:2:3] - self.assertEqual((slice(1, 2, 3), slice(1, 2, 3)) in d, False) - # Ellipsis - d[...] = 1 - self.assertEqual(d[...], 1) - d[...] += 1 - self.assertEqual(d[...], 2) - del d[...] - self.assertEqual(Ellipsis in d, False) - # Tuple of Ellipses - d[..., ...] = 1 - self.assertEqual(d[..., ...], 1) - d[..., ...] += 1 - self.assertEqual(d[..., ...], 2) - del d[..., ...] - self.assertEqual((Ellipsis, Ellipsis) in d, False) - -def test_main(): - test_support.run_unittest(TestSpecifics) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_compiler.py b/sys/lib/python/test/test_compiler.py deleted file mode 100644 index 229d8a370..000000000 --- a/sys/lib/python/test/test_compiler.py +++ /dev/null @@ -1,207 +0,0 @@ -import compiler -from compiler.ast import flatten -import os, sys, time, unittest -import test.test_support -from random import random - -# How much time in seconds can pass before we print a 'Still working' message. -_PRINT_WORKING_MSG_INTERVAL = 5 * 60 - -class TrivialContext(object): - def __enter__(self): - return self - def __exit__(self, *exc_info): - pass - -class CompilerTest(unittest.TestCase): - - def testCompileLibrary(self): - # A simple but large test. Compile all the code in the - # standard library and its test suite. This doesn't verify - # that any of the code is correct, merely the compiler is able - # to generate some kind of code for it. - - next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL - libdir = os.path.dirname(unittest.__file__) - testdir = os.path.dirname(test.test_support.__file__) - - for dir in [libdir, testdir]: - for basename in os.listdir(dir): - # Print still working message since this test can be really slow - if next_time <= time.time(): - next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL - print >>sys.__stdout__, \ - ' testCompileLibrary still working, be patient...' - sys.__stdout__.flush() - - if not basename.endswith(".py"): - continue - if not TEST_ALL and random() < 0.98: - continue - path = os.path.join(dir, basename) - if test.test_support.verbose: - print "compiling", path - f = open(path, "U") - buf = f.read() - f.close() - if "badsyntax" in basename or "bad_coding" in basename: - self.assertRaises(SyntaxError, compiler.compile, - buf, basename, "exec") - else: - try: - compiler.compile(buf, basename, "exec") - except Exception, e: - args = list(e.args) - args[0] += "[in file %s]" % basename - e.args = tuple(args) - raise - - def testNewClassSyntax(self): - compiler.compile("class foo():pass\n\n","","exec") - - def testYieldExpr(self): - compiler.compile("def g(): yield\n\n", "", "exec") - - def testTryExceptFinally(self): - # Test that except and finally clauses in one try stmt are recognized - c = compiler.compile("try:\n 1/0\nexcept:\n e = 1\nfinally:\n f = 1", - "", "exec") - dct = {} - exec c in dct - self.assertEquals(dct.get('e'), 1) - self.assertEquals(dct.get('f'), 1) - - def testDefaultArgs(self): - self.assertRaises(SyntaxError, compiler.parse, "def foo(a=1, b): pass") - - def testDocstrings(self): - c = compiler.compile('"doc"', '', 'exec') - self.assert_('__doc__' in c.co_names) - c = compiler.compile('def f():\n "doc"', '', 'exec') - g = {} - exec c in g - self.assertEquals(g['f'].__doc__, "doc") - - def testLineNo(self): - # Test that all nodes except Module have a correct lineno attribute. - filename = __file__ - if filename.endswith((".pyc", ".pyo")): - filename = filename[:-1] - tree = compiler.parseFile(filename) - self.check_lineno(tree) - - def check_lineno(self, node): - try: - self._check_lineno(node) - except AssertionError: - print node.__class__, node.lineno - raise - - def _check_lineno(self, node): - if not node.__class__ in NOLINENO: - self.assert_(isinstance(node.lineno, int), - "lineno=%s on %s" % (node.lineno, node.__class__)) - self.assert_(node.lineno > 0, - "lineno=%s on %s" % (node.lineno, node.__class__)) - for child in node.getChildNodes(): - self.check_lineno(child) - - def testFlatten(self): - self.assertEquals(flatten([1, [2]]), [1, 2]) - self.assertEquals(flatten((1, (2,))), [1, 2]) - - def testNestedScope(self): - c = compiler.compile('def g():\n' - ' a = 1\n' - ' def f(): return a + 2\n' - ' return f()\n' - 'result = g()', - '', - 'exec') - dct = {} - exec c in dct - self.assertEquals(dct.get('result'), 3) - - def testGenExp(self): - c = compiler.compile('list((i,j) for i in range(3) if i < 3' - ' for j in range(4) if j > 2)', - '', - 'eval') - self.assertEquals(eval(c), [(0, 3), (1, 3), (2, 3)]) - - def testWith(self): - # SF bug 1638243 - c = compiler.compile('from __future__ import with_statement\n' - 'def f():\n' - ' with TrivialContext():\n' - ' return 1\n' - 'result = f()', - '', - 'exec' ) - dct = {'TrivialContext': TrivialContext} - exec c in dct - self.assertEquals(dct.get('result'), 1) - - def testWithAss(self): - c = compiler.compile('from __future__ import with_statement\n' - 'def f():\n' - ' with TrivialContext() as tc:\n' - ' return 1\n' - 'result = f()', - '', - 'exec' ) - dct = {'TrivialContext': TrivialContext} - exec c in dct - self.assertEquals(dct.get('result'), 1) - - -NOLINENO = (compiler.ast.Module, compiler.ast.Stmt, compiler.ast.Discard) - -############################################################################### -# code below is just used to trigger some possible errors, for the benefit of -# testLineNo -############################################################################### - -class Toto: - """docstring""" - pass - -a, b = 2, 3 -[c, d] = 5, 6 -l = [(x, y) for x, y in zip(range(5), range(5,10))] -l[0] -l[3:4] -d = {'a': 2} -d = {} -t = () -t = (1, 2) -l = [] -l = [1, 2] -if l: - pass -else: - a, b = b, a - -try: - print yo -except: - yo = 3 -else: - yo += 3 - -try: - a += b -finally: - b = 0 - -from math import * - -############################################################################### - -def test_main(): - global TEST_ALL - TEST_ALL = test.test_support.is_resource_enabled("compiler") - test.test_support.run_unittest(CompilerTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_complex.py b/sys/lib/python/test/test_complex.py deleted file mode 100644 index 0d42bd2b6..000000000 --- a/sys/lib/python/test/test_complex.py +++ /dev/null @@ -1,341 +0,0 @@ -import unittest, os -from test import test_support - -import warnings -warnings.filterwarnings( - "ignore", - category=DeprecationWarning, - message=".*complex divmod.*are deprecated" -) - -from random import random - -# These tests ensure that complex math does the right thing - -class ComplexTest(unittest.TestCase): - - def assertAlmostEqual(self, a, b): - if isinstance(a, complex): - if isinstance(b, complex): - unittest.TestCase.assertAlmostEqual(self, a.real, b.real) - unittest.TestCase.assertAlmostEqual(self, a.imag, b.imag) - else: - unittest.TestCase.assertAlmostEqual(self, a.real, b) - unittest.TestCase.assertAlmostEqual(self, a.imag, 0.) - else: - if isinstance(b, complex): - unittest.TestCase.assertAlmostEqual(self, a, b.real) - unittest.TestCase.assertAlmostEqual(self, 0., b.imag) - else: - unittest.TestCase.assertAlmostEqual(self, a, b) - - def assertCloseAbs(self, x, y, eps=1e-9): - """Return true iff floats x and y "are close\"""" - # put the one with larger magnitude second - if abs(x) > abs(y): - x, y = y, x - if y == 0: - return abs(x) < eps - if x == 0: - return abs(y) < eps - # check that relative difference < eps - self.assert_(abs((x-y)/y) < eps) - - def assertClose(self, x, y, eps=1e-9): - """Return true iff complexes x and y "are close\"""" - self.assertCloseAbs(x.real, y.real, eps) - self.assertCloseAbs(x.imag, y.imag, eps) - - def assertIs(self, a, b): - self.assert_(a is b) - - def check_div(self, x, y): - """Compute complex z=x*y, and check that z/x==y and z/y==x.""" - z = x * y - if x != 0: - q = z / x - self.assertClose(q, y) - q = z.__div__(x) - self.assertClose(q, y) - q = z.__truediv__(x) - self.assertClose(q, y) - if y != 0: - q = z / y - self.assertClose(q, x) - q = z.__div__(y) - self.assertClose(q, x) - q = z.__truediv__(y) - self.assertClose(q, x) - - def test_div(self): - simple_real = [float(i) for i in xrange(-5, 6)] - simple_complex = [complex(x, y) for x in simple_real for y in simple_real] - for x in simple_complex: - for y in simple_complex: - self.check_div(x, y) - - # A naive complex division algorithm (such as in 2.0) is very prone to - # nonsense errors for these (overflows and underflows). - self.check_div(complex(1e200, 1e200), 1+0j) - self.check_div(complex(1e-200, 1e-200), 1+0j) - - # Just for fun. - for i in xrange(100): - self.check_div(complex(random(), random()), - complex(random(), random())) - - self.assertRaises(ZeroDivisionError, complex.__div__, 1+1j, 0+0j) - # FIXME: The following currently crashes on Alpha - # self.assertRaises(OverflowError, pow, 1e200+1j, 1e200+1j) - - def test_truediv(self): - self.assertAlmostEqual(complex.__truediv__(2+0j, 1+1j), 1-1j) - self.assertRaises(ZeroDivisionError, complex.__truediv__, 1+1j, 0+0j) - - def test_floordiv(self): - self.assertAlmostEqual(complex.__floordiv__(3+0j, 1.5+0j), 2) - self.assertRaises(ZeroDivisionError, complex.__floordiv__, 3+0j, 0+0j) - - def test_coerce(self): - self.assertRaises(OverflowError, complex.__coerce__, 1+1j, 1L<<10000) - - def test_richcompare(self): - self.assertRaises(OverflowError, complex.__eq__, 1+1j, 1L<<10000) - self.assertEqual(complex.__lt__(1+1j, None), NotImplemented) - self.assertIs(complex.__eq__(1+1j, 1+1j), True) - self.assertIs(complex.__eq__(1+1j, 2+2j), False) - self.assertIs(complex.__ne__(1+1j, 1+1j), False) - self.assertIs(complex.__ne__(1+1j, 2+2j), True) - self.assertRaises(TypeError, complex.__lt__, 1+1j, 2+2j) - self.assertRaises(TypeError, complex.__le__, 1+1j, 2+2j) - self.assertRaises(TypeError, complex.__gt__, 1+1j, 2+2j) - self.assertRaises(TypeError, complex.__ge__, 1+1j, 2+2j) - - def test_mod(self): - self.assertRaises(ZeroDivisionError, (1+1j).__mod__, 0+0j) - - a = 3.33+4.43j - try: - a % 0 - except ZeroDivisionError: - pass - else: - self.fail("modulo parama can't be 0") - - def test_divmod(self): - self.assertRaises(ZeroDivisionError, divmod, 1+1j, 0+0j) - - def test_pow(self): - self.assertAlmostEqual(pow(1+1j, 0+0j), 1.0) - self.assertAlmostEqual(pow(0+0j, 2+0j), 0.0) - self.assertRaises(ZeroDivisionError, pow, 0+0j, 1j) - self.assertAlmostEqual(pow(1j, -1), 1/1j) - self.assertAlmostEqual(pow(1j, 200), 1) - self.assertRaises(ValueError, pow, 1+1j, 1+1j, 1+1j) - - a = 3.33+4.43j - self.assertEqual(a ** 0j, 1) - self.assertEqual(a ** 0.+0.j, 1) - - self.assertEqual(3j ** 0j, 1) - self.assertEqual(3j ** 0, 1) - - try: - 0j ** a - except ZeroDivisionError: - pass - else: - self.fail("should fail 0.0 to negative or complex power") - - try: - 0j ** (3-2j) - except ZeroDivisionError: - pass - else: - self.fail("should fail 0.0 to negative or complex power") - - # The following is used to exercise certain code paths - self.assertEqual(a ** 105, a ** 105) - self.assertEqual(a ** -105, a ** -105) - self.assertEqual(a ** -30, a ** -30) - - self.assertEqual(0.0j ** 0, 1) - - b = 5.1+2.3j - self.assertRaises(ValueError, pow, a, b, 0) - - def test_boolcontext(self): - for i in xrange(100): - self.assert_(complex(random() + 1e-6, random() + 1e-6)) - self.assert_(not complex(0.0, 0.0)) - - def test_conjugate(self): - self.assertClose(complex(5.3, 9.8).conjugate(), 5.3-9.8j) - - def test_constructor(self): - class OS: - def __init__(self, value): self.value = value - def __complex__(self): return self.value - class NS(object): - def __init__(self, value): self.value = value - def __complex__(self): return self.value - self.assertEqual(complex(OS(1+10j)), 1+10j) - self.assertEqual(complex(NS(1+10j)), 1+10j) - self.assertRaises(TypeError, complex, OS(None)) - self.assertRaises(TypeError, complex, NS(None)) - - self.assertAlmostEqual(complex("1+10j"), 1+10j) - self.assertAlmostEqual(complex(10), 10+0j) - self.assertAlmostEqual(complex(10.0), 10+0j) - self.assertAlmostEqual(complex(10L), 10+0j) - self.assertAlmostEqual(complex(10+0j), 10+0j) - self.assertAlmostEqual(complex(1,10), 1+10j) - self.assertAlmostEqual(complex(1,10L), 1+10j) - self.assertAlmostEqual(complex(1,10.0), 1+10j) - self.assertAlmostEqual(complex(1L,10), 1+10j) - self.assertAlmostEqual(complex(1L,10L), 1+10j) - self.assertAlmostEqual(complex(1L,10.0), 1+10j) - self.assertAlmostEqual(complex(1.0,10), 1+10j) - self.assertAlmostEqual(complex(1.0,10L), 1+10j) - self.assertAlmostEqual(complex(1.0,10.0), 1+10j) - self.assertAlmostEqual(complex(3.14+0j), 3.14+0j) - self.assertAlmostEqual(complex(3.14), 3.14+0j) - self.assertAlmostEqual(complex(314), 314.0+0j) - self.assertAlmostEqual(complex(314L), 314.0+0j) - self.assertAlmostEqual(complex(3.14+0j, 0j), 3.14+0j) - self.assertAlmostEqual(complex(3.14, 0.0), 3.14+0j) - self.assertAlmostEqual(complex(314, 0), 314.0+0j) - self.assertAlmostEqual(complex(314L, 0L), 314.0+0j) - self.assertAlmostEqual(complex(0j, 3.14j), -3.14+0j) - self.assertAlmostEqual(complex(0.0, 3.14j), -3.14+0j) - self.assertAlmostEqual(complex(0j, 3.14), 3.14j) - self.assertAlmostEqual(complex(0.0, 3.14), 3.14j) - self.assertAlmostEqual(complex("1"), 1+0j) - self.assertAlmostEqual(complex("1j"), 1j) - self.assertAlmostEqual(complex(), 0) - self.assertAlmostEqual(complex("-1"), -1) - self.assertAlmostEqual(complex("+1"), +1) - - class complex2(complex): pass - self.assertAlmostEqual(complex(complex2(1+1j)), 1+1j) - self.assertAlmostEqual(complex(real=17, imag=23), 17+23j) - self.assertAlmostEqual(complex(real=17+23j), 17+23j) - self.assertAlmostEqual(complex(real=17+23j, imag=23), 17+46j) - self.assertAlmostEqual(complex(real=1+2j, imag=3+4j), -3+5j) - - c = 3.14 + 1j - self.assert_(complex(c) is c) - del c - - self.assertRaises(TypeError, complex, "1", "1") - self.assertRaises(TypeError, complex, 1, "1") - - self.assertEqual(complex(" 3.14+J "), 3.14+1j) - if test_support.have_unicode: - self.assertEqual(complex(unicode(" 3.14+J ")), 3.14+1j) - - # SF bug 543840: complex(string) accepts strings with \0 - # Fixed in 2.3. - self.assertRaises(ValueError, complex, '1+1j\0j') - - self.assertRaises(TypeError, int, 5+3j) - self.assertRaises(TypeError, long, 5+3j) - self.assertRaises(TypeError, float, 5+3j) - self.assertRaises(ValueError, complex, "") - self.assertRaises(TypeError, complex, None) - self.assertRaises(ValueError, complex, "\0") - self.assertRaises(TypeError, complex, "1", "2") - self.assertRaises(TypeError, complex, "1", 42) - self.assertRaises(TypeError, complex, 1, "2") - self.assertRaises(ValueError, complex, "1+") - self.assertRaises(ValueError, complex, "1+1j+1j") - self.assertRaises(ValueError, complex, "--") - if test_support.have_unicode: - self.assertRaises(ValueError, complex, unicode("1"*500)) - self.assertRaises(ValueError, complex, unicode("x")) - - class EvilExc(Exception): - pass - - class evilcomplex: - def __complex__(self): - raise EvilExc - - self.assertRaises(EvilExc, complex, evilcomplex()) - - class float2: - def __init__(self, value): - self.value = value - def __float__(self): - return self.value - - self.assertAlmostEqual(complex(float2(42.)), 42) - self.assertAlmostEqual(complex(real=float2(17.), imag=float2(23.)), 17+23j) - self.assertRaises(TypeError, complex, float2(None)) - - class complex0(complex): - """Test usage of __complex__() when inheriting from 'complex'""" - def __complex__(self): - return 42j - - class complex1(complex): - """Test usage of __complex__() with a __new__() method""" - def __new__(self, value=0j): - return complex.__new__(self, 2*value) - def __complex__(self): - return self - - class complex2(complex): - """Make sure that __complex__() calls fail if anything other than a - complex is returned""" - def __complex__(self): - return None - - self.assertAlmostEqual(complex(complex0(1j)), 42j) - self.assertAlmostEqual(complex(complex1(1j)), 2j) - self.assertRaises(TypeError, complex, complex2(1j)) - - def test_hash(self): - for x in xrange(-30, 30): - self.assertEqual(hash(x), hash(complex(x, 0))) - x /= 3.0 # now check against floating point - self.assertEqual(hash(x), hash(complex(x, 0.))) - - def test_abs(self): - nums = [complex(x/3., y/7.) for x in xrange(-9,9) for y in xrange(-9,9)] - for num in nums: - self.assertAlmostEqual((num.real**2 + num.imag**2) ** 0.5, abs(num)) - - def test_repr(self): - self.assertEqual(repr(1+6j), '(1+6j)') - self.assertEqual(repr(1-6j), '(1-6j)') - - self.assertNotEqual(repr(-(1+0j)), '(-1+-0j)') - - def test_neg(self): - self.assertEqual(-(1+6j), -1-6j) - - def test_file(self): - a = 3.33+4.43j - b = 5.1+2.3j - - fo = None - try: - fo = open(test_support.TESTFN, "wb") - print >>fo, a, b - fo.close() - fo = open(test_support.TESTFN, "rb") - self.assertEqual(fo.read(), "%s %s\n" % (a, b)) - finally: - if (fo is not None) and (not fo.closed): - fo.close() - try: - os.remove(test_support.TESTFN) - except (OSError, IOError): - pass - -def test_main(): - test_support.run_unittest(ComplexTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_complex_args.py b/sys/lib/python/test/test_complex_args.py deleted file mode 100644 index c6d50a9d0..000000000 --- a/sys/lib/python/test/test_complex_args.py +++ /dev/null @@ -1,91 +0,0 @@ - -import unittest -from test import test_support - -class ComplexArgsTestCase(unittest.TestCase): - - def check(self, func, expected, *args): - self.assertEqual(func(*args), expected) - - # These functions are tested below as lambdas too. If you add a function test, - # also add a similar lambda test. - - def test_func_parens_no_unpacking(self): - def f(((((x))))): return x - self.check(f, 1, 1) - # Inner parens are elided, same as: f(x,) - def f(((x)),): return x - self.check(f, 2, 2) - - def test_func_1(self): - def f(((((x),)))): return x - self.check(f, 3, (3,)) - def f(((((x)),))): return x - self.check(f, 4, (4,)) - def f(((((x))),)): return x - self.check(f, 5, (5,)) - def f(((x),)): return x - self.check(f, 6, (6,)) - - def test_func_2(self): - def f(((((x)),),)): return x - self.check(f, 2, ((2,),)) - - def test_func_3(self): - def f((((((x)),),),)): return x - self.check(f, 3, (((3,),),)) - - def test_func_complex(self): - def f((((((x)),),),), a, b, c): return x, a, b, c - self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) - - def f(((((((x)),)),),), a, b, c): return x, a, b, c - self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) - - def f(a, b, c, ((((((x)),)),),)): return a, b, c, x - self.check(f, (9, 8, 7, 3), 9, 8, 7, (((3,),),)) - - # Duplicate the tests above, but for lambda. If you add a lambda test, - # also add a similar function test above. - - def test_lambda_parens_no_unpacking(self): - f = lambda (((((x))))): x - self.check(f, 1, 1) - # Inner parens are elided, same as: f(x,) - f = lambda ((x)),: x - self.check(f, 2, 2) - - def test_lambda_1(self): - f = lambda (((((x),)))): x - self.check(f, 3, (3,)) - f = lambda (((((x)),))): x - self.check(f, 4, (4,)) - f = lambda (((((x))),)): x - self.check(f, 5, (5,)) - f = lambda (((x),)): x - self.check(f, 6, (6,)) - - def test_lambda_2(self): - f = lambda (((((x)),),)): x - self.check(f, 2, ((2,),)) - - def test_lambda_3(self): - f = lambda ((((((x)),),),)): x - self.check(f, 3, (((3,),),)) - - def test_lambda_complex(self): - f = lambda (((((x)),),),), a, b, c: (x, a, b, c) - self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) - - f = lambda ((((((x)),)),),), a, b, c: (x, a, b, c) - self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) - - f = lambda a, b, c, ((((((x)),)),),): (a, b, c, x) - self.check(f, (9, 8, 7, 3), 9, 8, 7, (((3,),),)) - - -def test_main(): - test_support.run_unittest(ComplexArgsTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_contains.py b/sys/lib/python/test/test_contains.py deleted file mode 100644 index e6f5cf727..000000000 --- a/sys/lib/python/test/test_contains.py +++ /dev/null @@ -1,133 +0,0 @@ -from test.test_support import TestFailed, have_unicode - -class base_set: - - def __init__(self, el): - self.el = el - -class set(base_set): - - def __contains__(self, el): - return self.el == el - -class seq(base_set): - - def __getitem__(self, n): - return [self.el][n] - -def check(ok, *args): - if not ok: - raise TestFailed, " ".join(map(str, args)) - -a = base_set(1) -b = set(1) -c = seq(1) - -check(1 in b, "1 not in set(1)") -check(0 not in b, "0 in set(1)") -check(1 in c, "1 not in seq(1)") -check(0 not in c, "0 in seq(1)") - -try: - 1 in a - check(0, "in base_set did not raise error") -except TypeError: - pass - -try: - 1 not in a - check(0, "not in base_set did not raise error") -except TypeError: - pass - -# Test char in string - -check('c' in 'abc', "'c' not in 'abc'") -check('d' not in 'abc', "'d' in 'abc'") - -check('' in '', "'' not in ''") -check('' in 'abc', "'' not in 'abc'") - -try: - None in 'abc' - check(0, "None in 'abc' did not raise error") -except TypeError: - pass - - -if have_unicode: - - # Test char in Unicode - - check('c' in unicode('abc'), "'c' not in u'abc'") - check('d' not in unicode('abc'), "'d' in u'abc'") - - check('' in unicode(''), "'' not in u''") - check(unicode('') in '', "u'' not in ''") - check(unicode('') in unicode(''), "u'' not in u''") - check('' in unicode('abc'), "'' not in u'abc'") - check(unicode('') in 'abc', "u'' not in 'abc'") - check(unicode('') in unicode('abc'), "u'' not in u'abc'") - - try: - None in unicode('abc') - check(0, "None in u'abc' did not raise error") - except TypeError: - pass - - # Test Unicode char in Unicode - - check(unicode('c') in unicode('abc'), "u'c' not in u'abc'") - check(unicode('d') not in unicode('abc'), "u'd' in u'abc'") - - # Test Unicode char in string - - check(unicode('c') in 'abc', "u'c' not in 'abc'") - check(unicode('d') not in 'abc', "u'd' in 'abc'") - -# A collection of tests on builtin sequence types -a = range(10) -for i in a: - check(i in a, "%r not in %r" % (i, a)) -check(16 not in a, "16 not in %r" % (a,)) -check(a not in a, "%s not in %r" % (a, a)) - -a = tuple(a) -for i in a: - check(i in a, "%r not in %r" % (i, a)) -check(16 not in a, "16 not in %r" % (a,)) -check(a not in a, "%r not in %r" % (a, a)) - -class Deviant1: - """Behaves strangely when compared - - This class is designed to make sure that the contains code - works when the list is modified during the check. - """ - - aList = range(15) - - def __cmp__(self, other): - if other == 12: - self.aList.remove(12) - self.aList.remove(13) - self.aList.remove(14) - return 1 - -check(Deviant1() not in Deviant1.aList, "Deviant1 failed") - -class Deviant2: - """Behaves strangely when compared - - This class raises an exception during comparison. That in - turn causes the comparison to fail with a TypeError. - """ - - def __cmp__(self, other): - if other == 4: - raise RuntimeError, "gotcha" - -try: - check(Deviant2() not in a, "oops") -except TypeError: - pass diff --git a/sys/lib/python/test/test_contextlib.py b/sys/lib/python/test/test_contextlib.py deleted file mode 100644 index 747785d54..000000000 --- a/sys/lib/python/test/test_contextlib.py +++ /dev/null @@ -1,340 +0,0 @@ -"""Unit tests for contextlib.py, and other context managers.""" - -from __future__ import with_statement - -import sys -import os -import decimal -import tempfile -import unittest -import threading -from contextlib import * # Tests __all__ -from test.test_support import run_suite - -class ContextManagerTestCase(unittest.TestCase): - - def test_contextmanager_plain(self): - state = [] - @contextmanager - def woohoo(): - state.append(1) - yield 42 - state.append(999) - with woohoo() as x: - self.assertEqual(state, [1]) - self.assertEqual(x, 42) - state.append(x) - self.assertEqual(state, [1, 42, 999]) - - def test_contextmanager_finally(self): - state = [] - @contextmanager - def woohoo(): - state.append(1) - try: - yield 42 - finally: - state.append(999) - try: - with woohoo() as x: - self.assertEqual(state, [1]) - self.assertEqual(x, 42) - state.append(x) - raise ZeroDivisionError() - except ZeroDivisionError: - pass - else: - self.fail("Expected ZeroDivisionError") - self.assertEqual(state, [1, 42, 999]) - - def test_contextmanager_no_reraise(self): - @contextmanager - def whee(): - yield - ctx = whee() - ctx.__enter__() - # Calling __exit__ should not result in an exception - self.failIf(ctx.__exit__(TypeError, TypeError("foo"), None)) - - def test_contextmanager_trap_yield_after_throw(self): - @contextmanager - def whoo(): - try: - yield - except: - yield - ctx = whoo() - ctx.__enter__() - self.assertRaises( - RuntimeError, ctx.__exit__, TypeError, TypeError("foo"), None - ) - - def test_contextmanager_except(self): - state = [] - @contextmanager - def woohoo(): - state.append(1) - try: - yield 42 - except ZeroDivisionError, e: - state.append(e.args[0]) - self.assertEqual(state, [1, 42, 999]) - with woohoo() as x: - self.assertEqual(state, [1]) - self.assertEqual(x, 42) - state.append(x) - raise ZeroDivisionError(999) - self.assertEqual(state, [1, 42, 999]) - - def test_contextmanager_attribs(self): - def attribs(**kw): - def decorate(func): - for k,v in kw.items(): - setattr(func,k,v) - return func - return decorate - @contextmanager - @attribs(foo='bar') - def baz(spam): - """Whee!""" - self.assertEqual(baz.__name__,'baz') - self.assertEqual(baz.foo, 'bar') - self.assertEqual(baz.__doc__, "Whee!") - -class NestedTestCase(unittest.TestCase): - - # XXX This needs more work - - def test_nested(self): - @contextmanager - def a(): - yield 1 - @contextmanager - def b(): - yield 2 - @contextmanager - def c(): - yield 3 - with nested(a(), b(), c()) as (x, y, z): - self.assertEqual(x, 1) - self.assertEqual(y, 2) - self.assertEqual(z, 3) - - def test_nested_cleanup(self): - state = [] - @contextmanager - def a(): - state.append(1) - try: - yield 2 - finally: - state.append(3) - @contextmanager - def b(): - state.append(4) - try: - yield 5 - finally: - state.append(6) - try: - with nested(a(), b()) as (x, y): - state.append(x) - state.append(y) - 1/0 - except ZeroDivisionError: - self.assertEqual(state, [1, 4, 2, 5, 6, 3]) - else: - self.fail("Didn't raise ZeroDivisionError") - - def test_nested_right_exception(self): - state = [] - @contextmanager - def a(): - yield 1 - class b(object): - def __enter__(self): - return 2 - def __exit__(self, *exc_info): - try: - raise Exception() - except: - pass - try: - with nested(a(), b()) as (x, y): - 1/0 - except ZeroDivisionError: - self.assertEqual((x, y), (1, 2)) - except Exception: - self.fail("Reraised wrong exception") - else: - self.fail("Didn't raise ZeroDivisionError") - - def test_nested_b_swallows(self): - @contextmanager - def a(): - yield - @contextmanager - def b(): - try: - yield - except: - # Swallow the exception - pass - try: - with nested(a(), b()): - 1/0 - except ZeroDivisionError: - self.fail("Didn't swallow ZeroDivisionError") - - def test_nested_break(self): - @contextmanager - def a(): - yield - state = 0 - while True: - state += 1 - with nested(a(), a()): - break - state += 10 - self.assertEqual(state, 1) - - def test_nested_continue(self): - @contextmanager - def a(): - yield - state = 0 - while state < 3: - state += 1 - with nested(a(), a()): - continue - state += 10 - self.assertEqual(state, 3) - - def test_nested_return(self): - @contextmanager - def a(): - try: - yield - except: - pass - def foo(): - with nested(a(), a()): - return 1 - return 10 - self.assertEqual(foo(), 1) - -class ClosingTestCase(unittest.TestCase): - - # XXX This needs more work - - def test_closing(self): - state = [] - class C: - def close(self): - state.append(1) - x = C() - self.assertEqual(state, []) - with closing(x) as y: - self.assertEqual(x, y) - self.assertEqual(state, [1]) - - def test_closing_error(self): - state = [] - class C: - def close(self): - state.append(1) - x = C() - self.assertEqual(state, []) - try: - with closing(x) as y: - self.assertEqual(x, y) - 1/0 - except ZeroDivisionError: - self.assertEqual(state, [1]) - else: - self.fail("Didn't raise ZeroDivisionError") - -class FileContextTestCase(unittest.TestCase): - - def testWithOpen(self): - tfn = tempfile.mktemp() - try: - f = None - with open(tfn, "w") as f: - self.failIf(f.closed) - f.write("Booh\n") - self.failUnless(f.closed) - f = None - try: - with open(tfn, "r") as f: - self.failIf(f.closed) - self.assertEqual(f.read(), "Booh\n") - 1/0 - except ZeroDivisionError: - self.failUnless(f.closed) - else: - self.fail("Didn't raise ZeroDivisionError") - finally: - try: - os.remove(tfn) - except os.error: - pass - -class LockContextTestCase(unittest.TestCase): - - def boilerPlate(self, lock, locked): - self.failIf(locked()) - with lock: - self.failUnless(locked()) - self.failIf(locked()) - try: - with lock: - self.failUnless(locked()) - 1/0 - except ZeroDivisionError: - self.failIf(locked()) - else: - self.fail("Didn't raise ZeroDivisionError") - - def testWithLock(self): - lock = threading.Lock() - self.boilerPlate(lock, lock.locked) - - def testWithRLock(self): - lock = threading.RLock() - self.boilerPlate(lock, lock._is_owned) - - def testWithCondition(self): - lock = threading.Condition() - def locked(): - return lock._is_owned() - self.boilerPlate(lock, locked) - - def testWithSemaphore(self): - lock = threading.Semaphore() - def locked(): - if lock.acquire(False): - lock.release() - return False - else: - return True - self.boilerPlate(lock, locked) - - def testWithBoundedSemaphore(self): - lock = threading.BoundedSemaphore() - def locked(): - if lock.acquire(False): - lock.release() - return False - else: - return True - self.boilerPlate(lock, locked) - -# This is needed to make the test actually run under regrtest.py! -def test_main(): - run_suite( - unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_cookie.py b/sys/lib/python/test/test_cookie.py deleted file mode 100644 index c20beeeb1..000000000 --- a/sys/lib/python/test/test_cookie.py +++ /dev/null @@ -1,50 +0,0 @@ -# Simple test suite for Cookie.py - -from test.test_support import verify, verbose, run_doctest -import Cookie - -import warnings -warnings.filterwarnings("ignore", - ".* class is insecure.*", - DeprecationWarning) - -# Currently this only tests SimpleCookie - -cases = [ - ('chips=ahoy; vienna=finger', {'chips':'ahoy', 'vienna':'finger'}), - ('keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"', - {'keebler' : 'E=mc2; L="Loves"; fudge=\012;'}), - - # Check illegal cookies that have an '=' char in an unquoted value - ('keebler=E=mc2', {'keebler' : 'E=mc2'}) - ] - -for data, dict in cases: - C = Cookie.SimpleCookie() ; C.load(data) - print repr(C) - print C.output(sep='\n') - for k, v in sorted(dict.iteritems()): - print ' ', k, repr( C[k].value ), repr(v) - verify(C[k].value == v) - print C[k] - -C = Cookie.SimpleCookie() -C.load('Customer="WILE_E_COYOTE"; Version=1; Path=/acme') - -verify(C['Customer'].value == 'WILE_E_COYOTE') -verify(C['Customer']['version'] == '1') -verify(C['Customer']['path'] == '/acme') - -print C.output(['path']) -print C.js_output() -print C.js_output(['path']) - -# Try cookie with quoted meta-data -C = Cookie.SimpleCookie() -C.load('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"') -verify(C['Customer'].value == 'WILE_E_COYOTE') -verify(C['Customer']['version'] == '1') -verify(C['Customer']['path'] == '/acme') - -print "If anything blows up after this line, it's from Cookie's doctest." -run_doctest(Cookie) diff --git a/sys/lib/python/test/test_cookielib.py b/sys/lib/python/test/test_cookielib.py deleted file mode 100644 index 991506cb5..000000000 --- a/sys/lib/python/test/test_cookielib.py +++ /dev/null @@ -1,1736 +0,0 @@ -# -*- coding: utf-8 -*- -"""Tests for cookielib.py.""" - -import re, os, time -from unittest import TestCase - -from test import test_support - -class DateTimeTests(TestCase): - - def test_time2isoz(self): - from cookielib import time2isoz - - base = 1019227000 - day = 24*3600 - self.assertEquals(time2isoz(base), "2002-04-19 14:36:40Z") - self.assertEquals(time2isoz(base+day), "2002-04-20 14:36:40Z") - self.assertEquals(time2isoz(base+2*day), "2002-04-21 14:36:40Z") - self.assertEquals(time2isoz(base+3*day), "2002-04-22 14:36:40Z") - - az = time2isoz() - bz = time2isoz(500000) - for text in (az, bz): - self.assert_(re.search(r"^\d{4}-\d\d-\d\d \d\d:\d\d:\d\dZ$", text), - "bad time2isoz format: %s %s" % (az, bz)) - - def test_http2time(self): - from cookielib import http2time - - def parse_date(text): - return time.gmtime(http2time(text))[:6] - - self.assertEquals(parse_date("01 Jan 2001"), (2001, 1, 1, 0, 0, 0.0)) - - # this test will break around year 2070 - self.assertEquals(parse_date("03-Feb-20"), (2020, 2, 3, 0, 0, 0.0)) - - # this test will break around year 2048 - self.assertEquals(parse_date("03-Feb-98"), (1998, 2, 3, 0, 0, 0.0)) - - def test_http2time_formats(self): - from cookielib import http2time, time2isoz - - # test http2time for supported dates. Test cases with 2 digit year - # will probably break in year 2044. - tests = [ - 'Thu, 03 Feb 1994 00:00:00 GMT', # proposed new HTTP format - 'Thursday, 03-Feb-94 00:00:00 GMT', # old rfc850 HTTP format - 'Thursday, 03-Feb-1994 00:00:00 GMT', # broken rfc850 HTTP format - - '03 Feb 1994 00:00:00 GMT', # HTTP format (no weekday) - '03-Feb-94 00:00:00 GMT', # old rfc850 (no weekday) - '03-Feb-1994 00:00:00 GMT', # broken rfc850 (no weekday) - '03-Feb-1994 00:00 GMT', # broken rfc850 (no weekday, no seconds) - '03-Feb-1994 00:00', # broken rfc850 (no weekday, no seconds, no tz) - - '03-Feb-94', # old rfc850 HTTP format (no weekday, no time) - '03-Feb-1994', # broken rfc850 HTTP format (no weekday, no time) - '03 Feb 1994', # proposed new HTTP format (no weekday, no time) - - # A few tests with extra space at various places - ' 03 Feb 1994 0:00 ', - ' 03-Feb-1994 ', - ] - - test_t = 760233600 # assume broken POSIX counting of seconds - result = time2isoz(test_t) - expected = "1994-02-03 00:00:00Z" - self.assertEquals(result, expected, - "%s => '%s' (%s)" % (test_t, result, expected)) - - for s in tests: - t = http2time(s) - t2 = http2time(s.lower()) - t3 = http2time(s.upper()) - - self.assert_(t == t2 == t3 == test_t, - "'%s' => %s, %s, %s (%s)" % (s, t, t2, t3, test_t)) - - def test_http2time_garbage(self): - from cookielib import http2time - - for test in [ - '', - 'Garbage', - 'Mandag 16. September 1996', - '01-00-1980', - '01-13-1980', - '00-01-1980', - '32-01-1980', - '01-01-1980 25:00:00', - '01-01-1980 00:61:00', - '01-01-1980 00:00:62', - ]: - self.assert_(http2time(test) is None, - "http2time(%s) is not None\n" - "http2time(test) %s" % (test, http2time(test)) - ) - - -class HeaderTests(TestCase): - def test_parse_ns_headers(self): - from cookielib import parse_ns_headers - - # quotes should be stripped - expected = [[('foo', 'bar'), ('expires', 2209069412L), ('version', '0')]] - for hdr in [ - 'foo=bar; expires=01 Jan 2040 22:23:32 GMT', - 'foo=bar; expires="01 Jan 2040 22:23:32 GMT"', - ]: - self.assertEquals(parse_ns_headers([hdr]), expected) - - def test_parse_ns_headers_special_names(self): - # names such as 'expires' are not special in first name=value pair - # of Set-Cookie: header - from cookielib import parse_ns_headers - - # Cookie with name 'expires' - hdr = 'expires=01 Jan 2040 22:23:32 GMT' - expected = [[("expires", "01 Jan 2040 22:23:32 GMT"), ("version", "0")]] - self.assertEquals(parse_ns_headers([hdr]), expected) - - def test_join_header_words(self): - from cookielib import join_header_words - - joined = join_header_words([[("foo", None), ("bar", "baz")]]) - self.assertEquals(joined, "foo; bar=baz") - - self.assertEquals(join_header_words([[]]), "") - - def test_split_header_words(self): - from cookielib import split_header_words - - tests = [ - ("foo", [[("foo", None)]]), - ("foo=bar", [[("foo", "bar")]]), - (" foo ", [[("foo", None)]]), - (" foo= ", [[("foo", "")]]), - (" foo=", [[("foo", "")]]), - (" foo= ; ", [[("foo", "")]]), - (" foo= ; bar= baz ", [[("foo", ""), ("bar", "baz")]]), - ("foo=bar bar=baz", [[("foo", "bar"), ("bar", "baz")]]), - # doesn't really matter if this next fails, but it works ATM - ("foo= bar=baz", [[("foo", "bar=baz")]]), - ("foo=bar;bar=baz", [[("foo", "bar"), ("bar", "baz")]]), - ('foo bar baz', [[("foo", None), ("bar", None), ("baz", None)]]), - ("a, b, c", [[("a", None)], [("b", None)], [("c", None)]]), - (r'foo; bar=baz, spam=, foo="\,\;\"", bar= ', - [[("foo", None), ("bar", "baz")], - [("spam", "")], [("foo", ',;"')], [("bar", "")]]), - ] - - for arg, expect in tests: - try: - result = split_header_words([arg]) - except: - import traceback, StringIO - f = StringIO.StringIO() - traceback.print_exc(None, f) - result = "(error -- traceback follows)\n\n%s" % f.getvalue() - self.assertEquals(result, expect, """ -When parsing: '%s' -Expected: '%s' -Got: '%s' -""" % (arg, expect, result)) - - def test_roundtrip(self): - from cookielib import split_header_words, join_header_words - - tests = [ - ("foo", "foo"), - ("foo=bar", "foo=bar"), - (" foo ", "foo"), - ("foo=", 'foo=""'), - ("foo=bar bar=baz", "foo=bar; bar=baz"), - ("foo=bar;bar=baz", "foo=bar; bar=baz"), - ('foo bar baz', "foo; bar; baz"), - (r'foo="\"" bar="\\"', r'foo="\""; bar="\\"'), - ('foo,,,bar', 'foo, bar'), - ('foo=bar,bar=baz', 'foo=bar, bar=baz'), - - ('text/html; charset=iso-8859-1', - 'text/html; charset="iso-8859-1"'), - - ('foo="bar"; port="80,81"; discard, bar=baz', - 'foo=bar; port="80,81"; discard, bar=baz'), - - (r'Basic realm="\"foo\\\\bar\""', - r'Basic; realm="\"foo\\\\bar\""') - ] - - for arg, expect in tests: - input = split_header_words([arg]) - res = join_header_words(input) - self.assertEquals(res, expect, """ -When parsing: '%s' -Expected: '%s' -Got: '%s' -Input was: '%s' -""" % (arg, expect, res, input)) - - -class FakeResponse: - def __init__(self, headers=[], url=None): - """ - headers: list of RFC822-style 'Key: value' strings - """ - import mimetools, StringIO - f = StringIO.StringIO("\n".join(headers)) - self._headers = mimetools.Message(f) - self._url = url - def info(self): return self._headers - -def interact_2965(cookiejar, url, *set_cookie_hdrs): - return _interact(cookiejar, url, set_cookie_hdrs, "Set-Cookie2") - -def interact_netscape(cookiejar, url, *set_cookie_hdrs): - return _interact(cookiejar, url, set_cookie_hdrs, "Set-Cookie") - -def _interact(cookiejar, url, set_cookie_hdrs, hdr_name): - """Perform a single request / response cycle, returning Cookie: header.""" - from urllib2 import Request - req = Request(url) - cookiejar.add_cookie_header(req) - cookie_hdr = req.get_header("Cookie", "") - headers = [] - for hdr in set_cookie_hdrs: - headers.append("%s: %s" % (hdr_name, hdr)) - res = FakeResponse(headers, url) - cookiejar.extract_cookies(res, req) - return cookie_hdr - - -class FileCookieJarTests(TestCase): - def test_lwp_valueless_cookie(self): - # cookies with no value should be saved and loaded consistently - from cookielib import LWPCookieJar - filename = test_support.TESTFN - c = LWPCookieJar() - interact_netscape(c, "http://www.acme.com/", 'boo') - self.assertEqual(c._cookies["www.acme.com"]["/"]["boo"].value, None) - try: - c.save(filename, ignore_discard=True) - c = LWPCookieJar() - c.load(filename, ignore_discard=True) - finally: - try: os.unlink(filename) - except OSError: pass - self.assertEqual(c._cookies["www.acme.com"]["/"]["boo"].value, None) - - def test_bad_magic(self): - from cookielib import LWPCookieJar, MozillaCookieJar, LoadError - # IOErrors (eg. file doesn't exist) are allowed to propagate - filename = test_support.TESTFN - for cookiejar_class in LWPCookieJar, MozillaCookieJar: - c = cookiejar_class() - try: - c.load(filename="for this test to work, a file with this " - "filename should not exist") - except IOError, exc: - # exactly IOError, not LoadError - self.assertEqual(exc.__class__, IOError) - else: - self.fail("expected IOError for invalid filename") - # Invalid contents of cookies file (eg. bad magic string) - # causes a LoadError. - try: - f = open(filename, "w") - f.write("oops\n") - for cookiejar_class in LWPCookieJar, MozillaCookieJar: - c = cookiejar_class() - self.assertRaises(LoadError, c.load, filename) - finally: - try: os.unlink(filename) - except OSError: pass - -class CookieTests(TestCase): - # XXX - # Get rid of string comparisons where not actually testing str / repr. - # .clear() etc. - # IP addresses like 50 (single number, no dot) and domain-matching - # functions (and is_HDN)? See draft RFC 2965 errata. - # Strictness switches - # is_third_party() - # unverifiability / third-party blocking - # Netscape cookies work the same as RFC 2965 with regard to port. - # Set-Cookie with negative max age. - # If turn RFC 2965 handling off, Set-Cookie2 cookies should not clobber - # Set-Cookie cookies. - # Cookie2 should be sent if *any* cookies are not V1 (ie. V0 OR V2 etc.). - # Cookies (V1 and V0) with no expiry date should be set to be discarded. - # RFC 2965 Quoting: - # Should accept unquoted cookie-attribute values? check errata draft. - # Which are required on the way in and out? - # Should always return quoted cookie-attribute values? - # Proper testing of when RFC 2965 clobbers Netscape (waiting for errata). - # Path-match on return (same for V0 and V1). - # RFC 2965 acceptance and returning rules - # Set-Cookie2 without version attribute is rejected. - - # Netscape peculiarities list from Ronald Tschalar. - # The first two still need tests, the rest are covered. -## - Quoting: only quotes around the expires value are recognized as such -## (and yes, some folks quote the expires value); quotes around any other -## value are treated as part of the value. -## - White space: white space around names and values is ignored -## - Default path: if no path parameter is given, the path defaults to the -## path in the request-uri up to, but not including, the last '/'. Note -## that this is entirely different from what the spec says. -## - Commas and other delimiters: Netscape just parses until the next ';'. -## This means it will allow commas etc inside values (and yes, both -## commas and equals are commonly appear in the cookie value). This also -## means that if you fold multiple Set-Cookie header fields into one, -## comma-separated list, it'll be a headache to parse (at least my head -## starts hurting everytime I think of that code). -## - Expires: You'll get all sorts of date formats in the expires, -## including emtpy expires attributes ("expires="). Be as flexible as you -## can, and certainly don't expect the weekday to be there; if you can't -## parse it, just ignore it and pretend it's a session cookie. -## - Domain-matching: Netscape uses the 2-dot rule for _all_ domains, not -## just the 7 special TLD's listed in their spec. And folks rely on -## that... - - def test_domain_return_ok(self): - # test optimization: .domain_return_ok() should filter out most - # domains in the CookieJar before we try to access them (because that - # may require disk access -- in particular, with MSIECookieJar) - # This is only a rough check for performance reasons, so it's not too - # critical as long as it's sufficiently liberal. - import cookielib, urllib2 - pol = cookielib.DefaultCookiePolicy() - for url, domain, ok in [ - ("http://foo.bar.com/", "blah.com", False), - ("http://foo.bar.com/", "rhubarb.blah.com", False), - ("http://foo.bar.com/", "rhubarb.foo.bar.com", False), - ("http://foo.bar.com/", ".foo.bar.com", True), - ("http://foo.bar.com/", "foo.bar.com", True), - ("http://foo.bar.com/", ".bar.com", True), - ("http://foo.bar.com/", "com", True), - ("http://foo.com/", "rhubarb.foo.com", False), - ("http://foo.com/", ".foo.com", True), - ("http://foo.com/", "foo.com", True), - ("http://foo.com/", "com", True), - ("http://foo/", "rhubarb.foo", False), - ("http://foo/", ".foo", True), - ("http://foo/", "foo", True), - ("http://foo/", "foo.local", True), - ("http://foo/", ".local", True), - ]: - request = urllib2.Request(url) - r = pol.domain_return_ok(domain, request) - if ok: self.assert_(r) - else: self.assert_(not r) - - def test_missing_value(self): - from cookielib import MozillaCookieJar, lwp_cookie_str - - # missing = sign in Cookie: header is regarded by Mozilla as a missing - # name, and by cookielib as a missing value - filename = test_support.TESTFN - c = MozillaCookieJar(filename) - interact_netscape(c, "http://www.acme.com/", 'eggs') - interact_netscape(c, "http://www.acme.com/", '"spam"; path=/foo/') - cookie = c._cookies["www.acme.com"]["/"]["eggs"] - self.assert_(cookie.value is None) - self.assertEquals(cookie.name, "eggs") - cookie = c._cookies["www.acme.com"]['/foo/']['"spam"'] - self.assert_(cookie.value is None) - self.assertEquals(cookie.name, '"spam"') - self.assertEquals(lwp_cookie_str(cookie), ( - r'"spam"; path="/foo/"; domain="www.acme.com"; ' - 'path_spec; discard; version=0')) - old_str = repr(c) - c.save(ignore_expires=True, ignore_discard=True) - try: - c = MozillaCookieJar(filename) - c.revert(ignore_expires=True, ignore_discard=True) - finally: - os.unlink(c.filename) - # cookies unchanged apart from lost info re. whether path was specified - self.assertEquals( - repr(c), - re.sub("path_specified=%s" % True, "path_specified=%s" % False, - old_str) - ) - self.assertEquals(interact_netscape(c, "http://www.acme.com/foo/"), - '"spam"; eggs') - - def test_rfc2109_handling(self): - # RFC 2109 cookies are handled as RFC 2965 or Netscape cookies, - # dependent on policy settings - from cookielib import CookieJar, DefaultCookiePolicy - - for rfc2109_as_netscape, rfc2965, version in [ - # default according to rfc2965 if not explicitly specified - (None, False, 0), - (None, True, 1), - # explicit rfc2109_as_netscape - (False, False, None), # version None here means no cookie stored - (False, True, 1), - (True, False, 0), - (True, True, 0), - ]: - policy = DefaultCookiePolicy( - rfc2109_as_netscape=rfc2109_as_netscape, - rfc2965=rfc2965) - c = CookieJar(policy) - interact_netscape(c, "http://www.example.com/", "ni=ni; Version=1") - try: - cookie = c._cookies["www.example.com"]["/"]["ni"] - except KeyError: - self.assert_(version is None) # didn't expect a stored cookie - else: - self.assertEqual(cookie.version, version) - # 2965 cookies are unaffected - interact_2965(c, "http://www.example.com/", - "foo=bar; Version=1") - if rfc2965: - cookie2965 = c._cookies["www.example.com"]["/"]["foo"] - self.assertEqual(cookie2965.version, 1) - - def test_ns_parser(self): - from cookielib import CookieJar, DEFAULT_HTTP_PORT - - c = CookieJar() - interact_netscape(c, "http://www.acme.com/", - 'spam=eggs; DoMain=.acme.com; port; blArgh="feep"') - interact_netscape(c, "http://www.acme.com/", 'ni=ni; port=80,8080') - interact_netscape(c, "http://www.acme.com:80/", 'nini=ni') - interact_netscape(c, "http://www.acme.com:80/", 'foo=bar; expires=') - interact_netscape(c, "http://www.acme.com:80/", 'spam=eggs; ' - 'expires="Foo Bar 25 33:22:11 3022"') - - cookie = c._cookies[".acme.com"]["/"]["spam"] - self.assertEquals(cookie.domain, ".acme.com") - self.assert_(cookie.domain_specified) - self.assertEquals(cookie.port, DEFAULT_HTTP_PORT) - self.assert_(not cookie.port_specified) - # case is preserved - self.assert_(cookie.has_nonstandard_attr("blArgh") and - not cookie.has_nonstandard_attr("blargh")) - - cookie = c._cookies["www.acme.com"]["/"]["ni"] - self.assertEquals(cookie.domain, "www.acme.com") - self.assert_(not cookie.domain_specified) - self.assertEquals(cookie.port, "80,8080") - self.assert_(cookie.port_specified) - - cookie = c._cookies["www.acme.com"]["/"]["nini"] - self.assert_(cookie.port is None) - self.assert_(not cookie.port_specified) - - # invalid expires should not cause cookie to be dropped - foo = c._cookies["www.acme.com"]["/"]["foo"] - spam = c._cookies["www.acme.com"]["/"]["foo"] - self.assert_(foo.expires is None) - self.assert_(spam.expires is None) - - def test_ns_parser_special_names(self): - # names such as 'expires' are not special in first name=value pair - # of Set-Cookie: header - from cookielib import CookieJar - - c = CookieJar() - interact_netscape(c, "http://www.acme.com/", 'expires=eggs') - interact_netscape(c, "http://www.acme.com/", 'version=eggs; spam=eggs') - - cookies = c._cookies["www.acme.com"]["/"] - self.assert_('expires' in cookies) - self.assert_('version' in cookies) - - def test_expires(self): - from cookielib import time2netscape, CookieJar - - # if expires is in future, keep cookie... - c = CookieJar() - future = time2netscape(time.time()+3600) - interact_netscape(c, "http://www.acme.com/", 'spam="bar"; expires=%s' % - future) - self.assertEquals(len(c), 1) - now = time2netscape(time.time()-1) - # ... and if in past or present, discard it - interact_netscape(c, "http://www.acme.com/", 'foo="eggs"; expires=%s' % - now) - h = interact_netscape(c, "http://www.acme.com/") - self.assertEquals(len(c), 1) - self.assert_('spam="bar"' in h and "foo" not in h) - - # max-age takes precedence over expires, and zero max-age is request to - # delete both new cookie and any old matching cookie - interact_netscape(c, "http://www.acme.com/", 'eggs="bar"; expires=%s' % - future) - interact_netscape(c, "http://www.acme.com/", 'bar="bar"; expires=%s' % - future) - self.assertEquals(len(c), 3) - interact_netscape(c, "http://www.acme.com/", 'eggs="bar"; ' - 'expires=%s; max-age=0' % future) - interact_netscape(c, "http://www.acme.com/", 'bar="bar"; ' - 'max-age=0; expires=%s' % future) - h = interact_netscape(c, "http://www.acme.com/") - self.assertEquals(len(c), 1) - - # test expiry at end of session for cookies with no expires attribute - interact_netscape(c, "http://www.rhubarb.net/", 'whum="fizz"') - self.assertEquals(len(c), 2) - c.clear_session_cookies() - self.assertEquals(len(c), 1) - self.assert_('spam="bar"' in h) - - # XXX RFC 2965 expiry rules (some apply to V0 too) - - def test_default_path(self): - from cookielib import CookieJar, DefaultCookiePolicy - - # RFC 2965 - pol = DefaultCookiePolicy(rfc2965=True) - - c = CookieJar(pol) - interact_2965(c, "http://www.acme.com/", 'spam="bar"; Version="1"') - self.assert_("/" in c._cookies["www.acme.com"]) - - c = CookieJar(pol) - interact_2965(c, "http://www.acme.com/blah", 'eggs="bar"; Version="1"') - self.assert_("/" in c._cookies["www.acme.com"]) - - c = CookieJar(pol) - interact_2965(c, "http://www.acme.com/blah/rhubarb", - 'eggs="bar"; Version="1"') - self.assert_("/blah/" in c._cookies["www.acme.com"]) - - c = CookieJar(pol) - interact_2965(c, "http://www.acme.com/blah/rhubarb/", - 'eggs="bar"; Version="1"') - self.assert_("/blah/rhubarb/" in c._cookies["www.acme.com"]) - - # Netscape - - c = CookieJar() - interact_netscape(c, "http://www.acme.com/", 'spam="bar"') - self.assert_("/" in c._cookies["www.acme.com"]) - - c = CookieJar() - interact_netscape(c, "http://www.acme.com/blah", 'eggs="bar"') - self.assert_("/" in c._cookies["www.acme.com"]) - - c = CookieJar() - interact_netscape(c, "http://www.acme.com/blah/rhubarb", 'eggs="bar"') - self.assert_("/blah" in c._cookies["www.acme.com"]) - - c = CookieJar() - interact_netscape(c, "http://www.acme.com/blah/rhubarb/", 'eggs="bar"') - self.assert_("/blah/rhubarb" in c._cookies["www.acme.com"]) - - def test_escape_path(self): - from cookielib import escape_path - cases = [ - # quoted safe - ("/foo%2f/bar", "/foo%2F/bar"), - ("/foo%2F/bar", "/foo%2F/bar"), - # quoted % - ("/foo%%/bar", "/foo%%/bar"), - # quoted unsafe - ("/fo%19o/bar", "/fo%19o/bar"), - ("/fo%7do/bar", "/fo%7Do/bar"), - # unquoted safe - ("/foo/bar&", "/foo/bar&"), - ("/foo//bar", "/foo//bar"), - ("\176/foo/bar", "\176/foo/bar"), - # unquoted unsafe - ("/foo\031/bar", "/foo%19/bar"), - ("/\175foo/bar", "/%7Dfoo/bar"), - # unicode - (u"/foo/bar\uabcd", "/foo/bar%EA%AF%8D"), # UTF-8 encoded - ] - for arg, result in cases: - self.assertEquals(escape_path(arg), result) - - def test_request_path(self): - from urllib2 import Request - from cookielib import request_path - # with parameters - req = Request("http://www.example.com/rheum/rhaponicum;" - "foo=bar;sing=song?apples=pears&spam=eggs#ni") - self.assertEquals(request_path(req), "/rheum/rhaponicum;" - "foo=bar;sing=song?apples=pears&spam=eggs#ni") - # without parameters - req = Request("http://www.example.com/rheum/rhaponicum?" - "apples=pears&spam=eggs#ni") - self.assertEquals(request_path(req), "/rheum/rhaponicum?" - "apples=pears&spam=eggs#ni") - # missing final slash - req = Request("http://www.example.com") - self.assertEquals(request_path(req), "/") - - def test_request_port(self): - from urllib2 import Request - from cookielib import request_port, DEFAULT_HTTP_PORT - req = Request("http://www.acme.com:1234/", - headers={"Host": "www.acme.com:4321"}) - self.assertEquals(request_port(req), "1234") - req = Request("http://www.acme.com/", - headers={"Host": "www.acme.com:4321"}) - self.assertEquals(request_port(req), DEFAULT_HTTP_PORT) - - def test_request_host(self): - from urllib2 import Request - from cookielib import request_host - # this request is illegal (RFC2616, 14.2.3) - req = Request("http://1.1.1.1/", - headers={"Host": "www.acme.com:80"}) - # libwww-perl wants this response, but that seems wrong (RFC 2616, - # section 5.2, point 1., and RFC 2965 section 1, paragraph 3) - #self.assertEquals(request_host(req), "www.acme.com") - self.assertEquals(request_host(req), "1.1.1.1") - req = Request("http://www.acme.com/", - headers={"Host": "irrelevant.com"}) - self.assertEquals(request_host(req), "www.acme.com") - # not actually sure this one is valid Request object, so maybe should - # remove test for no host in url in request_host function? - req = Request("/resource.html", - headers={"Host": "www.acme.com"}) - self.assertEquals(request_host(req), "www.acme.com") - # port shouldn't be in request-host - req = Request("http://www.acme.com:2345/resource.html", - headers={"Host": "www.acme.com:5432"}) - self.assertEquals(request_host(req), "www.acme.com") - - def test_is_HDN(self): - from cookielib import is_HDN - self.assert_(is_HDN("foo.bar.com")) - self.assert_(is_HDN("1foo2.3bar4.5com")) - self.assert_(not is_HDN("192.168.1.1")) - self.assert_(not is_HDN("")) - self.assert_(not is_HDN(".")) - self.assert_(not is_HDN(".foo.bar.com")) - self.assert_(not is_HDN("..foo")) - self.assert_(not is_HDN("foo.")) - - def test_reach(self): - from cookielib import reach - self.assertEquals(reach("www.acme.com"), ".acme.com") - self.assertEquals(reach("acme.com"), "acme.com") - self.assertEquals(reach("acme.local"), ".local") - self.assertEquals(reach(".local"), ".local") - self.assertEquals(reach(".com"), ".com") - self.assertEquals(reach("."), ".") - self.assertEquals(reach(""), "") - self.assertEquals(reach("192.168.0.1"), "192.168.0.1") - - def test_domain_match(self): - from cookielib import domain_match, user_domain_match - self.assert_(domain_match("192.168.1.1", "192.168.1.1")) - self.assert_(not domain_match("192.168.1.1", ".168.1.1")) - self.assert_(domain_match("x.y.com", "x.Y.com")) - self.assert_(domain_match("x.y.com", ".Y.com")) - self.assert_(not domain_match("x.y.com", "Y.com")) - self.assert_(domain_match("a.b.c.com", ".c.com")) - self.assert_(not domain_match(".c.com", "a.b.c.com")) - self.assert_(domain_match("example.local", ".local")) - self.assert_(not domain_match("blah.blah", "")) - self.assert_(not domain_match("", ".rhubarb.rhubarb")) - self.assert_(domain_match("", "")) - - self.assert_(user_domain_match("acme.com", "acme.com")) - self.assert_(not user_domain_match("acme.com", ".acme.com")) - self.assert_(user_domain_match("rhubarb.acme.com", ".acme.com")) - self.assert_(user_domain_match("www.rhubarb.acme.com", ".acme.com")) - self.assert_(user_domain_match("x.y.com", "x.Y.com")) - self.assert_(user_domain_match("x.y.com", ".Y.com")) - self.assert_(not user_domain_match("x.y.com", "Y.com")) - self.assert_(user_domain_match("y.com", "Y.com")) - self.assert_(not user_domain_match(".y.com", "Y.com")) - self.assert_(user_domain_match(".y.com", ".Y.com")) - self.assert_(user_domain_match("x.y.com", ".com")) - self.assert_(not user_domain_match("x.y.com", "com")) - self.assert_(not user_domain_match("x.y.com", "m")) - self.assert_(not user_domain_match("x.y.com", ".m")) - self.assert_(not user_domain_match("x.y.com", "")) - self.assert_(not user_domain_match("x.y.com", ".")) - self.assert_(user_domain_match("192.168.1.1", "192.168.1.1")) - # not both HDNs, so must string-compare equal to match - self.assert_(not user_domain_match("192.168.1.1", ".168.1.1")) - self.assert_(not user_domain_match("192.168.1.1", ".")) - # empty string is a special case - self.assert_(not user_domain_match("192.168.1.1", "")) - - def test_wrong_domain(self): - # Cookies whose effective request-host name does not domain-match the - # domain are rejected. - - # XXX far from complete - from cookielib import CookieJar - c = CookieJar() - interact_2965(c, "http://www.nasty.com/", - 'foo=bar; domain=friendly.org; Version="1"') - self.assertEquals(len(c), 0) - - def test_strict_domain(self): - # Cookies whose domain is a country-code tld like .co.uk should - # not be set if CookiePolicy.strict_domain is true. - from cookielib import CookieJar, DefaultCookiePolicy - - cp = DefaultCookiePolicy(strict_domain=True) - cj = CookieJar(policy=cp) - interact_netscape(cj, "http://example.co.uk/", 'no=problemo') - interact_netscape(cj, "http://example.co.uk/", - 'okey=dokey; Domain=.example.co.uk') - self.assertEquals(len(cj), 2) - for pseudo_tld in [".co.uk", ".org.za", ".tx.us", ".name.us"]: - interact_netscape(cj, "http://example.%s/" % pseudo_tld, - 'spam=eggs; Domain=.co.uk') - self.assertEquals(len(cj), 2) - - def test_two_component_domain_ns(self): - # Netscape: .www.bar.com, www.bar.com, .bar.com, bar.com, no domain - # should all get accepted, as should .acme.com, acme.com and no domain - # for 2-component domains like acme.com. - from cookielib import CookieJar, DefaultCookiePolicy - - c = CookieJar() - - # two-component V0 domain is OK - interact_netscape(c, "http://foo.net/", 'ns=bar') - self.assertEquals(len(c), 1) - self.assertEquals(c._cookies["foo.net"]["/"]["ns"].value, "bar") - self.assertEquals(interact_netscape(c, "http://foo.net/"), "ns=bar") - # *will* be returned to any other domain (unlike RFC 2965)... - self.assertEquals(interact_netscape(c, "http://www.foo.net/"), - "ns=bar") - # ...unless requested otherwise - pol = DefaultCookiePolicy( - strict_ns_domain=DefaultCookiePolicy.DomainStrictNonDomain) - c.set_policy(pol) - self.assertEquals(interact_netscape(c, "http://www.foo.net/"), "") - - # unlike RFC 2965, even explicit two-component domain is OK, - # because .foo.net matches foo.net - interact_netscape(c, "http://foo.net/foo/", - 'spam1=eggs; domain=foo.net') - # even if starts with a dot -- in NS rules, .foo.net matches foo.net! - interact_netscape(c, "http://foo.net/foo/bar/", - 'spam2=eggs; domain=.foo.net') - self.assertEquals(len(c), 3) - self.assertEquals(c._cookies[".foo.net"]["/foo"]["spam1"].value, - "eggs") - self.assertEquals(c._cookies[".foo.net"]["/foo/bar"]["spam2"].value, - "eggs") - self.assertEquals(interact_netscape(c, "http://foo.net/foo/bar/"), - "spam2=eggs; spam1=eggs; ns=bar") - - # top-level domain is too general - interact_netscape(c, "http://foo.net/", 'nini="ni"; domain=.net') - self.assertEquals(len(c), 3) - -## # Netscape protocol doesn't allow non-special top level domains (such -## # as co.uk) in the domain attribute unless there are at least three -## # dots in it. - # Oh yes it does! Real implementations don't check this, and real - # cookies (of course) rely on that behaviour. - interact_netscape(c, "http://foo.co.uk", 'nasty=trick; domain=.co.uk') -## self.assertEquals(len(c), 2) - self.assertEquals(len(c), 4) - - def test_two_component_domain_rfc2965(self): - from cookielib import CookieJar, DefaultCookiePolicy - - pol = DefaultCookiePolicy(rfc2965=True) - c = CookieJar(pol) - - # two-component V1 domain is OK - interact_2965(c, "http://foo.net/", 'foo=bar; Version="1"') - self.assertEquals(len(c), 1) - self.assertEquals(c._cookies["foo.net"]["/"]["foo"].value, "bar") - self.assertEquals(interact_2965(c, "http://foo.net/"), - "$Version=1; foo=bar") - # won't be returned to any other domain (because domain was implied) - self.assertEquals(interact_2965(c, "http://www.foo.net/"), "") - - # unless domain is given explicitly, because then it must be - # rewritten to start with a dot: foo.net --> .foo.net, which does - # not domain-match foo.net - interact_2965(c, "http://foo.net/foo", - 'spam=eggs; domain=foo.net; path=/foo; Version="1"') - self.assertEquals(len(c), 1) - self.assertEquals(interact_2965(c, "http://foo.net/foo"), - "$Version=1; foo=bar") - - # explicit foo.net from three-component domain www.foo.net *does* get - # set, because .foo.net domain-matches .foo.net - interact_2965(c, "http://www.foo.net/foo/", - 'spam=eggs; domain=foo.net; Version="1"') - self.assertEquals(c._cookies[".foo.net"]["/foo/"]["spam"].value, - "eggs") - self.assertEquals(len(c), 2) - self.assertEquals(interact_2965(c, "http://foo.net/foo/"), - "$Version=1; foo=bar") - self.assertEquals(interact_2965(c, "http://www.foo.net/foo/"), - '$Version=1; spam=eggs; $Domain="foo.net"') - - # top-level domain is too general - interact_2965(c, "http://foo.net/", - 'ni="ni"; domain=".net"; Version="1"') - self.assertEquals(len(c), 2) - - # RFC 2965 doesn't require blocking this - interact_2965(c, "http://foo.co.uk/", - 'nasty=trick; domain=.co.uk; Version="1"') - self.assertEquals(len(c), 3) - - def test_domain_allow(self): - from cookielib import CookieJar, DefaultCookiePolicy - from urllib2 import Request - - c = CookieJar(policy=DefaultCookiePolicy( - blocked_domains=["acme.com"], - allowed_domains=["www.acme.com"])) - - req = Request("http://acme.com/") - headers = ["Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/"] - res = FakeResponse(headers, "http://acme.com/") - c.extract_cookies(res, req) - self.assertEquals(len(c), 0) - - req = Request("http://www.acme.com/") - res = FakeResponse(headers, "http://www.acme.com/") - c.extract_cookies(res, req) - self.assertEquals(len(c), 1) - - req = Request("http://www.coyote.com/") - res = FakeResponse(headers, "http://www.coyote.com/") - c.extract_cookies(res, req) - self.assertEquals(len(c), 1) - - # set a cookie with non-allowed domain... - req = Request("http://www.coyote.com/") - res = FakeResponse(headers, "http://www.coyote.com/") - cookies = c.make_cookies(res, req) - c.set_cookie(cookies[0]) - self.assertEquals(len(c), 2) - # ... and check is doesn't get returned - c.add_cookie_header(req) - self.assert_(not req.has_header("Cookie")) - - def test_domain_block(self): - from cookielib import CookieJar, DefaultCookiePolicy - from urllib2 import Request - - pol = DefaultCookiePolicy( - rfc2965=True, blocked_domains=[".acme.com"]) - c = CookieJar(policy=pol) - headers = ["Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/"] - - req = Request("http://www.acme.com/") - res = FakeResponse(headers, "http://www.acme.com/") - c.extract_cookies(res, req) - self.assertEquals(len(c), 0) - - p = pol.set_blocked_domains(["acme.com"]) - c.extract_cookies(res, req) - self.assertEquals(len(c), 1) - - c.clear() - req = Request("http://www.roadrunner.net/") - res = FakeResponse(headers, "http://www.roadrunner.net/") - c.extract_cookies(res, req) - self.assertEquals(len(c), 1) - req = Request("http://www.roadrunner.net/") - c.add_cookie_header(req) - self.assert_((req.has_header("Cookie") and - req.has_header("Cookie2"))) - - c.clear() - pol.set_blocked_domains([".acme.com"]) - c.extract_cookies(res, req) - self.assertEquals(len(c), 1) - - # set a cookie with blocked domain... - req = Request("http://www.acme.com/") - res = FakeResponse(headers, "http://www.acme.com/") - cookies = c.make_cookies(res, req) - c.set_cookie(cookies[0]) - self.assertEquals(len(c), 2) - # ... and check is doesn't get returned - c.add_cookie_header(req) - self.assert_(not req.has_header("Cookie")) - - def test_secure(self): - from cookielib import CookieJar, DefaultCookiePolicy - - for ns in True, False: - for whitespace in " ", "": - c = CookieJar() - if ns: - pol = DefaultCookiePolicy(rfc2965=False) - int = interact_netscape - vs = "" - else: - pol = DefaultCookiePolicy(rfc2965=True) - int = interact_2965 - vs = "; Version=1" - c.set_policy(pol) - url = "http://www.acme.com/" - int(c, url, "foo1=bar%s%s" % (vs, whitespace)) - int(c, url, "foo2=bar%s; secure%s" % (vs, whitespace)) - self.assert_( - not c._cookies["www.acme.com"]["/"]["foo1"].secure, - "non-secure cookie registered secure") - self.assert_( - c._cookies["www.acme.com"]["/"]["foo2"].secure, - "secure cookie registered non-secure") - - def test_quote_cookie_value(self): - from cookielib import CookieJar, DefaultCookiePolicy - c = CookieJar(policy=DefaultCookiePolicy(rfc2965=True)) - interact_2965(c, "http://www.acme.com/", r'foo=\b"a"r; Version=1') - h = interact_2965(c, "http://www.acme.com/") - self.assertEquals(h, r'$Version=1; foo=\\b\"a\"r') - - def test_missing_final_slash(self): - # Missing slash from request URL's abs_path should be assumed present. - from cookielib import CookieJar, DefaultCookiePolicy - from urllib2 import Request - url = "http://www.acme.com" - c = CookieJar(DefaultCookiePolicy(rfc2965=True)) - interact_2965(c, url, "foo=bar; Version=1") - req = Request(url) - self.assertEquals(len(c), 1) - c.add_cookie_header(req) - self.assert_(req.has_header("Cookie")) - - def test_domain_mirror(self): - from cookielib import CookieJar, DefaultCookiePolicy - - pol = DefaultCookiePolicy(rfc2965=True) - - c = CookieJar(pol) - url = "http://foo.bar.com/" - interact_2965(c, url, "spam=eggs; Version=1") - h = interact_2965(c, url) - self.assert_("Domain" not in h, - "absent domain returned with domain present") - - c = CookieJar(pol) - url = "http://foo.bar.com/" - interact_2965(c, url, 'spam=eggs; Version=1; Domain=.bar.com') - h = interact_2965(c, url) - self.assert_('$Domain=".bar.com"' in h, "domain not returned") - - c = CookieJar(pol) - url = "http://foo.bar.com/" - # note missing initial dot in Domain - interact_2965(c, url, 'spam=eggs; Version=1; Domain=bar.com') - h = interact_2965(c, url) - self.assert_('$Domain="bar.com"' in h, "domain not returned") - - def test_path_mirror(self): - from cookielib import CookieJar, DefaultCookiePolicy - - pol = DefaultCookiePolicy(rfc2965=True) - - c = CookieJar(pol) - url = "http://foo.bar.com/" - interact_2965(c, url, "spam=eggs; Version=1") - h = interact_2965(c, url) - self.assert_("Path" not in h, - "absent path returned with path present") - - c = CookieJar(pol) - url = "http://foo.bar.com/" - interact_2965(c, url, 'spam=eggs; Version=1; Path=/') - h = interact_2965(c, url) - self.assert_('$Path="/"' in h, "path not returned") - - def test_port_mirror(self): - from cookielib import CookieJar, DefaultCookiePolicy - - pol = DefaultCookiePolicy(rfc2965=True) - - c = CookieJar(pol) - url = "http://foo.bar.com/" - interact_2965(c, url, "spam=eggs; Version=1") - h = interact_2965(c, url) - self.assert_("Port" not in h, - "absent port returned with port present") - - c = CookieJar(pol) - url = "http://foo.bar.com/" - interact_2965(c, url, "spam=eggs; Version=1; Port") - h = interact_2965(c, url) - self.assert_(re.search("\$Port([^=]|$)", h), - "port with no value not returned with no value") - - c = CookieJar(pol) - url = "http://foo.bar.com/" - interact_2965(c, url, 'spam=eggs; Version=1; Port="80"') - h = interact_2965(c, url) - self.assert_('$Port="80"' in h, - "port with single value not returned with single value") - - c = CookieJar(pol) - url = "http://foo.bar.com/" - interact_2965(c, url, 'spam=eggs; Version=1; Port="80,8080"') - h = interact_2965(c, url) - self.assert_('$Port="80,8080"' in h, - "port with multiple values not returned with multiple " - "values") - - def test_no_return_comment(self): - from cookielib import CookieJar, DefaultCookiePolicy - - c = CookieJar(DefaultCookiePolicy(rfc2965=True)) - url = "http://foo.bar.com/" - interact_2965(c, url, 'spam=eggs; Version=1; ' - 'Comment="does anybody read these?"; ' - 'CommentURL="http://foo.bar.net/comment.html"') - h = interact_2965(c, url) - self.assert_( - "Comment" not in h, - "Comment or CommentURL cookie-attributes returned to server") - - def test_Cookie_iterator(self): - from cookielib import CookieJar, Cookie, DefaultCookiePolicy - - cs = CookieJar(DefaultCookiePolicy(rfc2965=True)) - # add some random cookies - interact_2965(cs, "http://blah.spam.org/", 'foo=eggs; Version=1; ' - 'Comment="does anybody read these?"; ' - 'CommentURL="http://foo.bar.net/comment.html"') - interact_netscape(cs, "http://www.acme.com/blah/", "spam=bar; secure") - interact_2965(cs, "http://www.acme.com/blah/", - "foo=bar; secure; Version=1") - interact_2965(cs, "http://www.acme.com/blah/", - "foo=bar; path=/; Version=1") - interact_2965(cs, "http://www.sol.no", - r'bang=wallop; version=1; domain=".sol.no"; ' - r'port="90,100, 80,8080"; ' - r'max-age=100; Comment = "Just kidding! (\"|\\\\) "') - - versions = [1, 1, 1, 0, 1] - names = ["bang", "foo", "foo", "spam", "foo"] - domains = [".sol.no", "blah.spam.org", "www.acme.com", - "www.acme.com", "www.acme.com"] - paths = ["/", "/", "/", "/blah", "/blah/"] - - for i in range(4): - i = 0 - for c in cs: - self.assert_(isinstance(c, Cookie)) - self.assertEquals(c.version, versions[i]) - self.assertEquals(c.name, names[i]) - self.assertEquals(c.domain, domains[i]) - self.assertEquals(c.path, paths[i]) - i = i + 1 - - def test_parse_ns_headers(self): - from cookielib import parse_ns_headers - - # missing domain value (invalid cookie) - self.assertEquals( - parse_ns_headers(["foo=bar; path=/; domain"]), - [[("foo", "bar"), - ("path", "/"), ("domain", None), ("version", "0")]] - ) - # invalid expires value - self.assertEquals( - parse_ns_headers(["foo=bar; expires=Foo Bar 12 33:22:11 2000"]), - [[("foo", "bar"), ("expires", None), ("version", "0")]] - ) - # missing cookie value (valid cookie) - self.assertEquals( - parse_ns_headers(["foo"]), - [[("foo", None), ("version", "0")]] - ) - # shouldn't add version if header is empty - self.assertEquals(parse_ns_headers([""]), []) - - def test_bad_cookie_header(self): - - def cookiejar_from_cookie_headers(headers): - from cookielib import CookieJar - from urllib2 import Request - c = CookieJar() - req = Request("http://www.example.com/") - r = FakeResponse(headers, "http://www.example.com/") - c.extract_cookies(r, req) - return c - - # none of these bad headers should cause an exception to be raised - for headers in [ - ["Set-Cookie: "], # actually, nothing wrong with this - ["Set-Cookie2: "], # ditto - # missing domain value - ["Set-Cookie2: a=foo; path=/; Version=1; domain"], - # bad max-age - ["Set-Cookie: b=foo; max-age=oops"], - ]: - c = cookiejar_from_cookie_headers(headers) - # these bad cookies shouldn't be set - self.assertEquals(len(c), 0) - - # cookie with invalid expires is treated as session cookie - headers = ["Set-Cookie: c=foo; expires=Foo Bar 12 33:22:11 2000"] - c = cookiejar_from_cookie_headers(headers) - cookie = c._cookies["www.example.com"]["/"]["c"] - self.assert_(cookie.expires is None) - - -class LWPCookieTests(TestCase): - # Tests taken from libwww-perl, with a few modifications and additions. - - def test_netscape_example_1(self): - from cookielib import CookieJar, DefaultCookiePolicy - from urllib2 import Request - - #------------------------------------------------------------------- - # First we check that it works for the original example at - # http://www.netscape.com/newsref/std/cookie_spec.html - - # Client requests a document, and receives in the response: - # - # Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT - # - # When client requests a URL in path "/" on this server, it sends: - # - # Cookie: CUSTOMER=WILE_E_COYOTE - # - # Client requests a document, and receives in the response: - # - # Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/ - # - # When client requests a URL in path "/" on this server, it sends: - # - # Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001 - # - # Client receives: - # - # Set-Cookie: SHIPPING=FEDEX; path=/fo - # - # When client requests a URL in path "/" on this server, it sends: - # - # Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001 - # - # When client requests a URL in path "/foo" on this server, it sends: - # - # Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001; SHIPPING=FEDEX - # - # The last Cookie is buggy, because both specifications say that the - # most specific cookie must be sent first. SHIPPING=FEDEX is the - # most specific and should thus be first. - - year_plus_one = time.localtime()[0] + 1 - - headers = [] - - c = CookieJar(DefaultCookiePolicy(rfc2965 = True)) - - #req = Request("http://1.1.1.1/", - # headers={"Host": "www.acme.com:80"}) - req = Request("http://www.acme.com:80/", - headers={"Host": "www.acme.com:80"}) - - headers.append( - "Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/ ; " - "expires=Wednesday, 09-Nov-%d 23:12:40 GMT" % year_plus_one) - res = FakeResponse(headers, "http://www.acme.com/") - c.extract_cookies(res, req) - - req = Request("http://www.acme.com/") - c.add_cookie_header(req) - - self.assertEqual(req.get_header("Cookie"), "CUSTOMER=WILE_E_COYOTE") - self.assertEqual(req.get_header("Cookie2"), '$Version="1"') - - headers.append("Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/") - res = FakeResponse(headers, "http://www.acme.com/") - c.extract_cookies(res, req) - - req = Request("http://www.acme.com/foo/bar") - c.add_cookie_header(req) - - h = req.get_header("Cookie") - self.assert_("PART_NUMBER=ROCKET_LAUNCHER_0001" in h and - "CUSTOMER=WILE_E_COYOTE" in h) - - headers.append('Set-Cookie: SHIPPING=FEDEX; path=/foo') - res = FakeResponse(headers, "http://www.acme.com") - c.extract_cookies(res, req) - - req = Request("http://www.acme.com/") - c.add_cookie_header(req) - - h = req.get_header("Cookie") - self.assert_("PART_NUMBER=ROCKET_LAUNCHER_0001" in h and - "CUSTOMER=WILE_E_COYOTE" in h and - "SHIPPING=FEDEX" not in h) - - req = Request("http://www.acme.com/foo/") - c.add_cookie_header(req) - - h = req.get_header("Cookie") - self.assert_(("PART_NUMBER=ROCKET_LAUNCHER_0001" in h and - "CUSTOMER=WILE_E_COYOTE" in h and - h.startswith("SHIPPING=FEDEX;"))) - - def test_netscape_example_2(self): - from cookielib import CookieJar - from urllib2 import Request - - # Second Example transaction sequence: - # - # Assume all mappings from above have been cleared. - # - # Client receives: - # - # Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/ - # - # When client requests a URL in path "/" on this server, it sends: - # - # Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001 - # - # Client receives: - # - # Set-Cookie: PART_NUMBER=RIDING_ROCKET_0023; path=/ammo - # - # When client requests a URL in path "/ammo" on this server, it sends: - # - # Cookie: PART_NUMBER=RIDING_ROCKET_0023; PART_NUMBER=ROCKET_LAUNCHER_0001 - # - # NOTE: There are two name/value pairs named "PART_NUMBER" due to - # the inheritance of the "/" mapping in addition to the "/ammo" mapping. - - c = CookieJar() - headers = [] - - req = Request("http://www.acme.com/") - headers.append("Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/") - res = FakeResponse(headers, "http://www.acme.com/") - - c.extract_cookies(res, req) - - req = Request("http://www.acme.com/") - c.add_cookie_header(req) - - self.assertEquals(req.get_header("Cookie"), - "PART_NUMBER=ROCKET_LAUNCHER_0001") - - headers.append( - "Set-Cookie: PART_NUMBER=RIDING_ROCKET_0023; path=/ammo") - res = FakeResponse(headers, "http://www.acme.com/") - c.extract_cookies(res, req) - - req = Request("http://www.acme.com/ammo") - c.add_cookie_header(req) - - self.assert_(re.search(r"PART_NUMBER=RIDING_ROCKET_0023;\s*" - "PART_NUMBER=ROCKET_LAUNCHER_0001", - req.get_header("Cookie"))) - - def test_ietf_example_1(self): - from cookielib import CookieJar, DefaultCookiePolicy - #------------------------------------------------------------------- - # Then we test with the examples from draft-ietf-http-state-man-mec-03.txt - # - # 5. EXAMPLES - - c = CookieJar(DefaultCookiePolicy(rfc2965=True)) - - # - # 5.1 Example 1 - # - # Most detail of request and response headers has been omitted. Assume - # the user agent has no stored cookies. - # - # 1. User Agent -> Server - # - # POST /acme/login HTTP/1.1 - # [form data] - # - # User identifies self via a form. - # - # 2. Server -> User Agent - # - # HTTP/1.1 200 OK - # Set-Cookie2: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme" - # - # Cookie reflects user's identity. - - cookie = interact_2965( - c, 'http://www.acme.com/acme/login', - 'Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"') - self.assert_(not cookie) - - # - # 3. User Agent -> Server - # - # POST /acme/pickitem HTTP/1.1 - # Cookie: $Version="1"; Customer="WILE_E_COYOTE"; $Path="/acme" - # [form data] - # - # User selects an item for ``shopping basket.'' - # - # 4. Server -> User Agent - # - # HTTP/1.1 200 OK - # Set-Cookie2: Part_Number="Rocket_Launcher_0001"; Version="1"; - # Path="/acme" - # - # Shopping basket contains an item. - - cookie = interact_2965(c, 'http://www.acme.com/acme/pickitem', - 'Part_Number="Rocket_Launcher_0001"; ' - 'Version="1"; Path="/acme"'); - self.assert_(re.search( - r'^\$Version="?1"?; Customer="?WILE_E_COYOTE"?; \$Path="/acme"$', - cookie)) - - # - # 5. User Agent -> Server - # - # POST /acme/shipping HTTP/1.1 - # Cookie: $Version="1"; - # Customer="WILE_E_COYOTE"; $Path="/acme"; - # Part_Number="Rocket_Launcher_0001"; $Path="/acme" - # [form data] - # - # User selects shipping method from form. - # - # 6. Server -> User Agent - # - # HTTP/1.1 200 OK - # Set-Cookie2: Shipping="FedEx"; Version="1"; Path="/acme" - # - # New cookie reflects shipping method. - - cookie = interact_2965(c, "http://www.acme.com/acme/shipping", - 'Shipping="FedEx"; Version="1"; Path="/acme"') - - self.assert_(re.search(r'^\$Version="?1"?;', cookie)) - self.assert_(re.search(r'Part_Number="?Rocket_Launcher_0001"?;' - '\s*\$Path="\/acme"', cookie)) - self.assert_(re.search(r'Customer="?WILE_E_COYOTE"?;\s*\$Path="\/acme"', - cookie)) - - # - # 7. User Agent -> Server - # - # POST /acme/process HTTP/1.1 - # Cookie: $Version="1"; - # Customer="WILE_E_COYOTE"; $Path="/acme"; - # Part_Number="Rocket_Launcher_0001"; $Path="/acme"; - # Shipping="FedEx"; $Path="/acme" - # [form data] - # - # User chooses to process order. - # - # 8. Server -> User Agent - # - # HTTP/1.1 200 OK - # - # Transaction is complete. - - cookie = interact_2965(c, "http://www.acme.com/acme/process") - self.assert_( - re.search(r'Shipping="?FedEx"?;\s*\$Path="\/acme"', cookie) and - "WILE_E_COYOTE" in cookie) - - # - # The user agent makes a series of requests on the origin server, after - # each of which it receives a new cookie. All the cookies have the same - # Path attribute and (default) domain. Because the request URLs all have - # /acme as a prefix, and that matches the Path attribute, each request - # contains all the cookies received so far. - - def test_ietf_example_2(self): - from cookielib import CookieJar, DefaultCookiePolicy - - # 5.2 Example 2 - # - # This example illustrates the effect of the Path attribute. All detail - # of request and response headers has been omitted. Assume the user agent - # has no stored cookies. - - c = CookieJar(DefaultCookiePolicy(rfc2965=True)) - - # Imagine the user agent has received, in response to earlier requests, - # the response headers - # - # Set-Cookie2: Part_Number="Rocket_Launcher_0001"; Version="1"; - # Path="/acme" - # - # and - # - # Set-Cookie2: Part_Number="Riding_Rocket_0023"; Version="1"; - # Path="/acme/ammo" - - interact_2965( - c, "http://www.acme.com/acme/ammo/specific", - 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"', - 'Part_Number="Riding_Rocket_0023"; Version="1"; Path="/acme/ammo"') - - # A subsequent request by the user agent to the (same) server for URLs of - # the form /acme/ammo/... would include the following request header: - # - # Cookie: $Version="1"; - # Part_Number="Riding_Rocket_0023"; $Path="/acme/ammo"; - # Part_Number="Rocket_Launcher_0001"; $Path="/acme" - # - # Note that the NAME=VALUE pair for the cookie with the more specific Path - # attribute, /acme/ammo, comes before the one with the less specific Path - # attribute, /acme. Further note that the same cookie name appears more - # than once. - - cookie = interact_2965(c, "http://www.acme.com/acme/ammo/...") - self.assert_( - re.search(r"Riding_Rocket_0023.*Rocket_Launcher_0001", cookie)) - - # A subsequent request by the user agent to the (same) server for a URL of - # the form /acme/parts/ would include the following request header: - # - # Cookie: $Version="1"; Part_Number="Rocket_Launcher_0001"; $Path="/acme" - # - # Here, the second cookie's Path attribute /acme/ammo is not a prefix of - # the request URL, /acme/parts/, so the cookie does not get forwarded to - # the server. - - cookie = interact_2965(c, "http://www.acme.com/acme/parts/") - self.assert_("Rocket_Launcher_0001" in cookie and - "Riding_Rocket_0023" not in cookie) - - def test_rejection(self): - # Test rejection of Set-Cookie2 responses based on domain, path, port. - from cookielib import DefaultCookiePolicy, LWPCookieJar - - pol = DefaultCookiePolicy(rfc2965=True) - - c = LWPCookieJar(policy=pol) - - max_age = "max-age=3600" - - # illegal domain (no embedded dots) - cookie = interact_2965(c, "http://www.acme.com", - 'foo=bar; domain=".com"; version=1') - self.assert_(not c) - - # legal domain - cookie = interact_2965(c, "http://www.acme.com", - 'ping=pong; domain="acme.com"; version=1') - self.assertEquals(len(c), 1) - - # illegal domain (host prefix "www.a" contains a dot) - cookie = interact_2965(c, "http://www.a.acme.com", - 'whiz=bang; domain="acme.com"; version=1') - self.assertEquals(len(c), 1) - - # legal domain - cookie = interact_2965(c, "http://www.a.acme.com", - 'wow=flutter; domain=".a.acme.com"; version=1') - self.assertEquals(len(c), 2) - - # can't partially match an IP-address - cookie = interact_2965(c, "http://125.125.125.125", - 'zzzz=ping; domain="125.125.125"; version=1') - self.assertEquals(len(c), 2) - - # illegal path (must be prefix of request path) - cookie = interact_2965(c, "http://www.sol.no", - 'blah=rhubarb; domain=".sol.no"; path="/foo"; ' - 'version=1') - self.assertEquals(len(c), 2) - - # legal path - cookie = interact_2965(c, "http://www.sol.no/foo/bar", - 'bing=bong; domain=".sol.no"; path="/foo"; ' - 'version=1') - self.assertEquals(len(c), 3) - - # illegal port (request-port not in list) - cookie = interact_2965(c, "http://www.sol.no", - 'whiz=ffft; domain=".sol.no"; port="90,100"; ' - 'version=1') - self.assertEquals(len(c), 3) - - # legal port - cookie = interact_2965( - c, "http://www.sol.no", - r'bang=wallop; version=1; domain=".sol.no"; ' - r'port="90,100, 80,8080"; ' - r'max-age=100; Comment = "Just kidding! (\"|\\\\) "') - self.assertEquals(len(c), 4) - - # port attribute without any value (current port) - cookie = interact_2965(c, "http://www.sol.no", - 'foo9=bar; version=1; domain=".sol.no"; port; ' - 'max-age=100;') - self.assertEquals(len(c), 5) - - # encoded path - # LWP has this test, but unescaping allowed path characters seems - # like a bad idea, so I think this should fail: -## cookie = interact_2965(c, "http://www.sol.no/foo/", -## r'foo8=bar; version=1; path="/%66oo"') - # but this is OK, because '<' is not an allowed HTTP URL path - # character: - cookie = interact_2965(c, "http://www.sol.no/ 2: - raise IOError - self.assertRaises(IOError, self._write_test, BadList(), '') - class BadItem: - def __str__(self): - raise IOError - self.assertRaises(IOError, self._write_test, [BadItem()], '') - - def test_write_bigfield(self): - # This exercises the buffer realloc functionality - bigstring = 'X' * 50000 - self._write_test([bigstring,bigstring], '%s,%s' % \ - (bigstring, bigstring)) - - def test_write_quoting(self): - self._write_test(['a',1,'p,q'], 'a,1,"p,q"') - self.assertRaises(csv.Error, - self._write_test, - ['a',1,'p,q'], 'a,1,p,q', - quoting = csv.QUOTE_NONE) - self._write_test(['a',1,'p,q'], 'a,1,"p,q"', - quoting = csv.QUOTE_MINIMAL) - self._write_test(['a',1,'p,q'], '"a",1,"p,q"', - quoting = csv.QUOTE_NONNUMERIC) - self._write_test(['a',1,'p,q'], '"a","1","p,q"', - quoting = csv.QUOTE_ALL) - - def test_write_escape(self): - self._write_test(['a',1,'p,q'], 'a,1,"p,q"', - escapechar='\\') - self.assertRaises(csv.Error, - self._write_test, - ['a',1,'p,"q"'], 'a,1,"p,\\"q\\""', - escapechar=None, doublequote=False) - self._write_test(['a',1,'p,"q"'], 'a,1,"p,\\"q\\""', - escapechar='\\', doublequote = False) - self._write_test(['"'], '""""', - escapechar='\\', quoting = csv.QUOTE_MINIMAL) - self._write_test(['"'], '\\"', - escapechar='\\', quoting = csv.QUOTE_MINIMAL, - doublequote = False) - self._write_test(['"'], '\\"', - escapechar='\\', quoting = csv.QUOTE_NONE) - self._write_test(['a',1,'p,q'], 'a,1,p\\,q', - escapechar='\\', quoting = csv.QUOTE_NONE) - - def test_writerows(self): - class BrokenFile: - def write(self, buf): - raise IOError - writer = csv.writer(BrokenFile()) - self.assertRaises(IOError, writer.writerows, [['a']]) - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj) - self.assertRaises(TypeError, writer.writerows, None) - writer.writerows([['a','b'],['c','d']]) - fileobj.seek(0) - self.assertEqual(fileobj.read(), "a,b\r\nc,d\r\n") - finally: - fileobj.close() - os.unlink(name) - - def _read_test(self, input, expect, **kwargs): - reader = csv.reader(input, **kwargs) - result = list(reader) - self.assertEqual(result, expect) - - def test_read_oddinputs(self): - self._read_test([], []) - self._read_test([''], [[]]) - self.assertRaises(csv.Error, self._read_test, - ['"ab"c'], None, strict = 1) - # cannot handle null bytes for the moment - self.assertRaises(csv.Error, self._read_test, - ['ab\0c'], None, strict = 1) - self._read_test(['"ab"c'], [['abc']], doublequote = 0) - - def test_read_eol(self): - self._read_test(['a,b'], [['a','b']]) - self._read_test(['a,b\n'], [['a','b']]) - self._read_test(['a,b\r\n'], [['a','b']]) - self._read_test(['a,b\r'], [['a','b']]) - self.assertRaises(csv.Error, self._read_test, ['a,b\rc,d'], []) - self.assertRaises(csv.Error, self._read_test, ['a,b\nc,d'], []) - self.assertRaises(csv.Error, self._read_test, ['a,b\r\nc,d'], []) - - def test_read_escape(self): - self._read_test(['a,\\b,c'], [['a', 'b', 'c']], escapechar='\\') - self._read_test(['a,b\\,c'], [['a', 'b,c']], escapechar='\\') - self._read_test(['a,"b\\,c"'], [['a', 'b,c']], escapechar='\\') - self._read_test(['a,"b,\\c"'], [['a', 'b,c']], escapechar='\\') - self._read_test(['a,"b,c\\""'], [['a', 'b,c"']], escapechar='\\') - self._read_test(['a,"b,c"\\'], [['a', 'b,c\\']], escapechar='\\') - - def test_read_quoting(self): - self._read_test(['1,",3,",5'], [['1', ',3,', '5']]) - self._read_test(['1,",3,",5'], [['1', '"', '3', '"', '5']], - quotechar=None, escapechar='\\') - self._read_test(['1,",3,",5'], [['1', '"', '3', '"', '5']], - quoting=csv.QUOTE_NONE, escapechar='\\') - # will this fail where locale uses comma for decimals? - self._read_test([',3,"5",7.3, 9'], [['', 3, '5', 7.3, 9]], - quoting=csv.QUOTE_NONNUMERIC) - self.assertRaises(ValueError, self._read_test, - ['abc,3'], [[]], - quoting=csv.QUOTE_NONNUMERIC) - - def test_read_bigfield(self): - # This exercises the buffer realloc functionality and field size - # limits. - limit = csv.field_size_limit() - try: - size = 50000 - bigstring = 'X' * size - bigline = '%s,%s' % (bigstring, bigstring) - self._read_test([bigline], [[bigstring, bigstring]]) - csv.field_size_limit(size) - self._read_test([bigline], [[bigstring, bigstring]]) - self.assertEqual(csv.field_size_limit(), size) - csv.field_size_limit(size-1) - self.assertRaises(csv.Error, self._read_test, [bigline], []) - self.assertRaises(TypeError, csv.field_size_limit, None) - self.assertRaises(TypeError, csv.field_size_limit, 1, None) - finally: - csv.field_size_limit(limit) - - def test_read_linenum(self): - r = csv.reader(['line,1', 'line,2', 'line,3']) - self.assertEqual(r.line_num, 0) - r.next() - self.assertEqual(r.line_num, 1) - r.next() - self.assertEqual(r.line_num, 2) - r.next() - self.assertEqual(r.line_num, 3) - self.assertRaises(StopIteration, r.next) - self.assertEqual(r.line_num, 3) - -class TestDialectRegistry(unittest.TestCase): - def test_registry_badargs(self): - self.assertRaises(TypeError, csv.list_dialects, None) - self.assertRaises(TypeError, csv.get_dialect) - self.assertRaises(csv.Error, csv.get_dialect, None) - self.assertRaises(csv.Error, csv.get_dialect, "nonesuch") - self.assertRaises(TypeError, csv.unregister_dialect) - self.assertRaises(csv.Error, csv.unregister_dialect, None) - self.assertRaises(csv.Error, csv.unregister_dialect, "nonesuch") - self.assertRaises(TypeError, csv.register_dialect, None) - self.assertRaises(TypeError, csv.register_dialect, None, None) - self.assertRaises(TypeError, csv.register_dialect, "nonesuch", 0, 0) - self.assertRaises(TypeError, csv.register_dialect, "nonesuch", - badargument=None) - self.assertRaises(TypeError, csv.register_dialect, "nonesuch", - quoting=None) - self.assertRaises(TypeError, csv.register_dialect, []) - - def test_registry(self): - class myexceltsv(csv.excel): - delimiter = "\t" - name = "myexceltsv" - expected_dialects = csv.list_dialects() + [name] - expected_dialects.sort() - csv.register_dialect(name, myexceltsv) - try: - self.failUnless(csv.get_dialect(name).delimiter, '\t') - got_dialects = csv.list_dialects() - got_dialects.sort() - self.assertEqual(expected_dialects, got_dialects) - finally: - csv.unregister_dialect(name) - - def test_register_kwargs(self): - name = 'fedcba' - csv.register_dialect(name, delimiter=';') - try: - self.failUnless(csv.get_dialect(name).delimiter, '\t') - self.failUnless(list(csv.reader('X;Y;Z', name)), ['X', 'Y', 'Z']) - finally: - csv.unregister_dialect(name) - - def test_incomplete_dialect(self): - class myexceltsv(csv.Dialect): - delimiter = "\t" - self.assertRaises(csv.Error, myexceltsv) - - def test_space_dialect(self): - class space(csv.excel): - delimiter = " " - quoting = csv.QUOTE_NONE - escapechar = "\\" - - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - fileobj.write("abc def\nc1ccccc1 benzene\n") - fileobj.seek(0) - rdr = csv.reader(fileobj, dialect=space()) - self.assertEqual(rdr.next(), ["abc", "def"]) - self.assertEqual(rdr.next(), ["c1ccccc1", "benzene"]) - finally: - fileobj.close() - os.unlink(name) - - def test_dialect_apply(self): - class testA(csv.excel): - delimiter = "\t" - class testB(csv.excel): - delimiter = ":" - class testC(csv.excel): - delimiter = "|" - - csv.register_dialect('testC', testC) - try: - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj) - writer.writerow([1,2,3]) - fileobj.seek(0) - self.assertEqual(fileobj.read(), "1,2,3\r\n") - finally: - fileobj.close() - os.unlink(name) - - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj, testA) - writer.writerow([1,2,3]) - fileobj.seek(0) - self.assertEqual(fileobj.read(), "1\t2\t3\r\n") - finally: - fileobj.close() - os.unlink(name) - - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj, dialect=testB()) - writer.writerow([1,2,3]) - fileobj.seek(0) - self.assertEqual(fileobj.read(), "1:2:3\r\n") - finally: - fileobj.close() - os.unlink(name) - - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj, dialect='testC') - writer.writerow([1,2,3]) - fileobj.seek(0) - self.assertEqual(fileobj.read(), "1|2|3\r\n") - finally: - fileobj.close() - os.unlink(name) - - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj, dialect=testA, delimiter=';') - writer.writerow([1,2,3]) - fileobj.seek(0) - self.assertEqual(fileobj.read(), "1;2;3\r\n") - finally: - fileobj.close() - os.unlink(name) - - finally: - csv.unregister_dialect('testC') - - def test_bad_dialect(self): - # Unknown parameter - self.assertRaises(TypeError, csv.reader, [], bad_attr = 0) - # Bad values - self.assertRaises(TypeError, csv.reader, [], delimiter = None) - self.assertRaises(TypeError, csv.reader, [], quoting = -1) - self.assertRaises(TypeError, csv.reader, [], quoting = 100) - -class TestCsvBase(unittest.TestCase): - def readerAssertEqual(self, input, expected_result): - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - fileobj.write(input) - fileobj.seek(0) - reader = csv.reader(fileobj, dialect = self.dialect) - fields = list(reader) - self.assertEqual(fields, expected_result) - finally: - fileobj.close() - os.unlink(name) - - def writerAssertEqual(self, input, expected_result): - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj, dialect = self.dialect) - writer.writerows(input) - fileobj.seek(0) - self.assertEqual(fileobj.read(), expected_result) - finally: - fileobj.close() - os.unlink(name) - -class TestDialectExcel(TestCsvBase): - dialect = 'excel' - - def test_single(self): - self.readerAssertEqual('abc', [['abc']]) - - def test_simple(self): - self.readerAssertEqual('1,2,3,4,5', [['1','2','3','4','5']]) - - def test_blankline(self): - self.readerAssertEqual('', []) - - def test_empty_fields(self): - self.readerAssertEqual(',', [['', '']]) - - def test_singlequoted(self): - self.readerAssertEqual('""', [['']]) - - def test_singlequoted_left_empty(self): - self.readerAssertEqual('"",', [['','']]) - - def test_singlequoted_right_empty(self): - self.readerAssertEqual(',""', [['','']]) - - def test_single_quoted_quote(self): - self.readerAssertEqual('""""', [['"']]) - - def test_quoted_quotes(self): - self.readerAssertEqual('""""""', [['""']]) - - def test_inline_quote(self): - self.readerAssertEqual('a""b', [['a""b']]) - - def test_inline_quotes(self): - self.readerAssertEqual('a"b"c', [['a"b"c']]) - - def test_quotes_and_more(self): - self.readerAssertEqual('"a"b', [['ab']]) - - def test_lone_quote(self): - self.readerAssertEqual('a"b', [['a"b']]) - - def test_quote_and_quote(self): - self.readerAssertEqual('"a" "b"', [['a "b"']]) - - def test_space_and_quote(self): - self.readerAssertEqual(' "a"', [[' "a"']]) - - def test_quoted(self): - self.readerAssertEqual('1,2,3,"I think, therefore I am",5,6', - [['1', '2', '3', - 'I think, therefore I am', - '5', '6']]) - - def test_quoted_quote(self): - self.readerAssertEqual('1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw"', - [['1', '2', '3', - '"I see," said the blind man', - 'as he picked up his hammer and saw']]) - - def test_quoted_nl(self): - input = '''\ -1,2,3,"""I see,"" -said the blind man","as he picked up his -hammer and saw" -9,8,7,6''' - self.readerAssertEqual(input, - [['1', '2', '3', - '"I see,"\nsaid the blind man', - 'as he picked up his\nhammer and saw'], - ['9','8','7','6']]) - - def test_dubious_quote(self): - self.readerAssertEqual('12,12,1",', [['12', '12', '1"', '']]) - - def test_null(self): - self.writerAssertEqual([], '') - - def test_single(self): - self.writerAssertEqual([['abc']], 'abc\r\n') - - def test_simple(self): - self.writerAssertEqual([[1, 2, 'abc', 3, 4]], '1,2,abc,3,4\r\n') - - def test_quotes(self): - self.writerAssertEqual([[1, 2, 'a"bc"', 3, 4]], '1,2,"a""bc""",3,4\r\n') - - def test_quote_fieldsep(self): - self.writerAssertEqual([['abc,def']], '"abc,def"\r\n') - - def test_newlines(self): - self.writerAssertEqual([[1, 2, 'a\nbc', 3, 4]], '1,2,"a\nbc",3,4\r\n') - -class EscapedExcel(csv.excel): - quoting = csv.QUOTE_NONE - escapechar = '\\' - -class TestEscapedExcel(TestCsvBase): - dialect = EscapedExcel() - - def test_escape_fieldsep(self): - self.writerAssertEqual([['abc,def']], 'abc\\,def\r\n') - - def test_read_escape_fieldsep(self): - self.readerAssertEqual('abc\\,def\r\n', [['abc,def']]) - -class QuotedEscapedExcel(csv.excel): - quoting = csv.QUOTE_NONNUMERIC - escapechar = '\\' - -class TestQuotedEscapedExcel(TestCsvBase): - dialect = QuotedEscapedExcel() - - def test_write_escape_fieldsep(self): - self.writerAssertEqual([['abc,def']], '"abc,def"\r\n') - - def test_read_escape_fieldsep(self): - self.readerAssertEqual('"abc\\,def"\r\n', [['abc,def']]) - -class TestDictFields(unittest.TestCase): - ### "long" means the row is longer than the number of fieldnames - ### "short" means there are fewer elements in the row than fieldnames - def test_write_simple_dict(self): - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2", "f3"]) - writer.writerow({"f1": 10, "f3": "abc"}) - fileobj.seek(0) - self.assertEqual(fileobj.read(), "10,,abc\r\n") - finally: - fileobj.close() - os.unlink(name) - - def test_write_no_fields(self): - fileobj = StringIO() - self.assertRaises(TypeError, csv.DictWriter, fileobj) - - def test_read_dict_fields(self): - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - fileobj.write("1,2,abc\r\n") - fileobj.seek(0) - reader = csv.DictReader(fileobj, - fieldnames=["f1", "f2", "f3"]) - self.assertEqual(reader.next(), {"f1": '1', "f2": '2', "f3": 'abc'}) - finally: - fileobj.close() - os.unlink(name) - - def test_read_dict_no_fieldnames(self): - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - fileobj.write("f1,f2,f3\r\n1,2,abc\r\n") - fileobj.seek(0) - reader = csv.DictReader(fileobj) - self.assertEqual(reader.next(), {"f1": '1', "f2": '2', "f3": 'abc'}) - finally: - fileobj.close() - os.unlink(name) - - def test_read_long(self): - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - fileobj.write("1,2,abc,4,5,6\r\n") - fileobj.seek(0) - reader = csv.DictReader(fileobj, - fieldnames=["f1", "f2"]) - self.assertEqual(reader.next(), {"f1": '1', "f2": '2', - None: ["abc", "4", "5", "6"]}) - finally: - fileobj.close() - os.unlink(name) - - def test_read_long_with_rest(self): - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - fileobj.write("1,2,abc,4,5,6\r\n") - fileobj.seek(0) - reader = csv.DictReader(fileobj, - fieldnames=["f1", "f2"], restkey="_rest") - self.assertEqual(reader.next(), {"f1": '1', "f2": '2', - "_rest": ["abc", "4", "5", "6"]}) - finally: - fileobj.close() - os.unlink(name) - - def test_read_long_with_rest_no_fieldnames(self): - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - fileobj.write("f1,f2\r\n1,2,abc,4,5,6\r\n") - fileobj.seek(0) - reader = csv.DictReader(fileobj, restkey="_rest") - self.assertEqual(reader.next(), {"f1": '1', "f2": '2', - "_rest": ["abc", "4", "5", "6"]}) - finally: - fileobj.close() - os.unlink(name) - - def test_read_short(self): - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - fileobj.write("1,2,abc,4,5,6\r\n1,2,abc\r\n") - fileobj.seek(0) - reader = csv.DictReader(fileobj, - fieldnames="1 2 3 4 5 6".split(), - restval="DEFAULT") - self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', - "4": '4', "5": '5', "6": '6'}) - self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', - "4": 'DEFAULT', "5": 'DEFAULT', - "6": 'DEFAULT'}) - finally: - fileobj.close() - os.unlink(name) - - def test_read_multi(self): - sample = [ - '2147483648,43.0e12,17,abc,def\r\n', - '147483648,43.0e2,17,abc,def\r\n', - '47483648,43.0,170,abc,def\r\n' - ] - - reader = csv.DictReader(sample, - fieldnames="i1 float i2 s1 s2".split()) - self.assertEqual(reader.next(), {"i1": '2147483648', - "float": '43.0e12', - "i2": '17', - "s1": 'abc', - "s2": 'def'}) - - def test_read_with_blanks(self): - reader = csv.DictReader(["1,2,abc,4,5,6\r\n","\r\n", - "1,2,abc,4,5,6\r\n"], - fieldnames="1 2 3 4 5 6".split()) - self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', - "4": '4', "5": '5', "6": '6'}) - self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', - "4": '4', "5": '5', "6": '6'}) - - def test_read_semi_sep(self): - reader = csv.DictReader(["1;2;abc;4;5;6\r\n"], - fieldnames="1 2 3 4 5 6".split(), - delimiter=';') - self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', - "4": '4', "5": '5', "6": '6'}) - -class TestArrayWrites(unittest.TestCase): - def test_int_write(self): - import array - contents = [(20-i) for i in range(20)] - a = array.array('i', contents) - - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj, dialect="excel") - writer.writerow(a) - expected = ",".join([str(i) for i in a])+"\r\n" - fileobj.seek(0) - self.assertEqual(fileobj.read(), expected) - finally: - fileobj.close() - os.unlink(name) - - def test_double_write(self): - import array - contents = [(20-i)*0.1 for i in range(20)] - a = array.array('d', contents) - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj, dialect="excel") - writer.writerow(a) - expected = ",".join([str(i) for i in a])+"\r\n" - fileobj.seek(0) - self.assertEqual(fileobj.read(), expected) - finally: - fileobj.close() - os.unlink(name) - - def test_float_write(self): - import array - contents = [(20-i)*0.1 for i in range(20)] - a = array.array('f', contents) - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj, dialect="excel") - writer.writerow(a) - expected = ",".join([str(i) for i in a])+"\r\n" - fileobj.seek(0) - self.assertEqual(fileobj.read(), expected) - finally: - fileobj.close() - os.unlink(name) - - def test_char_write(self): - import array, string - a = array.array('c', string.letters) - fd, name = tempfile.mkstemp() - fileobj = os.fdopen(fd, "w+b") - try: - writer = csv.writer(fileobj, dialect="excel") - writer.writerow(a) - expected = ",".join(a)+"\r\n" - fileobj.seek(0) - self.assertEqual(fileobj.read(), expected) - finally: - fileobj.close() - os.unlink(name) - -class TestDialectValidity(unittest.TestCase): - def test_quoting(self): - class mydialect(csv.Dialect): - delimiter = ";" - escapechar = '\\' - doublequote = False - skipinitialspace = True - lineterminator = '\r\n' - quoting = csv.QUOTE_NONE - d = mydialect() - - mydialect.quoting = None - self.assertRaises(csv.Error, mydialect) - - mydialect.doublequote = True - mydialect.quoting = csv.QUOTE_ALL - mydialect.quotechar = '"' - d = mydialect() - - mydialect.quotechar = "''" - self.assertRaises(csv.Error, mydialect) - - mydialect.quotechar = 4 - self.assertRaises(csv.Error, mydialect) - - def test_delimiter(self): - class mydialect(csv.Dialect): - delimiter = ";" - escapechar = '\\' - doublequote = False - skipinitialspace = True - lineterminator = '\r\n' - quoting = csv.QUOTE_NONE - d = mydialect() - - mydialect.delimiter = ":::" - self.assertRaises(csv.Error, mydialect) - - mydialect.delimiter = 4 - self.assertRaises(csv.Error, mydialect) - - def test_lineterminator(self): - class mydialect(csv.Dialect): - delimiter = ";" - escapechar = '\\' - doublequote = False - skipinitialspace = True - lineterminator = '\r\n' - quoting = csv.QUOTE_NONE - d = mydialect() - - mydialect.lineterminator = ":::" - d = mydialect() - - mydialect.lineterminator = 4 - self.assertRaises(csv.Error, mydialect) - - -class TestSniffer(unittest.TestCase): - sample1 = """\ -Harry's, Arlington Heights, IL, 2/1/03, Kimi Hayes -Shark City, Glendale Heights, IL, 12/28/02, Prezence -Tommy's Place, Blue Island, IL, 12/28/02, Blue Sunday/White Crow -Stonecutters Seafood and Chop House, Lemont, IL, 12/19/02, Week Back -""" - sample2 = """\ -'Harry''s':'Arlington Heights':'IL':'2/1/03':'Kimi Hayes' -'Shark City':'Glendale Heights':'IL':'12/28/02':'Prezence' -'Tommy''s Place':'Blue Island':'IL':'12/28/02':'Blue Sunday/White Crow' -'Stonecutters Seafood and Chop House':'Lemont':'IL':'12/19/02':'Week Back' -""" - header = '''\ -"venue","city","state","date","performers" -''' - sample3 = '''\ -05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03 -05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03 -05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03 -''' - - sample4 = '''\ -2147483648;43.0e12;17;abc;def -147483648;43.0e2;17;abc;def -47483648;43.0;170;abc;def -''' - - sample5 = "aaa\tbbb\r\nAAA\t\r\nBBB\t\r\n" - sample6 = "a|b|c\r\nd|e|f\r\n" - sample7 = "'a'|'b'|'c'\r\n'd'|e|f\r\n" - - def test_has_header(self): - sniffer = csv.Sniffer() - self.assertEqual(sniffer.has_header(self.sample1), False) - self.assertEqual(sniffer.has_header(self.header+self.sample1), True) - - def test_sniff(self): - sniffer = csv.Sniffer() - dialect = sniffer.sniff(self.sample1) - self.assertEqual(dialect.delimiter, ",") - self.assertEqual(dialect.quotechar, '"') - self.assertEqual(dialect.skipinitialspace, True) - - dialect = sniffer.sniff(self.sample2) - self.assertEqual(dialect.delimiter, ":") - self.assertEqual(dialect.quotechar, "'") - self.assertEqual(dialect.skipinitialspace, False) - - def test_delimiters(self): - sniffer = csv.Sniffer() - dialect = sniffer.sniff(self.sample3) - # given that all three lines in sample3 are equal, - # I think that any character could have been 'guessed' as the - # delimiter, depending on dictionary order - self.assert_(dialect.delimiter in self.sample3) - dialect = sniffer.sniff(self.sample3, delimiters="?,") - self.assertEqual(dialect.delimiter, "?") - dialect = sniffer.sniff(self.sample3, delimiters="/,") - self.assertEqual(dialect.delimiter, "/") - dialect = sniffer.sniff(self.sample4) - self.assertEqual(dialect.delimiter, ";") - dialect = sniffer.sniff(self.sample5) - self.assertEqual(dialect.delimiter, "\t") - dialect = sniffer.sniff(self.sample6) - self.assertEqual(dialect.delimiter, "|") - dialect = sniffer.sniff(self.sample7) - self.assertEqual(dialect.delimiter, "|") - self.assertEqual(dialect.quotechar, "'") - -if not hasattr(sys, "gettotalrefcount"): - if test_support.verbose: print "*** skipping leakage tests ***" -else: - class NUL: - def write(s, *args): - pass - writelines = write - - class TestLeaks(unittest.TestCase): - def test_create_read(self): - delta = 0 - lastrc = sys.gettotalrefcount() - for i in xrange(20): - gc.collect() - self.assertEqual(gc.garbage, []) - rc = sys.gettotalrefcount() - csv.reader(["a,b,c\r\n"]) - csv.reader(["a,b,c\r\n"]) - csv.reader(["a,b,c\r\n"]) - delta = rc-lastrc - lastrc = rc - # if csv.reader() leaks, last delta should be 3 or more - self.assertEqual(delta < 3, True) - - def test_create_write(self): - delta = 0 - lastrc = sys.gettotalrefcount() - s = NUL() - for i in xrange(20): - gc.collect() - self.assertEqual(gc.garbage, []) - rc = sys.gettotalrefcount() - csv.writer(s) - csv.writer(s) - csv.writer(s) - delta = rc-lastrc - lastrc = rc - # if csv.writer() leaks, last delta should be 3 or more - self.assertEqual(delta < 3, True) - - def test_read(self): - delta = 0 - rows = ["a,b,c\r\n"]*5 - lastrc = sys.gettotalrefcount() - for i in xrange(20): - gc.collect() - self.assertEqual(gc.garbage, []) - rc = sys.gettotalrefcount() - rdr = csv.reader(rows) - for row in rdr: - pass - delta = rc-lastrc - lastrc = rc - # if reader leaks during read, delta should be 5 or more - self.assertEqual(delta < 5, True) - - def test_write(self): - delta = 0 - rows = [[1,2,3]]*5 - s = NUL() - lastrc = sys.gettotalrefcount() - for i in xrange(20): - gc.collect() - self.assertEqual(gc.garbage, []) - rc = sys.gettotalrefcount() - writer = csv.writer(s) - for row in rows: - writer.writerow(row) - delta = rc-lastrc - lastrc = rc - # if writer leaks during write, last delta should be 5 or more - self.assertEqual(delta < 5, True) - -# commented out for now - csv module doesn't yet support Unicode -## class TestUnicode(unittest.TestCase): -## def test_unicode_read(self): -## import codecs -## f = codecs.EncodedFile(StringIO("Martin von Löwis," -## "Marc André Lemburg," -## "Guido van Rossum," -## "François Pinard\r\n"), -## data_encoding='iso-8859-1') -## reader = csv.reader(f) -## self.assertEqual(list(reader), [[u"Martin von Löwis", -## u"Marc André Lemburg", -## u"Guido van Rossum", -## u"François Pinardn"]]) - -def test_main(): - mod = sys.modules[__name__] - test_support.run_unittest( - *[getattr(mod, name) for name in dir(mod) if name.startswith('Test')] - ) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_ctypes.py b/sys/lib/python/test/test_ctypes.py deleted file mode 100644 index fd2032bc6..000000000 --- a/sys/lib/python/test/test_ctypes.py +++ /dev/null @@ -1,12 +0,0 @@ -import unittest - -from test.test_support import run_suite -import ctypes.test - -def test_main(): - skipped, testcases = ctypes.test.get_tests(ctypes.test, "test_*.py", verbosity=0) - suites = [unittest.makeSuite(t) for t in testcases] - run_suite(unittest.TestSuite(suites)) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_curses.py b/sys/lib/python/test/test_curses.py deleted file mode 100644 index ff7b39d11..000000000 --- a/sys/lib/python/test/test_curses.py +++ /dev/null @@ -1,275 +0,0 @@ -# -# Test script for the curses module -# -# This script doesn't actually display anything very coherent. but it -# does call every method and function. -# -# Functions not tested: {def,reset}_{shell,prog}_mode, getch(), getstr(), -# init_color() -# Only called, not tested: getmouse(), ungetmouse() -# - -import curses, sys, tempfile, os -import curses.panel - -# Optionally test curses module. This currently requires that the -# 'curses' resource be given on the regrtest command line using the -u -# option. If not available, nothing after this line will be executed. - -from test.test_support import requires, TestSkipped -requires('curses') - -# XXX: if newterm was supported we could use it instead of initscr and not exit -term = os.environ.get('TERM') -if not term or term == 'unknown': - raise TestSkipped, "$TERM=%r, calling initscr() may cause exit" % term - -if sys.platform == "cygwin": - raise TestSkipped("cygwin's curses mostly just hangs") - -def window_funcs(stdscr): - "Test the methods of windows" - win = curses.newwin(10,10) - win = curses.newwin(5,5, 5,5) - win2 = curses.newwin(15,15, 5,5) - - for meth in [stdscr.addch, stdscr.addstr]: - for args in [('a'), ('a', curses.A_BOLD), - (4,4, 'a'), (5,5, 'a', curses.A_BOLD)]: - meth(*args) - - for meth in [stdscr.box, stdscr.clear, stdscr.clrtobot, - stdscr.clrtoeol, stdscr.cursyncup, stdscr.delch, - stdscr.deleteln, stdscr.erase, stdscr.getbegyx, - stdscr.getbkgd, stdscr.getkey, stdscr.getmaxyx, - stdscr.getparyx, stdscr.getyx, stdscr.inch, - stdscr.insertln, stdscr.instr, stdscr.is_wintouched, - win.noutrefresh, stdscr.redrawwin, stdscr.refresh, - stdscr.standout, stdscr.standend, stdscr.syncdown, - stdscr.syncup, stdscr.touchwin, stdscr.untouchwin]: - meth() - - stdscr.addnstr('1234', 3) - stdscr.addnstr('1234', 3, curses.A_BOLD) - stdscr.addnstr(4,4, '1234', 3) - stdscr.addnstr(5,5, '1234', 3, curses.A_BOLD) - - stdscr.attron(curses.A_BOLD) - stdscr.attroff(curses.A_BOLD) - stdscr.attrset(curses.A_BOLD) - stdscr.bkgd(' ') - stdscr.bkgd(' ', curses.A_REVERSE) - stdscr.bkgdset(' ') - stdscr.bkgdset(' ', curses.A_REVERSE) - - win.border(65, 66, 67, 68, - 69, 70, 71, 72) - win.border('|', '!', '-', '_', - '+', '\\', '#', '/') - try: - win.border(65, 66, 67, 68, - 69, [], 71, 72) - except TypeError: - pass - else: - raise RuntimeError, "Expected win.border() to raise TypeError" - - stdscr.clearok(1) - - win4 = stdscr.derwin(2,2) - win4 = stdscr.derwin(1,1, 5,5) - win4.mvderwin(9,9) - - stdscr.echochar('a') - stdscr.echochar('a', curses.A_BOLD) - stdscr.hline('-', 5) - stdscr.hline('-', 5, curses.A_BOLD) - stdscr.hline(1,1,'-', 5) - stdscr.hline(1,1,'-', 5, curses.A_BOLD) - - stdscr.idcok(1) - stdscr.idlok(1) - stdscr.immedok(1) - stdscr.insch('c') - stdscr.insdelln(1) - stdscr.insnstr('abc', 3) - stdscr.insnstr('abc', 3, curses.A_BOLD) - stdscr.insnstr(5, 5, 'abc', 3) - stdscr.insnstr(5, 5, 'abc', 3, curses.A_BOLD) - - stdscr.insstr('def') - stdscr.insstr('def', curses.A_BOLD) - stdscr.insstr(5, 5, 'def') - stdscr.insstr(5, 5, 'def', curses.A_BOLD) - stdscr.is_linetouched(0) - stdscr.keypad(1) - stdscr.leaveok(1) - stdscr.move(3,3) - win.mvwin(2,2) - stdscr.nodelay(1) - stdscr.notimeout(1) - win2.overlay(win) - win2.overwrite(win) - win2.overlay(win, 1, 2, 3, 3, 2, 1) - win2.overwrite(win, 1, 2, 3, 3, 2, 1) - stdscr.redrawln(1,2) - - stdscr.scrollok(1) - stdscr.scroll() - stdscr.scroll(2) - stdscr.scroll(-3) - - stdscr.move(12, 2) - stdscr.setscrreg(10,15) - win3 = stdscr.subwin(10,10) - win3 = stdscr.subwin(10,10, 5,5) - stdscr.syncok(1) - stdscr.timeout(5) - stdscr.touchline(5,5) - stdscr.touchline(5,5,0) - stdscr.vline('a', 3) - stdscr.vline('a', 3, curses.A_STANDOUT) - stdscr.vline(1,1, 'a', 3) - stdscr.vline(1,1, 'a', 3, curses.A_STANDOUT) - - if hasattr(curses, 'resize'): - stdscr.resize() - if hasattr(curses, 'enclose'): - stdscr.enclose() - - -def module_funcs(stdscr): - "Test module-level functions" - - for func in [curses.baudrate, curses.beep, curses.can_change_color, - curses.cbreak, curses.def_prog_mode, curses.doupdate, - curses.filter, curses.flash, curses.flushinp, - curses.has_colors, curses.has_ic, curses.has_il, - curses.isendwin, curses.killchar, curses.longname, - curses.nocbreak, curses.noecho, curses.nonl, - curses.noqiflush, curses.noraw, - curses.reset_prog_mode, curses.termattrs, - curses.termname, curses.erasechar, curses.getsyx]: - func() - - # Functions that actually need arguments - if curses.tigetstr("cnorm"): - curses.curs_set(1) - curses.delay_output(1) - curses.echo() ; curses.echo(1) - - f = tempfile.TemporaryFile() - stdscr.putwin(f) - f.seek(0) - curses.getwin(f) - f.close() - - curses.halfdelay(1) - curses.intrflush(1) - curses.meta(1) - curses.napms(100) - curses.newpad(50,50) - win = curses.newwin(5,5) - win = curses.newwin(5,5, 1,1) - curses.nl() ; curses.nl(1) - curses.putp('abc') - curses.qiflush() - curses.raw() ; curses.raw(1) - curses.setsyx(5,5) - curses.tigetflag('hc') - curses.tigetnum('co') - curses.tigetstr('cr') - curses.tparm('cr') - curses.typeahead(sys.__stdin__.fileno()) - curses.unctrl('a') - curses.ungetch('a') - curses.use_env(1) - - # Functions only available on a few platforms - if curses.has_colors(): - curses.start_color() - curses.init_pair(2, 1,1) - curses.color_content(1) - curses.color_pair(2) - curses.pair_content(curses.COLOR_PAIRS - 1) - curses.pair_number(0) - - if hasattr(curses, 'use_default_colors'): - curses.use_default_colors() - - if hasattr(curses, 'keyname'): - curses.keyname(13) - - if hasattr(curses, 'has_key'): - curses.has_key(13) - - if hasattr(curses, 'getmouse'): - (availmask, oldmask) = curses.mousemask(curses.BUTTON1_PRESSED) - # availmask indicates that mouse stuff not available. - if availmask != 0: - curses.mouseinterval(10) - # just verify these don't cause errors - m = curses.getmouse() - curses.ungetmouse(*m) - - if hasattr(curses, 'is_term_resized'): - curses.is_term_resized(*stdscr.getmaxyx()) - if hasattr(curses, 'resizeterm'): - curses.resizeterm(*stdscr.getmaxyx()) - if hasattr(curses, 'resize_term'): - curses.resize_term(*stdscr.getmaxyx()) - -def unit_tests(): - from curses import ascii - for ch, expected in [('a', 'a'), ('A', 'A'), - (';', ';'), (' ', ' '), - ('\x7f', '^?'), ('\n', '^J'), ('\0', '^@'), - # Meta-bit characters - ('\x8a', '!^J'), ('\xc1', '!A'), - ]: - if ascii.unctrl(ch) != expected: - print 'curses.unctrl fails on character', repr(ch) - - -def test_userptr_without_set(stdscr): - w = curses.newwin(10, 10) - p = curses.panel.new_panel(w) - # try to access userptr() before calling set_userptr() -- segfaults - try: - p.userptr() - raise RuntimeError, 'userptr should fail since not set' - except curses.panel.error: - pass - -def test_resize_term(stdscr): - if hasattr(curses, 'resizeterm'): - lines, cols = curses.LINES, curses.COLS - curses.resizeterm(lines - 1, cols + 1) - - if curses.LINES != lines - 1 or curses.COLS != cols + 1: - raise RuntimeError, "Expected resizeterm to update LINES and COLS" - -def main(stdscr): - curses.savetty() - try: - module_funcs(stdscr) - window_funcs(stdscr) - test_userptr_without_set(stdscr) - test_resize_term(stdscr) - finally: - curses.resetty() - -if __name__ == '__main__': - curses.wrapper(main) - unit_tests() -else: - try: - # testing setupterm() inside initscr/endwin - # causes terminal breakage - curses.setupterm(fd=sys.__stdout__.fileno()) - stdscr = curses.initscr() - main(stdscr) - finally: - curses.endwin() - - unit_tests() diff --git a/sys/lib/python/test/test_datetime.py b/sys/lib/python/test/test_datetime.py deleted file mode 100644 index 40eb3ab92..000000000 --- a/sys/lib/python/test/test_datetime.py +++ /dev/null @@ -1,3287 +0,0 @@ -"""Test date/time type. - -See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases -""" - -import os -import sys -import pickle -import cPickle -import unittest - -from test import test_support - -from datetime import MINYEAR, MAXYEAR -from datetime import timedelta -from datetime import tzinfo -from datetime import time -from datetime import date, datetime - -pickle_choices = [(pickler, unpickler, proto) - for pickler in pickle, cPickle - for unpickler in pickle, cPickle - for proto in range(3)] -assert len(pickle_choices) == 2*2*3 - -# An arbitrary collection of objects of non-datetime types, for testing -# mixed-type comparisons. -OTHERSTUFF = (10, 10L, 34.5, "abc", {}, [], ()) - - -############################################################################# -# module tests - -class TestModule(unittest.TestCase): - - def test_constants(self): - import datetime - self.assertEqual(datetime.MINYEAR, 1) - self.assertEqual(datetime.MAXYEAR, 9999) - -############################################################################# -# tzinfo tests - -class FixedOffset(tzinfo): - def __init__(self, offset, name, dstoffset=42): - if isinstance(offset, int): - offset = timedelta(minutes=offset) - if isinstance(dstoffset, int): - dstoffset = timedelta(minutes=dstoffset) - self.__offset = offset - self.__name = name - self.__dstoffset = dstoffset - def __repr__(self): - return self.__name.lower() - def utcoffset(self, dt): - return self.__offset - def tzname(self, dt): - return self.__name - def dst(self, dt): - return self.__dstoffset - -class PicklableFixedOffset(FixedOffset): - def __init__(self, offset=None, name=None, dstoffset=None): - FixedOffset.__init__(self, offset, name, dstoffset) - -class TestTZInfo(unittest.TestCase): - - def test_non_abstractness(self): - # In order to allow subclasses to get pickled, the C implementation - # wasn't able to get away with having __init__ raise - # NotImplementedError. - useless = tzinfo() - dt = datetime.max - self.assertRaises(NotImplementedError, useless.tzname, dt) - self.assertRaises(NotImplementedError, useless.utcoffset, dt) - self.assertRaises(NotImplementedError, useless.dst, dt) - - def test_subclass_must_override(self): - class NotEnough(tzinfo): - def __init__(self, offset, name): - self.__offset = offset - self.__name = name - self.failUnless(issubclass(NotEnough, tzinfo)) - ne = NotEnough(3, "NotByALongShot") - self.failUnless(isinstance(ne, tzinfo)) - - dt = datetime.now() - self.assertRaises(NotImplementedError, ne.tzname, dt) - self.assertRaises(NotImplementedError, ne.utcoffset, dt) - self.assertRaises(NotImplementedError, ne.dst, dt) - - def test_normal(self): - fo = FixedOffset(3, "Three") - self.failUnless(isinstance(fo, tzinfo)) - for dt in datetime.now(), None: - self.assertEqual(fo.utcoffset(dt), timedelta(minutes=3)) - self.assertEqual(fo.tzname(dt), "Three") - self.assertEqual(fo.dst(dt), timedelta(minutes=42)) - - def test_pickling_base(self): - # There's no point to pickling tzinfo objects on their own (they - # carry no data), but they need to be picklable anyway else - # concrete subclasses can't be pickled. - orig = tzinfo.__new__(tzinfo) - self.failUnless(type(orig) is tzinfo) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.failUnless(type(derived) is tzinfo) - - def test_pickling_subclass(self): - # Make sure we can pickle/unpickle an instance of a subclass. - offset = timedelta(minutes=-300) - orig = PicklableFixedOffset(offset, 'cookie') - self.failUnless(isinstance(orig, tzinfo)) - self.failUnless(type(orig) is PicklableFixedOffset) - self.assertEqual(orig.utcoffset(None), offset) - self.assertEqual(orig.tzname(None), 'cookie') - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.failUnless(isinstance(derived, tzinfo)) - self.failUnless(type(derived) is PicklableFixedOffset) - self.assertEqual(derived.utcoffset(None), offset) - self.assertEqual(derived.tzname(None), 'cookie') - -############################################################################# -# Base clase for testing a particular aspect of timedelta, time, date and -# datetime comparisons. - -class HarmlessMixedComparison(unittest.TestCase): - # Test that __eq__ and __ne__ don't complain for mixed-type comparisons. - - # Subclasses must define 'theclass', and theclass(1, 1, 1) must be a - # legit constructor. - - def test_harmless_mixed_comparison(self): - me = self.theclass(1, 1, 1) - - self.failIf(me == ()) - self.failUnless(me != ()) - self.failIf(() == me) - self.failUnless(() != me) - - self.failUnless(me in [1, 20L, [], me]) - self.failIf(me not in [1, 20L, [], me]) - - self.failUnless([] in [me, 1, 20L, []]) - self.failIf([] not in [me, 1, 20L, []]) - - def test_harmful_mixed_comparison(self): - me = self.theclass(1, 1, 1) - - self.assertRaises(TypeError, lambda: me < ()) - self.assertRaises(TypeError, lambda: me <= ()) - self.assertRaises(TypeError, lambda: me > ()) - self.assertRaises(TypeError, lambda: me >= ()) - - self.assertRaises(TypeError, lambda: () < me) - self.assertRaises(TypeError, lambda: () <= me) - self.assertRaises(TypeError, lambda: () > me) - self.assertRaises(TypeError, lambda: () >= me) - - self.assertRaises(TypeError, cmp, (), me) - self.assertRaises(TypeError, cmp, me, ()) - -############################################################################# -# timedelta tests - -class TestTimeDelta(HarmlessMixedComparison): - - theclass = timedelta - - def test_constructor(self): - eq = self.assertEqual - td = timedelta - - # Check keyword args to constructor - eq(td(), td(weeks=0, days=0, hours=0, minutes=0, seconds=0, - milliseconds=0, microseconds=0)) - eq(td(1), td(days=1)) - eq(td(0, 1), td(seconds=1)) - eq(td(0, 0, 1), td(microseconds=1)) - eq(td(weeks=1), td(days=7)) - eq(td(days=1), td(hours=24)) - eq(td(hours=1), td(minutes=60)) - eq(td(minutes=1), td(seconds=60)) - eq(td(seconds=1), td(milliseconds=1000)) - eq(td(milliseconds=1), td(microseconds=1000)) - - # Check float args to constructor - eq(td(weeks=1.0/7), td(days=1)) - eq(td(days=1.0/24), td(hours=1)) - eq(td(hours=1.0/60), td(minutes=1)) - eq(td(minutes=1.0/60), td(seconds=1)) - eq(td(seconds=0.001), td(milliseconds=1)) - eq(td(milliseconds=0.001), td(microseconds=1)) - - def test_computations(self): - eq = self.assertEqual - td = timedelta - - a = td(7) # One week - b = td(0, 60) # One minute - c = td(0, 0, 1000) # One millisecond - eq(a+b+c, td(7, 60, 1000)) - eq(a-b, td(6, 24*3600 - 60)) - eq(-a, td(-7)) - eq(+a, td(7)) - eq(-b, td(-1, 24*3600 - 60)) - eq(-c, td(-1, 24*3600 - 1, 999000)) - eq(abs(a), a) - eq(abs(-a), a) - eq(td(6, 24*3600), a) - eq(td(0, 0, 60*1000000), b) - eq(a*10, td(70)) - eq(a*10, 10*a) - eq(a*10L, 10*a) - eq(b*10, td(0, 600)) - eq(10*b, td(0, 600)) - eq(b*10L, td(0, 600)) - eq(c*10, td(0, 0, 10000)) - eq(10*c, td(0, 0, 10000)) - eq(c*10L, td(0, 0, 10000)) - eq(a*-1, -a) - eq(b*-2, -b-b) - eq(c*-2, -c+-c) - eq(b*(60*24), (b*60)*24) - eq(b*(60*24), (60*b)*24) - eq(c*1000, td(0, 1)) - eq(1000*c, td(0, 1)) - eq(a//7, td(1)) - eq(b//10, td(0, 6)) - eq(c//1000, td(0, 0, 1)) - eq(a//10, td(0, 7*24*360)) - eq(a//3600000, td(0, 0, 7*24*1000)) - - def test_disallowed_computations(self): - a = timedelta(42) - - # Add/sub ints, longs, floats should be illegal - for i in 1, 1L, 1.0: - self.assertRaises(TypeError, lambda: a+i) - self.assertRaises(TypeError, lambda: a-i) - self.assertRaises(TypeError, lambda: i+a) - self.assertRaises(TypeError, lambda: i-a) - - # Mul/div by float isn't supported. - x = 2.3 - self.assertRaises(TypeError, lambda: a*x) - self.assertRaises(TypeError, lambda: x*a) - self.assertRaises(TypeError, lambda: a/x) - self.assertRaises(TypeError, lambda: x/a) - self.assertRaises(TypeError, lambda: a // x) - self.assertRaises(TypeError, lambda: x // a) - - # Divison of int by timedelta doesn't make sense. - # Division by zero doesn't make sense. - for zero in 0, 0L: - self.assertRaises(TypeError, lambda: zero // a) - self.assertRaises(ZeroDivisionError, lambda: a // zero) - - def test_basic_attributes(self): - days, seconds, us = 1, 7, 31 - td = timedelta(days, seconds, us) - self.assertEqual(td.days, days) - self.assertEqual(td.seconds, seconds) - self.assertEqual(td.microseconds, us) - - def test_carries(self): - t1 = timedelta(days=100, - weeks=-7, - hours=-24*(100-49), - minutes=-3, - seconds=12, - microseconds=(3*60 - 12) * 1e6 + 1) - t2 = timedelta(microseconds=1) - self.assertEqual(t1, t2) - - def test_hash_equality(self): - t1 = timedelta(days=100, - weeks=-7, - hours=-24*(100-49), - minutes=-3, - seconds=12, - microseconds=(3*60 - 12) * 1000000) - t2 = timedelta() - self.assertEqual(hash(t1), hash(t2)) - - t1 += timedelta(weeks=7) - t2 += timedelta(days=7*7) - self.assertEqual(t1, t2) - self.assertEqual(hash(t1), hash(t2)) - - d = {t1: 1} - d[t2] = 2 - self.assertEqual(len(d), 1) - self.assertEqual(d[t1], 2) - - def test_pickling(self): - args = 12, 34, 56 - orig = timedelta(*args) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - - def test_compare(self): - t1 = timedelta(2, 3, 4) - t2 = timedelta(2, 3, 4) - self.failUnless(t1 == t2) - self.failUnless(t1 <= t2) - self.failUnless(t1 >= t2) - self.failUnless(not t1 != t2) - self.failUnless(not t1 < t2) - self.failUnless(not t1 > t2) - self.assertEqual(cmp(t1, t2), 0) - self.assertEqual(cmp(t2, t1), 0) - - for args in (3, 3, 3), (2, 4, 4), (2, 3, 5): - t2 = timedelta(*args) # this is larger than t1 - self.failUnless(t1 < t2) - self.failUnless(t2 > t1) - self.failUnless(t1 <= t2) - self.failUnless(t2 >= t1) - self.failUnless(t1 != t2) - self.failUnless(t2 != t1) - self.failUnless(not t1 == t2) - self.failUnless(not t2 == t1) - self.failUnless(not t1 > t2) - self.failUnless(not t2 < t1) - self.failUnless(not t1 >= t2) - self.failUnless(not t2 <= t1) - self.assertEqual(cmp(t1, t2), -1) - self.assertEqual(cmp(t2, t1), 1) - - for badarg in OTHERSTUFF: - self.assertEqual(t1 == badarg, False) - self.assertEqual(t1 != badarg, True) - self.assertEqual(badarg == t1, False) - self.assertEqual(badarg != t1, True) - - self.assertRaises(TypeError, lambda: t1 <= badarg) - self.assertRaises(TypeError, lambda: t1 < badarg) - self.assertRaises(TypeError, lambda: t1 > badarg) - self.assertRaises(TypeError, lambda: t1 >= badarg) - self.assertRaises(TypeError, lambda: badarg <= t1) - self.assertRaises(TypeError, lambda: badarg < t1) - self.assertRaises(TypeError, lambda: badarg > t1) - self.assertRaises(TypeError, lambda: badarg >= t1) - - def test_str(self): - td = timedelta - eq = self.assertEqual - - eq(str(td(1)), "1 day, 0:00:00") - eq(str(td(-1)), "-1 day, 0:00:00") - eq(str(td(2)), "2 days, 0:00:00") - eq(str(td(-2)), "-2 days, 0:00:00") - - eq(str(td(hours=12, minutes=58, seconds=59)), "12:58:59") - eq(str(td(hours=2, minutes=3, seconds=4)), "2:03:04") - eq(str(td(weeks=-30, hours=23, minutes=12, seconds=34)), - "-210 days, 23:12:34") - - eq(str(td(milliseconds=1)), "0:00:00.001000") - eq(str(td(microseconds=3)), "0:00:00.000003") - - eq(str(td(days=999999999, hours=23, minutes=59, seconds=59, - microseconds=999999)), - "999999999 days, 23:59:59.999999") - - def test_roundtrip(self): - for td in (timedelta(days=999999999, hours=23, minutes=59, - seconds=59, microseconds=999999), - timedelta(days=-999999999), - timedelta(days=1, seconds=2, microseconds=3)): - - # Verify td -> string -> td identity. - s = repr(td) - self.failUnless(s.startswith('datetime.')) - s = s[9:] - td2 = eval(s) - self.assertEqual(td, td2) - - # Verify identity via reconstructing from pieces. - td2 = timedelta(td.days, td.seconds, td.microseconds) - self.assertEqual(td, td2) - - def test_resolution_info(self): - self.assert_(isinstance(timedelta.min, timedelta)) - self.assert_(isinstance(timedelta.max, timedelta)) - self.assert_(isinstance(timedelta.resolution, timedelta)) - self.assert_(timedelta.max > timedelta.min) - self.assertEqual(timedelta.min, timedelta(-999999999)) - self.assertEqual(timedelta.max, timedelta(999999999, 24*3600-1, 1e6-1)) - self.assertEqual(timedelta.resolution, timedelta(0, 0, 1)) - - def test_overflow(self): - tiny = timedelta.resolution - - td = timedelta.min + tiny - td -= tiny # no problem - self.assertRaises(OverflowError, td.__sub__, tiny) - self.assertRaises(OverflowError, td.__add__, -tiny) - - td = timedelta.max - tiny - td += tiny # no problem - self.assertRaises(OverflowError, td.__add__, tiny) - self.assertRaises(OverflowError, td.__sub__, -tiny) - - self.assertRaises(OverflowError, lambda: -timedelta.max) - - def test_microsecond_rounding(self): - td = timedelta - eq = self.assertEqual - - # Single-field rounding. - eq(td(milliseconds=0.4/1000), td(0)) # rounds to 0 - eq(td(milliseconds=-0.4/1000), td(0)) # rounds to 0 - eq(td(milliseconds=0.6/1000), td(microseconds=1)) - eq(td(milliseconds=-0.6/1000), td(microseconds=-1)) - - # Rounding due to contributions from more than one field. - us_per_hour = 3600e6 - us_per_day = us_per_hour * 24 - eq(td(days=.4/us_per_day), td(0)) - eq(td(hours=.2/us_per_hour), td(0)) - eq(td(days=.4/us_per_day, hours=.2/us_per_hour), td(microseconds=1)) - - eq(td(days=-.4/us_per_day), td(0)) - eq(td(hours=-.2/us_per_hour), td(0)) - eq(td(days=-.4/us_per_day, hours=-.2/us_per_hour), td(microseconds=-1)) - - def test_massive_normalization(self): - td = timedelta(microseconds=-1) - self.assertEqual((td.days, td.seconds, td.microseconds), - (-1, 24*3600-1, 999999)) - - def test_bool(self): - self.failUnless(timedelta(1)) - self.failUnless(timedelta(0, 1)) - self.failUnless(timedelta(0, 0, 1)) - self.failUnless(timedelta(microseconds=1)) - self.failUnless(not timedelta(0)) - - def test_subclass_timedelta(self): - - class T(timedelta): - @staticmethod - def from_td(td): - return T(td.days, td.seconds, td.microseconds) - - def as_hours(self): - sum = (self.days * 24 + - self.seconds / 3600.0 + - self.microseconds / 3600e6) - return round(sum) - - t1 = T(days=1) - self.assert_(type(t1) is T) - self.assertEqual(t1.as_hours(), 24) - - t2 = T(days=-1, seconds=-3600) - self.assert_(type(t2) is T) - self.assertEqual(t2.as_hours(), -25) - - t3 = t1 + t2 - self.assert_(type(t3) is timedelta) - t4 = T.from_td(t3) - self.assert_(type(t4) is T) - self.assertEqual(t3.days, t4.days) - self.assertEqual(t3.seconds, t4.seconds) - self.assertEqual(t3.microseconds, t4.microseconds) - self.assertEqual(str(t3), str(t4)) - self.assertEqual(t4.as_hours(), -1) - -############################################################################# -# date tests - -class TestDateOnly(unittest.TestCase): - # Tests here won't pass if also run on datetime objects, so don't - # subclass this to test datetimes too. - - def test_delta_non_days_ignored(self): - dt = date(2000, 1, 2) - delta = timedelta(days=1, hours=2, minutes=3, seconds=4, - microseconds=5) - days = timedelta(delta.days) - self.assertEqual(days, timedelta(1)) - - dt2 = dt + delta - self.assertEqual(dt2, dt + days) - - dt2 = delta + dt - self.assertEqual(dt2, dt + days) - - dt2 = dt - delta - self.assertEqual(dt2, dt - days) - - delta = -delta - days = timedelta(delta.days) - self.assertEqual(days, timedelta(-2)) - - dt2 = dt + delta - self.assertEqual(dt2, dt + days) - - dt2 = delta + dt - self.assertEqual(dt2, dt + days) - - dt2 = dt - delta - self.assertEqual(dt2, dt - days) - -class SubclassDate(date): - sub_var = 1 - -class TestDate(HarmlessMixedComparison): - # Tests here should pass for both dates and datetimes, except for a - # few tests that TestDateTime overrides. - - theclass = date - - def test_basic_attributes(self): - dt = self.theclass(2002, 3, 1) - self.assertEqual(dt.year, 2002) - self.assertEqual(dt.month, 3) - self.assertEqual(dt.day, 1) - - def test_roundtrip(self): - for dt in (self.theclass(1, 2, 3), - self.theclass.today()): - # Verify dt -> string -> date identity. - s = repr(dt) - self.failUnless(s.startswith('datetime.')) - s = s[9:] - dt2 = eval(s) - self.assertEqual(dt, dt2) - - # Verify identity via reconstructing from pieces. - dt2 = self.theclass(dt.year, dt.month, dt.day) - self.assertEqual(dt, dt2) - - def test_ordinal_conversions(self): - # Check some fixed values. - for y, m, d, n in [(1, 1, 1, 1), # calendar origin - (1, 12, 31, 365), - (2, 1, 1, 366), - # first example from "Calendrical Calculations" - (1945, 11, 12, 710347)]: - d = self.theclass(y, m, d) - self.assertEqual(n, d.toordinal()) - fromord = self.theclass.fromordinal(n) - self.assertEqual(d, fromord) - if hasattr(fromord, "hour"): - # if we're checking something fancier than a date, verify - # the extra fields have been zeroed out - self.assertEqual(fromord.hour, 0) - self.assertEqual(fromord.minute, 0) - self.assertEqual(fromord.second, 0) - self.assertEqual(fromord.microsecond, 0) - - # Check first and last days of year spottily across the whole - # range of years supported. - for year in xrange(MINYEAR, MAXYEAR+1, 7): - # Verify (year, 1, 1) -> ordinal -> y, m, d is identity. - d = self.theclass(year, 1, 1) - n = d.toordinal() - d2 = self.theclass.fromordinal(n) - self.assertEqual(d, d2) - # Verify that moving back a day gets to the end of year-1. - if year > 1: - d = self.theclass.fromordinal(n-1) - d2 = self.theclass(year-1, 12, 31) - self.assertEqual(d, d2) - self.assertEqual(d2.toordinal(), n-1) - - # Test every day in a leap-year and a non-leap year. - dim = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - for year, isleap in (2000, True), (2002, False): - n = self.theclass(year, 1, 1).toordinal() - for month, maxday in zip(range(1, 13), dim): - if month == 2 and isleap: - maxday += 1 - for day in range(1, maxday+1): - d = self.theclass(year, month, day) - self.assertEqual(d.toordinal(), n) - self.assertEqual(d, self.theclass.fromordinal(n)) - n += 1 - - def test_extreme_ordinals(self): - a = self.theclass.min - a = self.theclass(a.year, a.month, a.day) # get rid of time parts - aord = a.toordinal() - b = a.fromordinal(aord) - self.assertEqual(a, b) - - self.assertRaises(ValueError, lambda: a.fromordinal(aord - 1)) - - b = a + timedelta(days=1) - self.assertEqual(b.toordinal(), aord + 1) - self.assertEqual(b, self.theclass.fromordinal(aord + 1)) - - a = self.theclass.max - a = self.theclass(a.year, a.month, a.day) # get rid of time parts - aord = a.toordinal() - b = a.fromordinal(aord) - self.assertEqual(a, b) - - self.assertRaises(ValueError, lambda: a.fromordinal(aord + 1)) - - b = a - timedelta(days=1) - self.assertEqual(b.toordinal(), aord - 1) - self.assertEqual(b, self.theclass.fromordinal(aord - 1)) - - def test_bad_constructor_arguments(self): - # bad years - self.theclass(MINYEAR, 1, 1) # no exception - self.theclass(MAXYEAR, 1, 1) # no exception - self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1) - self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1) - # bad months - self.theclass(2000, 1, 1) # no exception - self.theclass(2000, 12, 1) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 0, 1) - self.assertRaises(ValueError, self.theclass, 2000, 13, 1) - # bad days - self.theclass(2000, 2, 29) # no exception - self.theclass(2004, 2, 29) # no exception - self.theclass(2400, 2, 29) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 2, 30) - self.assertRaises(ValueError, self.theclass, 2001, 2, 29) - self.assertRaises(ValueError, self.theclass, 2100, 2, 29) - self.assertRaises(ValueError, self.theclass, 1900, 2, 29) - self.assertRaises(ValueError, self.theclass, 2000, 1, 0) - self.assertRaises(ValueError, self.theclass, 2000, 1, 32) - - def test_hash_equality(self): - d = self.theclass(2000, 12, 31) - # same thing - e = self.theclass(2000, 12, 31) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - d = self.theclass(2001, 1, 1) - # same thing - e = self.theclass(2001, 1, 1) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - def test_computations(self): - a = self.theclass(2002, 1, 31) - b = self.theclass(1956, 1, 31) - - diff = a-b - self.assertEqual(diff.days, 46*365 + len(range(1956, 2002, 4))) - self.assertEqual(diff.seconds, 0) - self.assertEqual(diff.microseconds, 0) - - day = timedelta(1) - week = timedelta(7) - a = self.theclass(2002, 3, 2) - self.assertEqual(a + day, self.theclass(2002, 3, 3)) - self.assertEqual(day + a, self.theclass(2002, 3, 3)) - self.assertEqual(a - day, self.theclass(2002, 3, 1)) - self.assertEqual(-day + a, self.theclass(2002, 3, 1)) - self.assertEqual(a + week, self.theclass(2002, 3, 9)) - self.assertEqual(a - week, self.theclass(2002, 2, 23)) - self.assertEqual(a + 52*week, self.theclass(2003, 3, 1)) - self.assertEqual(a - 52*week, self.theclass(2001, 3, 3)) - self.assertEqual((a + week) - a, week) - self.assertEqual((a + day) - a, day) - self.assertEqual((a - week) - a, -week) - self.assertEqual((a - day) - a, -day) - self.assertEqual(a - (a + week), -week) - self.assertEqual(a - (a + day), -day) - self.assertEqual(a - (a - week), week) - self.assertEqual(a - (a - day), day) - - # Add/sub ints, longs, floats should be illegal - for i in 1, 1L, 1.0: - self.assertRaises(TypeError, lambda: a+i) - self.assertRaises(TypeError, lambda: a-i) - self.assertRaises(TypeError, lambda: i+a) - self.assertRaises(TypeError, lambda: i-a) - - # delta - date is senseless. - self.assertRaises(TypeError, lambda: day - a) - # mixing date and (delta or date) via * or // is senseless - self.assertRaises(TypeError, lambda: day * a) - self.assertRaises(TypeError, lambda: a * day) - self.assertRaises(TypeError, lambda: day // a) - self.assertRaises(TypeError, lambda: a // day) - self.assertRaises(TypeError, lambda: a * a) - self.assertRaises(TypeError, lambda: a // a) - # date + date is senseless - self.assertRaises(TypeError, lambda: a + a) - - def test_overflow(self): - tiny = self.theclass.resolution - - dt = self.theclass.min + tiny - dt -= tiny # no problem - self.assertRaises(OverflowError, dt.__sub__, tiny) - self.assertRaises(OverflowError, dt.__add__, -tiny) - - dt = self.theclass.max - tiny - dt += tiny # no problem - self.assertRaises(OverflowError, dt.__add__, tiny) - self.assertRaises(OverflowError, dt.__sub__, -tiny) - - def test_fromtimestamp(self): - import time - - # Try an arbitrary fixed value. - year, month, day = 1999, 9, 19 - ts = time.mktime((year, month, day, 0, 0, 0, 0, 0, -1)) - d = self.theclass.fromtimestamp(ts) - self.assertEqual(d.year, year) - self.assertEqual(d.month, month) - self.assertEqual(d.day, day) - - def test_insane_fromtimestamp(self): - # It's possible that some platform maps time_t to double, - # and that this test will fail there. This test should - # exempt such platforms (provided they return reasonable - # results!). - for insane in -1e200, 1e200: - self.assertRaises(ValueError, self.theclass.fromtimestamp, - insane) - - def test_today(self): - import time - - # We claim that today() is like fromtimestamp(time.time()), so - # prove it. - for dummy in range(3): - today = self.theclass.today() - ts = time.time() - todayagain = self.theclass.fromtimestamp(ts) - if today == todayagain: - break - # There are several legit reasons that could fail: - # 1. It recently became midnight, between the today() and the - # time() calls. - # 2. The platform time() has such fine resolution that we'll - # never get the same value twice. - # 3. The platform time() has poor resolution, and we just - # happened to call today() right before a resolution quantum - # boundary. - # 4. The system clock got fiddled between calls. - # In any case, wait a little while and try again. - time.sleep(0.1) - - # It worked or it didn't. If it didn't, assume it's reason #2, and - # let the test pass if they're within half a second of each other. - self.failUnless(today == todayagain or - abs(todayagain - today) < timedelta(seconds=0.5)) - - def test_weekday(self): - for i in range(7): - # March 4, 2002 is a Monday - self.assertEqual(self.theclass(2002, 3, 4+i).weekday(), i) - self.assertEqual(self.theclass(2002, 3, 4+i).isoweekday(), i+1) - # January 2, 1956 is a Monday - self.assertEqual(self.theclass(1956, 1, 2+i).weekday(), i) - self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1) - - def test_isocalendar(self): - # Check examples from - # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm - for i in range(7): - d = self.theclass(2003, 12, 22+i) - self.assertEqual(d.isocalendar(), (2003, 52, i+1)) - d = self.theclass(2003, 12, 29) + timedelta(i) - self.assertEqual(d.isocalendar(), (2004, 1, i+1)) - d = self.theclass(2004, 1, 5+i) - self.assertEqual(d.isocalendar(), (2004, 2, i+1)) - d = self.theclass(2009, 12, 21+i) - self.assertEqual(d.isocalendar(), (2009, 52, i+1)) - d = self.theclass(2009, 12, 28) + timedelta(i) - self.assertEqual(d.isocalendar(), (2009, 53, i+1)) - d = self.theclass(2010, 1, 4+i) - self.assertEqual(d.isocalendar(), (2010, 1, i+1)) - - def test_iso_long_years(self): - # Calculate long ISO years and compare to table from - # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm - ISO_LONG_YEARS_TABLE = """ - 4 32 60 88 - 9 37 65 93 - 15 43 71 99 - 20 48 76 - 26 54 82 - - 105 133 161 189 - 111 139 167 195 - 116 144 172 - 122 150 178 - 128 156 184 - - 201 229 257 285 - 207 235 263 291 - 212 240 268 296 - 218 246 274 - 224 252 280 - - 303 331 359 387 - 308 336 364 392 - 314 342 370 398 - 320 348 376 - 325 353 381 - """ - iso_long_years = map(int, ISO_LONG_YEARS_TABLE.split()) - iso_long_years.sort() - L = [] - for i in range(400): - d = self.theclass(2000+i, 12, 31) - d1 = self.theclass(1600+i, 12, 31) - self.assertEqual(d.isocalendar()[1:], d1.isocalendar()[1:]) - if d.isocalendar()[1] == 53: - L.append(i) - self.assertEqual(L, iso_long_years) - - def test_isoformat(self): - t = self.theclass(2, 3, 2) - self.assertEqual(t.isoformat(), "0002-03-02") - - def test_ctime(self): - t = self.theclass(2002, 3, 2) - self.assertEqual(t.ctime(), "Sat Mar 2 00:00:00 2002") - - def test_strftime(self): - t = self.theclass(2005, 3, 2) - self.assertEqual(t.strftime("m:%m d:%d y:%y"), "m:03 d:02 y:05") - self.assertEqual(t.strftime(""), "") # SF bug #761337 - self.assertEqual(t.strftime('x'*1000), 'x'*1000) # SF bug #1556784 - - self.assertRaises(TypeError, t.strftime) # needs an arg - self.assertRaises(TypeError, t.strftime, "one", "two") # too many args - self.assertRaises(TypeError, t.strftime, 42) # arg wrong type - - # A naive object replaces %z and %Z w/ empty strings. - self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''") - - def test_resolution_info(self): - self.assert_(isinstance(self.theclass.min, self.theclass)) - self.assert_(isinstance(self.theclass.max, self.theclass)) - self.assert_(isinstance(self.theclass.resolution, timedelta)) - self.assert_(self.theclass.max > self.theclass.min) - - def test_extreme_timedelta(self): - big = self.theclass.max - self.theclass.min - # 3652058 days, 23 hours, 59 minutes, 59 seconds, 999999 microseconds - n = (big.days*24*3600 + big.seconds)*1000000 + big.microseconds - # n == 315537897599999999 ~= 2**58.13 - justasbig = timedelta(0, 0, n) - self.assertEqual(big, justasbig) - self.assertEqual(self.theclass.min + big, self.theclass.max) - self.assertEqual(self.theclass.max - big, self.theclass.min) - - def test_timetuple(self): - for i in range(7): - # January 2, 1956 is a Monday (0) - d = self.theclass(1956, 1, 2+i) - t = d.timetuple() - self.assertEqual(t, (1956, 1, 2+i, 0, 0, 0, i, 2+i, -1)) - # February 1, 1956 is a Wednesday (2) - d = self.theclass(1956, 2, 1+i) - t = d.timetuple() - self.assertEqual(t, (1956, 2, 1+i, 0, 0, 0, (2+i)%7, 32+i, -1)) - # March 1, 1956 is a Thursday (3), and is the 31+29+1 = 61st day - # of the year. - d = self.theclass(1956, 3, 1+i) - t = d.timetuple() - self.assertEqual(t, (1956, 3, 1+i, 0, 0, 0, (3+i)%7, 61+i, -1)) - self.assertEqual(t.tm_year, 1956) - self.assertEqual(t.tm_mon, 3) - self.assertEqual(t.tm_mday, 1+i) - self.assertEqual(t.tm_hour, 0) - self.assertEqual(t.tm_min, 0) - self.assertEqual(t.tm_sec, 0) - self.assertEqual(t.tm_wday, (3+i)%7) - self.assertEqual(t.tm_yday, 61+i) - self.assertEqual(t.tm_isdst, -1) - - def test_pickling(self): - args = 6, 7, 23 - orig = self.theclass(*args) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - - def test_compare(self): - t1 = self.theclass(2, 3, 4) - t2 = self.theclass(2, 3, 4) - self.failUnless(t1 == t2) - self.failUnless(t1 <= t2) - self.failUnless(t1 >= t2) - self.failUnless(not t1 != t2) - self.failUnless(not t1 < t2) - self.failUnless(not t1 > t2) - self.assertEqual(cmp(t1, t2), 0) - self.assertEqual(cmp(t2, t1), 0) - - for args in (3, 3, 3), (2, 4, 4), (2, 3, 5): - t2 = self.theclass(*args) # this is larger than t1 - self.failUnless(t1 < t2) - self.failUnless(t2 > t1) - self.failUnless(t1 <= t2) - self.failUnless(t2 >= t1) - self.failUnless(t1 != t2) - self.failUnless(t2 != t1) - self.failUnless(not t1 == t2) - self.failUnless(not t2 == t1) - self.failUnless(not t1 > t2) - self.failUnless(not t2 < t1) - self.failUnless(not t1 >= t2) - self.failUnless(not t2 <= t1) - self.assertEqual(cmp(t1, t2), -1) - self.assertEqual(cmp(t2, t1), 1) - - for badarg in OTHERSTUFF: - self.assertEqual(t1 == badarg, False) - self.assertEqual(t1 != badarg, True) - self.assertEqual(badarg == t1, False) - self.assertEqual(badarg != t1, True) - - self.assertRaises(TypeError, lambda: t1 < badarg) - self.assertRaises(TypeError, lambda: t1 > badarg) - self.assertRaises(TypeError, lambda: t1 >= badarg) - self.assertRaises(TypeError, lambda: badarg <= t1) - self.assertRaises(TypeError, lambda: badarg < t1) - self.assertRaises(TypeError, lambda: badarg > t1) - self.assertRaises(TypeError, lambda: badarg >= t1) - - def test_mixed_compare(self): - our = self.theclass(2000, 4, 5) - self.assertRaises(TypeError, cmp, our, 1) - self.assertRaises(TypeError, cmp, 1, our) - - class AnotherDateTimeClass(object): - def __cmp__(self, other): - # Return "equal" so calling this can't be confused with - # compare-by-address (which never says "equal" for distinct - # objects). - return 0 - - # This still errors, because date and datetime comparison raise - # TypeError instead of NotImplemented when they don't know what to - # do, in order to stop comparison from falling back to the default - # compare-by-address. - their = AnotherDateTimeClass() - self.assertRaises(TypeError, cmp, our, their) - # Oops: The next stab raises TypeError in the C implementation, - # but not in the Python implementation of datetime. The difference - # is due to that the Python implementation defines __cmp__ but - # the C implementation defines tp_richcompare. This is more pain - # to fix than it's worth, so commenting out the test. - # self.assertEqual(cmp(their, our), 0) - - # But date and datetime comparison return NotImplemented instead if the - # other object has a timetuple attr. This gives the other object a - # chance to do the comparison. - class Comparable(AnotherDateTimeClass): - def timetuple(self): - return () - - their = Comparable() - self.assertEqual(cmp(our, their), 0) - self.assertEqual(cmp(their, our), 0) - self.failUnless(our == their) - self.failUnless(their == our) - - def test_bool(self): - # All dates are considered true. - self.failUnless(self.theclass.min) - self.failUnless(self.theclass.max) - - def test_srftime_out_of_range(self): - # For nasty technical reasons, we can't handle years before 1900. - cls = self.theclass - self.assertEqual(cls(1900, 1, 1).strftime("%Y"), "1900") - for y in 1, 49, 51, 99, 100, 1000, 1899: - self.assertRaises(ValueError, cls(y, 1, 1).strftime, "%Y") - - def test_replace(self): - cls = self.theclass - args = [1, 2, 3] - base = cls(*args) - self.assertEqual(base, base.replace()) - - i = 0 - for name, newval in (("year", 2), - ("month", 3), - ("day", 4)): - newargs = args[:] - newargs[i] = newval - expected = cls(*newargs) - got = base.replace(**{name: newval}) - self.assertEqual(expected, got) - i += 1 - - # Out of bounds. - base = cls(2000, 2, 29) - self.assertRaises(ValueError, base.replace, year=2001) - - def test_subclass_date(self): - - class C(self.theclass): - theAnswer = 42 - - def __new__(cls, *args, **kws): - temp = kws.copy() - extra = temp.pop('extra') - result = self.theclass.__new__(cls, *args, **temp) - result.extra = extra - return result - - def newmeth(self, start): - return start + self.year + self.month - - args = 2003, 4, 14 - - dt1 = self.theclass(*args) - dt2 = C(*args, **{'extra': 7}) - - self.assertEqual(dt2.__class__, C) - self.assertEqual(dt2.theAnswer, 42) - self.assertEqual(dt2.extra, 7) - self.assertEqual(dt1.toordinal(), dt2.toordinal()) - self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month - 7) - - def test_pickling_subclass_date(self): - - args = 6, 7, 23 - orig = SubclassDate(*args) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - - def test_backdoor_resistance(self): - # For fast unpickling, the constructor accepts a pickle string. - # This is a low-overhead backdoor. A user can (by intent or - # mistake) pass a string directly, which (if it's the right length) - # will get treated like a pickle, and bypass the normal sanity - # checks in the constructor. This can create insane objects. - # The constructor doesn't want to burn the time to validate all - # fields, but does check the month field. This stops, e.g., - # datetime.datetime('1995-03-25') from yielding an insane object. - base = '1995-03-25' - if not issubclass(self.theclass, datetime): - base = base[:4] - for month_byte in '9', chr(0), chr(13), '\xff': - self.assertRaises(TypeError, self.theclass, - base[:2] + month_byte + base[3:]) - for ord_byte in range(1, 13): - # This shouldn't blow up because of the month byte alone. If - # the implementation changes to do more-careful checking, it may - # blow up because other fields are insane. - self.theclass(base[:2] + chr(ord_byte) + base[3:]) - -############################################################################# -# datetime tests - -class SubclassDatetime(datetime): - sub_var = 1 - -class TestDateTime(TestDate): - - theclass = datetime - - def test_basic_attributes(self): - dt = self.theclass(2002, 3, 1, 12, 0) - self.assertEqual(dt.year, 2002) - self.assertEqual(dt.month, 3) - self.assertEqual(dt.day, 1) - self.assertEqual(dt.hour, 12) - self.assertEqual(dt.minute, 0) - self.assertEqual(dt.second, 0) - self.assertEqual(dt.microsecond, 0) - - def test_basic_attributes_nonzero(self): - # Make sure all attributes are non-zero so bugs in - # bit-shifting access show up. - dt = self.theclass(2002, 3, 1, 12, 59, 59, 8000) - self.assertEqual(dt.year, 2002) - self.assertEqual(dt.month, 3) - self.assertEqual(dt.day, 1) - self.assertEqual(dt.hour, 12) - self.assertEqual(dt.minute, 59) - self.assertEqual(dt.second, 59) - self.assertEqual(dt.microsecond, 8000) - - def test_roundtrip(self): - for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7), - self.theclass.now()): - # Verify dt -> string -> datetime identity. - s = repr(dt) - self.failUnless(s.startswith('datetime.')) - s = s[9:] - dt2 = eval(s) - self.assertEqual(dt, dt2) - - # Verify identity via reconstructing from pieces. - dt2 = self.theclass(dt.year, dt.month, dt.day, - dt.hour, dt.minute, dt.second, - dt.microsecond) - self.assertEqual(dt, dt2) - - def test_isoformat(self): - t = self.theclass(2, 3, 2, 4, 5, 1, 123) - self.assertEqual(t.isoformat(), "0002-03-02T04:05:01.000123") - self.assertEqual(t.isoformat('T'), "0002-03-02T04:05:01.000123") - self.assertEqual(t.isoformat(' '), "0002-03-02 04:05:01.000123") - # str is ISO format with the separator forced to a blank. - self.assertEqual(str(t), "0002-03-02 04:05:01.000123") - - t = self.theclass(2, 3, 2) - self.assertEqual(t.isoformat(), "0002-03-02T00:00:00") - self.assertEqual(t.isoformat('T'), "0002-03-02T00:00:00") - self.assertEqual(t.isoformat(' '), "0002-03-02 00:00:00") - # str is ISO format with the separator forced to a blank. - self.assertEqual(str(t), "0002-03-02 00:00:00") - - def test_more_ctime(self): - # Test fields that TestDate doesn't touch. - import time - - t = self.theclass(2002, 3, 2, 18, 3, 5, 123) - self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002") - # Oops! The next line fails on Win2K under MSVC 6, so it's commented - # out. The difference is that t.ctime() produces " 2" for the day, - # but platform ctime() produces "02" for the day. According to - # C99, t.ctime() is correct here. - # self.assertEqual(t.ctime(), time.ctime(time.mktime(t.timetuple()))) - - # So test a case where that difference doesn't matter. - t = self.theclass(2002, 3, 22, 18, 3, 5, 123) - self.assertEqual(t.ctime(), time.ctime(time.mktime(t.timetuple()))) - - def test_tz_independent_comparing(self): - dt1 = self.theclass(2002, 3, 1, 9, 0, 0) - dt2 = self.theclass(2002, 3, 1, 10, 0, 0) - dt3 = self.theclass(2002, 3, 1, 9, 0, 0) - self.assertEqual(dt1, dt3) - self.assert_(dt2 > dt3) - - # Make sure comparison doesn't forget microseconds, and isn't done - # via comparing a float timestamp (an IEEE double doesn't have enough - # precision to span microsecond resolution across years 1 thru 9999, - # so comparing via timestamp necessarily calls some distinct values - # equal). - dt1 = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999998) - us = timedelta(microseconds=1) - dt2 = dt1 + us - self.assertEqual(dt2 - dt1, us) - self.assert_(dt1 < dt2) - - def test_strftime_with_bad_tzname_replace(self): - # verify ok if tzinfo.tzname().replace() returns a non-string - class MyTzInfo(FixedOffset): - def tzname(self, dt): - class MyStr(str): - def replace(self, *args): - return None - return MyStr('name') - t = self.theclass(2005, 3, 2, 0, 0, 0, 0, MyTzInfo(3, 'name')) - self.assertRaises(TypeError, t.strftime, '%Z') - - def test_bad_constructor_arguments(self): - # bad years - self.theclass(MINYEAR, 1, 1) # no exception - self.theclass(MAXYEAR, 1, 1) # no exception - self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1) - self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1) - # bad months - self.theclass(2000, 1, 1) # no exception - self.theclass(2000, 12, 1) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 0, 1) - self.assertRaises(ValueError, self.theclass, 2000, 13, 1) - # bad days - self.theclass(2000, 2, 29) # no exception - self.theclass(2004, 2, 29) # no exception - self.theclass(2400, 2, 29) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 2, 30) - self.assertRaises(ValueError, self.theclass, 2001, 2, 29) - self.assertRaises(ValueError, self.theclass, 2100, 2, 29) - self.assertRaises(ValueError, self.theclass, 1900, 2, 29) - self.assertRaises(ValueError, self.theclass, 2000, 1, 0) - self.assertRaises(ValueError, self.theclass, 2000, 1, 32) - # bad hours - self.theclass(2000, 1, 31, 0) # no exception - self.theclass(2000, 1, 31, 23) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 1, 31, -1) - self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 24) - # bad minutes - self.theclass(2000, 1, 31, 23, 0) # no exception - self.theclass(2000, 1, 31, 23, 59) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, -1) - self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 60) - # bad seconds - self.theclass(2000, 1, 31, 23, 59, 0) # no exception - self.theclass(2000, 1, 31, 23, 59, 59) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 59, -1) - self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 59, 60) - # bad microseconds - self.theclass(2000, 1, 31, 23, 59, 59, 0) # no exception - self.theclass(2000, 1, 31, 23, 59, 59, 999999) # no exception - self.assertRaises(ValueError, self.theclass, - 2000, 1, 31, 23, 59, 59, -1) - self.assertRaises(ValueError, self.theclass, - 2000, 1, 31, 23, 59, 59, - 1000000) - - def test_hash_equality(self): - d = self.theclass(2000, 12, 31, 23, 30, 17) - e = self.theclass(2000, 12, 31, 23, 30, 17) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - d = self.theclass(2001, 1, 1, 0, 5, 17) - e = self.theclass(2001, 1, 1, 0, 5, 17) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - def test_computations(self): - a = self.theclass(2002, 1, 31) - b = self.theclass(1956, 1, 31) - diff = a-b - self.assertEqual(diff.days, 46*365 + len(range(1956, 2002, 4))) - self.assertEqual(diff.seconds, 0) - self.assertEqual(diff.microseconds, 0) - a = self.theclass(2002, 3, 2, 17, 6) - millisec = timedelta(0, 0, 1000) - hour = timedelta(0, 3600) - day = timedelta(1) - week = timedelta(7) - self.assertEqual(a + hour, self.theclass(2002, 3, 2, 18, 6)) - self.assertEqual(hour + a, self.theclass(2002, 3, 2, 18, 6)) - self.assertEqual(a + 10*hour, self.theclass(2002, 3, 3, 3, 6)) - self.assertEqual(a - hour, self.theclass(2002, 3, 2, 16, 6)) - self.assertEqual(-hour + a, self.theclass(2002, 3, 2, 16, 6)) - self.assertEqual(a - hour, a + -hour) - self.assertEqual(a - 20*hour, self.theclass(2002, 3, 1, 21, 6)) - self.assertEqual(a + day, self.theclass(2002, 3, 3, 17, 6)) - self.assertEqual(a - day, self.theclass(2002, 3, 1, 17, 6)) - self.assertEqual(a + week, self.theclass(2002, 3, 9, 17, 6)) - self.assertEqual(a - week, self.theclass(2002, 2, 23, 17, 6)) - self.assertEqual(a + 52*week, self.theclass(2003, 3, 1, 17, 6)) - self.assertEqual(a - 52*week, self.theclass(2001, 3, 3, 17, 6)) - self.assertEqual((a + week) - a, week) - self.assertEqual((a + day) - a, day) - self.assertEqual((a + hour) - a, hour) - self.assertEqual((a + millisec) - a, millisec) - self.assertEqual((a - week) - a, -week) - self.assertEqual((a - day) - a, -day) - self.assertEqual((a - hour) - a, -hour) - self.assertEqual((a - millisec) - a, -millisec) - self.assertEqual(a - (a + week), -week) - self.assertEqual(a - (a + day), -day) - self.assertEqual(a - (a + hour), -hour) - self.assertEqual(a - (a + millisec), -millisec) - self.assertEqual(a - (a - week), week) - self.assertEqual(a - (a - day), day) - self.assertEqual(a - (a - hour), hour) - self.assertEqual(a - (a - millisec), millisec) - self.assertEqual(a + (week + day + hour + millisec), - self.theclass(2002, 3, 10, 18, 6, 0, 1000)) - self.assertEqual(a + (week + day + hour + millisec), - (((a + week) + day) + hour) + millisec) - self.assertEqual(a - (week + day + hour + millisec), - self.theclass(2002, 2, 22, 16, 5, 59, 999000)) - self.assertEqual(a - (week + day + hour + millisec), - (((a - week) - day) - hour) - millisec) - # Add/sub ints, longs, floats should be illegal - for i in 1, 1L, 1.0: - self.assertRaises(TypeError, lambda: a+i) - self.assertRaises(TypeError, lambda: a-i) - self.assertRaises(TypeError, lambda: i+a) - self.assertRaises(TypeError, lambda: i-a) - - # delta - datetime is senseless. - self.assertRaises(TypeError, lambda: day - a) - # mixing datetime and (delta or datetime) via * or // is senseless - self.assertRaises(TypeError, lambda: day * a) - self.assertRaises(TypeError, lambda: a * day) - self.assertRaises(TypeError, lambda: day // a) - self.assertRaises(TypeError, lambda: a // day) - self.assertRaises(TypeError, lambda: a * a) - self.assertRaises(TypeError, lambda: a // a) - # datetime + datetime is senseless - self.assertRaises(TypeError, lambda: a + a) - - def test_pickling(self): - args = 6, 7, 23, 20, 59, 1, 64**2 - orig = self.theclass(*args) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - - def test_more_pickling(self): - a = self.theclass(2003, 2, 7, 16, 48, 37, 444116) - s = pickle.dumps(a) - b = pickle.loads(s) - self.assertEqual(b.year, 2003) - self.assertEqual(b.month, 2) - self.assertEqual(b.day, 7) - - def test_pickling_subclass_datetime(self): - args = 6, 7, 23, 20, 59, 1, 64**2 - orig = SubclassDatetime(*args) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - - def test_more_compare(self): - # The test_compare() inherited from TestDate covers the error cases. - # We just want to test lexicographic ordering on the members datetime - # has that date lacks. - args = [2000, 11, 29, 20, 58, 16, 999998] - t1 = self.theclass(*args) - t2 = self.theclass(*args) - self.failUnless(t1 == t2) - self.failUnless(t1 <= t2) - self.failUnless(t1 >= t2) - self.failUnless(not t1 != t2) - self.failUnless(not t1 < t2) - self.failUnless(not t1 > t2) - self.assertEqual(cmp(t1, t2), 0) - self.assertEqual(cmp(t2, t1), 0) - - for i in range(len(args)): - newargs = args[:] - newargs[i] = args[i] + 1 - t2 = self.theclass(*newargs) # this is larger than t1 - self.failUnless(t1 < t2) - self.failUnless(t2 > t1) - self.failUnless(t1 <= t2) - self.failUnless(t2 >= t1) - self.failUnless(t1 != t2) - self.failUnless(t2 != t1) - self.failUnless(not t1 == t2) - self.failUnless(not t2 == t1) - self.failUnless(not t1 > t2) - self.failUnless(not t2 < t1) - self.failUnless(not t1 >= t2) - self.failUnless(not t2 <= t1) - self.assertEqual(cmp(t1, t2), -1) - self.assertEqual(cmp(t2, t1), 1) - - - # A helper for timestamp constructor tests. - def verify_field_equality(self, expected, got): - self.assertEqual(expected.tm_year, got.year) - self.assertEqual(expected.tm_mon, got.month) - self.assertEqual(expected.tm_mday, got.day) - self.assertEqual(expected.tm_hour, got.hour) - self.assertEqual(expected.tm_min, got.minute) - self.assertEqual(expected.tm_sec, got.second) - - def test_fromtimestamp(self): - import time - - ts = time.time() - expected = time.localtime(ts) - got = self.theclass.fromtimestamp(ts) - self.verify_field_equality(expected, got) - - def test_utcfromtimestamp(self): - import time - - ts = time.time() - expected = time.gmtime(ts) - got = self.theclass.utcfromtimestamp(ts) - self.verify_field_equality(expected, got) - - def test_microsecond_rounding(self): - # Test whether fromtimestamp "rounds up" floats that are less - # than one microsecond smaller than an integer. - self.assertEquals(self.theclass.fromtimestamp(0.9999999), - self.theclass.fromtimestamp(1)) - - def test_insane_fromtimestamp(self): - # It's possible that some platform maps time_t to double, - # and that this test will fail there. This test should - # exempt such platforms (provided they return reasonable - # results!). - for insane in -1e200, 1e200: - self.assertRaises(ValueError, self.theclass.fromtimestamp, - insane) - - def test_insane_utcfromtimestamp(self): - # It's possible that some platform maps time_t to double, - # and that this test will fail there. This test should - # exempt such platforms (provided they return reasonable - # results!). - for insane in -1e200, 1e200: - self.assertRaises(ValueError, self.theclass.utcfromtimestamp, - insane) - - def test_negative_float_fromtimestamp(self): - # Windows doesn't accept negative timestamps - if os.name == "nt": - return - # The result is tz-dependent; at least test that this doesn't - # fail (like it did before bug 1646728 was fixed). - self.theclass.fromtimestamp(-1.05) - - def test_negative_float_utcfromtimestamp(self): - # Windows doesn't accept negative timestamps - if os.name == "nt": - return - d = self.theclass.utcfromtimestamp(-1.05) - self.assertEquals(d, self.theclass(1969, 12, 31, 23, 59, 58, 950000)) - - def test_utcnow(self): - import time - - # Call it a success if utcnow() and utcfromtimestamp() are within - # a second of each other. - tolerance = timedelta(seconds=1) - for dummy in range(3): - from_now = self.theclass.utcnow() - from_timestamp = self.theclass.utcfromtimestamp(time.time()) - if abs(from_timestamp - from_now) <= tolerance: - break - # Else try again a few times. - self.failUnless(abs(from_timestamp - from_now) <= tolerance) - - def test_strptime(self): - import time - - string = '2004-12-01 13:02:47' - format = '%Y-%m-%d %H:%M:%S' - expected = self.theclass(*(time.strptime(string, format)[0:6])) - got = self.theclass.strptime(string, format) - self.assertEqual(expected, got) - - def test_more_timetuple(self): - # This tests fields beyond those tested by the TestDate.test_timetuple. - t = self.theclass(2004, 12, 31, 6, 22, 33) - self.assertEqual(t.timetuple(), (2004, 12, 31, 6, 22, 33, 4, 366, -1)) - self.assertEqual(t.timetuple(), - (t.year, t.month, t.day, - t.hour, t.minute, t.second, - t.weekday(), - t.toordinal() - date(t.year, 1, 1).toordinal() + 1, - -1)) - tt = t.timetuple() - self.assertEqual(tt.tm_year, t.year) - self.assertEqual(tt.tm_mon, t.month) - self.assertEqual(tt.tm_mday, t.day) - self.assertEqual(tt.tm_hour, t.hour) - self.assertEqual(tt.tm_min, t.minute) - self.assertEqual(tt.tm_sec, t.second) - self.assertEqual(tt.tm_wday, t.weekday()) - self.assertEqual(tt.tm_yday, t.toordinal() - - date(t.year, 1, 1).toordinal() + 1) - self.assertEqual(tt.tm_isdst, -1) - - def test_more_strftime(self): - # This tests fields beyond those tested by the TestDate.test_strftime. - t = self.theclass(2004, 12, 31, 6, 22, 33) - self.assertEqual(t.strftime("%m %d %y %S %M %H %j"), - "12 31 04 33 22 06 366") - - def test_extract(self): - dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234) - self.assertEqual(dt.date(), date(2002, 3, 4)) - self.assertEqual(dt.time(), time(18, 45, 3, 1234)) - - def test_combine(self): - d = date(2002, 3, 4) - t = time(18, 45, 3, 1234) - expected = self.theclass(2002, 3, 4, 18, 45, 3, 1234) - combine = self.theclass.combine - dt = combine(d, t) - self.assertEqual(dt, expected) - - dt = combine(time=t, date=d) - self.assertEqual(dt, expected) - - self.assertEqual(d, dt.date()) - self.assertEqual(t, dt.time()) - self.assertEqual(dt, combine(dt.date(), dt.time())) - - self.assertRaises(TypeError, combine) # need an arg - self.assertRaises(TypeError, combine, d) # need two args - self.assertRaises(TypeError, combine, t, d) # args reversed - self.assertRaises(TypeError, combine, d, t, 1) # too many args - self.assertRaises(TypeError, combine, "date", "time") # wrong types - - def test_replace(self): - cls = self.theclass - args = [1, 2, 3, 4, 5, 6, 7] - base = cls(*args) - self.assertEqual(base, base.replace()) - - i = 0 - for name, newval in (("year", 2), - ("month", 3), - ("day", 4), - ("hour", 5), - ("minute", 6), - ("second", 7), - ("microsecond", 8)): - newargs = args[:] - newargs[i] = newval - expected = cls(*newargs) - got = base.replace(**{name: newval}) - self.assertEqual(expected, got) - i += 1 - - # Out of bounds. - base = cls(2000, 2, 29) - self.assertRaises(ValueError, base.replace, year=2001) - - def test_astimezone(self): - # Pretty boring! The TZ test is more interesting here. astimezone() - # simply can't be applied to a naive object. - dt = self.theclass.now() - f = FixedOffset(44, "") - self.assertRaises(TypeError, dt.astimezone) # not enough args - self.assertRaises(TypeError, dt.astimezone, f, f) # too many args - self.assertRaises(TypeError, dt.astimezone, dt) # arg wrong type - self.assertRaises(ValueError, dt.astimezone, f) # naive - self.assertRaises(ValueError, dt.astimezone, tz=f) # naive - - class Bogus(tzinfo): - def utcoffset(self, dt): return None - def dst(self, dt): return timedelta(0) - bog = Bogus() - self.assertRaises(ValueError, dt.astimezone, bog) # naive - - class AlsoBogus(tzinfo): - def utcoffset(self, dt): return timedelta(0) - def dst(self, dt): return None - alsobog = AlsoBogus() - self.assertRaises(ValueError, dt.astimezone, alsobog) # also naive - - def test_subclass_datetime(self): - - class C(self.theclass): - theAnswer = 42 - - def __new__(cls, *args, **kws): - temp = kws.copy() - extra = temp.pop('extra') - result = self.theclass.__new__(cls, *args, **temp) - result.extra = extra - return result - - def newmeth(self, start): - return start + self.year + self.month + self.second - - args = 2003, 4, 14, 12, 13, 41 - - dt1 = self.theclass(*args) - dt2 = C(*args, **{'extra': 7}) - - self.assertEqual(dt2.__class__, C) - self.assertEqual(dt2.theAnswer, 42) - self.assertEqual(dt2.extra, 7) - self.assertEqual(dt1.toordinal(), dt2.toordinal()) - self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month + - dt1.second - 7) - -class SubclassTime(time): - sub_var = 1 - -class TestTime(HarmlessMixedComparison): - - theclass = time - - def test_basic_attributes(self): - t = self.theclass(12, 0) - self.assertEqual(t.hour, 12) - self.assertEqual(t.minute, 0) - self.assertEqual(t.second, 0) - self.assertEqual(t.microsecond, 0) - - def test_basic_attributes_nonzero(self): - # Make sure all attributes are non-zero so bugs in - # bit-shifting access show up. - t = self.theclass(12, 59, 59, 8000) - self.assertEqual(t.hour, 12) - self.assertEqual(t.minute, 59) - self.assertEqual(t.second, 59) - self.assertEqual(t.microsecond, 8000) - - def test_roundtrip(self): - t = self.theclass(1, 2, 3, 4) - - # Verify t -> string -> time identity. - s = repr(t) - self.failUnless(s.startswith('datetime.')) - s = s[9:] - t2 = eval(s) - self.assertEqual(t, t2) - - # Verify identity via reconstructing from pieces. - t2 = self.theclass(t.hour, t.minute, t.second, - t.microsecond) - self.assertEqual(t, t2) - - def test_comparing(self): - args = [1, 2, 3, 4] - t1 = self.theclass(*args) - t2 = self.theclass(*args) - self.failUnless(t1 == t2) - self.failUnless(t1 <= t2) - self.failUnless(t1 >= t2) - self.failUnless(not t1 != t2) - self.failUnless(not t1 < t2) - self.failUnless(not t1 > t2) - self.assertEqual(cmp(t1, t2), 0) - self.assertEqual(cmp(t2, t1), 0) - - for i in range(len(args)): - newargs = args[:] - newargs[i] = args[i] + 1 - t2 = self.theclass(*newargs) # this is larger than t1 - self.failUnless(t1 < t2) - self.failUnless(t2 > t1) - self.failUnless(t1 <= t2) - self.failUnless(t2 >= t1) - self.failUnless(t1 != t2) - self.failUnless(t2 != t1) - self.failUnless(not t1 == t2) - self.failUnless(not t2 == t1) - self.failUnless(not t1 > t2) - self.failUnless(not t2 < t1) - self.failUnless(not t1 >= t2) - self.failUnless(not t2 <= t1) - self.assertEqual(cmp(t1, t2), -1) - self.assertEqual(cmp(t2, t1), 1) - - for badarg in OTHERSTUFF: - self.assertEqual(t1 == badarg, False) - self.assertEqual(t1 != badarg, True) - self.assertEqual(badarg == t1, False) - self.assertEqual(badarg != t1, True) - - self.assertRaises(TypeError, lambda: t1 <= badarg) - self.assertRaises(TypeError, lambda: t1 < badarg) - self.assertRaises(TypeError, lambda: t1 > badarg) - self.assertRaises(TypeError, lambda: t1 >= badarg) - self.assertRaises(TypeError, lambda: badarg <= t1) - self.assertRaises(TypeError, lambda: badarg < t1) - self.assertRaises(TypeError, lambda: badarg > t1) - self.assertRaises(TypeError, lambda: badarg >= t1) - - def test_bad_constructor_arguments(self): - # bad hours - self.theclass(0, 0) # no exception - self.theclass(23, 0) # no exception - self.assertRaises(ValueError, self.theclass, -1, 0) - self.assertRaises(ValueError, self.theclass, 24, 0) - # bad minutes - self.theclass(23, 0) # no exception - self.theclass(23, 59) # no exception - self.assertRaises(ValueError, self.theclass, 23, -1) - self.assertRaises(ValueError, self.theclass, 23, 60) - # bad seconds - self.theclass(23, 59, 0) # no exception - self.theclass(23, 59, 59) # no exception - self.assertRaises(ValueError, self.theclass, 23, 59, -1) - self.assertRaises(ValueError, self.theclass, 23, 59, 60) - # bad microseconds - self.theclass(23, 59, 59, 0) # no exception - self.theclass(23, 59, 59, 999999) # no exception - self.assertRaises(ValueError, self.theclass, 23, 59, 59, -1) - self.assertRaises(ValueError, self.theclass, 23, 59, 59, 1000000) - - def test_hash_equality(self): - d = self.theclass(23, 30, 17) - e = self.theclass(23, 30, 17) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - d = self.theclass(0, 5, 17) - e = self.theclass(0, 5, 17) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - def test_isoformat(self): - t = self.theclass(4, 5, 1, 123) - self.assertEqual(t.isoformat(), "04:05:01.000123") - self.assertEqual(t.isoformat(), str(t)) - - t = self.theclass() - self.assertEqual(t.isoformat(), "00:00:00") - self.assertEqual(t.isoformat(), str(t)) - - t = self.theclass(microsecond=1) - self.assertEqual(t.isoformat(), "00:00:00.000001") - self.assertEqual(t.isoformat(), str(t)) - - t = self.theclass(microsecond=10) - self.assertEqual(t.isoformat(), "00:00:00.000010") - self.assertEqual(t.isoformat(), str(t)) - - t = self.theclass(microsecond=100) - self.assertEqual(t.isoformat(), "00:00:00.000100") - self.assertEqual(t.isoformat(), str(t)) - - t = self.theclass(microsecond=1000) - self.assertEqual(t.isoformat(), "00:00:00.001000") - self.assertEqual(t.isoformat(), str(t)) - - t = self.theclass(microsecond=10000) - self.assertEqual(t.isoformat(), "00:00:00.010000") - self.assertEqual(t.isoformat(), str(t)) - - t = self.theclass(microsecond=100000) - self.assertEqual(t.isoformat(), "00:00:00.100000") - self.assertEqual(t.isoformat(), str(t)) - - def test_strftime(self): - t = self.theclass(1, 2, 3, 4) - self.assertEqual(t.strftime('%H %M %S'), "01 02 03") - # A naive object replaces %z and %Z with empty strings. - self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''") - - def test_str(self): - self.assertEqual(str(self.theclass(1, 2, 3, 4)), "01:02:03.000004") - self.assertEqual(str(self.theclass(10, 2, 3, 4000)), "10:02:03.004000") - self.assertEqual(str(self.theclass(0, 2, 3, 400000)), "00:02:03.400000") - self.assertEqual(str(self.theclass(12, 2, 3, 0)), "12:02:03") - self.assertEqual(str(self.theclass(23, 15, 0, 0)), "23:15:00") - - def test_repr(self): - name = 'datetime.' + self.theclass.__name__ - self.assertEqual(repr(self.theclass(1, 2, 3, 4)), - "%s(1, 2, 3, 4)" % name) - self.assertEqual(repr(self.theclass(10, 2, 3, 4000)), - "%s(10, 2, 3, 4000)" % name) - self.assertEqual(repr(self.theclass(0, 2, 3, 400000)), - "%s(0, 2, 3, 400000)" % name) - self.assertEqual(repr(self.theclass(12, 2, 3, 0)), - "%s(12, 2, 3)" % name) - self.assertEqual(repr(self.theclass(23, 15, 0, 0)), - "%s(23, 15)" % name) - - def test_resolution_info(self): - self.assert_(isinstance(self.theclass.min, self.theclass)) - self.assert_(isinstance(self.theclass.max, self.theclass)) - self.assert_(isinstance(self.theclass.resolution, timedelta)) - self.assert_(self.theclass.max > self.theclass.min) - - def test_pickling(self): - args = 20, 59, 16, 64**2 - orig = self.theclass(*args) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - - def test_pickling_subclass_time(self): - args = 20, 59, 16, 64**2 - orig = SubclassTime(*args) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - - def test_bool(self): - cls = self.theclass - self.failUnless(cls(1)) - self.failUnless(cls(0, 1)) - self.failUnless(cls(0, 0, 1)) - self.failUnless(cls(0, 0, 0, 1)) - self.failUnless(not cls(0)) - self.failUnless(not cls()) - - def test_replace(self): - cls = self.theclass - args = [1, 2, 3, 4] - base = cls(*args) - self.assertEqual(base, base.replace()) - - i = 0 - for name, newval in (("hour", 5), - ("minute", 6), - ("second", 7), - ("microsecond", 8)): - newargs = args[:] - newargs[i] = newval - expected = cls(*newargs) - got = base.replace(**{name: newval}) - self.assertEqual(expected, got) - i += 1 - - # Out of bounds. - base = cls(1) - self.assertRaises(ValueError, base.replace, hour=24) - self.assertRaises(ValueError, base.replace, minute=-1) - self.assertRaises(ValueError, base.replace, second=100) - self.assertRaises(ValueError, base.replace, microsecond=1000000) - - def test_subclass_time(self): - - class C(self.theclass): - theAnswer = 42 - - def __new__(cls, *args, **kws): - temp = kws.copy() - extra = temp.pop('extra') - result = self.theclass.__new__(cls, *args, **temp) - result.extra = extra - return result - - def newmeth(self, start): - return start + self.hour + self.second - - args = 4, 5, 6 - - dt1 = self.theclass(*args) - dt2 = C(*args, **{'extra': 7}) - - self.assertEqual(dt2.__class__, C) - self.assertEqual(dt2.theAnswer, 42) - self.assertEqual(dt2.extra, 7) - self.assertEqual(dt1.isoformat(), dt2.isoformat()) - self.assertEqual(dt2.newmeth(-7), dt1.hour + dt1.second - 7) - - def test_backdoor_resistance(self): - # see TestDate.test_backdoor_resistance(). - base = '2:59.0' - for hour_byte in ' ', '9', chr(24), '\xff': - self.assertRaises(TypeError, self.theclass, - hour_byte + base[1:]) - -# A mixin for classes with a tzinfo= argument. Subclasses must define -# theclass as a class atribute, and theclass(1, 1, 1, tzinfo=whatever) -# must be legit (which is true for time and datetime). -class TZInfoBase(unittest.TestCase): - - def test_argument_passing(self): - cls = self.theclass - # A datetime passes itself on, a time passes None. - class introspective(tzinfo): - def tzname(self, dt): return dt and "real" or "none" - def utcoffset(self, dt): - return timedelta(minutes = dt and 42 or -42) - dst = utcoffset - - obj = cls(1, 2, 3, tzinfo=introspective()) - - expected = cls is time and "none" or "real" - self.assertEqual(obj.tzname(), expected) - - expected = timedelta(minutes=(cls is time and -42 or 42)) - self.assertEqual(obj.utcoffset(), expected) - self.assertEqual(obj.dst(), expected) - - def test_bad_tzinfo_classes(self): - cls = self.theclass - self.assertRaises(TypeError, cls, 1, 1, 1, tzinfo=12) - - class NiceTry(object): - def __init__(self): pass - def utcoffset(self, dt): pass - self.assertRaises(TypeError, cls, 1, 1, 1, tzinfo=NiceTry) - - class BetterTry(tzinfo): - def __init__(self): pass - def utcoffset(self, dt): pass - b = BetterTry() - t = cls(1, 1, 1, tzinfo=b) - self.failUnless(t.tzinfo is b) - - def test_utc_offset_out_of_bounds(self): - class Edgy(tzinfo): - def __init__(self, offset): - self.offset = timedelta(minutes=offset) - def utcoffset(self, dt): - return self.offset - - cls = self.theclass - for offset, legit in ((-1440, False), - (-1439, True), - (1439, True), - (1440, False)): - if cls is time: - t = cls(1, 2, 3, tzinfo=Edgy(offset)) - elif cls is datetime: - t = cls(6, 6, 6, 1, 2, 3, tzinfo=Edgy(offset)) - else: - assert 0, "impossible" - if legit: - aofs = abs(offset) - h, m = divmod(aofs, 60) - tag = "%c%02d:%02d" % (offset < 0 and '-' or '+', h, m) - if isinstance(t, datetime): - t = t.timetz() - self.assertEqual(str(t), "01:02:03" + tag) - else: - self.assertRaises(ValueError, str, t) - - def test_tzinfo_classes(self): - cls = self.theclass - class C1(tzinfo): - def utcoffset(self, dt): return None - def dst(self, dt): return None - def tzname(self, dt): return None - for t in (cls(1, 1, 1), - cls(1, 1, 1, tzinfo=None), - cls(1, 1, 1, tzinfo=C1())): - self.failUnless(t.utcoffset() is None) - self.failUnless(t.dst() is None) - self.failUnless(t.tzname() is None) - - class C3(tzinfo): - def utcoffset(self, dt): return timedelta(minutes=-1439) - def dst(self, dt): return timedelta(minutes=1439) - def tzname(self, dt): return "aname" - t = cls(1, 1, 1, tzinfo=C3()) - self.assertEqual(t.utcoffset(), timedelta(minutes=-1439)) - self.assertEqual(t.dst(), timedelta(minutes=1439)) - self.assertEqual(t.tzname(), "aname") - - # Wrong types. - class C4(tzinfo): - def utcoffset(self, dt): return "aname" - def dst(self, dt): return 7 - def tzname(self, dt): return 0 - t = cls(1, 1, 1, tzinfo=C4()) - self.assertRaises(TypeError, t.utcoffset) - self.assertRaises(TypeError, t.dst) - self.assertRaises(TypeError, t.tzname) - - # Offset out of range. - class C6(tzinfo): - def utcoffset(self, dt): return timedelta(hours=-24) - def dst(self, dt): return timedelta(hours=24) - t = cls(1, 1, 1, tzinfo=C6()) - self.assertRaises(ValueError, t.utcoffset) - self.assertRaises(ValueError, t.dst) - - # Not a whole number of minutes. - class C7(tzinfo): - def utcoffset(self, dt): return timedelta(seconds=61) - def dst(self, dt): return timedelta(microseconds=-81) - t = cls(1, 1, 1, tzinfo=C7()) - self.assertRaises(ValueError, t.utcoffset) - self.assertRaises(ValueError, t.dst) - - def test_aware_compare(self): - cls = self.theclass - - # Ensure that utcoffset() gets ignored if the comparands have - # the same tzinfo member. - class OperandDependentOffset(tzinfo): - def utcoffset(self, t): - if t.minute < 10: - # d0 and d1 equal after adjustment - return timedelta(minutes=t.minute) - else: - # d2 off in the weeds - return timedelta(minutes=59) - - base = cls(8, 9, 10, tzinfo=OperandDependentOffset()) - d0 = base.replace(minute=3) - d1 = base.replace(minute=9) - d2 = base.replace(minute=11) - for x in d0, d1, d2: - for y in d0, d1, d2: - got = cmp(x, y) - expected = cmp(x.minute, y.minute) - self.assertEqual(got, expected) - - # However, if they're different members, uctoffset is not ignored. - # Note that a time can't actually have an operand-depedent offset, - # though (and time.utcoffset() passes None to tzinfo.utcoffset()), - # so skip this test for time. - if cls is not time: - d0 = base.replace(minute=3, tzinfo=OperandDependentOffset()) - d1 = base.replace(minute=9, tzinfo=OperandDependentOffset()) - d2 = base.replace(minute=11, tzinfo=OperandDependentOffset()) - for x in d0, d1, d2: - for y in d0, d1, d2: - got = cmp(x, y) - if (x is d0 or x is d1) and (y is d0 or y is d1): - expected = 0 - elif x is y is d2: - expected = 0 - elif x is d2: - expected = -1 - else: - assert y is d2 - expected = 1 - self.assertEqual(got, expected) - - -# Testing time objects with a non-None tzinfo. -class TestTimeTZ(TestTime, TZInfoBase): - theclass = time - - def test_empty(self): - t = self.theclass() - self.assertEqual(t.hour, 0) - self.assertEqual(t.minute, 0) - self.assertEqual(t.second, 0) - self.assertEqual(t.microsecond, 0) - self.failUnless(t.tzinfo is None) - - def test_zones(self): - est = FixedOffset(-300, "EST", 1) - utc = FixedOffset(0, "UTC", -2) - met = FixedOffset(60, "MET", 3) - t1 = time( 7, 47, tzinfo=est) - t2 = time(12, 47, tzinfo=utc) - t3 = time(13, 47, tzinfo=met) - t4 = time(microsecond=40) - t5 = time(microsecond=40, tzinfo=utc) - - self.assertEqual(t1.tzinfo, est) - self.assertEqual(t2.tzinfo, utc) - self.assertEqual(t3.tzinfo, met) - self.failUnless(t4.tzinfo is None) - self.assertEqual(t5.tzinfo, utc) - - self.assertEqual(t1.utcoffset(), timedelta(minutes=-300)) - self.assertEqual(t2.utcoffset(), timedelta(minutes=0)) - self.assertEqual(t3.utcoffset(), timedelta(minutes=60)) - self.failUnless(t4.utcoffset() is None) - self.assertRaises(TypeError, t1.utcoffset, "no args") - - self.assertEqual(t1.tzname(), "EST") - self.assertEqual(t2.tzname(), "UTC") - self.assertEqual(t3.tzname(), "MET") - self.failUnless(t4.tzname() is None) - self.assertRaises(TypeError, t1.tzname, "no args") - - self.assertEqual(t1.dst(), timedelta(minutes=1)) - self.assertEqual(t2.dst(), timedelta(minutes=-2)) - self.assertEqual(t3.dst(), timedelta(minutes=3)) - self.failUnless(t4.dst() is None) - self.assertRaises(TypeError, t1.dst, "no args") - - self.assertEqual(hash(t1), hash(t2)) - self.assertEqual(hash(t1), hash(t3)) - self.assertEqual(hash(t2), hash(t3)) - - self.assertEqual(t1, t2) - self.assertEqual(t1, t3) - self.assertEqual(t2, t3) - self.assertRaises(TypeError, lambda: t4 == t5) # mixed tz-aware & naive - self.assertRaises(TypeError, lambda: t4 < t5) # mixed tz-aware & naive - self.assertRaises(TypeError, lambda: t5 < t4) # mixed tz-aware & naive - - self.assertEqual(str(t1), "07:47:00-05:00") - self.assertEqual(str(t2), "12:47:00+00:00") - self.assertEqual(str(t3), "13:47:00+01:00") - self.assertEqual(str(t4), "00:00:00.000040") - self.assertEqual(str(t5), "00:00:00.000040+00:00") - - self.assertEqual(t1.isoformat(), "07:47:00-05:00") - self.assertEqual(t2.isoformat(), "12:47:00+00:00") - self.assertEqual(t3.isoformat(), "13:47:00+01:00") - self.assertEqual(t4.isoformat(), "00:00:00.000040") - self.assertEqual(t5.isoformat(), "00:00:00.000040+00:00") - - d = 'datetime.time' - self.assertEqual(repr(t1), d + "(7, 47, tzinfo=est)") - self.assertEqual(repr(t2), d + "(12, 47, tzinfo=utc)") - self.assertEqual(repr(t3), d + "(13, 47, tzinfo=met)") - self.assertEqual(repr(t4), d + "(0, 0, 0, 40)") - self.assertEqual(repr(t5), d + "(0, 0, 0, 40, tzinfo=utc)") - - self.assertEqual(t1.strftime("%H:%M:%S %%Z=%Z %%z=%z"), - "07:47:00 %Z=EST %z=-0500") - self.assertEqual(t2.strftime("%H:%M:%S %Z %z"), "12:47:00 UTC +0000") - self.assertEqual(t3.strftime("%H:%M:%S %Z %z"), "13:47:00 MET +0100") - - yuck = FixedOffset(-1439, "%z %Z %%z%%Z") - t1 = time(23, 59, tzinfo=yuck) - self.assertEqual(t1.strftime("%H:%M %%Z='%Z' %%z='%z'"), - "23:59 %Z='%z %Z %%z%%Z' %z='-2359'") - - # Check that an invalid tzname result raises an exception. - class Badtzname(tzinfo): - def tzname(self, dt): return 42 - t = time(2, 3, 4, tzinfo=Badtzname()) - self.assertEqual(t.strftime("%H:%M:%S"), "02:03:04") - self.assertRaises(TypeError, t.strftime, "%Z") - - def test_hash_edge_cases(self): - # Offsets that overflow a basic time. - t1 = self.theclass(0, 1, 2, 3, tzinfo=FixedOffset(1439, "")) - t2 = self.theclass(0, 0, 2, 3, tzinfo=FixedOffset(1438, "")) - self.assertEqual(hash(t1), hash(t2)) - - t1 = self.theclass(23, 58, 6, 100, tzinfo=FixedOffset(-1000, "")) - t2 = self.theclass(23, 48, 6, 100, tzinfo=FixedOffset(-1010, "")) - self.assertEqual(hash(t1), hash(t2)) - - def test_pickling(self): - # Try one without a tzinfo. - args = 20, 59, 16, 64**2 - orig = self.theclass(*args) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - - # Try one with a tzinfo. - tinfo = PicklableFixedOffset(-300, 'cookie') - orig = self.theclass(5, 6, 7, tzinfo=tinfo) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - self.failUnless(isinstance(derived.tzinfo, PicklableFixedOffset)) - self.assertEqual(derived.utcoffset(), timedelta(minutes=-300)) - self.assertEqual(derived.tzname(), 'cookie') - - def test_more_bool(self): - # Test cases with non-None tzinfo. - cls = self.theclass - - t = cls(0, tzinfo=FixedOffset(-300, "")) - self.failUnless(t) - - t = cls(5, tzinfo=FixedOffset(-300, "")) - self.failUnless(t) - - t = cls(5, tzinfo=FixedOffset(300, "")) - self.failUnless(not t) - - t = cls(23, 59, tzinfo=FixedOffset(23*60 + 59, "")) - self.failUnless(not t) - - # Mostly ensuring this doesn't overflow internally. - t = cls(0, tzinfo=FixedOffset(23*60 + 59, "")) - self.failUnless(t) - - # But this should yield a value error -- the utcoffset is bogus. - t = cls(0, tzinfo=FixedOffset(24*60, "")) - self.assertRaises(ValueError, lambda: bool(t)) - - # Likewise. - t = cls(0, tzinfo=FixedOffset(-24*60, "")) - self.assertRaises(ValueError, lambda: bool(t)) - - def test_replace(self): - cls = self.theclass - z100 = FixedOffset(100, "+100") - zm200 = FixedOffset(timedelta(minutes=-200), "-200") - args = [1, 2, 3, 4, z100] - base = cls(*args) - self.assertEqual(base, base.replace()) - - i = 0 - for name, newval in (("hour", 5), - ("minute", 6), - ("second", 7), - ("microsecond", 8), - ("tzinfo", zm200)): - newargs = args[:] - newargs[i] = newval - expected = cls(*newargs) - got = base.replace(**{name: newval}) - self.assertEqual(expected, got) - i += 1 - - # Ensure we can get rid of a tzinfo. - self.assertEqual(base.tzname(), "+100") - base2 = base.replace(tzinfo=None) - self.failUnless(base2.tzinfo is None) - self.failUnless(base2.tzname() is None) - - # Ensure we can add one. - base3 = base2.replace(tzinfo=z100) - self.assertEqual(base, base3) - self.failUnless(base.tzinfo is base3.tzinfo) - - # Out of bounds. - base = cls(1) - self.assertRaises(ValueError, base.replace, hour=24) - self.assertRaises(ValueError, base.replace, minute=-1) - self.assertRaises(ValueError, base.replace, second=100) - self.assertRaises(ValueError, base.replace, microsecond=1000000) - - def test_mixed_compare(self): - t1 = time(1, 2, 3) - t2 = time(1, 2, 3) - self.assertEqual(t1, t2) - t2 = t2.replace(tzinfo=None) - self.assertEqual(t1, t2) - t2 = t2.replace(tzinfo=FixedOffset(None, "")) - self.assertEqual(t1, t2) - t2 = t2.replace(tzinfo=FixedOffset(0, "")) - self.assertRaises(TypeError, lambda: t1 == t2) - - # In time w/ identical tzinfo objects, utcoffset is ignored. - class Varies(tzinfo): - def __init__(self): - self.offset = timedelta(minutes=22) - def utcoffset(self, t): - self.offset += timedelta(minutes=1) - return self.offset - - v = Varies() - t1 = t2.replace(tzinfo=v) - t2 = t2.replace(tzinfo=v) - self.assertEqual(t1.utcoffset(), timedelta(minutes=23)) - self.assertEqual(t2.utcoffset(), timedelta(minutes=24)) - self.assertEqual(t1, t2) - - # But if they're not identical, it isn't ignored. - t2 = t2.replace(tzinfo=Varies()) - self.failUnless(t1 < t2) # t1's offset counter still going up - - def test_subclass_timetz(self): - - class C(self.theclass): - theAnswer = 42 - - def __new__(cls, *args, **kws): - temp = kws.copy() - extra = temp.pop('extra') - result = self.theclass.__new__(cls, *args, **temp) - result.extra = extra - return result - - def newmeth(self, start): - return start + self.hour + self.second - - args = 4, 5, 6, 500, FixedOffset(-300, "EST", 1) - - dt1 = self.theclass(*args) - dt2 = C(*args, **{'extra': 7}) - - self.assertEqual(dt2.__class__, C) - self.assertEqual(dt2.theAnswer, 42) - self.assertEqual(dt2.extra, 7) - self.assertEqual(dt1.utcoffset(), dt2.utcoffset()) - self.assertEqual(dt2.newmeth(-7), dt1.hour + dt1.second - 7) - - -# Testing datetime objects with a non-None tzinfo. - -class TestDateTimeTZ(TestDateTime, TZInfoBase): - theclass = datetime - - def test_trivial(self): - dt = self.theclass(1, 2, 3, 4, 5, 6, 7) - self.assertEqual(dt.year, 1) - self.assertEqual(dt.month, 2) - self.assertEqual(dt.day, 3) - self.assertEqual(dt.hour, 4) - self.assertEqual(dt.minute, 5) - self.assertEqual(dt.second, 6) - self.assertEqual(dt.microsecond, 7) - self.assertEqual(dt.tzinfo, None) - - def test_even_more_compare(self): - # The test_compare() and test_more_compare() inherited from TestDate - # and TestDateTime covered non-tzinfo cases. - - # Smallest possible after UTC adjustment. - t1 = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, "")) - # Largest possible after UTC adjustment. - t2 = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999, - tzinfo=FixedOffset(-1439, "")) - - # Make sure those compare correctly, and w/o overflow. - self.failUnless(t1 < t2) - self.failUnless(t1 != t2) - self.failUnless(t2 > t1) - - self.failUnless(t1 == t1) - self.failUnless(t2 == t2) - - # Equal afer adjustment. - t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, "")) - t2 = self.theclass(2, 1, 1, 3, 13, tzinfo=FixedOffset(3*60+13+2, "")) - self.assertEqual(t1, t2) - - # Change t1 not to subtract a minute, and t1 should be larger. - t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(0, "")) - self.failUnless(t1 > t2) - - # Change t1 to subtract 2 minutes, and t1 should be smaller. - t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(2, "")) - self.failUnless(t1 < t2) - - # Back to the original t1, but make seconds resolve it. - t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""), - second=1) - self.failUnless(t1 > t2) - - # Likewise, but make microseconds resolve it. - t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""), - microsecond=1) - self.failUnless(t1 > t2) - - # Make t2 naive and it should fail. - t2 = self.theclass.min - self.assertRaises(TypeError, lambda: t1 == t2) - self.assertEqual(t2, t2) - - # It's also naive if it has tzinfo but tzinfo.utcoffset() is None. - class Naive(tzinfo): - def utcoffset(self, dt): return None - t2 = self.theclass(5, 6, 7, tzinfo=Naive()) - self.assertRaises(TypeError, lambda: t1 == t2) - self.assertEqual(t2, t2) - - # OTOH, it's OK to compare two of these mixing the two ways of being - # naive. - t1 = self.theclass(5, 6, 7) - self.assertEqual(t1, t2) - - # Try a bogus uctoffset. - class Bogus(tzinfo): - def utcoffset(self, dt): - return timedelta(minutes=1440) # out of bounds - t1 = self.theclass(2, 2, 2, tzinfo=Bogus()) - t2 = self.theclass(2, 2, 2, tzinfo=FixedOffset(0, "")) - self.assertRaises(ValueError, lambda: t1 == t2) - - def test_pickling(self): - # Try one without a tzinfo. - args = 6, 7, 23, 20, 59, 1, 64**2 - orig = self.theclass(*args) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - - # Try one with a tzinfo. - tinfo = PicklableFixedOffset(-300, 'cookie') - orig = self.theclass(*args, **{'tzinfo': tinfo}) - derived = self.theclass(1, 1, 1, tzinfo=FixedOffset(0, "", 0)) - for pickler, unpickler, proto in pickle_choices: - green = pickler.dumps(orig, proto) - derived = unpickler.loads(green) - self.assertEqual(orig, derived) - self.failUnless(isinstance(derived.tzinfo, - PicklableFixedOffset)) - self.assertEqual(derived.utcoffset(), timedelta(minutes=-300)) - self.assertEqual(derived.tzname(), 'cookie') - - def test_extreme_hashes(self): - # If an attempt is made to hash these via subtracting the offset - # then hashing a datetime object, OverflowError results. The - # Python implementation used to blow up here. - t = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, "")) - hash(t) - t = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999, - tzinfo=FixedOffset(-1439, "")) - hash(t) - - # OTOH, an OOB offset should blow up. - t = self.theclass(5, 5, 5, tzinfo=FixedOffset(-1440, "")) - self.assertRaises(ValueError, hash, t) - - def test_zones(self): - est = FixedOffset(-300, "EST") - utc = FixedOffset(0, "UTC") - met = FixedOffset(60, "MET") - t1 = datetime(2002, 3, 19, 7, 47, tzinfo=est) - t2 = datetime(2002, 3, 19, 12, 47, tzinfo=utc) - t3 = datetime(2002, 3, 19, 13, 47, tzinfo=met) - self.assertEqual(t1.tzinfo, est) - self.assertEqual(t2.tzinfo, utc) - self.assertEqual(t3.tzinfo, met) - self.assertEqual(t1.utcoffset(), timedelta(minutes=-300)) - self.assertEqual(t2.utcoffset(), timedelta(minutes=0)) - self.assertEqual(t3.utcoffset(), timedelta(minutes=60)) - self.assertEqual(t1.tzname(), "EST") - self.assertEqual(t2.tzname(), "UTC") - self.assertEqual(t3.tzname(), "MET") - self.assertEqual(hash(t1), hash(t2)) - self.assertEqual(hash(t1), hash(t3)) - self.assertEqual(hash(t2), hash(t3)) - self.assertEqual(t1, t2) - self.assertEqual(t1, t3) - self.assertEqual(t2, t3) - self.assertEqual(str(t1), "2002-03-19 07:47:00-05:00") - self.assertEqual(str(t2), "2002-03-19 12:47:00+00:00") - self.assertEqual(str(t3), "2002-03-19 13:47:00+01:00") - d = 'datetime.datetime(2002, 3, 19, ' - self.assertEqual(repr(t1), d + "7, 47, tzinfo=est)") - self.assertEqual(repr(t2), d + "12, 47, tzinfo=utc)") - self.assertEqual(repr(t3), d + "13, 47, tzinfo=met)") - - def test_combine(self): - met = FixedOffset(60, "MET") - d = date(2002, 3, 4) - tz = time(18, 45, 3, 1234, tzinfo=met) - dt = datetime.combine(d, tz) - self.assertEqual(dt, datetime(2002, 3, 4, 18, 45, 3, 1234, - tzinfo=met)) - - def test_extract(self): - met = FixedOffset(60, "MET") - dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234, tzinfo=met) - self.assertEqual(dt.date(), date(2002, 3, 4)) - self.assertEqual(dt.time(), time(18, 45, 3, 1234)) - self.assertEqual(dt.timetz(), time(18, 45, 3, 1234, tzinfo=met)) - - def test_tz_aware_arithmetic(self): - import random - - now = self.theclass.now() - tz55 = FixedOffset(-330, "west 5:30") - timeaware = now.time().replace(tzinfo=tz55) - nowaware = self.theclass.combine(now.date(), timeaware) - self.failUnless(nowaware.tzinfo is tz55) - self.assertEqual(nowaware.timetz(), timeaware) - - # Can't mix aware and non-aware. - self.assertRaises(TypeError, lambda: now - nowaware) - self.assertRaises(TypeError, lambda: nowaware - now) - - # And adding datetime's doesn't make sense, aware or not. - self.assertRaises(TypeError, lambda: now + nowaware) - self.assertRaises(TypeError, lambda: nowaware + now) - self.assertRaises(TypeError, lambda: nowaware + nowaware) - - # Subtracting should yield 0. - self.assertEqual(now - now, timedelta(0)) - self.assertEqual(nowaware - nowaware, timedelta(0)) - - # Adding a delta should preserve tzinfo. - delta = timedelta(weeks=1, minutes=12, microseconds=5678) - nowawareplus = nowaware + delta - self.failUnless(nowaware.tzinfo is tz55) - nowawareplus2 = delta + nowaware - self.failUnless(nowawareplus2.tzinfo is tz55) - self.assertEqual(nowawareplus, nowawareplus2) - - # that - delta should be what we started with, and that - what we - # started with should be delta. - diff = nowawareplus - delta - self.failUnless(diff.tzinfo is tz55) - self.assertEqual(nowaware, diff) - self.assertRaises(TypeError, lambda: delta - nowawareplus) - self.assertEqual(nowawareplus - nowaware, delta) - - # Make up a random timezone. - tzr = FixedOffset(random.randrange(-1439, 1440), "randomtimezone") - # Attach it to nowawareplus. - nowawareplus = nowawareplus.replace(tzinfo=tzr) - self.failUnless(nowawareplus.tzinfo is tzr) - # Make sure the difference takes the timezone adjustments into account. - got = nowaware - nowawareplus - # Expected: (nowaware base - nowaware offset) - - # (nowawareplus base - nowawareplus offset) = - # (nowaware base - nowawareplus base) + - # (nowawareplus offset - nowaware offset) = - # -delta + nowawareplus offset - nowaware offset - expected = nowawareplus.utcoffset() - nowaware.utcoffset() - delta - self.assertEqual(got, expected) - - # Try max possible difference. - min = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, "min")) - max = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999, - tzinfo=FixedOffset(-1439, "max")) - maxdiff = max - min - self.assertEqual(maxdiff, self.theclass.max - self.theclass.min + - timedelta(minutes=2*1439)) - - def test_tzinfo_now(self): - meth = self.theclass.now - # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). - base = meth() - # Try with and without naming the keyword. - off42 = FixedOffset(42, "42") - another = meth(off42) - again = meth(tz=off42) - self.failUnless(another.tzinfo is again.tzinfo) - self.assertEqual(another.utcoffset(), timedelta(minutes=42)) - # Bad argument with and w/o naming the keyword. - self.assertRaises(TypeError, meth, 16) - self.assertRaises(TypeError, meth, tzinfo=16) - # Bad keyword name. - self.assertRaises(TypeError, meth, tinfo=off42) - # Too many args. - self.assertRaises(TypeError, meth, off42, off42) - - # We don't know which time zone we're in, and don't have a tzinfo - # class to represent it, so seeing whether a tz argument actually - # does a conversion is tricky. - weirdtz = FixedOffset(timedelta(hours=15, minutes=58), "weirdtz", 0) - utc = FixedOffset(0, "utc", 0) - for dummy in range(3): - now = datetime.now(weirdtz) - self.failUnless(now.tzinfo is weirdtz) - utcnow = datetime.utcnow().replace(tzinfo=utc) - now2 = utcnow.astimezone(weirdtz) - if abs(now - now2) < timedelta(seconds=30): - break - # Else the code is broken, or more than 30 seconds passed between - # calls; assuming the latter, just try again. - else: - # Three strikes and we're out. - self.fail("utcnow(), now(tz), or astimezone() may be broken") - - def test_tzinfo_fromtimestamp(self): - import time - meth = self.theclass.fromtimestamp - ts = time.time() - # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). - base = meth(ts) - # Try with and without naming the keyword. - off42 = FixedOffset(42, "42") - another = meth(ts, off42) - again = meth(ts, tz=off42) - self.failUnless(another.tzinfo is again.tzinfo) - self.assertEqual(another.utcoffset(), timedelta(minutes=42)) - # Bad argument with and w/o naming the keyword. - self.assertRaises(TypeError, meth, ts, 16) - self.assertRaises(TypeError, meth, ts, tzinfo=16) - # Bad keyword name. - self.assertRaises(TypeError, meth, ts, tinfo=off42) - # Too many args. - self.assertRaises(TypeError, meth, ts, off42, off42) - # Too few args. - self.assertRaises(TypeError, meth) - - # Try to make sure tz= actually does some conversion. - timestamp = 1000000000 - utcdatetime = datetime.utcfromtimestamp(timestamp) - # In POSIX (epoch 1970), that's 2001-09-09 01:46:40 UTC, give or take. - # But on some flavor of Mac, it's nowhere near that. So we can't have - # any idea here what time that actually is, we can only test that - # relative changes match. - utcoffset = timedelta(hours=-15, minutes=39) # arbitrary, but not zero - tz = FixedOffset(utcoffset, "tz", 0) - expected = utcdatetime + utcoffset - got = datetime.fromtimestamp(timestamp, tz) - self.assertEqual(expected, got.replace(tzinfo=None)) - - def test_tzinfo_utcnow(self): - meth = self.theclass.utcnow - # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). - base = meth() - # Try with and without naming the keyword; for whatever reason, - # utcnow() doesn't accept a tzinfo argument. - off42 = FixedOffset(42, "42") - self.assertRaises(TypeError, meth, off42) - self.assertRaises(TypeError, meth, tzinfo=off42) - - def test_tzinfo_utcfromtimestamp(self): - import time - meth = self.theclass.utcfromtimestamp - ts = time.time() - # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). - base = meth(ts) - # Try with and without naming the keyword; for whatever reason, - # utcfromtimestamp() doesn't accept a tzinfo argument. - off42 = FixedOffset(42, "42") - self.assertRaises(TypeError, meth, ts, off42) - self.assertRaises(TypeError, meth, ts, tzinfo=off42) - - def test_tzinfo_timetuple(self): - # TestDateTime tested most of this. datetime adds a twist to the - # DST flag. - class DST(tzinfo): - def __init__(self, dstvalue): - if isinstance(dstvalue, int): - dstvalue = timedelta(minutes=dstvalue) - self.dstvalue = dstvalue - def dst(self, dt): - return self.dstvalue - - cls = self.theclass - for dstvalue, flag in (-33, 1), (33, 1), (0, 0), (None, -1): - d = cls(1, 1, 1, 10, 20, 30, 40, tzinfo=DST(dstvalue)) - t = d.timetuple() - self.assertEqual(1, t.tm_year) - self.assertEqual(1, t.tm_mon) - self.assertEqual(1, t.tm_mday) - self.assertEqual(10, t.tm_hour) - self.assertEqual(20, t.tm_min) - self.assertEqual(30, t.tm_sec) - self.assertEqual(0, t.tm_wday) - self.assertEqual(1, t.tm_yday) - self.assertEqual(flag, t.tm_isdst) - - # dst() returns wrong type. - self.assertRaises(TypeError, cls(1, 1, 1, tzinfo=DST("x")).timetuple) - - # dst() at the edge. - self.assertEqual(cls(1,1,1, tzinfo=DST(1439)).timetuple().tm_isdst, 1) - self.assertEqual(cls(1,1,1, tzinfo=DST(-1439)).timetuple().tm_isdst, 1) - - # dst() out of range. - self.assertRaises(ValueError, cls(1,1,1, tzinfo=DST(1440)).timetuple) - self.assertRaises(ValueError, cls(1,1,1, tzinfo=DST(-1440)).timetuple) - - def test_utctimetuple(self): - class DST(tzinfo): - def __init__(self, dstvalue): - if isinstance(dstvalue, int): - dstvalue = timedelta(minutes=dstvalue) - self.dstvalue = dstvalue - def dst(self, dt): - return self.dstvalue - - cls = self.theclass - # This can't work: DST didn't implement utcoffset. - self.assertRaises(NotImplementedError, - cls(1, 1, 1, tzinfo=DST(0)).utcoffset) - - class UOFS(DST): - def __init__(self, uofs, dofs=None): - DST.__init__(self, dofs) - self.uofs = timedelta(minutes=uofs) - def utcoffset(self, dt): - return self.uofs - - # Ensure tm_isdst is 0 regardless of what dst() says: DST is never - # in effect for a UTC time. - for dstvalue in -33, 33, 0, None: - d = cls(1, 2, 3, 10, 20, 30, 40, tzinfo=UOFS(-53, dstvalue)) - t = d.utctimetuple() - self.assertEqual(d.year, t.tm_year) - self.assertEqual(d.month, t.tm_mon) - self.assertEqual(d.day, t.tm_mday) - self.assertEqual(11, t.tm_hour) # 20mm + 53mm = 1hn + 13mm - self.assertEqual(13, t.tm_min) - self.assertEqual(d.second, t.tm_sec) - self.assertEqual(d.weekday(), t.tm_wday) - self.assertEqual(d.toordinal() - date(1, 1, 1).toordinal() + 1, - t.tm_yday) - self.assertEqual(0, t.tm_isdst) - - # At the edges, UTC adjustment can normalize into years out-of-range - # for a datetime object. Ensure that a correct timetuple is - # created anyway. - tiny = cls(MINYEAR, 1, 1, 0, 0, 37, tzinfo=UOFS(1439)) - # That goes back 1 minute less than a full day. - t = tiny.utctimetuple() - self.assertEqual(t.tm_year, MINYEAR-1) - self.assertEqual(t.tm_mon, 12) - self.assertEqual(t.tm_mday, 31) - self.assertEqual(t.tm_hour, 0) - self.assertEqual(t.tm_min, 1) - self.assertEqual(t.tm_sec, 37) - self.assertEqual(t.tm_yday, 366) # "year 0" is a leap year - self.assertEqual(t.tm_isdst, 0) - - huge = cls(MAXYEAR, 12, 31, 23, 59, 37, 999999, tzinfo=UOFS(-1439)) - # That goes forward 1 minute less than a full day. - t = huge.utctimetuple() - self.assertEqual(t.tm_year, MAXYEAR+1) - self.assertEqual(t.tm_mon, 1) - self.assertEqual(t.tm_mday, 1) - self.assertEqual(t.tm_hour, 23) - self.assertEqual(t.tm_min, 58) - self.assertEqual(t.tm_sec, 37) - self.assertEqual(t.tm_yday, 1) - self.assertEqual(t.tm_isdst, 0) - - def test_tzinfo_isoformat(self): - zero = FixedOffset(0, "+00:00") - plus = FixedOffset(220, "+03:40") - minus = FixedOffset(-231, "-03:51") - unknown = FixedOffset(None, "") - - cls = self.theclass - datestr = '0001-02-03' - for ofs in None, zero, plus, minus, unknown: - for us in 0, 987001: - d = cls(1, 2, 3, 4, 5, 59, us, tzinfo=ofs) - timestr = '04:05:59' + (us and '.987001' or '') - ofsstr = ofs is not None and d.tzname() or '' - tailstr = timestr + ofsstr - iso = d.isoformat() - self.assertEqual(iso, datestr + 'T' + tailstr) - self.assertEqual(iso, d.isoformat('T')) - self.assertEqual(d.isoformat('k'), datestr + 'k' + tailstr) - self.assertEqual(str(d), datestr + ' ' + tailstr) - - def test_replace(self): - cls = self.theclass - z100 = FixedOffset(100, "+100") - zm200 = FixedOffset(timedelta(minutes=-200), "-200") - args = [1, 2, 3, 4, 5, 6, 7, z100] - base = cls(*args) - self.assertEqual(base, base.replace()) - - i = 0 - for name, newval in (("year", 2), - ("month", 3), - ("day", 4), - ("hour", 5), - ("minute", 6), - ("second", 7), - ("microsecond", 8), - ("tzinfo", zm200)): - newargs = args[:] - newargs[i] = newval - expected = cls(*newargs) - got = base.replace(**{name: newval}) - self.assertEqual(expected, got) - i += 1 - - # Ensure we can get rid of a tzinfo. - self.assertEqual(base.tzname(), "+100") - base2 = base.replace(tzinfo=None) - self.failUnless(base2.tzinfo is None) - self.failUnless(base2.tzname() is None) - - # Ensure we can add one. - base3 = base2.replace(tzinfo=z100) - self.assertEqual(base, base3) - self.failUnless(base.tzinfo is base3.tzinfo) - - # Out of bounds. - base = cls(2000, 2, 29) - self.assertRaises(ValueError, base.replace, year=2001) - - def test_more_astimezone(self): - # The inherited test_astimezone covered some trivial and error cases. - fnone = FixedOffset(None, "None") - f44m = FixedOffset(44, "44") - fm5h = FixedOffset(-timedelta(hours=5), "m300") - - dt = self.theclass.now(tz=f44m) - self.failUnless(dt.tzinfo is f44m) - # Replacing with degenerate tzinfo raises an exception. - self.assertRaises(ValueError, dt.astimezone, fnone) - # Ditto with None tz. - self.assertRaises(TypeError, dt.astimezone, None) - # Replacing with same tzinfo makes no change. - x = dt.astimezone(dt.tzinfo) - self.failUnless(x.tzinfo is f44m) - self.assertEqual(x.date(), dt.date()) - self.assertEqual(x.time(), dt.time()) - - # Replacing with different tzinfo does adjust. - got = dt.astimezone(fm5h) - self.failUnless(got.tzinfo is fm5h) - self.assertEqual(got.utcoffset(), timedelta(hours=-5)) - expected = dt - dt.utcoffset() # in effect, convert to UTC - expected += fm5h.utcoffset(dt) # and from there to local time - expected = expected.replace(tzinfo=fm5h) # and attach new tzinfo - self.assertEqual(got.date(), expected.date()) - self.assertEqual(got.time(), expected.time()) - self.assertEqual(got.timetz(), expected.timetz()) - self.failUnless(got.tzinfo is expected.tzinfo) - self.assertEqual(got, expected) - - def test_aware_subtract(self): - cls = self.theclass - - # Ensure that utcoffset() is ignored when the operands have the - # same tzinfo member. - class OperandDependentOffset(tzinfo): - def utcoffset(self, t): - if t.minute < 10: - # d0 and d1 equal after adjustment - return timedelta(minutes=t.minute) - else: - # d2 off in the weeds - return timedelta(minutes=59) - - base = cls(8, 9, 10, 11, 12, 13, 14, tzinfo=OperandDependentOffset()) - d0 = base.replace(minute=3) - d1 = base.replace(minute=9) - d2 = base.replace(minute=11) - for x in d0, d1, d2: - for y in d0, d1, d2: - got = x - y - expected = timedelta(minutes=x.minute - y.minute) - self.assertEqual(got, expected) - - # OTOH, if the tzinfo members are distinct, utcoffsets aren't - # ignored. - base = cls(8, 9, 10, 11, 12, 13, 14) - d0 = base.replace(minute=3, tzinfo=OperandDependentOffset()) - d1 = base.replace(minute=9, tzinfo=OperandDependentOffset()) - d2 = base.replace(minute=11, tzinfo=OperandDependentOffset()) - for x in d0, d1, d2: - for y in d0, d1, d2: - got = x - y - if (x is d0 or x is d1) and (y is d0 or y is d1): - expected = timedelta(0) - elif x is y is d2: - expected = timedelta(0) - elif x is d2: - expected = timedelta(minutes=(11-59)-0) - else: - assert y is d2 - expected = timedelta(minutes=0-(11-59)) - self.assertEqual(got, expected) - - def test_mixed_compare(self): - t1 = datetime(1, 2, 3, 4, 5, 6, 7) - t2 = datetime(1, 2, 3, 4, 5, 6, 7) - self.assertEqual(t1, t2) - t2 = t2.replace(tzinfo=None) - self.assertEqual(t1, t2) - t2 = t2.replace(tzinfo=FixedOffset(None, "")) - self.assertEqual(t1, t2) - t2 = t2.replace(tzinfo=FixedOffset(0, "")) - self.assertRaises(TypeError, lambda: t1 == t2) - - # In datetime w/ identical tzinfo objects, utcoffset is ignored. - class Varies(tzinfo): - def __init__(self): - self.offset = timedelta(minutes=22) - def utcoffset(self, t): - self.offset += timedelta(minutes=1) - return self.offset - - v = Varies() - t1 = t2.replace(tzinfo=v) - t2 = t2.replace(tzinfo=v) - self.assertEqual(t1.utcoffset(), timedelta(minutes=23)) - self.assertEqual(t2.utcoffset(), timedelta(minutes=24)) - self.assertEqual(t1, t2) - - # But if they're not identical, it isn't ignored. - t2 = t2.replace(tzinfo=Varies()) - self.failUnless(t1 < t2) # t1's offset counter still going up - - def test_subclass_datetimetz(self): - - class C(self.theclass): - theAnswer = 42 - - def __new__(cls, *args, **kws): - temp = kws.copy() - extra = temp.pop('extra') - result = self.theclass.__new__(cls, *args, **temp) - result.extra = extra - return result - - def newmeth(self, start): - return start + self.hour + self.year - - args = 2002, 12, 31, 4, 5, 6, 500, FixedOffset(-300, "EST", 1) - - dt1 = self.theclass(*args) - dt2 = C(*args, **{'extra': 7}) - - self.assertEqual(dt2.__class__, C) - self.assertEqual(dt2.theAnswer, 42) - self.assertEqual(dt2.extra, 7) - self.assertEqual(dt1.utcoffset(), dt2.utcoffset()) - self.assertEqual(dt2.newmeth(-7), dt1.hour + dt1.year - 7) - -# Pain to set up DST-aware tzinfo classes. - -def first_sunday_on_or_after(dt): - days_to_go = 6 - dt.weekday() - if days_to_go: - dt += timedelta(days_to_go) - return dt - -ZERO = timedelta(0) -HOUR = timedelta(hours=1) -DAY = timedelta(days=1) -# In the US, DST starts at 2am (standard time) on the first Sunday in April. -DSTSTART = datetime(1, 4, 1, 2) -# and ends at 2am (DST time; 1am standard time) on the last Sunday of Oct, -# which is the first Sunday on or after Oct 25. Because we view 1:MM as -# being standard time on that day, there is no spelling in local time of -# the last hour of DST (that's 1:MM DST, but 1:MM is taken as standard time). -DSTEND = datetime(1, 10, 25, 1) - -class USTimeZone(tzinfo): - - def __init__(self, hours, reprname, stdname, dstname): - self.stdoffset = timedelta(hours=hours) - self.reprname = reprname - self.stdname = stdname - self.dstname = dstname - - def __repr__(self): - return self.reprname - - def tzname(self, dt): - if self.dst(dt): - return self.dstname - else: - return self.stdname - - def utcoffset(self, dt): - return self.stdoffset + self.dst(dt) - - def dst(self, dt): - if dt is None or dt.tzinfo is None: - # An exception instead may be sensible here, in one or more of - # the cases. - return ZERO - assert dt.tzinfo is self - - # Find first Sunday in April. - start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year)) - assert start.weekday() == 6 and start.month == 4 and start.day <= 7 - - # Find last Sunday in October. - end = first_sunday_on_or_after(DSTEND.replace(year=dt.year)) - assert end.weekday() == 6 and end.month == 10 and end.day >= 25 - - # Can't compare naive to aware objects, so strip the timezone from - # dt first. - if start <= dt.replace(tzinfo=None) < end: - return HOUR - else: - return ZERO - -Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") -Central = USTimeZone(-6, "Central", "CST", "CDT") -Mountain = USTimeZone(-7, "Mountain", "MST", "MDT") -Pacific = USTimeZone(-8, "Pacific", "PST", "PDT") -utc_real = FixedOffset(0, "UTC", 0) -# For better test coverage, we want another flavor of UTC that's west of -# the Eastern and Pacific timezones. -utc_fake = FixedOffset(-12*60, "UTCfake", 0) - -class TestTimezoneConversions(unittest.TestCase): - # The DST switch times for 2002, in std time. - dston = datetime(2002, 4, 7, 2) - dstoff = datetime(2002, 10, 27, 1) - - theclass = datetime - - # Check a time that's inside DST. - def checkinside(self, dt, tz, utc, dston, dstoff): - self.assertEqual(dt.dst(), HOUR) - - # Conversion to our own timezone is always an identity. - self.assertEqual(dt.astimezone(tz), dt) - - asutc = dt.astimezone(utc) - there_and_back = asutc.astimezone(tz) - - # Conversion to UTC and back isn't always an identity here, - # because there are redundant spellings (in local time) of - # UTC time when DST begins: the clock jumps from 1:59:59 - # to 3:00:00, and a local time of 2:MM:SS doesn't really - # make sense then. The classes above treat 2:MM:SS as - # daylight time then (it's "after 2am"), really an alias - # for 1:MM:SS standard time. The latter form is what - # conversion back from UTC produces. - if dt.date() == dston.date() and dt.hour == 2: - # We're in the redundant hour, and coming back from - # UTC gives the 1:MM:SS standard-time spelling. - self.assertEqual(there_and_back + HOUR, dt) - # Although during was considered to be in daylight - # time, there_and_back is not. - self.assertEqual(there_and_back.dst(), ZERO) - # They're the same times in UTC. - self.assertEqual(there_and_back.astimezone(utc), - dt.astimezone(utc)) - else: - # We're not in the redundant hour. - self.assertEqual(dt, there_and_back) - - # Because we have a redundant spelling when DST begins, there is - # (unforunately) an hour when DST ends that can't be spelled at all in - # local time. When DST ends, the clock jumps from 1:59 back to 1:00 - # again. The hour 1:MM DST has no spelling then: 1:MM is taken to be - # standard time. 1:MM DST == 0:MM EST, but 0:MM is taken to be - # daylight time. The hour 1:MM daylight == 0:MM standard can't be - # expressed in local time. Nevertheless, we want conversion back - # from UTC to mimic the local clock's "repeat an hour" behavior. - nexthour_utc = asutc + HOUR - nexthour_tz = nexthour_utc.astimezone(tz) - if dt.date() == dstoff.date() and dt.hour == 0: - # We're in the hour before the last DST hour. The last DST hour - # is ineffable. We want the conversion back to repeat 1:MM. - self.assertEqual(nexthour_tz, dt.replace(hour=1)) - nexthour_utc += HOUR - nexthour_tz = nexthour_utc.astimezone(tz) - self.assertEqual(nexthour_tz, dt.replace(hour=1)) - else: - self.assertEqual(nexthour_tz - dt, HOUR) - - # Check a time that's outside DST. - def checkoutside(self, dt, tz, utc): - self.assertEqual(dt.dst(), ZERO) - - # Conversion to our own timezone is always an identity. - self.assertEqual(dt.astimezone(tz), dt) - - # Converting to UTC and back is an identity too. - asutc = dt.astimezone(utc) - there_and_back = asutc.astimezone(tz) - self.assertEqual(dt, there_and_back) - - def convert_between_tz_and_utc(self, tz, utc): - dston = self.dston.replace(tzinfo=tz) - # Because 1:MM on the day DST ends is taken as being standard time, - # there is no spelling in tz for the last hour of daylight time. - # For purposes of the test, the last hour of DST is 0:MM, which is - # taken as being daylight time (and 1:MM is taken as being standard - # time). - dstoff = self.dstoff.replace(tzinfo=tz) - for delta in (timedelta(weeks=13), - DAY, - HOUR, - timedelta(minutes=1), - timedelta(microseconds=1)): - - self.checkinside(dston, tz, utc, dston, dstoff) - for during in dston + delta, dstoff - delta: - self.checkinside(during, tz, utc, dston, dstoff) - - self.checkoutside(dstoff, tz, utc) - for outside in dston - delta, dstoff + delta: - self.checkoutside(outside, tz, utc) - - def test_easy(self): - # Despite the name of this test, the endcases are excruciating. - self.convert_between_tz_and_utc(Eastern, utc_real) - self.convert_between_tz_and_utc(Pacific, utc_real) - self.convert_between_tz_and_utc(Eastern, utc_fake) - self.convert_between_tz_and_utc(Pacific, utc_fake) - # The next is really dancing near the edge. It works because - # Pacific and Eastern are far enough apart that their "problem - # hours" don't overlap. - self.convert_between_tz_and_utc(Eastern, Pacific) - self.convert_between_tz_and_utc(Pacific, Eastern) - # OTOH, these fail! Don't enable them. The difficulty is that - # the edge case tests assume that every hour is representable in - # the "utc" class. This is always true for a fixed-offset tzinfo - # class (lke utc_real and utc_fake), but not for Eastern or Central. - # For these adjacent DST-aware time zones, the range of time offsets - # tested ends up creating hours in the one that aren't representable - # in the other. For the same reason, we would see failures in the - # Eastern vs Pacific tests too if we added 3*HOUR to the list of - # offset deltas in convert_between_tz_and_utc(). - # - # self.convert_between_tz_and_utc(Eastern, Central) # can't work - # self.convert_between_tz_and_utc(Central, Eastern) # can't work - - def test_tricky(self): - # 22:00 on day before daylight starts. - fourback = self.dston - timedelta(hours=4) - ninewest = FixedOffset(-9*60, "-0900", 0) - fourback = fourback.replace(tzinfo=ninewest) - # 22:00-0900 is 7:00 UTC == 2:00 EST == 3:00 DST. Since it's "after - # 2", we should get the 3 spelling. - # If we plug 22:00 the day before into Eastern, it "looks like std - # time", so its offset is returned as -5, and -5 - -9 = 4. Adding 4 - # to 22:00 lands on 2:00, which makes no sense in local time (the - # local clock jumps from 1 to 3). The point here is to make sure we - # get the 3 spelling. - expected = self.dston.replace(hour=3) - got = fourback.astimezone(Eastern).replace(tzinfo=None) - self.assertEqual(expected, got) - - # Similar, but map to 6:00 UTC == 1:00 EST == 2:00 DST. In that - # case we want the 1:00 spelling. - sixutc = self.dston.replace(hour=6, tzinfo=utc_real) - # Now 6:00 "looks like daylight", so the offset wrt Eastern is -4, - # and adding -4-0 == -4 gives the 2:00 spelling. We want the 1:00 EST - # spelling. - expected = self.dston.replace(hour=1) - got = sixutc.astimezone(Eastern).replace(tzinfo=None) - self.assertEqual(expected, got) - - # Now on the day DST ends, we want "repeat an hour" behavior. - # UTC 4:MM 5:MM 6:MM 7:MM checking these - # EST 23:MM 0:MM 1:MM 2:MM - # EDT 0:MM 1:MM 2:MM 3:MM - # wall 0:MM 1:MM 1:MM 2:MM against these - for utc in utc_real, utc_fake: - for tz in Eastern, Pacific: - first_std_hour = self.dstoff - timedelta(hours=2) # 23:MM - # Convert that to UTC. - first_std_hour -= tz.utcoffset(None) - # Adjust for possibly fake UTC. - asutc = first_std_hour + utc.utcoffset(None) - # First UTC hour to convert; this is 4:00 when utc=utc_real & - # tz=Eastern. - asutcbase = asutc.replace(tzinfo=utc) - for tzhour in (0, 1, 1, 2): - expectedbase = self.dstoff.replace(hour=tzhour) - for minute in 0, 30, 59: - expected = expectedbase.replace(minute=minute) - asutc = asutcbase.replace(minute=minute) - astz = asutc.astimezone(tz) - self.assertEqual(astz.replace(tzinfo=None), expected) - asutcbase += HOUR - - - def test_bogus_dst(self): - class ok(tzinfo): - def utcoffset(self, dt): return HOUR - def dst(self, dt): return HOUR - - now = self.theclass.now().replace(tzinfo=utc_real) - # Doesn't blow up. - now.astimezone(ok()) - - # Does blow up. - class notok(ok): - def dst(self, dt): return None - self.assertRaises(ValueError, now.astimezone, notok()) - - def test_fromutc(self): - self.assertRaises(TypeError, Eastern.fromutc) # not enough args - now = datetime.utcnow().replace(tzinfo=utc_real) - self.assertRaises(ValueError, Eastern.fromutc, now) # wrong tzinfo - now = now.replace(tzinfo=Eastern) # insert correct tzinfo - enow = Eastern.fromutc(now) # doesn't blow up - self.assertEqual(enow.tzinfo, Eastern) # has right tzinfo member - self.assertRaises(TypeError, Eastern.fromutc, now, now) # too many args - self.assertRaises(TypeError, Eastern.fromutc, date.today()) # wrong type - - # Always converts UTC to standard time. - class FauxUSTimeZone(USTimeZone): - def fromutc(self, dt): - return dt + self.stdoffset - FEastern = FauxUSTimeZone(-5, "FEastern", "FEST", "FEDT") - - # UTC 4:MM 5:MM 6:MM 7:MM 8:MM 9:MM - # EST 23:MM 0:MM 1:MM 2:MM 3:MM 4:MM - # EDT 0:MM 1:MM 2:MM 3:MM 4:MM 5:MM - - # Check around DST start. - start = self.dston.replace(hour=4, tzinfo=Eastern) - fstart = start.replace(tzinfo=FEastern) - for wall in 23, 0, 1, 3, 4, 5: - expected = start.replace(hour=wall) - if wall == 23: - expected -= timedelta(days=1) - got = Eastern.fromutc(start) - self.assertEqual(expected, got) - - expected = fstart + FEastern.stdoffset - got = FEastern.fromutc(fstart) - self.assertEqual(expected, got) - - # Ensure astimezone() calls fromutc() too. - got = fstart.replace(tzinfo=utc_real).astimezone(FEastern) - self.assertEqual(expected, got) - - start += HOUR - fstart += HOUR - - # Check around DST end. - start = self.dstoff.replace(hour=4, tzinfo=Eastern) - fstart = start.replace(tzinfo=FEastern) - for wall in 0, 1, 1, 2, 3, 4: - expected = start.replace(hour=wall) - got = Eastern.fromutc(start) - self.assertEqual(expected, got) - - expected = fstart + FEastern.stdoffset - got = FEastern.fromutc(fstart) - self.assertEqual(expected, got) - - # Ensure astimezone() calls fromutc() too. - got = fstart.replace(tzinfo=utc_real).astimezone(FEastern) - self.assertEqual(expected, got) - - start += HOUR - fstart += HOUR - - -############################################################################# -# oddballs - -class Oddballs(unittest.TestCase): - - def test_bug_1028306(self): - # Trying to compare a date to a datetime should act like a mixed- - # type comparison, despite that datetime is a subclass of date. - as_date = date.today() - as_datetime = datetime.combine(as_date, time()) - self.assert_(as_date != as_datetime) - self.assert_(as_datetime != as_date) - self.assert_(not as_date == as_datetime) - self.assert_(not as_datetime == as_date) - self.assertRaises(TypeError, lambda: as_date < as_datetime) - self.assertRaises(TypeError, lambda: as_datetime < as_date) - self.assertRaises(TypeError, lambda: as_date <= as_datetime) - self.assertRaises(TypeError, lambda: as_datetime <= as_date) - self.assertRaises(TypeError, lambda: as_date > as_datetime) - self.assertRaises(TypeError, lambda: as_datetime > as_date) - self.assertRaises(TypeError, lambda: as_date >= as_datetime) - self.assertRaises(TypeError, lambda: as_datetime >= as_date) - - # Neverthelss, comparison should work with the base-class (date) - # projection if use of a date method is forced. - self.assert_(as_date.__eq__(as_datetime)) - different_day = (as_date.day + 1) % 20 + 1 - self.assert_(not as_date.__eq__(as_datetime.replace(day= - different_day))) - - # And date should compare with other subclasses of date. If a - # subclass wants to stop this, it's up to the subclass to do so. - date_sc = SubclassDate(as_date.year, as_date.month, as_date.day) - self.assertEqual(as_date, date_sc) - self.assertEqual(date_sc, as_date) - - # Ditto for datetimes. - datetime_sc = SubclassDatetime(as_datetime.year, as_datetime.month, - as_date.day, 0, 0, 0) - self.assertEqual(as_datetime, datetime_sc) - self.assertEqual(datetime_sc, as_datetime) - -def test_suite(): - allsuites = [unittest.makeSuite(klass, 'test') - for klass in (TestModule, - TestTZInfo, - TestTimeDelta, - TestDateOnly, - TestDate, - TestDateTime, - TestTime, - TestTimeTZ, - TestDateTimeTZ, - TestTimezoneConversions, - Oddballs, - ) - ] - return unittest.TestSuite(allsuites) - -def test_main(): - import gc - import sys - - thesuite = test_suite() - lastrc = None - while True: - test_support.run_suite(thesuite) - if 1: # change to 0, under a debug build, for some leak detection - break - gc.collect() - if gc.garbage: - raise SystemError("gc.garbage not empty after test run: %r" % - gc.garbage) - if hasattr(sys, 'gettotalrefcount'): - thisrc = sys.gettotalrefcount() - print >> sys.stderr, '*' * 10, 'total refs:', thisrc, - if lastrc: - print >> sys.stderr, 'delta:', thisrc - lastrc - else: - print >> sys.stderr - lastrc = thisrc - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_dbm.py b/sys/lib/python/test/test_dbm.py deleted file mode 100755 index b93e72eb7..000000000 --- a/sys/lib/python/test/test_dbm.py +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env python -"""Test script for the dbm module - Roger E. Masse -""" -import os -import random -import dbm -from dbm import error -from test.test_support import verbose, verify, TestSkipped, TESTFN - -# make filename unique to allow multiple concurrent tests -# and to minimize the likelihood of a problem from an old file -filename = TESTFN - -def cleanup(): - for suffix in ['', '.pag', '.dir', '.db']: - try: - os.unlink(filename + suffix) - except OSError, (errno, strerror): - # if we can't delete the file because of permissions, - # nothing will work, so skip the test - if errno == 1: - raise TestSkipped, 'unable to remove: ' + filename + suffix - -def test_keys(): - d = dbm.open(filename, 'c') - verify(d.keys() == []) - d['a'] = 'b' - d['12345678910'] = '019237410982340912840198242' - d.keys() - if d.has_key('a'): - if verbose: - print 'Test dbm keys: ', d.keys() - - d.close() - -def test_modes(): - d = dbm.open(filename, 'r') - d.close() - d = dbm.open(filename, 'rw') - d.close() - d = dbm.open(filename, 'w') - d.close() - d = dbm.open(filename, 'n') - d.close() - -cleanup() -try: - test_keys() - test_modes() -except: - cleanup() - raise - -cleanup() diff --git a/sys/lib/python/test/test_decimal.py b/sys/lib/python/test/test_decimal.py deleted file mode 100644 index 841ea6fc0..000000000 --- a/sys/lib/python/test/test_decimal.py +++ /dev/null @@ -1,1133 +0,0 @@ -# Copyright (c) 2004 Python Software Foundation. -# All rights reserved. - -# Written by Eric Price -# and Facundo Batista -# and Raymond Hettinger -# and Aahz (aahz at pobox.com) -# and Tim Peters - -""" -These are the test cases for the Decimal module. - -There are two groups of tests, Arithmetic and Behaviour. The former test -the Decimal arithmetic using the tests provided by Mike Cowlishaw. The latter -test the pythonic behaviour according to PEP 327. - -Cowlishaw's tests can be downloaded from: - - www2.hursley.ibm.com/decimal/dectest.zip - -This test module can be called from command line with one parameter (Arithmetic -or Behaviour) to test each part, or without parameter to test both parts. If -you're working through IDLE, you can import this test module and call test_main() -with the corresponding argument. -""" -from __future__ import with_statement - -import unittest -import glob -import os, sys -import pickle, copy -from decimal import * -from test.test_support import (TestSkipped, run_unittest, run_doctest, - is_resource_enabled) -import random -try: - import threading -except ImportError: - threading = None - -# Useful Test Constant -Signals = getcontext().flags.keys() - -# Tests are built around these assumed context defaults. -# test_main() restores the original context. -def init(): - global ORIGINAL_CONTEXT - ORIGINAL_CONTEXT = getcontext().copy() - DefaultContext.prec = 9 - DefaultContext.rounding = ROUND_HALF_EVEN - DefaultContext.traps = dict.fromkeys(Signals, 0) - setcontext(DefaultContext) - -TESTDATADIR = 'decimaltestdata' -if __name__ == '__main__': - file = sys.argv[0] -else: - file = __file__ -testdir = os.path.dirname(file) or os.curdir -directory = testdir + os.sep + TESTDATADIR + os.sep - -skip_expected = not os.path.isdir(directory) - -# Make sure it actually raises errors when not expected and caught in flags -# Slower, since it runs some things several times. -EXTENDEDERRORTEST = False - - -#Map the test cases' error names to the actual errors - -ErrorNames = {'clamped' : Clamped, - 'conversion_syntax' : InvalidOperation, - 'division_by_zero' : DivisionByZero, - 'division_impossible' : InvalidOperation, - 'division_undefined' : InvalidOperation, - 'inexact' : Inexact, - 'invalid_context' : InvalidOperation, - 'invalid_operation' : InvalidOperation, - 'overflow' : Overflow, - 'rounded' : Rounded, - 'subnormal' : Subnormal, - 'underflow' : Underflow} - - -def Nonfunction(*args): - """Doesn't do anything.""" - return None - -RoundingDict = {'ceiling' : ROUND_CEILING, #Maps test-case names to roundings. - 'down' : ROUND_DOWN, - 'floor' : ROUND_FLOOR, - 'half_down' : ROUND_HALF_DOWN, - 'half_even' : ROUND_HALF_EVEN, - 'half_up' : ROUND_HALF_UP, - 'up' : ROUND_UP} - -# Name adapter to be able to change the Decimal and Context -# interface without changing the test files from Cowlishaw -nameAdapter = {'toeng':'to_eng_string', - 'tosci':'to_sci_string', - 'samequantum':'same_quantum', - 'tointegral':'to_integral', - 'remaindernear':'remainder_near', - 'divideint':'divide_int', - 'squareroot':'sqrt', - 'apply':'_apply', - } - -class DecimalTest(unittest.TestCase): - """Class which tests the Decimal class against the test cases. - - Changed for unittest. - """ - def setUp(self): - self.context = Context() - for key in DefaultContext.traps.keys(): - DefaultContext.traps[key] = 1 - self.ignore_list = ['#'] - # Basically, a # means return NaN InvalidOperation. - # Different from a sNaN in trim - - self.ChangeDict = {'precision' : self.change_precision, - 'rounding' : self.change_rounding_method, - 'maxexponent' : self.change_max_exponent, - 'minexponent' : self.change_min_exponent, - 'clamp' : self.change_clamp} - - def tearDown(self): - """Cleaning up enviroment.""" - # leaving context in original state - for key in DefaultContext.traps.keys(): - DefaultContext.traps[key] = 0 - return - - def eval_file(self, file): - global skip_expected - if skip_expected: - raise TestSkipped - return - for line in open(file).xreadlines(): - line = line.replace('\r\n', '').replace('\n', '') - #print line - try: - t = self.eval_line(line) - except InvalidOperation: - print 'Error in test cases:' - print line - continue - except DecimalException, exception: - #Exception raised where there shoudn't have been one. - self.fail('Exception "'+exception.__class__.__name__ + '" raised on line '+line) - - return - - def eval_line(self, s): - if s.find(' -> ') >= 0 and s[:2] != '--' and not s.startswith(' --'): - s = (s.split('->')[0] + '->' + - s.split('->')[1].split('--')[0]).strip() - else: - s = s.split('--')[0].strip() - - for ignore in self.ignore_list: - if s.find(ignore) >= 0: - #print s.split()[0], 'NotImplemented--', ignore - return - if not s: - return - elif ':' in s: - return self.eval_directive(s) - else: - return self.eval_equation(s) - - def eval_directive(self, s): - funct, value = map(lambda x: x.strip().lower(), s.split(':')) - if funct == 'rounding': - value = RoundingDict[value] - else: - try: - value = int(value) - except ValueError: - pass - - funct = self.ChangeDict.get(funct, Nonfunction) - funct(value) - - def eval_equation(self, s): - #global DEFAULT_PRECISION - #print DEFAULT_PRECISION - - if not TEST_ALL and random.random() < 0.90: - return - - try: - Sides = s.split('->') - L = Sides[0].strip().split() - id = L[0] -# print id, - funct = L[1].lower() - valstemp = L[2:] - L = Sides[1].strip().split() - ans = L[0] - exceptions = L[1:] - except (TypeError, AttributeError, IndexError): - raise InvalidOperation - def FixQuotes(val): - val = val.replace("''", 'SingleQuote').replace('""', 'DoubleQuote') - val = val.replace("'", '').replace('"', '') - val = val.replace('SingleQuote', "'").replace('DoubleQuote', '"') - return val - fname = nameAdapter.get(funct, funct) - if fname == 'rescale': - return - funct = getattr(self.context, fname) - vals = [] - conglomerate = '' - quote = 0 - theirexceptions = [ErrorNames[x.lower()] for x in exceptions] - - for exception in Signals: - self.context.traps[exception] = 1 #Catch these bugs... - for exception in theirexceptions: - self.context.traps[exception] = 0 - for i, val in enumerate(valstemp): - if val.count("'") % 2 == 1: - quote = 1 - quote - if quote: - conglomerate = conglomerate + ' ' + val - continue - else: - val = conglomerate + val - conglomerate = '' - v = FixQuotes(val) - if fname in ('to_sci_string', 'to_eng_string'): - if EXTENDEDERRORTEST: - for error in theirexceptions: - self.context.traps[error] = 1 - try: - funct(self.context.create_decimal(v)) - except error: - pass - except Signals, e: - self.fail("Raised %s in %s when %s disabled" % \ - (e, s, error)) - else: - self.fail("Did not raise %s in %s" % (error, s)) - self.context.traps[error] = 0 - v = self.context.create_decimal(v) - else: - v = Decimal(v) - vals.append(v) - - ans = FixQuotes(ans) - - if EXTENDEDERRORTEST and fname not in ('to_sci_string', 'to_eng_string'): - for error in theirexceptions: - self.context.traps[error] = 1 - try: - funct(*vals) - except error: - pass - except Signals, e: - self.fail("Raised %s in %s when %s disabled" % \ - (e, s, error)) - else: - self.fail("Did not raise %s in %s" % (error, s)) - self.context.traps[error] = 0 - try: - result = str(funct(*vals)) - if fname == 'same_quantum': - result = str(int(eval(result))) # 'True', 'False' -> '1', '0' - except Signals, error: - self.fail("Raised %s in %s" % (error, s)) - except: #Catch any error long enough to state the test case. - print "ERROR:", s - raise - - myexceptions = self.getexceptions() - self.context.clear_flags() - - myexceptions.sort() - theirexceptions.sort() - - self.assertEqual(result, ans, - 'Incorrect answer for ' + s + ' -- got ' + result) - self.assertEqual(myexceptions, theirexceptions, - 'Incorrect flags set in ' + s + ' -- got ' \ - + str(myexceptions)) - return - - def getexceptions(self): - return [e for e in Signals if self.context.flags[e]] - - def change_precision(self, prec): - self.context.prec = prec - def change_rounding_method(self, rounding): - self.context.rounding = rounding - def change_min_exponent(self, exp): - self.context.Emin = exp - def change_max_exponent(self, exp): - self.context.Emax = exp - def change_clamp(self, clamp): - self.context._clamp = clamp - -# Dynamically build custom test definition for each file in the test -# directory and add the definitions to the DecimalTest class. This -# procedure insures that new files do not get skipped. -for filename in os.listdir(directory): - if '.decTest' not in filename: - continue - head, tail = filename.split('.') - tester = lambda self, f=filename: self.eval_file(directory + f) - setattr(DecimalTest, 'test_' + head, tester) - del filename, head, tail, tester - - - -# The following classes test the behaviour of Decimal according to PEP 327 - -class DecimalExplicitConstructionTest(unittest.TestCase): - '''Unit tests for Explicit Construction cases of Decimal.''' - - def test_explicit_empty(self): - self.assertEqual(Decimal(), Decimal("0")) - - def test_explicit_from_None(self): - self.assertRaises(TypeError, Decimal, None) - - def test_explicit_from_int(self): - - #positive - d = Decimal(45) - self.assertEqual(str(d), '45') - - #very large positive - d = Decimal(500000123) - self.assertEqual(str(d), '500000123') - - #negative - d = Decimal(-45) - self.assertEqual(str(d), '-45') - - #zero - d = Decimal(0) - self.assertEqual(str(d), '0') - - def test_explicit_from_string(self): - - #empty - self.assertEqual(str(Decimal('')), 'NaN') - - #int - self.assertEqual(str(Decimal('45')), '45') - - #float - self.assertEqual(str(Decimal('45.34')), '45.34') - - #engineer notation - self.assertEqual(str(Decimal('45e2')), '4.5E+3') - - #just not a number - self.assertEqual(str(Decimal('ugly')), 'NaN') - - def test_explicit_from_tuples(self): - - #zero - d = Decimal( (0, (0,), 0) ) - self.assertEqual(str(d), '0') - - #int - d = Decimal( (1, (4, 5), 0) ) - self.assertEqual(str(d), '-45') - - #float - d = Decimal( (0, (4, 5, 3, 4), -2) ) - self.assertEqual(str(d), '45.34') - - #weird - d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) - self.assertEqual(str(d), '-4.34913534E-17') - - #wrong number of items - self.assertRaises(ValueError, Decimal, (1, (4, 3, 4, 9, 1)) ) - - #bad sign - self.assertRaises(ValueError, Decimal, (8, (4, 3, 4, 9, 1), 2) ) - - #bad exp - self.assertRaises(ValueError, Decimal, (1, (4, 3, 4, 9, 1), 'wrong!') ) - - #bad coefficients - self.assertRaises(ValueError, Decimal, (1, (4, 3, 4, None, 1), 2) ) - self.assertRaises(ValueError, Decimal, (1, (4, -3, 4, 9, 1), 2) ) - - def test_explicit_from_Decimal(self): - - #positive - d = Decimal(45) - e = Decimal(d) - self.assertEqual(str(e), '45') - self.assertNotEqual(id(d), id(e)) - - #very large positive - d = Decimal(500000123) - e = Decimal(d) - self.assertEqual(str(e), '500000123') - self.assertNotEqual(id(d), id(e)) - - #negative - d = Decimal(-45) - e = Decimal(d) - self.assertEqual(str(e), '-45') - self.assertNotEqual(id(d), id(e)) - - #zero - d = Decimal(0) - e = Decimal(d) - self.assertEqual(str(e), '0') - self.assertNotEqual(id(d), id(e)) - - def test_explicit_context_create_decimal(self): - - nc = copy.copy(getcontext()) - nc.prec = 3 - - # empty - d = Decimal() - self.assertEqual(str(d), '0') - d = nc.create_decimal() - self.assertEqual(str(d), '0') - - # from None - self.assertRaises(TypeError, nc.create_decimal, None) - - # from int - d = nc.create_decimal(456) - self.failUnless(isinstance(d, Decimal)) - self.assertEqual(nc.create_decimal(45678), - nc.create_decimal('457E+2')) - - # from string - d = Decimal('456789') - self.assertEqual(str(d), '456789') - d = nc.create_decimal('456789') - self.assertEqual(str(d), '4.57E+5') - - # from tuples - d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) - self.assertEqual(str(d), '-4.34913534E-17') - d = nc.create_decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) - self.assertEqual(str(d), '-4.35E-17') - - # from Decimal - prevdec = Decimal(500000123) - d = Decimal(prevdec) - self.assertEqual(str(d), '500000123') - d = nc.create_decimal(prevdec) - self.assertEqual(str(d), '5.00E+8') - - -class DecimalImplicitConstructionTest(unittest.TestCase): - '''Unit tests for Implicit Construction cases of Decimal.''' - - def test_implicit_from_None(self): - self.assertRaises(TypeError, eval, 'Decimal(5) + None', globals()) - - def test_implicit_from_int(self): - #normal - self.assertEqual(str(Decimal(5) + 45), '50') - #exceeding precision - self.assertEqual(Decimal(5) + 123456789000, Decimal(123456789000)) - - def test_implicit_from_string(self): - self.assertRaises(TypeError, eval, 'Decimal(5) + "3"', globals()) - - def test_implicit_from_float(self): - self.assertRaises(TypeError, eval, 'Decimal(5) + 2.2', globals()) - - def test_implicit_from_Decimal(self): - self.assertEqual(Decimal(5) + Decimal(45), Decimal(50)) - - def test_rop(self): - # Allow other classes to be trained to interact with Decimals - class E: - def __divmod__(self, other): - return 'divmod ' + str(other) - def __rdivmod__(self, other): - return str(other) + ' rdivmod' - def __lt__(self, other): - return 'lt ' + str(other) - def __gt__(self, other): - return 'gt ' + str(other) - def __le__(self, other): - return 'le ' + str(other) - def __ge__(self, other): - return 'ge ' + str(other) - def __eq__(self, other): - return 'eq ' + str(other) - def __ne__(self, other): - return 'ne ' + str(other) - - self.assertEqual(divmod(E(), Decimal(10)), 'divmod 10') - self.assertEqual(divmod(Decimal(10), E()), '10 rdivmod') - self.assertEqual(eval('Decimal(10) < E()'), 'gt 10') - self.assertEqual(eval('Decimal(10) > E()'), 'lt 10') - self.assertEqual(eval('Decimal(10) <= E()'), 'ge 10') - self.assertEqual(eval('Decimal(10) >= E()'), 'le 10') - self.assertEqual(eval('Decimal(10) == E()'), 'eq 10') - self.assertEqual(eval('Decimal(10) != E()'), 'ne 10') - - # insert operator methods and then exercise them - oplist = [ - ('+', '__add__', '__radd__'), - ('-', '__sub__', '__rsub__'), - ('*', '__mul__', '__rmul__'), - ('%', '__mod__', '__rmod__'), - ('//', '__floordiv__', '__rfloordiv__'), - ('**', '__pow__', '__rpow__') - ] - if 1/2 == 0: - # testing with classic division, so add __div__ - oplist.append(('/', '__div__', '__rdiv__')) - else: - # testing with -Qnew, so add __truediv__ - oplist.append(('/', '__truediv__', '__rtruediv__')) - - for sym, lop, rop in oplist: - setattr(E, lop, lambda self, other: 'str' + lop + str(other)) - setattr(E, rop, lambda self, other: str(other) + rop + 'str') - self.assertEqual(eval('E()' + sym + 'Decimal(10)'), - 'str' + lop + '10') - self.assertEqual(eval('Decimal(10)' + sym + 'E()'), - '10' + rop + 'str') - -class DecimalArithmeticOperatorsTest(unittest.TestCase): - '''Unit tests for all arithmetic operators, binary and unary.''' - - def test_addition(self): - - d1 = Decimal('-11.1') - d2 = Decimal('22.2') - - #two Decimals - self.assertEqual(d1+d2, Decimal('11.1')) - self.assertEqual(d2+d1, Decimal('11.1')) - - #with other type, left - c = d1 + 5 - self.assertEqual(c, Decimal('-6.1')) - self.assertEqual(type(c), type(d1)) - - #with other type, right - c = 5 + d1 - self.assertEqual(c, Decimal('-6.1')) - self.assertEqual(type(c), type(d1)) - - #inline with decimal - d1 += d2 - self.assertEqual(d1, Decimal('11.1')) - - #inline with other type - d1 += 5 - self.assertEqual(d1, Decimal('16.1')) - - def test_subtraction(self): - - d1 = Decimal('-11.1') - d2 = Decimal('22.2') - - #two Decimals - self.assertEqual(d1-d2, Decimal('-33.3')) - self.assertEqual(d2-d1, Decimal('33.3')) - - #with other type, left - c = d1 - 5 - self.assertEqual(c, Decimal('-16.1')) - self.assertEqual(type(c), type(d1)) - - #with other type, right - c = 5 - d1 - self.assertEqual(c, Decimal('16.1')) - self.assertEqual(type(c), type(d1)) - - #inline with decimal - d1 -= d2 - self.assertEqual(d1, Decimal('-33.3')) - - #inline with other type - d1 -= 5 - self.assertEqual(d1, Decimal('-38.3')) - - def test_multiplication(self): - - d1 = Decimal('-5') - d2 = Decimal('3') - - #two Decimals - self.assertEqual(d1*d2, Decimal('-15')) - self.assertEqual(d2*d1, Decimal('-15')) - - #with other type, left - c = d1 * 5 - self.assertEqual(c, Decimal('-25')) - self.assertEqual(type(c), type(d1)) - - #with other type, right - c = 5 * d1 - self.assertEqual(c, Decimal('-25')) - self.assertEqual(type(c), type(d1)) - - #inline with decimal - d1 *= d2 - self.assertEqual(d1, Decimal('-15')) - - #inline with other type - d1 *= 5 - self.assertEqual(d1, Decimal('-75')) - - def test_division(self): - - d1 = Decimal('-5') - d2 = Decimal('2') - - #two Decimals - self.assertEqual(d1/d2, Decimal('-2.5')) - self.assertEqual(d2/d1, Decimal('-0.4')) - - #with other type, left - c = d1 / 4 - self.assertEqual(c, Decimal('-1.25')) - self.assertEqual(type(c), type(d1)) - - #with other type, right - c = 4 / d1 - self.assertEqual(c, Decimal('-0.8')) - self.assertEqual(type(c), type(d1)) - - #inline with decimal - d1 /= d2 - self.assertEqual(d1, Decimal('-2.5')) - - #inline with other type - d1 /= 4 - self.assertEqual(d1, Decimal('-0.625')) - - def test_floor_division(self): - - d1 = Decimal('5') - d2 = Decimal('2') - - #two Decimals - self.assertEqual(d1//d2, Decimal('2')) - self.assertEqual(d2//d1, Decimal('0')) - - #with other type, left - c = d1 // 4 - self.assertEqual(c, Decimal('1')) - self.assertEqual(type(c), type(d1)) - - #with other type, right - c = 7 // d1 - self.assertEqual(c, Decimal('1')) - self.assertEqual(type(c), type(d1)) - - #inline with decimal - d1 //= d2 - self.assertEqual(d1, Decimal('2')) - - #inline with other type - d1 //= 2 - self.assertEqual(d1, Decimal('1')) - - def test_powering(self): - - d1 = Decimal('5') - d2 = Decimal('2') - - #two Decimals - self.assertEqual(d1**d2, Decimal('25')) - self.assertEqual(d2**d1, Decimal('32')) - - #with other type, left - c = d1 ** 4 - self.assertEqual(c, Decimal('625')) - self.assertEqual(type(c), type(d1)) - - #with other type, right - c = 7 ** d1 - self.assertEqual(c, Decimal('16807')) - self.assertEqual(type(c), type(d1)) - - #inline with decimal - d1 **= d2 - self.assertEqual(d1, Decimal('25')) - - #inline with other type - d1 **= 4 - self.assertEqual(d1, Decimal('390625')) - - def test_module(self): - - d1 = Decimal('5') - d2 = Decimal('2') - - #two Decimals - self.assertEqual(d1%d2, Decimal('1')) - self.assertEqual(d2%d1, Decimal('2')) - - #with other type, left - c = d1 % 4 - self.assertEqual(c, Decimal('1')) - self.assertEqual(type(c), type(d1)) - - #with other type, right - c = 7 % d1 - self.assertEqual(c, Decimal('2')) - self.assertEqual(type(c), type(d1)) - - #inline with decimal - d1 %= d2 - self.assertEqual(d1, Decimal('1')) - - #inline with other type - d1 %= 4 - self.assertEqual(d1, Decimal('1')) - - def test_floor_div_module(self): - - d1 = Decimal('5') - d2 = Decimal('2') - - #two Decimals - (p, q) = divmod(d1, d2) - self.assertEqual(p, Decimal('2')) - self.assertEqual(q, Decimal('1')) - self.assertEqual(type(p), type(d1)) - self.assertEqual(type(q), type(d1)) - - #with other type, left - (p, q) = divmod(d1, 4) - self.assertEqual(p, Decimal('1')) - self.assertEqual(q, Decimal('1')) - self.assertEqual(type(p), type(d1)) - self.assertEqual(type(q), type(d1)) - - #with other type, right - (p, q) = divmod(7, d1) - self.assertEqual(p, Decimal('1')) - self.assertEqual(q, Decimal('2')) - self.assertEqual(type(p), type(d1)) - self.assertEqual(type(q), type(d1)) - - def test_unary_operators(self): - self.assertEqual(+Decimal(45), Decimal(+45)) # + - self.assertEqual(-Decimal(45), Decimal(-45)) # - - self.assertEqual(abs(Decimal(45)), abs(Decimal(-45))) # abs - - -# The following are two functions used to test threading in the next class - -def thfunc1(cls): - d1 = Decimal(1) - d3 = Decimal(3) - cls.assertEqual(d1/d3, Decimal('0.333333333')) - cls.synchro.wait() - cls.assertEqual(d1/d3, Decimal('0.333333333')) - cls.finish1.set() - return - -def thfunc2(cls): - d1 = Decimal(1) - d3 = Decimal(3) - cls.assertEqual(d1/d3, Decimal('0.333333333')) - thiscontext = getcontext() - thiscontext.prec = 18 - cls.assertEqual(d1/d3, Decimal('0.333333333333333333')) - cls.synchro.set() - cls.finish2.set() - return - - -class DecimalUseOfContextTest(unittest.TestCase): - '''Unit tests for Use of Context cases in Decimal.''' - - try: - import threading - except ImportError: - threading = None - - # Take care executing this test from IDLE, there's an issue in threading - # that hangs IDLE and I couldn't find it - - def test_threading(self): - #Test the "threading isolation" of a Context. - - self.synchro = threading.Event() - self.finish1 = threading.Event() - self.finish2 = threading.Event() - - th1 = threading.Thread(target=thfunc1, args=(self,)) - th2 = threading.Thread(target=thfunc2, args=(self,)) - - th1.start() - th2.start() - - self.finish1.wait() - self.finish1.wait() - return - - if threading is None: - del test_threading - - -class DecimalUsabilityTest(unittest.TestCase): - '''Unit tests for Usability cases of Decimal.''' - - def test_comparison_operators(self): - - da = Decimal('23.42') - db = Decimal('23.42') - dc = Decimal('45') - - #two Decimals - self.failUnless(dc > da) - self.failUnless(dc >= da) - self.failUnless(da < dc) - self.failUnless(da <= dc) - self.failUnless(da == db) - self.failUnless(da != dc) - self.failUnless(da <= db) - self.failUnless(da >= db) - self.assertEqual(cmp(dc,da), 1) - self.assertEqual(cmp(da,dc), -1) - self.assertEqual(cmp(da,db), 0) - - #a Decimal and an int - self.failUnless(dc > 23) - self.failUnless(23 < dc) - self.failUnless(dc == 45) - self.assertEqual(cmp(dc,23), 1) - self.assertEqual(cmp(23,dc), -1) - self.assertEqual(cmp(dc,45), 0) - - #a Decimal and uncomparable - self.assertNotEqual(da, 'ugly') - self.assertNotEqual(da, 32.7) - self.assertNotEqual(da, object()) - self.assertNotEqual(da, object) - - # sortable - a = map(Decimal, xrange(100)) - b = a[:] - random.shuffle(a) - a.sort() - self.assertEqual(a, b) - - def test_copy_and_deepcopy_methods(self): - d = Decimal('43.24') - c = copy.copy(d) - self.assertEqual(id(c), id(d)) - dc = copy.deepcopy(d) - self.assertEqual(id(dc), id(d)) - - def test_hash_method(self): - #just that it's hashable - hash(Decimal(23)) - #the same hash that to an int - self.assertEqual(hash(Decimal(23)), hash(23)) - self.assertRaises(TypeError, hash, Decimal('NaN')) - self.assert_(hash(Decimal('Inf'))) - self.assert_(hash(Decimal('-Inf'))) - - def test_min_and_max_methods(self): - - d1 = Decimal('15.32') - d2 = Decimal('28.5') - l1 = 15 - l2 = 28 - - #between Decimals - self.failUnless(min(d1,d2) is d1) - self.failUnless(min(d2,d1) is d1) - self.failUnless(max(d1,d2) is d2) - self.failUnless(max(d2,d1) is d2) - - #between Decimal and long - self.failUnless(min(d1,l2) is d1) - self.failUnless(min(l2,d1) is d1) - self.failUnless(max(l1,d2) is d2) - self.failUnless(max(d2,l1) is d2) - - def test_as_nonzero(self): - #as false - self.failIf(Decimal(0)) - #as true - self.failUnless(Decimal('0.372')) - - def test_tostring_methods(self): - #Test str and repr methods. - - d = Decimal('15.32') - self.assertEqual(str(d), '15.32') # str - self.assertEqual(repr(d), 'Decimal("15.32")') # repr - - def test_tonum_methods(self): - #Test float, int and long methods. - - d1 = Decimal('66') - d2 = Decimal('15.32') - - #int - self.assertEqual(int(d1), 66) - self.assertEqual(int(d2), 15) - - #long - self.assertEqual(long(d1), 66) - self.assertEqual(long(d2), 15) - - #float - self.assertEqual(float(d1), 66) - self.assertEqual(float(d2), 15.32) - - def test_eval_round_trip(self): - - #with zero - d = Decimal( (0, (0,), 0) ) - self.assertEqual(d, eval(repr(d))) - - #int - d = Decimal( (1, (4, 5), 0) ) - self.assertEqual(d, eval(repr(d))) - - #float - d = Decimal( (0, (4, 5, 3, 4), -2) ) - self.assertEqual(d, eval(repr(d))) - - #weird - d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) - self.assertEqual(d, eval(repr(d))) - - def test_as_tuple(self): - - #with zero - d = Decimal(0) - self.assertEqual(d.as_tuple(), (0, (0,), 0) ) - - #int - d = Decimal(-45) - self.assertEqual(d.as_tuple(), (1, (4, 5), 0) ) - - #complicated string - d = Decimal("-4.34913534E-17") - self.assertEqual(d.as_tuple(), (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) - - #inf - d = Decimal("Infinity") - self.assertEqual(d.as_tuple(), (0, (0,), 'F') ) - - def test_immutability_operations(self): - # Do operations and check that it didn't change change internal objects. - - d1 = Decimal('-25e55') - b1 = Decimal('-25e55') - d2 = Decimal('33e-33') - b2 = Decimal('33e-33') - - def checkSameDec(operation, useOther=False): - if useOther: - eval("d1." + operation + "(d2)") - self.assertEqual(d1._sign, b1._sign) - self.assertEqual(d1._int, b1._int) - self.assertEqual(d1._exp, b1._exp) - self.assertEqual(d2._sign, b2._sign) - self.assertEqual(d2._int, b2._int) - self.assertEqual(d2._exp, b2._exp) - else: - eval("d1." + operation + "()") - self.assertEqual(d1._sign, b1._sign) - self.assertEqual(d1._int, b1._int) - self.assertEqual(d1._exp, b1._exp) - return - - Decimal(d1) - self.assertEqual(d1._sign, b1._sign) - self.assertEqual(d1._int, b1._int) - self.assertEqual(d1._exp, b1._exp) - - checkSameDec("__abs__") - checkSameDec("__add__", True) - checkSameDec("__div__", True) - checkSameDec("__divmod__", True) - checkSameDec("__cmp__", True) - checkSameDec("__float__") - checkSameDec("__floordiv__", True) - checkSameDec("__hash__") - checkSameDec("__int__") - checkSameDec("__long__") - checkSameDec("__mod__", True) - checkSameDec("__mul__", True) - checkSameDec("__neg__") - checkSameDec("__nonzero__") - checkSameDec("__pos__") - checkSameDec("__pow__", True) - checkSameDec("__radd__", True) - checkSameDec("__rdiv__", True) - checkSameDec("__rdivmod__", True) - checkSameDec("__repr__") - checkSameDec("__rfloordiv__", True) - checkSameDec("__rmod__", True) - checkSameDec("__rmul__", True) - checkSameDec("__rpow__", True) - checkSameDec("__rsub__", True) - checkSameDec("__str__") - checkSameDec("__sub__", True) - checkSameDec("__truediv__", True) - checkSameDec("adjusted") - checkSameDec("as_tuple") - checkSameDec("compare", True) - checkSameDec("max", True) - checkSameDec("min", True) - checkSameDec("normalize") - checkSameDec("quantize", True) - checkSameDec("remainder_near", True) - checkSameDec("same_quantum", True) - checkSameDec("sqrt") - checkSameDec("to_eng_string") - checkSameDec("to_integral") - -class DecimalPythonAPItests(unittest.TestCase): - - def test_pickle(self): - d = Decimal('-3.141590000') - p = pickle.dumps(d) - e = pickle.loads(p) - self.assertEqual(d, e) - - def test_int(self): - for x in range(-250, 250): - s = '%0.2f' % (x / 100.0) - # should work the same as for floats - self.assertEqual(int(Decimal(s)), int(float(s))) - # should work the same as to_integral in the ROUND_DOWN mode - d = Decimal(s) - r = d.to_integral(ROUND_DOWN) - self.assertEqual(Decimal(int(d)), r) - -class ContextAPItests(unittest.TestCase): - - def test_pickle(self): - c = Context() - e = pickle.loads(pickle.dumps(c)) - for k in vars(c): - v1 = vars(c)[k] - v2 = vars(e)[k] - self.assertEqual(v1, v2) - - def test_equality_with_other_types(self): - self.assert_(Decimal(10) in ['a', 1.0, Decimal(10), (1,2), {}]) - self.assert_(Decimal(10) not in ['a', 1.0, (1,2), {}]) - - def test_copy(self): - # All copies should be deep - c = Context() - d = c.copy() - self.assertNotEqual(id(c), id(d)) - self.assertNotEqual(id(c.flags), id(d.flags)) - self.assertNotEqual(id(c.traps), id(d.traps)) - -class WithStatementTest(unittest.TestCase): - # Can't do these as docstrings until Python 2.6 - # as doctest can't handle __future__ statements - - def test_localcontext(self): - # Use a copy of the current context in the block - orig_ctx = getcontext() - with localcontext() as enter_ctx: - set_ctx = getcontext() - final_ctx = getcontext() - self.assert_(orig_ctx is final_ctx, 'did not restore context correctly') - self.assert_(orig_ctx is not set_ctx, 'did not copy the context') - self.assert_(set_ctx is enter_ctx, '__enter__ returned wrong context') - - def test_localcontextarg(self): - # Use a copy of the supplied context in the block - orig_ctx = getcontext() - new_ctx = Context(prec=42) - with localcontext(new_ctx) as enter_ctx: - set_ctx = getcontext() - final_ctx = getcontext() - self.assert_(orig_ctx is final_ctx, 'did not restore context correctly') - self.assert_(set_ctx.prec == new_ctx.prec, 'did not set correct context') - self.assert_(new_ctx is not set_ctx, 'did not copy the context') - self.assert_(set_ctx is enter_ctx, '__enter__ returned wrong context') - -def test_main(arith=False, verbose=None): - """ Execute the tests. - - Runs all arithmetic tests if arith is True or if the "decimal" resource - is enabled in regrtest.py - """ - - init() - global TEST_ALL - TEST_ALL = arith or is_resource_enabled('decimal') - - test_classes = [ - DecimalExplicitConstructionTest, - DecimalImplicitConstructionTest, - DecimalArithmeticOperatorsTest, - DecimalUseOfContextTest, - DecimalUsabilityTest, - DecimalPythonAPItests, - ContextAPItests, - DecimalTest, - WithStatementTest, - ] - - try: - run_unittest(*test_classes) - import decimal as DecimalModule - run_doctest(DecimalModule, verbose) - finally: - setcontext(ORIGINAL_CONTEXT) - -if __name__ == '__main__': - # Calling with no arguments runs all tests. - # Calling with "Skip" will skip over 90% of the arithmetic tests. - if len(sys.argv) == 1: - test_main(arith=True, verbose=True) - elif len(sys.argv) == 2: - arith = sys.argv[1].lower() != 'skip' - test_main(arith=arith, verbose=True) - else: - raise ValueError("test called with wrong arguments, use test_Decimal [Skip]") diff --git a/sys/lib/python/test/test_decorators.py b/sys/lib/python/test/test_decorators.py deleted file mode 100644 index 56aa5e132..000000000 --- a/sys/lib/python/test/test_decorators.py +++ /dev/null @@ -1,273 +0,0 @@ -import unittest -from test import test_support - -def funcattrs(**kwds): - def decorate(func): - func.__dict__.update(kwds) - return func - return decorate - -class MiscDecorators (object): - @staticmethod - def author(name): - def decorate(func): - func.__dict__['author'] = name - return func - return decorate - -# ----------------------------------------------- - -class DbcheckError (Exception): - def __init__(self, exprstr, func, args, kwds): - # A real version of this would set attributes here - Exception.__init__(self, "dbcheck %r failed (func=%s args=%s kwds=%s)" % - (exprstr, func, args, kwds)) - - -def dbcheck(exprstr, globals=None, locals=None): - "Decorator to implement debugging assertions" - def decorate(func): - expr = compile(exprstr, "dbcheck-%s" % func.func_name, "eval") - def check(*args, **kwds): - if not eval(expr, globals, locals): - raise DbcheckError(exprstr, func, args, kwds) - return func(*args, **kwds) - return check - return decorate - -# ----------------------------------------------- - -def countcalls(counts): - "Decorator to count calls to a function" - def decorate(func): - func_name = func.func_name - counts[func_name] = 0 - def call(*args, **kwds): - counts[func_name] += 1 - return func(*args, **kwds) - call.func_name = func_name - return call - return decorate - -# ----------------------------------------------- - -def memoize(func): - saved = {} - def call(*args): - try: - return saved[args] - except KeyError: - res = func(*args) - saved[args] = res - return res - except TypeError: - # Unhashable argument - return func(*args) - call.func_name = func.func_name - return call - -# ----------------------------------------------- - -class TestDecorators(unittest.TestCase): - - def test_single(self): - class C(object): - @staticmethod - def foo(): return 42 - self.assertEqual(C.foo(), 42) - self.assertEqual(C().foo(), 42) - - def test_staticmethod_function(self): - @staticmethod - def notamethod(x): - return x - self.assertRaises(TypeError, notamethod, 1) - - def test_dotted(self): - decorators = MiscDecorators() - @decorators.author('Cleese') - def foo(): return 42 - self.assertEqual(foo(), 42) - self.assertEqual(foo.author, 'Cleese') - - def test_argforms(self): - # A few tests of argument passing, as we use restricted form - # of expressions for decorators. - - def noteargs(*args, **kwds): - def decorate(func): - setattr(func, 'dbval', (args, kwds)) - return func - return decorate - - args = ( 'Now', 'is', 'the', 'time' ) - kwds = dict(one=1, two=2) - @noteargs(*args, **kwds) - def f1(): return 42 - self.assertEqual(f1(), 42) - self.assertEqual(f1.dbval, (args, kwds)) - - @noteargs('terry', 'gilliam', eric='idle', john='cleese') - def f2(): return 84 - self.assertEqual(f2(), 84) - self.assertEqual(f2.dbval, (('terry', 'gilliam'), - dict(eric='idle', john='cleese'))) - - @noteargs(1, 2,) - def f3(): pass - self.assertEqual(f3.dbval, ((1, 2), {})) - - def test_dbcheck(self): - @dbcheck('args[1] is not None') - def f(a, b): - return a + b - self.assertEqual(f(1, 2), 3) - self.assertRaises(DbcheckError, f, 1, None) - - def test_memoize(self): - counts = {} - - @memoize - @countcalls(counts) - def double(x): - return x * 2 - self.assertEqual(double.func_name, 'double') - - self.assertEqual(counts, dict(double=0)) - - # Only the first call with a given argument bumps the call count: - # - self.assertEqual(double(2), 4) - self.assertEqual(counts['double'], 1) - self.assertEqual(double(2), 4) - self.assertEqual(counts['double'], 1) - self.assertEqual(double(3), 6) - self.assertEqual(counts['double'], 2) - - # Unhashable arguments do not get memoized: - # - self.assertEqual(double([10]), [10, 10]) - self.assertEqual(counts['double'], 3) - self.assertEqual(double([10]), [10, 10]) - self.assertEqual(counts['double'], 4) - - def test_errors(self): - # Test syntax restrictions - these are all compile-time errors: - # - for expr in [ "1+2", "x[3]", "(1, 2)" ]: - # Sanity check: is expr is a valid expression by itself? - compile(expr, "testexpr", "exec") - - codestr = "@%s\ndef f(): pass" % expr - self.assertRaises(SyntaxError, compile, codestr, "test", "exec") - - # You can't put multiple decorators on a single line: - # - self.assertRaises(SyntaxError, compile, - "@f1 @f2\ndef f(): pass", "test", "exec") - - # Test runtime errors - - def unimp(func): - raise NotImplementedError - context = dict(nullval=None, unimp=unimp) - - for expr, exc in [ ("undef", NameError), - ("nullval", TypeError), - ("nullval.attr", AttributeError), - ("unimp", NotImplementedError)]: - codestr = "@%s\ndef f(): pass\nassert f() is None" % expr - code = compile(codestr, "test", "exec") - self.assertRaises(exc, eval, code, context) - - def test_double(self): - class C(object): - @funcattrs(abc=1, xyz="haha") - @funcattrs(booh=42) - def foo(self): return 42 - self.assertEqual(C().foo(), 42) - self.assertEqual(C.foo.abc, 1) - self.assertEqual(C.foo.xyz, "haha") - self.assertEqual(C.foo.booh, 42) - - def test_order(self): - # Test that decorators are applied in the proper order to the function - # they are decorating. - def callnum(num): - """Decorator factory that returns a decorator that replaces the - passed-in function with one that returns the value of 'num'""" - def deco(func): - return lambda: num - return deco - @callnum(2) - @callnum(1) - def foo(): return 42 - self.assertEqual(foo(), 2, - "Application order of decorators is incorrect") - - def test_eval_order(self): - # Evaluating a decorated function involves four steps for each - # decorator-maker (the function that returns a decorator): - # - # 1: Evaluate the decorator-maker name - # 2: Evaluate the decorator-maker arguments (if any) - # 3: Call the decorator-maker to make a decorator - # 4: Call the decorator - # - # When there are multiple decorators, these steps should be - # performed in the above order for each decorator, but we should - # iterate through the decorators in the reverse of the order they - # appear in the source. - - actions = [] - - def make_decorator(tag): - actions.append('makedec' + tag) - def decorate(func): - actions.append('calldec' + tag) - return func - return decorate - - class NameLookupTracer (object): - def __init__(self, index): - self.index = index - - def __getattr__(self, fname): - if fname == 'make_decorator': - opname, res = ('evalname', make_decorator) - elif fname == 'arg': - opname, res = ('evalargs', str(self.index)) - else: - assert False, "Unknown attrname %s" % fname - actions.append('%s%d' % (opname, self.index)) - return res - - c1, c2, c3 = map(NameLookupTracer, [ 1, 2, 3 ]) - - expected_actions = [ 'evalname1', 'evalargs1', 'makedec1', - 'evalname2', 'evalargs2', 'makedec2', - 'evalname3', 'evalargs3', 'makedec3', - 'calldec3', 'calldec2', 'calldec1' ] - - actions = [] - @c1.make_decorator(c1.arg) - @c2.make_decorator(c2.arg) - @c3.make_decorator(c3.arg) - def foo(): return 42 - self.assertEqual(foo(), 42) - - self.assertEqual(actions, expected_actions) - - # Test the equivalence claim in chapter 7 of the reference manual. - # - actions = [] - def bar(): return 42 - bar = c1.make_decorator(c1.arg)(c2.make_decorator(c2.arg)(c3.make_decorator(c3.arg)(bar))) - self.assertEqual(bar(), 42) - self.assertEqual(actions, expected_actions) - -def test_main(): - test_support.run_unittest(TestDecorators) - -if __name__=="__main__": - test_main() diff --git a/sys/lib/python/test/test_defaultdict.py b/sys/lib/python/test/test_defaultdict.py deleted file mode 100644 index 08be005b4..000000000 --- a/sys/lib/python/test/test_defaultdict.py +++ /dev/null @@ -1,149 +0,0 @@ -"""Unit tests for collections.defaultdict.""" - -import os -import copy -import tempfile -import unittest -from test import test_support - -from collections import defaultdict - -def foobar(): - return list - -class TestDefaultDict(unittest.TestCase): - - def test_basic(self): - d1 = defaultdict() - self.assertEqual(d1.default_factory, None) - d1.default_factory = list - d1[12].append(42) - self.assertEqual(d1, {12: [42]}) - d1[12].append(24) - self.assertEqual(d1, {12: [42, 24]}) - d1[13] - d1[14] - self.assertEqual(d1, {12: [42, 24], 13: [], 14: []}) - self.assert_(d1[12] is not d1[13] is not d1[14]) - d2 = defaultdict(list, foo=1, bar=2) - self.assertEqual(d2.default_factory, list) - self.assertEqual(d2, {"foo": 1, "bar": 2}) - self.assertEqual(d2["foo"], 1) - self.assertEqual(d2["bar"], 2) - self.assertEqual(d2[42], []) - self.assert_("foo" in d2) - self.assert_("foo" in d2.keys()) - self.assert_("bar" in d2) - self.assert_("bar" in d2.keys()) - self.assert_(42 in d2) - self.assert_(42 in d2.keys()) - self.assert_(12 not in d2) - self.assert_(12 not in d2.keys()) - d2.default_factory = None - self.assertEqual(d2.default_factory, None) - try: - d2[15] - except KeyError, err: - self.assertEqual(err.args, (15,)) - else: - self.fail("d2[15] didn't raise KeyError") - self.assertRaises(TypeError, defaultdict, 1) - - def test_missing(self): - d1 = defaultdict() - self.assertRaises(KeyError, d1.__missing__, 42) - d1.default_factory = list - self.assertEqual(d1.__missing__(42), []) - - def test_repr(self): - d1 = defaultdict() - self.assertEqual(d1.default_factory, None) - self.assertEqual(repr(d1), "defaultdict(None, {})") - d1[11] = 41 - self.assertEqual(repr(d1), "defaultdict(None, {11: 41})") - d2 = defaultdict(int) - self.assertEqual(d2.default_factory, int) - d2[12] = 42 - self.assertEqual(repr(d2), "defaultdict(, {12: 42})") - def foo(): return 43 - d3 = defaultdict(foo) - self.assert_(d3.default_factory is foo) - d3[13] - self.assertEqual(repr(d3), "defaultdict(%s, {13: 43})" % repr(foo)) - - def test_print(self): - d1 = defaultdict() - def foo(): return 42 - d2 = defaultdict(foo, {1: 2}) - # NOTE: We can't use tempfile.[Named]TemporaryFile since this - # code must exercise the tp_print C code, which only gets - # invoked for *real* files. - tfn = tempfile.mktemp() - try: - f = open(tfn, "w+") - try: - print >>f, d1 - print >>f, d2 - f.seek(0) - self.assertEqual(f.readline(), repr(d1) + "\n") - self.assertEqual(f.readline(), repr(d2) + "\n") - finally: - f.close() - finally: - os.remove(tfn) - - def test_copy(self): - d1 = defaultdict() - d2 = d1.copy() - self.assertEqual(type(d2), defaultdict) - self.assertEqual(d2.default_factory, None) - self.assertEqual(d2, {}) - d1.default_factory = list - d3 = d1.copy() - self.assertEqual(type(d3), defaultdict) - self.assertEqual(d3.default_factory, list) - self.assertEqual(d3, {}) - d1[42] - d4 = d1.copy() - self.assertEqual(type(d4), defaultdict) - self.assertEqual(d4.default_factory, list) - self.assertEqual(d4, {42: []}) - d4[12] - self.assertEqual(d4, {42: [], 12: []}) - - def test_shallow_copy(self): - d1 = defaultdict(foobar, {1: 1}) - d2 = copy.copy(d1) - self.assertEqual(d2.default_factory, foobar) - self.assertEqual(d2, d1) - d1.default_factory = list - d2 = copy.copy(d1) - self.assertEqual(d2.default_factory, list) - self.assertEqual(d2, d1) - - def test_deep_copy(self): - d1 = defaultdict(foobar, {1: [1]}) - d2 = copy.deepcopy(d1) - self.assertEqual(d2.default_factory, foobar) - self.assertEqual(d2, d1) - self.assert_(d1[1] is not d2[1]) - d1.default_factory = list - d2 = copy.deepcopy(d1) - self.assertEqual(d2.default_factory, list) - self.assertEqual(d2, d1) - - def test_keyerror_without_factory(self): - d1 = defaultdict() - try: - d1[(1,)] - except KeyError, err: - self.assertEqual(err.message, (1,)) - else: - self.fail("expected KeyError") - - -def test_main(): - test_support.run_unittest(TestDefaultDict) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_deque.py b/sys/lib/python/test/test_deque.py deleted file mode 100644 index 1d996eee9..000000000 --- a/sys/lib/python/test/test_deque.py +++ /dev/null @@ -1,632 +0,0 @@ -from collections import deque -import unittest -from test import test_support, seq_tests -from weakref import proxy -import copy -import cPickle as pickle -from cStringIO import StringIO -import random -import os - -BIG = 100000 - -def fail(): - raise SyntaxError - yield 1 - -class BadCmp: - def __eq__(self, other): - raise RuntimeError - -class MutateCmp: - def __init__(self, deque, result): - self.deque = deque - self.result = result - def __eq__(self, other): - self.deque.clear() - return self.result - -class TestBasic(unittest.TestCase): - - def test_basics(self): - d = deque(xrange(100)) - d.__init__(xrange(100, 200)) - for i in xrange(200, 400): - d.append(i) - for i in reversed(xrange(-200, 0)): - d.appendleft(i) - self.assertEqual(list(d), range(-200, 400)) - self.assertEqual(len(d), 600) - - left = [d.popleft() for i in xrange(250)] - self.assertEqual(left, range(-200, 50)) - self.assertEqual(list(d), range(50, 400)) - - right = [d.pop() for i in xrange(250)] - right.reverse() - self.assertEqual(right, range(150, 400)) - self.assertEqual(list(d), range(50, 150)) - - def test_comparisons(self): - d = deque('xabc'); d.popleft() - for e in [d, deque('abc'), deque('ab'), deque(), list(d)]: - self.assertEqual(d==e, type(d)==type(e) and list(d)==list(e)) - self.assertEqual(d!=e, not(type(d)==type(e) and list(d)==list(e))) - - args = map(deque, ('', 'a', 'b', 'ab', 'ba', 'abc', 'xba', 'xabc', 'cba')) - for x in args: - for y in args: - self.assertEqual(x == y, list(x) == list(y), (x,y)) - self.assertEqual(x != y, list(x) != list(y), (x,y)) - self.assertEqual(x < y, list(x) < list(y), (x,y)) - self.assertEqual(x <= y, list(x) <= list(y), (x,y)) - self.assertEqual(x > y, list(x) > list(y), (x,y)) - self.assertEqual(x >= y, list(x) >= list(y), (x,y)) - self.assertEqual(cmp(x,y), cmp(list(x),list(y)), (x,y)) - - def test_extend(self): - d = deque('a') - self.assertRaises(TypeError, d.extend, 1) - d.extend('bcd') - self.assertEqual(list(d), list('abcd')) - - def test_extendleft(self): - d = deque('a') - self.assertRaises(TypeError, d.extendleft, 1) - d.extendleft('bcd') - self.assertEqual(list(d), list(reversed('abcd'))) - d = deque() - d.extendleft(range(1000)) - self.assertEqual(list(d), list(reversed(range(1000)))) - self.assertRaises(SyntaxError, d.extendleft, fail()) - - def test_getitem(self): - n = 200 - d = deque(xrange(n)) - l = range(n) - for i in xrange(n): - d.popleft() - l.pop(0) - if random.random() < 0.5: - d.append(i) - l.append(i) - for j in xrange(1-len(l), len(l)): - assert d[j] == l[j] - - d = deque('superman') - self.assertEqual(d[0], 's') - self.assertEqual(d[-1], 'n') - d = deque() - self.assertRaises(IndexError, d.__getitem__, 0) - self.assertRaises(IndexError, d.__getitem__, -1) - - def test_setitem(self): - n = 200 - d = deque(xrange(n)) - for i in xrange(n): - d[i] = 10 * i - self.assertEqual(list(d), [10*i for i in xrange(n)]) - l = list(d) - for i in xrange(1-n, 0, -1): - d[i] = 7*i - l[i] = 7*i - self.assertEqual(list(d), l) - - def test_delitem(self): - n = 500 # O(n**2) test, don't make this too big - d = deque(xrange(n)) - self.assertRaises(IndexError, d.__delitem__, -n-1) - self.assertRaises(IndexError, d.__delitem__, n) - for i in xrange(n): - self.assertEqual(len(d), n-i) - j = random.randrange(-len(d), len(d)) - val = d[j] - self.assert_(val in d) - del d[j] - self.assert_(val not in d) - self.assertEqual(len(d), 0) - - def test_rotate(self): - s = tuple('abcde') - n = len(s) - - d = deque(s) - d.rotate(1) # verify rot(1) - self.assertEqual(''.join(d), 'eabcd') - - d = deque(s) - d.rotate(-1) # verify rot(-1) - self.assertEqual(''.join(d), 'bcdea') - d.rotate() # check default to 1 - self.assertEqual(tuple(d), s) - - for i in xrange(n*3): - d = deque(s) - e = deque(d) - d.rotate(i) # check vs. rot(1) n times - for j in xrange(i): - e.rotate(1) - self.assertEqual(tuple(d), tuple(e)) - d.rotate(-i) # check that it works in reverse - self.assertEqual(tuple(d), s) - e.rotate(n-i) # check that it wraps forward - self.assertEqual(tuple(e), s) - - for i in xrange(n*3): - d = deque(s) - e = deque(d) - d.rotate(-i) - for j in xrange(i): - e.rotate(-1) # check vs. rot(-1) n times - self.assertEqual(tuple(d), tuple(e)) - d.rotate(i) # check that it works in reverse - self.assertEqual(tuple(d), s) - e.rotate(i-n) # check that it wraps backaround - self.assertEqual(tuple(e), s) - - d = deque(s) - e = deque(s) - e.rotate(BIG+17) # verify on long series of rotates - dr = d.rotate - for i in xrange(BIG+17): - dr() - self.assertEqual(tuple(d), tuple(e)) - - self.assertRaises(TypeError, d.rotate, 'x') # Wrong arg type - self.assertRaises(TypeError, d.rotate, 1, 10) # Too many args - - d = deque() - d.rotate() # rotate an empty deque - self.assertEqual(d, deque()) - - def test_len(self): - d = deque('ab') - self.assertEqual(len(d), 2) - d.popleft() - self.assertEqual(len(d), 1) - d.pop() - self.assertEqual(len(d), 0) - self.assertRaises(IndexError, d.pop) - self.assertEqual(len(d), 0) - d.append('c') - self.assertEqual(len(d), 1) - d.appendleft('d') - self.assertEqual(len(d), 2) - d.clear() - self.assertEqual(len(d), 0) - - def test_underflow(self): - d = deque() - self.assertRaises(IndexError, d.pop) - self.assertRaises(IndexError, d.popleft) - - def test_clear(self): - d = deque(xrange(100)) - self.assertEqual(len(d), 100) - d.clear() - self.assertEqual(len(d), 0) - self.assertEqual(list(d), []) - d.clear() # clear an emtpy deque - self.assertEqual(list(d), []) - - def test_remove(self): - d = deque('abcdefghcij') - d.remove('c') - self.assertEqual(d, deque('abdefghcij')) - d.remove('c') - self.assertEqual(d, deque('abdefghij')) - self.assertRaises(ValueError, d.remove, 'c') - self.assertEqual(d, deque('abdefghij')) - - # Handle comparison errors - d = deque(['a', 'b', BadCmp(), 'c']) - e = deque(d) - self.assertRaises(RuntimeError, d.remove, 'c') - for x, y in zip(d, e): - # verify that original order and values are retained. - self.assert_(x is y) - - # Handle evil mutator - for match in (True, False): - d = deque(['ab']) - d.extend([MutateCmp(d, match), 'c']) - self.assertRaises(IndexError, d.remove, 'c') - self.assertEqual(d, deque()) - - def test_repr(self): - d = deque(xrange(200)) - e = eval(repr(d)) - self.assertEqual(list(d), list(e)) - d.append(d) - self.assert_('...' in repr(d)) - - def test_print(self): - d = deque(xrange(200)) - d.append(d) - try: - fo = open(test_support.TESTFN, "wb") - print >> fo, d, - fo.close() - fo = open(test_support.TESTFN, "rb") - self.assertEqual(fo.read(), repr(d)) - finally: - fo.close() - os.remove(test_support.TESTFN) - - def test_init(self): - self.assertRaises(TypeError, deque, 'abc', 2); - self.assertRaises(TypeError, deque, 1); - - def test_hash(self): - self.assertRaises(TypeError, hash, deque('abc')) - - def test_long_steadystate_queue_popleft(self): - for size in (0, 1, 2, 100, 1000): - d = deque(xrange(size)) - append, pop = d.append, d.popleft - for i in xrange(size, BIG): - append(i) - x = pop() - if x != i - size: - self.assertEqual(x, i-size) - self.assertEqual(list(d), range(BIG-size, BIG)) - - def test_long_steadystate_queue_popright(self): - for size in (0, 1, 2, 100, 1000): - d = deque(reversed(xrange(size))) - append, pop = d.appendleft, d.pop - for i in xrange(size, BIG): - append(i) - x = pop() - if x != i - size: - self.assertEqual(x, i-size) - self.assertEqual(list(reversed(list(d))), range(BIG-size, BIG)) - - def test_big_queue_popleft(self): - pass - d = deque() - append, pop = d.append, d.popleft - for i in xrange(BIG): - append(i) - for i in xrange(BIG): - x = pop() - if x != i: - self.assertEqual(x, i) - - def test_big_queue_popright(self): - d = deque() - append, pop = d.appendleft, d.pop - for i in xrange(BIG): - append(i) - for i in xrange(BIG): - x = pop() - if x != i: - self.assertEqual(x, i) - - def test_big_stack_right(self): - d = deque() - append, pop = d.append, d.pop - for i in xrange(BIG): - append(i) - for i in reversed(xrange(BIG)): - x = pop() - if x != i: - self.assertEqual(x, i) - self.assertEqual(len(d), 0) - - def test_big_stack_left(self): - d = deque() - append, pop = d.appendleft, d.popleft - for i in xrange(BIG): - append(i) - for i in reversed(xrange(BIG)): - x = pop() - if x != i: - self.assertEqual(x, i) - self.assertEqual(len(d), 0) - - def test_roundtrip_iter_init(self): - d = deque(xrange(200)) - e = deque(d) - self.assertNotEqual(id(d), id(e)) - self.assertEqual(list(d), list(e)) - - def test_pickle(self): - d = deque(xrange(200)) - for i in (0, 1, 2): - s = pickle.dumps(d, i) - e = pickle.loads(s) - self.assertNotEqual(id(d), id(e)) - self.assertEqual(list(d), list(e)) - - def test_pickle_recursive(self): - d = deque('abc') - d.append(d) - for i in (0, 1, 2): - e = pickle.loads(pickle.dumps(d, i)) - self.assertNotEqual(id(d), id(e)) - self.assertEqual(id(e), id(e[-1])) - - def test_deepcopy(self): - mut = [10] - d = deque([mut]) - e = copy.deepcopy(d) - self.assertEqual(list(d), list(e)) - mut[0] = 11 - self.assertNotEqual(id(d), id(e)) - self.assertNotEqual(list(d), list(e)) - - def test_copy(self): - mut = [10] - d = deque([mut]) - e = copy.copy(d) - self.assertEqual(list(d), list(e)) - mut[0] = 11 - self.assertNotEqual(id(d), id(e)) - self.assertEqual(list(d), list(e)) - - def test_reversed(self): - for s in ('abcd', xrange(2000)): - self.assertEqual(list(reversed(deque(s))), list(reversed(s))) - - def test_gc_doesnt_blowup(self): - import gc - # This used to assert-fail in deque_traverse() under a debug - # build, or run wild with a NULL pointer in a release build. - d = deque() - for i in xrange(100): - d.append(1) - gc.collect() - -class TestVariousIteratorArgs(unittest.TestCase): - - def test_constructor(self): - for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): - for g in (seq_tests.Sequence, seq_tests.IterFunc, - seq_tests.IterGen, seq_tests.IterFuncStop, - seq_tests.itermulti, seq_tests.iterfunc): - self.assertEqual(list(deque(g(s))), list(g(s))) - self.assertRaises(TypeError, deque, seq_tests.IterNextOnly(s)) - self.assertRaises(TypeError, deque, seq_tests.IterNoNext(s)) - self.assertRaises(ZeroDivisionError, deque, seq_tests.IterGenExc(s)) - - def test_iter_with_altered_data(self): - d = deque('abcdefg') - it = iter(d) - d.pop() - self.assertRaises(RuntimeError, it.next) - - def test_runtime_error_on_empty_deque(self): - d = deque() - it = iter(d) - d.append(10) - self.assertRaises(RuntimeError, it.next) - -class Deque(deque): - pass - -class DequeWithBadIter(deque): - def __iter__(self): - raise TypeError - -class TestSubclass(unittest.TestCase): - - def test_basics(self): - d = Deque(xrange(100)) - d.__init__(xrange(100, 200)) - for i in xrange(200, 400): - d.append(i) - for i in reversed(xrange(-200, 0)): - d.appendleft(i) - self.assertEqual(list(d), range(-200, 400)) - self.assertEqual(len(d), 600) - - left = [d.popleft() for i in xrange(250)] - self.assertEqual(left, range(-200, 50)) - self.assertEqual(list(d), range(50, 400)) - - right = [d.pop() for i in xrange(250)] - right.reverse() - self.assertEqual(right, range(150, 400)) - self.assertEqual(list(d), range(50, 150)) - - d.clear() - self.assertEqual(len(d), 0) - - def test_copy_pickle(self): - - d = Deque('abc') - - e = d.__copy__() - self.assertEqual(type(d), type(e)) - self.assertEqual(list(d), list(e)) - - e = Deque(d) - self.assertEqual(type(d), type(e)) - self.assertEqual(list(d), list(e)) - - s = pickle.dumps(d) - e = pickle.loads(s) - self.assertNotEqual(id(d), id(e)) - self.assertEqual(type(d), type(e)) - self.assertEqual(list(d), list(e)) - - def test_pickle(self): - d = Deque('abc') - d.append(d) - - e = pickle.loads(pickle.dumps(d)) - self.assertNotEqual(id(d), id(e)) - self.assertEqual(type(d), type(e)) - dd = d.pop() - ee = e.pop() - self.assertEqual(id(e), id(ee)) - self.assertEqual(d, e) - - d.x = d - e = pickle.loads(pickle.dumps(d)) - self.assertEqual(id(e), id(e.x)) - - d = DequeWithBadIter('abc') - self.assertRaises(TypeError, pickle.dumps, d) - - def test_weakref(self): - d = deque('gallahad') - p = proxy(d) - self.assertEqual(str(p), str(d)) - d = None - self.assertRaises(ReferenceError, str, p) - - def test_strange_subclass(self): - class X(deque): - def __iter__(self): - return iter([]) - d1 = X([1,2,3]) - d2 = X([4,5,6]) - d1 == d2 # not clear if this is supposed to be True or False, - # but it used to give a SystemError - - -class SubclassWithKwargs(deque): - def __init__(self, newarg=1): - deque.__init__(self) - -class TestSubclassWithKwargs(unittest.TestCase): - def test_subclass_with_kwargs(self): - # SF bug #1486663 -- this used to erroneously raise a TypeError - SubclassWithKwargs(newarg=1) - -#============================================================================== - -libreftest = """ -Example from the Library Reference: Doc/lib/libcollections.tex - ->>> from collections import deque ->>> d = deque('ghi') # make a new deque with three items ->>> for elem in d: # iterate over the deque's elements -... print elem.upper() -G -H -I ->>> d.append('j') # add a new entry to the right side ->>> d.appendleft('f') # add a new entry to the left side ->>> d # show the representation of the deque -deque(['f', 'g', 'h', 'i', 'j']) ->>> d.pop() # return and remove the rightmost item -'j' ->>> d.popleft() # return and remove the leftmost item -'f' ->>> list(d) # list the contents of the deque -['g', 'h', 'i'] ->>> d[0] # peek at leftmost item -'g' ->>> d[-1] # peek at rightmost item -'i' ->>> list(reversed(d)) # list the contents of a deque in reverse -['i', 'h', 'g'] ->>> 'h' in d # search the deque -True ->>> d.extend('jkl') # add multiple elements at once ->>> d -deque(['g', 'h', 'i', 'j', 'k', 'l']) ->>> d.rotate(1) # right rotation ->>> d -deque(['l', 'g', 'h', 'i', 'j', 'k']) ->>> d.rotate(-1) # left rotation ->>> d -deque(['g', 'h', 'i', 'j', 'k', 'l']) ->>> deque(reversed(d)) # make a new deque in reverse order -deque(['l', 'k', 'j', 'i', 'h', 'g']) ->>> d.clear() # empty the deque ->>> d.pop() # cannot pop from an empty deque -Traceback (most recent call last): - File "", line 1, in -toplevel- - d.pop() -IndexError: pop from an empty deque - ->>> d.extendleft('abc') # extendleft() reverses the input order ->>> d -deque(['c', 'b', 'a']) - - - ->>> def delete_nth(d, n): -... d.rotate(-n) -... d.popleft() -... d.rotate(n) -... ->>> d = deque('abcdef') ->>> delete_nth(d, 2) # remove the entry at d[2] ->>> d -deque(['a', 'b', 'd', 'e', 'f']) - - - ->>> def roundrobin(*iterables): -... pending = deque(iter(i) for i in iterables) -... while pending: -... task = pending.popleft() -... try: -... yield task.next() -... except StopIteration: -... continue -... pending.append(task) -... - ->>> for value in roundrobin('abc', 'd', 'efgh'): -... print value -... -a -d -e -b -f -c -g -h - - ->>> def maketree(iterable): -... d = deque(iterable) -... while len(d) > 1: -... pair = [d.popleft(), d.popleft()] -... d.append(pair) -... return list(d) -... ->>> print maketree('abcdefgh') -[[[['a', 'b'], ['c', 'd']], [['e', 'f'], ['g', 'h']]]] - -""" - - -#============================================================================== - -__test__ = {'libreftest' : libreftest} - -def test_main(verbose=None): - import sys - test_classes = ( - TestBasic, - TestVariousIteratorArgs, - TestSubclass, - TestSubclassWithKwargs, - ) - - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - - # doctests - from test import test_deque - test_support.run_doctest(test_deque, verbose) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_descr.py b/sys/lib/python/test/test_descr.py deleted file mode 100644 index a29f404f5..000000000 --- a/sys/lib/python/test/test_descr.py +++ /dev/null @@ -1,4283 +0,0 @@ -# Test enhancements related to descriptors and new-style classes - -from test.test_support import verify, vereq, verbose, TestFailed, TESTFN, get_original_stdout -from copy import deepcopy -import warnings - -warnings.filterwarnings("ignore", - r'complex divmod\(\), // and % are deprecated$', - DeprecationWarning, r'(|%s)$' % __name__) - -def veris(a, b): - if a is not b: - raise TestFailed, "%r is %r" % (a, b) - -def testunop(a, res, expr="len(a)", meth="__len__"): - if verbose: print "checking", expr - dict = {'a': a} - vereq(eval(expr, dict), res) - t = type(a) - m = getattr(t, meth) - while meth not in t.__dict__: - t = t.__bases__[0] - vereq(m, t.__dict__[meth]) - vereq(m(a), res) - bm = getattr(a, meth) - vereq(bm(), res) - -def testbinop(a, b, res, expr="a+b", meth="__add__"): - if verbose: print "checking", expr - dict = {'a': a, 'b': b} - - # XXX Hack so this passes before 2.3 when -Qnew is specified. - if meth == "__div__" and 1/2 == 0.5: - meth = "__truediv__" - - vereq(eval(expr, dict), res) - t = type(a) - m = getattr(t, meth) - while meth not in t.__dict__: - t = t.__bases__[0] - vereq(m, t.__dict__[meth]) - vereq(m(a, b), res) - bm = getattr(a, meth) - vereq(bm(b), res) - -def testternop(a, b, c, res, expr="a[b:c]", meth="__getslice__"): - if verbose: print "checking", expr - dict = {'a': a, 'b': b, 'c': c} - vereq(eval(expr, dict), res) - t = type(a) - m = getattr(t, meth) - while meth not in t.__dict__: - t = t.__bases__[0] - vereq(m, t.__dict__[meth]) - vereq(m(a, b, c), res) - bm = getattr(a, meth) - vereq(bm(b, c), res) - -def testsetop(a, b, res, stmt="a+=b", meth="__iadd__"): - if verbose: print "checking", stmt - dict = {'a': deepcopy(a), 'b': b} - exec stmt in dict - vereq(dict['a'], res) - t = type(a) - m = getattr(t, meth) - while meth not in t.__dict__: - t = t.__bases__[0] - vereq(m, t.__dict__[meth]) - dict['a'] = deepcopy(a) - m(dict['a'], b) - vereq(dict['a'], res) - dict['a'] = deepcopy(a) - bm = getattr(dict['a'], meth) - bm(b) - vereq(dict['a'], res) - -def testset2op(a, b, c, res, stmt="a[b]=c", meth="__setitem__"): - if verbose: print "checking", stmt - dict = {'a': deepcopy(a), 'b': b, 'c': c} - exec stmt in dict - vereq(dict['a'], res) - t = type(a) - m = getattr(t, meth) - while meth not in t.__dict__: - t = t.__bases__[0] - vereq(m, t.__dict__[meth]) - dict['a'] = deepcopy(a) - m(dict['a'], b, c) - vereq(dict['a'], res) - dict['a'] = deepcopy(a) - bm = getattr(dict['a'], meth) - bm(b, c) - vereq(dict['a'], res) - -def testset3op(a, b, c, d, res, stmt="a[b:c]=d", meth="__setslice__"): - if verbose: print "checking", stmt - dict = {'a': deepcopy(a), 'b': b, 'c': c, 'd': d} - exec stmt in dict - vereq(dict['a'], res) - t = type(a) - while meth not in t.__dict__: - t = t.__bases__[0] - m = getattr(t, meth) - vereq(m, t.__dict__[meth]) - dict['a'] = deepcopy(a) - m(dict['a'], b, c, d) - vereq(dict['a'], res) - dict['a'] = deepcopy(a) - bm = getattr(dict['a'], meth) - bm(b, c, d) - vereq(dict['a'], res) - -def class_docstrings(): - class Classic: - "A classic docstring." - vereq(Classic.__doc__, "A classic docstring.") - vereq(Classic.__dict__['__doc__'], "A classic docstring.") - - class Classic2: - pass - verify(Classic2.__doc__ is None) - - class NewStatic(object): - "Another docstring." - vereq(NewStatic.__doc__, "Another docstring.") - vereq(NewStatic.__dict__['__doc__'], "Another docstring.") - - class NewStatic2(object): - pass - verify(NewStatic2.__doc__ is None) - - class NewDynamic(object): - "Another docstring." - vereq(NewDynamic.__doc__, "Another docstring.") - vereq(NewDynamic.__dict__['__doc__'], "Another docstring.") - - class NewDynamic2(object): - pass - verify(NewDynamic2.__doc__ is None) - -def lists(): - if verbose: print "Testing list operations..." - testbinop([1], [2], [1,2], "a+b", "__add__") - testbinop([1,2,3], 2, 1, "b in a", "__contains__") - testbinop([1,2,3], 4, 0, "b in a", "__contains__") - testbinop([1,2,3], 1, 2, "a[b]", "__getitem__") - testternop([1,2,3], 0, 2, [1,2], "a[b:c]", "__getslice__") - testsetop([1], [2], [1,2], "a+=b", "__iadd__") - testsetop([1,2], 3, [1,2,1,2,1,2], "a*=b", "__imul__") - testunop([1,2,3], 3, "len(a)", "__len__") - testbinop([1,2], 3, [1,2,1,2,1,2], "a*b", "__mul__") - testbinop([1,2], 3, [1,2,1,2,1,2], "b*a", "__rmul__") - testset2op([1,2], 1, 3, [1,3], "a[b]=c", "__setitem__") - testset3op([1,2,3,4], 1, 3, [5,6], [1,5,6,4], "a[b:c]=d", "__setslice__") - -def dicts(): - if verbose: print "Testing dict operations..." - testbinop({1:2}, {2:1}, -1, "cmp(a,b)", "__cmp__") - testbinop({1:2,3:4}, 1, 1, "b in a", "__contains__") - testbinop({1:2,3:4}, 2, 0, "b in a", "__contains__") - testbinop({1:2,3:4}, 1, 2, "a[b]", "__getitem__") - d = {1:2,3:4} - l1 = [] - for i in d.keys(): l1.append(i) - l = [] - for i in iter(d): l.append(i) - vereq(l, l1) - l = [] - for i in d.__iter__(): l.append(i) - vereq(l, l1) - l = [] - for i in dict.__iter__(d): l.append(i) - vereq(l, l1) - d = {1:2, 3:4} - testunop(d, 2, "len(a)", "__len__") - vereq(eval(repr(d), {}), d) - vereq(eval(d.__repr__(), {}), d) - testset2op({1:2,3:4}, 2, 3, {1:2,2:3,3:4}, "a[b]=c", "__setitem__") - -def dict_constructor(): - if verbose: - print "Testing dict constructor ..." - d = dict() - vereq(d, {}) - d = dict({}) - vereq(d, {}) - d = dict({1: 2, 'a': 'b'}) - vereq(d, {1: 2, 'a': 'b'}) - vereq(d, dict(d.items())) - vereq(d, dict(d.iteritems())) - d = dict({'one':1, 'two':2}) - vereq(d, dict(one=1, two=2)) - vereq(d, dict(**d)) - vereq(d, dict({"one": 1}, two=2)) - vereq(d, dict([("two", 2)], one=1)) - vereq(d, dict([("one", 100), ("two", 200)], **d)) - verify(d is not dict(**d)) - for badarg in 0, 0L, 0j, "0", [0], (0,): - try: - dict(badarg) - except TypeError: - pass - except ValueError: - if badarg == "0": - # It's a sequence, and its elements are also sequences (gotta - # love strings ), but they aren't of length 2, so this - # one seemed better as a ValueError than a TypeError. - pass - else: - raise TestFailed("no TypeError from dict(%r)" % badarg) - else: - raise TestFailed("no TypeError from dict(%r)" % badarg) - - try: - dict({}, {}) - except TypeError: - pass - else: - raise TestFailed("no TypeError from dict({}, {})") - - class Mapping: - # Lacks a .keys() method; will be added later. - dict = {1:2, 3:4, 'a':1j} - - try: - dict(Mapping()) - except TypeError: - pass - else: - raise TestFailed("no TypeError from dict(incomplete mapping)") - - Mapping.keys = lambda self: self.dict.keys() - Mapping.__getitem__ = lambda self, i: self.dict[i] - d = dict(Mapping()) - vereq(d, Mapping.dict) - - # Init from sequence of iterable objects, each producing a 2-sequence. - class AddressBookEntry: - def __init__(self, first, last): - self.first = first - self.last = last - def __iter__(self): - return iter([self.first, self.last]) - - d = dict([AddressBookEntry('Tim', 'Warsaw'), - AddressBookEntry('Barry', 'Peters'), - AddressBookEntry('Tim', 'Peters'), - AddressBookEntry('Barry', 'Warsaw')]) - vereq(d, {'Barry': 'Warsaw', 'Tim': 'Peters'}) - - d = dict(zip(range(4), range(1, 5))) - vereq(d, dict([(i, i+1) for i in range(4)])) - - # Bad sequence lengths. - for bad in [('tooshort',)], [('too', 'long', 'by 1')]: - try: - dict(bad) - except ValueError: - pass - else: - raise TestFailed("no ValueError from dict(%r)" % bad) - -def test_dir(): - if verbose: - print "Testing dir() ..." - junk = 12 - vereq(dir(), ['junk']) - del junk - - # Just make sure these don't blow up! - for arg in 2, 2L, 2j, 2e0, [2], "2", u"2", (2,), {2:2}, type, test_dir: - dir(arg) - - # Try classic classes. - class C: - Cdata = 1 - def Cmethod(self): pass - - cstuff = ['Cdata', 'Cmethod', '__doc__', '__module__'] - vereq(dir(C), cstuff) - verify('im_self' in dir(C.Cmethod)) - - c = C() # c.__doc__ is an odd thing to see here; ditto c.__module__. - vereq(dir(c), cstuff) - - c.cdata = 2 - c.cmethod = lambda self: 0 - vereq(dir(c), cstuff + ['cdata', 'cmethod']) - verify('im_self' in dir(c.Cmethod)) - - class A(C): - Adata = 1 - def Amethod(self): pass - - astuff = ['Adata', 'Amethod'] + cstuff - vereq(dir(A), astuff) - verify('im_self' in dir(A.Amethod)) - a = A() - vereq(dir(a), astuff) - verify('im_self' in dir(a.Amethod)) - a.adata = 42 - a.amethod = lambda self: 3 - vereq(dir(a), astuff + ['adata', 'amethod']) - - # The same, but with new-style classes. Since these have object as a - # base class, a lot more gets sucked in. - def interesting(strings): - return [s for s in strings if not s.startswith('_')] - - class C(object): - Cdata = 1 - def Cmethod(self): pass - - cstuff = ['Cdata', 'Cmethod'] - vereq(interesting(dir(C)), cstuff) - - c = C() - vereq(interesting(dir(c)), cstuff) - verify('im_self' in dir(C.Cmethod)) - - c.cdata = 2 - c.cmethod = lambda self: 0 - vereq(interesting(dir(c)), cstuff + ['cdata', 'cmethod']) - verify('im_self' in dir(c.Cmethod)) - - class A(C): - Adata = 1 - def Amethod(self): pass - - astuff = ['Adata', 'Amethod'] + cstuff - vereq(interesting(dir(A)), astuff) - verify('im_self' in dir(A.Amethod)) - a = A() - vereq(interesting(dir(a)), astuff) - a.adata = 42 - a.amethod = lambda self: 3 - vereq(interesting(dir(a)), astuff + ['adata', 'amethod']) - verify('im_self' in dir(a.Amethod)) - - # Try a module subclass. - import sys - class M(type(sys)): - pass - minstance = M("m") - minstance.b = 2 - minstance.a = 1 - names = [x for x in dir(minstance) if x not in ["__name__", "__doc__"]] - vereq(names, ['a', 'b']) - - class M2(M): - def getdict(self): - return "Not a dict!" - __dict__ = property(getdict) - - m2instance = M2("m2") - m2instance.b = 2 - m2instance.a = 1 - vereq(m2instance.__dict__, "Not a dict!") - try: - dir(m2instance) - except TypeError: - pass - - # Two essentially featureless objects, just inheriting stuff from - # object. - vereq(dir(None), dir(Ellipsis)) - - # Nasty test case for proxied objects - class Wrapper(object): - def __init__(self, obj): - self.__obj = obj - def __repr__(self): - return "Wrapper(%s)" % repr(self.__obj) - def __getitem__(self, key): - return Wrapper(self.__obj[key]) - def __len__(self): - return len(self.__obj) - def __getattr__(self, name): - return Wrapper(getattr(self.__obj, name)) - - class C(object): - def __getclass(self): - return Wrapper(type(self)) - __class__ = property(__getclass) - - dir(C()) # This used to segfault - -binops = { - 'add': '+', - 'sub': '-', - 'mul': '*', - 'div': '/', - 'mod': '%', - 'divmod': 'divmod', - 'pow': '**', - 'lshift': '<<', - 'rshift': '>>', - 'and': '&', - 'xor': '^', - 'or': '|', - 'cmp': 'cmp', - 'lt': '<', - 'le': '<=', - 'eq': '==', - 'ne': '!=', - 'gt': '>', - 'ge': '>=', - } - -for name, expr in binops.items(): - if expr.islower(): - expr = expr + "(a, b)" - else: - expr = 'a %s b' % expr - binops[name] = expr - -unops = { - 'pos': '+', - 'neg': '-', - 'abs': 'abs', - 'invert': '~', - 'int': 'int', - 'long': 'long', - 'float': 'float', - 'oct': 'oct', - 'hex': 'hex', - } - -for name, expr in unops.items(): - if expr.islower(): - expr = expr + "(a)" - else: - expr = '%s a' % expr - unops[name] = expr - -def numops(a, b, skip=[]): - dict = {'a': a, 'b': b} - for name, expr in binops.items(): - if name not in skip: - name = "__%s__" % name - if hasattr(a, name): - res = eval(expr, dict) - testbinop(a, b, res, expr, name) - for name, expr in unops.items(): - if name not in skip: - name = "__%s__" % name - if hasattr(a, name): - res = eval(expr, dict) - testunop(a, res, expr, name) - -def ints(): - if verbose: print "Testing int operations..." - numops(100, 3) - # The following crashes in Python 2.2 - vereq((1).__nonzero__(), 1) - vereq((0).__nonzero__(), 0) - # This returns 'NotImplemented' in Python 2.2 - class C(int): - def __add__(self, other): - return NotImplemented - vereq(C(5L), 5) - try: - C() + "" - except TypeError: - pass - else: - raise TestFailed, "NotImplemented should have caused TypeError" - import sys - try: - C(sys.maxint+1) - except OverflowError: - pass - else: - raise TestFailed, "should have raised OverflowError" - -def longs(): - if verbose: print "Testing long operations..." - numops(100L, 3L) - -def floats(): - if verbose: print "Testing float operations..." - numops(100.0, 3.0) - -def complexes(): - if verbose: print "Testing complex operations..." - numops(100.0j, 3.0j, skip=['lt', 'le', 'gt', 'ge', 'int', 'long', 'float']) - class Number(complex): - __slots__ = ['prec'] - def __new__(cls, *args, **kwds): - result = complex.__new__(cls, *args) - result.prec = kwds.get('prec', 12) - return result - def __repr__(self): - prec = self.prec - if self.imag == 0.0: - return "%.*g" % (prec, self.real) - if self.real == 0.0: - return "%.*gj" % (prec, self.imag) - return "(%.*g+%.*gj)" % (prec, self.real, prec, self.imag) - __str__ = __repr__ - - a = Number(3.14, prec=6) - vereq(repr(a), "3.14") - vereq(a.prec, 6) - - a = Number(a, prec=2) - vereq(repr(a), "3.1") - vereq(a.prec, 2) - - a = Number(234.5) - vereq(repr(a), "234.5") - vereq(a.prec, 12) - -def spamlists(): - if verbose: print "Testing spamlist operations..." - import copy, xxsubtype as spam - def spamlist(l, memo=None): - import xxsubtype as spam - return spam.spamlist(l) - # This is an ugly hack: - copy._deepcopy_dispatch[spam.spamlist] = spamlist - - testbinop(spamlist([1]), spamlist([2]), spamlist([1,2]), "a+b", "__add__") - testbinop(spamlist([1,2,3]), 2, 1, "b in a", "__contains__") - testbinop(spamlist([1,2,3]), 4, 0, "b in a", "__contains__") - testbinop(spamlist([1,2,3]), 1, 2, "a[b]", "__getitem__") - testternop(spamlist([1,2,3]), 0, 2, spamlist([1,2]), - "a[b:c]", "__getslice__") - testsetop(spamlist([1]), spamlist([2]), spamlist([1,2]), - "a+=b", "__iadd__") - testsetop(spamlist([1,2]), 3, spamlist([1,2,1,2,1,2]), "a*=b", "__imul__") - testunop(spamlist([1,2,3]), 3, "len(a)", "__len__") - testbinop(spamlist([1,2]), 3, spamlist([1,2,1,2,1,2]), "a*b", "__mul__") - testbinop(spamlist([1,2]), 3, spamlist([1,2,1,2,1,2]), "b*a", "__rmul__") - testset2op(spamlist([1,2]), 1, 3, spamlist([1,3]), "a[b]=c", "__setitem__") - testset3op(spamlist([1,2,3,4]), 1, 3, spamlist([5,6]), - spamlist([1,5,6,4]), "a[b:c]=d", "__setslice__") - # Test subclassing - class C(spam.spamlist): - def foo(self): return 1 - a = C() - vereq(a, []) - vereq(a.foo(), 1) - a.append(100) - vereq(a, [100]) - vereq(a.getstate(), 0) - a.setstate(42) - vereq(a.getstate(), 42) - -def spamdicts(): - if verbose: print "Testing spamdict operations..." - import copy, xxsubtype as spam - def spamdict(d, memo=None): - import xxsubtype as spam - sd = spam.spamdict() - for k, v in d.items(): sd[k] = v - return sd - # This is an ugly hack: - copy._deepcopy_dispatch[spam.spamdict] = spamdict - - testbinop(spamdict({1:2}), spamdict({2:1}), -1, "cmp(a,b)", "__cmp__") - testbinop(spamdict({1:2,3:4}), 1, 1, "b in a", "__contains__") - testbinop(spamdict({1:2,3:4}), 2, 0, "b in a", "__contains__") - testbinop(spamdict({1:2,3:4}), 1, 2, "a[b]", "__getitem__") - d = spamdict({1:2,3:4}) - l1 = [] - for i in d.keys(): l1.append(i) - l = [] - for i in iter(d): l.append(i) - vereq(l, l1) - l = [] - for i in d.__iter__(): l.append(i) - vereq(l, l1) - l = [] - for i in type(spamdict({})).__iter__(d): l.append(i) - vereq(l, l1) - straightd = {1:2, 3:4} - spamd = spamdict(straightd) - testunop(spamd, 2, "len(a)", "__len__") - testunop(spamd, repr(straightd), "repr(a)", "__repr__") - testset2op(spamdict({1:2,3:4}), 2, 3, spamdict({1:2,2:3,3:4}), - "a[b]=c", "__setitem__") - # Test subclassing - class C(spam.spamdict): - def foo(self): return 1 - a = C() - vereq(a.items(), []) - vereq(a.foo(), 1) - a['foo'] = 'bar' - vereq(a.items(), [('foo', 'bar')]) - vereq(a.getstate(), 0) - a.setstate(100) - vereq(a.getstate(), 100) - -def pydicts(): - if verbose: print "Testing Python subclass of dict..." - verify(issubclass(dict, dict)) - verify(isinstance({}, dict)) - d = dict() - vereq(d, {}) - verify(d.__class__ is dict) - verify(isinstance(d, dict)) - class C(dict): - state = -1 - def __init__(self, *a, **kw): - if a: - vereq(len(a), 1) - self.state = a[0] - if kw: - for k, v in kw.items(): self[v] = k - def __getitem__(self, key): - return self.get(key, 0) - def __setitem__(self, key, value): - verify(isinstance(key, type(0))) - dict.__setitem__(self, key, value) - def setstate(self, state): - self.state = state - def getstate(self): - return self.state - verify(issubclass(C, dict)) - a1 = C(12) - vereq(a1.state, 12) - a2 = C(foo=1, bar=2) - vereq(a2[1] == 'foo' and a2[2], 'bar') - a = C() - vereq(a.state, -1) - vereq(a.getstate(), -1) - a.setstate(0) - vereq(a.state, 0) - vereq(a.getstate(), 0) - a.setstate(10) - vereq(a.state, 10) - vereq(a.getstate(), 10) - vereq(a[42], 0) - a[42] = 24 - vereq(a[42], 24) - if verbose: print "pydict stress test ..." - N = 50 - for i in range(N): - a[i] = C() - for j in range(N): - a[i][j] = i*j - for i in range(N): - for j in range(N): - vereq(a[i][j], i*j) - -def pylists(): - if verbose: print "Testing Python subclass of list..." - class C(list): - def __getitem__(self, i): - return list.__getitem__(self, i) + 100 - def __getslice__(self, i, j): - return (i, j) - a = C() - a.extend([0,1,2]) - vereq(a[0], 100) - vereq(a[1], 101) - vereq(a[2], 102) - vereq(a[100:200], (100,200)) - -def metaclass(): - if verbose: print "Testing __metaclass__..." - class C: - __metaclass__ = type - def __init__(self): - self.__state = 0 - def getstate(self): - return self.__state - def setstate(self, state): - self.__state = state - a = C() - vereq(a.getstate(), 0) - a.setstate(10) - vereq(a.getstate(), 10) - class D: - class __metaclass__(type): - def myself(cls): return cls - vereq(D.myself(), D) - d = D() - verify(d.__class__ is D) - class M1(type): - def __new__(cls, name, bases, dict): - dict['__spam__'] = 1 - return type.__new__(cls, name, bases, dict) - class C: - __metaclass__ = M1 - vereq(C.__spam__, 1) - c = C() - vereq(c.__spam__, 1) - - class _instance(object): - pass - class M2(object): - @staticmethod - def __new__(cls, name, bases, dict): - self = object.__new__(cls) - self.name = name - self.bases = bases - self.dict = dict - return self - def __call__(self): - it = _instance() - # Early binding of methods - for key in self.dict: - if key.startswith("__"): - continue - setattr(it, key, self.dict[key].__get__(it, self)) - return it - class C: - __metaclass__ = M2 - def spam(self): - return 42 - vereq(C.name, 'C') - vereq(C.bases, ()) - verify('spam' in C.dict) - c = C() - vereq(c.spam(), 42) - - # More metaclass examples - - class autosuper(type): - # Automatically add __super to the class - # This trick only works for dynamic classes - def __new__(metaclass, name, bases, dict): - cls = super(autosuper, metaclass).__new__(metaclass, - name, bases, dict) - # Name mangling for __super removes leading underscores - while name[:1] == "_": - name = name[1:] - if name: - name = "_%s__super" % name - else: - name = "__super" - setattr(cls, name, super(cls)) - return cls - class A: - __metaclass__ = autosuper - def meth(self): - return "A" - class B(A): - def meth(self): - return "B" + self.__super.meth() - class C(A): - def meth(self): - return "C" + self.__super.meth() - class D(C, B): - def meth(self): - return "D" + self.__super.meth() - vereq(D().meth(), "DCBA") - class E(B, C): - def meth(self): - return "E" + self.__super.meth() - vereq(E().meth(), "EBCA") - - class autoproperty(type): - # Automatically create property attributes when methods - # named _get_x and/or _set_x are found - def __new__(metaclass, name, bases, dict): - hits = {} - for key, val in dict.iteritems(): - if key.startswith("_get_"): - key = key[5:] - get, set = hits.get(key, (None, None)) - get = val - hits[key] = get, set - elif key.startswith("_set_"): - key = key[5:] - get, set = hits.get(key, (None, None)) - set = val - hits[key] = get, set - for key, (get, set) in hits.iteritems(): - dict[key] = property(get, set) - return super(autoproperty, metaclass).__new__(metaclass, - name, bases, dict) - class A: - __metaclass__ = autoproperty - def _get_x(self): - return -self.__x - def _set_x(self, x): - self.__x = -x - a = A() - verify(not hasattr(a, "x")) - a.x = 12 - vereq(a.x, 12) - vereq(a._A__x, -12) - - class multimetaclass(autoproperty, autosuper): - # Merge of multiple cooperating metaclasses - pass - class A: - __metaclass__ = multimetaclass - def _get_x(self): - return "A" - class B(A): - def _get_x(self): - return "B" + self.__super._get_x() - class C(A): - def _get_x(self): - return "C" + self.__super._get_x() - class D(C, B): - def _get_x(self): - return "D" + self.__super._get_x() - vereq(D().x, "DCBA") - - # Make sure type(x) doesn't call x.__class__.__init__ - class T(type): - counter = 0 - def __init__(self, *args): - T.counter += 1 - class C: - __metaclass__ = T - vereq(T.counter, 1) - a = C() - vereq(type(a), C) - vereq(T.counter, 1) - - class C(object): pass - c = C() - try: c() - except TypeError: pass - else: raise TestFailed, "calling object w/o call method should raise TypeError" - -def pymods(): - if verbose: print "Testing Python subclass of module..." - log = [] - import sys - MT = type(sys) - class MM(MT): - def __init__(self, name): - MT.__init__(self, name) - def __getattribute__(self, name): - log.append(("getattr", name)) - return MT.__getattribute__(self, name) - def __setattr__(self, name, value): - log.append(("setattr", name, value)) - MT.__setattr__(self, name, value) - def __delattr__(self, name): - log.append(("delattr", name)) - MT.__delattr__(self, name) - a = MM("a") - a.foo = 12 - x = a.foo - del a.foo - vereq(log, [("setattr", "foo", 12), - ("getattr", "foo"), - ("delattr", "foo")]) - -def multi(): - if verbose: print "Testing multiple inheritance..." - class C(object): - def __init__(self): - self.__state = 0 - def getstate(self): - return self.__state - def setstate(self, state): - self.__state = state - a = C() - vereq(a.getstate(), 0) - a.setstate(10) - vereq(a.getstate(), 10) - class D(dict, C): - def __init__(self): - type({}).__init__(self) - C.__init__(self) - d = D() - vereq(d.keys(), []) - d["hello"] = "world" - vereq(d.items(), [("hello", "world")]) - vereq(d["hello"], "world") - vereq(d.getstate(), 0) - d.setstate(10) - vereq(d.getstate(), 10) - vereq(D.__mro__, (D, dict, C, object)) - - # SF bug #442833 - class Node(object): - def __int__(self): - return int(self.foo()) - def foo(self): - return "23" - class Frag(Node, list): - def foo(self): - return "42" - vereq(Node().__int__(), 23) - vereq(int(Node()), 23) - vereq(Frag().__int__(), 42) - vereq(int(Frag()), 42) - - # MI mixing classic and new-style classes. - - class A: - x = 1 - - class B(A): - pass - - class C(A): - x = 2 - - class D(B, C): - pass - vereq(D.x, 1) - - # Classic MRO is preserved for a classic base class. - class E(D, object): - pass - vereq(E.__mro__, (E, D, B, A, C, object)) - vereq(E.x, 1) - - # But with a mix of classic bases, their MROs are combined using - # new-style MRO. - class F(B, C, object): - pass - vereq(F.__mro__, (F, B, C, A, object)) - vereq(F.x, 2) - - # Try something else. - class C: - def cmethod(self): - return "C a" - def all_method(self): - return "C b" - - class M1(C, object): - def m1method(self): - return "M1 a" - def all_method(self): - return "M1 b" - - vereq(M1.__mro__, (M1, C, object)) - m = M1() - vereq(m.cmethod(), "C a") - vereq(m.m1method(), "M1 a") - vereq(m.all_method(), "M1 b") - - class D(C): - def dmethod(self): - return "D a" - def all_method(self): - return "D b" - - class M2(D, object): - def m2method(self): - return "M2 a" - def all_method(self): - return "M2 b" - - vereq(M2.__mro__, (M2, D, C, object)) - m = M2() - vereq(m.cmethod(), "C a") - vereq(m.dmethod(), "D a") - vereq(m.m2method(), "M2 a") - vereq(m.all_method(), "M2 b") - - class M3(M1, M2, object): - def m3method(self): - return "M3 a" - def all_method(self): - return "M3 b" - vereq(M3.__mro__, (M3, M1, M2, D, C, object)) - m = M3() - vereq(m.cmethod(), "C a") - vereq(m.dmethod(), "D a") - vereq(m.m1method(), "M1 a") - vereq(m.m2method(), "M2 a") - vereq(m.m3method(), "M3 a") - vereq(m.all_method(), "M3 b") - - class Classic: - pass - try: - class New(Classic): - __metaclass__ = type - except TypeError: - pass - else: - raise TestFailed, "new class with only classic bases - shouldn't be" - -def diamond(): - if verbose: print "Testing multiple inheritance special cases..." - class A(object): - def spam(self): return "A" - vereq(A().spam(), "A") - class B(A): - def boo(self): return "B" - def spam(self): return "B" - vereq(B().spam(), "B") - vereq(B().boo(), "B") - class C(A): - def boo(self): return "C" - vereq(C().spam(), "A") - vereq(C().boo(), "C") - class D(B, C): pass - vereq(D().spam(), "B") - vereq(D().boo(), "B") - vereq(D.__mro__, (D, B, C, A, object)) - class E(C, B): pass - vereq(E().spam(), "B") - vereq(E().boo(), "C") - vereq(E.__mro__, (E, C, B, A, object)) - # MRO order disagreement - try: - class F(D, E): pass - except TypeError: - pass - else: - raise TestFailed, "expected MRO order disagreement (F)" - try: - class G(E, D): pass - except TypeError: - pass - else: - raise TestFailed, "expected MRO order disagreement (G)" - - -# see thread python-dev/2002-October/029035.html -def ex5(): - if verbose: print "Testing ex5 from C3 switch discussion..." - class A(object): pass - class B(object): pass - class C(object): pass - class X(A): pass - class Y(A): pass - class Z(X,B,Y,C): pass - vereq(Z.__mro__, (Z, X, B, Y, A, C, object)) - -# see "A Monotonic Superclass Linearization for Dylan", -# by Kim Barrett et al. (OOPSLA 1996) -def monotonicity(): - if verbose: print "Testing MRO monotonicity..." - class Boat(object): pass - class DayBoat(Boat): pass - class WheelBoat(Boat): pass - class EngineLess(DayBoat): pass - class SmallMultihull(DayBoat): pass - class PedalWheelBoat(EngineLess,WheelBoat): pass - class SmallCatamaran(SmallMultihull): pass - class Pedalo(PedalWheelBoat,SmallCatamaran): pass - - vereq(PedalWheelBoat.__mro__, - (PedalWheelBoat, EngineLess, DayBoat, WheelBoat, Boat, - object)) - vereq(SmallCatamaran.__mro__, - (SmallCatamaran, SmallMultihull, DayBoat, Boat, object)) - - vereq(Pedalo.__mro__, - (Pedalo, PedalWheelBoat, EngineLess, SmallCatamaran, - SmallMultihull, DayBoat, WheelBoat, Boat, object)) - -# see "A Monotonic Superclass Linearization for Dylan", -# by Kim Barrett et al. (OOPSLA 1996) -def consistency_with_epg(): - if verbose: print "Testing consistentcy with EPG..." - class Pane(object): pass - class ScrollingMixin(object): pass - class EditingMixin(object): pass - class ScrollablePane(Pane,ScrollingMixin): pass - class EditablePane(Pane,EditingMixin): pass - class EditableScrollablePane(ScrollablePane,EditablePane): pass - - vereq(EditableScrollablePane.__mro__, - (EditableScrollablePane, ScrollablePane, EditablePane, - Pane, ScrollingMixin, EditingMixin, object)) - -mro_err_msg = """Cannot create a consistent method resolution -order (MRO) for bases """ - -def mro_disagreement(): - if verbose: print "Testing error messages for MRO disagreement..." - def raises(exc, expected, callable, *args): - try: - callable(*args) - except exc, msg: - if not str(msg).startswith(expected): - raise TestFailed, "Message %r, expected %r" % (str(msg), - expected) - else: - raise TestFailed, "Expected %s" % exc - class A(object): pass - class B(A): pass - class C(object): pass - # Test some very simple errors - raises(TypeError, "duplicate base class A", - type, "X", (A, A), {}) - raises(TypeError, mro_err_msg, - type, "X", (A, B), {}) - raises(TypeError, mro_err_msg, - type, "X", (A, C, B), {}) - # Test a slightly more complex error - class GridLayout(object): pass - class HorizontalGrid(GridLayout): pass - class VerticalGrid(GridLayout): pass - class HVGrid(HorizontalGrid, VerticalGrid): pass - class VHGrid(VerticalGrid, HorizontalGrid): pass - raises(TypeError, mro_err_msg, - type, "ConfusedGrid", (HVGrid, VHGrid), {}) - -def objects(): - if verbose: print "Testing object class..." - a = object() - vereq(a.__class__, object) - vereq(type(a), object) - b = object() - verify(a is not b) - verify(not hasattr(a, "foo")) - try: - a.foo = 12 - except (AttributeError, TypeError): - pass - else: - verify(0, "object() should not allow setting a foo attribute") - verify(not hasattr(object(), "__dict__")) - - class Cdict(object): - pass - x = Cdict() - vereq(x.__dict__, {}) - x.foo = 1 - vereq(x.foo, 1) - vereq(x.__dict__, {'foo': 1}) - -def slots(): - if verbose: print "Testing __slots__..." - class C0(object): - __slots__ = [] - x = C0() - verify(not hasattr(x, "__dict__")) - verify(not hasattr(x, "foo")) - - class C1(object): - __slots__ = ['a'] - x = C1() - verify(not hasattr(x, "__dict__")) - verify(not hasattr(x, "a")) - x.a = 1 - vereq(x.a, 1) - x.a = None - veris(x.a, None) - del x.a - verify(not hasattr(x, "a")) - - class C3(object): - __slots__ = ['a', 'b', 'c'] - x = C3() - verify(not hasattr(x, "__dict__")) - verify(not hasattr(x, 'a')) - verify(not hasattr(x, 'b')) - verify(not hasattr(x, 'c')) - x.a = 1 - x.b = 2 - x.c = 3 - vereq(x.a, 1) - vereq(x.b, 2) - vereq(x.c, 3) - - class C4(object): - """Validate name mangling""" - __slots__ = ['__a'] - def __init__(self, value): - self.__a = value - def get(self): - return self.__a - x = C4(5) - verify(not hasattr(x, '__dict__')) - verify(not hasattr(x, '__a')) - vereq(x.get(), 5) - try: - x.__a = 6 - except AttributeError: - pass - else: - raise TestFailed, "Double underscored names not mangled" - - # Make sure slot names are proper identifiers - try: - class C(object): - __slots__ = [None] - except TypeError: - pass - else: - raise TestFailed, "[None] slots not caught" - try: - class C(object): - __slots__ = ["foo bar"] - except TypeError: - pass - else: - raise TestFailed, "['foo bar'] slots not caught" - try: - class C(object): - __slots__ = ["foo\0bar"] - except TypeError: - pass - else: - raise TestFailed, "['foo\\0bar'] slots not caught" - try: - class C(object): - __slots__ = ["1"] - except TypeError: - pass - else: - raise TestFailed, "['1'] slots not caught" - try: - class C(object): - __slots__ = [""] - except TypeError: - pass - else: - raise TestFailed, "[''] slots not caught" - class C(object): - __slots__ = ["a", "a_b", "_a", "A0123456789Z"] - - # Test unicode slot names - try: - unichr - except NameError: - pass - else: - # _unicode_to_string used to modify slots in certain circumstances - slots = (unicode("foo"), unicode("bar")) - class C(object): - __slots__ = slots - x = C() - x.foo = 5 - vereq(x.foo, 5) - veris(type(slots[0]), unicode) - # this used to leak references - try: - class C(object): - __slots__ = [unichr(128)] - except (TypeError, UnicodeEncodeError): - pass - else: - raise TestFailed, "[unichr(128)] slots not caught" - - # Test leaks - class Counted(object): - counter = 0 # counts the number of instances alive - def __init__(self): - Counted.counter += 1 - def __del__(self): - Counted.counter -= 1 - class C(object): - __slots__ = ['a', 'b', 'c'] - x = C() - x.a = Counted() - x.b = Counted() - x.c = Counted() - vereq(Counted.counter, 3) - del x - vereq(Counted.counter, 0) - class D(C): - pass - x = D() - x.a = Counted() - x.z = Counted() - vereq(Counted.counter, 2) - del x - vereq(Counted.counter, 0) - class E(D): - __slots__ = ['e'] - x = E() - x.a = Counted() - x.z = Counted() - x.e = Counted() - vereq(Counted.counter, 3) - del x - vereq(Counted.counter, 0) - - # Test cyclical leaks [SF bug 519621] - class F(object): - __slots__ = ['a', 'b'] - log = [] - s = F() - s.a = [Counted(), s] - vereq(Counted.counter, 1) - s = None - import gc - gc.collect() - vereq(Counted.counter, 0) - - # Test lookup leaks [SF bug 572567] - import sys,gc - class G(object): - def __cmp__(self, other): - return 0 - g = G() - orig_objects = len(gc.get_objects()) - for i in xrange(10): - g==g - new_objects = len(gc.get_objects()) - vereq(orig_objects, new_objects) - class H(object): - __slots__ = ['a', 'b'] - def __init__(self): - self.a = 1 - self.b = 2 - def __del__(self): - assert self.a == 1 - assert self.b == 2 - - save_stderr = sys.stderr - sys.stderr = sys.stdout - h = H() - try: - del h - finally: - sys.stderr = save_stderr - -def slotspecials(): - if verbose: print "Testing __dict__ and __weakref__ in __slots__..." - - class D(object): - __slots__ = ["__dict__"] - a = D() - verify(hasattr(a, "__dict__")) - verify(not hasattr(a, "__weakref__")) - a.foo = 42 - vereq(a.__dict__, {"foo": 42}) - - class W(object): - __slots__ = ["__weakref__"] - a = W() - verify(hasattr(a, "__weakref__")) - verify(not hasattr(a, "__dict__")) - try: - a.foo = 42 - except AttributeError: - pass - else: - raise TestFailed, "shouldn't be allowed to set a.foo" - - class C1(W, D): - __slots__ = [] - a = C1() - verify(hasattr(a, "__dict__")) - verify(hasattr(a, "__weakref__")) - a.foo = 42 - vereq(a.__dict__, {"foo": 42}) - - class C2(D, W): - __slots__ = [] - a = C2() - verify(hasattr(a, "__dict__")) - verify(hasattr(a, "__weakref__")) - a.foo = 42 - vereq(a.__dict__, {"foo": 42}) - -# MRO order disagreement -# -# class C3(C1, C2): -# __slots__ = [] -# -# class C4(C2, C1): -# __slots__ = [] - -def dynamics(): - if verbose: print "Testing class attribute propagation..." - class D(object): - pass - class E(D): - pass - class F(D): - pass - D.foo = 1 - vereq(D.foo, 1) - # Test that dynamic attributes are inherited - vereq(E.foo, 1) - vereq(F.foo, 1) - # Test dynamic instances - class C(object): - pass - a = C() - verify(not hasattr(a, "foobar")) - C.foobar = 2 - vereq(a.foobar, 2) - C.method = lambda self: 42 - vereq(a.method(), 42) - C.__repr__ = lambda self: "C()" - vereq(repr(a), "C()") - C.__int__ = lambda self: 100 - vereq(int(a), 100) - vereq(a.foobar, 2) - verify(not hasattr(a, "spam")) - def mygetattr(self, name): - if name == "spam": - return "spam" - raise AttributeError - C.__getattr__ = mygetattr - vereq(a.spam, "spam") - a.new = 12 - vereq(a.new, 12) - def mysetattr(self, name, value): - if name == "spam": - raise AttributeError - return object.__setattr__(self, name, value) - C.__setattr__ = mysetattr - try: - a.spam = "not spam" - except AttributeError: - pass - else: - verify(0, "expected AttributeError") - vereq(a.spam, "spam") - class D(C): - pass - d = D() - d.foo = 1 - vereq(d.foo, 1) - - # Test handling of int*seq and seq*int - class I(int): - pass - vereq("a"*I(2), "aa") - vereq(I(2)*"a", "aa") - vereq(2*I(3), 6) - vereq(I(3)*2, 6) - vereq(I(3)*I(2), 6) - - # Test handling of long*seq and seq*long - class L(long): - pass - vereq("a"*L(2L), "aa") - vereq(L(2L)*"a", "aa") - vereq(2*L(3), 6) - vereq(L(3)*2, 6) - vereq(L(3)*L(2), 6) - - # Test comparison of classes with dynamic metaclasses - class dynamicmetaclass(type): - pass - class someclass: - __metaclass__ = dynamicmetaclass - verify(someclass != object) - -def errors(): - if verbose: print "Testing errors..." - - try: - class C(list, dict): - pass - except TypeError: - pass - else: - verify(0, "inheritance from both list and dict should be illegal") - - try: - class C(object, None): - pass - except TypeError: - pass - else: - verify(0, "inheritance from non-type should be illegal") - class Classic: - pass - - try: - class C(type(len)): - pass - except TypeError: - pass - else: - verify(0, "inheritance from CFunction should be illegal") - - try: - class C(object): - __slots__ = 1 - except TypeError: - pass - else: - verify(0, "__slots__ = 1 should be illegal") - - try: - class C(object): - __slots__ = [1] - except TypeError: - pass - else: - verify(0, "__slots__ = [1] should be illegal") - -def classmethods(): - if verbose: print "Testing class methods..." - class C(object): - def foo(*a): return a - goo = classmethod(foo) - c = C() - vereq(C.goo(1), (C, 1)) - vereq(c.goo(1), (C, 1)) - vereq(c.foo(1), (c, 1)) - class D(C): - pass - d = D() - vereq(D.goo(1), (D, 1)) - vereq(d.goo(1), (D, 1)) - vereq(d.foo(1), (d, 1)) - vereq(D.foo(d, 1), (d, 1)) - # Test for a specific crash (SF bug 528132) - def f(cls, arg): return (cls, arg) - ff = classmethod(f) - vereq(ff.__get__(0, int)(42), (int, 42)) - vereq(ff.__get__(0)(42), (int, 42)) - - # Test super() with classmethods (SF bug 535444) - veris(C.goo.im_self, C) - veris(D.goo.im_self, D) - veris(super(D,D).goo.im_self, D) - veris(super(D,d).goo.im_self, D) - vereq(super(D,D).goo(), (D,)) - vereq(super(D,d).goo(), (D,)) - - # Verify that argument is checked for callability (SF bug 753451) - try: - classmethod(1).__get__(1) - except TypeError: - pass - else: - raise TestFailed, "classmethod should check for callability" - - # Verify that classmethod() doesn't allow keyword args - try: - classmethod(f, kw=1) - except TypeError: - pass - else: - raise TestFailed, "classmethod shouldn't accept keyword args" - -def classmethods_in_c(): - if verbose: print "Testing C-based class methods..." - import xxsubtype as spam - a = (1, 2, 3) - d = {'abc': 123} - x, a1, d1 = spam.spamlist.classmeth(*a, **d) - veris(x, spam.spamlist) - vereq(a, a1) - vereq(d, d1) - x, a1, d1 = spam.spamlist().classmeth(*a, **d) - veris(x, spam.spamlist) - vereq(a, a1) - vereq(d, d1) - -def staticmethods(): - if verbose: print "Testing static methods..." - class C(object): - def foo(*a): return a - goo = staticmethod(foo) - c = C() - vereq(C.goo(1), (1,)) - vereq(c.goo(1), (1,)) - vereq(c.foo(1), (c, 1,)) - class D(C): - pass - d = D() - vereq(D.goo(1), (1,)) - vereq(d.goo(1), (1,)) - vereq(d.foo(1), (d, 1)) - vereq(D.foo(d, 1), (d, 1)) - -def staticmethods_in_c(): - if verbose: print "Testing C-based static methods..." - import xxsubtype as spam - a = (1, 2, 3) - d = {"abc": 123} - x, a1, d1 = spam.spamlist.staticmeth(*a, **d) - veris(x, None) - vereq(a, a1) - vereq(d, d1) - x, a1, d2 = spam.spamlist().staticmeth(*a, **d) - veris(x, None) - vereq(a, a1) - vereq(d, d1) - -def classic(): - if verbose: print "Testing classic classes..." - class C: - def foo(*a): return a - goo = classmethod(foo) - c = C() - vereq(C.goo(1), (C, 1)) - vereq(c.goo(1), (C, 1)) - vereq(c.foo(1), (c, 1)) - class D(C): - pass - d = D() - vereq(D.goo(1), (D, 1)) - vereq(d.goo(1), (D, 1)) - vereq(d.foo(1), (d, 1)) - vereq(D.foo(d, 1), (d, 1)) - class E: # *not* subclassing from C - foo = C.foo - vereq(E().foo, C.foo) # i.e., unbound - verify(repr(C.foo.__get__(C())).startswith("= 0) - vereq(str(c1), repr(c1)) - verify(-1 not in c1) - for i in range(10): - verify(i in c1) - verify(10 not in c1) - # Test the default behavior for dynamic classes - class D(object): - def __getitem__(self, i): - if 0 <= i < 10: return i - raise IndexError - d1 = D() - d2 = D() - verify(not not d1) - verify(id(d1) != id(d2)) - hash(d1) - hash(d2) - vereq(cmp(d1, d2), cmp(id(d1), id(d2))) - vereq(d1, d1) - verify(d1 != d2) - verify(not d1 != d1) - verify(not d1 == d2) - # Note that the module name appears in str/repr, and that varies - # depending on whether this test is run standalone or from a framework. - verify(str(d1).find('D object at ') >= 0) - vereq(str(d1), repr(d1)) - verify(-1 not in d1) - for i in range(10): - verify(i in d1) - verify(10 not in d1) - # Test overridden behavior for static classes - class Proxy(object): - def __init__(self, x): - self.x = x - def __nonzero__(self): - return not not self.x - def __hash__(self): - return hash(self.x) - def __eq__(self, other): - return self.x == other - def __ne__(self, other): - return self.x != other - def __cmp__(self, other): - return cmp(self.x, other.x) - def __str__(self): - return "Proxy:%s" % self.x - def __repr__(self): - return "Proxy(%r)" % self.x - def __contains__(self, value): - return value in self.x - p0 = Proxy(0) - p1 = Proxy(1) - p_1 = Proxy(-1) - verify(not p0) - verify(not not p1) - vereq(hash(p0), hash(0)) - vereq(p0, p0) - verify(p0 != p1) - verify(not p0 != p0) - vereq(not p0, p1) - vereq(cmp(p0, p1), -1) - vereq(cmp(p0, p0), 0) - vereq(cmp(p0, p_1), 1) - vereq(str(p0), "Proxy:0") - vereq(repr(p0), "Proxy(0)") - p10 = Proxy(range(10)) - verify(-1 not in p10) - for i in range(10): - verify(i in p10) - verify(10 not in p10) - # Test overridden behavior for dynamic classes - class DProxy(object): - def __init__(self, x): - self.x = x - def __nonzero__(self): - return not not self.x - def __hash__(self): - return hash(self.x) - def __eq__(self, other): - return self.x == other - def __ne__(self, other): - return self.x != other - def __cmp__(self, other): - return cmp(self.x, other.x) - def __str__(self): - return "DProxy:%s" % self.x - def __repr__(self): - return "DProxy(%r)" % self.x - def __contains__(self, value): - return value in self.x - p0 = DProxy(0) - p1 = DProxy(1) - p_1 = DProxy(-1) - verify(not p0) - verify(not not p1) - vereq(hash(p0), hash(0)) - vereq(p0, p0) - verify(p0 != p1) - verify(not p0 != p0) - vereq(not p0, p1) - vereq(cmp(p0, p1), -1) - vereq(cmp(p0, p0), 0) - vereq(cmp(p0, p_1), 1) - vereq(str(p0), "DProxy:0") - vereq(repr(p0), "DProxy(0)") - p10 = DProxy(range(10)) - verify(-1 not in p10) - for i in range(10): - verify(i in p10) - verify(10 not in p10) - # Safety test for __cmp__ - def unsafecmp(a, b): - try: - a.__class__.__cmp__(a, b) - except TypeError: - pass - else: - raise TestFailed, "shouldn't allow %s.__cmp__(%r, %r)" % ( - a.__class__, a, b) - unsafecmp(u"123", "123") - unsafecmp("123", u"123") - unsafecmp(1, 1.0) - unsafecmp(1.0, 1) - unsafecmp(1, 1L) - unsafecmp(1L, 1) - - class Letter(str): - def __new__(cls, letter): - if letter == 'EPS': - return str.__new__(cls) - return str.__new__(cls, letter) - def __str__(self): - if not self: - return 'EPS' - return self - - # sys.stdout needs to be the original to trigger the recursion bug - import sys - test_stdout = sys.stdout - sys.stdout = get_original_stdout() - try: - # nothing should actually be printed, this should raise an exception - print Letter('w') - except RuntimeError: - pass - else: - raise TestFailed, "expected a RuntimeError for print recursion" - sys.stdout = test_stdout - -def weakrefs(): - if verbose: print "Testing weak references..." - import weakref - class C(object): - pass - c = C() - r = weakref.ref(c) - verify(r() is c) - del c - verify(r() is None) - del r - class NoWeak(object): - __slots__ = ['foo'] - no = NoWeak() - try: - weakref.ref(no) - except TypeError, msg: - verify(str(msg).find("weak reference") >= 0) - else: - verify(0, "weakref.ref(no) should be illegal") - class Weak(object): - __slots__ = ['foo', '__weakref__'] - yes = Weak() - r = weakref.ref(yes) - verify(r() is yes) - del yes - verify(r() is None) - del r - -def properties(): - if verbose: print "Testing property..." - class C(object): - def getx(self): - return self.__x - def setx(self, value): - self.__x = value - def delx(self): - del self.__x - x = property(getx, setx, delx, doc="I'm the x property.") - a = C() - verify(not hasattr(a, "x")) - a.x = 42 - vereq(a._C__x, 42) - vereq(a.x, 42) - del a.x - verify(not hasattr(a, "x")) - verify(not hasattr(a, "_C__x")) - C.x.__set__(a, 100) - vereq(C.x.__get__(a), 100) - C.x.__delete__(a) - verify(not hasattr(a, "x")) - - raw = C.__dict__['x'] - verify(isinstance(raw, property)) - - attrs = dir(raw) - verify("__doc__" in attrs) - verify("fget" in attrs) - verify("fset" in attrs) - verify("fdel" in attrs) - - vereq(raw.__doc__, "I'm the x property.") - verify(raw.fget is C.__dict__['getx']) - verify(raw.fset is C.__dict__['setx']) - verify(raw.fdel is C.__dict__['delx']) - - for attr in "__doc__", "fget", "fset", "fdel": - try: - setattr(raw, attr, 42) - except TypeError, msg: - if str(msg).find('readonly') < 0: - raise TestFailed("when setting readonly attr %r on a " - "property, got unexpected TypeError " - "msg %r" % (attr, str(msg))) - else: - raise TestFailed("expected TypeError from trying to set " - "readonly %r attr on a property" % attr) - - class D(object): - __getitem__ = property(lambda s: 1/0) - - d = D() - try: - for i in d: - str(i) - except ZeroDivisionError: - pass - else: - raise TestFailed, "expected ZeroDivisionError from bad property" - - class E(object): - def getter(self): - "getter method" - return 0 - def setter(self, value): - "setter method" - pass - prop = property(getter) - vereq(prop.__doc__, "getter method") - prop2 = property(fset=setter) - vereq(prop2.__doc__, None) - - # this segfaulted in 2.5b2 - try: - import _testcapi - except ImportError: - pass - else: - class X(object): - p = property(_testcapi.test_with_docstring) - - -def supers(): - if verbose: print "Testing super..." - - class A(object): - def meth(self, a): - return "A(%r)" % a - - vereq(A().meth(1), "A(1)") - - class B(A): - def __init__(self): - self.__super = super(B, self) - def meth(self, a): - return "B(%r)" % a + self.__super.meth(a) - - vereq(B().meth(2), "B(2)A(2)") - - class C(A): - def meth(self, a): - return "C(%r)" % a + self.__super.meth(a) - C._C__super = super(C) - - vereq(C().meth(3), "C(3)A(3)") - - class D(C, B): - def meth(self, a): - return "D(%r)" % a + super(D, self).meth(a) - - vereq(D().meth(4), "D(4)C(4)B(4)A(4)") - - # Test for subclassing super - - class mysuper(super): - def __init__(self, *args): - return super(mysuper, self).__init__(*args) - - class E(D): - def meth(self, a): - return "E(%r)" % a + mysuper(E, self).meth(a) - - vereq(E().meth(5), "E(5)D(5)C(5)B(5)A(5)") - - class F(E): - def meth(self, a): - s = self.__super # == mysuper(F, self) - return "F(%r)[%s]" % (a, s.__class__.__name__) + s.meth(a) - F._F__super = mysuper(F) - - vereq(F().meth(6), "F(6)[mysuper]E(6)D(6)C(6)B(6)A(6)") - - # Make sure certain errors are raised - - try: - super(D, 42) - except TypeError: - pass - else: - raise TestFailed, "shouldn't allow super(D, 42)" - - try: - super(D, C()) - except TypeError: - pass - else: - raise TestFailed, "shouldn't allow super(D, C())" - - try: - super(D).__get__(12) - except TypeError: - pass - else: - raise TestFailed, "shouldn't allow super(D).__get__(12)" - - try: - super(D).__get__(C()) - except TypeError: - pass - else: - raise TestFailed, "shouldn't allow super(D).__get__(C())" - - # Make sure data descriptors can be overridden and accessed via super - # (new feature in Python 2.3) - - class DDbase(object): - def getx(self): return 42 - x = property(getx) - - class DDsub(DDbase): - def getx(self): return "hello" - x = property(getx) - - dd = DDsub() - vereq(dd.x, "hello") - vereq(super(DDsub, dd).x, 42) - - # Ensure that super() lookup of descriptor from classmethod - # works (SF ID# 743627) - - class Base(object): - aProp = property(lambda self: "foo") - - class Sub(Base): - @classmethod - def test(klass): - return super(Sub,klass).aProp - - veris(Sub.test(), Base.aProp) - - # Verify that super() doesn't allow keyword args - try: - super(Base, kw=1) - except TypeError: - pass - else: - raise TestFailed, "super shouldn't accept keyword args" - -def inherits(): - if verbose: print "Testing inheritance from basic types..." - - class hexint(int): - def __repr__(self): - return hex(self) - def __add__(self, other): - return hexint(int.__add__(self, other)) - # (Note that overriding __radd__ doesn't work, - # because the int type gets first dibs.) - vereq(repr(hexint(7) + 9), "0x10") - vereq(repr(hexint(1000) + 7), "0x3ef") - a = hexint(12345) - vereq(a, 12345) - vereq(int(a), 12345) - verify(int(a).__class__ is int) - vereq(hash(a), hash(12345)) - verify((+a).__class__ is int) - verify((a >> 0).__class__ is int) - verify((a << 0).__class__ is int) - verify((hexint(0) << 12).__class__ is int) - verify((hexint(0) >> 12).__class__ is int) - - class octlong(long): - __slots__ = [] - def __str__(self): - s = oct(self) - if s[-1] == 'L': - s = s[:-1] - return s - def __add__(self, other): - return self.__class__(super(octlong, self).__add__(other)) - __radd__ = __add__ - vereq(str(octlong(3) + 5), "010") - # (Note that overriding __radd__ here only seems to work - # because the example uses a short int left argument.) - vereq(str(5 + octlong(3000)), "05675") - a = octlong(12345) - vereq(a, 12345L) - vereq(long(a), 12345L) - vereq(hash(a), hash(12345L)) - verify(long(a).__class__ is long) - verify((+a).__class__ is long) - verify((-a).__class__ is long) - verify((-octlong(0)).__class__ is long) - verify((a >> 0).__class__ is long) - verify((a << 0).__class__ is long) - verify((a - 0).__class__ is long) - verify((a * 1).__class__ is long) - verify((a ** 1).__class__ is long) - verify((a // 1).__class__ is long) - verify((1 * a).__class__ is long) - verify((a | 0).__class__ is long) - verify((a ^ 0).__class__ is long) - verify((a & -1L).__class__ is long) - verify((octlong(0) << 12).__class__ is long) - verify((octlong(0) >> 12).__class__ is long) - verify(abs(octlong(0)).__class__ is long) - - # Because octlong overrides __add__, we can't check the absence of +0 - # optimizations using octlong. - class longclone(long): - pass - a = longclone(1) - verify((a + 0).__class__ is long) - verify((0 + a).__class__ is long) - - # Check that negative clones don't segfault - a = longclone(-1) - vereq(a.__dict__, {}) - vereq(long(a), -1) # verify PyNumber_Long() copies the sign bit - - class precfloat(float): - __slots__ = ['prec'] - def __init__(self, value=0.0, prec=12): - self.prec = int(prec) - float.__init__(value) - def __repr__(self): - return "%.*g" % (self.prec, self) - vereq(repr(precfloat(1.1)), "1.1") - a = precfloat(12345) - vereq(a, 12345.0) - vereq(float(a), 12345.0) - verify(float(a).__class__ is float) - vereq(hash(a), hash(12345.0)) - verify((+a).__class__ is float) - - class madcomplex(complex): - def __repr__(self): - return "%.17gj%+.17g" % (self.imag, self.real) - a = madcomplex(-3, 4) - vereq(repr(a), "4j-3") - base = complex(-3, 4) - veris(base.__class__, complex) - vereq(a, base) - vereq(complex(a), base) - veris(complex(a).__class__, complex) - a = madcomplex(a) # just trying another form of the constructor - vereq(repr(a), "4j-3") - vereq(a, base) - vereq(complex(a), base) - veris(complex(a).__class__, complex) - vereq(hash(a), hash(base)) - veris((+a).__class__, complex) - veris((a + 0).__class__, complex) - vereq(a + 0, base) - veris((a - 0).__class__, complex) - vereq(a - 0, base) - veris((a * 1).__class__, complex) - vereq(a * 1, base) - veris((a / 1).__class__, complex) - vereq(a / 1, base) - - class madtuple(tuple): - _rev = None - def rev(self): - if self._rev is not None: - return self._rev - L = list(self) - L.reverse() - self._rev = self.__class__(L) - return self._rev - a = madtuple((1,2,3,4,5,6,7,8,9,0)) - vereq(a, (1,2,3,4,5,6,7,8,9,0)) - vereq(a.rev(), madtuple((0,9,8,7,6,5,4,3,2,1))) - vereq(a.rev().rev(), madtuple((1,2,3,4,5,6,7,8,9,0))) - for i in range(512): - t = madtuple(range(i)) - u = t.rev() - v = u.rev() - vereq(v, t) - a = madtuple((1,2,3,4,5)) - vereq(tuple(a), (1,2,3,4,5)) - verify(tuple(a).__class__ is tuple) - vereq(hash(a), hash((1,2,3,4,5))) - verify(a[:].__class__ is tuple) - verify((a * 1).__class__ is tuple) - verify((a * 0).__class__ is tuple) - verify((a + ()).__class__ is tuple) - a = madtuple(()) - vereq(tuple(a), ()) - verify(tuple(a).__class__ is tuple) - verify((a + a).__class__ is tuple) - verify((a * 0).__class__ is tuple) - verify((a * 1).__class__ is tuple) - verify((a * 2).__class__ is tuple) - verify(a[:].__class__ is tuple) - - class madstring(str): - _rev = None - def rev(self): - if self._rev is not None: - return self._rev - L = list(self) - L.reverse() - self._rev = self.__class__("".join(L)) - return self._rev - s = madstring("abcdefghijklmnopqrstuvwxyz") - vereq(s, "abcdefghijklmnopqrstuvwxyz") - vereq(s.rev(), madstring("zyxwvutsrqponmlkjihgfedcba")) - vereq(s.rev().rev(), madstring("abcdefghijklmnopqrstuvwxyz")) - for i in range(256): - s = madstring("".join(map(chr, range(i)))) - t = s.rev() - u = t.rev() - vereq(u, s) - s = madstring("12345") - vereq(str(s), "12345") - verify(str(s).__class__ is str) - - base = "\x00" * 5 - s = madstring(base) - vereq(s, base) - vereq(str(s), base) - verify(str(s).__class__ is str) - vereq(hash(s), hash(base)) - vereq({s: 1}[base], 1) - vereq({base: 1}[s], 1) - verify((s + "").__class__ is str) - vereq(s + "", base) - verify(("" + s).__class__ is str) - vereq("" + s, base) - verify((s * 0).__class__ is str) - vereq(s * 0, "") - verify((s * 1).__class__ is str) - vereq(s * 1, base) - verify((s * 2).__class__ is str) - vereq(s * 2, base + base) - verify(s[:].__class__ is str) - vereq(s[:], base) - verify(s[0:0].__class__ is str) - vereq(s[0:0], "") - verify(s.strip().__class__ is str) - vereq(s.strip(), base) - verify(s.lstrip().__class__ is str) - vereq(s.lstrip(), base) - verify(s.rstrip().__class__ is str) - vereq(s.rstrip(), base) - identitytab = ''.join([chr(i) for i in range(256)]) - verify(s.translate(identitytab).__class__ is str) - vereq(s.translate(identitytab), base) - verify(s.translate(identitytab, "x").__class__ is str) - vereq(s.translate(identitytab, "x"), base) - vereq(s.translate(identitytab, "\x00"), "") - verify(s.replace("x", "x").__class__ is str) - vereq(s.replace("x", "x"), base) - verify(s.ljust(len(s)).__class__ is str) - vereq(s.ljust(len(s)), base) - verify(s.rjust(len(s)).__class__ is str) - vereq(s.rjust(len(s)), base) - verify(s.center(len(s)).__class__ is str) - vereq(s.center(len(s)), base) - verify(s.lower().__class__ is str) - vereq(s.lower(), base) - - class madunicode(unicode): - _rev = None - def rev(self): - if self._rev is not None: - return self._rev - L = list(self) - L.reverse() - self._rev = self.__class__(u"".join(L)) - return self._rev - u = madunicode("ABCDEF") - vereq(u, u"ABCDEF") - vereq(u.rev(), madunicode(u"FEDCBA")) - vereq(u.rev().rev(), madunicode(u"ABCDEF")) - base = u"12345" - u = madunicode(base) - vereq(unicode(u), base) - verify(unicode(u).__class__ is unicode) - vereq(hash(u), hash(base)) - vereq({u: 1}[base], 1) - vereq({base: 1}[u], 1) - verify(u.strip().__class__ is unicode) - vereq(u.strip(), base) - verify(u.lstrip().__class__ is unicode) - vereq(u.lstrip(), base) - verify(u.rstrip().__class__ is unicode) - vereq(u.rstrip(), base) - verify(u.replace(u"x", u"x").__class__ is unicode) - vereq(u.replace(u"x", u"x"), base) - verify(u.replace(u"xy", u"xy").__class__ is unicode) - vereq(u.replace(u"xy", u"xy"), base) - verify(u.center(len(u)).__class__ is unicode) - vereq(u.center(len(u)), base) - verify(u.ljust(len(u)).__class__ is unicode) - vereq(u.ljust(len(u)), base) - verify(u.rjust(len(u)).__class__ is unicode) - vereq(u.rjust(len(u)), base) - verify(u.lower().__class__ is unicode) - vereq(u.lower(), base) - verify(u.upper().__class__ is unicode) - vereq(u.upper(), base) - verify(u.capitalize().__class__ is unicode) - vereq(u.capitalize(), base) - verify(u.title().__class__ is unicode) - vereq(u.title(), base) - verify((u + u"").__class__ is unicode) - vereq(u + u"", base) - verify((u"" + u).__class__ is unicode) - vereq(u"" + u, base) - verify((u * 0).__class__ is unicode) - vereq(u * 0, u"") - verify((u * 1).__class__ is unicode) - vereq(u * 1, base) - verify((u * 2).__class__ is unicode) - vereq(u * 2, base + base) - verify(u[:].__class__ is unicode) - vereq(u[:], base) - verify(u[0:0].__class__ is unicode) - vereq(u[0:0], u"") - - class sublist(list): - pass - a = sublist(range(5)) - vereq(a, range(5)) - a.append("hello") - vereq(a, range(5) + ["hello"]) - a[5] = 5 - vereq(a, range(6)) - a.extend(range(6, 20)) - vereq(a, range(20)) - a[-5:] = [] - vereq(a, range(15)) - del a[10:15] - vereq(len(a), 10) - vereq(a, range(10)) - vereq(list(a), range(10)) - vereq(a[0], 0) - vereq(a[9], 9) - vereq(a[-10], 0) - vereq(a[-1], 9) - vereq(a[:5], range(5)) - - class CountedInput(file): - """Counts lines read by self.readline(). - - self.lineno is the 0-based ordinal of the last line read, up to - a maximum of one greater than the number of lines in the file. - - self.ateof is true if and only if the final "" line has been read, - at which point self.lineno stops incrementing, and further calls - to readline() continue to return "". - """ - - lineno = 0 - ateof = 0 - def readline(self): - if self.ateof: - return "" - s = file.readline(self) - # Next line works too. - # s = super(CountedInput, self).readline() - self.lineno += 1 - if s == "": - self.ateof = 1 - return s - - f = file(name=TESTFN, mode='w') - lines = ['a\n', 'b\n', 'c\n'] - try: - f.writelines(lines) - f.close() - f = CountedInput(TESTFN) - for (i, expected) in zip(range(1, 5) + [4], lines + 2 * [""]): - got = f.readline() - vereq(expected, got) - vereq(f.lineno, i) - vereq(f.ateof, (i > len(lines))) - f.close() - finally: - try: - f.close() - except: - pass - try: - import os - os.unlink(TESTFN) - except: - pass - -def keywords(): - if verbose: - print "Testing keyword args to basic type constructors ..." - vereq(int(x=1), 1) - vereq(float(x=2), 2.0) - vereq(long(x=3), 3L) - vereq(complex(imag=42, real=666), complex(666, 42)) - vereq(str(object=500), '500') - vereq(unicode(string='abc', errors='strict'), u'abc') - vereq(tuple(sequence=range(3)), (0, 1, 2)) - vereq(list(sequence=(0, 1, 2)), range(3)) - # note: as of Python 2.3, dict() no longer has an "items" keyword arg - - for constructor in (int, float, long, complex, str, unicode, - tuple, list, file): - try: - constructor(bogus_keyword_arg=1) - except TypeError: - pass - else: - raise TestFailed("expected TypeError from bogus keyword " - "argument to %r" % constructor) - -def restricted(): - # XXX This test is disabled because rexec is not deemed safe - return - import rexec - if verbose: - print "Testing interaction with restricted execution ..." - - sandbox = rexec.RExec() - - code1 = """f = open(%r, 'w')""" % TESTFN - code2 = """f = file(%r, 'w')""" % TESTFN - code3 = """\ -f = open(%r) -t = type(f) # a sneaky way to get the file() constructor -f.close() -f = t(%r, 'w') # rexec can't catch this by itself -""" % (TESTFN, TESTFN) - - f = open(TESTFN, 'w') # Create the file so code3 can find it. - f.close() - - try: - for code in code1, code2, code3: - try: - sandbox.r_exec(code) - except IOError, msg: - if str(msg).find("restricted") >= 0: - outcome = "OK" - else: - outcome = "got an exception, but not an expected one" - else: - outcome = "expected a restricted-execution exception" - - if outcome != "OK": - raise TestFailed("%s, in %r" % (outcome, code)) - - finally: - try: - import os - os.unlink(TESTFN) - except: - pass - -def str_subclass_as_dict_key(): - if verbose: - print "Testing a str subclass used as dict key .." - - class cistr(str): - """Sublcass of str that computes __eq__ case-insensitively. - - Also computes a hash code of the string in canonical form. - """ - - def __init__(self, value): - self.canonical = value.lower() - self.hashcode = hash(self.canonical) - - def __eq__(self, other): - if not isinstance(other, cistr): - other = cistr(other) - return self.canonical == other.canonical - - def __hash__(self): - return self.hashcode - - vereq(cistr('ABC'), 'abc') - vereq('aBc', cistr('ABC')) - vereq(str(cistr('ABC')), 'ABC') - - d = {cistr('one'): 1, cistr('two'): 2, cistr('tHree'): 3} - vereq(d[cistr('one')], 1) - vereq(d[cistr('tWo')], 2) - vereq(d[cistr('THrEE')], 3) - verify(cistr('ONe') in d) - vereq(d.get(cistr('thrEE')), 3) - -def classic_comparisons(): - if verbose: print "Testing classic comparisons..." - class classic: - pass - for base in (classic, int, object): - if verbose: print " (base = %s)" % base - class C(base): - def __init__(self, value): - self.value = int(value) - def __cmp__(self, other): - if isinstance(other, C): - return cmp(self.value, other.value) - if isinstance(other, int) or isinstance(other, long): - return cmp(self.value, other) - return NotImplemented - c1 = C(1) - c2 = C(2) - c3 = C(3) - vereq(c1, 1) - c = {1: c1, 2: c2, 3: c3} - for x in 1, 2, 3: - for y in 1, 2, 3: - verify(cmp(c[x], c[y]) == cmp(x, y), "x=%d, y=%d" % (x, y)) - for op in "<", "<=", "==", "!=", ">", ">=": - verify(eval("c[x] %s c[y]" % op) == eval("x %s y" % op), - "x=%d, y=%d" % (x, y)) - verify(cmp(c[x], y) == cmp(x, y), "x=%d, y=%d" % (x, y)) - verify(cmp(x, c[y]) == cmp(x, y), "x=%d, y=%d" % (x, y)) - -def rich_comparisons(): - if verbose: - print "Testing rich comparisons..." - class Z(complex): - pass - z = Z(1) - vereq(z, 1+0j) - vereq(1+0j, z) - class ZZ(complex): - def __eq__(self, other): - try: - return abs(self - other) <= 1e-6 - except: - return NotImplemented - zz = ZZ(1.0000003) - vereq(zz, 1+0j) - vereq(1+0j, zz) - - class classic: - pass - for base in (classic, int, object, list): - if verbose: print " (base = %s)" % base - class C(base): - def __init__(self, value): - self.value = int(value) - def __cmp__(self, other): - raise TestFailed, "shouldn't call __cmp__" - def __eq__(self, other): - if isinstance(other, C): - return self.value == other.value - if isinstance(other, int) or isinstance(other, long): - return self.value == other - return NotImplemented - def __ne__(self, other): - if isinstance(other, C): - return self.value != other.value - if isinstance(other, int) or isinstance(other, long): - return self.value != other - return NotImplemented - def __lt__(self, other): - if isinstance(other, C): - return self.value < other.value - if isinstance(other, int) or isinstance(other, long): - return self.value < other - return NotImplemented - def __le__(self, other): - if isinstance(other, C): - return self.value <= other.value - if isinstance(other, int) or isinstance(other, long): - return self.value <= other - return NotImplemented - def __gt__(self, other): - if isinstance(other, C): - return self.value > other.value - if isinstance(other, int) or isinstance(other, long): - return self.value > other - return NotImplemented - def __ge__(self, other): - if isinstance(other, C): - return self.value >= other.value - if isinstance(other, int) or isinstance(other, long): - return self.value >= other - return NotImplemented - c1 = C(1) - c2 = C(2) - c3 = C(3) - vereq(c1, 1) - c = {1: c1, 2: c2, 3: c3} - for x in 1, 2, 3: - for y in 1, 2, 3: - for op in "<", "<=", "==", "!=", ">", ">=": - verify(eval("c[x] %s c[y]" % op) == eval("x %s y" % op), - "x=%d, y=%d" % (x, y)) - verify(eval("c[x] %s y" % op) == eval("x %s y" % op), - "x=%d, y=%d" % (x, y)) - verify(eval("x %s c[y]" % op) == eval("x %s y" % op), - "x=%d, y=%d" % (x, y)) - -def coercions(): - if verbose: print "Testing coercions..." - class I(int): pass - coerce(I(0), 0) - coerce(0, I(0)) - class L(long): pass - coerce(L(0), 0) - coerce(L(0), 0L) - coerce(0, L(0)) - coerce(0L, L(0)) - class F(float): pass - coerce(F(0), 0) - coerce(F(0), 0L) - coerce(F(0), 0.) - coerce(0, F(0)) - coerce(0L, F(0)) - coerce(0., F(0)) - class C(complex): pass - coerce(C(0), 0) - coerce(C(0), 0L) - coerce(C(0), 0.) - coerce(C(0), 0j) - coerce(0, C(0)) - coerce(0L, C(0)) - coerce(0., C(0)) - coerce(0j, C(0)) - -def descrdoc(): - if verbose: print "Testing descriptor doc strings..." - def check(descr, what): - vereq(descr.__doc__, what) - check(file.closed, "True if the file is closed") # getset descriptor - check(file.name, "file name") # member descriptor - -def setclass(): - if verbose: print "Testing __class__ assignment..." - class C(object): pass - class D(object): pass - class E(object): pass - class F(D, E): pass - for cls in C, D, E, F: - for cls2 in C, D, E, F: - x = cls() - x.__class__ = cls2 - verify(x.__class__ is cls2) - x.__class__ = cls - verify(x.__class__ is cls) - def cant(x, C): - try: - x.__class__ = C - except TypeError: - pass - else: - raise TestFailed, "shouldn't allow %r.__class__ = %r" % (x, C) - try: - delattr(x, "__class__") - except TypeError: - pass - else: - raise TestFailed, "shouldn't allow del %r.__class__" % x - cant(C(), list) - cant(list(), C) - cant(C(), 1) - cant(C(), object) - cant(object(), list) - cant(list(), object) - class Int(int): __slots__ = [] - cant(2, Int) - cant(Int(), int) - cant(True, int) - cant(2, bool) - o = object() - cant(o, type(1)) - cant(o, type(None)) - del o - -def setdict(): - if verbose: print "Testing __dict__ assignment..." - class C(object): pass - a = C() - a.__dict__ = {'b': 1} - vereq(a.b, 1) - def cant(x, dict): - try: - x.__dict__ = dict - except (AttributeError, TypeError): - pass - else: - raise TestFailed, "shouldn't allow %r.__dict__ = %r" % (x, dict) - cant(a, None) - cant(a, []) - cant(a, 1) - del a.__dict__ # Deleting __dict__ is allowed - # Classes don't allow __dict__ assignment - cant(C, {}) - -def pickles(): - if verbose: - print "Testing pickling and copying new-style classes and objects..." - import pickle, cPickle - - def sorteditems(d): - L = d.items() - L.sort() - return L - - global C - class C(object): - def __init__(self, a, b): - super(C, self).__init__() - self.a = a - self.b = b - def __repr__(self): - return "C(%r, %r)" % (self.a, self.b) - - global C1 - class C1(list): - def __new__(cls, a, b): - return super(C1, cls).__new__(cls) - def __getnewargs__(self): - return (self.a, self.b) - def __init__(self, a, b): - self.a = a - self.b = b - def __repr__(self): - return "C1(%r, %r)<%r>" % (self.a, self.b, list(self)) - - global C2 - class C2(int): - def __new__(cls, a, b, val=0): - return super(C2, cls).__new__(cls, val) - def __getnewargs__(self): - return (self.a, self.b, int(self)) - def __init__(self, a, b, val=0): - self.a = a - self.b = b - def __repr__(self): - return "C2(%r, %r)<%r>" % (self.a, self.b, int(self)) - - global C3 - class C3(object): - def __init__(self, foo): - self.foo = foo - def __getstate__(self): - return self.foo - def __setstate__(self, foo): - self.foo = foo - - global C4classic, C4 - class C4classic: # classic - pass - class C4(C4classic, object): # mixed inheritance - pass - - for p in pickle, cPickle: - for bin in 0, 1: - if verbose: - print p.__name__, ["text", "binary"][bin] - - for cls in C, C1, C2: - s = p.dumps(cls, bin) - cls2 = p.loads(s) - verify(cls2 is cls) - - a = C1(1, 2); a.append(42); a.append(24) - b = C2("hello", "world", 42) - s = p.dumps((a, b), bin) - x, y = p.loads(s) - vereq(x.__class__, a.__class__) - vereq(sorteditems(x.__dict__), sorteditems(a.__dict__)) - vereq(y.__class__, b.__class__) - vereq(sorteditems(y.__dict__), sorteditems(b.__dict__)) - vereq(repr(x), repr(a)) - vereq(repr(y), repr(b)) - if verbose: - print "a = x =", a - print "b = y =", b - # Test for __getstate__ and __setstate__ on new style class - u = C3(42) - s = p.dumps(u, bin) - v = p.loads(s) - veris(u.__class__, v.__class__) - vereq(u.foo, v.foo) - # Test for picklability of hybrid class - u = C4() - u.foo = 42 - s = p.dumps(u, bin) - v = p.loads(s) - veris(u.__class__, v.__class__) - vereq(u.foo, v.foo) - - # Testing copy.deepcopy() - if verbose: - print "deepcopy" - import copy - for cls in C, C1, C2: - cls2 = copy.deepcopy(cls) - verify(cls2 is cls) - - a = C1(1, 2); a.append(42); a.append(24) - b = C2("hello", "world", 42) - x, y = copy.deepcopy((a, b)) - vereq(x.__class__, a.__class__) - vereq(sorteditems(x.__dict__), sorteditems(a.__dict__)) - vereq(y.__class__, b.__class__) - vereq(sorteditems(y.__dict__), sorteditems(b.__dict__)) - vereq(repr(x), repr(a)) - vereq(repr(y), repr(b)) - if verbose: - print "a = x =", a - print "b = y =", b - -def pickleslots(): - if verbose: print "Testing pickling of classes with __slots__ ..." - import pickle, cPickle - # Pickling of classes with __slots__ but without __getstate__ should fail - global B, C, D, E - class B(object): - pass - for base in [object, B]: - class C(base): - __slots__ = ['a'] - class D(C): - pass - try: - pickle.dumps(C()) - except TypeError: - pass - else: - raise TestFailed, "should fail: pickle C instance - %s" % base - try: - cPickle.dumps(C()) - except TypeError: - pass - else: - raise TestFailed, "should fail: cPickle C instance - %s" % base - try: - pickle.dumps(C()) - except TypeError: - pass - else: - raise TestFailed, "should fail: pickle D instance - %s" % base - try: - cPickle.dumps(D()) - except TypeError: - pass - else: - raise TestFailed, "should fail: cPickle D instance - %s" % base - # Give C a nice generic __getstate__ and __setstate__ - class C(base): - __slots__ = ['a'] - def __getstate__(self): - try: - d = self.__dict__.copy() - except AttributeError: - d = {} - for cls in self.__class__.__mro__: - for sn in cls.__dict__.get('__slots__', ()): - try: - d[sn] = getattr(self, sn) - except AttributeError: - pass - return d - def __setstate__(self, d): - for k, v in d.items(): - setattr(self, k, v) - class D(C): - pass - # Now it should work - x = C() - y = pickle.loads(pickle.dumps(x)) - vereq(hasattr(y, 'a'), 0) - y = cPickle.loads(cPickle.dumps(x)) - vereq(hasattr(y, 'a'), 0) - x.a = 42 - y = pickle.loads(pickle.dumps(x)) - vereq(y.a, 42) - y = cPickle.loads(cPickle.dumps(x)) - vereq(y.a, 42) - x = D() - x.a = 42 - x.b = 100 - y = pickle.loads(pickle.dumps(x)) - vereq(y.a + y.b, 142) - y = cPickle.loads(cPickle.dumps(x)) - vereq(y.a + y.b, 142) - # A subclass that adds a slot should also work - class E(C): - __slots__ = ['b'] - x = E() - x.a = 42 - x.b = "foo" - y = pickle.loads(pickle.dumps(x)) - vereq(y.a, x.a) - vereq(y.b, x.b) - y = cPickle.loads(cPickle.dumps(x)) - vereq(y.a, x.a) - vereq(y.b, x.b) - -def copies(): - if verbose: print "Testing copy.copy() and copy.deepcopy()..." - import copy - class C(object): - pass - - a = C() - a.foo = 12 - b = copy.copy(a) - vereq(b.__dict__, a.__dict__) - - a.bar = [1,2,3] - c = copy.copy(a) - vereq(c.bar, a.bar) - verify(c.bar is a.bar) - - d = copy.deepcopy(a) - vereq(d.__dict__, a.__dict__) - a.bar.append(4) - vereq(d.bar, [1,2,3]) - -def binopoverride(): - if verbose: print "Testing overrides of binary operations..." - class I(int): - def __repr__(self): - return "I(%r)" % int(self) - def __add__(self, other): - return I(int(self) + int(other)) - __radd__ = __add__ - def __pow__(self, other, mod=None): - if mod is None: - return I(pow(int(self), int(other))) - else: - return I(pow(int(self), int(other), int(mod))) - def __rpow__(self, other, mod=None): - if mod is None: - return I(pow(int(other), int(self), mod)) - else: - return I(pow(int(other), int(self), int(mod))) - - vereq(repr(I(1) + I(2)), "I(3)") - vereq(repr(I(1) + 2), "I(3)") - vereq(repr(1 + I(2)), "I(3)") - vereq(repr(I(2) ** I(3)), "I(8)") - vereq(repr(2 ** I(3)), "I(8)") - vereq(repr(I(2) ** 3), "I(8)") - vereq(repr(pow(I(2), I(3), I(5))), "I(3)") - class S(str): - def __eq__(self, other): - return self.lower() == other.lower() - -def subclasspropagation(): - if verbose: print "Testing propagation of slot functions to subclasses..." - class A(object): - pass - class B(A): - pass - class C(A): - pass - class D(B, C): - pass - d = D() - orig_hash = hash(d) # related to id(d) in platform-dependent ways - A.__hash__ = lambda self: 42 - vereq(hash(d), 42) - C.__hash__ = lambda self: 314 - vereq(hash(d), 314) - B.__hash__ = lambda self: 144 - vereq(hash(d), 144) - D.__hash__ = lambda self: 100 - vereq(hash(d), 100) - del D.__hash__ - vereq(hash(d), 144) - del B.__hash__ - vereq(hash(d), 314) - del C.__hash__ - vereq(hash(d), 42) - del A.__hash__ - vereq(hash(d), orig_hash) - d.foo = 42 - d.bar = 42 - vereq(d.foo, 42) - vereq(d.bar, 42) - def __getattribute__(self, name): - if name == "foo": - return 24 - return object.__getattribute__(self, name) - A.__getattribute__ = __getattribute__ - vereq(d.foo, 24) - vereq(d.bar, 42) - def __getattr__(self, name): - if name in ("spam", "foo", "bar"): - return "hello" - raise AttributeError, name - B.__getattr__ = __getattr__ - vereq(d.spam, "hello") - vereq(d.foo, 24) - vereq(d.bar, 42) - del A.__getattribute__ - vereq(d.foo, 42) - del d.foo - vereq(d.foo, "hello") - vereq(d.bar, 42) - del B.__getattr__ - try: - d.foo - except AttributeError: - pass - else: - raise TestFailed, "d.foo should be undefined now" - - # Test a nasty bug in recurse_down_subclasses() - import gc - class A(object): - pass - class B(A): - pass - del B - gc.collect() - A.__setitem__ = lambda *a: None # crash - -def buffer_inherit(): - import binascii - # SF bug [#470040] ParseTuple t# vs subclasses. - if verbose: - print "Testing that buffer interface is inherited ..." - - class MyStr(str): - pass - base = 'abc' - m = MyStr(base) - # b2a_hex uses the buffer interface to get its argument's value, via - # PyArg_ParseTuple 't#' code. - vereq(binascii.b2a_hex(m), binascii.b2a_hex(base)) - - # It's not clear that unicode will continue to support the character - # buffer interface, and this test will fail if that's taken away. - class MyUni(unicode): - pass - base = u'abc' - m = MyUni(base) - vereq(binascii.b2a_hex(m), binascii.b2a_hex(base)) - - class MyInt(int): - pass - m = MyInt(42) - try: - binascii.b2a_hex(m) - raise TestFailed('subclass of int should not have a buffer interface') - except TypeError: - pass - -def str_of_str_subclass(): - import binascii - import cStringIO - - if verbose: - print "Testing __str__ defined in subclass of str ..." - - class octetstring(str): - def __str__(self): - return binascii.b2a_hex(self) - def __repr__(self): - return self + " repr" - - o = octetstring('A') - vereq(type(o), octetstring) - vereq(type(str(o)), str) - vereq(type(repr(o)), str) - vereq(ord(o), 0x41) - vereq(str(o), '41') - vereq(repr(o), 'A repr') - vereq(o.__str__(), '41') - vereq(o.__repr__(), 'A repr') - - capture = cStringIO.StringIO() - # Calling str() or not exercises different internal paths. - print >> capture, o - print >> capture, str(o) - vereq(capture.getvalue(), '41\n41\n') - capture.close() - -def kwdargs(): - if verbose: print "Testing keyword arguments to __init__, __call__..." - def f(a): return a - vereq(f.__call__(a=42), 42) - a = [] - list.__init__(a, sequence=[0, 1, 2]) - vereq(a, [0, 1, 2]) - -def recursive__call__(): - if verbose: print ("Testing recursive __call__() by setting to instance of " - "class ...") - class A(object): - pass - - A.__call__ = A() - try: - A()() - except RuntimeError: - pass - else: - raise TestFailed("Recursion limit should have been reached for " - "__call__()") - -def delhook(): - if verbose: print "Testing __del__ hook..." - log = [] - class C(object): - def __del__(self): - log.append(1) - c = C() - vereq(log, []) - del c - vereq(log, [1]) - - class D(object): pass - d = D() - try: del d[0] - except TypeError: pass - else: raise TestFailed, "invalid del() didn't raise TypeError" - -def hashinherit(): - if verbose: print "Testing hash of mutable subclasses..." - - class mydict(dict): - pass - d = mydict() - try: - hash(d) - except TypeError: - pass - else: - raise TestFailed, "hash() of dict subclass should fail" - - class mylist(list): - pass - d = mylist() - try: - hash(d) - except TypeError: - pass - else: - raise TestFailed, "hash() of list subclass should fail" - -def strops(): - try: 'a' + 5 - except TypeError: pass - else: raise TestFailed, "'' + 5 doesn't raise TypeError" - - try: ''.split('') - except ValueError: pass - else: raise TestFailed, "''.split('') doesn't raise ValueError" - - try: ''.join([0]) - except TypeError: pass - else: raise TestFailed, "''.join([0]) doesn't raise TypeError" - - try: ''.rindex('5') - except ValueError: pass - else: raise TestFailed, "''.rindex('5') doesn't raise ValueError" - - try: '%(n)s' % None - except TypeError: pass - else: raise TestFailed, "'%(n)s' % None doesn't raise TypeError" - - try: '%(n' % {} - except ValueError: pass - else: raise TestFailed, "'%(n' % {} '' doesn't raise ValueError" - - try: '%*s' % ('abc') - except TypeError: pass - else: raise TestFailed, "'%*s' % ('abc') doesn't raise TypeError" - - try: '%*.*s' % ('abc', 5) - except TypeError: pass - else: raise TestFailed, "'%*.*s' % ('abc', 5) doesn't raise TypeError" - - try: '%s' % (1, 2) - except TypeError: pass - else: raise TestFailed, "'%s' % (1, 2) doesn't raise TypeError" - - try: '%' % None - except ValueError: pass - else: raise TestFailed, "'%' % None doesn't raise ValueError" - - vereq('534253'.isdigit(), 1) - vereq('534253x'.isdigit(), 0) - vereq('%c' % 5, '\x05') - vereq('%c' % '5', '5') - -def deepcopyrecursive(): - if verbose: print "Testing deepcopy of recursive objects..." - class Node: - pass - a = Node() - b = Node() - a.b = b - b.a = a - z = deepcopy(a) # This blew up before - -def modules(): - if verbose: print "Testing uninitialized module objects..." - from types import ModuleType as M - m = M.__new__(M) - str(m) - vereq(hasattr(m, "__name__"), 0) - vereq(hasattr(m, "__file__"), 0) - vereq(hasattr(m, "foo"), 0) - vereq(m.__dict__, None) - m.foo = 1 - vereq(m.__dict__, {"foo": 1}) - -def dictproxyiterkeys(): - class C(object): - def meth(self): - pass - if verbose: print "Testing dict-proxy iterkeys..." - keys = [ key for key in C.__dict__.iterkeys() ] - keys.sort() - vereq(keys, ['__dict__', '__doc__', '__module__', '__weakref__', 'meth']) - -def dictproxyitervalues(): - class C(object): - def meth(self): - pass - if verbose: print "Testing dict-proxy itervalues..." - values = [ values for values in C.__dict__.itervalues() ] - vereq(len(values), 5) - -def dictproxyiteritems(): - class C(object): - def meth(self): - pass - if verbose: print "Testing dict-proxy iteritems..." - keys = [ key for (key, value) in C.__dict__.iteritems() ] - keys.sort() - vereq(keys, ['__dict__', '__doc__', '__module__', '__weakref__', 'meth']) - -def funnynew(): - if verbose: print "Testing __new__ returning something unexpected..." - class C(object): - def __new__(cls, arg): - if isinstance(arg, str): return [1, 2, 3] - elif isinstance(arg, int): return object.__new__(D) - else: return object.__new__(cls) - class D(C): - def __init__(self, arg): - self.foo = arg - vereq(C("1"), [1, 2, 3]) - vereq(D("1"), [1, 2, 3]) - d = D(None) - veris(d.foo, None) - d = C(1) - vereq(isinstance(d, D), True) - vereq(d.foo, 1) - d = D(1) - vereq(isinstance(d, D), True) - vereq(d.foo, 1) - -def imulbug(): - # SF bug 544647 - if verbose: print "Testing for __imul__ problems..." - class C(object): - def __imul__(self, other): - return (self, other) - x = C() - y = x - y *= 1.0 - vereq(y, (x, 1.0)) - y = x - y *= 2 - vereq(y, (x, 2)) - y = x - y *= 3L - vereq(y, (x, 3L)) - y = x - y *= 1L<<100 - vereq(y, (x, 1L<<100)) - y = x - y *= None - vereq(y, (x, None)) - y = x - y *= "foo" - vereq(y, (x, "foo")) - -def docdescriptor(): - # SF bug 542984 - if verbose: print "Testing __doc__ descriptor..." - class DocDescr(object): - def __get__(self, object, otype): - if object: - object = object.__class__.__name__ + ' instance' - if otype: - otype = otype.__name__ - return 'object=%s; type=%s' % (object, otype) - class OldClass: - __doc__ = DocDescr() - class NewClass(object): - __doc__ = DocDescr() - vereq(OldClass.__doc__, 'object=None; type=OldClass') - vereq(OldClass().__doc__, 'object=OldClass instance; type=OldClass') - vereq(NewClass.__doc__, 'object=None; type=NewClass') - vereq(NewClass().__doc__, 'object=NewClass instance; type=NewClass') - -def copy_setstate(): - if verbose: - print "Testing that copy.*copy() correctly uses __setstate__..." - import copy - class C(object): - def __init__(self, foo=None): - self.foo = foo - self.__foo = foo - def setfoo(self, foo=None): - self.foo = foo - def getfoo(self): - return self.__foo - def __getstate__(self): - return [self.foo] - def __setstate__(self, lst): - assert len(lst) == 1 - self.__foo = self.foo = lst[0] - a = C(42) - a.setfoo(24) - vereq(a.foo, 24) - vereq(a.getfoo(), 42) - b = copy.copy(a) - vereq(b.foo, 24) - vereq(b.getfoo(), 24) - b = copy.deepcopy(a) - vereq(b.foo, 24) - vereq(b.getfoo(), 24) - -def slices(): - if verbose: - print "Testing cases with slices and overridden __getitem__ ..." - # Strings - vereq("hello"[:4], "hell") - vereq("hello"[slice(4)], "hell") - vereq(str.__getitem__("hello", slice(4)), "hell") - class S(str): - def __getitem__(self, x): - return str.__getitem__(self, x) - vereq(S("hello")[:4], "hell") - vereq(S("hello")[slice(4)], "hell") - vereq(S("hello").__getitem__(slice(4)), "hell") - # Tuples - vereq((1,2,3)[:2], (1,2)) - vereq((1,2,3)[slice(2)], (1,2)) - vereq(tuple.__getitem__((1,2,3), slice(2)), (1,2)) - class T(tuple): - def __getitem__(self, x): - return tuple.__getitem__(self, x) - vereq(T((1,2,3))[:2], (1,2)) - vereq(T((1,2,3))[slice(2)], (1,2)) - vereq(T((1,2,3)).__getitem__(slice(2)), (1,2)) - # Lists - vereq([1,2,3][:2], [1,2]) - vereq([1,2,3][slice(2)], [1,2]) - vereq(list.__getitem__([1,2,3], slice(2)), [1,2]) - class L(list): - def __getitem__(self, x): - return list.__getitem__(self, x) - vereq(L([1,2,3])[:2], [1,2]) - vereq(L([1,2,3])[slice(2)], [1,2]) - vereq(L([1,2,3]).__getitem__(slice(2)), [1,2]) - # Now do lists and __setitem__ - a = L([1,2,3]) - a[slice(1, 3)] = [3,2] - vereq(a, [1,3,2]) - a[slice(0, 2, 1)] = [3,1] - vereq(a, [3,1,2]) - a.__setitem__(slice(1, 3), [2,1]) - vereq(a, [3,2,1]) - a.__setitem__(slice(0, 2, 1), [2,3]) - vereq(a, [2,3,1]) - -def subtype_resurrection(): - if verbose: - print "Testing resurrection of new-style instance..." - - class C(object): - container = [] - - def __del__(self): - # resurrect the instance - C.container.append(self) - - c = C() - c.attr = 42 - # The most interesting thing here is whether this blows up, due to flawed - # GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug). - del c - - # If that didn't blow up, it's also interesting to see whether clearing - # the last container slot works: that will attempt to delete c again, - # which will cause c to get appended back to the container again "during" - # the del. - del C.container[-1] - vereq(len(C.container), 1) - vereq(C.container[-1].attr, 42) - - # Make c mortal again, so that the test framework with -l doesn't report - # it as a leak. - del C.__del__ - -def slottrash(): - # Deallocating deeply nested slotted trash caused stack overflows - if verbose: - print "Testing slot trash..." - class trash(object): - __slots__ = ['x'] - def __init__(self, x): - self.x = x - o = None - for i in xrange(50000): - o = trash(o) - del o - -def slotmultipleinheritance(): - # SF bug 575229, multiple inheritance w/ slots dumps core - class A(object): - __slots__=() - class B(object): - pass - class C(A,B) : - __slots__=() - vereq(C.__basicsize__, B.__basicsize__) - verify(hasattr(C, '__dict__')) - verify(hasattr(C, '__weakref__')) - C().x = 2 - -def testrmul(): - # SF patch 592646 - if verbose: - print "Testing correct invocation of __rmul__..." - class C(object): - def __mul__(self, other): - return "mul" - def __rmul__(self, other): - return "rmul" - a = C() - vereq(a*2, "mul") - vereq(a*2.2, "mul") - vereq(2*a, "rmul") - vereq(2.2*a, "rmul") - -def testipow(): - # [SF bug 620179] - if verbose: - print "Testing correct invocation of __ipow__..." - class C(object): - def __ipow__(self, other): - pass - a = C() - a **= 2 - -def do_this_first(): - if verbose: - print "Testing SF bug 551412 ..." - # This dumps core when SF bug 551412 isn't fixed -- - # but only when test_descr.py is run separately. - # (That can't be helped -- as soon as PyType_Ready() - # is called for PyLong_Type, the bug is gone.) - class UserLong(object): - def __pow__(self, *args): - pass - try: - pow(0L, UserLong(), 0L) - except: - pass - - if verbose: - print "Testing SF bug 570483..." - # Another segfault only when run early - # (before PyType_Ready(tuple) is called) - type.mro(tuple) - -def test_mutable_bases(): - if verbose: - print "Testing mutable bases..." - # stuff that should work: - class C(object): - pass - class C2(object): - def __getattribute__(self, attr): - if attr == 'a': - return 2 - else: - return super(C2, self).__getattribute__(attr) - def meth(self): - return 1 - class D(C): - pass - class E(D): - pass - d = D() - e = E() - D.__bases__ = (C,) - D.__bases__ = (C2,) - vereq(d.meth(), 1) - vereq(e.meth(), 1) - vereq(d.a, 2) - vereq(e.a, 2) - vereq(C2.__subclasses__(), [D]) - - # stuff that shouldn't: - class L(list): - pass - - try: - L.__bases__ = (dict,) - except TypeError: - pass - else: - raise TestFailed, "shouldn't turn list subclass into dict subclass" - - try: - list.__bases__ = (dict,) - except TypeError: - pass - else: - raise TestFailed, "shouldn't be able to assign to list.__bases__" - - try: - del D.__bases__ - except TypeError: - pass - else: - raise TestFailed, "shouldn't be able to delete .__bases__" - - try: - D.__bases__ = () - except TypeError, msg: - if str(msg) == "a new-style class can't have only classic bases": - raise TestFailed, "wrong error message for .__bases__ = ()" - else: - raise TestFailed, "shouldn't be able to set .__bases__ to ()" - - try: - D.__bases__ = (D,) - except TypeError: - pass - else: - # actually, we'll have crashed by here... - raise TestFailed, "shouldn't be able to create inheritance cycles" - - try: - D.__bases__ = (C, C) - except TypeError: - pass - else: - raise TestFailed, "didn't detect repeated base classes" - - try: - D.__bases__ = (E,) - except TypeError: - pass - else: - raise TestFailed, "shouldn't be able to create inheritance cycles" - - # let's throw a classic class into the mix: - class Classic: - def meth2(self): - return 3 - - D.__bases__ = (C, Classic) - - vereq(d.meth2(), 3) - vereq(e.meth2(), 3) - try: - d.a - except AttributeError: - pass - else: - raise TestFailed, "attribute should have vanished" - - try: - D.__bases__ = (Classic,) - except TypeError: - pass - else: - raise TestFailed, "new-style class must have a new-style base" - -def test_mutable_bases_with_failing_mro(): - if verbose: - print "Testing mutable bases with failing mro..." - class WorkOnce(type): - def __new__(self, name, bases, ns): - self.flag = 0 - return super(WorkOnce, self).__new__(WorkOnce, name, bases, ns) - def mro(self): - if self.flag > 0: - raise RuntimeError, "bozo" - else: - self.flag += 1 - return type.mro(self) - - class WorkAlways(type): - def mro(self): - # this is here to make sure that .mro()s aren't called - # with an exception set (which was possible at one point). - # An error message will be printed in a debug build. - # What's a good way to test for this? - return type.mro(self) - - class C(object): - pass - - class C2(object): - pass - - class D(C): - pass - - class E(D): - pass - - class F(D): - __metaclass__ = WorkOnce - - class G(D): - __metaclass__ = WorkAlways - - # Immediate subclasses have their mro's adjusted in alphabetical - # order, so E's will get adjusted before adjusting F's fails. We - # check here that E's gets restored. - - E_mro_before = E.__mro__ - D_mro_before = D.__mro__ - - try: - D.__bases__ = (C2,) - except RuntimeError: - vereq(E.__mro__, E_mro_before) - vereq(D.__mro__, D_mro_before) - else: - raise TestFailed, "exception not propagated" - -def test_mutable_bases_catch_mro_conflict(): - if verbose: - print "Testing mutable bases catch mro conflict..." - class A(object): - pass - - class B(object): - pass - - class C(A, B): - pass - - class D(A, B): - pass - - class E(C, D): - pass - - try: - C.__bases__ = (B, A) - except TypeError: - pass - else: - raise TestFailed, "didn't catch MRO conflict" - -def mutable_names(): - if verbose: - print "Testing mutable names..." - class C(object): - pass - - # C.__module__ could be 'test_descr' or '__main__' - mod = C.__module__ - - C.__name__ = 'D' - vereq((C.__module__, C.__name__), (mod, 'D')) - - C.__name__ = 'D.E' - vereq((C.__module__, C.__name__), (mod, 'D.E')) - -def subclass_right_op(): - if verbose: - print "Testing correct dispatch of subclass overloading __r__..." - - # This code tests various cases where right-dispatch of a subclass - # should be preferred over left-dispatch of a base class. - - # Case 1: subclass of int; this tests code in abstract.c::binary_op1() - - class B(int): - def __floordiv__(self, other): - return "B.__floordiv__" - def __rfloordiv__(self, other): - return "B.__rfloordiv__" - - vereq(B(1) // 1, "B.__floordiv__") - vereq(1 // B(1), "B.__rfloordiv__") - - # Case 2: subclass of object; this is just the baseline for case 3 - - class C(object): - def __floordiv__(self, other): - return "C.__floordiv__" - def __rfloordiv__(self, other): - return "C.__rfloordiv__" - - vereq(C() // 1, "C.__floordiv__") - vereq(1 // C(), "C.__rfloordiv__") - - # Case 3: subclass of new-style class; here it gets interesting - - class D(C): - def __floordiv__(self, other): - return "D.__floordiv__" - def __rfloordiv__(self, other): - return "D.__rfloordiv__" - - vereq(D() // C(), "D.__floordiv__") - vereq(C() // D(), "D.__rfloordiv__") - - # Case 4: this didn't work right in 2.2.2 and 2.3a1 - - class E(C): - pass - - vereq(E.__rfloordiv__, C.__rfloordiv__) - - vereq(E() // 1, "C.__floordiv__") - vereq(1 // E(), "C.__rfloordiv__") - vereq(E() // C(), "C.__floordiv__") - vereq(C() // E(), "C.__floordiv__") # This one would fail - -def dict_type_with_metaclass(): - if verbose: - print "Testing type of __dict__ when __metaclass__ set..." - - class B(object): - pass - class M(type): - pass - class C: - # In 2.3a1, C.__dict__ was a real dict rather than a dict proxy - __metaclass__ = M - veris(type(C.__dict__), type(B.__dict__)) - -def meth_class_get(): - # Full coverage of descrobject.c::classmethod_get() - if verbose: - print "Testing __get__ method of METH_CLASS C methods..." - # Baseline - arg = [1, 2, 3] - res = {1: None, 2: None, 3: None} - vereq(dict.fromkeys(arg), res) - vereq({}.fromkeys(arg), res) - # Now get the descriptor - descr = dict.__dict__["fromkeys"] - # More baseline using the descriptor directly - vereq(descr.__get__(None, dict)(arg), res) - vereq(descr.__get__({})(arg), res) - # Now check various error cases - try: - descr.__get__(None, None) - except TypeError: - pass - else: - raise TestFailed, "shouldn't have allowed descr.__get__(None, None)" - try: - descr.__get__(42) - except TypeError: - pass - else: - raise TestFailed, "shouldn't have allowed descr.__get__(42)" - try: - descr.__get__(None, 42) - except TypeError: - pass - else: - raise TestFailed, "shouldn't have allowed descr.__get__(None, 42)" - try: - descr.__get__(None, int) - except TypeError: - pass - else: - raise TestFailed, "shouldn't have allowed descr.__get__(None, int)" - -def isinst_isclass(): - if verbose: - print "Testing proxy isinstance() and isclass()..." - class Proxy(object): - def __init__(self, obj): - self.__obj = obj - def __getattribute__(self, name): - if name.startswith("_Proxy__"): - return object.__getattribute__(self, name) - else: - return getattr(self.__obj, name) - # Test with a classic class - class C: - pass - a = C() - pa = Proxy(a) - verify(isinstance(a, C)) # Baseline - verify(isinstance(pa, C)) # Test - # Test with a classic subclass - class D(C): - pass - a = D() - pa = Proxy(a) - verify(isinstance(a, C)) # Baseline - verify(isinstance(pa, C)) # Test - # Test with a new-style class - class C(object): - pass - a = C() - pa = Proxy(a) - verify(isinstance(a, C)) # Baseline - verify(isinstance(pa, C)) # Test - # Test with a new-style subclass - class D(C): - pass - a = D() - pa = Proxy(a) - verify(isinstance(a, C)) # Baseline - verify(isinstance(pa, C)) # Test - -def proxysuper(): - if verbose: - print "Testing super() for a proxy object..." - class Proxy(object): - def __init__(self, obj): - self.__obj = obj - def __getattribute__(self, name): - if name.startswith("_Proxy__"): - return object.__getattribute__(self, name) - else: - return getattr(self.__obj, name) - - class B(object): - def f(self): - return "B.f" - - class C(B): - def f(self): - return super(C, self).f() + "->C.f" - - obj = C() - p = Proxy(obj) - vereq(C.__dict__["f"](p), "B.f->C.f") - -def carloverre(): - if verbose: - print "Testing prohibition of Carlo Verre's hack..." - try: - object.__setattr__(str, "foo", 42) - except TypeError: - pass - else: - raise TestFailed, "Carlo Verre __setattr__ suceeded!" - try: - object.__delattr__(str, "lower") - except TypeError: - pass - else: - raise TestFailed, "Carlo Verre __delattr__ succeeded!" - -def weakref_segfault(): - # SF 742911 - if verbose: - print "Testing weakref segfault..." - - import weakref - - class Provoker: - def __init__(self, referrent): - self.ref = weakref.ref(referrent) - - def __del__(self): - x = self.ref() - - class Oops(object): - pass - - o = Oops() - o.whatever = Provoker(o) - del o - -def wrapper_segfault(): - # SF 927248: deeply nested wrappers could cause stack overflow - f = lambda:None - for i in xrange(1000000): - f = f.__call__ - f = None - -# Fix SF #762455, segfault when sys.stdout is changed in getattr -def filefault(): - if verbose: - print "Testing sys.stdout is changed in getattr..." - import sys - class StdoutGuard: - def __getattr__(self, attr): - sys.stdout = sys.__stdout__ - raise RuntimeError("Premature access to sys.stdout.%s" % attr) - sys.stdout = StdoutGuard() - try: - print "Oops!" - except RuntimeError: - pass - -def vicious_descriptor_nonsense(): - # A potential segfault spotted by Thomas Wouters in mail to - # python-dev 2003-04-17, turned into an example & fixed by Michael - # Hudson just less than four months later... - if verbose: - print "Testing vicious_descriptor_nonsense..." - - class Evil(object): - def __hash__(self): - return hash('attr') - def __eq__(self, other): - del C.attr - return 0 - - class Descr(object): - def __get__(self, ob, type=None): - return 1 - - class C(object): - attr = Descr() - - c = C() - c.__dict__[Evil()] = 0 - - vereq(c.attr, 1) - # this makes a crash more likely: - import gc; gc.collect() - vereq(hasattr(c, 'attr'), False) - -def test_init(): - # SF 1155938 - class Foo(object): - def __init__(self): - return 10 - try: - Foo() - except TypeError: - pass - else: - raise TestFailed, "did not test __init__() for None return" - -def methodwrapper(): - # did not support any reflection before 2.5 - if verbose: - print "Testing method-wrapper objects..." - - l = [] - vereq(l.__add__, l.__add__) - vereq(l.__add__, [].__add__) - verify(l.__add__ != [5].__add__) - verify(l.__add__ != l.__mul__) - verify(l.__add__.__name__ == '__add__') - verify(l.__add__.__self__ is l) - verify(l.__add__.__objclass__ is list) - vereq(l.__add__.__doc__, list.__add__.__doc__) - try: - hash(l.__add__) - except TypeError: - pass - else: - raise TestFailed("no TypeError from hash([].__add__)") - - t = () - t += (7,) - vereq(t.__add__, (7,).__add__) - vereq(hash(t.__add__), hash((7,).__add__)) - -def notimplemented(): - # all binary methods should be able to return a NotImplemented - if verbose: - print "Testing NotImplemented..." - - import sys - import types - import operator - - def specialmethod(self, other): - return NotImplemented - - def check(expr, x, y): - try: - exec expr in {'x': x, 'y': y, 'operator': operator} - except TypeError: - pass - else: - raise TestFailed("no TypeError from %r" % (expr,)) - - N1 = sys.maxint + 1L # might trigger OverflowErrors instead of TypeErrors - N2 = sys.maxint # if sizeof(int) < sizeof(long), might trigger - # ValueErrors instead of TypeErrors - for metaclass in [type, types.ClassType]: - for name, expr, iexpr in [ - ('__add__', 'x + y', 'x += y'), - ('__sub__', 'x - y', 'x -= y'), - ('__mul__', 'x * y', 'x *= y'), - ('__truediv__', 'operator.truediv(x, y)', None), - ('__floordiv__', 'operator.floordiv(x, y)', None), - ('__div__', 'x / y', 'x /= y'), - ('__mod__', 'x % y', 'x %= y'), - ('__divmod__', 'divmod(x, y)', None), - ('__pow__', 'x ** y', 'x **= y'), - ('__lshift__', 'x << y', 'x <<= y'), - ('__rshift__', 'x >> y', 'x >>= y'), - ('__and__', 'x & y', 'x &= y'), - ('__or__', 'x | y', 'x |= y'), - ('__xor__', 'x ^ y', 'x ^= y'), - ('__coerce__', 'coerce(x, y)', None)]: - if name == '__coerce__': - rname = name - else: - rname = '__r' + name[2:] - A = metaclass('A', (), {name: specialmethod}) - B = metaclass('B', (), {rname: specialmethod}) - a = A() - b = B() - check(expr, a, a) - check(expr, a, b) - check(expr, b, a) - check(expr, b, b) - check(expr, a, N1) - check(expr, a, N2) - check(expr, N1, b) - check(expr, N2, b) - if iexpr: - check(iexpr, a, a) - check(iexpr, a, b) - check(iexpr, b, a) - check(iexpr, b, b) - check(iexpr, a, N1) - check(iexpr, a, N2) - iname = '__i' + name[2:] - C = metaclass('C', (), {iname: specialmethod}) - c = C() - check(iexpr, c, a) - check(iexpr, c, b) - check(iexpr, c, N1) - check(iexpr, c, N2) - -def test_assign_slice(): - # ceval.c's assign_slice used to check for - # tp->tp_as_sequence->sq_slice instead of - # tp->tp_as_sequence->sq_ass_slice - - class C(object): - def __setslice__(self, start, stop, value): - self.value = value - - c = C() - c[1:2] = 3 - vereq(c.value, 3) - -def test_main(): - weakref_segfault() # Must be first, somehow - wrapper_segfault() - do_this_first() - class_docstrings() - lists() - dicts() - dict_constructor() - test_dir() - ints() - longs() - floats() - complexes() - spamlists() - spamdicts() - pydicts() - pylists() - metaclass() - pymods() - multi() - mro_disagreement() - diamond() - ex5() - monotonicity() - consistency_with_epg() - objects() - slots() - slotspecials() - dynamics() - errors() - classmethods() - classmethods_in_c() - staticmethods() - staticmethods_in_c() - classic() - compattr() - newslot() - altmro() - overloading() - methods() - specials() - weakrefs() - properties() - supers() - inherits() - keywords() - restricted() - str_subclass_as_dict_key() - classic_comparisons() - rich_comparisons() - coercions() - descrdoc() - setclass() - setdict() - pickles() - copies() - binopoverride() - subclasspropagation() - buffer_inherit() - str_of_str_subclass() - kwdargs() - recursive__call__() - delhook() - hashinherit() - strops() - deepcopyrecursive() - modules() - dictproxyiterkeys() - dictproxyitervalues() - dictproxyiteritems() - pickleslots() - funnynew() - imulbug() - docdescriptor() - copy_setstate() - slices() - subtype_resurrection() - slottrash() - slotmultipleinheritance() - testrmul() - testipow() - test_mutable_bases() - test_mutable_bases_with_failing_mro() - test_mutable_bases_catch_mro_conflict() - mutable_names() - subclass_right_op() - dict_type_with_metaclass() - meth_class_get() - isinst_isclass() - proxysuper() - carloverre() - filefault() - vicious_descriptor_nonsense() - test_init() - methodwrapper() - notimplemented() - test_assign_slice() - - if verbose: print "All OK" - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_descrtut.py b/sys/lib/python/test/test_descrtut.py deleted file mode 100644 index 9dcfca196..000000000 --- a/sys/lib/python/test/test_descrtut.py +++ /dev/null @@ -1,494 +0,0 @@ -# This contains most of the executable examples from Guido's descr -# tutorial, once at -# -# http://www.python.org/2.2/descrintro.html -# -# A few examples left implicit in the writeup were fleshed out, a few were -# skipped due to lack of interest (e.g., faking super() by hand isn't -# of much interest anymore), and a few were fiddled to make the output -# deterministic. - -from test.test_support import sortdict -import pprint - -class defaultdict(dict): - def __init__(self, default=None): - dict.__init__(self) - self.default = default - - def __getitem__(self, key): - try: - return dict.__getitem__(self, key) - except KeyError: - return self.default - - def get(self, key, *args): - if not args: - args = (self.default,) - return dict.get(self, key, *args) - - def merge(self, other): - for key in other: - if key not in self: - self[key] = other[key] - -test_1 = """ - -Here's the new type at work: - - >>> print defaultdict # show our type - - >>> print type(defaultdict) # its metatype - - >>> a = defaultdict(default=0.0) # create an instance - >>> print a # show the instance - {} - >>> print type(a) # show its type - - >>> print a.__class__ # show its class - - >>> print type(a) is a.__class__ # its type is its class - True - >>> a[1] = 3.25 # modify the instance - >>> print a # show the new value - {1: 3.25} - >>> print a[1] # show the new item - 3.25 - >>> print a[0] # a non-existant item - 0.0 - >>> a.merge({1:100, 2:200}) # use a dict method - >>> print sortdict(a) # show the result - {1: 3.25, 2: 200} - >>> - -We can also use the new type in contexts where classic only allows "real" -dictionaries, such as the locals/globals dictionaries for the exec -statement or the built-in function eval(): - - >>> def sorted(seq): - ... seq.sort() - ... return seq - >>> print sorted(a.keys()) - [1, 2] - >>> exec "x = 3; print x" in a - 3 - >>> print sorted(a.keys()) - [1, 2, '__builtins__', 'x'] - >>> print a['x'] - 3 - >>> - -Now I'll show that defaultdict instances have dynamic instance variables, -just like classic classes: - - >>> a.default = -1 - >>> print a["noway"] - -1 - >>> a.default = -1000 - >>> print a["noway"] - -1000 - >>> 'default' in dir(a) - True - >>> a.x1 = 100 - >>> a.x2 = 200 - >>> print a.x1 - 100 - >>> d = dir(a) - >>> 'default' in d and 'x1' in d and 'x2' in d - True - >>> print sortdict(a.__dict__) - {'default': -1000, 'x1': 100, 'x2': 200} - >>> -""" - -class defaultdict2(dict): - __slots__ = ['default'] - - def __init__(self, default=None): - dict.__init__(self) - self.default = default - - def __getitem__(self, key): - try: - return dict.__getitem__(self, key) - except KeyError: - return self.default - - def get(self, key, *args): - if not args: - args = (self.default,) - return dict.get(self, key, *args) - - def merge(self, other): - for key in other: - if key not in self: - self[key] = other[key] - -test_2 = """ - -The __slots__ declaration takes a list of instance variables, and reserves -space for exactly these in the instance. When __slots__ is used, other -instance variables cannot be assigned to: - - >>> a = defaultdict2(default=0.0) - >>> a[1] - 0.0 - >>> a.default = -1 - >>> a[1] - -1 - >>> a.x1 = 1 - Traceback (most recent call last): - File "", line 1, in ? - AttributeError: 'defaultdict2' object has no attribute 'x1' - >>> - -""" - -test_3 = """ - -Introspecting instances of built-in types - -For instance of built-in types, x.__class__ is now the same as type(x): - - >>> type([]) - - >>> [].__class__ - - >>> list - - >>> isinstance([], list) - True - >>> isinstance([], dict) - False - >>> isinstance([], object) - True - >>> - -Under the new proposal, the __methods__ attribute no longer exists: - - >>> [].__methods__ - Traceback (most recent call last): - File "", line 1, in ? - AttributeError: 'list' object has no attribute '__methods__' - >>> - -Instead, you can get the same information from the list type: - - >>> pprint.pprint(dir(list)) # like list.__dict__.keys(), but sorted - ['__add__', - '__class__', - '__contains__', - '__delattr__', - '__delitem__', - '__delslice__', - '__doc__', - '__eq__', - '__ge__', - '__getattribute__', - '__getitem__', - '__getslice__', - '__gt__', - '__hash__', - '__iadd__', - '__imul__', - '__init__', - '__iter__', - '__le__', - '__len__', - '__lt__', - '__mul__', - '__ne__', - '__new__', - '__reduce__', - '__reduce_ex__', - '__repr__', - '__reversed__', - '__rmul__', - '__setattr__', - '__setitem__', - '__setslice__', - '__str__', - 'append', - 'count', - 'extend', - 'index', - 'insert', - 'pop', - 'remove', - 'reverse', - 'sort'] - -The new introspection API gives more information than the old one: in -addition to the regular methods, it also shows the methods that are -normally invoked through special notations, e.g. __iadd__ (+=), __len__ -(len), __ne__ (!=). You can invoke any method from this list directly: - - >>> a = ['tic', 'tac'] - >>> list.__len__(a) # same as len(a) - 2 - >>> a.__len__() # ditto - 2 - >>> list.append(a, 'toe') # same as a.append('toe') - >>> a - ['tic', 'tac', 'toe'] - >>> - -This is just like it is for user-defined classes. -""" - -test_4 = """ - -Static methods and class methods - -The new introspection API makes it possible to add static methods and class -methods. Static methods are easy to describe: they behave pretty much like -static methods in C++ or Java. Here's an example: - - >>> class C: - ... - ... @staticmethod - ... def foo(x, y): - ... print "staticmethod", x, y - - >>> C.foo(1, 2) - staticmethod 1 2 - >>> c = C() - >>> c.foo(1, 2) - staticmethod 1 2 - -Class methods use a similar pattern to declare methods that receive an -implicit first argument that is the *class* for which they are invoked. - - >>> class C: - ... @classmethod - ... def foo(cls, y): - ... print "classmethod", cls, y - - >>> C.foo(1) - classmethod test.test_descrtut.C 1 - >>> c = C() - >>> c.foo(1) - classmethod test.test_descrtut.C 1 - - >>> class D(C): - ... pass - - >>> D.foo(1) - classmethod test.test_descrtut.D 1 - >>> d = D() - >>> d.foo(1) - classmethod test.test_descrtut.D 1 - -This prints "classmethod __main__.D 1" both times; in other words, the -class passed as the first argument of foo() is the class involved in the -call, not the class involved in the definition of foo(). - -But notice this: - - >>> class E(C): - ... @classmethod - ... def foo(cls, y): # override C.foo - ... print "E.foo() called" - ... C.foo(y) - - >>> E.foo(1) - E.foo() called - classmethod test.test_descrtut.C 1 - >>> e = E() - >>> e.foo(1) - E.foo() called - classmethod test.test_descrtut.C 1 - -In this example, the call to C.foo() from E.foo() will see class C as its -first argument, not class E. This is to be expected, since the call -specifies the class C. But it stresses the difference between these class -methods and methods defined in metaclasses (where an upcall to a metamethod -would pass the target class as an explicit first argument). -""" - -test_5 = """ - -Attributes defined by get/set methods - - - >>> class property(object): - ... - ... def __init__(self, get, set=None): - ... self.__get = get - ... self.__set = set - ... - ... def __get__(self, inst, type=None): - ... return self.__get(inst) - ... - ... def __set__(self, inst, value): - ... if self.__set is None: - ... raise AttributeError, "this attribute is read-only" - ... return self.__set(inst, value) - -Now let's define a class with an attribute x defined by a pair of methods, -getx() and and setx(): - - >>> class C(object): - ... - ... def __init__(self): - ... self.__x = 0 - ... - ... def getx(self): - ... return self.__x - ... - ... def setx(self, x): - ... if x < 0: x = 0 - ... self.__x = x - ... - ... x = property(getx, setx) - -Here's a small demonstration: - - >>> a = C() - >>> a.x = 10 - >>> print a.x - 10 - >>> a.x = -10 - >>> print a.x - 0 - >>> - -Hmm -- property is builtin now, so let's try it that way too. - - >>> del property # unmask the builtin - >>> property - - - >>> class C(object): - ... def __init__(self): - ... self.__x = 0 - ... def getx(self): - ... return self.__x - ... def setx(self, x): - ... if x < 0: x = 0 - ... self.__x = x - ... x = property(getx, setx) - - - >>> a = C() - >>> a.x = 10 - >>> print a.x - 10 - >>> a.x = -10 - >>> print a.x - 0 - >>> -""" - -test_6 = """ - -Method resolution order - -This example is implicit in the writeup. - ->>> class A: # classic class -... def save(self): -... print "called A.save()" ->>> class B(A): -... pass ->>> class C(A): -... def save(self): -... print "called C.save()" ->>> class D(B, C): -... pass - ->>> D().save() -called A.save() - ->>> class A(object): # new class -... def save(self): -... print "called A.save()" ->>> class B(A): -... pass ->>> class C(A): -... def save(self): -... print "called C.save()" ->>> class D(B, C): -... pass - ->>> D().save() -called C.save() -""" - -class A(object): - def m(self): - return "A" - -class B(A): - def m(self): - return "B" + super(B, self).m() - -class C(A): - def m(self): - return "C" + super(C, self).m() - -class D(C, B): - def m(self): - return "D" + super(D, self).m() - - -test_7 = """ - -Cooperative methods and "super" - ->>> print D().m() # "DCBA" -DCBA -""" - -test_8 = """ - -Backwards incompatibilities - ->>> class A: -... def foo(self): -... print "called A.foo()" - ->>> class B(A): -... pass - ->>> class C(A): -... def foo(self): -... B.foo(self) - ->>> C().foo() -Traceback (most recent call last): - ... -TypeError: unbound method foo() must be called with B instance as first argument (got C instance instead) - ->>> class C(A): -... def foo(self): -... A.foo(self) ->>> C().foo() -called A.foo() -""" - -__test__ = {"tut1": test_1, - "tut2": test_2, - "tut3": test_3, - "tut4": test_4, - "tut5": test_5, - "tut6": test_6, - "tut7": test_7, - "tut8": test_8} - -# Magic test name that regrtest.py invokes *after* importing this module. -# This worms around a bootstrap problem. -# Note that doctest and regrtest both look in sys.argv for a "-v" argument, -# so this works as expected in both ways of running regrtest. -def test_main(verbose=None): - # Obscure: import this module as test.test_descrtut instead of as - # plain test_descrtut because the name of this module works its way - # into the doctest examples, and unless the full test.test_descrtut - # business is used the name can change depending on how the test is - # invoked. - from test import test_support, test_descrtut - test_support.run_doctest(test_descrtut, verbose) - -# This part isn't needed for regrtest, but for running the test directly. -if __name__ == "__main__": - test_main(1) diff --git a/sys/lib/python/test/test_dict.py b/sys/lib/python/test/test_dict.py deleted file mode 100644 index 8da091534..000000000 --- a/sys/lib/python/test/test_dict.py +++ /dev/null @@ -1,477 +0,0 @@ -import unittest -from test import test_support - -import sys, UserDict, cStringIO - - -class DictTest(unittest.TestCase): - def test_constructor(self): - # calling built-in types without argument must return empty - self.assertEqual(dict(), {}) - self.assert_(dict() is not {}) - - def test_bool(self): - self.assert_(not {}) - self.assert_({1: 2}) - self.assert_(bool({}) is False) - self.assert_(bool({1: 2}) is True) - - def test_keys(self): - d = {} - self.assertEqual(d.keys(), []) - d = {'a': 1, 'b': 2} - k = d.keys() - self.assert_(d.has_key('a')) - self.assert_(d.has_key('b')) - - self.assertRaises(TypeError, d.keys, None) - - def test_values(self): - d = {} - self.assertEqual(d.values(), []) - d = {1:2} - self.assertEqual(d.values(), [2]) - - self.assertRaises(TypeError, d.values, None) - - def test_items(self): - d = {} - self.assertEqual(d.items(), []) - - d = {1:2} - self.assertEqual(d.items(), [(1, 2)]) - - self.assertRaises(TypeError, d.items, None) - - def test_has_key(self): - d = {} - self.assert_(not d.has_key('a')) - d = {'a': 1, 'b': 2} - k = d.keys() - k.sort() - self.assertEqual(k, ['a', 'b']) - - self.assertRaises(TypeError, d.has_key) - - def test_contains(self): - d = {} - self.assert_(not ('a' in d)) - self.assert_('a' not in d) - d = {'a': 1, 'b': 2} - self.assert_('a' in d) - self.assert_('b' in d) - self.assert_('c' not in d) - - self.assertRaises(TypeError, d.__contains__) - - def test_len(self): - d = {} - self.assertEqual(len(d), 0) - d = {'a': 1, 'b': 2} - self.assertEqual(len(d), 2) - - def test_getitem(self): - d = {'a': 1, 'b': 2} - self.assertEqual(d['a'], 1) - self.assertEqual(d['b'], 2) - d['c'] = 3 - d['a'] = 4 - self.assertEqual(d['c'], 3) - self.assertEqual(d['a'], 4) - del d['b'] - self.assertEqual(d, {'a': 4, 'c': 3}) - - self.assertRaises(TypeError, d.__getitem__) - - class BadEq(object): - def __eq__(self, other): - raise Exc() - - d = {} - d[BadEq()] = 42 - self.assertRaises(KeyError, d.__getitem__, 23) - - class Exc(Exception): pass - - class BadHash(object): - fail = False - def __hash__(self): - if self.fail: - raise Exc() - else: - return 42 - - x = BadHash() - d[x] = 42 - x.fail = True - self.assertRaises(Exc, d.__getitem__, x) - - def test_clear(self): - d = {1:1, 2:2, 3:3} - d.clear() - self.assertEqual(d, {}) - - self.assertRaises(TypeError, d.clear, None) - - def test_update(self): - d = {} - d.update({1:100}) - d.update({2:20}) - d.update({1:1, 2:2, 3:3}) - self.assertEqual(d, {1:1, 2:2, 3:3}) - - d.update() - self.assertEqual(d, {1:1, 2:2, 3:3}) - - self.assertRaises((TypeError, AttributeError), d.update, None) - - class SimpleUserDict: - def __init__(self): - self.d = {1:1, 2:2, 3:3} - def keys(self): - return self.d.keys() - def __getitem__(self, i): - return self.d[i] - d.clear() - d.update(SimpleUserDict()) - self.assertEqual(d, {1:1, 2:2, 3:3}) - - class Exc(Exception): pass - - d.clear() - class FailingUserDict: - def keys(self): - raise Exc - self.assertRaises(Exc, d.update, FailingUserDict()) - - class FailingUserDict: - def keys(self): - class BogonIter: - def __init__(self): - self.i = 1 - def __iter__(self): - return self - def next(self): - if self.i: - self.i = 0 - return 'a' - raise Exc - return BogonIter() - def __getitem__(self, key): - return key - self.assertRaises(Exc, d.update, FailingUserDict()) - - class FailingUserDict: - def keys(self): - class BogonIter: - def __init__(self): - self.i = ord('a') - def __iter__(self): - return self - def next(self): - if self.i <= ord('z'): - rtn = chr(self.i) - self.i += 1 - return rtn - raise StopIteration - return BogonIter() - def __getitem__(self, key): - raise Exc - self.assertRaises(Exc, d.update, FailingUserDict()) - - class badseq(object): - def __iter__(self): - return self - def next(self): - raise Exc() - - self.assertRaises(Exc, {}.update, badseq()) - - self.assertRaises(ValueError, {}.update, [(1, 2, 3)]) - - def test_fromkeys(self): - self.assertEqual(dict.fromkeys('abc'), {'a':None, 'b':None, 'c':None}) - d = {} - self.assert_(not(d.fromkeys('abc') is d)) - self.assertEqual(d.fromkeys('abc'), {'a':None, 'b':None, 'c':None}) - self.assertEqual(d.fromkeys((4,5),0), {4:0, 5:0}) - self.assertEqual(d.fromkeys([]), {}) - def g(): - yield 1 - self.assertEqual(d.fromkeys(g()), {1:None}) - self.assertRaises(TypeError, {}.fromkeys, 3) - class dictlike(dict): pass - self.assertEqual(dictlike.fromkeys('a'), {'a':None}) - self.assertEqual(dictlike().fromkeys('a'), {'a':None}) - self.assert_(type(dictlike.fromkeys('a')) is dictlike) - self.assert_(type(dictlike().fromkeys('a')) is dictlike) - class mydict(dict): - def __new__(cls): - return UserDict.UserDict() - ud = mydict.fromkeys('ab') - self.assertEqual(ud, {'a':None, 'b':None}) - self.assert_(isinstance(ud, UserDict.UserDict)) - self.assertRaises(TypeError, dict.fromkeys) - - class Exc(Exception): pass - - class baddict1(dict): - def __init__(self): - raise Exc() - - self.assertRaises(Exc, baddict1.fromkeys, [1]) - - class BadSeq(object): - def __iter__(self): - return self - def next(self): - raise Exc() - - self.assertRaises(Exc, dict.fromkeys, BadSeq()) - - class baddict2(dict): - def __setitem__(self, key, value): - raise Exc() - - self.assertRaises(Exc, baddict2.fromkeys, [1]) - - def test_copy(self): - d = {1:1, 2:2, 3:3} - self.assertEqual(d.copy(), {1:1, 2:2, 3:3}) - self.assertEqual({}.copy(), {}) - self.assertRaises(TypeError, d.copy, None) - - def test_get(self): - d = {} - self.assert_(d.get('c') is None) - self.assertEqual(d.get('c', 3), 3) - d = {'a' : 1, 'b' : 2} - self.assert_(d.get('c') is None) - self.assertEqual(d.get('c', 3), 3) - self.assertEqual(d.get('a'), 1) - self.assertEqual(d.get('a', 3), 1) - self.assertRaises(TypeError, d.get) - self.assertRaises(TypeError, d.get, None, None, None) - - def test_setdefault(self): - # dict.setdefault() - d = {} - self.assert_(d.setdefault('key0') is None) - d.setdefault('key0', []) - self.assert_(d.setdefault('key0') is None) - d.setdefault('key', []).append(3) - self.assertEqual(d['key'][0], 3) - d.setdefault('key', []).append(4) - self.assertEqual(len(d['key']), 2) - self.assertRaises(TypeError, d.setdefault) - - class Exc(Exception): pass - - class BadHash(object): - fail = False - def __hash__(self): - if self.fail: - raise Exc() - else: - return 42 - - x = BadHash() - d[x] = 42 - x.fail = True - self.assertRaises(Exc, d.setdefault, x, []) - - def test_popitem(self): - # dict.popitem() - for copymode in -1, +1: - # -1: b has same structure as a - # +1: b is a.copy() - for log2size in range(12): - size = 2**log2size - a = {} - b = {} - for i in range(size): - a[repr(i)] = i - if copymode < 0: - b[repr(i)] = i - if copymode > 0: - b = a.copy() - for i in range(size): - ka, va = ta = a.popitem() - self.assertEqual(va, int(ka)) - kb, vb = tb = b.popitem() - self.assertEqual(vb, int(kb)) - self.assert_(not(copymode < 0 and ta != tb)) - self.assert_(not a) - self.assert_(not b) - - d = {} - self.assertRaises(KeyError, d.popitem) - - def test_pop(self): - # Tests for pop with specified key - d = {} - k, v = 'abc', 'def' - d[k] = v - self.assertRaises(KeyError, d.pop, 'ghi') - - self.assertEqual(d.pop(k), v) - self.assertEqual(len(d), 0) - - self.assertRaises(KeyError, d.pop, k) - - # verify longs/ints get same value when key > 32 bits (for 64-bit archs) - # see SF bug #689659 - x = 4503599627370496L - y = 4503599627370496 - h = {x: 'anything', y: 'something else'} - self.assertEqual(h[x], h[y]) - - self.assertEqual(d.pop(k, v), v) - d[k] = v - self.assertEqual(d.pop(k, 1), v) - - self.assertRaises(TypeError, d.pop) - - class Exc(Exception): pass - - class BadHash(object): - fail = False - def __hash__(self): - if self.fail: - raise Exc() - else: - return 42 - - x = BadHash() - d[x] = 42 - x.fail = True - self.assertRaises(Exc, d.pop, x) - - def test_mutatingiteration(self): - d = {} - d[1] = 1 - try: - for i in d: - d[i+1] = 1 - except RuntimeError: - pass - else: - self.fail("changing dict size during iteration doesn't raise Error") - - def test_repr(self): - d = {} - self.assertEqual(repr(d), '{}') - d[1] = 2 - self.assertEqual(repr(d), '{1: 2}') - d = {} - d[1] = d - self.assertEqual(repr(d), '{1: {...}}') - - class Exc(Exception): pass - - class BadRepr(object): - def __repr__(self): - raise Exc() - - d = {1: BadRepr()} - self.assertRaises(Exc, repr, d) - - def test_le(self): - self.assert_(not ({} < {})) - self.assert_(not ({1: 2} < {1L: 2L})) - - class Exc(Exception): pass - - class BadCmp(object): - def __eq__(self, other): - raise Exc() - - d1 = {BadCmp(): 1} - d2 = {1: 1} - try: - d1 < d2 - except Exc: - pass - else: - self.fail("< didn't raise Exc") - - def test_missing(self): - # Make sure dict doesn't have a __missing__ method - self.assertEqual(hasattr(dict, "__missing__"), False) - self.assertEqual(hasattr({}, "__missing__"), False) - # Test several cases: - # (D) subclass defines __missing__ method returning a value - # (E) subclass defines __missing__ method raising RuntimeError - # (F) subclass sets __missing__ instance variable (no effect) - # (G) subclass doesn't define __missing__ at a all - class D(dict): - def __missing__(self, key): - return 42 - d = D({1: 2, 3: 4}) - self.assertEqual(d[1], 2) - self.assertEqual(d[3], 4) - self.assert_(2 not in d) - self.assert_(2 not in d.keys()) - self.assertEqual(d[2], 42) - class E(dict): - def __missing__(self, key): - raise RuntimeError(key) - e = E() - try: - e[42] - except RuntimeError, err: - self.assertEqual(err.args, (42,)) - else: - self.fail("e[42] didn't raise RuntimeError") - class F(dict): - def __init__(self): - # An instance variable __missing__ should have no effect - self.__missing__ = lambda key: None - f = F() - try: - f[42] - except KeyError, err: - self.assertEqual(err.args, (42,)) - else: - self.fail("f[42] didn't raise KeyError") - class G(dict): - pass - g = G() - try: - g[42] - except KeyError, err: - self.assertEqual(err.args, (42,)) - else: - self.fail("g[42] didn't raise KeyError") - - def test_tuple_keyerror(self): - # SF #1576657 - d = {} - try: - d[(1,)] - except KeyError, e: - self.assertEqual(e.args, ((1,),)) - else: - self.fail("missing KeyError") - - -from test import mapping_tests - -class GeneralMappingTests(mapping_tests.BasicTestMappingProtocol): - type2test = dict - -class Dict(dict): - pass - -class SubclassMappingTests(mapping_tests.BasicTestMappingProtocol): - type2test = Dict - -def test_main(): - test_support.run_unittest( - DictTest, - GeneralMappingTests, - SubclassMappingTests, - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_difflib.py b/sys/lib/python/test/test_difflib.py deleted file mode 100644 index 83fad1548..000000000 --- a/sys/lib/python/test/test_difflib.py +++ /dev/null @@ -1,161 +0,0 @@ -import difflib -from test.test_support import run_unittest, findfile -import unittest -import doctest -import sys - -class TestSFbugs(unittest.TestCase): - - def test_ratio_for_null_seqn(self): - # Check clearing of SF bug 763023 - s = difflib.SequenceMatcher(None, [], []) - self.assertEqual(s.ratio(), 1) - self.assertEqual(s.quick_ratio(), 1) - self.assertEqual(s.real_quick_ratio(), 1) - - def test_comparing_empty_lists(self): - # Check fix for bug #979794 - group_gen = difflib.SequenceMatcher(None, [], []).get_grouped_opcodes() - self.assertRaises(StopIteration, group_gen.next) - diff_gen = difflib.unified_diff([], []) - self.assertRaises(StopIteration, diff_gen.next) - -patch914575_from1 = """ - 1. Beautiful is beTTer than ugly. - 2. Explicit is better than implicit. - 3. Simple is better than complex. - 4. Complex is better than complicated. -""" - -patch914575_to1 = """ - 1. Beautiful is better than ugly. - 3. Simple is better than complex. - 4. Complicated is better than complex. - 5. Flat is better than nested. -""" - -patch914575_from2 = """ -\t\tLine 1: preceeded by from:[tt] to:[ssss] - \t\tLine 2: preceeded by from:[sstt] to:[sssst] - \t \tLine 3: preceeded by from:[sstst] to:[ssssss] -Line 4: \thas from:[sst] to:[sss] after : -Line 5: has from:[t] to:[ss] at end\t -""" - -patch914575_to2 = """ - Line 1: preceeded by from:[tt] to:[ssss] - \tLine 2: preceeded by from:[sstt] to:[sssst] - Line 3: preceeded by from:[sstst] to:[ssssss] -Line 4: has from:[sst] to:[sss] after : -Line 5: has from:[t] to:[ss] at end -""" - -patch914575_from3 = """line 0 -1234567890123456789012345689012345 -line 1 -line 2 -line 3 -line 4 changed -line 5 changed -line 6 changed -line 7 -line 8 subtracted -line 9 -1234567890123456789012345689012345 -short line -just fits in!! -just fits in two lines yup!! -the end""" - -patch914575_to3 = """line 0 -1234567890123456789012345689012345 -line 1 -line 2 added -line 3 -line 4 chanGEd -line 5a chanGed -line 6a changEd -line 7 -line 8 -line 9 -1234567890 -another long line that needs to be wrapped -just fitS in!! -just fits in two lineS yup!! -the end""" - -class TestSFpatches(unittest.TestCase): - - def test_html_diff(self): - # Check SF patch 914575 for generating HTML differences - f1a = ((patch914575_from1 + '123\n'*10)*3) - t1a = (patch914575_to1 + '123\n'*10)*3 - f1b = '456\n'*10 + f1a - t1b = '456\n'*10 + t1a - f1a = f1a.splitlines() - t1a = t1a.splitlines() - f1b = f1b.splitlines() - t1b = t1b.splitlines() - f2 = patch914575_from2.splitlines() - t2 = patch914575_to2.splitlines() - f3 = patch914575_from3 - t3 = patch914575_to3 - i = difflib.HtmlDiff() - j = difflib.HtmlDiff(tabsize=2) - k = difflib.HtmlDiff(wrapcolumn=14) - - full = i.make_file(f1a,t1a,'from','to',context=False,numlines=5) - tables = '\n'.join( - [ - '

Context (first diff within numlines=5(default))

', - i.make_table(f1a,t1a,'from','to',context=True), - '

Context (first diff after numlines=5(default))

', - i.make_table(f1b,t1b,'from','to',context=True), - '

Context (numlines=6)

', - i.make_table(f1a,t1a,'from','to',context=True,numlines=6), - '

Context (numlines=0)

', - i.make_table(f1a,t1a,'from','to',context=True,numlines=0), - '

Same Context

', - i.make_table(f1a,f1a,'from','to',context=True), - '

Same Full

', - i.make_table(f1a,f1a,'from','to',context=False), - '

Empty Context

', - i.make_table([],[],'from','to',context=True), - '

Empty Full

', - i.make_table([],[],'from','to',context=False), - '

tabsize=2

', - j.make_table(f2,t2), - '

tabsize=default

', - i.make_table(f2,t2), - '

Context (wrapcolumn=14,numlines=0)

', - k.make_table(f3.splitlines(),t3.splitlines(),context=True,numlines=0), - '

wrapcolumn=14,splitlines()

', - k.make_table(f3.splitlines(),t3.splitlines()), - '

wrapcolumn=14,splitlines(True)

', - k.make_table(f3.splitlines(True),t3.splitlines(True)), - ]) - actual = full.replace('','\n%s\n' % tables) - # temporarily uncomment next three lines to baseline this test - #f = open('test_difflib_expect.html','w') - #f.write(actual) - #f.close() - expect = open(findfile('test_difflib_expect.html')).read() - - - self.assertEqual(actual,expect) - - def test_recursion_limit(self): - # Check if the problem described in patch #1413711 exists. - limit = sys.getrecursionlimit() - old = [(i%2 and "K:%d" or "V:A:%d") % i for i in range(limit*2)] - new = [(i%2 and "K:%d" or "V:B:%d") % i for i in range(limit*2)] - difflib.SequenceMatcher(None, old, new).get_opcodes() - - -def test_main(): - difflib.HtmlDiff._default_prefix = 0 - Doctests = doctest.DocTestSuite(difflib) - run_unittest(TestSFpatches, TestSFbugs, Doctests) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_difflib_expect.html b/sys/lib/python/test/test_difflib_expect.html deleted file mode 100644 index 71b6d7a86..000000000 --- a/sys/lib/python/test/test_difflib_expect.html +++ /dev/null @@ -1,526 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

from
to
f1f1
n2   1. Beautiful is beTTer than ugly.n2   1. Beautiful is better than ugly.
3   2. Explicit is better than implicit.
4   3. Simple is better than complex.3   3.   Simple is better than complex.
5   4. Complex is better than complicated.4   4. Complicated is better than complex.
5   5. Flat is better than nested.
61236123
71237123
81238123
91239123
1012310123
1112311123
1212312123
1312313123
1412314123
1512315123
1616
n17   1. Beautiful is beTTer than ugly.n17   1. Beautiful is better than ugly.
18   2. Explicit is better than implicit.
19   3. Simple is better than complex.18   3.   Simple is better than complex.
20   4. Complex is better than complicated.19   4. Complicated is better than complex.
20   5. Flat is better than nested.
2112321123
2212322123
2312323123
2412324123
2512325123
2612326123
2712327123
2812328123
2912329123
3012330123
3131
t32   1. Beautiful is beTTer than ugly.t32   1. Beautiful is better than ugly.
33   2. Explicit is better than implicit.
34   3. Simple is better than complex.33   3.   Simple is better than complex.
35   4. Complex is better than complicated.34   4. Complicated is better than complex.
35   5. Flat is better than nested.
3612336123
3712337123
3812338123
3912339123
4012340123
4112341123
4212342123
4312343123
4412344123
4512345123
- - - - -
Legends
- - - - -
Colors
 Added 
Changed
Deleted
- - - - -
Links
(f)irst change
(n)ext change
(t)op
- -

Context (first diff within numlines=5(default))

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

from
to
f1f1
n2   1. Beautiful is beTTer than ugly.n2   1. Beautiful is better than ugly.
3   2. Explicit is better than implicit.
4   3. Simple is better than complex.3   3.   Simple is better than complex.
5   4. Complex is better than complicated.4   4. Complicated is better than complex.
5   5. Flat is better than nested.
61236123
71237123
81238123
91239123
1012310123
1212312123
1312313123
1412314123
1512315123
1616
n17   1. Beautiful is beTTer than ugly.n17   1. Beautiful is better than ugly.
18   2. Explicit is better than implicit.
19   3. Simple is better than complex.18   3.   Simple is better than complex.
20   4. Complex is better than complicated.19   4. Complicated is better than complex.
20   5. Flat is better than nested.
2112321123
2212322123
2312323123
2412324123
2512325123
2712327123
2812328123
2912329123
3012330123
3131
t32   1. Beautiful is beTTer than ugly.t32   1. Beautiful is better than ugly.
33   2. Explicit is better than implicit.
34   3. Simple is better than complex.33   3.   Simple is better than complex.
35   4. Complex is better than complicated.34   4. Complicated is better than complex.
35   5. Flat is better than nested.
3612336123
3712337123
3812338123
3912339123
4012340123
-

Context (first diff after numlines=5(default))

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

from
to
74567456
84568456
94569456
1045610456
1111
n12   1. Beautiful is beTTer than ugly.n12   1. Beautiful is better than ugly.
13   2. Explicit is better than implicit.
14   3. Simple is better than complex.13   3.   Simple is better than complex.
15   4. Complex is better than complicated.14   4. Complicated is better than complex.
15   5. Flat is better than nested.
1612316123
1712317123
1812318123
1912319123
2012320123
2212322123
2312323123
2412324123
2512325123
2626
n27   1. Beautiful is beTTer than ugly.n27   1. Beautiful is better than ugly.
28   2. Explicit is better than implicit.
29   3. Simple is better than complex.28   3.   Simple is better than complex.
30   4. Complex is better than complicated.29   4. Complicated is better than complex.
30   5. Flat is better than nested.
3112331123
3212332123
3312333123
3412334123
3512335123
3712337123
3812338123
3912339123
4012340123
4141
t42   1. Beautiful is beTTer than ugly.t42   1. Beautiful is better than ugly.
43   2. Explicit is better than implicit.
44   3. Simple is better than complex.43   3.   Simple is better than complex.
45   4. Complex is better than complicated.44   4. Complicated is better than complex.
45   5. Flat is better than nested.
4612346123
4712347123
4812348123
4912349123
5012350123
-

Context (numlines=6)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

from
to
f1f1
n2   1. Beautiful is beTTer than ugly.n2   1. Beautiful is better than ugly.
3   2. Explicit is better than implicit.
4   3. Simple is better than complex.3   3.   Simple is better than complex.
5   4. Complex is better than complicated.4   4. Complicated is better than complex.
5   5. Flat is better than nested.
61236123
71237123
81238123
91239123
1012310123
1112311123
1212312123
1312313123
1412314123
1512315123
1616
n17   1. Beautiful is beTTer than ugly.n17   1. Beautiful is better than ugly.
18   2. Explicit is better than implicit.
19   3. Simple is better than complex.18   3.   Simple is better than complex.
20   4. Complex is better than complicated.19   4. Complicated is better than complex.
20   5. Flat is better than nested.
2112321123
2212322123
2312323123
2412324123
2512325123
2612326123
2712327123
2812328123
2912329123
3012330123
3131
t32   1. Beautiful is beTTer than ugly.t32   1. Beautiful is better than ugly.
33   2. Explicit is better than implicit.
34   3. Simple is better than complex.33   3.   Simple is better than complex.
35   4. Complex is better than complicated.34   4. Complicated is better than complex.
35   5. Flat is better than nested.
3612336123
3712337123
3812338123
3912339123
4012340123
4112341123
-

Context (numlines=0)

- - - - - - - - - - - - - - - - - - - - - - - - - - -

from
to
n2   1. Beautiful is beTTer than ugly.n2   1. Beautiful is better than ugly.
3   2. Explicit is better than implicit.
4   3. Simple is better than complex.3   3.   Simple is better than complex.
5   4. Complex is better than complicated.4   4. Complicated is better than complex.
5   5. Flat is better than nested.
n17   1. Beautiful is beTTer than ugly.n17   1. Beautiful is better than ugly.
18   2. Explicit is better than implicit.
19   3. Simple is better than complex.18   3.   Simple is better than complex.
20   4. Complex is better than complicated.19   4. Complicated is better than complex.
20   5. Flat is better than nested.
t32   1. Beautiful is beTTer than ugly.t32   1. Beautiful is better than ugly.
33   2. Explicit is better than implicit.
34   3. Simple is better than complex.33   3.   Simple is better than complex.
35   4. Complex is better than complicated.34   4. Complicated is better than complex.
35   5. Flat is better than nested.
-

Same Context

- - - - - - - - -

from
to
t No Differences Found t No Differences Found 
-

Same Full

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

from
to
t1t1
2   1. Beautiful is beTTer than ugly.2   1. Beautiful is beTTer than ugly.
3   2. Explicit is better than implicit.3   2. Explicit is better than implicit.
4   3. Simple is better than complex.4   3. Simple is better than complex.
5   4. Complex is better than complicated.5   4. Complex is better than complicated.
61236123
71237123
81238123
91239123
1012310123
1112311123
1212312123
1312313123
1412314123
1512315123
1616
17   1. Beautiful is beTTer than ugly.17   1. Beautiful is beTTer than ugly.
18   2. Explicit is better than implicit.18   2. Explicit is better than implicit.
19   3. Simple is better than complex.19   3. Simple is better than complex.
20   4. Complex is better than complicated.20   4. Complex is better than complicated.
2112321123
2212322123
2312323123
2412324123
2512325123
2612326123
2712327123
2812328123
2912329123
3012330123
3131
32   1. Beautiful is beTTer than ugly.32   1. Beautiful is beTTer than ugly.
33   2. Explicit is better than implicit.33   2. Explicit is better than implicit.
34   3. Simple is better than complex.34   3. Simple is better than complex.
35   4. Complex is better than complicated.35   4. Complex is better than complicated.
3612336123
3712337123
3812338123
3912339123
4012340123
4112341123
4212342123
4312343123
4412344123
4512345123
-

Empty Context

- - - - - - - - -

from
to
t No Differences Found t No Differences Found 
-

Empty Full

- - - - - - - - -

from
to
t Empty File t Empty File 
-

tabsize=2

- - - - - - - - - - - - - -
f1f1
t2    Line 1: preceeded by from:[tt] to:[ssss]t2    Line 1: preceeded by from:[tt] to:[ssss]
3      Line 2: preceeded by from:[sstt] to:[sssst]3      Line 2: preceeded by from:[sstt] to:[sssst]
4      Line 3: preceeded by from:[sstst] to:[ssssss]4      Line 3: preceeded by from:[sstst] to:[ssssss]
5Line 4:   has from:[sst] to:[sss] after :5Line 4:   has from:[sst] to:[sss] after :
6Line 5: has from:[t] to:[ss] at end 6Line 5: has from:[t] to:[ss] at end
-

tabsize=default

- - - - - - - - - - - - - -
f1f1
t2                Line 1: preceeded by from:[tt] to:[ssss]t2    Line 1: preceeded by from:[tt] to:[ssss]
3                Line 2: preceeded by from:[sstt] to:[sssst]3        Line 2: preceeded by from:[sstt] to:[sssst]
4                Line 3: preceeded by from:[sstst] to:[ssssss]4      Line 3: preceeded by from:[sstst] to:[ssssss]
5Line 4:         has from:[sst] to:[sss] after :5Line 4:   has from:[sst] to:[sss] after :
6Line 5: has from:[t] to:[ss] at end     6Line 5: has from:[t] to:[ss] at end
-

Context (wrapcolumn=14,numlines=0)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
n4line 2n4line 2    adde
 >d
n6line 4   changn6line 4   chanG
>ed>Ed
7line 5   chang7line 5a  chanG
>ed>ed
8line 6   chang8line 6a  chang
>ed>Ed
n10line 8  subtran10line 8
>cted 
t1212345678901234t121234567890
>56789012345689 
>012345 
13short line13another long l
 >ine that needs
 > to be wrapped
14just fits in!!14just fitS in!!
15just fits in t15just fits in t
>wo lines yup!!>wo lineS yup!!
-

wrapcolumn=14,splitlines()

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
f1line 0f1line 0
212345678901234212345678901234
>56789012345689>56789012345689
>012345>012345
3line 13line 1
n4line 2n4line 2    adde
 >d
5line 35line 3
n6line 4   changn6line 4   chanG
>ed>Ed
7line 5   chang7line 5a  chanG
>ed>ed
8line 6   chang8line 6a  chang
>ed>Ed
9line 79line 7
n10line 8  subtran10line 8
>cted 
11line 911line 9
t1212345678901234t121234567890
>56789012345689 
>012345 
13short line13another long l
 >ine that needs
 > to be wrapped
14just fits in!!14just fitS in!!
15just fits in t15just fits in t
>wo lines yup!!>wo lineS yup!!
16the end16the end
-

wrapcolumn=14,splitlines(True)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
f1line 0f1line 0
212345678901234212345678901234
>56789012345689>56789012345689
>012345>012345
3line 13line 1
n4line 2n4line 2    adde
 >d
5line 35line 3
n6line 4   changn6line 4   chanG
>ed>Ed
7line 5   chang7line 5a  chanG
>ed>ed
8line 6   chang8line 6a  chang
>ed>Ed
9line 79line 7
n10line 8  subtran10line 8
>cted 
11line 911line 9
t1212345678901234t121234567890
>56789012345689 
>012345 
13short line13another long l
 >ine that needs
 > to be wrapped
14just fits in!!14just fitS in!!
15just fits in t15just fits in t
>wo lines yup!!>wo lineS yup!!
16the end16the end
- - - \ No newline at end of file diff --git a/sys/lib/python/test/test_dircache.py b/sys/lib/python/test/test_dircache.py deleted file mode 100644 index 68f6fc28b..000000000 --- a/sys/lib/python/test/test_dircache.py +++ /dev/null @@ -1,73 +0,0 @@ -""" - Test cases for the dircache module - Nick Mathewson -""" - -import unittest -from test.test_support import run_unittest, TESTFN -import dircache, os, time, sys, tempfile - - -class DircacheTests(unittest.TestCase): - def setUp(self): - self.tempdir = tempfile.mkdtemp() - - def tearDown(self): - for fname in os.listdir(self.tempdir): - self.delTemp(fname) - os.rmdir(self.tempdir) - - def writeTemp(self, fname): - f = open(os.path.join(self.tempdir, fname), 'w') - f.close() - - def mkdirTemp(self, fname): - os.mkdir(os.path.join(self.tempdir, fname)) - - def delTemp(self, fname): - fname = os.path.join(self.tempdir, fname) - if os.path.isdir(fname): - os.rmdir(fname) - else: - os.unlink(fname) - - def test_listdir(self): - ## SUCCESSFUL CASES - entries = dircache.listdir(self.tempdir) - self.assertEquals(entries, []) - - # Check that cache is actually caching, not just passing through. - self.assert_(dircache.listdir(self.tempdir) is entries) - - # Directories aren't "files" on Windows, and directory mtime has - # nothing to do with when files under a directory get created. - # That is, this test can't possibly work under Windows -- dircache - # is only good for capturing a one-shot snapshot there. - - if sys.platform[:3] not in ('win', 'os2'): - # Sadly, dircache has the same granularity as stat.mtime, and so - # can't notice any changes that occurred within 1 sec of the last - # time it examined a directory. - time.sleep(1) - self.writeTemp("test1") - entries = dircache.listdir(self.tempdir) - self.assertEquals(entries, ['test1']) - self.assert_(dircache.listdir(self.tempdir) is entries) - - ## UNSUCCESSFUL CASES - self.assertRaises(OSError, dircache.listdir, self.tempdir+"_nonexistent") - - def test_annotate(self): - self.writeTemp("test2") - self.mkdirTemp("A") - lst = ['A', 'test2', 'test_nonexistent'] - dircache.annotate(self.tempdir, lst) - self.assertEquals(lst, ['A/', 'test2', 'test_nonexistent']) - - -def test_main(): - run_unittest(DircacheTests) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_dis.py b/sys/lib/python/test/test_dis.py deleted file mode 100644 index c31092c0f..000000000 --- a/sys/lib/python/test/test_dis.py +++ /dev/null @@ -1,156 +0,0 @@ -from test.test_support import verify, verbose, TestFailed, run_unittest -import sys -import dis -import StringIO - -# Minimal tests for dis module - -import unittest - -def _f(a): - print a - return 1 - -dis_f = """\ - %-4d 0 LOAD_FAST 0 (a) - 3 PRINT_ITEM - 4 PRINT_NEWLINE - - %-4d 5 LOAD_CONST 1 (1) - 8 RETURN_VALUE -"""%(_f.func_code.co_firstlineno + 1, - _f.func_code.co_firstlineno + 2) - - -def bug708901(): - for res in range(1, - 10): - pass - -dis_bug708901 = """\ - %-4d 0 SETUP_LOOP 23 (to 26) - 3 LOAD_GLOBAL 0 (range) - 6 LOAD_CONST 1 (1) - - %-4d 9 LOAD_CONST 2 (10) - 12 CALL_FUNCTION 2 - 15 GET_ITER - >> 16 FOR_ITER 6 (to 25) - 19 STORE_FAST 0 (res) - - %-4d 22 JUMP_ABSOLUTE 16 - >> 25 POP_BLOCK - >> 26 LOAD_CONST 0 (None) - 29 RETURN_VALUE -"""%(bug708901.func_code.co_firstlineno + 1, - bug708901.func_code.co_firstlineno + 2, - bug708901.func_code.co_firstlineno + 3) - - -def bug1333982(x=[]): - assert 0, ([s for s in x] + - 1) - pass - -dis_bug1333982 = """\ - %-4d 0 LOAD_CONST 1 (0) - 3 JUMP_IF_TRUE 41 (to 47) - 6 POP_TOP - 7 LOAD_GLOBAL 0 (AssertionError) - 10 BUILD_LIST 0 - 13 DUP_TOP - 14 STORE_FAST 1 (_[1]) - 17 LOAD_FAST 0 (x) - 20 GET_ITER - >> 21 FOR_ITER 13 (to 37) - 24 STORE_FAST 2 (s) - 27 LOAD_FAST 1 (_[1]) - 30 LOAD_FAST 2 (s) - 33 LIST_APPEND - 34 JUMP_ABSOLUTE 21 - >> 37 DELETE_FAST 1 (_[1]) - - %-4d 40 LOAD_CONST 2 (1) - 43 BINARY_ADD - 44 RAISE_VARARGS 2 - >> 47 POP_TOP - - %-4d 48 LOAD_CONST 0 (None) - 51 RETURN_VALUE -"""%(bug1333982.func_code.co_firstlineno + 1, - bug1333982.func_code.co_firstlineno + 2, - bug1333982.func_code.co_firstlineno + 3) - -_BIG_LINENO_FORMAT = """\ -%3d 0 LOAD_GLOBAL 0 (spam) - 3 POP_TOP - 4 LOAD_CONST 0 (None) - 7 RETURN_VALUE -""" - -class DisTests(unittest.TestCase): - def do_disassembly_test(self, func, expected): - s = StringIO.StringIO() - save_stdout = sys.stdout - sys.stdout = s - dis.dis(func) - sys.stdout = save_stdout - got = s.getvalue() - # Trim trailing blanks (if any). - lines = got.split('\n') - lines = [line.rstrip() for line in lines] - expected = expected.split("\n") - import difflib - if expected != lines: - self.fail( - "events did not match expectation:\n" + - "\n".join(difflib.ndiff(expected, - lines))) - - def test_opmap(self): - self.assertEqual(dis.opmap["STOP_CODE"], 0) - self.assertEqual(dis.opmap["LOAD_CONST"] in dis.hasconst, True) - self.assertEqual(dis.opmap["STORE_NAME"] in dis.hasname, True) - - def test_opname(self): - self.assertEqual(dis.opname[dis.opmap["LOAD_FAST"]], "LOAD_FAST") - - def test_boundaries(self): - self.assertEqual(dis.opmap["EXTENDED_ARG"], dis.EXTENDED_ARG) - self.assertEqual(dis.opmap["STORE_NAME"], dis.HAVE_ARGUMENT) - - def test_dis(self): - self.do_disassembly_test(_f, dis_f) - - def test_bug_708901(self): - self.do_disassembly_test(bug708901, dis_bug708901) - - def test_bug_1333982(self): - # This one is checking bytecodes generated for an `assert` statement, - # so fails if the tests are run with -O. Skip this test then. - if __debug__: - self.do_disassembly_test(bug1333982, dis_bug1333982) - - def test_big_linenos(self): - def func(count): - namespace = {} - func = "def foo():\n " + "".join(["\n "] * count + ["spam\n"]) - exec func in namespace - return namespace['foo'] - - # Test all small ranges - for i in xrange(1, 300): - expected = _BIG_LINENO_FORMAT % (i + 2) - self.do_disassembly_test(func(i), expected) - - # Test some larger ranges too - for i in xrange(300, 5000, 10): - expected = _BIG_LINENO_FORMAT % (i + 2) - self.do_disassembly_test(func(i), expected) - -def test_main(): - run_unittest(DisTests) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_distutils.py b/sys/lib/python/test/test_distutils.py deleted file mode 100644 index fcd792d94..000000000 --- a/sys/lib/python/test/test_distutils.py +++ /dev/null @@ -1,17 +0,0 @@ -"""Tests for distutils. - -The tests for distutils are defined in the distutils.tests package; -the test_suite() function there returns a test suite that's ready to -be run. -""" - -import distutils.tests -import test.test_support - - -def test_main(): - test.test_support.run_unittest(distutils.tests.test_suite()) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_dl.py b/sys/lib/python/test/test_dl.py deleted file mode 100755 index b70a4cfee..000000000 --- a/sys/lib/python/test/test_dl.py +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env python -"""Test dlmodule.c - Roger E. Masse revised strategy by Barry Warsaw -""" - -import dl -from test.test_support import verbose,TestSkipped - -sharedlibs = [ - ('/usr/lib/libc.so', 'getpid'), - ('/lib/libc.so.6', 'getpid'), - ('/usr/bin/cygwin1.dll', 'getpid'), - ('/usr/lib/libc.dylib', 'getpid'), - ] - -for s, func in sharedlibs: - try: - if verbose: - print 'trying to open:', s, - l = dl.open(s) - except dl.error, err: - if verbose: - print 'failed', repr(str(err)) - pass - else: - if verbose: - print 'succeeded...', - l.call(func) - l.close() - if verbose: - print 'worked!' - break -else: - raise TestSkipped, 'Could not open any shared libraries' diff --git a/sys/lib/python/test/test_doctest.py b/sys/lib/python/test/test_doctest.py deleted file mode 100644 index e8379c5dc..000000000 --- a/sys/lib/python/test/test_doctest.py +++ /dev/null @@ -1,2418 +0,0 @@ -""" -Test script for doctest. -""" - -from test import test_support -import doctest -import warnings - -###################################################################### -## Sample Objects (used by test cases) -###################################################################### - -def sample_func(v): - """ - Blah blah - - >>> print sample_func(22) - 44 - - Yee ha! - """ - return v+v - -class SampleClass: - """ - >>> print 1 - 1 - - >>> # comments get ignored. so are empty PS1 and PS2 prompts: - >>> - ... - - Multiline example: - >>> sc = SampleClass(3) - >>> for i in range(10): - ... sc = sc.double() - ... print sc.get(), - 6 12 24 48 96 192 384 768 1536 3072 - """ - def __init__(self, val): - """ - >>> print SampleClass(12).get() - 12 - """ - self.val = val - - def double(self): - """ - >>> print SampleClass(12).double().get() - 24 - """ - return SampleClass(self.val + self.val) - - def get(self): - """ - >>> print SampleClass(-5).get() - -5 - """ - return self.val - - def a_staticmethod(v): - """ - >>> print SampleClass.a_staticmethod(10) - 11 - """ - return v+1 - a_staticmethod = staticmethod(a_staticmethod) - - def a_classmethod(cls, v): - """ - >>> print SampleClass.a_classmethod(10) - 12 - >>> print SampleClass(0).a_classmethod(10) - 12 - """ - return v+2 - a_classmethod = classmethod(a_classmethod) - - a_property = property(get, doc=""" - >>> print SampleClass(22).a_property - 22 - """) - - class NestedClass: - """ - >>> x = SampleClass.NestedClass(5) - >>> y = x.square() - >>> print y.get() - 25 - """ - def __init__(self, val=0): - """ - >>> print SampleClass.NestedClass().get() - 0 - """ - self.val = val - def square(self): - return SampleClass.NestedClass(self.val*self.val) - def get(self): - return self.val - -class SampleNewStyleClass(object): - r""" - >>> print '1\n2\n3' - 1 - 2 - 3 - """ - def __init__(self, val): - """ - >>> print SampleNewStyleClass(12).get() - 12 - """ - self.val = val - - def double(self): - """ - >>> print SampleNewStyleClass(12).double().get() - 24 - """ - return SampleNewStyleClass(self.val + self.val) - - def get(self): - """ - >>> print SampleNewStyleClass(-5).get() - -5 - """ - return self.val - -###################################################################### -## Fake stdin (for testing interactive debugging) -###################################################################### - -class _FakeInput: - """ - A fake input stream for pdb's interactive debugger. Whenever a - line is read, print it (to simulate the user typing it), and then - return it. The set of lines to return is specified in the - constructor; they should not have trailing newlines. - """ - def __init__(self, lines): - self.lines = lines - - def readline(self): - line = self.lines.pop(0) - print line - return line+'\n' - -###################################################################### -## Test Cases -###################################################################### - -def test_Example(): r""" -Unit tests for the `Example` class. - -Example is a simple container class that holds: - - `source`: A source string. - - `want`: An expected output string. - - `exc_msg`: An expected exception message string (or None if no - exception is expected). - - `lineno`: A line number (within the docstring). - - `indent`: The example's indentation in the input string. - - `options`: An option dictionary, mapping option flags to True or - False. - -These attributes are set by the constructor. `source` and `want` are -required; the other attributes all have default values: - - >>> example = doctest.Example('print 1', '1\n') - >>> (example.source, example.want, example.exc_msg, - ... example.lineno, example.indent, example.options) - ('print 1\n', '1\n', None, 0, 0, {}) - -The first three attributes (`source`, `want`, and `exc_msg`) may be -specified positionally; the remaining arguments should be specified as -keyword arguments: - - >>> exc_msg = 'IndexError: pop from an empty list' - >>> example = doctest.Example('[].pop()', '', exc_msg, - ... lineno=5, indent=4, - ... options={doctest.ELLIPSIS: True}) - >>> (example.source, example.want, example.exc_msg, - ... example.lineno, example.indent, example.options) - ('[].pop()\n', '', 'IndexError: pop from an empty list\n', 5, 4, {8: True}) - -The constructor normalizes the `source` string to end in a newline: - - Source spans a single line: no terminating newline. - >>> e = doctest.Example('print 1', '1\n') - >>> e.source, e.want - ('print 1\n', '1\n') - - >>> e = doctest.Example('print 1\n', '1\n') - >>> e.source, e.want - ('print 1\n', '1\n') - - Source spans multiple lines: require terminating newline. - >>> e = doctest.Example('print 1;\nprint 2\n', '1\n2\n') - >>> e.source, e.want - ('print 1;\nprint 2\n', '1\n2\n') - - >>> e = doctest.Example('print 1;\nprint 2', '1\n2\n') - >>> e.source, e.want - ('print 1;\nprint 2\n', '1\n2\n') - - Empty source string (which should never appear in real examples) - >>> e = doctest.Example('', '') - >>> e.source, e.want - ('\n', '') - -The constructor normalizes the `want` string to end in a newline, -unless it's the empty string: - - >>> e = doctest.Example('print 1', '1\n') - >>> e.source, e.want - ('print 1\n', '1\n') - - >>> e = doctest.Example('print 1', '1') - >>> e.source, e.want - ('print 1\n', '1\n') - - >>> e = doctest.Example('print', '') - >>> e.source, e.want - ('print\n', '') - -The constructor normalizes the `exc_msg` string to end in a newline, -unless it's `None`: - - Message spans one line - >>> exc_msg = 'IndexError: pop from an empty list' - >>> e = doctest.Example('[].pop()', '', exc_msg) - >>> e.exc_msg - 'IndexError: pop from an empty list\n' - - >>> exc_msg = 'IndexError: pop from an empty list\n' - >>> e = doctest.Example('[].pop()', '', exc_msg) - >>> e.exc_msg - 'IndexError: pop from an empty list\n' - - Message spans multiple lines - >>> exc_msg = 'ValueError: 1\n 2' - >>> e = doctest.Example('raise ValueError("1\n 2")', '', exc_msg) - >>> e.exc_msg - 'ValueError: 1\n 2\n' - - >>> exc_msg = 'ValueError: 1\n 2\n' - >>> e = doctest.Example('raise ValueError("1\n 2")', '', exc_msg) - >>> e.exc_msg - 'ValueError: 1\n 2\n' - - Empty (but non-None) exception message (which should never appear - in real examples) - >>> exc_msg = '' - >>> e = doctest.Example('raise X()', '', exc_msg) - >>> e.exc_msg - '\n' -""" - -def test_DocTest(): r""" -Unit tests for the `DocTest` class. - -DocTest is a collection of examples, extracted from a docstring, along -with information about where the docstring comes from (a name, -filename, and line number). The docstring is parsed by the `DocTest` -constructor: - - >>> docstring = ''' - ... >>> print 12 - ... 12 - ... - ... Non-example text. - ... - ... >>> print 'another\example' - ... another - ... example - ... ''' - >>> globs = {} # globals to run the test in. - >>> parser = doctest.DocTestParser() - >>> test = parser.get_doctest(docstring, globs, 'some_test', - ... 'some_file', 20) - >>> print test - - >>> len(test.examples) - 2 - >>> e1, e2 = test.examples - >>> (e1.source, e1.want, e1.lineno) - ('print 12\n', '12\n', 1) - >>> (e2.source, e2.want, e2.lineno) - ("print 'another\\example'\n", 'another\nexample\n', 6) - -Source information (name, filename, and line number) is available as -attributes on the doctest object: - - >>> (test.name, test.filename, test.lineno) - ('some_test', 'some_file', 20) - -The line number of an example within its containing file is found by -adding the line number of the example and the line number of its -containing test: - - >>> test.lineno + e1.lineno - 21 - >>> test.lineno + e2.lineno - 26 - -If the docstring contains inconsistant leading whitespace in the -expected output of an example, then `DocTest` will raise a ValueError: - - >>> docstring = r''' - ... >>> print 'bad\nindentation' - ... bad - ... indentation - ... ''' - >>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0) - Traceback (most recent call last): - ValueError: line 4 of the docstring for some_test has inconsistent leading whitespace: 'indentation' - -If the docstring contains inconsistent leading whitespace on -continuation lines, then `DocTest` will raise a ValueError: - - >>> docstring = r''' - ... >>> print ('bad indentation', - ... ... 2) - ... ('bad', 'indentation') - ... ''' - >>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0) - Traceback (most recent call last): - ValueError: line 2 of the docstring for some_test has inconsistent leading whitespace: '... 2)' - -If there's no blank space after a PS1 prompt ('>>>'), then `DocTest` -will raise a ValueError: - - >>> docstring = '>>>print 1\n1' - >>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0) - Traceback (most recent call last): - ValueError: line 1 of the docstring for some_test lacks blank after >>>: '>>>print 1' - -If there's no blank space after a PS2 prompt ('...'), then `DocTest` -will raise a ValueError: - - >>> docstring = '>>> if 1:\n...print 1\n1' - >>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0) - Traceback (most recent call last): - ValueError: line 2 of the docstring for some_test lacks blank after ...: '...print 1' - -""" - -def test_DocTestFinder(): r""" -Unit tests for the `DocTestFinder` class. - -DocTestFinder is used to extract DocTests from an object's docstring -and the docstrings of its contained objects. It can be used with -modules, functions, classes, methods, staticmethods, classmethods, and -properties. - -Finding Tests in Functions -~~~~~~~~~~~~~~~~~~~~~~~~~~ -For a function whose docstring contains examples, DocTestFinder.find() -will return a single test (for that function's docstring): - - >>> finder = doctest.DocTestFinder() - -We'll simulate a __file__ attr that ends in pyc: - - >>> import test.test_doctest - >>> old = test.test_doctest.__file__ - >>> test.test_doctest.__file__ = 'test_doctest.pyc' - - >>> tests = finder.find(sample_func) - - >>> print tests # doctest: +ELLIPSIS - [] - -The exact name depends on how test_doctest was invoked, so allow for -leading path components. - - >>> tests[0].filename # doctest: +ELLIPSIS - '...test_doctest.py' - - >>> test.test_doctest.__file__ = old - - - >>> e = tests[0].examples[0] - >>> (e.source, e.want, e.lineno) - ('print sample_func(22)\n', '44\n', 3) - -By default, tests are created for objects with no docstring: - - >>> def no_docstring(v): - ... pass - >>> finder.find(no_docstring) - [] - -However, the optional argument `exclude_empty` to the DocTestFinder -constructor can be used to exclude tests for objects with empty -docstrings: - - >>> def no_docstring(v): - ... pass - >>> excl_empty_finder = doctest.DocTestFinder(exclude_empty=True) - >>> excl_empty_finder.find(no_docstring) - [] - -If the function has a docstring with no examples, then a test with no -examples is returned. (This lets `DocTestRunner` collect statistics -about which functions have no tests -- but is that useful? And should -an empty test also be created when there's no docstring?) - - >>> def no_examples(v): - ... ''' no doctest examples ''' - >>> finder.find(no_examples) # doctest: +ELLIPSIS - [] - -Finding Tests in Classes -~~~~~~~~~~~~~~~~~~~~~~~~ -For a class, DocTestFinder will create a test for the class's -docstring, and will recursively explore its contents, including -methods, classmethods, staticmethods, properties, and nested classes. - - >>> finder = doctest.DocTestFinder() - >>> tests = finder.find(SampleClass) - >>> for t in tests: - ... print '%2s %s' % (len(t.examples), t.name) - 3 SampleClass - 3 SampleClass.NestedClass - 1 SampleClass.NestedClass.__init__ - 1 SampleClass.__init__ - 2 SampleClass.a_classmethod - 1 SampleClass.a_property - 1 SampleClass.a_staticmethod - 1 SampleClass.double - 1 SampleClass.get - -New-style classes are also supported: - - >>> tests = finder.find(SampleNewStyleClass) - >>> for t in tests: - ... print '%2s %s' % (len(t.examples), t.name) - 1 SampleNewStyleClass - 1 SampleNewStyleClass.__init__ - 1 SampleNewStyleClass.double - 1 SampleNewStyleClass.get - -Finding Tests in Modules -~~~~~~~~~~~~~~~~~~~~~~~~ -For a module, DocTestFinder will create a test for the class's -docstring, and will recursively explore its contents, including -functions, classes, and the `__test__` dictionary, if it exists: - - >>> # A module - >>> import new - >>> m = new.module('some_module') - >>> def triple(val): - ... ''' - ... >>> print triple(11) - ... 33 - ... ''' - ... return val*3 - >>> m.__dict__.update({ - ... 'sample_func': sample_func, - ... 'SampleClass': SampleClass, - ... '__doc__': ''' - ... Module docstring. - ... >>> print 'module' - ... module - ... ''', - ... '__test__': { - ... 'd': '>>> print 6\n6\n>>> print 7\n7\n', - ... 'c': triple}}) - - >>> finder = doctest.DocTestFinder() - >>> # Use module=test.test_doctest, to prevent doctest from - >>> # ignoring the objects since they weren't defined in m. - >>> import test.test_doctest - >>> tests = finder.find(m, module=test.test_doctest) - >>> for t in tests: - ... print '%2s %s' % (len(t.examples), t.name) - 1 some_module - 3 some_module.SampleClass - 3 some_module.SampleClass.NestedClass - 1 some_module.SampleClass.NestedClass.__init__ - 1 some_module.SampleClass.__init__ - 2 some_module.SampleClass.a_classmethod - 1 some_module.SampleClass.a_property - 1 some_module.SampleClass.a_staticmethod - 1 some_module.SampleClass.double - 1 some_module.SampleClass.get - 1 some_module.__test__.c - 2 some_module.__test__.d - 1 some_module.sample_func - -Duplicate Removal -~~~~~~~~~~~~~~~~~ -If a single object is listed twice (under different names), then tests -will only be generated for it once: - - >>> from test import doctest_aliases - >>> tests = excl_empty_finder.find(doctest_aliases) - >>> print len(tests) - 2 - >>> print tests[0].name - test.doctest_aliases.TwoNames - - TwoNames.f and TwoNames.g are bound to the same object. - We can't guess which will be found in doctest's traversal of - TwoNames.__dict__ first, so we have to allow for either. - - >>> tests[1].name.split('.')[-1] in ['f', 'g'] - True - -Empty Tests -~~~~~~~~~~~ -By default, an object with no doctests doesn't create any tests: - - >>> tests = doctest.DocTestFinder().find(SampleClass) - >>> for t in tests: - ... print '%2s %s' % (len(t.examples), t.name) - 3 SampleClass - 3 SampleClass.NestedClass - 1 SampleClass.NestedClass.__init__ - 1 SampleClass.__init__ - 2 SampleClass.a_classmethod - 1 SampleClass.a_property - 1 SampleClass.a_staticmethod - 1 SampleClass.double - 1 SampleClass.get - -By default, that excluded objects with no doctests. exclude_empty=False -tells it to include (empty) tests for objects with no doctests. This feature -is really to support backward compatibility in what doctest.master.summarize() -displays. - - >>> tests = doctest.DocTestFinder(exclude_empty=False).find(SampleClass) - >>> for t in tests: - ... print '%2s %s' % (len(t.examples), t.name) - 3 SampleClass - 3 SampleClass.NestedClass - 1 SampleClass.NestedClass.__init__ - 0 SampleClass.NestedClass.get - 0 SampleClass.NestedClass.square - 1 SampleClass.__init__ - 2 SampleClass.a_classmethod - 1 SampleClass.a_property - 1 SampleClass.a_staticmethod - 1 SampleClass.double - 1 SampleClass.get - -Turning off Recursion -~~~~~~~~~~~~~~~~~~~~~ -DocTestFinder can be told not to look for tests in contained objects -using the `recurse` flag: - - >>> tests = doctest.DocTestFinder(recurse=False).find(SampleClass) - >>> for t in tests: - ... print '%2s %s' % (len(t.examples), t.name) - 3 SampleClass - -Line numbers -~~~~~~~~~~~~ -DocTestFinder finds the line number of each example: - - >>> def f(x): - ... ''' - ... >>> x = 12 - ... - ... some text - ... - ... >>> # examples are not created for comments & bare prompts. - ... >>> - ... ... - ... - ... >>> for x in range(10): - ... ... print x, - ... 0 1 2 3 4 5 6 7 8 9 - ... >>> x//2 - ... 6 - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> [e.lineno for e in test.examples] - [1, 9, 12] -""" - -def test_DocTestParser(): r""" -Unit tests for the `DocTestParser` class. - -DocTestParser is used to parse docstrings containing doctest examples. - -The `parse` method divides a docstring into examples and intervening -text: - - >>> s = ''' - ... >>> x, y = 2, 3 # no output expected - ... >>> if 1: - ... ... print x - ... ... print y - ... 2 - ... 3 - ... - ... Some text. - ... >>> x+y - ... 5 - ... ''' - >>> parser = doctest.DocTestParser() - >>> for piece in parser.parse(s): - ... if isinstance(piece, doctest.Example): - ... print 'Example:', (piece.source, piece.want, piece.lineno) - ... else: - ... print ' Text:', `piece` - Text: '\n' - Example: ('x, y = 2, 3 # no output expected\n', '', 1) - Text: '' - Example: ('if 1:\n print x\n print y\n', '2\n3\n', 2) - Text: '\nSome text.\n' - Example: ('x+y\n', '5\n', 9) - Text: '' - -The `get_examples` method returns just the examples: - - >>> for piece in parser.get_examples(s): - ... print (piece.source, piece.want, piece.lineno) - ('x, y = 2, 3 # no output expected\n', '', 1) - ('if 1:\n print x\n print y\n', '2\n3\n', 2) - ('x+y\n', '5\n', 9) - -The `get_doctest` method creates a Test from the examples, along with the -given arguments: - - >>> test = parser.get_doctest(s, {}, 'name', 'filename', lineno=5) - >>> (test.name, test.filename, test.lineno) - ('name', 'filename', 5) - >>> for piece in test.examples: - ... print (piece.source, piece.want, piece.lineno) - ('x, y = 2, 3 # no output expected\n', '', 1) - ('if 1:\n print x\n print y\n', '2\n3\n', 2) - ('x+y\n', '5\n', 9) -""" - -class test_DocTestRunner: - def basics(): r""" -Unit tests for the `DocTestRunner` class. - -DocTestRunner is used to run DocTest test cases, and to accumulate -statistics. Here's a simple DocTest case we can use: - - >>> def f(x): - ... ''' - ... >>> x = 12 - ... >>> print x - ... 12 - ... >>> x//2 - ... 6 - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - -The main DocTestRunner interface is the `run` method, which runs a -given DocTest case in a given namespace (globs). It returns a tuple -`(f,t)`, where `f` is the number of failed tests and `t` is the number -of tried tests. - - >>> doctest.DocTestRunner(verbose=False).run(test) - (0, 3) - -If any example produces incorrect output, then the test runner reports -the failure and proceeds to the next example: - - >>> def f(x): - ... ''' - ... >>> x = 12 - ... >>> print x - ... 14 - ... >>> x//2 - ... 6 - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=True).run(test) - ... # doctest: +ELLIPSIS - Trying: - x = 12 - Expecting nothing - ok - Trying: - print x - Expecting: - 14 - ********************************************************************** - File ..., line 4, in f - Failed example: - print x - Expected: - 14 - Got: - 12 - Trying: - x//2 - Expecting: - 6 - ok - (1, 3) -""" - def verbose_flag(): r""" -The `verbose` flag makes the test runner generate more detailed -output: - - >>> def f(x): - ... ''' - ... >>> x = 12 - ... >>> print x - ... 12 - ... >>> x//2 - ... 6 - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - - >>> doctest.DocTestRunner(verbose=True).run(test) - Trying: - x = 12 - Expecting nothing - ok - Trying: - print x - Expecting: - 12 - ok - Trying: - x//2 - Expecting: - 6 - ok - (0, 3) - -If the `verbose` flag is unspecified, then the output will be verbose -iff `-v` appears in sys.argv: - - >>> # Save the real sys.argv list. - >>> old_argv = sys.argv - - >>> # If -v does not appear in sys.argv, then output isn't verbose. - >>> sys.argv = ['test'] - >>> doctest.DocTestRunner().run(test) - (0, 3) - - >>> # If -v does appear in sys.argv, then output is verbose. - >>> sys.argv = ['test', '-v'] - >>> doctest.DocTestRunner().run(test) - Trying: - x = 12 - Expecting nothing - ok - Trying: - print x - Expecting: - 12 - ok - Trying: - x//2 - Expecting: - 6 - ok - (0, 3) - - >>> # Restore sys.argv - >>> sys.argv = old_argv - -In the remaining examples, the test runner's verbosity will be -explicitly set, to ensure that the test behavior is consistent. - """ - def exceptions(): r""" -Tests of `DocTestRunner`'s exception handling. - -An expected exception is specified with a traceback message. The -lines between the first line and the type/value may be omitted or -replaced with any other string: - - >>> def f(x): - ... ''' - ... >>> x = 12 - ... >>> print x//0 - ... Traceback (most recent call last): - ... ZeroDivisionError: integer division or modulo by zero - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - (0, 2) - -An example may not generate output before it raises an exception; if -it does, then the traceback message will not be recognized as -signaling an expected exception, so the example will be reported as an -unexpected exception: - - >>> def f(x): - ... ''' - ... >>> x = 12 - ... >>> print 'pre-exception output', x//0 - ... pre-exception output - ... Traceback (most recent call last): - ... ZeroDivisionError: integer division or modulo by zero - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 4, in f - Failed example: - print 'pre-exception output', x//0 - Exception raised: - ... - ZeroDivisionError: integer division or modulo by zero - (1, 2) - -Exception messages may contain newlines: - - >>> def f(x): - ... r''' - ... >>> raise ValueError, 'multi\nline\nmessage' - ... Traceback (most recent call last): - ... ValueError: multi - ... line - ... message - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - (0, 1) - -If an exception is expected, but an exception with the wrong type or -message is raised, then it is reported as a failure: - - >>> def f(x): - ... r''' - ... >>> raise ValueError, 'message' - ... Traceback (most recent call last): - ... ValueError: wrong message - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 3, in f - Failed example: - raise ValueError, 'message' - Expected: - Traceback (most recent call last): - ValueError: wrong message - Got: - Traceback (most recent call last): - ... - ValueError: message - (1, 1) - -However, IGNORE_EXCEPTION_DETAIL can be used to allow a mismatch in the -detail: - - >>> def f(x): - ... r''' - ... >>> raise ValueError, 'message' #doctest: +IGNORE_EXCEPTION_DETAIL - ... Traceback (most recent call last): - ... ValueError: wrong message - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - (0, 1) - -But IGNORE_EXCEPTION_DETAIL does not allow a mismatch in the exception type: - - >>> def f(x): - ... r''' - ... >>> raise ValueError, 'message' #doctest: +IGNORE_EXCEPTION_DETAIL - ... Traceback (most recent call last): - ... TypeError: wrong type - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 3, in f - Failed example: - raise ValueError, 'message' #doctest: +IGNORE_EXCEPTION_DETAIL - Expected: - Traceback (most recent call last): - TypeError: wrong type - Got: - Traceback (most recent call last): - ... - ValueError: message - (1, 1) - -If an exception is raised but not expected, then it is reported as an -unexpected exception: - - >>> def f(x): - ... r''' - ... >>> 1//0 - ... 0 - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 3, in f - Failed example: - 1//0 - Exception raised: - Traceback (most recent call last): - ... - ZeroDivisionError: integer division or modulo by zero - (1, 1) -""" - def optionflags(): r""" -Tests of `DocTestRunner`'s option flag handling. - -Several option flags can be used to customize the behavior of the test -runner. These are defined as module constants in doctest, and passed -to the DocTestRunner constructor (multiple constants should be or-ed -together). - -The DONT_ACCEPT_TRUE_FOR_1 flag disables matches between True/False -and 1/0: - - >>> def f(x): - ... '>>> True\n1\n' - - >>> # Without the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - (0, 1) - - >>> # With the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> flags = doctest.DONT_ACCEPT_TRUE_FOR_1 - >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 2, in f - Failed example: - True - Expected: - 1 - Got: - True - (1, 1) - -The DONT_ACCEPT_BLANKLINE flag disables the match between blank lines -and the '' marker: - - >>> def f(x): - ... '>>> print "a\\n\\nb"\na\n\nb\n' - - >>> # Without the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - (0, 1) - - >>> # With the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> flags = doctest.DONT_ACCEPT_BLANKLINE - >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 2, in f - Failed example: - print "a\n\nb" - Expected: - a - - b - Got: - a - - b - (1, 1) - -The NORMALIZE_WHITESPACE flag causes all sequences of whitespace to be -treated as equal: - - >>> def f(x): - ... '>>> print 1, 2, 3\n 1 2\n 3' - - >>> # Without the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 2, in f - Failed example: - print 1, 2, 3 - Expected: - 1 2 - 3 - Got: - 1 2 3 - (1, 1) - - >>> # With the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> flags = doctest.NORMALIZE_WHITESPACE - >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) - (0, 1) - - An example from the docs: - >>> print range(20) #doctest: +NORMALIZE_WHITESPACE - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] - -The ELLIPSIS flag causes ellipsis marker ("...") in the expected -output to match any substring in the actual output: - - >>> def f(x): - ... '>>> print range(15)\n[0, 1, 2, ..., 14]\n' - - >>> # Without the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 2, in f - Failed example: - print range(15) - Expected: - [0, 1, 2, ..., 14] - Got: - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - (1, 1) - - >>> # With the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> flags = doctest.ELLIPSIS - >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) - (0, 1) - - ... also matches nothing: - - >>> for i in range(100): - ... print i**2, #doctest: +ELLIPSIS - 0 1...4...9 16 ... 36 49 64 ... 9801 - - ... can be surprising; e.g., this test passes: - - >>> for i in range(21): #doctest: +ELLIPSIS - ... print i, - 0 1 2 ...1...2...0 - - Examples from the docs: - - >>> print range(20) # doctest:+ELLIPSIS - [0, 1, ..., 18, 19] - - >>> print range(20) # doctest: +ELLIPSIS - ... # doctest: +NORMALIZE_WHITESPACE - [0, 1, ..., 18, 19] - -The SKIP flag causes an example to be skipped entirely. I.e., the -example is not run. It can be useful in contexts where doctest -examples serve as both documentation and test cases, and an example -should be included for documentation purposes, but should not be -checked (e.g., because its output is random, or depends on resources -which would be unavailable.) The SKIP flag can also be used for -'commenting out' broken examples. - - >>> import unavailable_resource # doctest: +SKIP - >>> unavailable_resource.do_something() # doctest: +SKIP - >>> unavailable_resource.blow_up() # doctest: +SKIP - Traceback (most recent call last): - ... - UncheckedBlowUpError: Nobody checks me. - - >>> import random - >>> print random.random() # doctest: +SKIP - 0.721216923889 - -The REPORT_UDIFF flag causes failures that involve multi-line expected -and actual outputs to be displayed using a unified diff: - - >>> def f(x): - ... r''' - ... >>> print '\n'.join('abcdefg') - ... a - ... B - ... c - ... d - ... f - ... g - ... h - ... ''' - - >>> # Without the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 3, in f - Failed example: - print '\n'.join('abcdefg') - Expected: - a - B - c - d - f - g - h - Got: - a - b - c - d - e - f - g - (1, 1) - - >>> # With the flag: - >>> test = doctest.DocTestFinder().find(f)[0] - >>> flags = doctest.REPORT_UDIFF - >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 3, in f - Failed example: - print '\n'.join('abcdefg') - Differences (unified diff with -expected +actual): - @@ -1,7 +1,7 @@ - a - -B - +b - c - d - +e - f - g - -h - (1, 1) - -The REPORT_CDIFF flag causes failures that involve multi-line expected -and actual outputs to be displayed using a context diff: - - >>> # Reuse f() from the REPORT_UDIFF example, above. - >>> test = doctest.DocTestFinder().find(f)[0] - >>> flags = doctest.REPORT_CDIFF - >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 3, in f - Failed example: - print '\n'.join('abcdefg') - Differences (context diff with expected followed by actual): - *************** - *** 1,7 **** - a - ! B - c - d - f - g - - h - --- 1,7 ---- - a - ! b - c - d - + e - f - g - (1, 1) - - -The REPORT_NDIFF flag causes failures to use the difflib.Differ algorithm -used by the popular ndiff.py utility. This does intraline difference -marking, as well as interline differences. - - >>> def f(x): - ... r''' - ... >>> print "a b c d e f g h i j k l m" - ... a b c d e f g h i j k 1 m - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> flags = doctest.REPORT_NDIFF - >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 3, in f - Failed example: - print "a b c d e f g h i j k l m" - Differences (ndiff with -expected +actual): - - a b c d e f g h i j k 1 m - ? ^ - + a b c d e f g h i j k l m - ? + ++ ^ - (1, 1) - -The REPORT_ONLY_FIRST_FAILURE supresses result output after the first -failing example: - - >>> def f(x): - ... r''' - ... >>> print 1 # first success - ... 1 - ... >>> print 2 # first failure - ... 200 - ... >>> print 3 # second failure - ... 300 - ... >>> print 4 # second success - ... 4 - ... >>> print 5 # third failure - ... 500 - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> flags = doctest.REPORT_ONLY_FIRST_FAILURE - >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 5, in f - Failed example: - print 2 # first failure - Expected: - 200 - Got: - 2 - (3, 5) - -However, output from `report_start` is not supressed: - - >>> doctest.DocTestRunner(verbose=True, optionflags=flags).run(test) - ... # doctest: +ELLIPSIS - Trying: - print 1 # first success - Expecting: - 1 - ok - Trying: - print 2 # first failure - Expecting: - 200 - ********************************************************************** - File ..., line 5, in f - Failed example: - print 2 # first failure - Expected: - 200 - Got: - 2 - (3, 5) - -For the purposes of REPORT_ONLY_FIRST_FAILURE, unexpected exceptions -count as failures: - - >>> def f(x): - ... r''' - ... >>> print 1 # first success - ... 1 - ... >>> raise ValueError(2) # first failure - ... 200 - ... >>> print 3 # second failure - ... 300 - ... >>> print 4 # second success - ... 4 - ... >>> print 5 # third failure - ... 500 - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> flags = doctest.REPORT_ONLY_FIRST_FAILURE - >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 5, in f - Failed example: - raise ValueError(2) # first failure - Exception raised: - ... - ValueError: 2 - (3, 5) - -New option flags can also be registered, via register_optionflag(). Here -we reach into doctest's internals a bit. - - >>> unlikely = "UNLIKELY_OPTION_NAME" - >>> unlikely in doctest.OPTIONFLAGS_BY_NAME - False - >>> new_flag_value = doctest.register_optionflag(unlikely) - >>> unlikely in doctest.OPTIONFLAGS_BY_NAME - True - -Before 2.4.4/2.5, registering a name more than once erroneously created -more than one flag value. Here we verify that's fixed: - - >>> redundant_flag_value = doctest.register_optionflag(unlikely) - >>> redundant_flag_value == new_flag_value - True - -Clean up. - >>> del doctest.OPTIONFLAGS_BY_NAME[unlikely] - - """ - - def option_directives(): r""" -Tests of `DocTestRunner`'s option directive mechanism. - -Option directives can be used to turn option flags on or off for a -single example. To turn an option on for an example, follow that -example with a comment of the form ``# doctest: +OPTION``: - - >>> def f(x): r''' - ... >>> print range(10) # should fail: no ellipsis - ... [0, 1, ..., 9] - ... - ... >>> print range(10) # doctest: +ELLIPSIS - ... [0, 1, ..., 9] - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 2, in f - Failed example: - print range(10) # should fail: no ellipsis - Expected: - [0, 1, ..., 9] - Got: - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - (1, 2) - -To turn an option off for an example, follow that example with a -comment of the form ``# doctest: -OPTION``: - - >>> def f(x): r''' - ... >>> print range(10) - ... [0, 1, ..., 9] - ... - ... >>> # should fail: no ellipsis - ... >>> print range(10) # doctest: -ELLIPSIS - ... [0, 1, ..., 9] - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False, - ... optionflags=doctest.ELLIPSIS).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 6, in f - Failed example: - print range(10) # doctest: -ELLIPSIS - Expected: - [0, 1, ..., 9] - Got: - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - (1, 2) - -Option directives affect only the example that they appear with; they -do not change the options for surrounding examples: - - >>> def f(x): r''' - ... >>> print range(10) # Should fail: no ellipsis - ... [0, 1, ..., 9] - ... - ... >>> print range(10) # doctest: +ELLIPSIS - ... [0, 1, ..., 9] - ... - ... >>> print range(10) # Should fail: no ellipsis - ... [0, 1, ..., 9] - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 2, in f - Failed example: - print range(10) # Should fail: no ellipsis - Expected: - [0, 1, ..., 9] - Got: - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - ********************************************************************** - File ..., line 8, in f - Failed example: - print range(10) # Should fail: no ellipsis - Expected: - [0, 1, ..., 9] - Got: - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - (2, 3) - -Multiple options may be modified by a single option directive. They -may be separated by whitespace, commas, or both: - - >>> def f(x): r''' - ... >>> print range(10) # Should fail - ... [0, 1, ..., 9] - ... >>> print range(10) # Should succeed - ... ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE - ... [0, 1, ..., 9] - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 2, in f - Failed example: - print range(10) # Should fail - Expected: - [0, 1, ..., 9] - Got: - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - (1, 2) - - >>> def f(x): r''' - ... >>> print range(10) # Should fail - ... [0, 1, ..., 9] - ... >>> print range(10) # Should succeed - ... ... # doctest: +ELLIPSIS,+NORMALIZE_WHITESPACE - ... [0, 1, ..., 9] - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 2, in f - Failed example: - print range(10) # Should fail - Expected: - [0, 1, ..., 9] - Got: - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - (1, 2) - - >>> def f(x): r''' - ... >>> print range(10) # Should fail - ... [0, 1, ..., 9] - ... >>> print range(10) # Should succeed - ... ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE - ... [0, 1, ..., 9] - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - ... # doctest: +ELLIPSIS - ********************************************************************** - File ..., line 2, in f - Failed example: - print range(10) # Should fail - Expected: - [0, 1, ..., 9] - Got: - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - (1, 2) - -The option directive may be put on the line following the source, as -long as a continuation prompt is used: - - >>> def f(x): r''' - ... >>> print range(10) - ... ... # doctest: +ELLIPSIS - ... [0, 1, ..., 9] - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - (0, 1) - -For examples with multi-line source, the option directive may appear -at the end of any line: - - >>> def f(x): r''' - ... >>> for x in range(10): # doctest: +ELLIPSIS - ... ... print x, - ... 0 1 2 ... 9 - ... - ... >>> for x in range(10): - ... ... print x, # doctest: +ELLIPSIS - ... 0 1 2 ... 9 - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - (0, 2) - -If more than one line of an example with multi-line source has an -option directive, then they are combined: - - >>> def f(x): r''' - ... Should fail (option directive not on the last line): - ... >>> for x in range(10): # doctest: +ELLIPSIS - ... ... print x, # doctest: +NORMALIZE_WHITESPACE - ... 0 1 2...9 - ... ''' - >>> test = doctest.DocTestFinder().find(f)[0] - >>> doctest.DocTestRunner(verbose=False).run(test) - (0, 1) - -It is an error to have a comment of the form ``# doctest:`` that is -*not* followed by words of the form ``+OPTION`` or ``-OPTION``, where -``OPTION`` is an option that has been registered with -`register_option`: - - >>> # Error: Option not registered - >>> s = '>>> print 12 #doctest: +BADOPTION' - >>> test = doctest.DocTestParser().get_doctest(s, {}, 's', 's.py', 0) - Traceback (most recent call last): - ValueError: line 1 of the doctest for s has an invalid option: '+BADOPTION' - - >>> # Error: No + or - prefix - >>> s = '>>> print 12 #doctest: ELLIPSIS' - >>> test = doctest.DocTestParser().get_doctest(s, {}, 's', 's.py', 0) - Traceback (most recent call last): - ValueError: line 1 of the doctest for s has an invalid option: 'ELLIPSIS' - -It is an error to use an option directive on a line that contains no -source: - - >>> s = '>>> # doctest: +ELLIPSIS' - >>> test = doctest.DocTestParser().get_doctest(s, {}, 's', 's.py', 0) - Traceback (most recent call last): - ValueError: line 0 of the doctest for s has an option directive on a line with no example: '# doctest: +ELLIPSIS' -""" - -def test_testsource(): r""" -Unit tests for `testsource()`. - -The testsource() function takes a module and a name, finds the (first) -test with that name in that module, and converts it to a script. The -example code is converted to regular Python code. The surrounding -words and expected output are converted to comments: - - >>> import test.test_doctest - >>> name = 'test.test_doctest.sample_func' - >>> print doctest.testsource(test.test_doctest, name) - # Blah blah - # - print sample_func(22) - # Expected: - ## 44 - # - # Yee ha! - - - >>> name = 'test.test_doctest.SampleNewStyleClass' - >>> print doctest.testsource(test.test_doctest, name) - print '1\n2\n3' - # Expected: - ## 1 - ## 2 - ## 3 - - - >>> name = 'test.test_doctest.SampleClass.a_classmethod' - >>> print doctest.testsource(test.test_doctest, name) - print SampleClass.a_classmethod(10) - # Expected: - ## 12 - print SampleClass(0).a_classmethod(10) - # Expected: - ## 12 - -""" - -def test_debug(): r""" - -Create a docstring that we want to debug: - - >>> s = ''' - ... >>> x = 12 - ... >>> print x - ... 12 - ... ''' - -Create some fake stdin input, to feed to the debugger: - - >>> import tempfile - >>> real_stdin = sys.stdin - >>> sys.stdin = _FakeInput(['next', 'print x', 'continue']) - -Run the debugger on the docstring, and then restore sys.stdin. - - >>> try: doctest.debug_src(s) - ... finally: sys.stdin = real_stdin - > (1)() - (Pdb) next - 12 - --Return-- - > (1)()->None - (Pdb) print x - 12 - (Pdb) continue - -""" - -def test_pdb_set_trace(): - """Using pdb.set_trace from a doctest. - - You can use pdb.set_trace from a doctest. To do so, you must - retrieve the set_trace function from the pdb module at the time - you use it. The doctest module changes sys.stdout so that it can - capture program output. It also temporarily replaces pdb.set_trace - with a version that restores stdout. This is necessary for you to - see debugger output. - - >>> doc = ''' - ... >>> x = 42 - ... >>> import pdb; pdb.set_trace() - ... ''' - >>> parser = doctest.DocTestParser() - >>> test = parser.get_doctest(doc, {}, "foo", "foo.py", 0) - >>> runner = doctest.DocTestRunner(verbose=False) - - To demonstrate this, we'll create a fake standard input that - captures our debugger input: - - >>> import tempfile - >>> real_stdin = sys.stdin - >>> sys.stdin = _FakeInput([ - ... 'print x', # print data defined by the example - ... 'continue', # stop debugging - ... '']) - - >>> try: runner.run(test) - ... finally: sys.stdin = real_stdin - --Return-- - > (1)()->None - -> import pdb; pdb.set_trace() - (Pdb) print x - 42 - (Pdb) continue - (0, 2) - - You can also put pdb.set_trace in a function called from a test: - - >>> def calls_set_trace(): - ... y=2 - ... import pdb; pdb.set_trace() - - >>> doc = ''' - ... >>> x=1 - ... >>> calls_set_trace() - ... ''' - >>> test = parser.get_doctest(doc, globals(), "foo", "foo.py", 0) - >>> real_stdin = sys.stdin - >>> sys.stdin = _FakeInput([ - ... 'print y', # print data defined in the function - ... 'up', # out of function - ... 'print x', # print data defined by the example - ... 'continue', # stop debugging - ... '']) - - >>> try: - ... runner.run(test) - ... finally: - ... sys.stdin = real_stdin - --Return-- - > (3)calls_set_trace()->None - -> import pdb; pdb.set_trace() - (Pdb) print y - 2 - (Pdb) up - > (1)() - -> calls_set_trace() - (Pdb) print x - 1 - (Pdb) continue - (0, 2) - - During interactive debugging, source code is shown, even for - doctest examples: - - >>> doc = ''' - ... >>> def f(x): - ... ... g(x*2) - ... >>> def g(x): - ... ... print x+3 - ... ... import pdb; pdb.set_trace() - ... >>> f(3) - ... ''' - >>> test = parser.get_doctest(doc, globals(), "foo", "foo.py", 0) - >>> real_stdin = sys.stdin - >>> sys.stdin = _FakeInput([ - ... 'list', # list source from example 2 - ... 'next', # return from g() - ... 'list', # list source from example 1 - ... 'next', # return from f() - ... 'list', # list source from example 3 - ... 'continue', # stop debugging - ... '']) - >>> try: runner.run(test) - ... finally: sys.stdin = real_stdin - ... # doctest: +NORMALIZE_WHITESPACE - --Return-- - > (3)g()->None - -> import pdb; pdb.set_trace() - (Pdb) list - 1 def g(x): - 2 print x+3 - 3 -> import pdb; pdb.set_trace() - [EOF] - (Pdb) next - --Return-- - > (2)f()->None - -> g(x*2) - (Pdb) list - 1 def f(x): - 2 -> g(x*2) - [EOF] - (Pdb) next - --Return-- - > (1)()->None - -> f(3) - (Pdb) list - 1 -> f(3) - [EOF] - (Pdb) continue - ********************************************************************** - File "foo.py", line 7, in foo - Failed example: - f(3) - Expected nothing - Got: - 9 - (1, 3) - """ - -def test_pdb_set_trace_nested(): - """This illustrates more-demanding use of set_trace with nested functions. - - >>> class C(object): - ... def calls_set_trace(self): - ... y = 1 - ... import pdb; pdb.set_trace() - ... self.f1() - ... y = 2 - ... def f1(self): - ... x = 1 - ... self.f2() - ... x = 2 - ... def f2(self): - ... z = 1 - ... z = 2 - - >>> calls_set_trace = C().calls_set_trace - - >>> doc = ''' - ... >>> a = 1 - ... >>> calls_set_trace() - ... ''' - >>> parser = doctest.DocTestParser() - >>> runner = doctest.DocTestRunner(verbose=False) - >>> test = parser.get_doctest(doc, globals(), "foo", "foo.py", 0) - >>> real_stdin = sys.stdin - >>> sys.stdin = _FakeInput([ - ... 'print y', # print data defined in the function - ... 'step', 'step', 'step', 'step', 'step', 'step', 'print z', - ... 'up', 'print x', - ... 'up', 'print y', - ... 'up', 'print foo', - ... 'continue', # stop debugging - ... '']) - - >>> try: - ... runner.run(test) - ... finally: - ... sys.stdin = real_stdin - > (5)calls_set_trace() - -> self.f1() - (Pdb) print y - 1 - (Pdb) step - --Call-- - > (7)f1() - -> def f1(self): - (Pdb) step - > (8)f1() - -> x = 1 - (Pdb) step - > (9)f1() - -> self.f2() - (Pdb) step - --Call-- - > (11)f2() - -> def f2(self): - (Pdb) step - > (12)f2() - -> z = 1 - (Pdb) step - > (13)f2() - -> z = 2 - (Pdb) print z - 1 - (Pdb) up - > (9)f1() - -> self.f2() - (Pdb) print x - 1 - (Pdb) up - > (5)calls_set_trace() - -> self.f1() - (Pdb) print y - 1 - (Pdb) up - > (1)() - -> calls_set_trace() - (Pdb) print foo - *** NameError: name 'foo' is not defined - (Pdb) continue - (0, 2) -""" - -def test_DocTestSuite(): - """DocTestSuite creates a unittest test suite from a doctest. - - We create a Suite by providing a module. A module can be provided - by passing a module object: - - >>> import unittest - >>> import test.sample_doctest - >>> suite = doctest.DocTestSuite(test.sample_doctest) - >>> suite.run(unittest.TestResult()) - - - We can also supply the module by name: - - >>> suite = doctest.DocTestSuite('test.sample_doctest') - >>> suite.run(unittest.TestResult()) - - - We can use the current module: - - >>> suite = test.sample_doctest.test_suite() - >>> suite.run(unittest.TestResult()) - - - We can supply global variables. If we pass globs, they will be - used instead of the module globals. Here we'll pass an empty - globals, triggering an extra error: - - >>> suite = doctest.DocTestSuite('test.sample_doctest', globs={}) - >>> suite.run(unittest.TestResult()) - - - Alternatively, we can provide extra globals. Here we'll make an - error go away by providing an extra global variable: - - >>> suite = doctest.DocTestSuite('test.sample_doctest', - ... extraglobs={'y': 1}) - >>> suite.run(unittest.TestResult()) - - - You can pass option flags. Here we'll cause an extra error - by disabling the blank-line feature: - - >>> suite = doctest.DocTestSuite('test.sample_doctest', - ... optionflags=doctest.DONT_ACCEPT_BLANKLINE) - >>> suite.run(unittest.TestResult()) - - - You can supply setUp and tearDown functions: - - >>> def setUp(t): - ... import test.test_doctest - ... test.test_doctest.sillySetup = True - - >>> def tearDown(t): - ... import test.test_doctest - ... del test.test_doctest.sillySetup - - Here, we installed a silly variable that the test expects: - - >>> suite = doctest.DocTestSuite('test.sample_doctest', - ... setUp=setUp, tearDown=tearDown) - >>> suite.run(unittest.TestResult()) - - - But the tearDown restores sanity: - - >>> import test.test_doctest - >>> test.test_doctest.sillySetup - Traceback (most recent call last): - ... - AttributeError: 'module' object has no attribute 'sillySetup' - - The setUp and tearDown funtions are passed test objects. Here - we'll use the setUp function to supply the missing variable y: - - >>> def setUp(test): - ... test.globs['y'] = 1 - - >>> suite = doctest.DocTestSuite('test.sample_doctest', setUp=setUp) - >>> suite.run(unittest.TestResult()) - - - Here, we didn't need to use a tearDown function because we - modified the test globals, which are a copy of the - sample_doctest module dictionary. The test globals are - automatically cleared for us after a test. - """ - -def test_DocFileSuite(): - """We can test tests found in text files using a DocFileSuite. - - We create a suite by providing the names of one or more text - files that include examples: - - >>> import unittest - >>> suite = doctest.DocFileSuite('test_doctest.txt', - ... 'test_doctest2.txt', - ... 'test_doctest4.txt') - >>> suite.run(unittest.TestResult()) - - - The test files are looked for in the directory containing the - calling module. A package keyword argument can be provided to - specify a different relative location. - - >>> import unittest - >>> suite = doctest.DocFileSuite('test_doctest.txt', - ... 'test_doctest2.txt', - ... 'test_doctest4.txt', - ... package='test') - >>> suite.run(unittest.TestResult()) - - - '/' should be used as a path separator. It will be converted - to a native separator at run time: - - >>> suite = doctest.DocFileSuite('../test/test_doctest.txt') - >>> suite.run(unittest.TestResult()) - - - If DocFileSuite is used from an interactive session, then files - are resolved relative to the directory of sys.argv[0]: - - >>> import new, os.path, test.test_doctest - >>> save_argv = sys.argv - >>> sys.argv = [test.test_doctest.__file__] - >>> suite = doctest.DocFileSuite('test_doctest.txt', - ... package=new.module('__main__')) - >>> sys.argv = save_argv - - By setting `module_relative=False`, os-specific paths may be - used (including absolute paths and paths relative to the - working directory): - - >>> # Get the absolute path of the test package. - >>> test_doctest_path = os.path.abspath(test.test_doctest.__file__) - >>> test_pkg_path = os.path.split(test_doctest_path)[0] - - >>> # Use it to find the absolute path of test_doctest.txt. - >>> test_file = os.path.join(test_pkg_path, 'test_doctest.txt') - - >>> suite = doctest.DocFileSuite(test_file, module_relative=False) - >>> suite.run(unittest.TestResult()) - - - It is an error to specify `package` when `module_relative=False`: - - >>> suite = doctest.DocFileSuite(test_file, module_relative=False, - ... package='test') - Traceback (most recent call last): - ValueError: Package may only be specified for module-relative paths. - - You can specify initial global variables: - - >>> suite = doctest.DocFileSuite('test_doctest.txt', - ... 'test_doctest2.txt', - ... 'test_doctest4.txt', - ... globs={'favorite_color': 'blue'}) - >>> suite.run(unittest.TestResult()) - - - In this case, we supplied a missing favorite color. You can - provide doctest options: - - >>> suite = doctest.DocFileSuite('test_doctest.txt', - ... 'test_doctest2.txt', - ... 'test_doctest4.txt', - ... optionflags=doctest.DONT_ACCEPT_BLANKLINE, - ... globs={'favorite_color': 'blue'}) - >>> suite.run(unittest.TestResult()) - - - And, you can provide setUp and tearDown functions: - - You can supply setUp and teatDoen functions: - - >>> def setUp(t): - ... import test.test_doctest - ... test.test_doctest.sillySetup = True - - >>> def tearDown(t): - ... import test.test_doctest - ... del test.test_doctest.sillySetup - - Here, we installed a silly variable that the test expects: - - >>> suite = doctest.DocFileSuite('test_doctest.txt', - ... 'test_doctest2.txt', - ... 'test_doctest4.txt', - ... setUp=setUp, tearDown=tearDown) - >>> suite.run(unittest.TestResult()) - - - But the tearDown restores sanity: - - >>> import test.test_doctest - >>> test.test_doctest.sillySetup - Traceback (most recent call last): - ... - AttributeError: 'module' object has no attribute 'sillySetup' - - The setUp and tearDown funtions are passed test objects. - Here, we'll use a setUp function to set the favorite color in - test_doctest.txt: - - >>> def setUp(test): - ... test.globs['favorite_color'] = 'blue' - - >>> suite = doctest.DocFileSuite('test_doctest.txt', setUp=setUp) - >>> suite.run(unittest.TestResult()) - - - Here, we didn't need to use a tearDown function because we - modified the test globals. The test globals are - automatically cleared for us after a test. - - Tests in a file run using `DocFileSuite` can also access the - `__file__` global, which is set to the name of the file - containing the tests: - - >>> suite = doctest.DocFileSuite('test_doctest3.txt') - >>> suite.run(unittest.TestResult()) - - - If the tests contain non-ASCII characters, we have to specify which - encoding the file is encoded with. We do so by using the `encoding` - parameter: - - >>> suite = doctest.DocFileSuite('test_doctest.txt', - ... 'test_doctest2.txt', - ... 'test_doctest4.txt', - ... encoding='utf-8') - >>> suite.run(unittest.TestResult()) - - - """ - -def test_trailing_space_in_test(): - """ - Trailing spaces in expected output are significant: - - >>> x, y = 'foo', '' - >>> print x, y - foo \n - """ - - -def test_unittest_reportflags(): - """Default unittest reporting flags can be set to control reporting - - Here, we'll set the REPORT_ONLY_FIRST_FAILURE option so we see - only the first failure of each test. First, we'll look at the - output without the flag. The file test_doctest.txt file has two - tests. They both fail if blank lines are disabled: - - >>> suite = doctest.DocFileSuite('test_doctest.txt', - ... optionflags=doctest.DONT_ACCEPT_BLANKLINE) - >>> import unittest - >>> result = suite.run(unittest.TestResult()) - >>> print result.failures[0][1] # doctest: +ELLIPSIS - Traceback ... - Failed example: - favorite_color - ... - Failed example: - if 1: - ... - - Note that we see both failures displayed. - - >>> old = doctest.set_unittest_reportflags( - ... doctest.REPORT_ONLY_FIRST_FAILURE) - - Now, when we run the test: - - >>> result = suite.run(unittest.TestResult()) - >>> print result.failures[0][1] # doctest: +ELLIPSIS - Traceback ... - Failed example: - favorite_color - Exception raised: - ... - NameError: name 'favorite_color' is not defined - - - - We get only the first failure. - - If we give any reporting options when we set up the tests, - however: - - >>> suite = doctest.DocFileSuite('test_doctest.txt', - ... optionflags=doctest.DONT_ACCEPT_BLANKLINE | doctest.REPORT_NDIFF) - - Then the default eporting options are ignored: - - >>> result = suite.run(unittest.TestResult()) - >>> print result.failures[0][1] # doctest: +ELLIPSIS - Traceback ... - Failed example: - favorite_color - ... - Failed example: - if 1: - print 'a' - print - print 'b' - Differences (ndiff with -expected +actual): - a - - - + - b - - - - - Test runners can restore the formatting flags after they run: - - >>> ignored = doctest.set_unittest_reportflags(old) - - """ - -def test_testfile(): r""" -Tests for the `testfile()` function. This function runs all the -doctest examples in a given file. In its simple invokation, it is -called with the name of a file, which is taken to be relative to the -calling module. The return value is (#failures, #tests). - - >>> doctest.testfile('test_doctest.txt') # doctest: +ELLIPSIS - ********************************************************************** - File "...", line 6, in test_doctest.txt - Failed example: - favorite_color - Exception raised: - ... - NameError: name 'favorite_color' is not defined - ********************************************************************** - 1 items had failures: - 1 of 2 in test_doctest.txt - ***Test Failed*** 1 failures. - (1, 2) - >>> doctest.master = None # Reset master. - -(Note: we'll be clearing doctest.master after each call to -`doctest.testfile`, to supress warnings about multiple tests with the -same name.) - -Globals may be specified with the `globs` and `extraglobs` parameters: - - >>> globs = {'favorite_color': 'blue'} - >>> doctest.testfile('test_doctest.txt', globs=globs) - (0, 2) - >>> doctest.master = None # Reset master. - - >>> extraglobs = {'favorite_color': 'red'} - >>> doctest.testfile('test_doctest.txt', globs=globs, - ... extraglobs=extraglobs) # doctest: +ELLIPSIS - ********************************************************************** - File "...", line 6, in test_doctest.txt - Failed example: - favorite_color - Expected: - 'blue' - Got: - 'red' - ********************************************************************** - 1 items had failures: - 1 of 2 in test_doctest.txt - ***Test Failed*** 1 failures. - (1, 2) - >>> doctest.master = None # Reset master. - -The file may be made relative to a given module or package, using the -optional `module_relative` parameter: - - >>> doctest.testfile('test_doctest.txt', globs=globs, - ... module_relative='test') - (0, 2) - >>> doctest.master = None # Reset master. - -Verbosity can be increased with the optional `verbose` paremter: - - >>> doctest.testfile('test_doctest.txt', globs=globs, verbose=True) - Trying: - favorite_color - Expecting: - 'blue' - ok - Trying: - if 1: - print 'a' - print - print 'b' - Expecting: - a - - b - ok - 1 items passed all tests: - 2 tests in test_doctest.txt - 2 tests in 1 items. - 2 passed and 0 failed. - Test passed. - (0, 2) - >>> doctest.master = None # Reset master. - -The name of the test may be specified with the optional `name` -parameter: - - >>> doctest.testfile('test_doctest.txt', name='newname') - ... # doctest: +ELLIPSIS - ********************************************************************** - File "...", line 6, in newname - ... - (1, 2) - >>> doctest.master = None # Reset master. - -The summary report may be supressed with the optional `report` -parameter: - - >>> doctest.testfile('test_doctest.txt', report=False) - ... # doctest: +ELLIPSIS - ********************************************************************** - File "...", line 6, in test_doctest.txt - Failed example: - favorite_color - Exception raised: - ... - NameError: name 'favorite_color' is not defined - (1, 2) - >>> doctest.master = None # Reset master. - -The optional keyword argument `raise_on_error` can be used to raise an -exception on the first error (which may be useful for postmortem -debugging): - - >>> doctest.testfile('test_doctest.txt', raise_on_error=True) - ... # doctest: +ELLIPSIS - Traceback (most recent call last): - UnexpectedException: ... - >>> doctest.master = None # Reset master. - -If the tests contain non-ASCII characters, the tests might fail, since -it's unknown which encoding is used. The encoding can be specified -using the optional keyword argument `encoding`: - - >>> doctest.testfile('test_doctest4.txt') # doctest: +ELLIPSIS - ********************************************************************** - File "...", line 7, in test_doctest4.txt - Failed example: - u'...' - Expected: - u'f\xf6\xf6' - Got: - u'f\xc3\xb6\xc3\xb6' - ********************************************************************** - ... - ********************************************************************** - 1 items had failures: - 2 of 4 in test_doctest4.txt - ***Test Failed*** 2 failures. - (2, 4) - >>> doctest.master = None # Reset master. - - >>> doctest.testfile('test_doctest4.txt', encoding='utf-8') - (0, 4) - >>> doctest.master = None # Reset master. -""" - -# old_test1, ... used to live in doctest.py, but cluttered it. Note -# that these use the deprecated doctest.Tester, so should go away (or -# be rewritten) someday. - -# Ignore all warnings about the use of class Tester in this module. -# Note that the name of this module may differ depending on how it's -# imported, so the use of __name__ is important. -warnings.filterwarnings("ignore", "class Tester", DeprecationWarning, - __name__, 0) - -def old_test1(): r""" ->>> from doctest import Tester ->>> t = Tester(globs={'x': 42}, verbose=0) ->>> t.runstring(r''' -... >>> x = x * 2 -... >>> print x -... 42 -... ''', 'XYZ') -********************************************************************** -Line 3, in XYZ -Failed example: - print x -Expected: - 42 -Got: - 84 -(1, 2) ->>> t.runstring(">>> x = x * 2\n>>> print x\n84\n", 'example2') -(0, 2) ->>> t.summarize() -********************************************************************** -1 items had failures: - 1 of 2 in XYZ -***Test Failed*** 1 failures. -(1, 4) ->>> t.summarize(verbose=1) -1 items passed all tests: - 2 tests in example2 -********************************************************************** -1 items had failures: - 1 of 2 in XYZ -4 tests in 2 items. -3 passed and 1 failed. -***Test Failed*** 1 failures. -(1, 4) -""" - -def old_test2(): r""" - >>> from doctest import Tester - >>> t = Tester(globs={}, verbose=1) - >>> test = r''' - ... # just an example - ... >>> x = 1 + 2 - ... >>> x - ... 3 - ... ''' - >>> t.runstring(test, "Example") - Running string Example - Trying: - x = 1 + 2 - Expecting nothing - ok - Trying: - x - Expecting: - 3 - ok - 0 of 2 examples failed in string Example - (0, 2) -""" - -def old_test3(): r""" - >>> from doctest import Tester - >>> t = Tester(globs={}, verbose=0) - >>> def _f(): - ... '''Trivial docstring example. - ... >>> assert 2 == 2 - ... ''' - ... return 32 - ... - >>> t.rundoc(_f) # expect 0 failures in 1 example - (0, 1) -""" - -def old_test4(): """ - >>> import new - >>> m1 = new.module('_m1') - >>> m2 = new.module('_m2') - >>> test_data = \""" - ... def _f(): - ... '''>>> assert 1 == 1 - ... ''' - ... def g(): - ... '''>>> assert 2 != 1 - ... ''' - ... class H: - ... '''>>> assert 2 > 1 - ... ''' - ... def bar(self): - ... '''>>> assert 1 < 2 - ... ''' - ... \""" - >>> exec test_data in m1.__dict__ - >>> exec test_data in m2.__dict__ - >>> m1.__dict__.update({"f2": m2._f, "g2": m2.g, "h2": m2.H}) - - Tests that objects outside m1 are excluded: - - >>> from doctest import Tester - >>> t = Tester(globs={}, verbose=0) - >>> t.rundict(m1.__dict__, "rundict_test", m1) # f2 and g2 and h2 skipped - (0, 4) - - Once more, not excluding stuff outside m1: - - >>> t = Tester(globs={}, verbose=0) - >>> t.rundict(m1.__dict__, "rundict_test_pvt") # None are skipped. - (0, 8) - - The exclusion of objects from outside the designated module is - meant to be invoked automagically by testmod. - - >>> doctest.testmod(m1, verbose=False) - (0, 4) -""" - -###################################################################### -## Main -###################################################################### - -def test_main(): - # Check the doctest cases in doctest itself: - test_support.run_doctest(doctest, verbosity=True) - # Check the doctest cases defined here: - from test import test_doctest - test_support.run_doctest(test_doctest, verbosity=True) - -import trace, sys, re, StringIO -def test_coverage(coverdir): - tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,], - trace=0, count=1) - tracer.run('reload(doctest); test_main()') - r = tracer.results() - print 'Writing coverage results...' - r.write_results(show_missing=True, summary=True, - coverdir=coverdir) - -if __name__ == '__main__': - if '-c' in sys.argv: - test_coverage('/tmp/doctest.cover') - else: - test_main() diff --git a/sys/lib/python/test/test_doctest.txt b/sys/lib/python/test/test_doctest.txt deleted file mode 100644 index f8e851e1a..000000000 --- a/sys/lib/python/test/test_doctest.txt +++ /dev/null @@ -1,17 +0,0 @@ -This is a sample doctest in a text file. - -In this example, we'll rely on a global variable being set for us -already: - - >>> favorite_color - 'blue' - -We can make this fail by disabling the blank-line feature. - - >>> if 1: - ... print 'a' - ... print - ... print 'b' - a - - b diff --git a/sys/lib/python/test/test_doctest2.py b/sys/lib/python/test/test_doctest2.py deleted file mode 100644 index 865a32e6f..000000000 --- a/sys/lib/python/test/test_doctest2.py +++ /dev/null @@ -1,120 +0,0 @@ -# -*- coding: utf-8 -*- -u"""A module to test whether doctest recognizes some 2.2 features, -like static and class methods. - ->>> print 'yup' # 1 -yup - -We include some (random) encoded (utf-8) text in the text surrounding -the example. It should be ignored: - -ЉЊЈÐЂ - -""" - -from test import test_support - -class C(object): - u"""Class C. - - >>> print C() # 2 - 42 - - - We include some (random) encoded (utf-8) text in the text surrounding - the example. It should be ignored: - - ЉЊЈÐЂ - - """ - - def __init__(self): - """C.__init__. - - >>> print C() # 3 - 42 - """ - - def __str__(self): - """ - >>> print C() # 4 - 42 - """ - return "42" - - class D(object): - """A nested D class. - - >>> print "In D!" # 5 - In D! - """ - - def nested(self): - """ - >>> print 3 # 6 - 3 - """ - - def getx(self): - """ - >>> c = C() # 7 - >>> c.x = 12 # 8 - >>> print c.x # 9 - -12 - """ - return -self._x - - def setx(self, value): - """ - >>> c = C() # 10 - >>> c.x = 12 # 11 - >>> print c.x # 12 - -12 - """ - self._x = value - - x = property(getx, setx, doc="""\ - >>> c = C() # 13 - >>> c.x = 12 # 14 - >>> print c.x # 15 - -12 - """) - - @staticmethod - def statm(): - """ - A static method. - - >>> print C.statm() # 16 - 666 - >>> print C().statm() # 17 - 666 - """ - return 666 - - @classmethod - def clsm(cls, val): - """ - A class method. - - >>> print C.clsm(22) # 18 - 22 - >>> print C().clsm(23) # 19 - 23 - """ - return val - -def test_main(): - from test import test_doctest2 - EXPECTED = 19 - f, t = test_support.run_doctest(test_doctest2) - if t != EXPECTED: - raise test_support.TestFailed("expected %d tests to run, not %d" % - (EXPECTED, t)) - -# Pollute the namespace with a bunch of imported functions and classes, -# to make sure they don't get tested. -from doctest import * - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_doctest2.txt b/sys/lib/python/test/test_doctest2.txt deleted file mode 100644 index 2e14856c2..000000000 --- a/sys/lib/python/test/test_doctest2.txt +++ /dev/null @@ -1,14 +0,0 @@ -This is a sample doctest in a text file. - -In this example, we'll rely on some silly setup: - - >>> import test.test_doctest - >>> test.test_doctest.sillySetup - True - -This test also has some (random) encoded (utf-8) unicode text: - - ÉÊÈÃÂÂ - -This doesn't cause a problem in the tect surrounding the examples, but -we include it here (in this test text file) to make sure. :) diff --git a/sys/lib/python/test/test_doctest3.txt b/sys/lib/python/test/test_doctest3.txt deleted file mode 100644 index 54a96d58e..000000000 --- a/sys/lib/python/test/test_doctest3.txt +++ /dev/null @@ -1,5 +0,0 @@ - -Here we check that `__file__` is provided: - - >>> type(__file__) - diff --git a/sys/lib/python/test/test_doctest4.txt b/sys/lib/python/test/test_doctest4.txt deleted file mode 100644 index a219d16a6..000000000 --- a/sys/lib/python/test/test_doctest4.txt +++ /dev/null @@ -1,17 +0,0 @@ -This is a sample doctest in a text file that contains non-ASCII characters. -This file is encoded using UTF-8. - -In order to get this test to pass, we have to manually specify the -encoding. - - >>> u'föö' - u'f\xf6\xf6' - - >>> u'bÄ…r' - u'b\u0105r' - - >>> 'föö' - 'f\xc3\xb6\xc3\xb6' - - >>> 'bÄ…r' - 'b\xc4\x85r' diff --git a/sys/lib/python/test/test_dumbdbm.py b/sys/lib/python/test/test_dumbdbm.py deleted file mode 100644 index 63b14b011..000000000 --- a/sys/lib/python/test/test_dumbdbm.py +++ /dev/null @@ -1,155 +0,0 @@ -#! /usr/bin/env python -"""Test script for the dumbdbm module - Original by Roger E. Masse -""" - -import os -import unittest -import dumbdbm -from test import test_support - -_fname = test_support.TESTFN - -def _delete_files(): - for ext in [".dir", ".dat", ".bak"]: - try: - os.unlink(_fname + ext) - except OSError: - pass - -class DumbDBMTestCase(unittest.TestCase): - _dict = {'0': '', - 'a': 'Python:', - 'b': 'Programming', - 'c': 'the', - 'd': 'way', - 'f': 'Guido', - 'g': 'intended' - } - - def __init__(self, *args): - unittest.TestCase.__init__(self, *args) - - def test_dumbdbm_creation(self): - f = dumbdbm.open(_fname, 'c') - self.assertEqual(f.keys(), []) - for key in self._dict: - f[key] = self._dict[key] - self.read_helper(f) - f.close() - - def test_close_twice(self): - f = dumbdbm.open(_fname) - f['a'] = 'b' - self.assertEqual(f['a'], 'b') - f.close() - f.close() - - def test_dumbdbm_modification(self): - self.init_db() - f = dumbdbm.open(_fname, 'w') - self._dict['g'] = f['g'] = "indented" - self.read_helper(f) - f.close() - - def test_dumbdbm_read(self): - self.init_db() - f = dumbdbm.open(_fname, 'r') - self.read_helper(f) - f.close() - - def test_dumbdbm_keys(self): - self.init_db() - f = dumbdbm.open(_fname) - keys = self.keys_helper(f) - f.close() - - def test_write_write_read(self): - # test for bug #482460 - f = dumbdbm.open(_fname) - f['1'] = 'hello' - f['1'] = 'hello2' - f.close() - f = dumbdbm.open(_fname) - self.assertEqual(f['1'], 'hello2') - f.close() - - def test_line_endings(self): - # test for bug #1172763: dumbdbm would die if the line endings - # weren't what was expected. - f = dumbdbm.open(_fname) - f['1'] = 'hello' - f['2'] = 'hello2' - f.close() - - # Mangle the file by adding \r before each newline - data = open(_fname + '.dir').read() - data = data.replace('\n', '\r\n') - open(_fname + '.dir', 'wb').write(data) - - f = dumbdbm.open(_fname) - self.assertEqual(f['1'], 'hello') - self.assertEqual(f['2'], 'hello2') - - - def read_helper(self, f): - keys = self.keys_helper(f) - for key in self._dict: - self.assertEqual(self._dict[key], f[key]) - - def init_db(self): - f = dumbdbm.open(_fname, 'w') - for k in self._dict: - f[k] = self._dict[k] - f.close() - - def keys_helper(self, f): - keys = f.keys() - keys.sort() - dkeys = self._dict.keys() - dkeys.sort() - self.assertEqual(keys, dkeys) - return keys - - # Perform randomized operations. This doesn't make assumptions about - # what *might* fail. - def test_random(self): - import random - d = {} # mirror the database - for dummy in range(5): - f = dumbdbm.open(_fname) - for dummy in range(100): - k = random.choice('abcdefghijklm') - if random.random() < 0.2: - if k in d: - del d[k] - del f[k] - else: - v = random.choice('abc') * random.randrange(10000) - d[k] = v - f[k] = v - self.assertEqual(f[k], v) - f.close() - - f = dumbdbm.open(_fname) - expected = d.items() - expected.sort() - got = f.items() - got.sort() - self.assertEqual(expected, got) - f.close() - - def tearDown(self): - _delete_files() - - def setUp(self): - _delete_files() - -def test_main(): - try: - test_support.run_unittest(DumbDBMTestCase) - finally: - _delete_files() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_dummy_thread.py b/sys/lib/python/test/test_dummy_thread.py deleted file mode 100644 index f274e0a0d..000000000 --- a/sys/lib/python/test/test_dummy_thread.py +++ /dev/null @@ -1,181 +0,0 @@ -"""Generic thread tests. - -Meant to be used by dummy_thread and thread. To allow for different modules -to be used, test_main() can be called with the module to use as the thread -implementation as its sole argument. - -""" -import dummy_thread as _thread -import time -import Queue -import random -import unittest -from test import test_support - -DELAY = 0 # Set > 0 when testing a module other than dummy_thread, such as - # the 'thread' module. - -class LockTests(unittest.TestCase): - """Test lock objects.""" - - def setUp(self): - # Create a lock - self.lock = _thread.allocate_lock() - - def test_initlock(self): - #Make sure locks start locked - self.failUnless(not self.lock.locked(), - "Lock object is not initialized unlocked.") - - def test_release(self): - # Test self.lock.release() - self.lock.acquire() - self.lock.release() - self.failUnless(not self.lock.locked(), - "Lock object did not release properly.") - - def test_improper_release(self): - #Make sure release of an unlocked thread raises _thread.error - self.failUnlessRaises(_thread.error, self.lock.release) - - def test_cond_acquire_success(self): - #Make sure the conditional acquiring of the lock works. - self.failUnless(self.lock.acquire(0), - "Conditional acquiring of the lock failed.") - - def test_cond_acquire_fail(self): - #Test acquiring locked lock returns False - self.lock.acquire(0) - self.failUnless(not self.lock.acquire(0), - "Conditional acquiring of a locked lock incorrectly " - "succeeded.") - - def test_uncond_acquire_success(self): - #Make sure unconditional acquiring of a lock works. - self.lock.acquire() - self.failUnless(self.lock.locked(), - "Uncondional locking failed.") - - def test_uncond_acquire_return_val(self): - #Make sure that an unconditional locking returns True. - self.failUnless(self.lock.acquire(1) is True, - "Unconditional locking did not return True.") - - def test_uncond_acquire_blocking(self): - #Make sure that unconditional acquiring of a locked lock blocks. - def delay_unlock(to_unlock, delay): - """Hold on to lock for a set amount of time before unlocking.""" - time.sleep(delay) - to_unlock.release() - - self.lock.acquire() - start_time = int(time.time()) - _thread.start_new_thread(delay_unlock,(self.lock, DELAY)) - if test_support.verbose: - print - print "*** Waiting for thread to release the lock "\ - "(approx. %s sec.) ***" % DELAY - self.lock.acquire() - end_time = int(time.time()) - if test_support.verbose: - print "done" - self.failUnless((end_time - start_time) >= DELAY, - "Blocking by unconditional acquiring failed.") - -class MiscTests(unittest.TestCase): - """Miscellaneous tests.""" - - def test_exit(self): - #Make sure _thread.exit() raises SystemExit - self.failUnlessRaises(SystemExit, _thread.exit) - - def test_ident(self): - #Test sanity of _thread.get_ident() - self.failUnless(isinstance(_thread.get_ident(), int), - "_thread.get_ident() returned a non-integer") - self.failUnless(_thread.get_ident() != 0, - "_thread.get_ident() returned 0") - - def test_LockType(self): - #Make sure _thread.LockType is the same type as _thread.allocate_locke() - self.failUnless(isinstance(_thread.allocate_lock(), _thread.LockType), - "_thread.LockType is not an instance of what is " - "returned by _thread.allocate_lock()") - - def test_interrupt_main(self): - #Calling start_new_thread with a function that executes interrupt_main - # should raise KeyboardInterrupt upon completion. - def call_interrupt(): - _thread.interrupt_main() - self.failUnlessRaises(KeyboardInterrupt, _thread.start_new_thread, - call_interrupt, tuple()) - - def test_interrupt_in_main(self): - # Make sure that if interrupt_main is called in main threat that - # KeyboardInterrupt is raised instantly. - self.failUnlessRaises(KeyboardInterrupt, _thread.interrupt_main) - -class ThreadTests(unittest.TestCase): - """Test thread creation.""" - - def test_arg_passing(self): - #Make sure that parameter passing works. - def arg_tester(queue, arg1=False, arg2=False): - """Use to test _thread.start_new_thread() passes args properly.""" - queue.put((arg1, arg2)) - - testing_queue = Queue.Queue(1) - _thread.start_new_thread(arg_tester, (testing_queue, True, True)) - result = testing_queue.get() - self.failUnless(result[0] and result[1], - "Argument passing for thread creation using tuple failed") - _thread.start_new_thread(arg_tester, tuple(), {'queue':testing_queue, - 'arg1':True, 'arg2':True}) - result = testing_queue.get() - self.failUnless(result[0] and result[1], - "Argument passing for thread creation using kwargs failed") - _thread.start_new_thread(arg_tester, (testing_queue, True), {'arg2':True}) - result = testing_queue.get() - self.failUnless(result[0] and result[1], - "Argument passing for thread creation using both tuple" - " and kwargs failed") - - def test_multi_creation(self): - #Make sure multiple threads can be created. - def queue_mark(queue, delay): - """Wait for ``delay`` seconds and then put something into ``queue``""" - time.sleep(delay) - queue.put(_thread.get_ident()) - - thread_count = 5 - testing_queue = Queue.Queue(thread_count) - if test_support.verbose: - print - print "*** Testing multiple thread creation "\ - "(will take approx. %s to %s sec.) ***" % (DELAY, thread_count) - for count in xrange(thread_count): - if DELAY: - local_delay = round(random.random(), 1) - else: - local_delay = 0 - _thread.start_new_thread(queue_mark, - (testing_queue, local_delay)) - time.sleep(DELAY) - if test_support.verbose: - print 'done' - self.failUnless(testing_queue.qsize() == thread_count, - "Not all %s threads executed properly after %s sec." % - (thread_count, DELAY)) - -def test_main(imported_module=None): - global _thread, DELAY - if imported_module: - _thread = imported_module - DELAY = 2 - if test_support.verbose: - print - print "*** Using %s as _thread module ***" % _thread - test_support.run_unittest(LockTests, MiscTests, ThreadTests) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_dummy_threading.py b/sys/lib/python/test/test_dummy_threading.py deleted file mode 100644 index 3724f1e5a..000000000 --- a/sys/lib/python/test/test_dummy_threading.py +++ /dev/null @@ -1,73 +0,0 @@ -# Very rudimentary test of threading module - -# Create a bunch of threads, let each do some work, wait until all are done - -from test.test_support import verbose -import random -import dummy_threading as _threading -import time - - -class TestThread(_threading.Thread): - - def run(self): - global running - # Uncomment if testing another module, such as the real 'threading' - # module. - #delay = random.random() * 2 - delay = 0 - if verbose: - print 'task', self.getName(), 'will run for', delay, 'sec' - sema.acquire() - mutex.acquire() - running = running + 1 - if verbose: - print running, 'tasks are running' - mutex.release() - time.sleep(delay) - if verbose: - print 'task', self.getName(), 'done' - mutex.acquire() - running = running - 1 - if verbose: - print self.getName(), 'is finished.', running, 'tasks are running' - mutex.release() - sema.release() - -def starttasks(): - for i in range(numtasks): - t = TestThread(name=""%i) - threads.append(t) - t.start() - - -def test_main(): - # This takes about n/3 seconds to run (about n/3 clumps of tasks, times - # about 1 second per clump). - global numtasks - numtasks = 10 - - # no more than 3 of the 10 can run at once - global sema - sema = _threading.BoundedSemaphore(value=3) - global mutex - mutex = _threading.RLock() - global running - running = 0 - - global threads - threads = [] - - starttasks() - - if verbose: - print 'waiting for all tasks to complete' - for t in threads: - t.join() - if verbose: - print 'all tasks done' - - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_email.py b/sys/lib/python/test/test_email.py deleted file mode 100644 index de0eee36b..000000000 --- a/sys/lib/python/test/test_email.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2001,2002 Python Software Foundation -# email package unit tests - -import unittest -# The specific tests now live in Lib/email/test -from email.test.test_email import suite -from test.test_support import run_suite - -def test_main(): - run_suite(suite()) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_email_codecs.py b/sys/lib/python/test/test_email_codecs.py deleted file mode 100644 index c550a6f81..000000000 --- a/sys/lib/python/test/test_email_codecs.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (C) 2002 Python Software Foundation -# email package unit tests for (optional) Asian codecs - -# The specific tests now live in Lib/email/test -from email.test import test_email_codecs -from email.test import test_email_codecs_renamed -from test import test_support - -def test_main(): - suite = test_email_codecs.suite() - suite.addTest(test_email_codecs_renamed.suite()) - test_support.run_suite(suite) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_email_renamed.py b/sys/lib/python/test/test_email_renamed.py deleted file mode 100644 index c3af59881..000000000 --- a/sys/lib/python/test/test_email_renamed.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2001-2006 Python Software Foundation -# email package unit tests - -import unittest -# The specific tests now live in Lib/email/test -from email.test.test_email_renamed import suite -from test.test_support import run_suite - -def test_main(): - run_suite(suite()) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_enumerate.py b/sys/lib/python/test/test_enumerate.py deleted file mode 100644 index e0a272e02..000000000 --- a/sys/lib/python/test/test_enumerate.py +++ /dev/null @@ -1,214 +0,0 @@ -import unittest -import sys - -from test import test_support - -class G: - 'Sequence using __getitem__' - def __init__(self, seqn): - self.seqn = seqn - def __getitem__(self, i): - return self.seqn[i] - -class I: - 'Sequence using iterator protocol' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class Ig: - 'Sequence using iterator protocol defined with a generator' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - for val in self.seqn: - yield val - -class X: - 'Missing __getitem__ and __iter__' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class E: - 'Test propagation of exceptions' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - 3 // 0 - -class N: - 'Iterator missing next()' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - -class EnumerateTestCase(unittest.TestCase): - - enum = enumerate - seq, res = 'abc', [(0,'a'), (1,'b'), (2,'c')] - - def test_basicfunction(self): - self.assertEqual(type(self.enum(self.seq)), self.enum) - e = self.enum(self.seq) - self.assertEqual(iter(e), e) - self.assertEqual(list(self.enum(self.seq)), self.res) - self.enum.__doc__ - - def test_getitemseqn(self): - self.assertEqual(list(self.enum(G(self.seq))), self.res) - e = self.enum(G('')) - self.assertRaises(StopIteration, e.next) - - def test_iteratorseqn(self): - self.assertEqual(list(self.enum(I(self.seq))), self.res) - e = self.enum(I('')) - self.assertRaises(StopIteration, e.next) - - def test_iteratorgenerator(self): - self.assertEqual(list(self.enum(Ig(self.seq))), self.res) - e = self.enum(Ig('')) - self.assertRaises(StopIteration, e.next) - - def test_noniterable(self): - self.assertRaises(TypeError, self.enum, X(self.seq)) - - def test_illformediterable(self): - self.assertRaises(TypeError, list, self.enum(N(self.seq))) - - def test_exception_propagation(self): - self.assertRaises(ZeroDivisionError, list, self.enum(E(self.seq))) - - def test_argumentcheck(self): - self.assertRaises(TypeError, self.enum) # no arguments - self.assertRaises(TypeError, self.enum, 1) # wrong type (not iterable) - self.assertRaises(TypeError, self.enum, 'abc', 2) # too many arguments - - def test_tuple_reuse(self): - # Tests an implementation detail where tuple is reused - # whenever nothing else holds a reference to it - self.assertEqual(len(set(map(id, list(enumerate(self.seq))))), len(self.seq)) - self.assertEqual(len(set(map(id, enumerate(self.seq)))), min(1,len(self.seq))) - -class MyEnum(enumerate): - pass - -class SubclassTestCase(EnumerateTestCase): - - enum = MyEnum - -class TestEmpty(EnumerateTestCase): - - seq, res = '', [] - -class TestBig(EnumerateTestCase): - - seq = range(10,20000,2) - res = zip(range(20000), seq) - -class TestReversed(unittest.TestCase): - - def test_simple(self): - class A: - def __getitem__(self, i): - if i < 5: - return str(i) - raise StopIteration - def __len__(self): - return 5 - for data in 'abc', range(5), tuple(enumerate('abc')), A(), xrange(1,17,5): - self.assertEqual(list(data)[::-1], list(reversed(data))) - self.assertRaises(TypeError, reversed, {}) - - def test_xrange_optimization(self): - x = xrange(1) - self.assertEqual(type(reversed(x)), type(iter(x))) - - def test_len(self): - # This is an implementation detail, not an interface requirement - from test.test_iterlen import len - for s in ('hello', tuple('hello'), list('hello'), xrange(5)): - self.assertEqual(len(reversed(s)), len(s)) - r = reversed(s) - list(r) - self.assertEqual(len(r), 0) - class SeqWithWeirdLen: - called = False - def __len__(self): - if not self.called: - self.called = True - return 10 - raise ZeroDivisionError - def __getitem__(self, index): - return index - r = reversed(SeqWithWeirdLen()) - self.assertRaises(ZeroDivisionError, len, r) - - - def test_gc(self): - class Seq: - def __len__(self): - return 10 - def __getitem__(self, index): - return index - s = Seq() - r = reversed(s) - s.r = r - - def test_args(self): - self.assertRaises(TypeError, reversed) - self.assertRaises(TypeError, reversed, [], 'extra') - - def test_bug1229429(self): - # this bug was never in reversed, it was in - # PyObject_CallMethod, and reversed_new calls that sometimes. - if not hasattr(sys, "getrefcount"): - return - def f(): - pass - r = f.__reversed__ = object() - rc = sys.getrefcount(r) - for i in range(10): - try: - reversed(f) - except TypeError: - pass - else: - self.fail("non-callable __reversed__ didn't raise!") - self.assertEqual(rc, sys.getrefcount(r)) - - -def test_main(verbose=None): - testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig, - TestReversed) - test_support.run_unittest(*testclasses) - - # verify reference counting - import sys - if verbose and hasattr(sys, "gettotalrefcount"): - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*testclasses) - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_eof.py b/sys/lib/python/test/test_eof.py deleted file mode 100644 index aae35182b..000000000 --- a/sys/lib/python/test/test_eof.py +++ /dev/null @@ -1,32 +0,0 @@ -#! /usr/bin/env python -"""test script for a few new invalid token catches""" - -import os -import unittest -from test import test_support - -class EOFTestCase(unittest.TestCase): - def test_EOFC(self): - expect = "EOL while scanning single-quoted string (, line 1)" - try: - eval("""'this is a test\ - """) - except SyntaxError, msg: - self.assertEqual(str(msg), expect) - else: - raise test_support.TestFailed - - def test_EOFS(self): - expect = "EOF while scanning triple-quoted string (, line 1)" - try: - eval("""'''this is a test""") - except SyntaxError, msg: - self.assertEqual(str(msg), expect) - else: - raise test_support.TestFailed - -def test_main(): - test_support.run_unittest(EOFTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_errno.py b/sys/lib/python/test/test_errno.py deleted file mode 100755 index 6b02e25cf..000000000 --- a/sys/lib/python/test/test_errno.py +++ /dev/null @@ -1,49 +0,0 @@ -#! /usr/bin/env python -"""Test the errno module - Roger E. Masse -""" - -import errno -from test.test_support import verbose - -errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV', - 'EAFNOSUPPORT', 'EAGAIN', 'EALREADY', 'EBADE', 'EBADF', - 'EBADFD', 'EBADMSG', 'EBADR', 'EBADRQC', 'EBADSLT', - 'EBFONT', 'EBUSY', 'ECHILD', 'ECHRNG', 'ECOMM', - 'ECONNABORTED', 'ECONNREFUSED', 'ECONNRESET', - 'EDEADLK', 'EDEADLOCK', 'EDESTADDRREQ', 'EDOM', - 'EDQUOT', 'EEXIST', 'EFAULT', 'EFBIG', 'EHOSTDOWN', - 'EHOSTUNREACH', 'EIDRM', 'EILSEQ', 'EINPROGRESS', - 'EINTR', 'EINVAL', 'EIO', 'EISCONN', 'EISDIR', - 'EL2HLT', 'EL2NSYNC', 'EL3HLT', 'EL3RST', 'ELIBACC', - 'ELIBBAD', 'ELIBEXEC', 'ELIBMAX', 'ELIBSCN', 'ELNRNG', - 'ELOOP', 'EMFILE', 'EMLINK', 'EMSGSIZE', 'EMULTIHOP', - 'ENAMETOOLONG', 'ENETDOWN', 'ENETRESET', 'ENETUNREACH', - 'ENFILE', 'ENOANO', 'ENOBUFS', 'ENOCSI', 'ENODATA', - 'ENODEV', 'ENOENT', 'ENOEXEC', 'ENOLCK', 'ENOLINK', - 'ENOMEM', 'ENOMSG', 'ENONET', 'ENOPKG', 'ENOPROTOOPT', - 'ENOSPC', 'ENOSR', 'ENOSTR', 'ENOSYS', 'ENOTBLK', - 'ENOTCONN', 'ENOTDIR', 'ENOTEMPTY', 'ENOTOBACCO', 'ENOTSOCK', - 'ENOTTY', 'ENOTUNIQ', 'ENXIO', 'EOPNOTSUPP', - 'EOVERFLOW', 'EPERM', 'EPFNOSUPPORT', 'EPIPE', - 'EPROTO', 'EPROTONOSUPPORT', 'EPROTOTYPE', - 'ERANGE', 'EREMCHG', 'EREMOTE', 'ERESTART', - 'EROFS', 'ESHUTDOWN', 'ESOCKTNOSUPPORT', 'ESPIPE', - 'ESRCH', 'ESRMNT', 'ESTALE', 'ESTRPIPE', 'ETIME', - 'ETIMEDOUT', 'ETOOMANYREFS', 'ETXTBSY', 'EUNATCH', - 'EUSERS', 'EWOULDBLOCK', 'EXDEV', 'EXFULL'] - -# -# This is a wee bit bogus since the module only conditionally adds -# errno constants if they have been defined by errno.h However, this -# test seems to work on SGI, Sparc & intel Solaris, and linux. -# -for error in errors: - try: - a = getattr(errno, error) - except AttributeError: - if verbose: - print '%s: not found' % error - else: - if verbose: - print '%s: %d' % (error, a) diff --git a/sys/lib/python/test/test_exception_variations.py b/sys/lib/python/test/test_exception_variations.py deleted file mode 100644 index 8fe75e8fc..000000000 --- a/sys/lib/python/test/test_exception_variations.py +++ /dev/null @@ -1,180 +0,0 @@ - -from test.test_support import run_unittest -import unittest - -class ExceptionTestCase(unittest.TestCase): - def test_try_except_else_finally(self): - hit_except = False - hit_else = False - hit_finally = False - - try: - raise Exception, 'nyaa!' - except: - hit_except = True - else: - hit_else = True - finally: - hit_finally = True - - self.assertTrue(hit_except) - self.assertTrue(hit_finally) - self.assertFalse(hit_else) - - def test_try_except_else_finally_no_exception(self): - hit_except = False - hit_else = False - hit_finally = False - - try: - pass - except: - hit_except = True - else: - hit_else = True - finally: - hit_finally = True - - self.assertFalse(hit_except) - self.assertTrue(hit_finally) - self.assertTrue(hit_else) - - def test_try_except_finally(self): - hit_except = False - hit_finally = False - - try: - raise Exception, 'yarr!' - except: - hit_except = True - finally: - hit_finally = True - - self.assertTrue(hit_except) - self.assertTrue(hit_finally) - - def test_try_except_finally_no_exception(self): - hit_except = False - hit_finally = False - - try: - pass - except: - hit_except = True - finally: - hit_finally = True - - self.assertFalse(hit_except) - self.assertTrue(hit_finally) - - def test_try_except(self): - hit_except = False - - try: - raise Exception, 'ahoy!' - except: - hit_except = True - - self.assertTrue(hit_except) - - def test_try_except_no_exception(self): - hit_except = False - - try: - pass - except: - hit_except = True - - self.assertFalse(hit_except) - - def test_try_except_else(self): - hit_except = False - hit_else = False - - try: - raise Exception, 'foo!' - except: - hit_except = True - else: - hit_else = True - - self.assertFalse(hit_else) - self.assertTrue(hit_except) - - def test_try_except_else_no_exception(self): - hit_except = False - hit_else = False - - try: - pass - except: - hit_except = True - else: - hit_else = True - - self.assertFalse(hit_except) - self.assertTrue(hit_else) - - def test_try_finally_no_exception(self): - hit_finally = False - - try: - pass - finally: - hit_finally = True - - self.assertTrue(hit_finally) - - def test_nested(self): - hit_finally = False - hit_inner_except = False - hit_inner_finally = False - - try: - try: - raise Exception, 'inner exception' - except: - hit_inner_except = True - finally: - hit_inner_finally = True - finally: - hit_finally = True - - self.assertTrue(hit_inner_except) - self.assertTrue(hit_inner_finally) - self.assertTrue(hit_finally) - - def test_nested_else(self): - hit_else = False - hit_finally = False - hit_except = False - hit_inner_except = False - hit_inner_else = False - - try: - try: - pass - except: - hit_inner_except = True - else: - hit_inner_else = True - - raise Exception, 'outer exception' - except: - hit_except = True - else: - hit_else = True - finally: - hit_finally = True - - self.assertFalse(hit_inner_except) - self.assertTrue(hit_inner_else) - self.assertFalse(hit_else) - self.assertTrue(hit_finally) - self.assertTrue(hit_except) - -def test_main(): - run_unittest(ExceptionTestCase) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_exceptions.py b/sys/lib/python/test/test_exceptions.py deleted file mode 100644 index 05666a859..000000000 --- a/sys/lib/python/test/test_exceptions.py +++ /dev/null @@ -1,345 +0,0 @@ -# Python test set -- part 5, built-in exceptions - -import os -import sys -import unittest -import warnings -import pickle, cPickle - -from test.test_support import TESTFN, unlink, run_unittest - -# XXX This is not really enough, each *operation* should be tested! - -class ExceptionTests(unittest.TestCase): - - def testReload(self): - # Reloading the built-in exceptions module failed prior to Py2.2, while it - # should act the same as reloading built-in sys. - try: - import exceptions - reload(exceptions) - except ImportError, e: - self.fail("reloading exceptions: %s" % e) - - def raise_catch(self, exc, excname): - try: - raise exc, "spam" - except exc, err: - buf1 = str(err) - try: - raise exc("spam") - except exc, err: - buf2 = str(err) - self.assertEquals(buf1, buf2) - self.assertEquals(exc.__name__, excname) - - def testRaising(self): - self.raise_catch(AttributeError, "AttributeError") - self.assertRaises(AttributeError, getattr, sys, "undefined_attribute") - - self.raise_catch(EOFError, "EOFError") - fp = open(TESTFN, 'w') - fp.close() - fp = open(TESTFN, 'r') - savestdin = sys.stdin - try: - try: - sys.stdin = fp - x = raw_input() - except EOFError: - pass - finally: - sys.stdin = savestdin - fp.close() - unlink(TESTFN) - - self.raise_catch(IOError, "IOError") - self.assertRaises(IOError, open, 'this file does not exist', 'r') - - self.raise_catch(ImportError, "ImportError") - self.assertRaises(ImportError, __import__, "undefined_module") - - self.raise_catch(IndexError, "IndexError") - x = [] - self.assertRaises(IndexError, x.__getitem__, 10) - - self.raise_catch(KeyError, "KeyError") - x = {} - self.assertRaises(KeyError, x.__getitem__, 'key') - - self.raise_catch(KeyboardInterrupt, "KeyboardInterrupt") - - self.raise_catch(MemoryError, "MemoryError") - - self.raise_catch(NameError, "NameError") - try: x = undefined_variable - except NameError: pass - - self.raise_catch(OverflowError, "OverflowError") - x = 1 - for dummy in range(128): - x += x # this simply shouldn't blow up - - self.raise_catch(RuntimeError, "RuntimeError") - - self.raise_catch(SyntaxError, "SyntaxError") - try: exec '/\n' - except SyntaxError: pass - - self.raise_catch(IndentationError, "IndentationError") - - self.raise_catch(TabError, "TabError") - # can only be tested under -tt, and is the only test for -tt - #try: compile("try:\n\t1/0\n \t1/0\nfinally:\n pass\n", '', 'exec') - #except TabError: pass - #else: self.fail("TabError not raised") - - self.raise_catch(SystemError, "SystemError") - - self.raise_catch(SystemExit, "SystemExit") - self.assertRaises(SystemExit, sys.exit, 0) - - self.raise_catch(TypeError, "TypeError") - try: [] + () - except TypeError: pass - - self.raise_catch(ValueError, "ValueError") - self.assertRaises(ValueError, chr, 10000) - - self.raise_catch(ZeroDivisionError, "ZeroDivisionError") - try: x = 1/0 - except ZeroDivisionError: pass - - self.raise_catch(Exception, "Exception") - try: x = 1/0 - except Exception, e: pass - - def testSyntaxErrorMessage(self): - # make sure the right exception message is raised for each of - # these code fragments - - def ckmsg(src, msg): - try: - compile(src, '', 'exec') - except SyntaxError, e: - if e.msg != msg: - self.fail("expected %s, got %s" % (msg, e.msg)) - else: - self.fail("failed to get expected SyntaxError") - - s = '''while 1: - try: - pass - finally: - continue''' - - if not sys.platform.startswith('java'): - ckmsg(s, "'continue' not supported inside 'finally' clause") - - s = '''if 1: - try: - continue - except: - pass''' - - ckmsg(s, "'continue' not properly in loop") - ckmsg("continue\n", "'continue' not properly in loop") - - def testSettingException(self): - # test that setting an exception at the C level works even if the - # exception object can't be constructed. - - class BadException: - def __init__(self_): - raise RuntimeError, "can't instantiate BadException" - - def test_capi1(): - import _testcapi - try: - _testcapi.raise_exception(BadException, 1) - except TypeError, err: - exc, err, tb = sys.exc_info() - co = tb.tb_frame.f_code - self.assertEquals(co.co_name, "test_capi1") - self.assert_(co.co_filename.endswith('test_exceptions'+os.extsep+'py')) - else: - self.fail("Expected exception") - - def test_capi2(): - import _testcapi - try: - _testcapi.raise_exception(BadException, 0) - except RuntimeError, err: - exc, err, tb = sys.exc_info() - co = tb.tb_frame.f_code - self.assertEquals(co.co_name, "__init__") - self.assert_(co.co_filename.endswith('test_exceptions'+os.extsep+'py')) - co2 = tb.tb_frame.f_back.f_code - self.assertEquals(co2.co_name, "test_capi2") - else: - self.fail("Expected exception") - - if not sys.platform.startswith('java'): - test_capi1() - test_capi2() - - def test_WindowsError(self): - try: - WindowsError - except NameError: - pass - else: - self.failUnlessEqual(str(WindowsError(1001)), - "1001") - self.failUnlessEqual(str(WindowsError(1001, "message")), - "[Error 1001] message") - self.failUnlessEqual(WindowsError(1001, "message").errno, 22) - self.failUnlessEqual(WindowsError(1001, "message").winerror, 1001) - - def testAttributes(self): - # test that exception attributes are happy - - exceptionList = [ - (BaseException, (), {'message' : '', 'args' : ()}), - (BaseException, (1, ), {'message' : 1, 'args' : (1,)}), - (BaseException, ('foo',), - {'message' : 'foo', 'args' : ('foo',)}), - (BaseException, ('foo', 1), - {'message' : '', 'args' : ('foo', 1)}), - (SystemExit, ('foo',), - {'message' : 'foo', 'args' : ('foo',), 'code' : 'foo'}), - (IOError, ('foo',), - {'message' : 'foo', 'args' : ('foo',), 'filename' : None, - 'errno' : None, 'strerror' : None}), - (IOError, ('foo', 'bar'), - {'message' : '', 'args' : ('foo', 'bar'), 'filename' : None, - 'errno' : 'foo', 'strerror' : 'bar'}), - (IOError, ('foo', 'bar', 'baz'), - {'message' : '', 'args' : ('foo', 'bar'), 'filename' : 'baz', - 'errno' : 'foo', 'strerror' : 'bar'}), - (IOError, ('foo', 'bar', 'baz', 'quux'), - {'message' : '', 'args' : ('foo', 'bar', 'baz', 'quux')}), - (EnvironmentError, ('errnoStr', 'strErrorStr', 'filenameStr'), - {'message' : '', 'args' : ('errnoStr', 'strErrorStr'), - 'strerror' : 'strErrorStr', 'errno' : 'errnoStr', - 'filename' : 'filenameStr'}), - (EnvironmentError, (1, 'strErrorStr', 'filenameStr'), - {'message' : '', 'args' : (1, 'strErrorStr'), 'errno' : 1, - 'strerror' : 'strErrorStr', 'filename' : 'filenameStr'}), - (SyntaxError, ('msgStr',), - {'message' : 'msgStr', 'args' : ('msgStr',), 'text' : None, - 'print_file_and_line' : None, 'msg' : 'msgStr', - 'filename' : None, 'lineno' : None, 'offset' : None}), - (SyntaxError, ('msgStr', ('filenameStr', 'linenoStr', 'offsetStr', - 'textStr')), - {'message' : '', 'offset' : 'offsetStr', 'text' : 'textStr', - 'args' : ('msgStr', ('filenameStr', 'linenoStr', - 'offsetStr', 'textStr')), - 'print_file_and_line' : None, 'msg' : 'msgStr', - 'filename' : 'filenameStr', 'lineno' : 'linenoStr'}), - (SyntaxError, ('msgStr', 'filenameStr', 'linenoStr', 'offsetStr', - 'textStr', 'print_file_and_lineStr'), - {'message' : '', 'text' : None, - 'args' : ('msgStr', 'filenameStr', 'linenoStr', 'offsetStr', - 'textStr', 'print_file_and_lineStr'), - 'print_file_and_line' : None, 'msg' : 'msgStr', - 'filename' : None, 'lineno' : None, 'offset' : None}), - (UnicodeError, (), {'message' : '', 'args' : (),}), - (UnicodeEncodeError, ('ascii', u'a', 0, 1, 'ordinal not in range'), - {'message' : '', 'args' : ('ascii', u'a', 0, 1, - 'ordinal not in range'), - 'encoding' : 'ascii', 'object' : u'a', - 'start' : 0, 'reason' : 'ordinal not in range'}), - (UnicodeDecodeError, ('ascii', '\xff', 0, 1, 'ordinal not in range'), - {'message' : '', 'args' : ('ascii', '\xff', 0, 1, - 'ordinal not in range'), - 'encoding' : 'ascii', 'object' : '\xff', - 'start' : 0, 'reason' : 'ordinal not in range'}), - (UnicodeTranslateError, (u"\u3042", 0, 1, "ouch"), - {'message' : '', 'args' : (u'\u3042', 0, 1, 'ouch'), - 'object' : u'\u3042', 'reason' : 'ouch', - 'start' : 0, 'end' : 1}), - ] - try: - exceptionList.append( - (WindowsError, (1, 'strErrorStr', 'filenameStr'), - {'message' : '', 'args' : (1, 'strErrorStr'), - 'strerror' : 'strErrorStr', 'winerror' : 1, - 'errno' : 22, 'filename' : 'filenameStr'}) - ) - except NameError: - pass - - for exc, args, expected in exceptionList: - try: - raise exc(*args) - except BaseException, e: - if type(e) is not exc: - raise - # Verify module name - self.assertEquals(type(e).__module__, 'exceptions') - # Verify no ref leaks in Exc_str() - s = str(e) - for checkArgName in expected: - self.assertEquals(repr(getattr(e, checkArgName)), - repr(expected[checkArgName]), - 'exception "%s", attribute "%s"' % - (repr(e), checkArgName)) - - # test for pickling support - for p in pickle, cPickle: - for protocol in range(p.HIGHEST_PROTOCOL + 1): - new = p.loads(p.dumps(e, protocol)) - for checkArgName in expected: - got = repr(getattr(new, checkArgName)) - want = repr(expected[checkArgName]) - self.assertEquals(got, want, - 'pickled "%r", attribute "%s' % - (e, checkArgName)) - - def testSlicing(self): - # Test that you can slice an exception directly instead of requiring - # going through the 'args' attribute. - args = (1, 2, 3) - exc = BaseException(*args) - self.failUnlessEqual(exc[:], args) - - def testKeywordArgs(self): - # test that builtin exception don't take keyword args, - # but user-defined subclasses can if they want - self.assertRaises(TypeError, BaseException, a=1) - - class DerivedException(BaseException): - def __init__(self, fancy_arg): - BaseException.__init__(self) - self.fancy_arg = fancy_arg - - x = DerivedException(fancy_arg=42) - self.assertEquals(x.fancy_arg, 42) - - def testInfiniteRecursion(self): - def f(): - return f() - self.assertRaises(RuntimeError, f) - - def g(): - try: - return g() - except ValueError: - return -1 - self.assertRaises(RuntimeError, g) - - def testUnicodeStrUsage(self): - # Make sure both instances and classes have a str and unicode - # representation. - self.failUnless(str(Exception)) - self.failUnless(unicode(Exception)) - self.failUnless(str(Exception('a'))) - self.failUnless(unicode(Exception(u'a'))) - - -def test_main(): - run_unittest(ExceptionTests) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_extcall.py b/sys/lib/python/test/test_extcall.py deleted file mode 100644 index 284dbb214..000000000 --- a/sys/lib/python/test/test_extcall.py +++ /dev/null @@ -1,279 +0,0 @@ -from test.test_support import verify, verbose, TestFailed, sortdict -from UserList import UserList - -def e(a, b): - print a, b - -def f(*a, **k): - print a, sortdict(k) - -def g(x, *y, **z): - print x, y, sortdict(z) - -def h(j=1, a=2, h=3): - print j, a, h - -f() -f(1) -f(1, 2) -f(1, 2, 3) - -f(1, 2, 3, *(4, 5)) -f(1, 2, 3, *[4, 5]) -f(1, 2, 3, *UserList([4, 5])) -f(1, 2, 3, **{'a':4, 'b':5}) -f(1, 2, 3, *(4, 5), **{'a':6, 'b':7}) -f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b':9}) - -# Verify clearing of SF bug #733667 -try: - e(c=3) -except TypeError: - pass -else: - print "should raise TypeError: e() got an unexpected keyword argument 'c'" - -try: - g() -except TypeError, err: - print "TypeError:", err -else: - print "should raise TypeError: not enough arguments; expected 1, got 0" - -try: - g(*()) -except TypeError, err: - print "TypeError:", err -else: - print "should raise TypeError: not enough arguments; expected 1, got 0" - -try: - g(*(), **{}) -except TypeError, err: - print "TypeError:", err -else: - print "should raise TypeError: not enough arguments; expected 1, got 0" - -g(1) -g(1, 2) -g(1, 2, 3) -g(1, 2, 3, *(4, 5)) -class Nothing: pass -try: - g(*Nothing()) -except TypeError, attr: - pass -else: - print "should raise TypeError" - -class Nothing: - def __len__(self): - return 5 -try: - g(*Nothing()) -except TypeError, attr: - pass -else: - print "should raise TypeError" - -class Nothing: - def __len__(self): - return 5 - def __getitem__(self, i): - if i < 3: - return i - else: - raise IndexError, i -g(*Nothing()) - -class Nothing: - def __init__(self): - self.c = 0 - def __iter__(self): - return self -try: - g(*Nothing()) -except TypeError, attr: - pass -else: - print "should raise TypeError" - -class Nothing: - def __init__(self): - self.c = 0 - def __iter__(self): - return self - def next(self): - if self.c == 4: - raise StopIteration - c = self.c - self.c += 1 - return c -g(*Nothing()) - -# make sure the function call doesn't stomp on the dictionary? -d = {'a': 1, 'b': 2, 'c': 3} -d2 = d.copy() -verify(d == d2) -g(1, d=4, **d) -print sortdict(d) -print sortdict(d2) -verify(d == d2, "function call modified dictionary") - -# what about willful misconduct? -def saboteur(**kw): - kw['x'] = locals() # yields a cyclic kw - return kw -d = {} -kw = saboteur(a=1, **d) -verify(d == {}) -# break the cycle -del kw['x'] - -try: - g(1, 2, 3, **{'x':4, 'y':5}) -except TypeError, err: - print err -else: - print "should raise TypeError: keyword parameter redefined" - -try: - g(1, 2, 3, a=4, b=5, *(6, 7), **{'a':8, 'b':9}) -except TypeError, err: - print err -else: - print "should raise TypeError: keyword parameter redefined" - -try: - f(**{1:2}) -except TypeError, err: - print err -else: - print "should raise TypeError: keywords must be strings" - -try: - h(**{'e': 2}) -except TypeError, err: - print err -else: - print "should raise TypeError: unexpected keyword argument: e" - -try: - h(*h) -except TypeError, err: - print err -else: - print "should raise TypeError: * argument must be a tuple" - -try: - dir(*h) -except TypeError, err: - print err -else: - print "should raise TypeError: * argument must be a tuple" - -try: - None(*h) -except TypeError, err: - print err -else: - print "should raise TypeError: * argument must be a tuple" - -try: - h(**h) -except TypeError, err: - print err -else: - print "should raise TypeError: ** argument must be a dictionary" - -try: - dir(**h) -except TypeError, err: - print err -else: - print "should raise TypeError: ** argument must be a dictionary" - -try: - None(**h) -except TypeError, err: - print err -else: - print "should raise TypeError: ** argument must be a dictionary" - -try: - dir(b=1,**{'b':1}) -except TypeError, err: - print err -else: - print "should raise TypeError: dir() got multiple values for keyword argument 'b'" - -def f2(*a, **b): - return a, b - -d = {} -for i in range(512): - key = 'k%d' % i - d[key] = i -a, b = f2(1, *(2, 3), **d) -print len(a), len(b), b == d - -class Foo: - def method(self, arg1, arg2): - return arg1 + arg2 - -x = Foo() -print Foo.method(*(x, 1, 2)) -print Foo.method(x, *(1, 2)) -try: - print Foo.method(*(1, 2, 3)) -except TypeError, err: - pass -else: - print 'expected a TypeError for unbound method call' -try: - print Foo.method(1, *(2, 3)) -except TypeError, err: - pass -else: - print 'expected a TypeError for unbound method call' - -# A PyCFunction that takes only positional parameters should allow an -# empty keyword dictionary to pass without a complaint, but raise a -# TypeError if the dictionary is non-empty. -id(1, **{}) -try: - id(1, **{"foo": 1}) -except TypeError: - pass -else: - raise TestFailed, 'expected TypeError; no exception raised' - -a, b, d, e, v, k = 'A', 'B', 'D', 'E', 'V', 'K' -funcs = [] -maxargs = {} -for args in ['', 'a', 'ab']: - for defargs in ['', 'd', 'de']: - for vararg in ['', 'v']: - for kwarg in ['', 'k']: - name = 'z' + args + defargs + vararg + kwarg - arglist = list(args) + map( - lambda x: '%s="%s"' % (x, x), defargs) - if vararg: arglist.append('*' + vararg) - if kwarg: arglist.append('**' + kwarg) - decl = (('def %s(%s): print "ok %s", a, b, d, e, v, ' + - 'type(k) is type ("") and k or sortdict(k)') - % (name, ', '.join(arglist), name)) - exec(decl) - func = eval(name) - funcs.append(func) - maxargs[func] = len(args + defargs) - -for name in ['za', 'zade', 'zabk', 'zabdv', 'zabdevk']: - func = eval(name) - for args in [(), (1, 2), (1, 2, 3, 4, 5)]: - for kwargs in ['', 'a', 'd', 'ad', 'abde']: - kwdict = {} - for k in kwargs: kwdict[k] = k + k - print func.func_name, args, sortdict(kwdict), '->', - try: func(*args, **kwdict) - except TypeError, err: print err diff --git a/sys/lib/python/test/test_fcntl.py b/sys/lib/python/test/test_fcntl.py deleted file mode 100755 index 2d800b2a5..000000000 --- a/sys/lib/python/test/test_fcntl.py +++ /dev/null @@ -1,69 +0,0 @@ -#! /usr/bin/env python -"""Test program for the fcntl C module. - OS/2+EMX doesn't support the file locking operations. - Roger E. Masse -""" -import struct -import fcntl -import os, sys -from test.test_support import verbose, TESTFN - -filename = TESTFN - -try: - os.O_LARGEFILE -except AttributeError: - start_len = "ll" -else: - start_len = "qq" - -if sys.platform.startswith('atheos'): - start_len = "qq" - -if sys.platform in ('netbsd1', 'netbsd2', 'netbsd3', - 'Darwin1.2', 'darwin', - 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', - 'freebsd6', 'freebsd7', - 'bsdos2', 'bsdos3', 'bsdos4', - 'openbsd', 'openbsd2', 'openbsd3', 'openbsd4'): - if struct.calcsize('l') == 8: - off_t = 'l' - pid_t = 'i' - else: - off_t = 'lxxxx' - pid_t = 'l' - lockdata = struct.pack(off_t+off_t+pid_t+'hh', 0, 0, 0, fcntl.F_WRLCK, 0) -elif sys.platform in ['aix3', 'aix4', 'hp-uxB', 'unixware7']: - lockdata = struct.pack('hhlllii', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) -elif sys.platform in ['os2emx']: - lockdata = None -else: - lockdata = struct.pack('hh'+start_len+'hh', fcntl.F_WRLCK, 0, 0, 0, 0, 0) -if lockdata: - if verbose: - print 'struct.pack: ', repr(lockdata) - -# the example from the library docs -f = open(filename, 'w') -rv = fcntl.fcntl(f.fileno(), fcntl.F_SETFL, os.O_NONBLOCK) -if verbose: - print 'Status from fcntl with O_NONBLOCK: ', rv - -if sys.platform not in ['os2emx']: - rv = fcntl.fcntl(f.fileno(), fcntl.F_SETLKW, lockdata) - if verbose: - print 'String from fcntl with F_SETLKW: ', repr(rv) - -f.close() -os.unlink(filename) - - -# Again, but pass the file rather than numeric descriptor: -f = open(filename, 'w') -rv = fcntl.fcntl(f, fcntl.F_SETFL, os.O_NONBLOCK) - -if sys.platform not in ['os2emx']: - rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata) - -f.close() -os.unlink(filename) diff --git a/sys/lib/python/test/test_file.py b/sys/lib/python/test/test_file.py deleted file mode 100644 index 73cb5b241..000000000 --- a/sys/lib/python/test/test_file.py +++ /dev/null @@ -1,336 +0,0 @@ -import sys -import os -import unittest -from array import array -from weakref import proxy - -from test.test_support import TESTFN, findfile, run_unittest -from UserList import UserList - -class AutoFileTests(unittest.TestCase): - # file tests for which a test file is automatically set up - - def setUp(self): - self.f = open(TESTFN, 'wb') - - def tearDown(self): - if self.f: - self.f.close() - os.remove(TESTFN) - - def testWeakRefs(self): - # verify weak references - p = proxy(self.f) - p.write('teststring') - self.assertEquals(self.f.tell(), p.tell()) - self.f.close() - self.f = None - self.assertRaises(ReferenceError, getattr, p, 'tell') - - def testAttributes(self): - # verify expected attributes exist - f = self.f - softspace = f.softspace - f.name # merely shouldn't blow up - f.mode # ditto - f.closed # ditto - - # verify softspace is writable - f.softspace = softspace # merely shouldn't blow up - - # verify the others aren't - for attr in 'name', 'mode', 'closed': - self.assertRaises((AttributeError, TypeError), setattr, f, attr, 'oops') - - def testReadinto(self): - # verify readinto - self.f.write('12') - self.f.close() - a = array('c', 'x'*10) - self.f = open(TESTFN, 'rb') - n = self.f.readinto(a) - self.assertEquals('12', a.tostring()[:n]) - - def testWritelinesUserList(self): - # verify writelines with instance sequence - l = UserList(['1', '2']) - self.f.writelines(l) - self.f.close() - self.f = open(TESTFN, 'rb') - buf = self.f.read() - self.assertEquals(buf, '12') - - def testWritelinesIntegers(self): - # verify writelines with integers - self.assertRaises(TypeError, self.f.writelines, [1, 2, 3]) - - def testWritelinesIntegersUserList(self): - # verify writelines with integers in UserList - l = UserList([1,2,3]) - self.assertRaises(TypeError, self.f.writelines, l) - - def testWritelinesNonString(self): - # verify writelines with non-string object - class NonString: - pass - - self.assertRaises(TypeError, self.f.writelines, - [NonString(), NonString()]) - - def testRepr(self): - # verify repr works - self.assert_(repr(self.f).startswith(">sys.__stdout__, ( - ' Skipping sys.stdin.seek(-1), it may crash the interpreter.' - ' Test manually.') - self.assertRaises(IOError, sys.stdin.truncate) - - def testUnicodeOpen(self): - # verify repr works for unicode too - f = open(unicode(TESTFN), "w") - self.assert_(repr(f).startswith(" - # "file.truncate fault on windows" - f = open(TESTFN, 'wb') - f.write('12345678901') # 11 bytes - f.close() - - f = open(TESTFN,'rb+') - data = f.read(5) - if data != '12345': - self.fail("Read on file opened for update failed %r" % data) - if f.tell() != 5: - self.fail("File pos after read wrong %d" % f.tell()) - - f.truncate() - if f.tell() != 5: - self.fail("File pos after ftruncate wrong %d" % f.tell()) - - f.close() - size = os.path.getsize(TESTFN) - if size != 5: - self.fail("File size after ftruncate wrong %d" % size) - - try: - bug801631() - finally: - os.unlink(TESTFN) - - def testIteration(self): - # Test the complex interaction when mixing file-iteration and the - # various read* methods. Ostensibly, the mixture could just be tested - # to work when it should work according to the Python language, - # instead of fail when it should fail according to the current CPython - # implementation. People don't always program Python the way they - # should, though, and the implemenation might change in subtle ways, - # so we explicitly test for errors, too; the test will just have to - # be updated when the implementation changes. - dataoffset = 16384 - filler = "ham\n" - assert not dataoffset % len(filler), \ - "dataoffset must be multiple of len(filler)" - nchunks = dataoffset // len(filler) - testlines = [ - "spam, spam and eggs\n", - "eggs, spam, ham and spam\n", - "saussages, spam, spam and eggs\n", - "spam, ham, spam and eggs\n", - "spam, spam, spam, spam, spam, ham, spam\n", - "wonderful spaaaaaam.\n" - ] - methods = [("readline", ()), ("read", ()), ("readlines", ()), - ("readinto", (array("c", " "*100),))] - - try: - # Prepare the testfile - bag = open(TESTFN, "w") - bag.write(filler * nchunks) - bag.writelines(testlines) - bag.close() - # Test for appropriate errors mixing read* and iteration - for methodname, args in methods: - f = open(TESTFN) - if f.next() != filler: - self.fail, "Broken testfile" - meth = getattr(f, methodname) - try: - meth(*args) - except ValueError: - pass - else: - self.fail("%s%r after next() didn't raise ValueError" % - (methodname, args)) - f.close() - - # Test to see if harmless (by accident) mixing of read* and - # iteration still works. This depends on the size of the internal - # iteration buffer (currently 8192,) but we can test it in a - # flexible manner. Each line in the bag o' ham is 4 bytes - # ("h", "a", "m", "\n"), so 4096 lines of that should get us - # exactly on the buffer boundary for any power-of-2 buffersize - # between 4 and 16384 (inclusive). - f = open(TESTFN) - for i in range(nchunks): - f.next() - testline = testlines.pop(0) - try: - line = f.readline() - except ValueError: - self.fail("readline() after next() with supposedly empty " - "iteration-buffer failed anyway") - if line != testline: - self.fail("readline() after next() with empty buffer " - "failed. Got %r, expected %r" % (line, testline)) - testline = testlines.pop(0) - buf = array("c", "\x00" * len(testline)) - try: - f.readinto(buf) - except ValueError: - self.fail("readinto() after next() with supposedly empty " - "iteration-buffer failed anyway") - line = buf.tostring() - if line != testline: - self.fail("readinto() after next() with empty buffer " - "failed. Got %r, expected %r" % (line, testline)) - - testline = testlines.pop(0) - try: - line = f.read(len(testline)) - except ValueError: - self.fail("read() after next() with supposedly empty " - "iteration-buffer failed anyway") - if line != testline: - self.fail("read() after next() with empty buffer " - "failed. Got %r, expected %r" % (line, testline)) - try: - lines = f.readlines() - except ValueError: - self.fail("readlines() after next() with supposedly empty " - "iteration-buffer failed anyway") - if lines != testlines: - self.fail("readlines() after next() with empty buffer " - "failed. Got %r, expected %r" % (line, testline)) - # Reading after iteration hit EOF shouldn't hurt either - f = open(TESTFN) - try: - for line in f: - pass - try: - f.readline() - f.readinto(buf) - f.read() - f.readlines() - except ValueError: - self.fail("read* failed after next() consumed file") - finally: - f.close() - finally: - os.unlink(TESTFN) - - -def test_main(): - # Historically, these tests have been sloppy about removing TESTFN. - # So get rid of it no matter what. - try: - run_unittest(AutoFileTests, OtherFileTests) - finally: - if os.path.exists(TESTFN): - os.unlink(TESTFN) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_filecmp.py b/sys/lib/python/test/test_filecmp.py deleted file mode 100644 index 503562b61..000000000 --- a/sys/lib/python/test/test_filecmp.py +++ /dev/null @@ -1,134 +0,0 @@ - -import os, filecmp, shutil, tempfile, shutil -import unittest -from test import test_support - -class FileCompareTestCase(unittest.TestCase): - def setUp(self): - self.name = test_support.TESTFN - self.name_same = test_support.TESTFN + '-same' - self.name_diff = test_support.TESTFN + '-diff' - data = 'Contents of file go here.\n' - for name in [self.name, self.name_same, self.name_diff]: - output = open(name, 'w') - output.write(data) - output.close() - - output = open(self.name_diff, 'a+') - output.write('An extra line.\n') - output.close() - self.dir = tempfile.gettempdir() - - def tearDown(self): - os.unlink(self.name) - os.unlink(self.name_same) - os.unlink(self.name_diff) - - def test_matching(self): - self.failUnless(filecmp.cmp(self.name, self.name_same), - "Comparing file to itself fails") - self.failUnless(filecmp.cmp(self.name, self.name_same, shallow=False), - "Comparing file to itself fails") - self.failUnless(filecmp.cmp(self.name, self.name, shallow=False), - "Comparing file to identical file fails") - self.failUnless(filecmp.cmp(self.name, self.name), - "Comparing file to identical file fails") - - def test_different(self): - self.failIf(filecmp.cmp(self.name, self.name_diff), - "Mismatched files compare as equal") - self.failIf(filecmp.cmp(self.name, self.dir), - "File and directory compare as equal") - -class DirCompareTestCase(unittest.TestCase): - def setUp(self): - tmpdir = tempfile.gettempdir() - self.dir = os.path.join(tmpdir, 'dir') - self.dir_same = os.path.join(tmpdir, 'dir-same') - self.dir_diff = os.path.join(tmpdir, 'dir-diff') - self.caseinsensitive = os.path.normcase('A') == os.path.normcase('a') - data = 'Contents of file go here.\n' - for dir in [self.dir, self.dir_same, self.dir_diff]: - shutil.rmtree(dir, True) - os.mkdir(dir) - if self.caseinsensitive and dir is self.dir_same: - fn = 'FiLe' # Verify case-insensitive comparison - else: - fn = 'file' - output = open(os.path.join(dir, fn), 'w') - output.write(data) - output.close() - - output = open(os.path.join(self.dir_diff, 'file2'), 'w') - output.write('An extra file.\n') - output.close() - - def tearDown(self): - shutil.rmtree(self.dir) - shutil.rmtree(self.dir_same) - shutil.rmtree(self.dir_diff) - - def test_cmpfiles(self): - self.failUnless(filecmp.cmpfiles(self.dir, self.dir, ['file']) == - (['file'], [], []), - "Comparing directory to itself fails") - self.failUnless(filecmp.cmpfiles(self.dir, self.dir_same, ['file']) == - (['file'], [], []), - "Comparing directory to same fails") - - # Try it with shallow=False - self.failUnless(filecmp.cmpfiles(self.dir, self.dir, ['file'], - shallow=False) == - (['file'], [], []), - "Comparing directory to itself fails") - self.failUnless(filecmp.cmpfiles(self.dir, self.dir_same, ['file'], - shallow=False), - "Comparing directory to same fails") - - # Add different file2 - output = open(os.path.join(self.dir, 'file2'), 'w') - output.write('Different contents.\n') - output.close() - - self.failIf(filecmp.cmpfiles(self.dir, self.dir_same, - ['file', 'file2']) == - (['file'], ['file2'], []), - "Comparing mismatched directories fails") - - - def test_dircmp(self): - # Check attributes for comparison of two identical directories - d = filecmp.dircmp(self.dir, self.dir_same) - if self.caseinsensitive: - self.assertEqual([d.left_list, d.right_list],[['file'], ['FiLe']]) - else: - self.assertEqual([d.left_list, d.right_list],[['file'], ['file']]) - self.failUnless(d.common == ['file']) - self.failUnless(d.left_only == d.right_only == []) - self.failUnless(d.same_files == ['file']) - self.failUnless(d.diff_files == []) - - # Check attributes for comparison of two different directories - d = filecmp.dircmp(self.dir, self.dir_diff) - self.failUnless(d.left_list == ['file']) - self.failUnless(d.right_list == ['file', 'file2']) - self.failUnless(d.common == ['file']) - self.failUnless(d.left_only == []) - self.failUnless(d.right_only == ['file2']) - self.failUnless(d.same_files == ['file']) - self.failUnless(d.diff_files == []) - - # Add different file2 - output = open(os.path.join(self.dir, 'file2'), 'w') - output.write('Different contents.\n') - output.close() - d = filecmp.dircmp(self.dir, self.dir_diff) - self.failUnless(d.same_files == ['file']) - self.failUnless(d.diff_files == ['file2']) - - -def test_main(): - test_support.run_unittest(FileCompareTestCase, DirCompareTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_fileinput.py b/sys/lib/python/test/test_fileinput.py deleted file mode 100644 index 301769e4f..000000000 --- a/sys/lib/python/test/test_fileinput.py +++ /dev/null @@ -1,227 +0,0 @@ -''' -Tests for fileinput module. -Nick Mathewson -''' - -from test.test_support import verify, verbose, TESTFN, TestFailed -import sys, os, re -from StringIO import StringIO -from fileinput import FileInput, hook_encoded - -# The fileinput module has 2 interfaces: the FileInput class which does -# all the work, and a few functions (input, etc.) that use a global _state -# variable. We only test the FileInput class, since the other functions -# only provide a thin facade over FileInput. - -# Write lines (a list of lines) to temp file number i, and return the -# temp file's name. -def writeTmp(i, lines, mode='w'): # opening in text mode is the default - name = TESTFN + str(i) - f = open(name, mode) - f.writelines(lines) - f.close() - return name - -pat = re.compile(r'LINE (\d+) OF FILE (\d+)') - -def remove_tempfiles(*names): - for name in names: - try: - os.unlink(name) - except: - pass - -def runTests(t1, t2, t3, t4, bs=0, round=0): - start = 1 + round*6 - if verbose: - print '%s. Simple iteration (bs=%s)' % (start+0, bs) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - lines = list(fi) - fi.close() - verify(len(lines) == 31) - verify(lines[4] == 'Line 5 of file 1\n') - verify(lines[30] == 'Line 1 of file 4\n') - verify(fi.lineno() == 31) - verify(fi.filename() == t4) - - if verbose: - print '%s. Status variables (bs=%s)' % (start+1, bs) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - s = "x" - while s and s != 'Line 6 of file 2\n': - s = fi.readline() - verify(fi.filename() == t2) - verify(fi.lineno() == 21) - verify(fi.filelineno() == 6) - verify(not fi.isfirstline()) - verify(not fi.isstdin()) - - if verbose: - print '%s. Nextfile (bs=%s)' % (start+2, bs) - fi.nextfile() - verify(fi.readline() == 'Line 1 of file 3\n') - verify(fi.lineno() == 22) - fi.close() - - if verbose: - print '%s. Stdin (bs=%s)' % (start+3, bs) - fi = FileInput(files=(t1, t2, t3, t4, '-'), bufsize=bs) - savestdin = sys.stdin - try: - sys.stdin = StringIO("Line 1 of stdin\nLine 2 of stdin\n") - lines = list(fi) - verify(len(lines) == 33) - verify(lines[32] == 'Line 2 of stdin\n') - verify(fi.filename() == '') - fi.nextfile() - finally: - sys.stdin = savestdin - - if verbose: - print '%s. Boundary conditions (bs=%s)' % (start+4, bs) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - verify(fi.lineno() == 0) - verify(fi.filename() == None) - fi.nextfile() - verify(fi.lineno() == 0) - verify(fi.filename() == None) - - if verbose: - print '%s. Inplace (bs=%s)' % (start+5, bs) - savestdout = sys.stdout - try: - fi = FileInput(files=(t1, t2, t3, t4), inplace=1, bufsize=bs) - for line in fi: - line = line[:-1].upper() - print line - fi.close() - finally: - sys.stdout = savestdout - - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - for line in fi: - verify(line[-1] == '\n') - m = pat.match(line[:-1]) - verify(m != None) - verify(int(m.group(1)) == fi.filelineno()) - fi.close() - - -def writeFiles(): - global t1, t2, t3, t4 - t1 = writeTmp(1, ["Line %s of file 1\n" % (i+1) for i in range(15)]) - t2 = writeTmp(2, ["Line %s of file 2\n" % (i+1) for i in range(10)]) - t3 = writeTmp(3, ["Line %s of file 3\n" % (i+1) for i in range(5)]) - t4 = writeTmp(4, ["Line %s of file 4\n" % (i+1) for i in range(1)]) - -# First, run the tests with default and teeny buffer size. -for round, bs in (0, 0), (1, 30): - try: - writeFiles() - runTests(t1, t2, t3, t4, bs, round) - finally: - remove_tempfiles(t1, t2, t3, t4) - -# Next, check for proper behavior with 0-byte files. -if verbose: - print "13. 0-byte files" -try: - t1 = writeTmp(1, [""]) - t2 = writeTmp(2, [""]) - t3 = writeTmp(3, ["The only line there is.\n"]) - t4 = writeTmp(4, [""]) - fi = FileInput(files=(t1, t2, t3, t4)) - line = fi.readline() - verify(line == 'The only line there is.\n') - verify(fi.lineno() == 1) - verify(fi.filelineno() == 1) - verify(fi.filename() == t3) - line = fi.readline() - verify(not line) - verify(fi.lineno() == 1) - verify(fi.filelineno() == 0) - verify(fi.filename() == t4) - fi.close() -finally: - remove_tempfiles(t1, t2, t3, t4) - -if verbose: - print "14. Files that don't end with newline" -try: - t1 = writeTmp(1, ["A\nB\nC"]) - t2 = writeTmp(2, ["D\nE\nF"]) - fi = FileInput(files=(t1, t2)) - lines = list(fi) - verify(lines == ["A\n", "B\n", "C", "D\n", "E\n", "F"]) - verify(fi.filelineno() == 3) - verify(fi.lineno() == 6) -finally: - remove_tempfiles(t1, t2) - -if verbose: - print "15. Unicode filenames" -try: - t1 = writeTmp(1, ["A\nB"]) - encoding = sys.getfilesystemencoding() - if encoding is None: - encoding = 'ascii' - fi = FileInput(files=unicode(t1, encoding)) - lines = list(fi) - verify(lines == ["A\n", "B"]) -finally: - remove_tempfiles(t1) - -if verbose: - print "16. fileno()" -try: - t1 = writeTmp(1, ["A\nB"]) - t2 = writeTmp(2, ["C\nD"]) - fi = FileInput(files=(t1, t2)) - verify(fi.fileno() == -1) - line = fi.next() - verify(fi.fileno() != -1) - fi.nextfile() - verify(fi.fileno() == -1) - line = list(fi) - verify(fi.fileno() == -1) -finally: - remove_tempfiles(t1, t2) - -if verbose: - print "17. Specify opening mode" -try: - # invalid mode, should raise ValueError - fi = FileInput(mode="w") - raise TestFailed("FileInput should reject invalid mode argument") -except ValueError: - pass -try: - # try opening in universal newline mode - t1 = writeTmp(1, ["A\nB\r\nC\rD"], mode="wb") - fi = FileInput(files=t1, mode="U") - lines = list(fi) - verify(lines == ["A\n", "B\n", "C\n", "D"]) -finally: - remove_tempfiles(t1) - -if verbose: - print "18. Test file opening hook" -try: - # cannot use openhook and inplace mode - fi = FileInput(inplace=1, openhook=lambda f,m: None) - raise TestFailed("FileInput should raise if both inplace " - "and openhook arguments are given") -except ValueError: - pass -try: - fi = FileInput(openhook=1) - raise TestFailed("FileInput should check openhook for being callable") -except ValueError: - pass -try: - t1 = writeTmp(1, ["A\nB"], mode="wb") - fi = FileInput(files=t1, openhook=hook_encoded("rot13")) - lines = list(fi) - verify(lines == ["N\n", "O"]) -finally: - remove_tempfiles(t1) diff --git a/sys/lib/python/test/test_float.py b/sys/lib/python/test/test_float.py deleted file mode 100644 index fb47db8eb..000000000 --- a/sys/lib/python/test/test_float.py +++ /dev/null @@ -1,110 +0,0 @@ - -import unittest, struct -from test import test_support - -class FormatFunctionsTestCase(unittest.TestCase): - - def setUp(self): - self.save_formats = {'double':float.__getformat__('double'), - 'float':float.__getformat__('float')} - - def tearDown(self): - float.__setformat__('double', self.save_formats['double']) - float.__setformat__('float', self.save_formats['float']) - - def test_getformat(self): - self.assert_(float.__getformat__('double') in - ['unknown', 'IEEE, big-endian', 'IEEE, little-endian']) - self.assert_(float.__getformat__('float') in - ['unknown', 'IEEE, big-endian', 'IEEE, little-endian']) - self.assertRaises(ValueError, float.__getformat__, 'chicken') - self.assertRaises(TypeError, float.__getformat__, 1) - - def test_setformat(self): - for t in 'double', 'float': - float.__setformat__(t, 'unknown') - if self.save_formats[t] == 'IEEE, big-endian': - self.assertRaises(ValueError, float.__setformat__, - t, 'IEEE, little-endian') - elif self.save_formats[t] == 'IEEE, little-endian': - self.assertRaises(ValueError, float.__setformat__, - t, 'IEEE, big-endian') - else: - self.assertRaises(ValueError, float.__setformat__, - t, 'IEEE, big-endian') - self.assertRaises(ValueError, float.__setformat__, - t, 'IEEE, little-endian') - self.assertRaises(ValueError, float.__setformat__, - t, 'chicken') - self.assertRaises(ValueError, float.__setformat__, - 'chicken', 'unknown') - -BE_DOUBLE_INF = '\x7f\xf0\x00\x00\x00\x00\x00\x00' -LE_DOUBLE_INF = ''.join(reversed(BE_DOUBLE_INF)) -BE_DOUBLE_NAN = '\x7f\xf8\x00\x00\x00\x00\x00\x00' -LE_DOUBLE_NAN = ''.join(reversed(BE_DOUBLE_NAN)) - -BE_FLOAT_INF = '\x7f\x80\x00\x00' -LE_FLOAT_INF = ''.join(reversed(BE_FLOAT_INF)) -BE_FLOAT_NAN = '\x7f\xc0\x00\x00' -LE_FLOAT_NAN = ''.join(reversed(BE_FLOAT_NAN)) - -# on non-IEEE platforms, attempting to unpack a bit pattern -# representing an infinity or a NaN should raise an exception. - -class UnknownFormatTestCase(unittest.TestCase): - def setUp(self): - self.save_formats = {'double':float.__getformat__('double'), - 'float':float.__getformat__('float')} - float.__setformat__('double', 'unknown') - float.__setformat__('float', 'unknown') - - def tearDown(self): - float.__setformat__('double', self.save_formats['double']) - float.__setformat__('float', self.save_formats['float']) - - def test_double_specials_dont_unpack(self): - for fmt, data in [('>d', BE_DOUBLE_INF), - ('>d', BE_DOUBLE_NAN), - ('f', BE_FLOAT_INF), - ('>f', BE_FLOAT_NAN), - ('d', BE_DOUBLE_INF), - ('>d', BE_DOUBLE_NAN), - ('f', BE_FLOAT_INF), - ('>f', BE_FLOAT_NAN), - ('>8)) - -def test_main(): - run_unittest(ForkTest) - reap_children() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_format.py b/sys/lib/python/test/test_format.py deleted file mode 100644 index a9b31707a..000000000 --- a/sys/lib/python/test/test_format.py +++ /dev/null @@ -1,248 +0,0 @@ -from test.test_support import verbose, have_unicode, TestFailed -import sys - -# test string formatting operator (I am not sure if this is being tested -# elsewhere but, surely, some of the given cases are *not* tested because -# they crash python) -# test on unicode strings as well - -overflowok = 1 - -def testformat(formatstr, args, output=None): - if verbose: - if output: - print "%s %% %s =? %s ..." %\ - (repr(formatstr), repr(args), repr(output)), - else: - print "%s %% %s works? ..." % (repr(formatstr), repr(args)), - try: - result = formatstr % args - except OverflowError: - if not overflowok: - raise - if verbose: - print 'overflow (this is fine)' - else: - if output and result != output: - if verbose: - print 'no' - print "%s %% %s == %s != %s" %\ - (repr(formatstr), repr(args), repr(result), repr(output)) - else: - if verbose: - print 'yes' - -def testboth(formatstr, *args): - testformat(formatstr, *args) - if have_unicode: - testformat(unicode(formatstr), *args) - - -testboth("%.1d", (1,), "1") -testboth("%.*d", (sys.maxint,1)) # expect overflow -testboth("%.100d", (1,), '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001') -testboth("%#.117x", (1,), '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001') -testboth("%#.118x", (1,), '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001') - -testboth("%f", (1.0,), "1.000000") -# these are trying to test the limits of the internal magic-number-length -# formatting buffer, if that number changes then these tests are less -# effective -testboth("%#.*g", (109, -1.e+49/3.)) -testboth("%#.*g", (110, -1.e+49/3.)) -testboth("%#.*g", (110, -1.e+100/3.)) - -# test some ridiculously large precision, expect overflow -testboth('%12.*f', (123456, 1.0)) - -# Formatting of long integers. Overflow is not ok -overflowok = 0 -testboth("%x", 10L, "a") -testboth("%x", 100000000000L, "174876e800") -testboth("%o", 10L, "12") -testboth("%o", 100000000000L, "1351035564000") -testboth("%d", 10L, "10") -testboth("%d", 100000000000L, "100000000000") - -big = 123456789012345678901234567890L -testboth("%d", big, "123456789012345678901234567890") -testboth("%d", -big, "-123456789012345678901234567890") -testboth("%5d", -big, "-123456789012345678901234567890") -testboth("%31d", -big, "-123456789012345678901234567890") -testboth("%32d", -big, " -123456789012345678901234567890") -testboth("%-32d", -big, "-123456789012345678901234567890 ") -testboth("%032d", -big, "-0123456789012345678901234567890") -testboth("%-032d", -big, "-123456789012345678901234567890 ") -testboth("%034d", -big, "-000123456789012345678901234567890") -testboth("%034d", big, "0000123456789012345678901234567890") -testboth("%0+34d", big, "+000123456789012345678901234567890") -testboth("%+34d", big, " +123456789012345678901234567890") -testboth("%34d", big, " 123456789012345678901234567890") -testboth("%.2d", big, "123456789012345678901234567890") -testboth("%.30d", big, "123456789012345678901234567890") -testboth("%.31d", big, "0123456789012345678901234567890") -testboth("%32.31d", big, " 0123456789012345678901234567890") - -big = 0x1234567890abcdef12345L # 21 hex digits -testboth("%x", big, "1234567890abcdef12345") -testboth("%x", -big, "-1234567890abcdef12345") -testboth("%5x", -big, "-1234567890abcdef12345") -testboth("%22x", -big, "-1234567890abcdef12345") -testboth("%23x", -big, " -1234567890abcdef12345") -testboth("%-23x", -big, "-1234567890abcdef12345 ") -testboth("%023x", -big, "-01234567890abcdef12345") -testboth("%-023x", -big, "-1234567890abcdef12345 ") -testboth("%025x", -big, "-0001234567890abcdef12345") -testboth("%025x", big, "00001234567890abcdef12345") -testboth("%0+25x", big, "+0001234567890abcdef12345") -testboth("%+25x", big, " +1234567890abcdef12345") -testboth("%25x", big, " 1234567890abcdef12345") -testboth("%.2x", big, "1234567890abcdef12345") -testboth("%.21x", big, "1234567890abcdef12345") -testboth("%.22x", big, "01234567890abcdef12345") -testboth("%23.22x", big, " 01234567890abcdef12345") -testboth("%-23.22x", big, "01234567890abcdef12345 ") -testboth("%X", big, "1234567890ABCDEF12345") -testboth("%#X", big, "0X1234567890ABCDEF12345") -testboth("%#x", big, "0x1234567890abcdef12345") -testboth("%#x", -big, "-0x1234567890abcdef12345") -testboth("%#.23x", -big, "-0x001234567890abcdef12345") -testboth("%#+.23x", big, "+0x001234567890abcdef12345") -testboth("%# .23x", big, " 0x001234567890abcdef12345") -testboth("%#+.23X", big, "+0X001234567890ABCDEF12345") -testboth("%#-+.23X", big, "+0X001234567890ABCDEF12345") -testboth("%#-+26.23X", big, "+0X001234567890ABCDEF12345") -testboth("%#-+27.23X", big, "+0X001234567890ABCDEF12345 ") -testboth("%#+27.23X", big, " +0X001234567890ABCDEF12345") -# next one gets two leading zeroes from precision, and another from the -# 0 flag and the width -testboth("%#+027.23X", big, "+0X0001234567890ABCDEF12345") -# same, except no 0 flag -testboth("%#+27.23X", big, " +0X001234567890ABCDEF12345") - -big = 012345670123456701234567012345670L # 32 octal digits -testboth("%o", big, "12345670123456701234567012345670") -testboth("%o", -big, "-12345670123456701234567012345670") -testboth("%5o", -big, "-12345670123456701234567012345670") -testboth("%33o", -big, "-12345670123456701234567012345670") -testboth("%34o", -big, " -12345670123456701234567012345670") -testboth("%-34o", -big, "-12345670123456701234567012345670 ") -testboth("%034o", -big, "-012345670123456701234567012345670") -testboth("%-034o", -big, "-12345670123456701234567012345670 ") -testboth("%036o", -big, "-00012345670123456701234567012345670") -testboth("%036o", big, "000012345670123456701234567012345670") -testboth("%0+36o", big, "+00012345670123456701234567012345670") -testboth("%+36o", big, " +12345670123456701234567012345670") -testboth("%36o", big, " 12345670123456701234567012345670") -testboth("%.2o", big, "12345670123456701234567012345670") -testboth("%.32o", big, "12345670123456701234567012345670") -testboth("%.33o", big, "012345670123456701234567012345670") -testboth("%34.33o", big, " 012345670123456701234567012345670") -testboth("%-34.33o", big, "012345670123456701234567012345670 ") -testboth("%o", big, "12345670123456701234567012345670") -testboth("%#o", big, "012345670123456701234567012345670") -testboth("%#o", -big, "-012345670123456701234567012345670") -testboth("%#.34o", -big, "-0012345670123456701234567012345670") -testboth("%#+.34o", big, "+0012345670123456701234567012345670") -testboth("%# .34o", big, " 0012345670123456701234567012345670") -testboth("%#+.34o", big, "+0012345670123456701234567012345670") -testboth("%#-+.34o", big, "+0012345670123456701234567012345670") -testboth("%#-+37.34o", big, "+0012345670123456701234567012345670 ") -testboth("%#+37.34o", big, " +0012345670123456701234567012345670") -# next one gets one leading zero from precision -testboth("%.33o", big, "012345670123456701234567012345670") -# base marker shouldn't change that, since "0" is redundant -testboth("%#.33o", big, "012345670123456701234567012345670") -# but reduce precision, and base marker should add a zero -testboth("%#.32o", big, "012345670123456701234567012345670") -# one leading zero from precision, and another from "0" flag & width -testboth("%034.33o", big, "0012345670123456701234567012345670") -# base marker shouldn't change that -testboth("%0#34.33o", big, "0012345670123456701234567012345670") - -# Some small ints, in both Python int and long flavors). -testboth("%d", 42, "42") -testboth("%d", -42, "-42") -testboth("%d", 42L, "42") -testboth("%d", -42L, "-42") -testboth("%#x", 1, "0x1") -testboth("%#x", 1L, "0x1") -testboth("%#X", 1, "0X1") -testboth("%#X", 1L, "0X1") -testboth("%#o", 1, "01") -testboth("%#o", 1L, "01") -testboth("%#o", 0, "0") -testboth("%#o", 0L, "0") -testboth("%o", 0, "0") -testboth("%o", 0L, "0") -testboth("%d", 0, "0") -testboth("%d", 0L, "0") -testboth("%#x", 0, "0x0") -testboth("%#x", 0L, "0x0") -testboth("%#X", 0, "0X0") -testboth("%#X", 0L, "0X0") - -testboth("%x", 0x42, "42") -testboth("%x", -0x42, "-42") -testboth("%x", 0x42L, "42") -testboth("%x", -0x42L, "-42") - -testboth("%o", 042, "42") -testboth("%o", -042, "-42") -testboth("%o", 042L, "42") -testboth("%o", -042L, "-42") - -# Test exception for unknown format characters -if verbose: - print 'Testing exceptions' - -def test_exc(formatstr, args, exception, excmsg): - try: - testformat(formatstr, args) - except exception, exc: - if str(exc) == excmsg: - if verbose: - print "yes" - else: - if verbose: print 'no' - print 'Unexpected ', exception, ':', repr(str(exc)) - except: - if verbose: print 'no' - print 'Unexpected exception' - raise - else: - raise TestFailed, 'did not get expected exception: %s' % excmsg - -test_exc('abc %a', 1, ValueError, - "unsupported format character 'a' (0x61) at index 5") -if have_unicode: - test_exc(unicode('abc %\u3000','raw-unicode-escape'), 1, ValueError, - "unsupported format character '?' (0x3000) at index 5") - -test_exc('%d', '1', TypeError, "int argument required") -test_exc('%g', '1', TypeError, "float argument required") -test_exc('no format', '1', TypeError, - "not all arguments converted during string formatting") -test_exc('no format', u'1', TypeError, - "not all arguments converted during string formatting") -test_exc(u'no format', '1', TypeError, - "not all arguments converted during string formatting") -test_exc(u'no format', u'1', TypeError, - "not all arguments converted during string formatting") - -class Foobar(long): - def __oct__(self): - # Returning a non-string should not blow up. - return self + 1 - -test_exc('%o', Foobar(), TypeError, - "expected string or Unicode object, long found") - -if sys.maxint == 2**31-1: - # crashes 2.2.1 and earlier: - try: - "%*d"%(sys.maxint, -127) - except MemoryError: - pass - else: - raise TestFailed, '"%*d"%(sys.maxint, -127) should fail' diff --git a/sys/lib/python/test/test_fpformat.py b/sys/lib/python/test/test_fpformat.py deleted file mode 100644 index a1b872262..000000000 --- a/sys/lib/python/test/test_fpformat.py +++ /dev/null @@ -1,75 +0,0 @@ -''' - Tests for fpformat module - Nick Mathewson -''' -from test.test_support import run_unittest -import unittest -from fpformat import fix, sci, NotANumber - -StringType = type('') - -# Test the old and obsolescent fpformat module. -# -# (It's obsolescent because fix(n,d) == "%.*f"%(d,n) and -# sci(n,d) == "%.*e"%(d,n) -# for all reasonable numeric n and d, except that sci gives 3 exponent -# digits instead of 2. -# -# Differences only occur for unreasonable n and d. <.2 wink>) - -class FpformatTest(unittest.TestCase): - - def checkFix(self, n, digits): - result = fix(n, digits) - if isinstance(n, StringType): - n = repr(n) - expected = "%.*f" % (digits, float(n)) - - self.assertEquals(result, expected) - - def checkSci(self, n, digits): - result = sci(n, digits) - if isinstance(n, StringType): - n = repr(n) - expected = "%.*e" % (digits, float(n)) - # add the extra 0 if needed - num, exp = expected.split("e") - if len(exp) < 4: - exp = exp[0] + "0" + exp[1:] - expected = "%se%s" % (num, exp) - - self.assertEquals(result, expected) - - def test_basic_cases(self): - self.assertEquals(fix(100.0/3, 3), '33.333') - self.assertEquals(sci(100.0/3, 3), '3.333e+001') - - def test_reasonable_values(self): - for d in range(7): - for val in (1000.0/3, 1000, 1000.0, .002, 1.0/3, 1e10): - for realVal in (val, 1.0/val, -val, -1.0/val): - self.checkFix(realVal, d) - self.checkSci(realVal, d) - - def test_failing_values(self): - # Now for 'unreasonable n and d' - self.assertEquals(fix(1.0, 1000), '1.'+('0'*1000)) - self.assertEquals(sci("1"+('0'*1000), 0), '1e+1000') - - # This behavior is inconsistent. sci raises an exception; fix doesn't. - yacht = "Throatwobbler Mangrove" - self.assertEquals(fix(yacht, 10), yacht) - try: - sci(yacht, 10) - except NotANumber: - pass - else: - self.fail("No exception on non-numeric sci") - - -def test_main(): - run_unittest(FpformatTest) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_frozen.py b/sys/lib/python/test/test_frozen.py deleted file mode 100644 index 8b121d38d..000000000 --- a/sys/lib/python/test/test_frozen.py +++ /dev/null @@ -1,27 +0,0 @@ -# Test the frozen module defined in frozen.c. - -from test.test_support import TestFailed -import sys, os - -try: - import __hello__ -except ImportError, x: - raise TestFailed, "import __hello__ failed:" + str(x) - -try: - import __phello__ -except ImportError, x: - raise TestFailed, "import __phello__ failed:" + str(x) - -try: - import __phello__.spam -except ImportError, x: - raise TestFailed, "import __phello__.spam failed:" + str(x) - -if sys.platform != "mac": # On the Mac this import does succeed. - try: - import __phello__.foo - except ImportError: - pass - else: - raise TestFailed, "import __phello__.foo should have failed" diff --git a/sys/lib/python/test/test_funcattrs.py b/sys/lib/python/test/test_funcattrs.py deleted file mode 100644 index 7a083b70d..000000000 --- a/sys/lib/python/test/test_funcattrs.py +++ /dev/null @@ -1,402 +0,0 @@ -from test.test_support import verbose, TestFailed, verify -import types - -class F: - def a(self): - pass - -def b(): - 'my docstring' - pass - -# __module__ is a special attribute -verify(b.__module__ == __name__) -verify(verify.__module__ == "test.test_support") - -# setting attributes on functions -try: - b.publish -except AttributeError: pass -else: raise TestFailed, 'expected AttributeError' - -if b.__dict__ <> {}: - raise TestFailed, 'expected unassigned func.__dict__ to be {}' - -b.publish = 1 -if b.publish <> 1: - raise TestFailed, 'function attribute not set to expected value' - -docstring = 'its docstring' -b.__doc__ = docstring -if b.__doc__ <> docstring: - raise TestFailed, 'problem with setting __doc__ attribute' - -if 'publish' not in dir(b): - raise TestFailed, 'attribute not in dir()' - -try: - del b.__dict__ -except TypeError: pass -else: raise TestFailed, 'del func.__dict__ expected TypeError' - -b.publish = 1 -try: - b.__dict__ = None -except TypeError: pass -else: raise TestFailed, 'func.__dict__ = None expected TypeError' - -d = {'hello': 'world'} -b.__dict__ = d -if b.func_dict is not d: - raise TestFailed, 'func.__dict__ assignment to dictionary failed' -if b.hello <> 'world': - raise TestFailed, 'attribute after func.__dict__ assignment failed' - -f1 = F() -f2 = F() - -try: - F.a.publish -except AttributeError: pass -else: raise TestFailed, 'expected AttributeError' - -try: - f1.a.publish -except AttributeError: pass -else: raise TestFailed, 'expected AttributeError' - -# In Python 2.1 beta 1, we disallowed setting attributes on unbound methods -# (it was already disallowed on bound methods). See the PEP for details. -try: - F.a.publish = 1 -except (AttributeError, TypeError): pass -else: raise TestFailed, 'expected AttributeError or TypeError' - -# But setting it explicitly on the underlying function object is okay. -F.a.im_func.publish = 1 - -if F.a.publish <> 1: - raise TestFailed, 'unbound method attribute not set to expected value' - -if f1.a.publish <> 1: - raise TestFailed, 'bound method attribute access did not work' - -if f2.a.publish <> 1: - raise TestFailed, 'bound method attribute access did not work' - -if 'publish' not in dir(F.a): - raise TestFailed, 'attribute not in dir()' - -try: - f1.a.publish = 0 -except (AttributeError, TypeError): pass -else: raise TestFailed, 'expected AttributeError or TypeError' - -# See the comment above about the change in semantics for Python 2.1b1 -try: - F.a.myclass = F -except (AttributeError, TypeError): pass -else: raise TestFailed, 'expected AttributeError or TypeError' - -F.a.im_func.myclass = F - -f1.a.myclass -f2.a.myclass -f1.a.myclass -F.a.myclass - -if f1.a.myclass is not f2.a.myclass or \ - f1.a.myclass is not F.a.myclass: - raise TestFailed, 'attributes were not the same' - -# try setting __dict__ -try: - F.a.__dict__ = (1, 2, 3) -except (AttributeError, TypeError): pass -else: raise TestFailed, 'expected TypeError or AttributeError' - -F.a.im_func.__dict__ = {'one': 11, 'two': 22, 'three': 33} - -if f1.a.two <> 22: - raise TestFailed, 'setting __dict__' - -from UserDict import UserDict -d = UserDict({'four': 44, 'five': 55}) - -try: - F.a.__dict__ = d -except (AttributeError, TypeError): pass -else: raise TestFailed - -if f2.a.one <> f1.a.one <> F.a.one <> 11: - raise TestFailed - -# im_func may not be a Python method! -import new -F.id = new.instancemethod(id, None, F) - -eff = F() -if eff.id() <> id(eff): - raise TestFailed - -try: - F.id.foo -except AttributeError: pass -else: raise TestFailed - -try: - F.id.foo = 12 -except (AttributeError, TypeError): pass -else: raise TestFailed - -try: - F.id.foo -except AttributeError: pass -else: raise TestFailed - -try: - eff.id.foo -except AttributeError: pass -else: raise TestFailed - -try: - eff.id.foo = 12 -except (AttributeError, TypeError): pass -else: raise TestFailed - -try: - eff.id.foo -except AttributeError: pass -else: raise TestFailed - -# Regression test for a crash in pre-2.1a1 -def another(): - pass - -try: - del another.__dict__ -except TypeError: pass -else: raise TestFailed - -try: - del another.func_dict -except TypeError: pass -else: raise TestFailed - -try: - another.func_dict = None -except TypeError: pass -else: raise TestFailed - -try: - del another.bar -except AttributeError: pass -else: raise TestFailed - -# This isn't specifically related to function attributes, but it does test a -# core dump regression in funcobject.c -del another.func_defaults - -def foo(): - pass - -def bar(): - pass - -def temp(): - print 1 - -if foo==bar: - raise TestFailed - -d={} -d[foo] = 1 - -foo.func_code = temp.func_code - -d[foo] - -# Test all predefined function attributes systematically - -def cantset(obj, name, value, exception=(AttributeError, TypeError)): - verify(hasattr(obj, name)) # Otherwise it's probably a typo - try: - setattr(obj, name, value) - except exception: - pass - else: - raise TestFailed, "shouldn't be able to set %s to %r" % (name, value) - try: - delattr(obj, name) - except (AttributeError, TypeError): - pass - else: - raise TestFailed, "shouldn't be able to del %s" % name - -def test_func_closure(): - a = 12 - def f(): print a - c = f.func_closure - verify(isinstance(c, tuple)) - verify(len(c) == 1) - verify(c[0].__class__.__name__ == "cell") # don't have a type object handy - cantset(f, "func_closure", c) - -def test_func_doc(): - def f(): pass - verify(f.__doc__ is None) - verify(f.func_doc is None) - f.__doc__ = "hello" - verify(f.__doc__ == "hello") - verify(f.func_doc == "hello") - del f.__doc__ - verify(f.__doc__ is None) - verify(f.func_doc is None) - f.func_doc = "world" - verify(f.__doc__ == "world") - verify(f.func_doc == "world") - del f.func_doc - verify(f.func_doc is None) - verify(f.__doc__ is None) - -def test_func_globals(): - def f(): pass - verify(f.func_globals is globals()) - cantset(f, "func_globals", globals()) - -def test_func_name(): - def f(): pass - verify(f.__name__ == "f") - verify(f.func_name == "f") - f.__name__ = "g" - verify(f.__name__ == "g") - verify(f.func_name == "g") - f.func_name = "h" - verify(f.__name__ == "h") - verify(f.func_name == "h") - cantset(f, "func_globals", 1) - cantset(f, "__name__", 1) - # test that you can access func.__name__ in restricted mode - s = """def f(): pass\nf.__name__""" - exec s in {'__builtins__':{}} - - -def test_func_code(): - a = b = 24 - def f(): pass - def g(): print 12 - def f1(): print a - def g1(): print b - def f2(): print a, b - verify(type(f.func_code) is types.CodeType) - f.func_code = g.func_code - cantset(f, "func_code", None) - # can't change the number of free vars - cantset(f, "func_code", f1.func_code, exception=ValueError) - cantset(f1, "func_code", f.func_code, exception=ValueError) - cantset(f1, "func_code", f2.func_code, exception=ValueError) - f1.func_code = g1.func_code - -def test_func_defaults(): - def f(a, b): return (a, b) - verify(f.func_defaults is None) - f.func_defaults = (1, 2) - verify(f.func_defaults == (1, 2)) - verify(f(10) == (10, 2)) - def g(a=1, b=2): return (a, b) - verify(g.func_defaults == (1, 2)) - del g.func_defaults - verify(g.func_defaults is None) - try: - g() - except TypeError: - pass - else: - raise TestFailed, "shouldn't be allowed to call g() w/o defaults" - -def test_func_dict(): - def f(): pass - a = f.__dict__ - b = f.func_dict - verify(a == {}) - verify(a is b) - f.hello = 'world' - verify(a == {'hello': 'world'}) - verify(f.func_dict is a is f.__dict__) - f.func_dict = {} - verify(not hasattr(f, "hello")) - f.__dict__ = {'world': 'hello'} - verify(f.world == "hello") - verify(f.__dict__ is f.func_dict == {'world': 'hello'}) - cantset(f, "func_dict", None) - cantset(f, "__dict__", None) - -def test_im_class(): - class C: - def foo(self): pass - verify(C.foo.im_class is C) - verify(C().foo.im_class is C) - cantset(C.foo, "im_class", C) - cantset(C().foo, "im_class", C) - -def test_im_func(): - def foo(self): pass - class C: - pass - C.foo = foo - verify(C.foo.im_func is foo) - verify(C().foo.im_func is foo) - cantset(C.foo, "im_func", foo) - cantset(C().foo, "im_func", foo) - -def test_im_self(): - class C: - def foo(self): pass - verify(C.foo.im_self is None) - c = C() - verify(c.foo.im_self is c) - cantset(C.foo, "im_self", None) - cantset(c.foo, "im_self", c) - -def test_im_dict(): - class C: - def foo(self): pass - foo.bar = 42 - verify(C.foo.__dict__ == {'bar': 42}) - verify(C().foo.__dict__ == {'bar': 42}) - cantset(C.foo, "__dict__", C.foo.__dict__) - cantset(C().foo, "__dict__", C.foo.__dict__) - -def test_im_doc(): - class C: - def foo(self): "hello" - verify(C.foo.__doc__ == "hello") - verify(C().foo.__doc__ == "hello") - cantset(C.foo, "__doc__", "hello") - cantset(C().foo, "__doc__", "hello") - -def test_im_name(): - class C: - def foo(self): pass - verify(C.foo.__name__ == "foo") - verify(C().foo.__name__ == "foo") - cantset(C.foo, "__name__", "foo") - cantset(C().foo, "__name__", "foo") - -def testmore(): - test_func_closure() - test_func_doc() - test_func_globals() - test_func_name() - test_func_code() - test_func_defaults() - test_func_dict() - # Tests for instance method attributes - test_im_class() - test_im_func() - test_im_self() - test_im_dict() - test_im_doc() - test_im_name() - -testmore() diff --git a/sys/lib/python/test/test_functools.py b/sys/lib/python/test/test_functools.py deleted file mode 100644 index 6012f9f85..000000000 --- a/sys/lib/python/test/test_functools.py +++ /dev/null @@ -1,293 +0,0 @@ -import functools -import unittest -from test import test_support -from weakref import proxy - -@staticmethod -def PythonPartial(func, *args, **keywords): - 'Pure Python approximation of partial()' - def newfunc(*fargs, **fkeywords): - newkeywords = keywords.copy() - newkeywords.update(fkeywords) - return func(*(args + fargs), **newkeywords) - newfunc.func = func - newfunc.args = args - newfunc.keywords = keywords - return newfunc - -def capture(*args, **kw): - """capture all positional and keyword arguments""" - return args, kw - -class TestPartial(unittest.TestCase): - - thetype = functools.partial - - def test_basic_examples(self): - p = self.thetype(capture, 1, 2, a=10, b=20) - self.assertEqual(p(3, 4, b=30, c=40), - ((1, 2, 3, 4), dict(a=10, b=30, c=40))) - p = self.thetype(map, lambda x: x*10) - self.assertEqual(p([1,2,3,4]), [10, 20, 30, 40]) - - def test_attributes(self): - p = self.thetype(capture, 1, 2, a=10, b=20) - # attributes should be readable - self.assertEqual(p.func, capture) - self.assertEqual(p.args, (1, 2)) - self.assertEqual(p.keywords, dict(a=10, b=20)) - # attributes should not be writable - if not isinstance(self.thetype, type): - return - self.assertRaises(TypeError, setattr, p, 'func', map) - self.assertRaises(TypeError, setattr, p, 'args', (1, 2)) - self.assertRaises(TypeError, setattr, p, 'keywords', dict(a=1, b=2)) - - def test_argument_checking(self): - self.assertRaises(TypeError, self.thetype) # need at least a func arg - try: - self.thetype(2)() - except TypeError: - pass - else: - self.fail('First arg not checked for callability') - - def test_protection_of_callers_dict_argument(self): - # a caller's dictionary should not be altered by partial - def func(a=10, b=20): - return a - d = {'a':3} - p = self.thetype(func, a=5) - self.assertEqual(p(**d), 3) - self.assertEqual(d, {'a':3}) - p(b=7) - self.assertEqual(d, {'a':3}) - - def test_arg_combinations(self): - # exercise special code paths for zero args in either partial - # object or the caller - p = self.thetype(capture) - self.assertEqual(p(), ((), {})) - self.assertEqual(p(1,2), ((1,2), {})) - p = self.thetype(capture, 1, 2) - self.assertEqual(p(), ((1,2), {})) - self.assertEqual(p(3,4), ((1,2,3,4), {})) - - def test_kw_combinations(self): - # exercise special code paths for no keyword args in - # either the partial object or the caller - p = self.thetype(capture) - self.assertEqual(p(), ((), {})) - self.assertEqual(p(a=1), ((), {'a':1})) - p = self.thetype(capture, a=1) - self.assertEqual(p(), ((), {'a':1})) - self.assertEqual(p(b=2), ((), {'a':1, 'b':2})) - # keyword args in the call override those in the partial object - self.assertEqual(p(a=3, b=2), ((), {'a':3, 'b':2})) - - def test_positional(self): - # make sure positional arguments are captured correctly - for args in [(), (0,), (0,1), (0,1,2), (0,1,2,3)]: - p = self.thetype(capture, *args) - expected = args + ('x',) - got, empty = p('x') - self.failUnless(expected == got and empty == {}) - - def test_keyword(self): - # make sure keyword arguments are captured correctly - for a in ['a', 0, None, 3.5]: - p = self.thetype(capture, a=a) - expected = {'a':a,'x':None} - empty, got = p(x=None) - self.failUnless(expected == got and empty == ()) - - def test_no_side_effects(self): - # make sure there are no side effects that affect subsequent calls - p = self.thetype(capture, 0, a=1) - args1, kw1 = p(1, b=2) - self.failUnless(args1 == (0,1) and kw1 == {'a':1,'b':2}) - args2, kw2 = p() - self.failUnless(args2 == (0,) and kw2 == {'a':1}) - - def test_error_propagation(self): - def f(x, y): - x / y - self.assertRaises(ZeroDivisionError, self.thetype(f, 1, 0)) - self.assertRaises(ZeroDivisionError, self.thetype(f, 1), 0) - self.assertRaises(ZeroDivisionError, self.thetype(f), 1, 0) - self.assertRaises(ZeroDivisionError, self.thetype(f, y=0), 1) - - def test_attributes(self): - p = self.thetype(hex) - try: - del p.__dict__ - except TypeError: - pass - else: - self.fail('partial object allowed __dict__ to be deleted') - - def test_weakref(self): - f = self.thetype(int, base=16) - p = proxy(f) - self.assertEqual(f.func, p.func) - f = None - self.assertRaises(ReferenceError, getattr, p, 'func') - - def test_with_bound_and_unbound_methods(self): - data = map(str, range(10)) - join = self.thetype(str.join, '') - self.assertEqual(join(data), '0123456789') - join = self.thetype(''.join) - self.assertEqual(join(data), '0123456789') - -class PartialSubclass(functools.partial): - pass - -class TestPartialSubclass(TestPartial): - - thetype = PartialSubclass - - -class TestPythonPartial(TestPartial): - - thetype = PythonPartial - -class TestUpdateWrapper(unittest.TestCase): - - def check_wrapper(self, wrapper, wrapped, - assigned=functools.WRAPPER_ASSIGNMENTS, - updated=functools.WRAPPER_UPDATES): - # Check attributes were assigned - for name in assigned: - self.failUnless(getattr(wrapper, name) is getattr(wrapped, name)) - # Check attributes were updated - for name in updated: - wrapper_attr = getattr(wrapper, name) - wrapped_attr = getattr(wrapped, name) - for key in wrapped_attr: - self.failUnless(wrapped_attr[key] is wrapper_attr[key]) - - def test_default_update(self): - def f(): - """This is a test""" - pass - f.attr = 'This is also a test' - def wrapper(): - pass - functools.update_wrapper(wrapper, f) - self.check_wrapper(wrapper, f) - self.assertEqual(wrapper.__name__, 'f') - self.assertEqual(wrapper.__doc__, 'This is a test') - self.assertEqual(wrapper.attr, 'This is also a test') - - def test_no_update(self): - def f(): - """This is a test""" - pass - f.attr = 'This is also a test' - def wrapper(): - pass - functools.update_wrapper(wrapper, f, (), ()) - self.check_wrapper(wrapper, f, (), ()) - self.assertEqual(wrapper.__name__, 'wrapper') - self.assertEqual(wrapper.__doc__, None) - self.failIf(hasattr(wrapper, 'attr')) - - def test_selective_update(self): - def f(): - pass - f.attr = 'This is a different test' - f.dict_attr = dict(a=1, b=2, c=3) - def wrapper(): - pass - wrapper.dict_attr = {} - assign = ('attr',) - update = ('dict_attr',) - functools.update_wrapper(wrapper, f, assign, update) - self.check_wrapper(wrapper, f, assign, update) - self.assertEqual(wrapper.__name__, 'wrapper') - self.assertEqual(wrapper.__doc__, None) - self.assertEqual(wrapper.attr, 'This is a different test') - self.assertEqual(wrapper.dict_attr, f.dict_attr) - - def test_builtin_update(self): - # Test for bug #1576241 - def wrapper(): - pass - functools.update_wrapper(wrapper, max) - self.assertEqual(wrapper.__name__, 'max') - self.assert_(wrapper.__doc__.startswith('max(')) - -class TestWraps(TestUpdateWrapper): - - def test_default_update(self): - def f(): - """This is a test""" - pass - f.attr = 'This is also a test' - @functools.wraps(f) - def wrapper(): - pass - self.check_wrapper(wrapper, f) - self.assertEqual(wrapper.__name__, 'f') - self.assertEqual(wrapper.__doc__, 'This is a test') - self.assertEqual(wrapper.attr, 'This is also a test') - - def test_no_update(self): - def f(): - """This is a test""" - pass - f.attr = 'This is also a test' - @functools.wraps(f, (), ()) - def wrapper(): - pass - self.check_wrapper(wrapper, f, (), ()) - self.assertEqual(wrapper.__name__, 'wrapper') - self.assertEqual(wrapper.__doc__, None) - self.failIf(hasattr(wrapper, 'attr')) - - def test_selective_update(self): - def f(): - pass - f.attr = 'This is a different test' - f.dict_attr = dict(a=1, b=2, c=3) - def add_dict_attr(f): - f.dict_attr = {} - return f - assign = ('attr',) - update = ('dict_attr',) - @functools.wraps(f, assign, update) - @add_dict_attr - def wrapper(): - pass - self.check_wrapper(wrapper, f, assign, update) - self.assertEqual(wrapper.__name__, 'wrapper') - self.assertEqual(wrapper.__doc__, None) - self.assertEqual(wrapper.attr, 'This is a different test') - self.assertEqual(wrapper.dict_attr, f.dict_attr) - - - -def test_main(verbose=None): - import sys - test_classes = ( - TestPartial, - TestPartialSubclass, - TestPythonPartial, - TestUpdateWrapper, - TestWraps - ) - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == '__main__': - test_main(verbose=True) diff --git a/sys/lib/python/test/test_future.py b/sys/lib/python/test/test_future.py deleted file mode 100644 index f67c69211..000000000 --- a/sys/lib/python/test/test_future.py +++ /dev/null @@ -1,106 +0,0 @@ -# Test various flavors of legal and illegal future statements - -import unittest -from test import test_support -import re - -rx = re.compile('\((\S+).py, line (\d+)') - -def get_error_location(msg): - mo = rx.search(str(msg)) - return mo.group(1, 2) - -class FutureTest(unittest.TestCase): - - def test_future1(self): - test_support.unload('test_future1') - from test import test_future1 - self.assertEqual(test_future1.result, 6) - - def test_future2(self): - test_support.unload('test_future2') - from test import test_future2 - self.assertEqual(test_future2.result, 6) - - def test_future3(self): - test_support.unload('test_future3') - from test import test_future3 - - def test_badfuture3(self): - try: - from test import badsyntax_future3 - except SyntaxError, msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future3", '3')) - else: - self.fail("expected exception didn't occur") - - def test_badfuture4(self): - try: - from test import badsyntax_future4 - except SyntaxError, msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future4", '3')) - else: - self.fail("expected exception didn't occur") - - def test_badfuture5(self): - try: - from test import badsyntax_future5 - except SyntaxError, msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future5", '4')) - else: - self.fail("expected exception didn't occur") - - def test_badfuture6(self): - try: - from test import badsyntax_future6 - except SyntaxError, msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future6", '3')) - else: - self.fail("expected exception didn't occur") - - def test_badfuture7(self): - try: - from test import badsyntax_future7 - except SyntaxError, msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future7", '3')) - else: - self.fail("expected exception didn't occur") - - def test_badfuture8(self): - try: - from test import badsyntax_future8 - except SyntaxError, msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future8", '3')) - else: - self.fail("expected exception didn't occur") - - def test_badfuture9(self): - try: - from test import badsyntax_future9 - except SyntaxError, msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future9", '3')) - else: - self.fail("expected exception didn't occur") - - def test_parserhack(self): - # test that the parser.c::future_hack function works as expected - try: - exec "from __future__ import division, with_statement; with = 0" - except SyntaxError: - pass - else: - self.fail("syntax error didn't occur") - - try: - exec "from __future__ import (with_statement, division); with = 0" - except SyntaxError: - pass - else: - self.fail("syntax error didn't occur") - - -def test_main(): - test_support.run_unittest(FutureTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_future1.py b/sys/lib/python/test/test_future1.py deleted file mode 100644 index 297c2e087..000000000 --- a/sys/lib/python/test/test_future1.py +++ /dev/null @@ -1,11 +0,0 @@ -"""This is a test""" - -# Import the name nested_scopes twice to trigger SF bug #407394 (regression). -from __future__ import nested_scopes, nested_scopes - -def f(x): - def g(y): - return x + y - return g - -result = f(2)(4) diff --git a/sys/lib/python/test/test_future2.py b/sys/lib/python/test/test_future2.py deleted file mode 100644 index 79eb73179..000000000 --- a/sys/lib/python/test/test_future2.py +++ /dev/null @@ -1,10 +0,0 @@ -"""This is a test""" - -from __future__ import nested_scopes; import string - -def f(x): - def g(y): - return x + y - return g - -result = f(2)(4) diff --git a/sys/lib/python/test/test_future3.py b/sys/lib/python/test/test_future3.py deleted file mode 100644 index ed23567a7..000000000 --- a/sys/lib/python/test/test_future3.py +++ /dev/null @@ -1,30 +0,0 @@ -from __future__ import nested_scopes -from __future__ import division - -import unittest -from test import test_support - -x = 2 -def nester(): - x = 3 - def inner(): - return x - return inner() - - -class TestFuture(unittest.TestCase): - - def test_floor_div_operator(self): - self.assertEqual(7 // 2, 3) - - def test_true_div_as_default(self): - self.assertAlmostEqual(7 / 2, 3.5) - - def test_nested_scopes(self): - self.assertEqual(nester(), 3) - -def test_main(): - test_support.run_unittest(TestFuture) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_gc.py b/sys/lib/python/test/test_gc.py deleted file mode 100644 index ec470c40c..000000000 --- a/sys/lib/python/test/test_gc.py +++ /dev/null @@ -1,636 +0,0 @@ -from test.test_support import verify, verbose, TestFailed, vereq -import sys -import gc -import weakref - -def expect(actual, expected, name): - if actual != expected: - raise TestFailed, "test_%s: actual %r, expected %r" % ( - name, actual, expected) - -def expect_nonzero(actual, name): - if actual == 0: - raise TestFailed, "test_%s: unexpected zero" % name - -def run_test(name, thunk): - if verbose: - print "testing %s..." % name, - thunk() - if verbose: - print "ok" - -def test_list(): - l = [] - l.append(l) - gc.collect() - del l - expect(gc.collect(), 1, "list") - -def test_dict(): - d = {} - d[1] = d - gc.collect() - del d - expect(gc.collect(), 1, "dict") - -def test_tuple(): - # since tuples are immutable we close the loop with a list - l = [] - t = (l,) - l.append(t) - gc.collect() - del t - del l - expect(gc.collect(), 2, "tuple") - -def test_class(): - class A: - pass - A.a = A - gc.collect() - del A - expect_nonzero(gc.collect(), "class") - -def test_newstyleclass(): - class A(object): - pass - gc.collect() - del A - expect_nonzero(gc.collect(), "staticclass") - -def test_instance(): - class A: - pass - a = A() - a.a = a - gc.collect() - del a - expect_nonzero(gc.collect(), "instance") - -def test_newinstance(): - class A(object): - pass - a = A() - a.a = a - gc.collect() - del a - expect_nonzero(gc.collect(), "newinstance") - class B(list): - pass - class C(B, A): - pass - a = C() - a.a = a - gc.collect() - del a - expect_nonzero(gc.collect(), "newinstance(2)") - del B, C - expect_nonzero(gc.collect(), "newinstance(3)") - A.a = A() - del A - expect_nonzero(gc.collect(), "newinstance(4)") - expect(gc.collect(), 0, "newinstance(5)") - -def test_method(): - # Tricky: self.__init__ is a bound method, it references the instance. - class A: - def __init__(self): - self.init = self.__init__ - a = A() - gc.collect() - del a - expect_nonzero(gc.collect(), "method") - -def test_finalizer(): - # A() is uncollectable if it is part of a cycle, make sure it shows up - # in gc.garbage. - class A: - def __del__(self): pass - class B: - pass - a = A() - a.a = a - id_a = id(a) - b = B() - b.b = b - gc.collect() - del a - del b - expect_nonzero(gc.collect(), "finalizer") - for obj in gc.garbage: - if id(obj) == id_a: - del obj.a - break - else: - raise TestFailed, "didn't find obj in garbage (finalizer)" - gc.garbage.remove(obj) - -def test_finalizer_newclass(): - # A() is uncollectable if it is part of a cycle, make sure it shows up - # in gc.garbage. - class A(object): - def __del__(self): pass - class B(object): - pass - a = A() - a.a = a - id_a = id(a) - b = B() - b.b = b - gc.collect() - del a - del b - expect_nonzero(gc.collect(), "finalizer") - for obj in gc.garbage: - if id(obj) == id_a: - del obj.a - break - else: - raise TestFailed, "didn't find obj in garbage (finalizer)" - gc.garbage.remove(obj) - -def test_function(): - # Tricky: f -> d -> f, code should call d.clear() after the exec to - # break the cycle. - d = {} - exec("def f(): pass\n") in d - gc.collect() - del d - expect(gc.collect(), 2, "function") - -def test_frame(): - def f(): - frame = sys._getframe() - gc.collect() - f() - expect(gc.collect(), 1, "frame") - - -def test_saveall(): - # Verify that cyclic garbage like lists show up in gc.garbage if the - # SAVEALL option is enabled. - - # First make sure we don't save away other stuff that just happens to - # be waiting for collection. - gc.collect() - vereq(gc.garbage, []) # if this fails, someone else created immortal trash - - L = [] - L.append(L) - id_L = id(L) - - debug = gc.get_debug() - gc.set_debug(debug | gc.DEBUG_SAVEALL) - del L - gc.collect() - gc.set_debug(debug) - - vereq(len(gc.garbage), 1) - obj = gc.garbage.pop() - vereq(id(obj), id_L) - -def test_del(): - # __del__ methods can trigger collection, make this to happen - thresholds = gc.get_threshold() - gc.enable() - gc.set_threshold(1) - - class A: - def __del__(self): - dir(self) - a = A() - del a - - gc.disable() - gc.set_threshold(*thresholds) - -def test_del_newclass(): - # __del__ methods can trigger collection, make this to happen - thresholds = gc.get_threshold() - gc.enable() - gc.set_threshold(1) - - class A(object): - def __del__(self): - dir(self) - a = A() - del a - - gc.disable() - gc.set_threshold(*thresholds) - -def test_get_count(): - gc.collect() - expect(gc.get_count(), (0, 0, 0), "get_count()") - a = dict() - expect(gc.get_count(), (1, 0, 0), "get_count()") - -def test_collect_generations(): - gc.collect() - a = dict() - gc.collect(0) - expect(gc.get_count(), (0, 1, 0), "collect(0)") - gc.collect(1) - expect(gc.get_count(), (0, 0, 1), "collect(1)") - gc.collect(2) - expect(gc.get_count(), (0, 0, 0), "collect(1)") - -class Ouch: - n = 0 - def __del__(self): - Ouch.n = Ouch.n + 1 - if Ouch.n % 17 == 0: - gc.collect() - -def test_trashcan(): - # "trashcan" is a hack to prevent stack overflow when deallocating - # very deeply nested tuples etc. It works in part by abusing the - # type pointer and refcount fields, and that can yield horrible - # problems when gc tries to traverse the structures. - # If this test fails (as it does in 2.0, 2.1 and 2.2), it will - # most likely die via segfault. - - # Note: In 2.3 the possibility for compiling without cyclic gc was - # removed, and that in turn allows the trashcan mechanism to work - # via much simpler means (e.g., it never abuses the type pointer or - # refcount fields anymore). Since it's much less likely to cause a - # problem now, the various constants in this expensive (we force a lot - # of full collections) test are cut back from the 2.2 version. - gc.enable() - N = 150 - for count in range(2): - t = [] - for i in range(N): - t = [t, Ouch()] - u = [] - for i in range(N): - u = [u, Ouch()] - v = {} - for i in range(N): - v = {1: v, 2: Ouch()} - gc.disable() - -class Boom: - def __getattr__(self, someattribute): - del self.attr - raise AttributeError - -def test_boom(): - a = Boom() - b = Boom() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - # a<->b are in a trash cycle now. Collection will invoke Boom.__getattr__ - # (to see whether a and b have __del__ methods), and __getattr__ deletes - # the internal "attr" attributes as a side effect. That causes the - # trash cycle to get reclaimed via refcounts falling to 0, thus mutating - # the trash graph as a side effect of merely asking whether __del__ - # exists. This used to (before 2.3b1) crash Python. Now __getattr__ - # isn't called. - expect(gc.collect(), 4, "boom") - expect(len(gc.garbage), garbagelen, "boom") - -class Boom2: - def __init__(self): - self.x = 0 - - def __getattr__(self, someattribute): - self.x += 1 - if self.x > 1: - del self.attr - raise AttributeError - -def test_boom2(): - a = Boom2() - b = Boom2() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - # Much like test_boom(), except that __getattr__ doesn't break the - # cycle until the second time gc checks for __del__. As of 2.3b1, - # there isn't a second time, so this simply cleans up the trash cycle. - # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get reclaimed - # this way. - expect(gc.collect(), 4, "boom2") - expect(len(gc.garbage), garbagelen, "boom2") - -# boom__new and boom2_new are exactly like boom and boom2, except use -# new-style classes. - -class Boom_New(object): - def __getattr__(self, someattribute): - del self.attr - raise AttributeError - -def test_boom_new(): - a = Boom_New() - b = Boom_New() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - expect(gc.collect(), 4, "boom_new") - expect(len(gc.garbage), garbagelen, "boom_new") - -class Boom2_New(object): - def __init__(self): - self.x = 0 - - def __getattr__(self, someattribute): - self.x += 1 - if self.x > 1: - del self.attr - raise AttributeError - -def test_boom2_new(): - a = Boom2_New() - b = Boom2_New() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - expect(gc.collect(), 4, "boom2_new") - expect(len(gc.garbage), garbagelen, "boom2_new") - -def test_get_referents(): - alist = [1, 3, 5] - got = gc.get_referents(alist) - got.sort() - expect(got, alist, "get_referents") - - atuple = tuple(alist) - got = gc.get_referents(atuple) - got.sort() - expect(got, alist, "get_referents") - - adict = {1: 3, 5: 7} - expected = [1, 3, 5, 7] - got = gc.get_referents(adict) - got.sort() - expect(got, expected, "get_referents") - - got = gc.get_referents([1, 2], {3: 4}, (0, 0, 0)) - got.sort() - expect(got, [0, 0] + range(5), "get_referents") - - expect(gc.get_referents(1, 'a', 4j), [], "get_referents") - -# Bug 1055820 has several tests of longstanding bugs involving weakrefs and -# cyclic gc. - -# An instance of C1055820 has a self-loop, so becomes cyclic trash when -# unreachable. -class C1055820(object): - def __init__(self, i): - self.i = i - self.loop = self - -class GC_Detector(object): - # Create an instance I. Then gc hasn't happened again so long as - # I.gc_happened is false. - - def __init__(self): - self.gc_happened = False - - def it_happened(ignored): - self.gc_happened = True - - # Create a piece of cyclic trash that triggers it_happened when - # gc collects it. - self.wr = weakref.ref(C1055820(666), it_happened) - -def test_bug1055820b(): - # Corresponds to temp2b.py in the bug report. - - ouch = [] - def callback(ignored): - ouch[:] = [wr() for wr in WRs] - - Cs = [C1055820(i) for i in range(2)] - WRs = [weakref.ref(c, callback) for c in Cs] - c = None - - gc.collect() - expect(len(ouch), 0, "bug1055820b") - # Make the two instances trash, and collect again. The bug was that - # the callback materialized a strong reference to an instance, but gc - # cleared the instance's dict anyway. - Cs = None - gc.collect() - expect(len(ouch), 2, "bug1055820b") # else the callbacks didn't run - for x in ouch: - # If the callback resurrected one of these guys, the instance - # would be damaged, with an empty __dict__. - expect(x, None, "bug1055820b") - -def test_bug1055820c(): - # Corresponds to temp2c.py in the bug report. This is pretty elaborate. - - c0 = C1055820(0) - # Move c0 into generation 2. - gc.collect() - - c1 = C1055820(1) - c1.keep_c0_alive = c0 - del c0.loop # now only c1 keeps c0 alive - - c2 = C1055820(2) - c2wr = weakref.ref(c2) # no callback! - - ouch = [] - def callback(ignored): - ouch[:] = [c2wr()] - - # The callback gets associated with a wr on an object in generation 2. - c0wr = weakref.ref(c0, callback) - - c0 = c1 = c2 = None - - # What we've set up: c0, c1, and c2 are all trash now. c0 is in - # generation 2. The only thing keeping it alive is that c1 points to it. - # c1 and c2 are in generation 0, and are in self-loops. There's a global - # weakref to c2 (c2wr), but that weakref has no callback. There's also - # a global weakref to c0 (c0wr), and that does have a callback, and that - # callback references c2 via c2wr(). - # - # c0 has a wr with callback, which references c2wr - # ^ - # | - # | Generation 2 above dots - #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . - # | Generation 0 below dots - # | - # | - # ^->c1 ^->c2 has a wr but no callback - # | | | | - # <--v <--v - # - # So this is the nightmare: when generation 0 gets collected, we see that - # c2 has a callback-free weakref, and c1 doesn't even have a weakref. - # Collecting generation 0 doesn't see c0 at all, and c0 is the only object - # that has a weakref with a callback. gc clears c1 and c2. Clearing c1 - # has the side effect of dropping the refcount on c0 to 0, so c0 goes - # away (despite that it's in an older generation) and c0's wr callback - # triggers. That in turn materializes a reference to c2 via c2wr(), but - # c2 gets cleared anyway by gc. - - # We want to let gc happen "naturally", to preserve the distinction - # between generations. - junk = [] - i = 0 - detector = GC_Detector() - while not detector.gc_happened: - i += 1 - if i > 10000: - raise TestFailed("gc didn't happen after 10000 iterations") - expect(len(ouch), 0, "bug1055820c") - junk.append([]) # this will eventually trigger gc - - expect(len(ouch), 1, "bug1055820c") # else the callback wasn't invoked - for x in ouch: - # If the callback resurrected c2, the instance would be damaged, - # with an empty __dict__. - expect(x, None, "bug1055820c") - -def test_bug1055820d(): - # Corresponds to temp2d.py in the bug report. This is very much like - # test_bug1055820c, but uses a __del__ method instead of a weakref - # callback to sneak in a resurrection of cyclic trash. - - ouch = [] - class D(C1055820): - def __del__(self): - ouch[:] = [c2wr()] - - d0 = D(0) - # Move all the above into generation 2. - gc.collect() - - c1 = C1055820(1) - c1.keep_d0_alive = d0 - del d0.loop # now only c1 keeps d0 alive - - c2 = C1055820(2) - c2wr = weakref.ref(c2) # no callback! - - d0 = c1 = c2 = None - - # What we've set up: d0, c1, and c2 are all trash now. d0 is in - # generation 2. The only thing keeping it alive is that c1 points to it. - # c1 and c2 are in generation 0, and are in self-loops. There's a global - # weakref to c2 (c2wr), but that weakref has no callback. There are no - # other weakrefs. - # - # d0 has a __del__ method that references c2wr - # ^ - # | - # | Generation 2 above dots - #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . - # | Generation 0 below dots - # | - # | - # ^->c1 ^->c2 has a wr but no callback - # | | | | - # <--v <--v - # - # So this is the nightmare: when generation 0 gets collected, we see that - # c2 has a callback-free weakref, and c1 doesn't even have a weakref. - # Collecting generation 0 doesn't see d0 at all. gc clears c1 and c2. - # Clearing c1 has the side effect of dropping the refcount on d0 to 0, so - # d0 goes away (despite that it's in an older generation) and d0's __del__ - # triggers. That in turn materializes a reference to c2 via c2wr(), but - # c2 gets cleared anyway by gc. - - # We want to let gc happen "naturally", to preserve the distinction - # between generations. - detector = GC_Detector() - junk = [] - i = 0 - while not detector.gc_happened: - i += 1 - if i > 10000: - raise TestFailed("gc didn't happen after 10000 iterations") - expect(len(ouch), 0, "bug1055820d") - junk.append([]) # this will eventually trigger gc - - expect(len(ouch), 1, "bug1055820d") # else __del__ wasn't invoked - for x in ouch: - # If __del__ resurrected c2, the instance would be damaged, with an - # empty __dict__. - expect(x, None, "bug1055820d") - - -def test_all(): - gc.collect() # Delete 2nd generation garbage - run_test("lists", test_list) - run_test("dicts", test_dict) - run_test("tuples", test_tuple) - run_test("classes", test_class) - run_test("new style classes", test_newstyleclass) - run_test("instances", test_instance) - run_test("new instances", test_newinstance) - run_test("methods", test_method) - run_test("functions", test_function) - run_test("frames", test_frame) - run_test("finalizers", test_finalizer) - run_test("finalizers (new class)", test_finalizer_newclass) - run_test("__del__", test_del) - run_test("__del__ (new class)", test_del_newclass) - run_test("get_count()", test_get_count) - run_test("collect(n)", test_collect_generations) - run_test("saveall", test_saveall) - run_test("trashcan", test_trashcan) - run_test("boom", test_boom) - run_test("boom2", test_boom2) - run_test("boom_new", test_boom_new) - run_test("boom2_new", test_boom2_new) - run_test("get_referents", test_get_referents) - run_test("bug1055820b", test_bug1055820b) - - gc.enable() - try: - run_test("bug1055820c", test_bug1055820c) - finally: - gc.disable() - - gc.enable() - try: - run_test("bug1055820d", test_bug1055820d) - finally: - gc.disable() - -def test(): - if verbose: - print "disabling automatic collection" - enabled = gc.isenabled() - gc.disable() - verify(not gc.isenabled()) - debug = gc.get_debug() - gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak - - try: - test_all() - finally: - gc.set_debug(debug) - # test gc.enable() even if GC is disabled by default - if verbose: - print "restoring automatic collection" - # make sure to always test gc.enable() - gc.enable() - verify(gc.isenabled()) - if not enabled: - gc.disable() - - -test() diff --git a/sys/lib/python/test/test_gdbm.py b/sys/lib/python/test/test_gdbm.py deleted file mode 100755 index 8e6f76f17..000000000 --- a/sys/lib/python/test/test_gdbm.py +++ /dev/null @@ -1,46 +0,0 @@ -#! /usr/bin/env python -"""Test script for the gdbm module - Roger E. Masse -""" - -import gdbm -from gdbm import error -from test.test_support import verbose, verify, TestFailed, TESTFN - -filename = TESTFN - -g = gdbm.open(filename, 'c') -verify(g.keys() == []) -g['a'] = 'b' -g['12345678910'] = '019237410982340912840198242' -a = g.keys() -if verbose: - print 'Test gdbm file keys: ', a - -g.has_key('a') -g.close() -try: - g['a'] -except error: - pass -else: - raise TestFailed, "expected gdbm.error accessing closed database" -g = gdbm.open(filename, 'r') -g.close() -g = gdbm.open(filename, 'w') -g.close() -g = gdbm.open(filename, 'n') -g.close() -try: - g = gdbm.open(filename, 'rx') - g.close() -except error: - pass -else: - raise TestFailed, "expected gdbm.error when passing invalid open flags" - -try: - import os - os.unlink(filename) -except: - pass diff --git a/sys/lib/python/test/test_generators.py b/sys/lib/python/test/test_generators.py deleted file mode 100644 index ee36413de..000000000 --- a/sys/lib/python/test/test_generators.py +++ /dev/null @@ -1,1839 +0,0 @@ -tutorial_tests = """ -Let's try a simple generator: - - >>> def f(): - ... yield 1 - ... yield 2 - - >>> for i in f(): - ... print i - 1 - 2 - >>> g = f() - >>> g.next() - 1 - >>> g.next() - 2 - -"Falling off the end" stops the generator: - - >>> g.next() - Traceback (most recent call last): - File "", line 1, in ? - File "", line 2, in g - StopIteration - -"return" also stops the generator: - - >>> def f(): - ... yield 1 - ... return - ... yield 2 # never reached - ... - >>> g = f() - >>> g.next() - 1 - >>> g.next() - Traceback (most recent call last): - File "", line 1, in ? - File "", line 3, in f - StopIteration - >>> g.next() # once stopped, can't be resumed - Traceback (most recent call last): - File "", line 1, in ? - StopIteration - -"raise StopIteration" stops the generator too: - - >>> def f(): - ... yield 1 - ... raise StopIteration - ... yield 2 # never reached - ... - >>> g = f() - >>> g.next() - 1 - >>> g.next() - Traceback (most recent call last): - File "", line 1, in ? - StopIteration - >>> g.next() - Traceback (most recent call last): - File "", line 1, in ? - StopIteration - -However, they are not exactly equivalent: - - >>> def g1(): - ... try: - ... return - ... except: - ... yield 1 - ... - >>> list(g1()) - [] - - >>> def g2(): - ... try: - ... raise StopIteration - ... except: - ... yield 42 - >>> print list(g2()) - [42] - -This may be surprising at first: - - >>> def g3(): - ... try: - ... return - ... finally: - ... yield 1 - ... - >>> list(g3()) - [1] - -Let's create an alternate range() function implemented as a generator: - - >>> def yrange(n): - ... for i in range(n): - ... yield i - ... - >>> list(yrange(5)) - [0, 1, 2, 3, 4] - -Generators always return to the most recent caller: - - >>> def creator(): - ... r = yrange(5) - ... print "creator", r.next() - ... return r - ... - >>> def caller(): - ... r = creator() - ... for i in r: - ... print "caller", i - ... - >>> caller() - creator 0 - caller 1 - caller 2 - caller 3 - caller 4 - -Generators can call other generators: - - >>> def zrange(n): - ... for i in yrange(n): - ... yield i - ... - >>> list(zrange(5)) - [0, 1, 2, 3, 4] - -""" - -# The examples from PEP 255. - -pep_tests = """ - -Specification: Yield - - Restriction: A generator cannot be resumed while it is actively - running: - - >>> def g(): - ... i = me.next() - ... yield i - >>> me = g() - >>> me.next() - Traceback (most recent call last): - ... - File "", line 2, in g - ValueError: generator already executing - -Specification: Return - - Note that return isn't always equivalent to raising StopIteration: the - difference lies in how enclosing try/except constructs are treated. - For example, - - >>> def f1(): - ... try: - ... return - ... except: - ... yield 1 - >>> print list(f1()) - [] - - because, as in any function, return simply exits, but - - >>> def f2(): - ... try: - ... raise StopIteration - ... except: - ... yield 42 - >>> print list(f2()) - [42] - - because StopIteration is captured by a bare "except", as is any - exception. - -Specification: Generators and Exception Propagation - - >>> def f(): - ... return 1//0 - >>> def g(): - ... yield f() # the zero division exception propagates - ... yield 42 # and we'll never get here - >>> k = g() - >>> k.next() - Traceback (most recent call last): - File "", line 1, in ? - File "", line 2, in g - File "", line 2, in f - ZeroDivisionError: integer division or modulo by zero - >>> k.next() # and the generator cannot be resumed - Traceback (most recent call last): - File "", line 1, in ? - StopIteration - >>> - -Specification: Try/Except/Finally - - >>> def f(): - ... try: - ... yield 1 - ... try: - ... yield 2 - ... 1//0 - ... yield 3 # never get here - ... except ZeroDivisionError: - ... yield 4 - ... yield 5 - ... raise - ... except: - ... yield 6 - ... yield 7 # the "raise" above stops this - ... except: - ... yield 8 - ... yield 9 - ... try: - ... x = 12 - ... finally: - ... yield 10 - ... yield 11 - >>> print list(f()) - [1, 2, 4, 5, 8, 9, 10, 11] - >>> - -Guido's binary tree example. - - >>> # A binary tree class. - >>> class Tree: - ... - ... def __init__(self, label, left=None, right=None): - ... self.label = label - ... self.left = left - ... self.right = right - ... - ... def __repr__(self, level=0, indent=" "): - ... s = level*indent + repr(self.label) - ... if self.left: - ... s = s + "\\n" + self.left.__repr__(level+1, indent) - ... if self.right: - ... s = s + "\\n" + self.right.__repr__(level+1, indent) - ... return s - ... - ... def __iter__(self): - ... return inorder(self) - - >>> # Create a Tree from a list. - >>> def tree(list): - ... n = len(list) - ... if n == 0: - ... return [] - ... i = n // 2 - ... return Tree(list[i], tree(list[:i]), tree(list[i+1:])) - - >>> # Show it off: create a tree. - >>> t = tree("ABCDEFGHIJKLMNOPQRSTUVWXYZ") - - >>> # A recursive generator that generates Tree labels in in-order. - >>> def inorder(t): - ... if t: - ... for x in inorder(t.left): - ... yield x - ... yield t.label - ... for x in inorder(t.right): - ... yield x - - >>> # Show it off: create a tree. - >>> t = tree("ABCDEFGHIJKLMNOPQRSTUVWXYZ") - >>> # Print the nodes of the tree in in-order. - >>> for x in t: - ... print x, - A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - - >>> # A non-recursive generator. - >>> def inorder(node): - ... stack = [] - ... while node: - ... while node.left: - ... stack.append(node) - ... node = node.left - ... yield node.label - ... while not node.right: - ... try: - ... node = stack.pop() - ... except IndexError: - ... return - ... yield node.label - ... node = node.right - - >>> # Exercise the non-recursive generator. - >>> for x in t: - ... print x, - A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - -""" - -# Examples from Iterator-List and Python-Dev and c.l.py. - -email_tests = """ - -The difference between yielding None and returning it. - ->>> def g(): -... for i in range(3): -... yield None -... yield None -... return ->>> list(g()) -[None, None, None, None] - -Ensure that explicitly raising StopIteration acts like any other exception -in try/except, not like a return. - ->>> def g(): -... yield 1 -... try: -... raise StopIteration -... except: -... yield 2 -... yield 3 ->>> list(g()) -[1, 2, 3] - -Next one was posted to c.l.py. - ->>> def gcomb(x, k): -... "Generate all combinations of k elements from list x." -... -... if k > len(x): -... return -... if k == 0: -... yield [] -... else: -... first, rest = x[0], x[1:] -... # A combination does or doesn't contain first. -... # If it does, the remainder is a k-1 comb of rest. -... for c in gcomb(rest, k-1): -... c.insert(0, first) -... yield c -... # If it doesn't contain first, it's a k comb of rest. -... for c in gcomb(rest, k): -... yield c - ->>> seq = range(1, 5) ->>> for k in range(len(seq) + 2): -... print "%d-combs of %s:" % (k, seq) -... for c in gcomb(seq, k): -... print " ", c -0-combs of [1, 2, 3, 4]: - [] -1-combs of [1, 2, 3, 4]: - [1] - [2] - [3] - [4] -2-combs of [1, 2, 3, 4]: - [1, 2] - [1, 3] - [1, 4] - [2, 3] - [2, 4] - [3, 4] -3-combs of [1, 2, 3, 4]: - [1, 2, 3] - [1, 2, 4] - [1, 3, 4] - [2, 3, 4] -4-combs of [1, 2, 3, 4]: - [1, 2, 3, 4] -5-combs of [1, 2, 3, 4]: - -From the Iterators list, about the types of these things. - ->>> def g(): -... yield 1 -... ->>> type(g) - ->>> i = g() ->>> type(i) - ->>> [s for s in dir(i) if not s.startswith('_')] -['close', 'gi_frame', 'gi_running', 'next', 'send', 'throw'] ->>> print i.next.__doc__ -x.next() -> the next value, or raise StopIteration ->>> iter(i) is i -True ->>> import types ->>> isinstance(i, types.GeneratorType) -True - -And more, added later. - ->>> i.gi_running -0 ->>> type(i.gi_frame) - ->>> i.gi_running = 42 -Traceback (most recent call last): - ... -TypeError: readonly attribute ->>> def g(): -... yield me.gi_running ->>> me = g() ->>> me.gi_running -0 ->>> me.next() -1 ->>> me.gi_running -0 - -A clever union-find implementation from c.l.py, due to David Eppstein. -Sent: Friday, June 29, 2001 12:16 PM -To: python-list@python.org -Subject: Re: PEP 255: Simple Generators - ->>> class disjointSet: -... def __init__(self, name): -... self.name = name -... self.parent = None -... self.generator = self.generate() -... -... def generate(self): -... while not self.parent: -... yield self -... for x in self.parent.generator: -... yield x -... -... def find(self): -... return self.generator.next() -... -... def union(self, parent): -... if self.parent: -... raise ValueError("Sorry, I'm not a root!") -... self.parent = parent -... -... def __str__(self): -... return self.name - ->>> names = "ABCDEFGHIJKLM" ->>> sets = [disjointSet(name) for name in names] ->>> roots = sets[:] - ->>> import random ->>> gen = random.WichmannHill(42) ->>> while 1: -... for s in sets: -... print "%s->%s" % (s, s.find()), -... print -... if len(roots) > 1: -... s1 = gen.choice(roots) -... roots.remove(s1) -... s2 = gen.choice(roots) -... s1.union(s2) -... print "merged", s1, "into", s2 -... else: -... break -A->A B->B C->C D->D E->E F->F G->G H->H I->I J->J K->K L->L M->M -merged D into G -A->A B->B C->C D->G E->E F->F G->G H->H I->I J->J K->K L->L M->M -merged C into F -A->A B->B C->F D->G E->E F->F G->G H->H I->I J->J K->K L->L M->M -merged L into A -A->A B->B C->F D->G E->E F->F G->G H->H I->I J->J K->K L->A M->M -merged H into E -A->A B->B C->F D->G E->E F->F G->G H->E I->I J->J K->K L->A M->M -merged B into E -A->A B->E C->F D->G E->E F->F G->G H->E I->I J->J K->K L->A M->M -merged J into G -A->A B->E C->F D->G E->E F->F G->G H->E I->I J->G K->K L->A M->M -merged E into G -A->A B->G C->F D->G E->G F->F G->G H->G I->I J->G K->K L->A M->M -merged M into G -A->A B->G C->F D->G E->G F->F G->G H->G I->I J->G K->K L->A M->G -merged I into K -A->A B->G C->F D->G E->G F->F G->G H->G I->K J->G K->K L->A M->G -merged K into A -A->A B->G C->F D->G E->G F->F G->G H->G I->A J->G K->A L->A M->G -merged F into A -A->A B->G C->A D->G E->G F->A G->G H->G I->A J->G K->A L->A M->G -merged A into G -A->G B->G C->G D->G E->G F->G G->G H->G I->G J->G K->G L->G M->G - -""" -# Emacs turd ' - -# Fun tests (for sufficiently warped notions of "fun"). - -fun_tests = """ - -Build up to a recursive Sieve of Eratosthenes generator. - ->>> def firstn(g, n): -... return [g.next() for i in range(n)] - ->>> def intsfrom(i): -... while 1: -... yield i -... i += 1 - ->>> firstn(intsfrom(5), 7) -[5, 6, 7, 8, 9, 10, 11] - ->>> def exclude_multiples(n, ints): -... for i in ints: -... if i % n: -... yield i - ->>> firstn(exclude_multiples(3, intsfrom(1)), 6) -[1, 2, 4, 5, 7, 8] - ->>> def sieve(ints): -... prime = ints.next() -... yield prime -... not_divisible_by_prime = exclude_multiples(prime, ints) -... for p in sieve(not_divisible_by_prime): -... yield p - ->>> primes = sieve(intsfrom(2)) ->>> firstn(primes, 20) -[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71] - - -Another famous problem: generate all integers of the form - 2**i * 3**j * 5**k -in increasing order, where i,j,k >= 0. Trickier than it may look at first! -Try writing it without generators, and correctly, and without generating -3 internal results for each result output. - ->>> def times(n, g): -... for i in g: -... yield n * i ->>> firstn(times(10, intsfrom(1)), 10) -[10, 20, 30, 40, 50, 60, 70, 80, 90, 100] - ->>> def merge(g, h): -... ng = g.next() -... nh = h.next() -... while 1: -... if ng < nh: -... yield ng -... ng = g.next() -... elif ng > nh: -... yield nh -... nh = h.next() -... else: -... yield ng -... ng = g.next() -... nh = h.next() - -The following works, but is doing a whale of a lot of redundant work -- -it's not clear how to get the internal uses of m235 to share a single -generator. Note that me_times2 (etc) each need to see every element in the -result sequence. So this is an example where lazy lists are more natural -(you can look at the head of a lazy list any number of times). - ->>> def m235(): -... yield 1 -... me_times2 = times(2, m235()) -... me_times3 = times(3, m235()) -... me_times5 = times(5, m235()) -... for i in merge(merge(me_times2, -... me_times3), -... me_times5): -... yield i - -Don't print "too many" of these -- the implementation above is extremely -inefficient: each call of m235() leads to 3 recursive calls, and in -turn each of those 3 more, and so on, and so on, until we've descended -enough levels to satisfy the print stmts. Very odd: when I printed 5 -lines of results below, this managed to screw up Win98's malloc in "the -usual" way, i.e. the heap grew over 4Mb so Win98 started fragmenting -address space, and it *looked* like a very slow leak. - ->>> result = m235() ->>> for i in range(3): -... print firstn(result, 15) -[1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24] -[25, 27, 30, 32, 36, 40, 45, 48, 50, 54, 60, 64, 72, 75, 80] -[81, 90, 96, 100, 108, 120, 125, 128, 135, 144, 150, 160, 162, 180, 192] - -Heh. Here's one way to get a shared list, complete with an excruciating -namespace renaming trick. The *pretty* part is that the times() and merge() -functions can be reused as-is, because they only assume their stream -arguments are iterable -- a LazyList is the same as a generator to times(). - ->>> class LazyList: -... def __init__(self, g): -... self.sofar = [] -... self.fetch = g.next -... -... def __getitem__(self, i): -... sofar, fetch = self.sofar, self.fetch -... while i >= len(sofar): -... sofar.append(fetch()) -... return sofar[i] - ->>> def m235(): -... yield 1 -... # Gack: m235 below actually refers to a LazyList. -... me_times2 = times(2, m235) -... me_times3 = times(3, m235) -... me_times5 = times(5, m235) -... for i in merge(merge(me_times2, -... me_times3), -... me_times5): -... yield i - -Print as many of these as you like -- *this* implementation is memory- -efficient. - ->>> m235 = LazyList(m235()) ->>> for i in range(5): -... print [m235[j] for j in range(15*i, 15*(i+1))] -[1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24] -[25, 27, 30, 32, 36, 40, 45, 48, 50, 54, 60, 64, 72, 75, 80] -[81, 90, 96, 100, 108, 120, 125, 128, 135, 144, 150, 160, 162, 180, 192] -[200, 216, 225, 240, 243, 250, 256, 270, 288, 300, 320, 324, 360, 375, 384] -[400, 405, 432, 450, 480, 486, 500, 512, 540, 576, 600, 625, 640, 648, 675] - -Ye olde Fibonacci generator, LazyList style. - ->>> def fibgen(a, b): -... -... def sum(g, h): -... while 1: -... yield g.next() + h.next() -... -... def tail(g): -... g.next() # throw first away -... for x in g: -... yield x -... -... yield a -... yield b -... for s in sum(iter(fib), -... tail(iter(fib))): -... yield s - ->>> fib = LazyList(fibgen(1, 2)) ->>> firstn(iter(fib), 17) -[1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584] - - -Running after your tail with itertools.tee (new in version 2.4) - -The algorithms "m235" (Hamming) and Fibonacci presented above are both -examples of a whole family of FP (functional programming) algorithms -where a function produces and returns a list while the production algorithm -suppose the list as already produced by recursively calling itself. -For these algorithms to work, they must: - -- produce at least a first element without presupposing the existence of - the rest of the list -- produce their elements in a lazy manner - -To work efficiently, the beginning of the list must not be recomputed over -and over again. This is ensured in most FP languages as a built-in feature. -In python, we have to explicitly maintain a list of already computed results -and abandon genuine recursivity. - -This is what had been attempted above with the LazyList class. One problem -with that class is that it keeps a list of all of the generated results and -therefore continually grows. This partially defeats the goal of the generator -concept, viz. produce the results only as needed instead of producing them -all and thereby wasting memory. - -Thanks to itertools.tee, it is now clear "how to get the internal uses of -m235 to share a single generator". - ->>> from itertools import tee ->>> def m235(): -... def _m235(): -... yield 1 -... for n in merge(times(2, m2), -... merge(times(3, m3), -... times(5, m5))): -... yield n -... m1 = _m235() -... m2, m3, m5, mRes = tee(m1, 4) -... return mRes - ->>> it = m235() ->>> for i in range(5): -... print firstn(it, 15) -[1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24] -[25, 27, 30, 32, 36, 40, 45, 48, 50, 54, 60, 64, 72, 75, 80] -[81, 90, 96, 100, 108, 120, 125, 128, 135, 144, 150, 160, 162, 180, 192] -[200, 216, 225, 240, 243, 250, 256, 270, 288, 300, 320, 324, 360, 375, 384] -[400, 405, 432, 450, 480, 486, 500, 512, 540, 576, 600, 625, 640, 648, 675] - -The "tee" function does just what we want. It internally keeps a generated -result for as long as it has not been "consumed" from all of the duplicated -iterators, whereupon it is deleted. You can therefore print the hamming -sequence during hours without increasing memory usage, or very little. - -The beauty of it is that recursive running-after-their-tail FP algorithms -are quite straightforwardly expressed with this Python idiom. - -Ye olde Fibonacci generator, tee style. - ->>> def fib(): -... -... def _isum(g, h): -... while 1: -... yield g.next() + h.next() -... -... def _fib(): -... yield 1 -... yield 2 -... fibTail.next() # throw first away -... for res in _isum(fibHead, fibTail): -... yield res -... -... realfib = _fib() -... fibHead, fibTail, fibRes = tee(realfib, 3) -... return fibRes - ->>> firstn(fib(), 17) -[1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584] - -""" - -# syntax_tests mostly provokes SyntaxErrors. Also fiddling with #if 0 -# hackery. - -syntax_tests = """ - ->>> def f(): -... return 22 -... yield 1 -Traceback (most recent call last): - .. -SyntaxError: 'return' with argument inside generator (, line 3) - ->>> def f(): -... yield 1 -... return 22 -Traceback (most recent call last): - .. -SyntaxError: 'return' with argument inside generator (, line 3) - -"return None" is not the same as "return" in a generator: - ->>> def f(): -... yield 1 -... return None -Traceback (most recent call last): - .. -SyntaxError: 'return' with argument inside generator (, line 3) - -These are fine: - ->>> def f(): -... yield 1 -... return - ->>> def f(): -... try: -... yield 1 -... finally: -... pass - ->>> def f(): -... try: -... try: -... 1//0 -... except ZeroDivisionError: -... yield 666 -... except: -... pass -... finally: -... pass - ->>> def f(): -... try: -... try: -... yield 12 -... 1//0 -... except ZeroDivisionError: -... yield 666 -... except: -... try: -... x = 12 -... finally: -... yield 12 -... except: -... return ->>> list(f()) -[12, 666] - ->>> def f(): -... yield ->>> type(f()) - - - ->>> def f(): -... if 0: -... yield ->>> type(f()) - - - ->>> def f(): -... if 0: -... yield 1 ->>> type(f()) - - ->>> def f(): -... if "": -... yield None ->>> type(f()) - - ->>> def f(): -... return -... try: -... if x==4: -... pass -... elif 0: -... try: -... 1//0 -... except SyntaxError: -... pass -... else: -... if 0: -... while 12: -... x += 1 -... yield 2 # don't blink -... f(a, b, c, d, e) -... else: -... pass -... except: -... x = 1 -... return ->>> type(f()) - - ->>> def f(): -... if 0: -... def g(): -... yield 1 -... ->>> type(f()) - - ->>> def f(): -... if 0: -... class C: -... def __init__(self): -... yield 1 -... def f(self): -... yield 2 ->>> type(f()) - - ->>> def f(): -... if 0: -... return -... if 0: -... yield 2 ->>> type(f()) - - - ->>> def f(): -... if 0: -... lambda x: x # shouldn't trigger here -... return # or here -... def f(i): -... return 2*i # or here -... if 0: -... return 3 # but *this* sucks (line 8) -... if 0: -... yield 2 # because it's a generator (line 10) -Traceback (most recent call last): -SyntaxError: 'return' with argument inside generator (, line 10) - -This one caused a crash (see SF bug 567538): - ->>> def f(): -... for i in range(3): -... try: -... continue -... finally: -... yield i -... ->>> g = f() ->>> print g.next() -0 ->>> print g.next() -1 ->>> print g.next() -2 ->>> print g.next() -Traceback (most recent call last): -StopIteration -""" - -# conjoin is a simple backtracking generator, named in honor of Icon's -# "conjunction" control structure. Pass a list of no-argument functions -# that return iterable objects. Easiest to explain by example: assume the -# function list [x, y, z] is passed. Then conjoin acts like: -# -# def g(): -# values = [None] * 3 -# for values[0] in x(): -# for values[1] in y(): -# for values[2] in z(): -# yield values -# -# So some 3-lists of values *may* be generated, each time we successfully -# get into the innermost loop. If an iterator fails (is exhausted) before -# then, it "backtracks" to get the next value from the nearest enclosing -# iterator (the one "to the left"), and starts all over again at the next -# slot (pumps a fresh iterator). Of course this is most useful when the -# iterators have side-effects, so that which values *can* be generated at -# each slot depend on the values iterated at previous slots. - -def conjoin(gs): - - values = [None] * len(gs) - - def gen(i, values=values): - if i >= len(gs): - yield values - else: - for values[i] in gs[i](): - for x in gen(i+1): - yield x - - for x in gen(0): - yield x - -# That works fine, but recursing a level and checking i against len(gs) for -# each item produced is inefficient. By doing manual loop unrolling across -# generator boundaries, it's possible to eliminate most of that overhead. -# This isn't worth the bother *in general* for generators, but conjoin() is -# a core building block for some CPU-intensive generator applications. - -def conjoin(gs): - - n = len(gs) - values = [None] * n - - # Do one loop nest at time recursively, until the # of loop nests - # remaining is divisible by 3. - - def gen(i, values=values): - if i >= n: - yield values - - elif (n-i) % 3: - ip1 = i+1 - for values[i] in gs[i](): - for x in gen(ip1): - yield x - - else: - for x in _gen3(i): - yield x - - # Do three loop nests at a time, recursing only if at least three more - # remain. Don't call directly: this is an internal optimization for - # gen's use. - - def _gen3(i, values=values): - assert i < n and (n-i) % 3 == 0 - ip1, ip2, ip3 = i+1, i+2, i+3 - g, g1, g2 = gs[i : ip3] - - if ip3 >= n: - # These are the last three, so we can yield values directly. - for values[i] in g(): - for values[ip1] in g1(): - for values[ip2] in g2(): - yield values - - else: - # At least 6 loop nests remain; peel off 3 and recurse for the - # rest. - for values[i] in g(): - for values[ip1] in g1(): - for values[ip2] in g2(): - for x in _gen3(ip3): - yield x - - for x in gen(0): - yield x - -# And one more approach: For backtracking apps like the Knight's Tour -# solver below, the number of backtracking levels can be enormous (one -# level per square, for the Knight's Tour, so that e.g. a 100x100 board -# needs 10,000 levels). In such cases Python is likely to run out of -# stack space due to recursion. So here's a recursion-free version of -# conjoin too. -# NOTE WELL: This allows large problems to be solved with only trivial -# demands on stack space. Without explicitly resumable generators, this is -# much harder to achieve. OTOH, this is much slower (up to a factor of 2) -# than the fancy unrolled recursive conjoin. - -def flat_conjoin(gs): # rename to conjoin to run tests with this instead - n = len(gs) - values = [None] * n - iters = [None] * n - _StopIteration = StopIteration # make local because caught a *lot* - i = 0 - while 1: - # Descend. - try: - while i < n: - it = iters[i] = gs[i]().next - values[i] = it() - i += 1 - except _StopIteration: - pass - else: - assert i == n - yield values - - # Backtrack until an older iterator can be resumed. - i -= 1 - while i >= 0: - try: - values[i] = iters[i]() - # Success! Start fresh at next level. - i += 1 - break - except _StopIteration: - # Continue backtracking. - i -= 1 - else: - assert i < 0 - break - -# A conjoin-based N-Queens solver. - -class Queens: - def __init__(self, n): - self.n = n - rangen = range(n) - - # Assign a unique int to each column and diagonal. - # columns: n of those, range(n). - # NW-SE diagonals: 2n-1 of these, i-j unique and invariant along - # each, smallest i-j is 0-(n-1) = 1-n, so add n-1 to shift to 0- - # based. - # NE-SW diagonals: 2n-1 of these, i+j unique and invariant along - # each, smallest i+j is 0, largest is 2n-2. - - # For each square, compute a bit vector of the columns and - # diagonals it covers, and for each row compute a function that - # generates the possiblities for the columns in that row. - self.rowgenerators = [] - for i in rangen: - rowuses = [(1L << j) | # column ordinal - (1L << (n + i-j + n-1)) | # NW-SE ordinal - (1L << (n + 2*n-1 + i+j)) # NE-SW ordinal - for j in rangen] - - def rowgen(rowuses=rowuses): - for j in rangen: - uses = rowuses[j] - if uses & self.used == 0: - self.used |= uses - yield j - self.used &= ~uses - - self.rowgenerators.append(rowgen) - - # Generate solutions. - def solve(self): - self.used = 0 - for row2col in conjoin(self.rowgenerators): - yield row2col - - def printsolution(self, row2col): - n = self.n - assert n == len(row2col) - sep = "+" + "-+" * n - print sep - for i in range(n): - squares = [" " for j in range(n)] - squares[row2col[i]] = "Q" - print "|" + "|".join(squares) + "|" - print sep - -# A conjoin-based Knight's Tour solver. This is pretty sophisticated -# (e.g., when used with flat_conjoin above, and passing hard=1 to the -# constructor, a 200x200 Knight's Tour was found quickly -- note that we're -# creating 10s of thousands of generators then!), and is lengthy. - -class Knights: - def __init__(self, m, n, hard=0): - self.m, self.n = m, n - - # solve() will set up succs[i] to be a list of square #i's - # successors. - succs = self.succs = [] - - # Remove i0 from each of its successor's successor lists, i.e. - # successors can't go back to i0 again. Return 0 if we can - # detect this makes a solution impossible, else return 1. - - def remove_from_successors(i0, len=len): - # If we remove all exits from a free square, we're dead: - # even if we move to it next, we can't leave it again. - # If we create a square with one exit, we must visit it next; - # else somebody else will have to visit it, and since there's - # only one adjacent, there won't be a way to leave it again. - # Finelly, if we create more than one free square with a - # single exit, we can only move to one of them next, leaving - # the other one a dead end. - ne0 = ne1 = 0 - for i in succs[i0]: - s = succs[i] - s.remove(i0) - e = len(s) - if e == 0: - ne0 += 1 - elif e == 1: - ne1 += 1 - return ne0 == 0 and ne1 < 2 - - # Put i0 back in each of its successor's successor lists. - - def add_to_successors(i0): - for i in succs[i0]: - succs[i].append(i0) - - # Generate the first move. - def first(): - if m < 1 or n < 1: - return - - # Since we're looking for a cycle, it doesn't matter where we - # start. Starting in a corner makes the 2nd move easy. - corner = self.coords2index(0, 0) - remove_from_successors(corner) - self.lastij = corner - yield corner - add_to_successors(corner) - - # Generate the second moves. - def second(): - corner = self.coords2index(0, 0) - assert self.lastij == corner # i.e., we started in the corner - if m < 3 or n < 3: - return - assert len(succs[corner]) == 2 - assert self.coords2index(1, 2) in succs[corner] - assert self.coords2index(2, 1) in succs[corner] - # Only two choices. Whichever we pick, the other must be the - # square picked on move m*n, as it's the only way to get back - # to (0, 0). Save its index in self.final so that moves before - # the last know it must be kept free. - for i, j in (1, 2), (2, 1): - this = self.coords2index(i, j) - final = self.coords2index(3-i, 3-j) - self.final = final - - remove_from_successors(this) - succs[final].append(corner) - self.lastij = this - yield this - succs[final].remove(corner) - add_to_successors(this) - - # Generate moves 3 thru m*n-1. - def advance(len=len): - # If some successor has only one exit, must take it. - # Else favor successors with fewer exits. - candidates = [] - for i in succs[self.lastij]: - e = len(succs[i]) - assert e > 0, "else remove_from_successors() pruning flawed" - if e == 1: - candidates = [(e, i)] - break - candidates.append((e, i)) - else: - candidates.sort() - - for e, i in candidates: - if i != self.final: - if remove_from_successors(i): - self.lastij = i - yield i - add_to_successors(i) - - # Generate moves 3 thru m*n-1. Alternative version using a - # stronger (but more expensive) heuristic to order successors. - # Since the # of backtracking levels is m*n, a poor move early on - # can take eons to undo. Smallest square board for which this - # matters a lot is 52x52. - def advance_hard(vmid=(m-1)/2.0, hmid=(n-1)/2.0, len=len): - # If some successor has only one exit, must take it. - # Else favor successors with fewer exits. - # Break ties via max distance from board centerpoint (favor - # corners and edges whenever possible). - candidates = [] - for i in succs[self.lastij]: - e = len(succs[i]) - assert e > 0, "else remove_from_successors() pruning flawed" - if e == 1: - candidates = [(e, 0, i)] - break - i1, j1 = self.index2coords(i) - d = (i1 - vmid)**2 + (j1 - hmid)**2 - candidates.append((e, -d, i)) - else: - candidates.sort() - - for e, d, i in candidates: - if i != self.final: - if remove_from_successors(i): - self.lastij = i - yield i - add_to_successors(i) - - # Generate the last move. - def last(): - assert self.final in succs[self.lastij] - yield self.final - - if m*n < 4: - self.squaregenerators = [first] - else: - self.squaregenerators = [first, second] + \ - [hard and advance_hard or advance] * (m*n - 3) + \ - [last] - - def coords2index(self, i, j): - assert 0 <= i < self.m - assert 0 <= j < self.n - return i * self.n + j - - def index2coords(self, index): - assert 0 <= index < self.m * self.n - return divmod(index, self.n) - - def _init_board(self): - succs = self.succs - del succs[:] - m, n = self.m, self.n - c2i = self.coords2index - - offsets = [( 1, 2), ( 2, 1), ( 2, -1), ( 1, -2), - (-1, -2), (-2, -1), (-2, 1), (-1, 2)] - rangen = range(n) - for i in range(m): - for j in rangen: - s = [c2i(i+io, j+jo) for io, jo in offsets - if 0 <= i+io < m and - 0 <= j+jo < n] - succs.append(s) - - # Generate solutions. - def solve(self): - self._init_board() - for x in conjoin(self.squaregenerators): - yield x - - def printsolution(self, x): - m, n = self.m, self.n - assert len(x) == m*n - w = len(str(m*n)) - format = "%" + str(w) + "d" - - squares = [[None] * n for i in range(m)] - k = 1 - for i in x: - i1, j1 = self.index2coords(i) - squares[i1][j1] = format % k - k += 1 - - sep = "+" + ("-" * w + "+") * n - print sep - for i in range(m): - row = squares[i] - print "|" + "|".join(row) + "|" - print sep - -conjoin_tests = """ - -Generate the 3-bit binary numbers in order. This illustrates dumbest- -possible use of conjoin, just to generate the full cross-product. - ->>> for c in conjoin([lambda: iter((0, 1))] * 3): -... print c -[0, 0, 0] -[0, 0, 1] -[0, 1, 0] -[0, 1, 1] -[1, 0, 0] -[1, 0, 1] -[1, 1, 0] -[1, 1, 1] - -For efficiency in typical backtracking apps, conjoin() yields the same list -object each time. So if you want to save away a full account of its -generated sequence, you need to copy its results. - ->>> def gencopy(iterator): -... for x in iterator: -... yield x[:] - ->>> for n in range(10): -... all = list(gencopy(conjoin([lambda: iter((0, 1))] * n))) -... print n, len(all), all[0] == [0] * n, all[-1] == [1] * n -0 1 True True -1 2 True True -2 4 True True -3 8 True True -4 16 True True -5 32 True True -6 64 True True -7 128 True True -8 256 True True -9 512 True True - -And run an 8-queens solver. - ->>> q = Queens(8) ->>> LIMIT = 2 ->>> count = 0 ->>> for row2col in q.solve(): -... count += 1 -... if count <= LIMIT: -... print "Solution", count -... q.printsolution(row2col) -Solution 1 -+-+-+-+-+-+-+-+-+ -|Q| | | | | | | | -+-+-+-+-+-+-+-+-+ -| | | | |Q| | | | -+-+-+-+-+-+-+-+-+ -| | | | | | | |Q| -+-+-+-+-+-+-+-+-+ -| | | | | |Q| | | -+-+-+-+-+-+-+-+-+ -| | |Q| | | | | | -+-+-+-+-+-+-+-+-+ -| | | | | | |Q| | -+-+-+-+-+-+-+-+-+ -| |Q| | | | | | | -+-+-+-+-+-+-+-+-+ -| | | |Q| | | | | -+-+-+-+-+-+-+-+-+ -Solution 2 -+-+-+-+-+-+-+-+-+ -|Q| | | | | | | | -+-+-+-+-+-+-+-+-+ -| | | | | |Q| | | -+-+-+-+-+-+-+-+-+ -| | | | | | | |Q| -+-+-+-+-+-+-+-+-+ -| | |Q| | | | | | -+-+-+-+-+-+-+-+-+ -| | | | | | |Q| | -+-+-+-+-+-+-+-+-+ -| | | |Q| | | | | -+-+-+-+-+-+-+-+-+ -| |Q| | | | | | | -+-+-+-+-+-+-+-+-+ -| | | | |Q| | | | -+-+-+-+-+-+-+-+-+ - ->>> print count, "solutions in all." -92 solutions in all. - -And run a Knight's Tour on a 10x10 board. Note that there are about -20,000 solutions even on a 6x6 board, so don't dare run this to exhaustion. - ->>> k = Knights(10, 10) ->>> LIMIT = 2 ->>> count = 0 ->>> for x in k.solve(): -... count += 1 -... if count <= LIMIT: -... print "Solution", count -... k.printsolution(x) -... else: -... break -Solution 1 -+---+---+---+---+---+---+---+---+---+---+ -| 1| 58| 27| 34| 3| 40| 29| 10| 5| 8| -+---+---+---+---+---+---+---+---+---+---+ -| 26| 35| 2| 57| 28| 33| 4| 7| 30| 11| -+---+---+---+---+---+---+---+---+---+---+ -| 59|100| 73| 36| 41| 56| 39| 32| 9| 6| -+---+---+---+---+---+---+---+---+---+---+ -| 74| 25| 60| 55| 72| 37| 42| 49| 12| 31| -+---+---+---+---+---+---+---+---+---+---+ -| 61| 86| 99| 76| 63| 52| 47| 38| 43| 50| -+---+---+---+---+---+---+---+---+---+---+ -| 24| 75| 62| 85| 54| 71| 64| 51| 48| 13| -+---+---+---+---+---+---+---+---+---+---+ -| 87| 98| 91| 80| 77| 84| 53| 46| 65| 44| -+---+---+---+---+---+---+---+---+---+---+ -| 90| 23| 88| 95| 70| 79| 68| 83| 14| 17| -+---+---+---+---+---+---+---+---+---+---+ -| 97| 92| 21| 78| 81| 94| 19| 16| 45| 66| -+---+---+---+---+---+---+---+---+---+---+ -| 22| 89| 96| 93| 20| 69| 82| 67| 18| 15| -+---+---+---+---+---+---+---+---+---+---+ -Solution 2 -+---+---+---+---+---+---+---+---+---+---+ -| 1| 58| 27| 34| 3| 40| 29| 10| 5| 8| -+---+---+---+---+---+---+---+---+---+---+ -| 26| 35| 2| 57| 28| 33| 4| 7| 30| 11| -+---+---+---+---+---+---+---+---+---+---+ -| 59|100| 73| 36| 41| 56| 39| 32| 9| 6| -+---+---+---+---+---+---+---+---+---+---+ -| 74| 25| 60| 55| 72| 37| 42| 49| 12| 31| -+---+---+---+---+---+---+---+---+---+---+ -| 61| 86| 99| 76| 63| 52| 47| 38| 43| 50| -+---+---+---+---+---+---+---+---+---+---+ -| 24| 75| 62| 85| 54| 71| 64| 51| 48| 13| -+---+---+---+---+---+---+---+---+---+---+ -| 87| 98| 89| 80| 77| 84| 53| 46| 65| 44| -+---+---+---+---+---+---+---+---+---+---+ -| 90| 23| 92| 95| 70| 79| 68| 83| 14| 17| -+---+---+---+---+---+---+---+---+---+---+ -| 97| 88| 21| 78| 81| 94| 19| 16| 45| 66| -+---+---+---+---+---+---+---+---+---+---+ -| 22| 91| 96| 93| 20| 69| 82| 67| 18| 15| -+---+---+---+---+---+---+---+---+---+---+ -""" - -weakref_tests = """\ -Generators are weakly referencable: - ->>> import weakref ->>> def gen(): -... yield 'foo!' -... ->>> wr = weakref.ref(gen) ->>> wr() is gen -True ->>> p = weakref.proxy(gen) - -Generator-iterators are weakly referencable as well: - ->>> gi = gen() ->>> wr = weakref.ref(gi) ->>> wr() is gi -True ->>> p = weakref.proxy(gi) ->>> list(p) -['foo!'] - -""" - -coroutine_tests = """\ -Sending a value into a started generator: - ->>> def f(): -... print (yield 1) -... yield 2 ->>> g = f() ->>> g.next() -1 ->>> g.send(42) -42 -2 - -Sending a value into a new generator produces a TypeError: - ->>> f().send("foo") -Traceback (most recent call last): -... -TypeError: can't send non-None value to a just-started generator - - -Yield by itself yields None: - ->>> def f(): yield ->>> list(f()) -[None] - - - -An obscene abuse of a yield expression within a generator expression: - ->>> list((yield 21) for i in range(4)) -[21, None, 21, None, 21, None, 21, None] - -And a more sane, but still weird usage: - ->>> def f(): list(i for i in [(yield 26)]) ->>> type(f()) - - - -A yield expression with augmented assignment. - ->>> def coroutine(seq): -... count = 0 -... while count < 200: -... count += yield -... seq.append(count) ->>> seq = [] ->>> c = coroutine(seq) ->>> c.next() ->>> print seq -[] ->>> c.send(10) ->>> print seq -[10] ->>> c.send(10) ->>> print seq -[10, 20] ->>> c.send(10) ->>> print seq -[10, 20, 30] - - -Check some syntax errors for yield expressions: - ->>> f=lambda: (yield 1),(yield 2) -Traceback (most recent call last): - ... -SyntaxError: 'yield' outside function (, line 1) - ->>> def f(): return lambda x=(yield): 1 -Traceback (most recent call last): - ... -SyntaxError: 'return' with argument inside generator (, line 1) - ->>> def f(): x = yield = y -Traceback (most recent call last): - ... -SyntaxError: assignment to yield expression not possible (, line 1) - ->>> def f(): (yield bar) = y -Traceback (most recent call last): - ... -SyntaxError: can't assign to yield expression (, line 1) - ->>> def f(): (yield bar) += y -Traceback (most recent call last): - ... -SyntaxError: augmented assignment to yield expression not possible (, line 1) - - -Now check some throw() conditions: - ->>> def f(): -... while True: -... try: -... print (yield) -... except ValueError,v: -... print "caught ValueError (%s)" % (v), ->>> import sys ->>> g = f() ->>> g.next() - ->>> g.throw(ValueError) # type only -caught ValueError () - ->>> g.throw(ValueError("xyz")) # value only -caught ValueError (xyz) - ->>> g.throw(ValueError, ValueError(1)) # value+matching type -caught ValueError (1) - ->>> g.throw(ValueError, TypeError(1)) # mismatched type, rewrapped -caught ValueError (1) - ->>> g.throw(ValueError, ValueError(1), None) # explicit None traceback -caught ValueError (1) - ->>> g.throw(ValueError(1), "foo") # bad args -Traceback (most recent call last): - ... -TypeError: instance exception may not have a separate value - ->>> g.throw(ValueError, "foo", 23) # bad args -Traceback (most recent call last): - ... -TypeError: throw() third argument must be a traceback object - ->>> def throw(g,exc): -... try: -... raise exc -... except: -... g.throw(*sys.exc_info()) ->>> throw(g,ValueError) # do it with traceback included -caught ValueError () - ->>> g.send(1) -1 - ->>> throw(g,TypeError) # terminate the generator -Traceback (most recent call last): - ... -TypeError - ->>> print g.gi_frame -None - ->>> g.send(2) -Traceback (most recent call last): - ... -StopIteration - ->>> g.throw(ValueError,6) # throw on closed generator -Traceback (most recent call last): - ... -ValueError: 6 - ->>> f().throw(ValueError,7) # throw on just-opened generator -Traceback (most recent call last): - ... -ValueError: 7 - ->>> f().throw("abc") # throw on just-opened generator -Traceback (most recent call last): - ... -abc - -Now let's try closing a generator: - ->>> def f(): -... try: yield -... except GeneratorExit: -... print "exiting" - ->>> g = f() ->>> g.next() ->>> g.close() -exiting ->>> g.close() # should be no-op now - ->>> f().close() # close on just-opened generator should be fine - ->>> def f(): yield # an even simpler generator ->>> f().close() # close before opening ->>> g = f() ->>> g.next() ->>> g.close() # close normally - -And finalization: - ->>> def f(): -... try: yield -... finally: -... print "exiting" - ->>> g = f() ->>> g.next() ->>> del g -exiting - - -Now let's try some ill-behaved generators: - ->>> def f(): -... try: yield -... except GeneratorExit: -... yield "foo!" ->>> g = f() ->>> g.next() ->>> g.close() -Traceback (most recent call last): - ... -RuntimeError: generator ignored GeneratorExit ->>> g.close() - - -Our ill-behaved code should be invoked during GC: - ->>> import sys, StringIO ->>> old, sys.stderr = sys.stderr, StringIO.StringIO() ->>> g = f() ->>> g.next() ->>> del g ->>> sys.stderr.getvalue().startswith( -... "Exception exceptions.RuntimeError: 'generator ignored GeneratorExit' in " -... ) -True ->>> sys.stderr = old - - -And errors thrown during closing should propagate: - ->>> def f(): -... try: yield -... except GeneratorExit: -... raise TypeError("fie!") ->>> g = f() ->>> g.next() ->>> g.close() -Traceback (most recent call last): - ... -TypeError: fie! - - -Ensure that various yield expression constructs make their -enclosing function a generator: - ->>> def f(): x += yield ->>> type(f()) - - ->>> def f(): x = yield ->>> type(f()) - - ->>> def f(): lambda x=(yield): 1 ->>> type(f()) - - ->>> def f(): x=(i for i in (yield) if (yield)) ->>> type(f()) - - ->>> def f(d): d[(yield "a")] = d[(yield "b")] = 27 ->>> data = [1,2] ->>> g = f(data) ->>> type(g) - ->>> g.send(None) -'a' ->>> data -[1, 2] ->>> g.send(0) -'b' ->>> data -[27, 2] ->>> try: g.send(1) -... except StopIteration: pass ->>> data -[27, 27] - -""" - -refleaks_tests = """ -Prior to adding cycle-GC support to itertools.tee, this code would leak -references. We add it to the standard suite so the routine refleak-tests -would trigger if it starts being uncleanable again. - ->>> import itertools ->>> def leak(): -... class gen: -... def __iter__(self): -... return self -... def next(self): -... return self.item -... g = gen() -... head, tail = itertools.tee(g) -... g.item = head -... return head ->>> it = leak() - -Make sure to also test the involvement of the tee-internal teedataobject, -which stores returned items. - ->>> item = it.next() - - - -This test leaked at one point due to generator finalization/destruction. -It was copied from Lib/test/leakers/test_generator_cycle.py before the file -was removed. - ->>> def leak(): -... def gen(): -... while True: -... yield g -... g = gen() - ->>> leak() - - - -This test isn't really generator related, but rather exception-in-cleanup -related. The coroutine tests (above) just happen to cause an exception in -the generator's __del__ (tp_del) method. We can also test for this -explicitly, without generators. We do have to redirect stderr to avoid -printing warnings and to doublecheck that we actually tested what we wanted -to test. - ->>> import sys, StringIO ->>> old = sys.stderr ->>> try: -... sys.stderr = StringIO.StringIO() -... class Leaker: -... def __del__(self): -... raise RuntimeError -... -... l = Leaker() -... del l -... err = sys.stderr.getvalue().strip() -... err.startswith( -... "Exception exceptions.RuntimeError: RuntimeError() in <" -... ) -... err.endswith("> ignored") -... len(err.splitlines()) -... finally: -... sys.stderr = old -True -True -1 - - - -These refleak tests should perhaps be in a testfile of their own, -test_generators just happened to be the test that drew these out. - -""" - -__test__ = {"tut": tutorial_tests, - "pep": pep_tests, - "email": email_tests, - "fun": fun_tests, - "syntax": syntax_tests, - "conjoin": conjoin_tests, - "weakref": weakref_tests, - "coroutine": coroutine_tests, - "refleaks": refleaks_tests, - } - -# Magic test name that regrtest.py invokes *after* importing this module. -# This worms around a bootstrap problem. -# Note that doctest and regrtest both look in sys.argv for a "-v" argument, -# so this works as expected in both ways of running regrtest. -def test_main(verbose=None): - from test import test_support, test_generators - test_support.run_doctest(test_generators, verbose) - -# This part isn't needed for regrtest, but for running the test directly. -if __name__ == "__main__": - test_main(1) diff --git a/sys/lib/python/test/test_genexps.py b/sys/lib/python/test/test_genexps.py deleted file mode 100644 index 2598a7913..000000000 --- a/sys/lib/python/test/test_genexps.py +++ /dev/null @@ -1,280 +0,0 @@ -doctests = """ - -Test simple loop with conditional - - >>> sum(i*i for i in range(100) if i&1 == 1) - 166650 - -Test simple nesting - - >>> list((i,j) for i in range(3) for j in range(4) ) - [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] - -Test nesting with the inner expression dependent on the outer - - >>> list((i,j) for i in range(4) for j in range(i) ) - [(1, 0), (2, 0), (2, 1), (3, 0), (3, 1), (3, 2)] - -Make sure the induction variable is not exposed - - >>> i = 20 - >>> sum(i*i for i in range(100)) - 328350 - >>> i - 20 - -Test first class - - >>> g = (i*i for i in range(4)) - >>> type(g) - - >>> list(g) - [0, 1, 4, 9] - -Test direct calls to next() - - >>> g = (i*i for i in range(3)) - >>> g.next() - 0 - >>> g.next() - 1 - >>> g.next() - 4 - >>> g.next() - Traceback (most recent call last): - File "", line 1, in -toplevel- - g.next() - StopIteration - -Does it stay stopped? - - >>> g.next() - Traceback (most recent call last): - File "", line 1, in -toplevel- - g.next() - StopIteration - >>> list(g) - [] - -Test running gen when defining function is out of scope - - >>> def f(n): - ... return (i*i for i in xrange(n)) - >>> list(f(10)) - [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] - - >>> def f(n): - ... return ((i,j) for i in xrange(3) for j in xrange(n)) - >>> list(f(4)) - [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] - >>> def f(n): - ... return ((i,j) for i in xrange(3) for j in xrange(4) if j in xrange(n)) - >>> list(f(4)) - [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] - >>> list(f(2)) - [(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1)] - -Verify that parenthesis are required in a statement - - >>> def f(n): - ... return i*i for i in xrange(n) - Traceback (most recent call last): - ... - SyntaxError: invalid syntax - -Verify that parenthesis are required when used as a keyword argument value - - >>> dict(a = i for i in xrange(10)) - Traceback (most recent call last): - ... - SyntaxError: invalid syntax - -Verify that parenthesis are required when used as a keyword argument value - - >>> dict(a = (i for i in xrange(10))) #doctest: +ELLIPSIS - {'a': } - -Verify early binding for the outermost for-expression - - >>> x=10 - >>> g = (i*i for i in range(x)) - >>> x = 5 - >>> list(g) - [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] - -Verify that the outermost for-expression makes an immediate check -for iterability - - >>> (i for i in 6) - Traceback (most recent call last): - File "", line 1, in -toplevel- - (i for i in 6) - TypeError: 'int' object is not iterable - -Verify late binding for the outermost if-expression - - >>> include = (2,4,6,8) - >>> g = (i*i for i in range(10) if i in include) - >>> include = (1,3,5,7,9) - >>> list(g) - [1, 9, 25, 49, 81] - -Verify late binding for the innermost for-expression - - >>> g = ((i,j) for i in range(3) for j in range(x)) - >>> x = 4 - >>> list(g) - [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] - -Verify re-use of tuples (a side benefit of using genexps over listcomps) - - >>> tupleids = map(id, ((i,i) for i in xrange(10))) - >>> int(max(tupleids) - min(tupleids)) - 0 - -Verify that syntax error's are raised for genexps used as lvalues - - >>> (y for y in (1,2)) = 10 - Traceback (most recent call last): - ... - SyntaxError: can't assign to generator expression (, line 1) - - >>> (y for y in (1,2)) += 10 - Traceback (most recent call last): - ... - SyntaxError: augmented assignment to generator expression not possible (, line 1) - - -########### Tests borrowed from or inspired by test_generators.py ############ - -Make a generator that acts like range() - - >>> yrange = lambda n: (i for i in xrange(n)) - >>> list(yrange(10)) - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - -Generators always return to the most recent caller: - - >>> def creator(): - ... r = yrange(5) - ... print "creator", r.next() - ... return r - >>> def caller(): - ... r = creator() - ... for i in r: - ... print "caller", i - >>> caller() - creator 0 - caller 1 - caller 2 - caller 3 - caller 4 - -Generators can call other generators: - - >>> def zrange(n): - ... for i in yrange(n): - ... yield i - >>> list(zrange(5)) - [0, 1, 2, 3, 4] - - -Verify that a gen exp cannot be resumed while it is actively running: - - >>> g = (me.next() for i in xrange(10)) - >>> me = g - >>> me.next() - Traceback (most recent call last): - File "", line 1, in -toplevel- - me.next() - File "", line 1, in - g = (me.next() for i in xrange(10)) - ValueError: generator already executing - -Verify exception propagation - - >>> g = (10 // i for i in (5, 0, 2)) - >>> g.next() - 2 - >>> g.next() - Traceback (most recent call last): - File "", line 1, in -toplevel- - g.next() - File "", line 1, in - g = (10 // i for i in (5, 0, 2)) - ZeroDivisionError: integer division or modulo by zero - >>> g.next() - Traceback (most recent call last): - File "", line 1, in -toplevel- - g.next() - StopIteration - -Make sure that None is a valid return value - - >>> list(None for i in xrange(10)) - [None, None, None, None, None, None, None, None, None, None] - -Check that generator attributes are present - - >>> g = (i*i for i in range(3)) - >>> expected = set(['gi_frame', 'gi_running', 'next']) - >>> set(attr for attr in dir(g) if not attr.startswith('__')) >= expected - True - - >>> print g.next.__doc__ - x.next() -> the next value, or raise StopIteration - >>> import types - >>> isinstance(g, types.GeneratorType) - True - -Check the __iter__ slot is defined to return self - - >>> iter(g) is g - True - -Verify that the running flag is set properly - - >>> g = (me.gi_running for i in (0,1)) - >>> me = g - >>> me.gi_running - 0 - >>> me.next() - 1 - >>> me.gi_running - 0 - -Verify that genexps are weakly referencable - - >>> import weakref - >>> g = (i*i for i in range(4)) - >>> wr = weakref.ref(g) - >>> wr() is g - True - >>> p = weakref.proxy(g) - >>> list(p) - [0, 1, 4, 9] - - -""" - - -__test__ = {'doctests' : doctests} - -def test_main(verbose=None): - import sys - from test import test_support - from test import test_genexps - test_support.run_doctest(test_genexps, verbose) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_doctest(test_genexps, verbose) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_getargs.py b/sys/lib/python/test/test_getargs.py deleted file mode 100644 index 4ce34bc4f..000000000 --- a/sys/lib/python/test/test_getargs.py +++ /dev/null @@ -1,24 +0,0 @@ -"""Test the internal getargs.c implementation - - PyArg_ParseTuple() is defined here. - -The test here is not intended to test all of the module, just the -single case that failed between 2.1 and 2.2a2. -""" - -# marshal.loads() uses PyArg_ParseTuple(args, "s#:loads") -# The s code will cause a Unicode conversion to occur. This test -# verify that the error is propagated properly from the C code back to -# Python. - -# XXX If the encoding succeeds using the current default encoding, -# this test will fail because it does not test the right part of the -# PyArg_ParseTuple() implementation. -from test.test_support import have_unicode -import marshal - -if have_unicode: - try: - marshal.loads(unicode(r"\222", 'unicode-escape')) - except UnicodeError: - pass diff --git a/sys/lib/python/test/test_getargs2.py b/sys/lib/python/test/test_getargs2.py deleted file mode 100644 index 90ca303ec..000000000 --- a/sys/lib/python/test/test_getargs2.py +++ /dev/null @@ -1,264 +0,0 @@ -import unittest -from test import test_support -import sys - -import warnings, re -warnings.filterwarnings("ignore", - category=DeprecationWarning, - message=".*integer argument expected, got float", - module=__name__) -warnings.filterwarnings("ignore", - category=DeprecationWarning, - message=".*integer argument expected, got float", - module="unittest") - -""" -> How about the following counterproposal. This also changes some of -> the other format codes to be a little more regular. -> -> Code C type Range check -> -> b unsigned char 0..UCHAR_MAX -> h signed short SHRT_MIN..SHRT_MAX -> B unsigned char none ** -> H unsigned short none ** -> k * unsigned long none -> I * unsigned int 0..UINT_MAX - - -> i int INT_MIN..INT_MAX -> l long LONG_MIN..LONG_MAX - -> K * unsigned long long none -> L long long LLONG_MIN..LLONG_MAX - -> Notes: -> -> * New format codes. -> -> ** Changed from previous "range-and-a-half" to "none"; the -> range-and-a-half checking wasn't particularly useful. - -Plus a C API or two, e.g. PyInt_AsLongMask() -> -unsigned long and PyInt_AsLongLongMask() -> unsigned -long long (if that exists). -""" - -LARGE = 0x7FFFFFFF -VERY_LARGE = 0xFF0000121212121212121242L - -from _testcapi import UCHAR_MAX, USHRT_MAX, UINT_MAX, ULONG_MAX, INT_MAX, \ - INT_MIN, LONG_MIN, LONG_MAX, PY_SSIZE_T_MIN, PY_SSIZE_T_MAX - -# fake, they are not defined in Python's header files -LLONG_MAX = 2**63-1 -LLONG_MIN = -2**63 -ULLONG_MAX = 2**64-1 - -class Long: - def __int__(self): - return 99L - -class Int: - def __int__(self): - return 99 - -class Unsigned_TestCase(unittest.TestCase): - def test_b(self): - from _testcapi import getargs_b - # b returns 'unsigned char', and does range checking (0 ... UCHAR_MAX) - self.failUnlessEqual(3, getargs_b(3.14)) - self.failUnlessEqual(99, getargs_b(Long())) - self.failUnlessEqual(99, getargs_b(Int())) - - self.assertRaises(OverflowError, getargs_b, -1) - self.failUnlessEqual(0, getargs_b(0)) - self.failUnlessEqual(UCHAR_MAX, getargs_b(UCHAR_MAX)) - self.assertRaises(OverflowError, getargs_b, UCHAR_MAX + 1) - - self.failUnlessEqual(42, getargs_b(42)) - self.failUnlessEqual(42, getargs_b(42L)) - self.assertRaises(OverflowError, getargs_b, VERY_LARGE) - - def test_B(self): - from _testcapi import getargs_B - # B returns 'unsigned char', no range checking - self.failUnlessEqual(3, getargs_B(3.14)) - self.failUnlessEqual(99, getargs_B(Long())) - self.failUnlessEqual(99, getargs_B(Int())) - - self.failUnlessEqual(UCHAR_MAX, getargs_B(-1)) - self.failUnlessEqual(UCHAR_MAX, getargs_B(-1L)) - self.failUnlessEqual(0, getargs_B(0)) - self.failUnlessEqual(UCHAR_MAX, getargs_B(UCHAR_MAX)) - self.failUnlessEqual(0, getargs_B(UCHAR_MAX+1)) - - self.failUnlessEqual(42, getargs_B(42)) - self.failUnlessEqual(42, getargs_B(42L)) - self.failUnlessEqual(UCHAR_MAX & VERY_LARGE, getargs_B(VERY_LARGE)) - - def test_H(self): - from _testcapi import getargs_H - # H returns 'unsigned short', no range checking - self.failUnlessEqual(3, getargs_H(3.14)) - self.failUnlessEqual(99, getargs_H(Long())) - self.failUnlessEqual(99, getargs_H(Int())) - - self.failUnlessEqual(USHRT_MAX, getargs_H(-1)) - self.failUnlessEqual(0, getargs_H(0)) - self.failUnlessEqual(USHRT_MAX, getargs_H(USHRT_MAX)) - self.failUnlessEqual(0, getargs_H(USHRT_MAX+1)) - - self.failUnlessEqual(42, getargs_H(42)) - self.failUnlessEqual(42, getargs_H(42L)) - - self.failUnlessEqual(VERY_LARGE & USHRT_MAX, getargs_H(VERY_LARGE)) - - def test_I(self): - from _testcapi import getargs_I - # I returns 'unsigned int', no range checking - self.failUnlessEqual(3, getargs_I(3.14)) - self.failUnlessEqual(99, getargs_I(Long())) - self.failUnlessEqual(99, getargs_I(Int())) - - self.failUnlessEqual(UINT_MAX, getargs_I(-1)) - self.failUnlessEqual(0, getargs_I(0)) - self.failUnlessEqual(UINT_MAX, getargs_I(UINT_MAX)) - self.failUnlessEqual(0, getargs_I(UINT_MAX+1)) - - self.failUnlessEqual(42, getargs_I(42)) - self.failUnlessEqual(42, getargs_I(42L)) - - self.failUnlessEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE)) - - def test_k(self): - from _testcapi import getargs_k - # k returns 'unsigned long', no range checking - # it does not accept float, or instances with __int__ - self.assertRaises(TypeError, getargs_k, 3.14) - self.assertRaises(TypeError, getargs_k, Long()) - self.assertRaises(TypeError, getargs_k, Int()) - - self.failUnlessEqual(ULONG_MAX, getargs_k(-1)) - self.failUnlessEqual(0, getargs_k(0)) - self.failUnlessEqual(ULONG_MAX, getargs_k(ULONG_MAX)) - self.failUnlessEqual(0, getargs_k(ULONG_MAX+1)) - - self.failUnlessEqual(42, getargs_k(42)) - self.failUnlessEqual(42, getargs_k(42L)) - - self.failUnlessEqual(VERY_LARGE & ULONG_MAX, getargs_k(VERY_LARGE)) - -class Signed_TestCase(unittest.TestCase): - def test_i(self): - from _testcapi import getargs_i - # i returns 'int', and does range checking (INT_MIN ... INT_MAX) - self.failUnlessEqual(3, getargs_i(3.14)) - self.failUnlessEqual(99, getargs_i(Long())) - self.failUnlessEqual(99, getargs_i(Int())) - - self.assertRaises(OverflowError, getargs_i, INT_MIN-1) - self.failUnlessEqual(INT_MIN, getargs_i(INT_MIN)) - self.failUnlessEqual(INT_MAX, getargs_i(INT_MAX)) - self.assertRaises(OverflowError, getargs_i, INT_MAX+1) - - self.failUnlessEqual(42, getargs_i(42)) - self.failUnlessEqual(42, getargs_i(42L)) - self.assertRaises(OverflowError, getargs_i, VERY_LARGE) - - def test_l(self): - from _testcapi import getargs_l - # l returns 'long', and does range checking (LONG_MIN ... LONG_MAX) - self.failUnlessEqual(3, getargs_l(3.14)) - self.failUnlessEqual(99, getargs_l(Long())) - self.failUnlessEqual(99, getargs_l(Int())) - - self.assertRaises(OverflowError, getargs_l, LONG_MIN-1) - self.failUnlessEqual(LONG_MIN, getargs_l(LONG_MIN)) - self.failUnlessEqual(LONG_MAX, getargs_l(LONG_MAX)) - self.assertRaises(OverflowError, getargs_l, LONG_MAX+1) - - self.failUnlessEqual(42, getargs_l(42)) - self.failUnlessEqual(42, getargs_l(42L)) - self.assertRaises(OverflowError, getargs_l, VERY_LARGE) - - def test_n(self): - from _testcapi import getargs_n - # n returns 'Py_ssize_t', and does range checking - # (PY_SSIZE_T_MIN ... PY_SSIZE_T_MAX) - self.failUnlessEqual(3, getargs_n(3.14)) - self.failUnlessEqual(99, getargs_n(Long())) - self.failUnlessEqual(99, getargs_n(Int())) - - self.assertRaises(OverflowError, getargs_n, PY_SSIZE_T_MIN-1) - self.failUnlessEqual(PY_SSIZE_T_MIN, getargs_n(PY_SSIZE_T_MIN)) - self.failUnlessEqual(PY_SSIZE_T_MAX, getargs_n(PY_SSIZE_T_MAX)) - self.assertRaises(OverflowError, getargs_n, PY_SSIZE_T_MAX+1) - - self.failUnlessEqual(42, getargs_n(42)) - self.failUnlessEqual(42, getargs_n(42L)) - self.assertRaises(OverflowError, getargs_n, VERY_LARGE) - - -class LongLong_TestCase(unittest.TestCase): - def test_L(self): - from _testcapi import getargs_L - # L returns 'long long', and does range checking (LLONG_MIN ... LLONG_MAX) - self.failUnlessRaises(TypeError, getargs_L, "Hello") - self.failUnlessEqual(3, getargs_L(3.14)) - self.failUnlessEqual(99, getargs_L(Long())) - self.failUnlessEqual(99, getargs_L(Int())) - - self.assertRaises(OverflowError, getargs_L, LLONG_MIN-1) - self.failUnlessEqual(LLONG_MIN, getargs_L(LLONG_MIN)) - self.failUnlessEqual(LLONG_MAX, getargs_L(LLONG_MAX)) - self.assertRaises(OverflowError, getargs_L, LLONG_MAX+1) - - self.failUnlessEqual(42, getargs_L(42)) - self.failUnlessEqual(42, getargs_L(42L)) - self.assertRaises(OverflowError, getargs_L, VERY_LARGE) - - def test_K(self): - from _testcapi import getargs_K - # K return 'unsigned long long', no range checking - self.assertRaises(TypeError, getargs_K, 3.14) - self.assertRaises(TypeError, getargs_K, Long()) - self.assertRaises(TypeError, getargs_K, Int()) - self.failUnlessEqual(ULLONG_MAX, getargs_K(ULLONG_MAX)) - self.failUnlessEqual(0, getargs_K(0)) - self.failUnlessEqual(0, getargs_K(ULLONG_MAX+1)) - - self.failUnlessEqual(42, getargs_K(42)) - self.failUnlessEqual(42, getargs_K(42L)) - - self.failUnlessEqual(VERY_LARGE & ULLONG_MAX, getargs_K(VERY_LARGE)) - - -class Tuple_TestCase(unittest.TestCase): - def test_tuple(self): - from _testcapi import getargs_tuple - - ret = getargs_tuple(1, (2, 3)) - self.assertEquals(ret, (1,2,3)) - - # make sure invalid tuple arguments are handled correctly - class seq: - def __len__(self): - return 2 - def __getitem__(self, n): - raise ValueError - self.assertRaises(TypeError, getargs_tuple, 1, seq()) - - -def test_main(): - tests = [Signed_TestCase, Unsigned_TestCase, Tuple_TestCase] - try: - from _testcapi import getargs_L, getargs_K - except ImportError: - pass # PY_LONG_LONG not available - else: - tests.append(LongLong_TestCase) - test_support.run_unittest(*tests) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_getopt.py b/sys/lib/python/test/test_getopt.py deleted file mode 100644 index 9856a6a70..000000000 --- a/sys/lib/python/test/test_getopt.py +++ /dev/null @@ -1,180 +0,0 @@ -# test_getopt.py -# David Goodger 2000-08-19 - -import getopt -from getopt import GetoptError -from test.test_support import verify, verbose, run_doctest -import os - -def expectException(teststr, expected, failure=AssertionError): - """Executes a statement passed in teststr, and raises an exception - (failure) if the expected exception is *not* raised.""" - try: - exec teststr - except expected: - pass - else: - raise failure - -old_posixly_correct = os.environ.get("POSIXLY_CORRECT") -if old_posixly_correct is not None: - del os.environ["POSIXLY_CORRECT"] - -if verbose: - print 'Running tests on getopt.short_has_arg' -verify(getopt.short_has_arg('a', 'a:')) -verify(not getopt.short_has_arg('a', 'a')) -expectException("tmp = getopt.short_has_arg('a', 'b')", GetoptError) -expectException("tmp = getopt.short_has_arg('a', '')", GetoptError) - -if verbose: - print 'Running tests on getopt.long_has_args' -has_arg, option = getopt.long_has_args('abc', ['abc=']) -verify(has_arg) -verify(option == 'abc') -has_arg, option = getopt.long_has_args('abc', ['abc']) -verify(not has_arg) -verify(option == 'abc') -has_arg, option = getopt.long_has_args('abc', ['abcd']) -verify(not has_arg) -verify(option == 'abcd') -expectException("has_arg, option = getopt.long_has_args('abc', ['def'])", - GetoptError) -expectException("has_arg, option = getopt.long_has_args('abc', [])", - GetoptError) -expectException("has_arg, option = " + \ - "getopt.long_has_args('abc', ['abcd','abcde'])", - GetoptError) - -if verbose: - print 'Running tests on getopt.do_shorts' -opts, args = getopt.do_shorts([], 'a', 'a', []) -verify(opts == [('-a', '')]) -verify(args == []) -opts, args = getopt.do_shorts([], 'a1', 'a:', []) -verify(opts == [('-a', '1')]) -verify(args == []) -#opts, args = getopt.do_shorts([], 'a=1', 'a:', []) -#verify(opts == [('-a', '1')]) -#verify(args == []) -opts, args = getopt.do_shorts([], 'a', 'a:', ['1']) -verify(opts == [('-a', '1')]) -verify(args == []) -opts, args = getopt.do_shorts([], 'a', 'a:', ['1', '2']) -verify(opts == [('-a', '1')]) -verify(args == ['2']) -expectException("opts, args = getopt.do_shorts([], 'a1', 'a', [])", - GetoptError) -expectException("opts, args = getopt.do_shorts([], 'a', 'a:', [])", - GetoptError) - -if verbose: - print 'Running tests on getopt.do_longs' -opts, args = getopt.do_longs([], 'abc', ['abc'], []) -verify(opts == [('--abc', '')]) -verify(args == []) -opts, args = getopt.do_longs([], 'abc=1', ['abc='], []) -verify(opts == [('--abc', '1')]) -verify(args == []) -opts, args = getopt.do_longs([], 'abc=1', ['abcd='], []) -verify(opts == [('--abcd', '1')]) -verify(args == []) -opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], []) -verify(opts == [('--abc', '')]) -verify(args == []) -# Much like the preceding, except with a non-alpha character ("-") in -# option name that precedes "="; failed in -# http://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470 -opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], []) -verify(opts == [('--foo', '42')]) -verify(args == []) -expectException("opts, args = getopt.do_longs([], 'abc=1', ['abc'], [])", - GetoptError) -expectException("opts, args = getopt.do_longs([], 'abc', ['abc='], [])", - GetoptError) - -# note: the empty string between '-a' and '--beta' is significant: -# it simulates an empty string option argument ('-a ""') on the command line. -cmdline = ['-a', '1', '-b', '--alpha=2', '--beta', '-a', '3', '-a', '', - '--beta', 'arg1', 'arg2'] - -if verbose: - print 'Running tests on getopt.getopt' -opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta']) -verify(opts == [('-a', '1'), ('-b', ''), ('--alpha', '2'), ('--beta', ''), - ('-a', '3'), ('-a', ''), ('--beta', '')] ) -# Note ambiguity of ('-b', '') and ('-a', '') above. This must be -# accounted for in the code that calls getopt(). -verify(args == ['arg1', 'arg2']) - -expectException( - "opts, args = getopt.getopt(cmdline, 'a:b', ['alpha', 'beta'])", - GetoptError) - -# Test handling of GNU style scanning mode. -if verbose: - print 'Running tests on getopt.gnu_getopt' -cmdline = ['-a', 'arg1', '-b', '1', '--alpha', '--beta=2'] -# GNU style -opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) -verify(opts == [('-a', ''), ('-b', '1'), ('--alpha', ''), ('--beta', '2')]) -verify(args == ['arg1']) -# Posix style via + -opts, args = getopt.gnu_getopt(cmdline, '+ab:', ['alpha', 'beta=']) -verify(opts == [('-a', '')]) -verify(args == ['arg1', '-b', '1', '--alpha', '--beta=2']) -# Posix style via POSIXLY_CORRECT -os.environ["POSIXLY_CORRECT"] = "1" -opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) -verify(opts == [('-a', '')]) -verify(args == ['arg1', '-b', '1', '--alpha', '--beta=2']) - - -if old_posixly_correct is None: - del os.environ["POSIXLY_CORRECT"] -else: - os.environ["POSIXLY_CORRECT"] = old_posixly_correct - -#------------------------------------------------------------------------------ - -libreftest = """ -Examples from the Library Reference: Doc/lib/libgetopt.tex - -An example using only Unix style options: - - ->>> import getopt ->>> args = '-a -b -cfoo -d bar a1 a2'.split() ->>> args -['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2'] ->>> optlist, args = getopt.getopt(args, 'abc:d:') ->>> optlist -[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')] ->>> args -['a1', 'a2'] - -Using long option names is equally easy: - - ->>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' ->>> args = s.split() ->>> args -['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2'] ->>> optlist, args = getopt.getopt(args, 'x', [ -... 'condition=', 'output-file=', 'testing']) ->>> optlist -[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')] ->>> args -['a1', 'a2'] - -""" - -__test__ = {'libreftest' : libreftest} - -import sys -run_doctest(sys.modules[__name__], verbose) - -#------------------------------------------------------------------------------ - -if verbose: - print "Module getopt: tests completed successfully." diff --git a/sys/lib/python/test/test_gettext.py b/sys/lib/python/test/test_gettext.py deleted file mode 100644 index 76253dedf..000000000 --- a/sys/lib/python/test/test_gettext.py +++ /dev/null @@ -1,458 +0,0 @@ -import os -import base64 -import shutil -import gettext -import unittest - -from test.test_support import run_suite - - -# TODO: -# - Add new tests, for example for "dgettext" -# - Remove dummy tests, for example testing for single and double quotes -# has no sense, it would have if we were testing a parser (i.e. pygettext) -# - Tests should have only one assert. - -GNU_MO_DATA = '''\ -3hIElQAAAAAGAAAAHAAAAEwAAAALAAAAfAAAAAAAAACoAAAAFQAAAKkAAAAjAAAAvwAAAKEAAADj -AAAABwAAAIUBAAALAAAAjQEAAEUBAACZAQAAFgAAAN8CAAAeAAAA9gIAAKEAAAAVAwAABQAAALcD -AAAJAAAAvQMAAAEAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABQAAAAYAAAACAAAAAFJh -eW1vbmQgTHV4dXJ5IFlhY2gtdABUaGVyZSBpcyAlcyBmaWxlAFRoZXJlIGFyZSAlcyBmaWxlcwBU -aGlzIG1vZHVsZSBwcm92aWRlcyBpbnRlcm5hdGlvbmFsaXphdGlvbiBhbmQgbG9jYWxpemF0aW9u -CnN1cHBvcnQgZm9yIHlvdXIgUHl0aG9uIHByb2dyYW1zIGJ5IHByb3ZpZGluZyBhbiBpbnRlcmZh -Y2UgdG8gdGhlIEdOVQpnZXR0ZXh0IG1lc3NhZ2UgY2F0YWxvZyBsaWJyYXJ5LgBtdWxsdXNrAG51 -ZGdlIG51ZGdlAFByb2plY3QtSWQtVmVyc2lvbjogMi4wClBPLVJldmlzaW9uLURhdGU6IDIwMDAt -MDgtMjkgMTI6MTktMDQ6MDAKTGFzdC1UcmFuc2xhdG9yOiBKLiBEYXZpZCBJYsOhw7FleiA8ai1k -YXZpZEBub29zLmZyPgpMYW5ndWFnZS1UZWFtOiBYWCA8cHl0aG9uLWRldkBweXRob24ub3JnPgpN -SU1FLVZlcnNpb246IDEuMApDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9aXNvLTg4 -NTktMQpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBub25lCkdlbmVyYXRlZC1CeTogcHlnZXR0 -ZXh0LnB5IDEuMQpQbHVyYWwtRm9ybXM6IG5wbHVyYWxzPTI7IHBsdXJhbD1uIT0xOwoAVGhyb2F0 -d29iYmxlciBNYW5ncm92ZQBIYXkgJXMgZmljaGVybwBIYXkgJXMgZmljaGVyb3MAR3V2ZiB6YnFo -eXIgY2ViaXZxcmYgdmFncmVhbmd2YmFueXZtbmd2YmEgbmFxIHlicG55dm1uZ3ZiYQpmaGNjYmVn -IHNiZSBsYmhlIENsZ3ViYSBjZWJ0ZW56ZiBvbCBjZWJpdnF2YXQgbmEgdmFncmVzbnByIGdiIGd1 -ciBUQUgKdHJnZ3JrZyB6cmZmbnRyIHBuZ255YnQgeXZvZW5lbC4AYmFjb24Ad2luayB3aW5rAA== -''' - -UMO_DATA = '''\ -3hIElQAAAAACAAAAHAAAACwAAAAFAAAAPAAAAAAAAABQAAAABAAAAFEAAAAPAQAAVgAAAAQAAABm -AQAAAQAAAAIAAAAAAAAAAAAAAAAAAAAAYWLDngBQcm9qZWN0LUlkLVZlcnNpb246IDIuMApQTy1S -ZXZpc2lvbi1EYXRlOiAyMDAzLTA0LTExIDEyOjQyLTA0MDAKTGFzdC1UcmFuc2xhdG9yOiBCYXJy -eSBBLiBXQXJzYXcgPGJhcnJ5QHB5dGhvbi5vcmc+Ckxhbmd1YWdlLVRlYW06IFhYIDxweXRob24t -ZGV2QHB5dGhvbi5vcmc+Ck1JTUUtVmVyc2lvbjogMS4wCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFp -bjsgY2hhcnNldD11dGYtOApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA3Yml0CkdlbmVyYXRl -ZC1CeTogbWFudWFsbHkKAMKkeXoA -''' - -MMO_DATA = '''\ -3hIElQAAAAABAAAAHAAAACQAAAADAAAALAAAAAAAAAA4AAAAeAEAADkAAAABAAAAAAAAAAAAAAAA -UHJvamVjdC1JZC1WZXJzaW9uOiBObyBQcm9qZWN0IDAuMApQT1QtQ3JlYXRpb24tRGF0ZTogV2Vk -IERlYyAxMSAwNzo0NDoxNSAyMDAyClBPLVJldmlzaW9uLURhdGU6IDIwMDItMDgtMTQgMDE6MTg6 -NTgrMDA6MDAKTGFzdC1UcmFuc2xhdG9yOiBKb2huIERvZSA8amRvZUBleGFtcGxlLmNvbT4KSmFu -ZSBGb29iYXIgPGpmb29iYXJAZXhhbXBsZS5jb20+Ckxhbmd1YWdlLVRlYW06IHh4IDx4eEBleGFt -cGxlLmNvbT4KTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFy -c2V0PWlzby04ODU5LTE1CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IHF1b3RlZC1wcmludGFi -bGUKR2VuZXJhdGVkLUJ5OiBweWdldHRleHQucHkgMS4zCgA= -''' - -LOCALEDIR = os.path.join('xx', 'LC_MESSAGES') -MOFILE = os.path.join(LOCALEDIR, 'gettext.mo') -UMOFILE = os.path.join(LOCALEDIR, 'ugettext.mo') -MMOFILE = os.path.join(LOCALEDIR, 'metadata.mo') -try: - LANG = os.environ['LANGUAGE'] -except: - LANG = 'en' - - -class GettextBaseTest(unittest.TestCase): - def setUp(self): - if not os.path.isdir(LOCALEDIR): - os.makedirs(LOCALEDIR) - fp = open(MOFILE, 'wb') - fp.write(base64.decodestring(GNU_MO_DATA)) - fp.close() - fp = open(UMOFILE, 'wb') - fp.write(base64.decodestring(UMO_DATA)) - fp.close() - fp = open(MMOFILE, 'wb') - fp.write(base64.decodestring(MMO_DATA)) - fp.close() - os.environ['LANGUAGE'] = 'xx' - - def tearDown(self): - os.environ['LANGUAGE'] = LANG - shutil.rmtree(os.path.split(LOCALEDIR)[0]) - - -class GettextTestCase1(GettextBaseTest): - def setUp(self): - GettextBaseTest.setUp(self) - self.localedir = os.curdir - self.mofile = MOFILE - gettext.install('gettext', self.localedir) - - def test_some_translations(self): - eq = self.assertEqual - # test some translations - eq(_('albatross'), 'albatross') - eq(_(u'mullusk'), 'bacon') - eq(_(r'Raymond Luxury Yach-t'), 'Throatwobbler Mangrove') - eq(_(ur'nudge nudge'), 'wink wink') - - def test_double_quotes(self): - eq = self.assertEqual - # double quotes - eq(_("albatross"), 'albatross') - eq(_(u"mullusk"), 'bacon') - eq(_(r"Raymond Luxury Yach-t"), 'Throatwobbler Mangrove') - eq(_(ur"nudge nudge"), 'wink wink') - - def test_triple_single_quotes(self): - eq = self.assertEqual - # triple single quotes - eq(_('''albatross'''), 'albatross') - eq(_(u'''mullusk'''), 'bacon') - eq(_(r'''Raymond Luxury Yach-t'''), 'Throatwobbler Mangrove') - eq(_(ur'''nudge nudge'''), 'wink wink') - - def test_triple_double_quotes(self): - eq = self.assertEqual - # triple double quotes - eq(_("""albatross"""), 'albatross') - eq(_(u"""mullusk"""), 'bacon') - eq(_(r"""Raymond Luxury Yach-t"""), 'Throatwobbler Mangrove') - eq(_(ur"""nudge nudge"""), 'wink wink') - - def test_multiline_strings(self): - eq = self.assertEqual - # multiline strings - eq(_('''This module provides internationalization and localization -support for your Python programs by providing an interface to the GNU -gettext message catalog library.'''), - '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba -fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH -trggrkg zrffntr pngnybt yvoenel.''') - - def test_the_alternative_interface(self): - eq = self.assertEqual - # test the alternative interface - fp = open(self.mofile, 'rb') - t = gettext.GNUTranslations(fp) - fp.close() - # Install the translation object - t.install() - eq(_('nudge nudge'), 'wink wink') - # Try unicode return type - t.install(unicode=True) - eq(_('mullusk'), 'bacon') - # Test installation of other methods - import __builtin__ - t.install(unicode=True, names=["gettext", "lgettext"]) - eq(_, t.ugettext) - eq(__builtin__.gettext, t.ugettext) - eq(lgettext, t.lgettext) - del __builtin__.gettext - del __builtin__.lgettext - - -class GettextTestCase2(GettextBaseTest): - def setUp(self): - GettextBaseTest.setUp(self) - self.localedir = os.curdir - # Set up the bindings - gettext.bindtextdomain('gettext', self.localedir) - gettext.textdomain('gettext') - # For convenience - self._ = gettext.gettext - - def test_bindtextdomain(self): - self.assertEqual(gettext.bindtextdomain('gettext'), self.localedir) - - def test_textdomain(self): - self.assertEqual(gettext.textdomain(), 'gettext') - - def test_some_translations(self): - eq = self.assertEqual - # test some translations - eq(self._('albatross'), 'albatross') - eq(self._(u'mullusk'), 'bacon') - eq(self._(r'Raymond Luxury Yach-t'), 'Throatwobbler Mangrove') - eq(self._(ur'nudge nudge'), 'wink wink') - - def test_double_quotes(self): - eq = self.assertEqual - # double quotes - eq(self._("albatross"), 'albatross') - eq(self._(u"mullusk"), 'bacon') - eq(self._(r"Raymond Luxury Yach-t"), 'Throatwobbler Mangrove') - eq(self._(ur"nudge nudge"), 'wink wink') - - def test_triple_single_quotes(self): - eq = self.assertEqual - # triple single quotes - eq(self._('''albatross'''), 'albatross') - eq(self._(u'''mullusk'''), 'bacon') - eq(self._(r'''Raymond Luxury Yach-t'''), 'Throatwobbler Mangrove') - eq(self._(ur'''nudge nudge'''), 'wink wink') - - def test_triple_double_quotes(self): - eq = self.assertEqual - # triple double quotes - eq(self._("""albatross"""), 'albatross') - eq(self._(u"""mullusk"""), 'bacon') - eq(self._(r"""Raymond Luxury Yach-t"""), 'Throatwobbler Mangrove') - eq(self._(ur"""nudge nudge"""), 'wink wink') - - def test_multiline_strings(self): - eq = self.assertEqual - # multiline strings - eq(self._('''This module provides internationalization and localization -support for your Python programs by providing an interface to the GNU -gettext message catalog library.'''), - '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba -fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH -trggrkg zrffntr pngnybt yvoenel.''') - - -class PluralFormsTestCase(GettextBaseTest): - def setUp(self): - GettextBaseTest.setUp(self) - self.mofile = MOFILE - - def test_plural_forms1(self): - eq = self.assertEqual - x = gettext.ngettext('There is %s file', 'There are %s files', 1) - eq(x, 'Hay %s fichero') - x = gettext.ngettext('There is %s file', 'There are %s files', 2) - eq(x, 'Hay %s ficheros') - - def test_plural_forms2(self): - eq = self.assertEqual - fp = open(self.mofile, 'rb') - t = gettext.GNUTranslations(fp) - fp.close() - x = t.ngettext('There is %s file', 'There are %s files', 1) - eq(x, 'Hay %s fichero') - x = t.ngettext('There is %s file', 'There are %s files', 2) - eq(x, 'Hay %s ficheros') - - def test_hu(self): - eq = self.assertEqual - f = gettext.c2py('0') - s = ''.join([ str(f(x)) for x in range(200) ]) - eq(s, "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") - - def test_de(self): - eq = self.assertEqual - f = gettext.c2py('n != 1') - s = ''.join([ str(f(x)) for x in range(200) ]) - eq(s, "10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111") - - def test_fr(self): - eq = self.assertEqual - f = gettext.c2py('n>1') - s = ''.join([ str(f(x)) for x in range(200) ]) - eq(s, "00111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111") - - def test_gd(self): - eq = self.assertEqual - f = gettext.c2py('n==1 ? 0 : n==2 ? 1 : 2') - s = ''.join([ str(f(x)) for x in range(200) ]) - eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222") - - def test_gd2(self): - eq = self.assertEqual - # Tests the combination of parentheses and "?:" - f = gettext.c2py('n==1 ? 0 : (n==2 ? 1 : 2)') - s = ''.join([ str(f(x)) for x in range(200) ]) - eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222") - - def test_lt(self): - eq = self.assertEqual - f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2') - s = ''.join([ str(f(x)) for x in range(200) ]) - eq(s, "20111111112222222222201111111120111111112011111111201111111120111111112011111111201111111120111111112011111111222222222220111111112011111111201111111120111111112011111111201111111120111111112011111111") - - def test_ru(self): - eq = self.assertEqual - f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') - s = ''.join([ str(f(x)) for x in range(200) ]) - eq(s, "20111222222222222222201112222220111222222011122222201112222220111222222011122222201112222220111222222011122222222222222220111222222011122222201112222220111222222011122222201112222220111222222011122222") - - def test_pl(self): - eq = self.assertEqual - f = gettext.c2py('n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') - s = ''.join([ str(f(x)) for x in range(200) ]) - eq(s, "20111222222222222222221112222222111222222211122222221112222222111222222211122222221112222222111222222211122222222222222222111222222211122222221112222222111222222211122222221112222222111222222211122222") - - def test_sl(self): - eq = self.assertEqual - f = gettext.c2py('n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3') - s = ''.join([ str(f(x)) for x in range(200) ]) - eq(s, "30122333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333012233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333") - - def test_security(self): - raises = self.assertRaises - # Test for a dangerous expression - raises(ValueError, gettext.c2py, "os.chmod('/etc/passwd',0777)") - - -class UnicodeTranslationsTest(GettextBaseTest): - def setUp(self): - GettextBaseTest.setUp(self) - fp = open(UMOFILE, 'rb') - try: - self.t = gettext.GNUTranslations(fp) - finally: - fp.close() - self._ = self.t.ugettext - - def test_unicode_msgid(self): - unless = self.failUnless - unless(isinstance(self._(''), unicode)) - unless(isinstance(self._(u''), unicode)) - - def test_unicode_msgstr(self): - eq = self.assertEqual - eq(self._(u'ab\xde'), u'\xa4yz') - - -class WeirdMetadataTest(GettextBaseTest): - def setUp(self): - GettextBaseTest.setUp(self) - fp = open(MMOFILE, 'rb') - try: - try: - self.t = gettext.GNUTranslations(fp) - except: - self.tearDown() - raise - finally: - fp.close() - - def test_weird_metadata(self): - info = self.t.info() - self.assertEqual(info['last-translator'], - 'John Doe \nJane Foobar ') - - -def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(GettextTestCase1)) - suite.addTest(unittest.makeSuite(GettextTestCase2)) - suite.addTest(unittest.makeSuite(PluralFormsTestCase)) - suite.addTest(unittest.makeSuite(UnicodeTranslationsTest)) - suite.addTest(unittest.makeSuite(WeirdMetadataTest)) - return suite - - -def test_main(): - run_suite(suite()) - - -if __name__ == '__main__': - test_main() - - -# For reference, here's the .po file used to created the GNU_MO_DATA above. -# -# The original version was automatically generated from the sources with -# pygettext. Later it was manually modified to add plural forms support. - -''' -# Dummy translation for the Python test_gettext.py module. -# Copyright (C) 2001 Python Software Foundation -# Barry Warsaw , 2000. -# -msgid "" -msgstr "" -"Project-Id-Version: 2.0\n" -"PO-Revision-Date: 2003-04-11 14:32-0400\n" -"Last-Translator: J. David Ibanez \n" -"Language-Team: XX \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: pygettext.py 1.1\n" -"Plural-Forms: nplurals=2; plural=n!=1;\n" - -#: test_gettext.py:19 test_gettext.py:25 test_gettext.py:31 test_gettext.py:37 -#: test_gettext.py:51 test_gettext.py:80 test_gettext.py:86 test_gettext.py:92 -#: test_gettext.py:98 -msgid "nudge nudge" -msgstr "wink wink" - -#: test_gettext.py:16 test_gettext.py:22 test_gettext.py:28 test_gettext.py:34 -#: test_gettext.py:77 test_gettext.py:83 test_gettext.py:89 test_gettext.py:95 -msgid "albatross" -msgstr "" - -#: test_gettext.py:18 test_gettext.py:24 test_gettext.py:30 test_gettext.py:36 -#: test_gettext.py:79 test_gettext.py:85 test_gettext.py:91 test_gettext.py:97 -msgid "Raymond Luxury Yach-t" -msgstr "Throatwobbler Mangrove" - -#: test_gettext.py:17 test_gettext.py:23 test_gettext.py:29 test_gettext.py:35 -#: test_gettext.py:56 test_gettext.py:78 test_gettext.py:84 test_gettext.py:90 -#: test_gettext.py:96 -msgid "mullusk" -msgstr "bacon" - -#: test_gettext.py:40 test_gettext.py:101 -msgid "" -"This module provides internationalization and localization\n" -"support for your Python programs by providing an interface to the GNU\n" -"gettext message catalog library." -msgstr "" -"Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba\n" -"fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH\n" -"trggrkg zrffntr pngnybt yvoenel." - -# Manually added, as neither pygettext nor xgettext support plural forms -# in Python. -msgid "There is %s file" -msgid_plural "There are %s files" -msgstr[0] "Hay %s fichero" -msgstr[1] "Hay %s ficheros" -''' - -# Here's the second example po file example, used to generate the UMO_DATA -# containing utf-8 encoded Unicode strings - -''' -# Dummy translation for the Python test_gettext.py module. -# Copyright (C) 2001 Python Software Foundation -# Barry Warsaw , 2000. -# -msgid "" -msgstr "" -"Project-Id-Version: 2.0\n" -"PO-Revision-Date: 2003-04-11 12:42-0400\n" -"Last-Translator: Barry A. WArsaw \n" -"Language-Team: XX \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 7bit\n" -"Generated-By: manually\n" - -#: nofile:0 -msgid "ab\xc3\x9e" -msgstr "\xc2\xa4yz" -''' - -# Here's the third example po file, used to generate MMO_DATA - -''' -msgid "" -msgstr "" -"Project-Id-Version: No Project 0.0\n" -"POT-Creation-Date: Wed Dec 11 07:44:15 2002\n" -"PO-Revision-Date: 2002-08-14 01:18:58+00:00\n" -"Last-Translator: John Doe \n" -"Jane Foobar \n" -"Language-Team: xx \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-15\n" -"Content-Transfer-Encoding: quoted-printable\n" -"Generated-By: pygettext.py 1.3\n" -''' diff --git a/sys/lib/python/test/test_gl.py b/sys/lib/python/test/test_gl.py deleted file mode 100755 index c9cce7760..000000000 --- a/sys/lib/python/test/test_gl.py +++ /dev/null @@ -1,150 +0,0 @@ -#! /usr/bin/env python -"""Very simple test script for the SGI gl library extension module - taken mostly from the documentation. - Roger E. Masse -""" -from test.test_support import verbose, TestSkipped -import gl, GL, time - -glattrs = ['RGBcolor', 'RGBcursor', 'RGBmode', 'RGBrange', 'RGBwritemask', -'__doc__', '__name__', 'addtopup', 'altgetmatrix', 'arc', 'arcf', -'arcfi', 'arcfs', 'arci', 'arcs', 'attachcursor', 'backbuffer', -'backface', 'bbox2', 'bbox2i', 'bbox2s', 'bgnclosedline', 'bgnline', -'bgnpoint', 'bgnpolygon', 'bgnsurface', 'bgntmesh', 'bgntrim', -'blankscreen', 'blanktime', 'blendfunction', 'blink', 'c3f', 'c3i', -'c3s', 'c4f', 'c4i', 'c4s', 'callobj', 'charstr', 'chunksize', 'circ', -'circf', 'circfi', 'circfs', 'circi', 'circs', 'clear', -'clearhitcode', 'clkoff', 'clkon', 'closeobj', 'cmode', 'cmov', -'cmov2', 'cmov2i', 'cmov2s', 'cmovi', 'cmovs', 'color', 'colorf', -'compactify', 'concave', 'cpack', 'crv', 'crvn', 'curorigin', -'cursoff', 'curson', 'curstype', 'curvebasis', 'curveit', -'curveprecision', 'cyclemap', 'czclear', 'defbasis', 'defcursor', -'deflinestyle', 'delobj', 'deltag', 'depthcue', 'devport', 'dglclose', -'dglopen', 'dither', 'dopup', 'doublebuffer', 'draw', 'draw2', -'draw2i', 'draw2s', 'drawi', 'drawmode', 'draws', 'editobj', -'endclosedline', 'endfullscrn', 'endline', 'endpick', 'endpoint', -'endpolygon', 'endpupmode', 'endselect', 'endsurface', 'endtmesh', -'endtrim', 'finish', 'font', 'foreground', 'freepup', 'frontbuffer', -'fudge', 'fullscrn', 'gRGBcolor', 'gRGBmask', 'gammaramp', 'gbegin', -'gconfig', 'genobj', 'gentag', 'getbackface', 'getbuffer', -'getbutton', 'getcmmode', 'getcolor', 'getcpos', 'getcursor', -'getdcm', 'getdepth', 'getdescender', 'getdisplaymode', 'getdrawmode', -'getfont', 'getgdesc', 'getgpos', 'getheight', 'gethitcode', -'getlsbackup', 'getlsrepeat', 'getlstyle', 'getlwidth', 'getmap', -'getmatrix', 'getmcolor', 'getmmode', 'getmonitor', -'getnurbsproperty', 'getopenobj', 'getorigin', 'getothermonitor', -'getpattern', 'getplanes', 'getport', 'getresetls', 'getscrmask', -'getshade', 'getsize', 'getsm', 'gettp', 'getvaluator', 'getvideo', -'getviewport', 'getwritemask', 'getzbuffer', 'gewrite', 'gflush', -'ginit', 'glcompat', 'greset', 'gselect', 'gsync', 'gversion', -'iconsize', 'icontitle', 'imakebackground', 'initnames', 'ismex', -'isobj', 'isqueued', 'istag', 'keepaspect', 'lRGBrange', 'lampoff', -'lampon', 'linesmooth', 'linewidth', 'lmbind', 'lmcolor', 'lmdef', -'loadmatrix', 'loadname', 'logicop', 'lookat', 'lrectread', -'lrectwrite', 'lsbackup', 'lsetdepth', 'lshaderange', 'lsrepeat', -'makeobj', 'maketag', 'mapcolor', 'mapw', 'mapw2', 'maxsize', -'minsize', 'mmode', 'move', 'move2', 'move2i', 'move2s', 'movei', -'moves', 'multimap', 'multmatrix', 'n3f', 'newpup', 'newtag', -'noborder', 'noise', 'noport', 'normal', 'nurbscurve', 'nurbssurface', -'nvarray', 'objdelete', 'objinsert', 'objreplace', 'onemap', 'ortho', -'ortho2', 'overlay', 'packrect', 'pagecolor', 'pagewritemask', -'passthrough', 'patch', 'patchbasis', 'patchcurves', 'patchprecision', -'pclos', 'pdr', 'pdr2', 'pdr2i', 'pdr2s', 'pdri', 'pdrs', -'perspective', 'pick', 'picksize', 'pixmode', 'pmv', 'pmv2', 'pmv2i', -'pmv2s', 'pmvi', 'pmvs', 'pnt', 'pnt2', 'pnt2i', 'pnt2s', 'pnti', -'pnts', 'pntsmooth', 'polarview', 'polf', 'polf2', 'polf2i', 'polf2s', -'polfi', 'polfs', 'poly', 'poly2', 'poly2i', 'poly2s', 'polyi', -'polys', 'popattributes', 'popmatrix', 'popname', 'popviewport', -'prefposition', 'prefsize', 'pupmode', 'pushattributes', 'pushmatrix', -'pushname', 'pushviewport', 'pwlcurve', 'qdevice', 'qenter', 'qgetfd', -'qread', 'qreset', 'qtest', 'rcrv', 'rcrvn', 'rdr', 'rdr2', 'rdr2i', -'rdr2s', 'rdri', 'rdrs', 'readdisplay', 'readsource', 'rect', -'rectcopy', 'rectf', 'rectfi', 'rectfs', 'recti', 'rects', 'rectzoom', -'resetls', 'reshapeviewport', 'ringbell', 'rmv', 'rmv2', 'rmv2i', -'rmv2s', 'rmvi', 'rmvs', 'rot', 'rotate', 'rpatch', 'rpdr', 'rpdr2', -'rpdr2i', 'rpdr2s', 'rpdri', 'rpdrs', 'rpmv', 'rpmv2', 'rpmv2i', -'rpmv2s', 'rpmvi', 'rpmvs', 'sbox', 'sboxf', 'sboxfi', 'sboxfs', -'sboxi', 'sboxs', 'scale', 'screenspace', 'scrmask', 'setbell', -'setcursor', 'setdepth', 'setlinestyle', 'setmap', 'setmonitor', -'setnurbsproperty', 'setpattern', 'setpup', 'setshade', 'setvaluator', -'setvideo', 'shademodel', 'shaderange', 'singlebuffer', 'smoothline', -'spclos', 'splf', 'splf2', 'splf2i', 'splf2s', 'splfi', 'splfs', -'stepunit', 'strwidth', 'subpixel', 'swapbuffers', 'swapinterval', -'swaptmesh', 'swinopen', 'textcolor', 'textinit', 'textport', -'textwritemask', 'tie', 'tpoff', 'tpon', 'translate', 'underlay', -'unpackrect', 'unqdevice', 'v2d', 'v2f', 'v2i', 'v2s', 'v3d', 'v3f', -'v3i', 'v3s', 'v4d', 'v4f', 'v4i', 'v4s', 'varray', 'videocmd', -'viewport', 'vnarray', 'winattach', 'winclose', 'winconstraints', -'windepth', 'window', 'winget', 'winmove', 'winopen', 'winpop', -'winposition', 'winpush', 'winset', 'wintitle', 'wmpack', 'writemask', -'writepixels', 'xfpt', 'xfpt2', 'xfpt2i', 'xfpt2s', 'xfpt4', 'xfpt4i', -'xfpt4s', 'xfpti', 'xfpts', 'zbuffer', 'zclear', 'zdraw', 'zfunction', -'zsource', 'zwritemask'] - -def main(): - # insure that we at least have an X display before continuing. - import os - try: - display = os.environ['DISPLAY'] - except: - raise TestSkipped, "No $DISPLAY -- skipping gl test" - - # touch all the attributes of gl without doing anything - if verbose: - print 'Touching gl module attributes...' - for attr in glattrs: - if verbose: - print 'touching: ', attr - getattr(gl, attr) - - # create a small 'Crisscross' window - if verbose: - print 'Creating a small "CrissCross" window...' - print 'foreground' - gl.foreground() - if verbose: - print 'prefposition' - gl.prefposition(500, 900, 500, 900) - if verbose: - print 'winopen "CrissCross"' - w = gl.winopen('CrissCross') - if verbose: - print 'clear' - gl.clear() - if verbose: - print 'ortho2' - gl.ortho2(0.0, 400.0, 0.0, 400.0) - if verbose: - print 'color WHITE' - gl.color(GL.WHITE) - if verbose: - print 'color RED' - gl.color(GL.RED) - if verbose: - print 'bgnline' - gl.bgnline() - if verbose: - print 'v2f' - gl.v2f(0.0, 0.0) - gl.v2f(400.0, 400.0) - if verbose: - print 'endline' - gl.endline() - if verbose: - print 'bgnline' - gl.bgnline() - if verbose: - print 'v2i' - gl.v2i(400, 0) - gl.v2i(0, 400) - if verbose: - print 'endline' - gl.endline() - if verbose: - print 'Displaying window for 2 seconds...' - time.sleep(2) - if verbose: - print 'winclose' - gl.winclose(w) - -main() diff --git a/sys/lib/python/test/test_glob.py b/sys/lib/python/test/test_glob.py deleted file mode 100644 index 5ce09f9d1..000000000 --- a/sys/lib/python/test/test_glob.py +++ /dev/null @@ -1,104 +0,0 @@ -import unittest -from test.test_support import run_unittest, TESTFN -import glob -import os -import shutil - -class GlobTests(unittest.TestCase): - - def norm(self, *parts): - return os.path.normpath(os.path.join(self.tempdir, *parts)) - - def mktemp(self, *parts): - filename = self.norm(*parts) - base, file = os.path.split(filename) - if not os.path.exists(base): - os.makedirs(base) - f = open(filename, 'w') - f.close() - - def setUp(self): - self.tempdir = TESTFN+"_dir" - self.mktemp('a', 'D') - self.mktemp('aab', 'F') - self.mktemp('aaa', 'zzzF') - self.mktemp('ZZZ') - self.mktemp('a', 'bcd', 'EF') - self.mktemp('a', 'bcd', 'efg', 'ha') - if hasattr(os, 'symlink'): - os.symlink(self.norm('broken'), self.norm('sym1')) - os.symlink(self.norm('broken'), self.norm('sym2')) - - def tearDown(self): - shutil.rmtree(self.tempdir) - - def glob(self, *parts): - if len(parts) == 1: - pattern = parts[0] - else: - pattern = os.path.join(*parts) - p = os.path.join(self.tempdir, pattern) - res = glob.glob(p) - self.assertEqual(list(glob.iglob(p)), res) - return res - - def assertSequencesEqual_noorder(self, l1, l2): - self.assertEqual(set(l1), set(l2)) - - def test_glob_literal(self): - eq = self.assertSequencesEqual_noorder - eq(self.glob('a'), [self.norm('a')]) - eq(self.glob('a', 'D'), [self.norm('a', 'D')]) - eq(self.glob('aab'), [self.norm('aab')]) - eq(self.glob('zymurgy'), []) - - def test_glob_one_directory(self): - eq = self.assertSequencesEqual_noorder - eq(self.glob('a*'), map(self.norm, ['a', 'aab', 'aaa'])) - eq(self.glob('*a'), map(self.norm, ['a', 'aaa'])) - eq(self.glob('aa?'), map(self.norm, ['aaa', 'aab'])) - eq(self.glob('aa[ab]'), map(self.norm, ['aaa', 'aab'])) - eq(self.glob('*q'), []) - - def test_glob_nested_directory(self): - eq = self.assertSequencesEqual_noorder - if os.path.normcase("abCD") == "abCD": - # case-sensitive filesystem - eq(self.glob('a', 'bcd', 'E*'), [self.norm('a', 'bcd', 'EF')]) - else: - # case insensitive filesystem - eq(self.glob('a', 'bcd', 'E*'), [self.norm('a', 'bcd', 'EF'), - self.norm('a', 'bcd', 'efg')]) - eq(self.glob('a', 'bcd', '*g'), [self.norm('a', 'bcd', 'efg')]) - - def test_glob_directory_names(self): - eq = self.assertSequencesEqual_noorder - eq(self.glob('*', 'D'), [self.norm('a', 'D')]) - eq(self.glob('*', '*a'), []) - eq(self.glob('a', '*', '*', '*a'), - [self.norm('a', 'bcd', 'efg', 'ha')]) - eq(self.glob('?a?', '*F'), map(self.norm, [os.path.join('aaa', 'zzzF'), - os.path.join('aab', 'F')])) - - def test_glob_directory_with_trailing_slash(self): - # We are verifying that when there is wildcard pattern which - # ends with os.sep doesn't blow up. - res = glob.glob(self.tempdir + '*' + os.sep) - self.assertEqual(len(res), 1) - # either of these results are reasonable - self.assertTrue(res[0] in [self.tempdir, self.tempdir + os.sep]) - - def test_glob_broken_symlinks(self): - if hasattr(os, 'symlink'): - eq = self.assertSequencesEqual_noorder - eq(self.glob('sym*'), [self.norm('sym1'), self.norm('sym2')]) - eq(self.glob('sym1'), [self.norm('sym1')]) - eq(self.glob('sym2'), [self.norm('sym2')]) - - -def test_main(): - run_unittest(GlobTests) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_global.py b/sys/lib/python/test/test_global.py deleted file mode 100644 index 4cc953cd3..000000000 --- a/sys/lib/python/test/test_global.py +++ /dev/null @@ -1,51 +0,0 @@ -"""Verify that warnings are issued for global statements following use.""" - -from test.test_support import check_syntax - -import warnings - -warnings.filterwarnings("error", module="") - -def compile_and_check(text, should_fail=1): - try: - compile(text, "", "exec") - except SyntaxError, msg: - if should_fail: - print "got SyntaxError as expected" - else: - print "raised unexpected SyntaxError:", text - else: - if should_fail: - print "should have raised SyntaxError:", text - else: - print "as expected, no SyntaxError" - -prog_text_1 = """ -def wrong1(): - a = 1 - b = 2 - global a - global b -""" -compile_and_check(prog_text_1) - -prog_text_2 = """ -def wrong2(): - print x - global x -""" -compile_and_check(prog_text_2) - -prog_text_3 = """ -def wrong3(): - print x - x = 2 - global x -""" -compile_and_check(prog_text_3) - -prog_text_4 = """ -global x -x = 2 -""" -compile_and_check(prog_text_4, 0) diff --git a/sys/lib/python/test/test_grammar.py b/sys/lib/python/test/test_grammar.py deleted file mode 100644 index 76483f676..000000000 --- a/sys/lib/python/test/test_grammar.py +++ /dev/null @@ -1,856 +0,0 @@ -# Python test set -- part 1, grammar. -# This just tests whether the parser accepts them all. - -# NOTE: When you run this test as a script from the command line, you -# get warnings about certain hex/oct constants. Since those are -# issued by the parser, you can't suppress them by adding a -# filterwarnings() call to this module. Therefore, to shut up the -# regression test, the filterwarnings() call has been added to -# regrtest.py. - -from test.test_support import TestFailed, verify, vereq, check_syntax -import sys - -print '1. Parser' - -print '1.1 Tokens' - -print '1.1.1 Backslashes' - -# Backslash means line continuation: -x = 1 \ -+ 1 -if x != 2: raise TestFailed, 'backslash for line continuation' - -# Backslash does not means continuation in comments :\ -x = 0 -if x != 0: raise TestFailed, 'backslash ending comment' - -print '1.1.2 Numeric literals' - -print '1.1.2.1 Plain integers' -if 0xff != 255: raise TestFailed, 'hex int' -if 0377 != 255: raise TestFailed, 'octal int' -if 2147483647 != 017777777777: raise TestFailed, 'large positive int' -try: - from sys import maxint -except ImportError: - maxint = 2147483647 -if maxint == 2147483647: - # The following test will start to fail in Python 2.4; - # change the 020000000000 to -020000000000 - if -2147483647-1 != -020000000000: raise TestFailed, 'max negative int' - # XXX -2147483648 - if 037777777777 < 0: raise TestFailed, 'large oct' - if 0xffffffff < 0: raise TestFailed, 'large hex' - for s in '2147483648', '040000000000', '0x100000000': - try: - x = eval(s) - except OverflowError: - print "OverflowError on huge integer literal " + repr(s) -elif eval('maxint == 9223372036854775807'): - if eval('-9223372036854775807-1 != -01000000000000000000000'): - raise TestFailed, 'max negative int' - if eval('01777777777777777777777') < 0: raise TestFailed, 'large oct' - if eval('0xffffffffffffffff') < 0: raise TestFailed, 'large hex' - for s in '9223372036854775808', '02000000000000000000000', \ - '0x10000000000000000': - try: - x = eval(s) - except OverflowError: - print "OverflowError on huge integer literal " + repr(s) -else: - print 'Weird maxint value', maxint - -print '1.1.2.2 Long integers' -x = 0L -x = 0l -x = 0xffffffffffffffffL -x = 0xffffffffffffffffl -x = 077777777777777777L -x = 077777777777777777l -x = 123456789012345678901234567890L -x = 123456789012345678901234567890l - -print '1.1.2.3 Floating point' -x = 3.14 -x = 314. -x = 0.314 -# XXX x = 000.314 -x = .314 -x = 3e14 -x = 3E14 -x = 3e-14 -x = 3e+14 -x = 3.e14 -x = .3e14 -x = 3.1e4 - -print '1.1.3 String literals' - -x = ''; y = ""; verify(len(x) == 0 and x == y) -x = '\''; y = "'"; verify(len(x) == 1 and x == y and ord(x) == 39) -x = '"'; y = "\""; verify(len(x) == 1 and x == y and ord(x) == 34) -x = "doesn't \"shrink\" does it" -y = 'doesn\'t "shrink" does it' -verify(len(x) == 24 and x == y) -x = "does \"shrink\" doesn't it" -y = 'does "shrink" doesn\'t it' -verify(len(x) == 24 and x == y) -x = """ -The "quick" -brown fox -jumps over -the 'lazy' dog. -""" -y = '\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n' -verify(x == y) -y = ''' -The "quick" -brown fox -jumps over -the 'lazy' dog. -'''; verify(x == y) -y = "\n\ -The \"quick\"\n\ -brown fox\n\ -jumps over\n\ -the 'lazy' dog.\n\ -"; verify(x == y) -y = '\n\ -The \"quick\"\n\ -brown fox\n\ -jumps over\n\ -the \'lazy\' dog.\n\ -'; verify(x == y) - - -print '1.2 Grammar' - -print 'single_input' # NEWLINE | simple_stmt | compound_stmt NEWLINE -# XXX can't test in a script -- this rule is only used when interactive - -print 'file_input' # (NEWLINE | stmt)* ENDMARKER -# Being tested as this very moment this very module - -print 'expr_input' # testlist NEWLINE -# XXX Hard to test -- used only in calls to input() - -print 'eval_input' # testlist ENDMARKER -x = eval('1, 0 or 1') - -print 'funcdef' -### 'def' NAME parameters ':' suite -### parameters: '(' [varargslist] ')' -### varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME] -### | ('**'|'*' '*') NAME) -### | fpdef ['=' test] (',' fpdef ['=' test])* [','] -### fpdef: NAME | '(' fplist ')' -### fplist: fpdef (',' fpdef)* [','] -### arglist: (argument ',')* (argument | *' test [',' '**' test] | '**' test) -### argument: [test '='] test # Really [keyword '='] test -def f1(): pass -f1() -f1(*()) -f1(*(), **{}) -def f2(one_argument): pass -def f3(two, arguments): pass -def f4(two, (compound, (argument, list))): pass -def f5((compound, first), two): pass -vereq(f2.func_code.co_varnames, ('one_argument',)) -vereq(f3.func_code.co_varnames, ('two', 'arguments')) -if sys.platform.startswith('java'): - vereq(f4.func_code.co_varnames, - ('two', '(compound, (argument, list))', 'compound', 'argument', - 'list',)) - vereq(f5.func_code.co_varnames, - ('(compound, first)', 'two', 'compound', 'first')) -else: - vereq(f4.func_code.co_varnames, - ('two', '.1', 'compound', 'argument', 'list')) - vereq(f5.func_code.co_varnames, - ('.0', 'two', 'compound', 'first')) -def a1(one_arg,): pass -def a2(two, args,): pass -def v0(*rest): pass -def v1(a, *rest): pass -def v2(a, b, *rest): pass -def v3(a, (b, c), *rest): return a, b, c, rest -# ceval unpacks the formal arguments into the first argcount names; -# thus, the names nested inside tuples must appear after these names. -if sys.platform.startswith('java'): - verify(v3.func_code.co_varnames == ('a', '(b, c)', 'rest', 'b', 'c')) -else: - vereq(v3.func_code.co_varnames, ('a', '.1', 'rest', 'b', 'c')) -verify(v3(1, (2, 3), 4) == (1, 2, 3, (4,))) -def d01(a=1): pass -d01() -d01(1) -d01(*(1,)) -d01(**{'a':2}) -def d11(a, b=1): pass -d11(1) -d11(1, 2) -d11(1, **{'b':2}) -def d21(a, b, c=1): pass -d21(1, 2) -d21(1, 2, 3) -d21(*(1, 2, 3)) -d21(1, *(2, 3)) -d21(1, 2, *(3,)) -d21(1, 2, **{'c':3}) -def d02(a=1, b=2): pass -d02() -d02(1) -d02(1, 2) -d02(*(1, 2)) -d02(1, *(2,)) -d02(1, **{'b':2}) -d02(**{'a': 1, 'b': 2}) -def d12(a, b=1, c=2): pass -d12(1) -d12(1, 2) -d12(1, 2, 3) -def d22(a, b, c=1, d=2): pass -d22(1, 2) -d22(1, 2, 3) -d22(1, 2, 3, 4) -def d01v(a=1, *rest): pass -d01v() -d01v(1) -d01v(1, 2) -d01v(*(1, 2, 3, 4)) -d01v(*(1,)) -d01v(**{'a':2}) -def d11v(a, b=1, *rest): pass -d11v(1) -d11v(1, 2) -d11v(1, 2, 3) -def d21v(a, b, c=1, *rest): pass -d21v(1, 2) -d21v(1, 2, 3) -d21v(1, 2, 3, 4) -d21v(*(1, 2, 3, 4)) -d21v(1, 2, **{'c': 3}) -def d02v(a=1, b=2, *rest): pass -d02v() -d02v(1) -d02v(1, 2) -d02v(1, 2, 3) -d02v(1, *(2, 3, 4)) -d02v(**{'a': 1, 'b': 2}) -def d12v(a, b=1, c=2, *rest): pass -d12v(1) -d12v(1, 2) -d12v(1, 2, 3) -d12v(1, 2, 3, 4) -d12v(*(1, 2, 3, 4)) -d12v(1, 2, *(3, 4, 5)) -d12v(1, *(2,), **{'c': 3}) -def d22v(a, b, c=1, d=2, *rest): pass -d22v(1, 2) -d22v(1, 2, 3) -d22v(1, 2, 3, 4) -d22v(1, 2, 3, 4, 5) -d22v(*(1, 2, 3, 4)) -d22v(1, 2, *(3, 4, 5)) -d22v(1, *(2, 3), **{'d': 4}) -def d31v((x)): pass -d31v(1) -def d32v((x,)): pass -d32v((1,)) - -### lambdef: 'lambda' [varargslist] ':' test -print 'lambdef' -l1 = lambda : 0 -verify(l1() == 0) -l2 = lambda : a[d] # XXX just testing the expression -l3 = lambda : [2 < x for x in [-1, 3, 0L]] -verify(l3() == [0, 1, 0]) -l4 = lambda x = lambda y = lambda z=1 : z : y() : x() -verify(l4() == 1) -l5 = lambda x, y, z=2: x + y + z -verify(l5(1, 2) == 5) -verify(l5(1, 2, 3) == 6) -check_syntax("lambda x: x = 2") - -### stmt: simple_stmt | compound_stmt -# Tested below - -### simple_stmt: small_stmt (';' small_stmt)* [';'] -print 'simple_stmt' -x = 1; pass; del x -def foo(): - # verify statments that end with semi-colons - x = 1; pass; del x; -foo() - -### small_stmt: expr_stmt | print_stmt | pass_stmt | del_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt -# Tested below - -print 'expr_stmt' # (exprlist '=')* exprlist -1 -1, 2, 3 -x = 1 -x = 1, 2, 3 -x = y = z = 1, 2, 3 -x, y, z = 1, 2, 3 -abc = a, b, c = x, y, z = xyz = 1, 2, (3, 4) -# NB these variables are deleted below - -check_syntax("x + 1 = 1") -check_syntax("a + 1 = b + 2") - -print 'print_stmt' # 'print' (test ',')* [test] -print 1, 2, 3 -print 1, 2, 3, -print -print 0 or 1, 0 or 1, -print 0 or 1 - -print 'extended print_stmt' # 'print' '>>' test ',' -import sys -print >> sys.stdout, 1, 2, 3 -print >> sys.stdout, 1, 2, 3, -print >> sys.stdout -print >> sys.stdout, 0 or 1, 0 or 1, -print >> sys.stdout, 0 or 1 - -# test printing to an instance -class Gulp: - def write(self, msg): pass - -gulp = Gulp() -print >> gulp, 1, 2, 3 -print >> gulp, 1, 2, 3, -print >> gulp -print >> gulp, 0 or 1, 0 or 1, -print >> gulp, 0 or 1 - -# test print >> None -def driver(): - oldstdout = sys.stdout - sys.stdout = Gulp() - try: - tellme(Gulp()) - tellme() - finally: - sys.stdout = oldstdout - -# we should see this once -def tellme(file=sys.stdout): - print >> file, 'hello world' - -driver() - -# we should not see this at all -def tellme(file=None): - print >> file, 'goodbye universe' - -driver() - -# syntax errors -check_syntax('print ,') -check_syntax('print >> x,') - -print 'del_stmt' # 'del' exprlist -del abc -del x, y, (z, xyz) - -print 'pass_stmt' # 'pass' -pass - -print 'flow_stmt' # break_stmt | continue_stmt | return_stmt | raise_stmt -# Tested below - -print 'break_stmt' # 'break' -while 1: break - -print 'continue_stmt' # 'continue' -i = 1 -while i: i = 0; continue - -msg = "" -while not msg: - msg = "continue + try/except ok" - try: - continue - msg = "continue failed to continue inside try" - except: - msg = "continue inside try called except block" -print msg - -msg = "" -while not msg: - msg = "finally block not called" - try: - continue - finally: - msg = "continue + try/finally ok" -print msg - - -# This test warrants an explanation. It is a test specifically for SF bugs -# #463359 and #462937. The bug is that a 'break' statement executed or -# exception raised inside a try/except inside a loop, *after* a continue -# statement has been executed in that loop, will cause the wrong number of -# arguments to be popped off the stack and the instruction pointer reset to -# a very small number (usually 0.) Because of this, the following test -# *must* written as a function, and the tracking vars *must* be function -# arguments with default values. Otherwise, the test will loop and loop. - -print "testing continue and break in try/except in loop" -def test_break_continue_loop(extra_burning_oil = 1, count=0): - big_hippo = 2 - while big_hippo: - count += 1 - try: - if extra_burning_oil and big_hippo == 1: - extra_burning_oil -= 1 - break - big_hippo -= 1 - continue - except: - raise - if count > 2 or big_hippo <> 1: - print "continue then break in try/except in loop broken!" -test_break_continue_loop() - -print 'return_stmt' # 'return' [testlist] -def g1(): return -def g2(): return 1 -g1() -x = g2() -check_syntax("class foo:return 1") - -print 'yield_stmt' -check_syntax("class foo:yield 1") - -print 'raise_stmt' # 'raise' test [',' test] -try: raise RuntimeError, 'just testing' -except RuntimeError: pass -try: raise KeyboardInterrupt -except KeyboardInterrupt: pass - -print 'import_name' # 'import' dotted_as_names -import sys -import time, sys -print 'import_from' # 'from' dotted_name 'import' ('*' | '(' import_as_names ')' | import_as_names) -from time import time -from time import (time) -from sys import * -from sys import path, argv -from sys import (path, argv) -from sys import (path, argv,) - -print 'global_stmt' # 'global' NAME (',' NAME)* -def f(): - global a - global a, b - global one, two, three, four, five, six, seven, eight, nine, ten - -print 'exec_stmt' # 'exec' expr ['in' expr [',' expr]] -def f(): - z = None - del z - exec 'z=1+1\n' - if z != 2: raise TestFailed, 'exec \'z=1+1\'\\n' - del z - exec 'z=1+1' - if z != 2: raise TestFailed, 'exec \'z=1+1\'' - z = None - del z - import types - if hasattr(types, "UnicodeType"): - exec r"""if 1: - exec u'z=1+1\n' - if z != 2: raise TestFailed, 'exec u\'z=1+1\'\\n' - del z - exec u'z=1+1' - if z != 2: raise TestFailed, 'exec u\'z=1+1\'' -""" -f() -g = {} -exec 'z = 1' in g -if g.has_key('__builtins__'): del g['__builtins__'] -if g != {'z': 1}: raise TestFailed, 'exec \'z = 1\' in g' -g = {} -l = {} - -import warnings -warnings.filterwarnings("ignore", "global statement", module="") -exec 'global a; a = 1; b = 2' in g, l -if g.has_key('__builtins__'): del g['__builtins__'] -if l.has_key('__builtins__'): del l['__builtins__'] -if (g, l) != ({'a':1}, {'b':2}): raise TestFailed, 'exec ... in g (%s), l (%s)' %(g,l) - - -print "assert_stmt" # assert_stmt: 'assert' test [',' test] -assert 1 -assert 1, 1 -assert lambda x:x -assert 1, lambda x:x+1 - -### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef -# Tested below - -print 'if_stmt' # 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] -if 1: pass -if 1: pass -else: pass -if 0: pass -elif 0: pass -if 0: pass -elif 0: pass -elif 0: pass -elif 0: pass -else: pass - -print 'while_stmt' # 'while' test ':' suite ['else' ':' suite] -while 0: pass -while 0: pass -else: pass - -print 'for_stmt' # 'for' exprlist 'in' exprlist ':' suite ['else' ':' suite] -for i in 1, 2, 3: pass -for i, j, k in (): pass -else: pass -class Squares: - def __init__(self, max): - self.max = max - self.sofar = [] - def __len__(self): return len(self.sofar) - def __getitem__(self, i): - if not 0 <= i < self.max: raise IndexError - n = len(self.sofar) - while n <= i: - self.sofar.append(n*n) - n = n+1 - return self.sofar[i] -n = 0 -for x in Squares(10): n = n+x -if n != 285: raise TestFailed, 'for over growing sequence' - -result = [] -for x, in [(1,), (2,), (3,)]: - result.append(x) -vereq(result, [1, 2, 3]) - -print 'try_stmt' -### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] -### | 'try' ':' suite 'finally' ':' suite -### except_clause: 'except' [expr [',' expr]] -try: - 1/0 -except ZeroDivisionError: - pass -else: - pass -try: 1/0 -except EOFError: pass -except TypeError, msg: pass -except RuntimeError, msg: pass -except: pass -else: pass -try: 1/0 -except (EOFError, TypeError, ZeroDivisionError): pass -try: 1/0 -except (EOFError, TypeError, ZeroDivisionError), msg: pass -try: pass -finally: pass - -print 'suite' # simple_stmt | NEWLINE INDENT NEWLINE* (stmt NEWLINE*)+ DEDENT -if 1: pass -if 1: - pass -if 1: - # - # - # - pass - pass - # - pass - # - -print 'test' -### and_test ('or' and_test)* -### and_test: not_test ('and' not_test)* -### not_test: 'not' not_test | comparison -if not 1: pass -if 1 and 1: pass -if 1 or 1: pass -if not not not 1: pass -if not 1 and 1 and 1: pass -if 1 and 1 or 1 and 1 and 1 or not 1 and 1: pass - -print 'comparison' -### comparison: expr (comp_op expr)* -### comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not' -if 1: pass -x = (1 == 1) -if 1 == 1: pass -if 1 != 1: pass -if 1 <> 1: pass -if 1 < 1: pass -if 1 > 1: pass -if 1 <= 1: pass -if 1 >= 1: pass -if 1 is 1: pass -if 1 is not 1: pass -if 1 in (): pass -if 1 not in (): pass -if 1 < 1 > 1 == 1 >= 1 <= 1 <> 1 != 1 in 1 not in 1 is 1 is not 1: pass - -print 'binary mask ops' -x = 1 & 1 -x = 1 ^ 1 -x = 1 | 1 - -print 'shift ops' -x = 1 << 1 -x = 1 >> 1 -x = 1 << 1 >> 1 - -print 'additive ops' -x = 1 -x = 1 + 1 -x = 1 - 1 - 1 -x = 1 - 1 + 1 - 1 + 1 - -print 'multiplicative ops' -x = 1 * 1 -x = 1 / 1 -x = 1 % 1 -x = 1 / 1 * 1 % 1 - -print 'unary ops' -x = +1 -x = -1 -x = ~1 -x = ~1 ^ 1 & 1 | 1 & 1 ^ -1 -x = -1*1/1 + 1*1 - ---1*1 - -print 'selectors' -### trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME -### subscript: expr | [expr] ':' [expr] -f1() -f2(1) -f2(1,) -f3(1, 2) -f3(1, 2,) -f4(1, (2, (3, 4))) -v0() -v0(1) -v0(1,) -v0(1,2) -v0(1,2,3,4,5,6,7,8,9,0) -v1(1) -v1(1,) -v1(1,2) -v1(1,2,3) -v1(1,2,3,4,5,6,7,8,9,0) -v2(1,2) -v2(1,2,3) -v2(1,2,3,4) -v2(1,2,3,4,5,6,7,8,9,0) -v3(1,(2,3)) -v3(1,(2,3),4) -v3(1,(2,3),4,5,6,7,8,9,0) -print -import sys, time -c = sys.path[0] -x = time.time() -x = sys.modules['time'].time() -a = '01234' -c = a[0] -c = a[-1] -s = a[0:5] -s = a[:5] -s = a[0:] -s = a[:] -s = a[-5:] -s = a[:-1] -s = a[-4:-3] -# A rough test of SF bug 1333982. http://python.org/sf/1333982 -# The testing here is fairly incomplete. -# Test cases should include: commas with 1 and 2 colons -d = {} -d[1] = 1 -d[1,] = 2 -d[1,2] = 3 -d[1,2,3] = 4 -L = list(d) -L.sort() -print L - - -print 'atoms' -### atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING -### dictmaker: test ':' test (',' test ':' test)* [','] - -x = (1) -x = (1 or 2 or 3) -x = (1 or 2 or 3, 2, 3) - -x = [] -x = [1] -x = [1 or 2 or 3] -x = [1 or 2 or 3, 2, 3] -x = [] - -x = {} -x = {'one': 1} -x = {'one': 1,} -x = {'one' or 'two': 1 or 2} -x = {'one': 1, 'two': 2} -x = {'one': 1, 'two': 2,} -x = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6} - -x = `x` -x = `1 or 2 or 3` -x = `1,2` -x = x -x = 'x' -x = 123 - -### exprlist: expr (',' expr)* [','] -### testlist: test (',' test)* [','] -# These have been exercised enough above - -print 'classdef' # 'class' NAME ['(' [testlist] ')'] ':' suite -class B: pass -class B2(): pass -class C1(B): pass -class C2(B): pass -class D(C1, C2, B): pass -class C: - def meth1(self): pass - def meth2(self, arg): pass - def meth3(self, a1, a2): pass - -# list comprehension tests -nums = [1, 2, 3, 4, 5] -strs = ["Apple", "Banana", "Coconut"] -spcs = [" Apple", " Banana ", "Coco nut "] - -print [s.strip() for s in spcs] -print [3 * x for x in nums] -print [x for x in nums if x > 2] -print [(i, s) for i in nums for s in strs] -print [(i, s) for i in nums for s in [f for f in strs if "n" in f]] -print [(lambda a:[a**i for i in range(a+1)])(j) for j in range(5)] - -def test_in_func(l): - return [None < x < 3 for x in l if x > 2] - -print test_in_func(nums) - -def test_nested_front(): - print [[y for y in [x, x + 1]] for x in [1,3,5]] - -test_nested_front() - -check_syntax("[i, s for i in nums for s in strs]") -check_syntax("[x if y]") - -suppliers = [ - (1, "Boeing"), - (2, "Ford"), - (3, "Macdonalds") -] - -parts = [ - (10, "Airliner"), - (20, "Engine"), - (30, "Cheeseburger") -] - -suppart = [ - (1, 10), (1, 20), (2, 20), (3, 30) -] - -print [ - (sname, pname) - for (sno, sname) in suppliers - for (pno, pname) in parts - for (sp_sno, sp_pno) in suppart - if sno == sp_sno and pno == sp_pno -] - -# generator expression tests -g = ([x for x in range(10)] for x in range(1)) -verify(g.next() == [x for x in range(10)]) -try: - g.next() - raise TestFailed, 'should produce StopIteration exception' -except StopIteration: - pass - -a = 1 -try: - g = (a for d in a) - g.next() - raise TestFailed, 'should produce TypeError' -except TypeError: - pass - -verify(list((x, y) for x in 'abcd' for y in 'abcd') == [(x, y) for x in 'abcd' for y in 'abcd']) -verify(list((x, y) for x in 'ab' for y in 'xy') == [(x, y) for x in 'ab' for y in 'xy']) - -a = [x for x in range(10)] -b = (x for x in (y for y in a)) -verify(sum(b) == sum([x for x in range(10)])) - -verify(sum(x**2 for x in range(10)) == sum([x**2 for x in range(10)])) -verify(sum(x*x for x in range(10) if x%2) == sum([x*x for x in range(10) if x%2])) -verify(sum(x for x in (y for y in range(10))) == sum([x for x in range(10)])) -verify(sum(x for x in (y for y in (z for z in range(10)))) == sum([x for x in range(10)])) -verify(sum(x for x in [y for y in (z for z in range(10))]) == sum([x for x in range(10)])) -verify(sum(x for x in (y for y in (z for z in range(10) if True)) if True) == sum([x for x in range(10)])) -verify(sum(x for x in (y for y in (z for z in range(10) if True) if False) if True) == 0) -check_syntax("foo(x for x in range(10), 100)") -check_syntax("foo(100, x for x in range(10))") - -# test for outmost iterable precomputation -x = 10; g = (i for i in range(x)); x = 5 -verify(len(list(g)) == 10) - -# This should hold, since we're only precomputing outmost iterable. -x = 10; t = False; g = ((i,j) for i in range(x) if t for j in range(x)) -x = 5; t = True; -verify([(i,j) for i in range(10) for j in range(5)] == list(g)) - -# Grammar allows multiple adjacent 'if's in listcomps and genexps, -# even though it's silly. Make sure it works (ifelse broke this.) -verify([ x for x in range(10) if x % 2 if x % 3 ], [1, 5, 7]) -verify((x for x in range(10) if x % 2 if x % 3), [1, 5, 7]) - -# Verify unpacking single element tuples in listcomp/genexp. -vereq([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) -vereq(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) - -# Test ifelse expressions in various cases -def _checkeval(msg, ret): - "helper to check that evaluation of expressions is done correctly" - print x - return ret - -verify([ x() for x in lambda: True, lambda: False if x() ] == [True]) -verify([ x() for x in (lambda: True, lambda: False) if x() ] == [True]) -verify([ x(False) for x in (lambda x: False if x else True, lambda x: True if x else False) if x(False) ] == [True]) -verify((5 if 1 else _checkeval("check 1", 0)) == 5) -verify((_checkeval("check 2", 0) if 0 else 5) == 5) -verify((5 and 6 if 0 else 1) == 1) -verify(((5 and 6) if 0 else 1) == 1) -verify((5 and (6 if 1 else 1)) == 6) -verify((0 or _checkeval("check 3", 2) if 0 else 3) == 3) -verify((1 or _checkeval("check 4", 2) if 1 else _checkeval("check 5", 3)) == 1) -verify((0 or 5 if 1 else _checkeval("check 6", 3)) == 5) -verify((not 5 if 1 else 1) == False) -verify((not 5 if 0 else 1) == 1) -verify((6 + 1 if 1 else 2) == 7) -verify((6 - 1 if 1 else 2) == 5) -verify((6 * 2 if 1 else 4) == 12) -verify((6 / 2 if 1 else 3) == 3) -verify((6 < 4 if 0 else 2) == 2) diff --git a/sys/lib/python/test/test_grp.py b/sys/lib/python/test/test_grp.py deleted file mode 100755 index 08958ba07..000000000 --- a/sys/lib/python/test/test_grp.py +++ /dev/null @@ -1,89 +0,0 @@ -"""Test script for the grp module.""" - -import grp -import unittest -from test import test_support - -class GroupDatabaseTestCase(unittest.TestCase): - - def check_value(self, value): - # check that a grp tuple has the entries and - # attributes promised by the docs - self.assertEqual(len(value), 4) - self.assertEqual(value[0], value.gr_name) - self.assert_(isinstance(value.gr_name, basestring)) - self.assertEqual(value[1], value.gr_passwd) - self.assert_(isinstance(value.gr_passwd, basestring)) - self.assertEqual(value[2], value.gr_gid) - self.assert_(isinstance(value.gr_gid, int)) - self.assertEqual(value[3], value.gr_mem) - self.assert_(isinstance(value.gr_mem, list)) - - def test_values(self): - entries = grp.getgrall() - - for e in entries: - self.check_value(e) - - for e in entries: - e2 = grp.getgrgid(e.gr_gid) - self.check_value(e2) - self.assertEqual(e2.gr_gid, e.gr_gid) - e2 = grp.getgrnam(e.gr_name) - self.check_value(e2) - # There are instances where getgrall() returns group names in - # lowercase while getgrgid() returns proper casing. - # Discovered on Ubuntu 5.04 (custom). - self.assertEqual(e2.gr_name.lower(), e.gr_name.lower()) - - def test_errors(self): - self.assertRaises(TypeError, grp.getgrgid) - self.assertRaises(TypeError, grp.getgrnam) - self.assertRaises(TypeError, grp.getgrall, 42) - - # try to get some errors - bynames = {} - bygids = {} - for (n, p, g, mem) in grp.getgrall(): - if not n or n == '+': - continue # skip NIS entries etc. - bynames[n] = g - bygids[g] = n - - allnames = bynames.keys() - namei = 0 - fakename = allnames[namei] - while fakename in bynames: - chars = map(None, fakename) - for i in xrange(len(chars)): - if chars[i] == 'z': - chars[i] = 'A' - break - elif chars[i] == 'Z': - continue - else: - chars[i] = chr(ord(chars[i]) + 1) - break - else: - namei = namei + 1 - try: - fakename = allnames[namei] - except IndexError: - # should never happen... if so, just forget it - break - fakename = ''.join(map(None, chars)) - - self.assertRaises(KeyError, grp.getgrnam, fakename) - - # Choose a non-existent gid. - fakegid = 4127 - while fakegid in bygids: - fakegid = (fakegid * 3) % 0x10000 - - self.assertRaises(KeyError, grp.getgrgid, fakegid) - -def test_main(): - test_support.run_unittest(GroupDatabaseTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_gzip.py b/sys/lib/python/test/test_gzip.py deleted file mode 100644 index 0f8e03e0a..000000000 --- a/sys/lib/python/test/test_gzip.py +++ /dev/null @@ -1,149 +0,0 @@ -#! /usr/bin/env python -"""Test script for the gzip module. -""" - -import unittest -from test import test_support -import sys, os -import gzip - - -data1 = """ int length=DEFAULTALLOC, err = Z_OK; - PyObject *RetVal; - int flushmode = Z_FINISH; - unsigned long start_total_out; - -""" - -data2 = """/* zlibmodule.c -- gzip-compatible data compression */ -/* See http://www.gzip.org/zlib/ -/* See http://www.winimage.com/zLibDll for Windows */ -""" - - -class TestGzip(unittest.TestCase): - filename = test_support.TESTFN - - def setUp (self): - pass - - def tearDown (self): - try: - os.unlink(self.filename) - except os.error: - pass - - - def test_write (self): - f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) - - # Try flush and fileno. - f.flush() - f.fileno() - if hasattr(os, 'fsync'): - os.fsync(f.fileno()) - f.close() - - def test_read(self): - self.test_write() - # Try reading. - f = gzip.GzipFile(self.filename, 'r') ; d = f.read() ; f.close() - self.assertEqual(d, data1*50) - - def test_append(self): - self.test_write() - # Append to the previous file - f = gzip.GzipFile(self.filename, 'ab') ; f.write(data2 * 15) ; f.close() - - f = gzip.GzipFile(self.filename, 'rb') ; d = f.read() ; f.close() - self.assertEqual(d, (data1*50) + (data2*15)) - - def test_many_append(self): - # Bug #1074261 was triggered when reading a file that contained - # many, many members. Create such a file and verify that reading it - # works. - f = gzip.open(self.filename, 'wb', 9) - f.write('a') - f.close() - for i in range(0,200): - f = gzip.open(self.filename, "ab", 9) # append - f.write('a') - f.close() - - # Try reading the file - zgfile = gzip.open(self.filename, "rb") - contents = "" - while 1: - ztxt = zgfile.read(8192) - contents += ztxt - if not ztxt: break - zgfile.close() - self.assertEquals(contents, 'a'*201) - - - def test_readline(self): - self.test_write() - # Try .readline() with varying line lengths - - f = gzip.GzipFile(self.filename, 'rb') - line_length = 0 - while 1: - L = f.readline(line_length) - if L == "" and line_length != 0: break - self.assert_(len(L) <= line_length) - line_length = (line_length + 1) % 50 - f.close() - - def test_readlines(self): - self.test_write() - # Try .readlines() - - f = gzip.GzipFile(self.filename, 'rb') - L = f.readlines() - f.close() - - f = gzip.GzipFile(self.filename, 'rb') - while 1: - L = f.readlines(150) - if L == []: break - f.close() - - def test_seek_read(self): - self.test_write() - # Try seek, read test - - f = gzip.GzipFile(self.filename) - while 1: - oldpos = f.tell() - line1 = f.readline() - if not line1: break - newpos = f.tell() - f.seek(oldpos) # negative seek - if len(line1)>10: - amount = 10 - else: - amount = len(line1) - line2 = f.read(amount) - self.assertEqual(line1[:amount], line2) - f.seek(newpos) # positive seek - f.close() - - def test_seek_write(self): - # Try seek, write test - f = gzip.GzipFile(self.filename, 'w') - for pos in range(0, 256, 16): - f.seek(pos) - f.write('GZ\n') - f.close() - - def test_mode(self): - self.test_write() - f = gzip.GzipFile(self.filename, 'r') - self.assertEqual(f.myfileobj.mode, 'rb') - f.close() - -def test_main(verbose=None): - test_support.run_unittest(TestGzip) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_hash.py b/sys/lib/python/test/test_hash.py deleted file mode 100644 index 3d6c9d1b6..000000000 --- a/sys/lib/python/test/test_hash.py +++ /dev/null @@ -1,36 +0,0 @@ -# test the invariant that -# iff a==b then hash(a)==hash(b) -# - -import unittest -from test import test_support - - -class HashEqualityTestCase(unittest.TestCase): - - def same_hash(self, *objlist): - # Hash each object given and fail if - # the hash values are not all the same. - hashed = map(hash, objlist) - for h in hashed[1:]: - if h != hashed[0]: - self.fail("hashed values differ: %r" % (objlist,)) - - def test_numeric_literals(self): - self.same_hash(1, 1L, 1.0, 1.0+0.0j) - - def test_coerced_integers(self): - self.same_hash(int(1), long(1), float(1), complex(1), - int('1'), float('1.0')) - - def test_coerced_floats(self): - self.same_hash(long(1.23e300), float(1.23e300)) - self.same_hash(float(0.5), complex(0.5, 0.0)) - - -def test_main(): - test_support.run_unittest(HashEqualityTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_hashlib.py b/sys/lib/python/test/test_hashlib.py deleted file mode 100644 index c7a18a754..000000000 --- a/sys/lib/python/test/test_hashlib.py +++ /dev/null @@ -1,191 +0,0 @@ -# Test hashlib module -# -# $Id: test_hashlib.py 39316 2005-08-21 18:45:59Z greg $ -# -# Copyright (C) 2005 Gregory P. Smith (greg@electricrain.com) -# Licensed to PSF under a Contributor Agreement. -# - -import hashlib -import unittest -from test import test_support - - -def hexstr(s): - import string - h = string.hexdigits - r = '' - for c in s: - i = ord(c) - r = r + h[(i >> 4) & 0xF] + h[i & 0xF] - return r - - -class HashLibTestCase(unittest.TestCase): - supported_hash_names = ( 'md5', 'MD5', 'sha1', 'SHA1', - 'sha224', 'SHA224', 'sha256', 'SHA256', - 'sha384', 'SHA384', 'sha512', 'SHA512' ) - - def test_unknown_hash(self): - try: - hashlib.new('spam spam spam spam spam') - except ValueError: - pass - else: - self.assert_(0 == "hashlib didn't reject bogus hash name") - - def test_hexdigest(self): - for name in self.supported_hash_names: - h = hashlib.new(name) - self.assert_(hexstr(h.digest()) == h.hexdigest()) - - - def test_large_update(self): - aas = 'a' * 128 - bees = 'b' * 127 - cees = 'c' * 126 - - for name in self.supported_hash_names: - m1 = hashlib.new(name) - m1.update(aas) - m1.update(bees) - m1.update(cees) - - m2 = hashlib.new(name) - m2.update(aas + bees + cees) - self.assertEqual(m1.digest(), m2.digest()) - - - def check(self, name, data, digest): - # test the direct constructors - computed = getattr(hashlib, name)(data).hexdigest() - self.assert_(computed == digest) - # test the general new() interface - computed = hashlib.new(name, data).hexdigest() - self.assert_(computed == digest) - - - def test_case_md5_0(self): - self.check('md5', '', 'd41d8cd98f00b204e9800998ecf8427e') - - def test_case_md5_1(self): - self.check('md5', 'abc', '900150983cd24fb0d6963f7d28e17f72') - - def test_case_md5_2(self): - self.check('md5', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', - 'd174ab98d277d9f5a5611c2c9f419d9f') - - - # use the three examples from Federal Information Processing Standards - # Publication 180-1, Secure Hash Standard, 1995 April 17 - # http://www.itl.nist.gov/div897/pubs/fip180-1.htm - - def test_case_sha1_0(self): - self.check('sha1', "", - "da39a3ee5e6b4b0d3255bfef95601890afd80709") - - def test_case_sha1_1(self): - self.check('sha1', "abc", - "a9993e364706816aba3e25717850c26c9cd0d89d") - - def test_case_sha1_2(self): - self.check('sha1', "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "84983e441c3bd26ebaae4aa1f95129e5e54670f1") - - def test_case_sha1_3(self): - self.check('sha1', "a" * 1000000, - "34aa973cd4c4daa4f61eeb2bdbad27316534016f") - - - # use the examples from Federal Information Processing Standards - # Publication 180-2, Secure Hash Standard, 2002 August 1 - # http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf - - def test_case_sha224_0(self): - self.check('sha224', "", - "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f") - - def test_case_sha224_1(self): - self.check('sha224', "abc", - "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7") - - def test_case_sha224_2(self): - self.check('sha224', - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525") - - def test_case_sha224_3(self): - self.check('sha224', "a" * 1000000, - "20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67") - - - def test_case_sha256_0(self): - self.check('sha256', "", - "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") - - def test_case_sha256_1(self): - self.check('sha256', "abc", - "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad") - - def test_case_sha256_2(self): - self.check('sha256', - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1") - - def test_case_sha256_3(self): - self.check('sha256', "a" * 1000000, - "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0") - - - def test_case_sha384_0(self): - self.check('sha384', "", - "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da"+ - "274edebfe76f65fbd51ad2f14898b95b") - - def test_case_sha384_1(self): - self.check('sha384', "abc", - "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed"+ - "8086072ba1e7cc2358baeca134c825a7") - - def test_case_sha384_2(self): - self.check('sha384', - "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"+ - "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", - "09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712"+ - "fcc7c71a557e2db966c3e9fa91746039") - - def test_case_sha384_3(self): - self.check('sha384', "a" * 1000000, - "9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b"+ - "07b8b3dc38ecc4ebae97ddd87f3d8985") - - - def test_case_sha512_0(self): - self.check('sha512', "", - "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce"+ - "47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e") - - def test_case_sha512_1(self): - self.check('sha512', "abc", - "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a"+ - "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f") - - def test_case_sha512_2(self): - self.check('sha512', - "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"+ - "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", - "8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018"+ - "501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909") - - def test_case_sha512_3(self): - self.check('sha512', "a" * 1000000, - "e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973eb"+ - "de0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b") - - -def test_main(): - test_support.run_unittest(HashLibTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_heapq.py b/sys/lib/python/test/test_heapq.py deleted file mode 100644 index e9f27982b..000000000 --- a/sys/lib/python/test/test_heapq.py +++ /dev/null @@ -1,286 +0,0 @@ -"""Unittests for heapq.""" - -from heapq import heappush, heappop, heapify, heapreplace, nlargest, nsmallest -import random -import unittest -from test import test_support -import sys - - -def heapiter(heap): - # An iterator returning a heap's elements, smallest-first. - try: - while 1: - yield heappop(heap) - except IndexError: - pass - -class TestHeap(unittest.TestCase): - - def test_push_pop(self): - # 1) Push 256 random numbers and pop them off, verifying all's OK. - heap = [] - data = [] - self.check_invariant(heap) - for i in range(256): - item = random.random() - data.append(item) - heappush(heap, item) - self.check_invariant(heap) - results = [] - while heap: - item = heappop(heap) - self.check_invariant(heap) - results.append(item) - data_sorted = data[:] - data_sorted.sort() - self.assertEqual(data_sorted, results) - # 2) Check that the invariant holds for a sorted array - self.check_invariant(results) - - self.assertRaises(TypeError, heappush, []) - try: - self.assertRaises(TypeError, heappush, None, None) - self.assertRaises(TypeError, heappop, None) - except AttributeError: - pass - - def check_invariant(self, heap): - # Check the heap invariant. - for pos, item in enumerate(heap): - if pos: # pos 0 has no parent - parentpos = (pos-1) >> 1 - self.assert_(heap[parentpos] <= item) - - def test_heapify(self): - for size in range(30): - heap = [random.random() for dummy in range(size)] - heapify(heap) - self.check_invariant(heap) - - self.assertRaises(TypeError, heapify, None) - - def test_naive_nbest(self): - data = [random.randrange(2000) for i in range(1000)] - heap = [] - for item in data: - heappush(heap, item) - if len(heap) > 10: - heappop(heap) - heap.sort() - self.assertEqual(heap, sorted(data)[-10:]) - - def test_nbest(self): - # Less-naive "N-best" algorithm, much faster (if len(data) is big - # enough ) than sorting all of data. However, if we had a max - # heap instead of a min heap, it could go faster still via - # heapify'ing all of data (linear time), then doing 10 heappops - # (10 log-time steps). - data = [random.randrange(2000) for i in range(1000)] - heap = data[:10] - heapify(heap) - for item in data[10:]: - if item > heap[0]: # this gets rarer the longer we run - heapreplace(heap, item) - self.assertEqual(list(heapiter(heap)), sorted(data)[-10:]) - - self.assertRaises(TypeError, heapreplace, None) - self.assertRaises(TypeError, heapreplace, None, None) - self.assertRaises(IndexError, heapreplace, [], None) - - def test_heapsort(self): - # Exercise everything with repeated heapsort checks - for trial in xrange(100): - size = random.randrange(50) - data = [random.randrange(25) for i in range(size)] - if trial & 1: # Half of the time, use heapify - heap = data[:] - heapify(heap) - else: # The rest of the time, use heappush - heap = [] - for item in data: - heappush(heap, item) - heap_sorted = [heappop(heap) for i in range(size)] - self.assertEqual(heap_sorted, sorted(data)) - - def test_nsmallest(self): - data = [(random.randrange(2000), i) for i in range(1000)] - for f in (None, lambda x: x[0] * 547 % 2000): - for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): - self.assertEqual(nsmallest(n, data), sorted(data)[:n]) - self.assertEqual(nsmallest(n, data, key=f), - sorted(data, key=f)[:n]) - - def test_nlargest(self): - data = [(random.randrange(2000), i) for i in range(1000)] - for f in (None, lambda x: x[0] * 547 % 2000): - for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): - self.assertEqual(nlargest(n, data), sorted(data, reverse=True)[:n]) - self.assertEqual(nlargest(n, data, key=f), - sorted(data, key=f, reverse=True)[:n]) - - -#============================================================================== - -class LenOnly: - "Dummy sequence class defining __len__ but not __getitem__." - def __len__(self): - return 10 - -class GetOnly: - "Dummy sequence class defining __getitem__ but not __len__." - def __getitem__(self, ndx): - return 10 - -class CmpErr: - "Dummy element that always raises an error during comparison" - def __cmp__(self, other): - raise ZeroDivisionError - -def R(seqn): - 'Regular generator' - for i in seqn: - yield i - -class G: - 'Sequence using __getitem__' - def __init__(self, seqn): - self.seqn = seqn - def __getitem__(self, i): - return self.seqn[i] - -class I: - 'Sequence using iterator protocol' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class Ig: - 'Sequence using iterator protocol defined with a generator' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - for val in self.seqn: - yield val - -class X: - 'Missing __getitem__ and __iter__' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class N: - 'Iterator missing next()' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - -class E: - 'Test propagation of exceptions' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - 3 // 0 - -class S: - 'Test immediate stop' - def __init__(self, seqn): - pass - def __iter__(self): - return self - def next(self): - raise StopIteration - -from itertools import chain, imap -def L(seqn): - 'Test multiple tiers of iterators' - return chain(imap(lambda x:x, R(Ig(G(seqn))))) - -class TestErrorHandling(unittest.TestCase): - - def test_non_sequence(self): - for f in (heapify, heappop): - self.assertRaises(TypeError, f, 10) - for f in (heappush, heapreplace, nlargest, nsmallest): - self.assertRaises(TypeError, f, 10, 10) - - def test_len_only(self): - for f in (heapify, heappop): - self.assertRaises(TypeError, f, LenOnly()) - for f in (heappush, heapreplace): - self.assertRaises(TypeError, f, LenOnly(), 10) - for f in (nlargest, nsmallest): - self.assertRaises(TypeError, f, 2, LenOnly()) - - def test_get_only(self): - for f in (heapify, heappop): - self.assertRaises(TypeError, f, GetOnly()) - for f in (heappush, heapreplace): - self.assertRaises(TypeError, f, GetOnly(), 10) - for f in (nlargest, nsmallest): - self.assertRaises(TypeError, f, 2, GetOnly()) - - def test_get_only(self): - seq = [CmpErr(), CmpErr(), CmpErr()] - for f in (heapify, heappop): - self.assertRaises(ZeroDivisionError, f, seq) - for f in (heappush, heapreplace): - self.assertRaises(ZeroDivisionError, f, seq, 10) - for f in (nlargest, nsmallest): - self.assertRaises(ZeroDivisionError, f, 2, seq) - - def test_arg_parsing(self): - for f in (heapify, heappop, heappush, heapreplace, nlargest, nsmallest): - self.assertRaises(TypeError, f, 10) - - def test_iterable_args(self): - for f in (nlargest, nsmallest): - for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): - for g in (G, I, Ig, L, R): - self.assertEqual(f(2, g(s)), f(2,s)) - self.assertEqual(f(2, S(s)), []) - self.assertRaises(TypeError, f, 2, X(s)) - self.assertRaises(TypeError, f, 2, N(s)) - self.assertRaises(ZeroDivisionError, f, 2, E(s)) - -#============================================================================== - - -def test_main(verbose=None): - from types import BuiltinFunctionType - - test_classes = [TestHeap] - if isinstance(heapify, BuiltinFunctionType): - test_classes.append(TestErrorHandling) - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_hexoct.py b/sys/lib/python/test/test_hexoct.py deleted file mode 100644 index f71dbe026..000000000 --- a/sys/lib/python/test/test_hexoct.py +++ /dev/null @@ -1,116 +0,0 @@ -"""Test correct treatment of hex/oct constants. - -This is complex because of changes due to PEP 237. -""" - -import sys -platform_long_is_32_bits = sys.maxint == 2147483647 - -import unittest -from test import test_support - -import warnings -warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, - "") - -class TextHexOct(unittest.TestCase): - - def test_hex_baseline(self): - # Baseline tests - self.assertEqual(0x0, 0) - self.assertEqual(0x10, 16) - if platform_long_is_32_bits: - self.assertEqual(0x7fffffff, 2147483647) - else: - self.assertEqual(0x7fffffffffffffff, 9223372036854775807) - # Ditto with a minus sign and parentheses - self.assertEqual(-(0x0), 0) - self.assertEqual(-(0x10), -16) - if platform_long_is_32_bits: - self.assertEqual(-(0x7fffffff), -2147483647) - else: - self.assertEqual(-(0x7fffffffffffffff), -9223372036854775807) - # Ditto with a minus sign and NO parentheses - self.assertEqual(-0x0, 0) - self.assertEqual(-0x10, -16) - if platform_long_is_32_bits: - self.assertEqual(-0x7fffffff, -2147483647) - else: - self.assertEqual(-0x7fffffffffffffff, -9223372036854775807) - - def test_hex_unsigned(self): - if platform_long_is_32_bits: - # Positive constants - self.assertEqual(0x80000000, 2147483648L) - self.assertEqual(0xffffffff, 4294967295L) - # Ditto with a minus sign and parentheses - self.assertEqual(-(0x80000000), -2147483648L) - self.assertEqual(-(0xffffffff), -4294967295L) - # Ditto with a minus sign and NO parentheses - # This failed in Python 2.2 through 2.2.2 and in 2.3a1 - self.assertEqual(-0x80000000, -2147483648L) - self.assertEqual(-0xffffffff, -4294967295L) - else: - # Positive constants - self.assertEqual(0x8000000000000000, 9223372036854775808L) - self.assertEqual(0xffffffffffffffff, 18446744073709551615L) - # Ditto with a minus sign and parentheses - self.assertEqual(-(0x8000000000000000), -9223372036854775808L) - self.assertEqual(-(0xffffffffffffffff), -18446744073709551615L) - # Ditto with a minus sign and NO parentheses - # This failed in Python 2.2 through 2.2.2 and in 2.3a1 - self.assertEqual(-0x8000000000000000, -9223372036854775808L) - self.assertEqual(-0xffffffffffffffff, -18446744073709551615L) - - def test_oct_baseline(self): - # Baseline tests - self.assertEqual(00, 0) - self.assertEqual(020, 16) - if platform_long_is_32_bits: - self.assertEqual(017777777777, 2147483647) - else: - self.assertEqual(0777777777777777777777, 9223372036854775807) - # Ditto with a minus sign and parentheses - self.assertEqual(-(00), 0) - self.assertEqual(-(020), -16) - if platform_long_is_32_bits: - self.assertEqual(-(017777777777), -2147483647) - else: - self.assertEqual(-(0777777777777777777777), -9223372036854775807) - # Ditto with a minus sign and NO parentheses - self.assertEqual(-00, 0) - self.assertEqual(-020, -16) - if platform_long_is_32_bits: - self.assertEqual(-017777777777, -2147483647) - else: - self.assertEqual(-0777777777777777777777, -9223372036854775807) - - def test_oct_unsigned(self): - if platform_long_is_32_bits: - # Positive constants - self.assertEqual(020000000000, 2147483648L) - self.assertEqual(037777777777, 4294967295L) - # Ditto with a minus sign and parentheses - self.assertEqual(-(020000000000), -2147483648L) - self.assertEqual(-(037777777777), -4294967295L) - # Ditto with a minus sign and NO parentheses - # This failed in Python 2.2 through 2.2.2 and in 2.3a1 - self.assertEqual(-020000000000, -2147483648L) - self.assertEqual(-037777777777, -4294967295L) - else: - # Positive constants - self.assertEqual(01000000000000000000000, 9223372036854775808L) - self.assertEqual(01777777777777777777777, 18446744073709551615L) - # Ditto with a minus sign and parentheses - self.assertEqual(-(01000000000000000000000), -9223372036854775808L) - self.assertEqual(-(01777777777777777777777), -18446744073709551615L) - # Ditto with a minus sign and NO parentheses - # This failed in Python 2.2 through 2.2.2 and in 2.3a1 - self.assertEqual(-01000000000000000000000, -9223372036854775808L) - self.assertEqual(-01777777777777777777777, -18446744073709551615L) - -def test_main(): - test_support.run_unittest(TextHexOct) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_hmac.py b/sys/lib/python/test/test_hmac.py deleted file mode 100644 index 9d094d289..000000000 --- a/sys/lib/python/test/test_hmac.py +++ /dev/null @@ -1,168 +0,0 @@ -import hmac -import sha -import unittest -from test import test_support - -class TestVectorsTestCase(unittest.TestCase): - - def test_md5_vectors(self): - # Test the HMAC module against test vectors from the RFC. - - def md5test(key, data, digest): - h = hmac.HMAC(key, data) - self.assertEqual(h.hexdigest().upper(), digest.upper()) - - md5test(chr(0x0b) * 16, - "Hi There", - "9294727A3638BB1C13F48EF8158BFC9D") - - md5test("Jefe", - "what do ya want for nothing?", - "750c783e6ab0b503eaa86e310a5db738") - - md5test(chr(0xAA)*16, - chr(0xDD)*50, - "56be34521d144c88dbb8c733f0e8b3f6") - - md5test("".join([chr(i) for i in range(1, 26)]), - chr(0xCD) * 50, - "697eaf0aca3a3aea3a75164746ffaa79") - - md5test(chr(0x0C) * 16, - "Test With Truncation", - "56461ef2342edc00f9bab995690efd4c") - - md5test(chr(0xAA) * 80, - "Test Using Larger Than Block-Size Key - Hash Key First", - "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd") - - md5test(chr(0xAA) * 80, - ("Test Using Larger Than Block-Size Key " - "and Larger Than One Block-Size Data"), - "6f630fad67cda0ee1fb1f562db3aa53e") - - def test_sha_vectors(self): - def shatest(key, data, digest): - h = hmac.HMAC(key, data, digestmod=sha) - self.assertEqual(h.hexdigest().upper(), digest.upper()) - - shatest(chr(0x0b) * 20, - "Hi There", - "b617318655057264e28bc0b6fb378c8ef146be00") - - shatest("Jefe", - "what do ya want for nothing?", - "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79") - - shatest(chr(0xAA)*20, - chr(0xDD)*50, - "125d7342b9ac11cd91a39af48aa17b4f63f175d3") - - shatest("".join([chr(i) for i in range(1, 26)]), - chr(0xCD) * 50, - "4c9007f4026250c6bc8414f9bf50c86c2d7235da") - - shatest(chr(0x0C) * 20, - "Test With Truncation", - "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04") - - shatest(chr(0xAA) * 80, - "Test Using Larger Than Block-Size Key - Hash Key First", - "aa4ae5e15272d00e95705637ce8a3b55ed402112") - - shatest(chr(0xAA) * 80, - ("Test Using Larger Than Block-Size Key " - "and Larger Than One Block-Size Data"), - "e8e99d0f45237d786d6bbaa7965c7808bbff1a91") - - -class ConstructorTestCase(unittest.TestCase): - - def test_normal(self): - # Standard constructor call. - failed = 0 - try: - h = hmac.HMAC("key") - except: - self.fail("Standard constructor call raised exception.") - - def test_withtext(self): - # Constructor call with text. - try: - h = hmac.HMAC("key", "hash this!") - except: - self.fail("Constructor call with text argument raised exception.") - - def test_withmodule(self): - # Constructor call with text and digest module. - import sha - try: - h = hmac.HMAC("key", "", sha) - except: - self.fail("Constructor call with sha module raised exception.") - -class SanityTestCase(unittest.TestCase): - - def test_default_is_md5(self): - # Testing if HMAC defaults to MD5 algorithm. - # NOTE: this whitebox test depends on the hmac class internals - import hashlib - h = hmac.HMAC("key") - self.failUnless(h.digest_cons == hashlib.md5) - - def test_exercise_all_methods(self): - # Exercising all methods once. - # This must not raise any exceptions - try: - h = hmac.HMAC("my secret key") - h.update("compute the hash of this text!") - dig = h.digest() - dig = h.hexdigest() - h2 = h.copy() - except: - self.fail("Exception raised during normal usage of HMAC class.") - -class CopyTestCase(unittest.TestCase): - - def test_attributes(self): - # Testing if attributes are of same type. - h1 = hmac.HMAC("key") - h2 = h1.copy() - self.failUnless(h1.digest_cons == h2.digest_cons, - "digest constructors don't match.") - self.failUnless(type(h1.inner) == type(h2.inner), - "Types of inner don't match.") - self.failUnless(type(h1.outer) == type(h2.outer), - "Types of outer don't match.") - - def test_realcopy(self): - # Testing if the copy method created a real copy. - h1 = hmac.HMAC("key") - h2 = h1.copy() - # Using id() in case somebody has overridden __cmp__. - self.failUnless(id(h1) != id(h2), "No real copy of the HMAC instance.") - self.failUnless(id(h1.inner) != id(h2.inner), - "No real copy of the attribute 'inner'.") - self.failUnless(id(h1.outer) != id(h2.outer), - "No real copy of the attribute 'outer'.") - - def test_equality(self): - # Testing if the copy has the same digests. - h1 = hmac.HMAC("key") - h1.update("some random text") - h2 = h1.copy() - self.failUnless(h1.digest() == h2.digest(), - "Digest of copy doesn't match original digest.") - self.failUnless(h1.hexdigest() == h2.hexdigest(), - "Hexdigest of copy doesn't match original hexdigest.") - -def test_main(): - test_support.run_unittest( - TestVectorsTestCase, - ConstructorTestCase, - SanityTestCase, - CopyTestCase - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_hotshot.py b/sys/lib/python/test/test_hotshot.py deleted file mode 100644 index 2751b3ffd..000000000 --- a/sys/lib/python/test/test_hotshot.py +++ /dev/null @@ -1,132 +0,0 @@ -import hotshot -import hotshot.log -import os -import pprint -import unittest - -from test import test_support - -from hotshot.log import ENTER, EXIT, LINE - - -def shortfilename(fn): - # We use a really shortened filename since an exact match is made, - # and the source may be either a Python source file or a - # pre-compiled bytecode file. - if fn: - return os.path.splitext(os.path.basename(fn))[0] - else: - return fn - - -class UnlinkingLogReader(hotshot.log.LogReader): - """Extend the LogReader so the log file is unlinked when we're - done with it.""" - - def __init__(self, logfn): - self.__logfn = logfn - hotshot.log.LogReader.__init__(self, logfn) - - def next(self, index=None): - try: - return hotshot.log.LogReader.next(self) - except StopIteration: - self.close() - os.unlink(self.__logfn) - raise - - -class HotShotTestCase(unittest.TestCase): - def new_profiler(self, lineevents=0, linetimings=1): - self.logfn = test_support.TESTFN - return hotshot.Profile(self.logfn, lineevents, linetimings) - - def get_logreader(self): - return UnlinkingLogReader(self.logfn) - - def get_events_wotime(self): - L = [] - for event in self.get_logreader(): - what, (filename, lineno, funcname), tdelta = event - L.append((what, (shortfilename(filename), lineno, funcname))) - return L - - def check_events(self, expected): - events = self.get_events_wotime() - if events != expected: - self.fail( - "events did not match expectation; got:\n%s\nexpected:\n%s" - % (pprint.pformat(events), pprint.pformat(expected))) - - def run_test(self, callable, events, profiler=None): - if profiler is None: - profiler = self.new_profiler() - self.failUnless(not profiler._prof.closed) - profiler.runcall(callable) - self.failUnless(not profiler._prof.closed) - profiler.close() - self.failUnless(profiler._prof.closed) - self.check_events(events) - - def test_addinfo(self): - def f(p): - p.addinfo("test-key", "test-value") - profiler = self.new_profiler() - profiler.runcall(f, profiler) - profiler.close() - log = self.get_logreader() - info = log._info - list(log) - self.failUnless(info["test-key"] == ["test-value"]) - - def test_line_numbers(self): - def f(): - y = 2 - x = 1 - def g(): - f() - f_lineno = f.func_code.co_firstlineno - g_lineno = g.func_code.co_firstlineno - events = [(ENTER, ("test_hotshot", g_lineno, "g")), - (LINE, ("test_hotshot", g_lineno+1, "g")), - (ENTER, ("test_hotshot", f_lineno, "f")), - (LINE, ("test_hotshot", f_lineno+1, "f")), - (LINE, ("test_hotshot", f_lineno+2, "f")), - (EXIT, ("test_hotshot", f_lineno, "f")), - (EXIT, ("test_hotshot", g_lineno, "g")), - ] - self.run_test(g, events, self.new_profiler(lineevents=1)) - - def test_start_stop(self): - # Make sure we don't return NULL in the start() and stop() - # methods when there isn't an error. Bug in 2.2 noted by - # Anthony Baxter. - profiler = self.new_profiler() - profiler.start() - profiler.stop() - profiler.close() - os.unlink(self.logfn) - - def test_bad_sys_path(self): - import sys - import os - orig_path = sys.path - coverage = hotshot._hotshot.coverage - try: - # verify we require a list for sys.path - sys.path = 'abc' - self.assertRaises(RuntimeError, coverage, test_support.TESTFN) - # verify that we require sys.path exists - del sys.path - self.assertRaises(RuntimeError, coverage, test_support.TESTFN) - finally: - sys.path = orig_path - if os.path.exists(test_support.TESTFN): - os.remove(test_support.TESTFN) - -def test_main(): - test_support.run_unittest(HotShotTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_htmllib.py b/sys/lib/python/test/test_htmllib.py deleted file mode 100644 index a20f43bbf..000000000 --- a/sys/lib/python/test/test_htmllib.py +++ /dev/null @@ -1,69 +0,0 @@ -import formatter -import htmllib -import unittest - -from test import test_support - - -class AnchorCollector(htmllib.HTMLParser): - def __init__(self, *args, **kw): - self.__anchors = [] - htmllib.HTMLParser.__init__(self, *args, **kw) - - def get_anchor_info(self): - return self.__anchors - - def anchor_bgn(self, *args): - self.__anchors.append(args) - -class DeclCollector(htmllib.HTMLParser): - def __init__(self, *args, **kw): - self.__decls = [] - htmllib.HTMLParser.__init__(self, *args, **kw) - - def get_decl_info(self): - return self.__decls - - def unknown_decl(self, data): - self.__decls.append(data) - - -class HTMLParserTestCase(unittest.TestCase): - def test_anchor_collection(self): - # See SF bug #467059. - parser = AnchorCollector(formatter.NullFormatter(), verbose=1) - parser.feed( - """ - - - """) - parser.close() - self.assertEquals(parser.get_anchor_info(), - [('http://foo.org/', 'splat', ''), - ('http://www.python.org/', '', ''), - ('', 'frob', ''), - ]) - - def test_decl_collection(self): - # See SF patch #545300 - parser = DeclCollector(formatter.NullFormatter(), verbose=1) - parser.feed( - """ - - hallo -   - - - """) - parser.close() - self.assertEquals(parser.get_decl_info(), - ["if !supportEmptyParas", - "endif" - ]) - -def test_main(): - test_support.run_unittest(HTMLParserTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_htmlparser.py b/sys/lib/python/test/test_htmlparser.py deleted file mode 100755 index 54b90cd2d..000000000 --- a/sys/lib/python/test/test_htmlparser.py +++ /dev/null @@ -1,318 +0,0 @@ -"""Tests for HTMLParser.py.""" - -import HTMLParser -import pprint -import sys -import unittest -from test import test_support - - -class EventCollector(HTMLParser.HTMLParser): - - def __init__(self): - self.events = [] - self.append = self.events.append - HTMLParser.HTMLParser.__init__(self) - - def get_events(self): - # Normalize the list of events so that buffer artefacts don't - # separate runs of contiguous characters. - L = [] - prevtype = None - for event in self.events: - type = event[0] - if type == prevtype == "data": - L[-1] = ("data", L[-1][1] + event[1]) - else: - L.append(event) - prevtype = type - self.events = L - return L - - # structure markup - - def handle_starttag(self, tag, attrs): - self.append(("starttag", tag, attrs)) - - def handle_startendtag(self, tag, attrs): - self.append(("startendtag", tag, attrs)) - - def handle_endtag(self, tag): - self.append(("endtag", tag)) - - # all other markup - - def handle_comment(self, data): - self.append(("comment", data)) - - def handle_charref(self, data): - self.append(("charref", data)) - - def handle_data(self, data): - self.append(("data", data)) - - def handle_decl(self, data): - self.append(("decl", data)) - - def handle_entityref(self, data): - self.append(("entityref", data)) - - def handle_pi(self, data): - self.append(("pi", data)) - - def unknown_decl(self, decl): - self.append(("unknown decl", decl)) - - -class EventCollectorExtra(EventCollector): - - def handle_starttag(self, tag, attrs): - EventCollector.handle_starttag(self, tag, attrs) - self.append(("starttag_text", self.get_starttag_text())) - - -class TestCaseBase(unittest.TestCase): - - def _run_check(self, source, expected_events, collector=EventCollector): - parser = collector() - for s in source: - parser.feed(s) - parser.close() - events = parser.get_events() - if events != expected_events: - self.fail("received events did not match expected events\n" - "Expected:\n" + pprint.pformat(expected_events) + - "\nReceived:\n" + pprint.pformat(events)) - - def _run_check_extra(self, source, events): - self._run_check(source, events, EventCollectorExtra) - - def _parse_error(self, source): - def parse(source=source): - parser = HTMLParser.HTMLParser() - parser.feed(source) - parser.close() - self.assertRaises(HTMLParser.HTMLParseError, parse) - - -class HTMLParserTestCase(TestCaseBase): - - def test_processing_instruction_only(self): - self._run_check("", [ - ("pi", "processing instruction"), - ]) - self._run_check("", [ - ("pi", "processing instruction ?"), - ]) - - def test_simple_html(self): - self._run_check(""" - -&entity; -< -sample -text -“ - - -""", [ - ("data", "\n"), - ("decl", "DOCTYPE html PUBLIC 'foo'"), - ("data", "\n"), - ("starttag", "html", []), - ("entityref", "entity"), - ("charref", "32"), - ("data", "\n"), - ("comment", "comment1a\n->< - - - - - - %paramEntity; - -]""" - self._run_check("" % inside, [ - ("decl", inside), - ]) - - def test_bad_nesting(self): - # Strangely, this *is* supposed to test that overlapping - # elements are allowed. HTMLParser is more geared toward - # lexing the input that parsing the structure. - self._run_check("", [ - ("starttag", "a", []), - ("starttag", "b", []), - ("endtag", "a"), - ("endtag", "b"), - ]) - - def test_bare_ampersands(self): - self._run_check("this text & contains & ampersands &", [ - ("data", "this text & contains & ampersands &"), - ]) - - def test_bare_pointy_brackets(self): - self._run_check("this < text > contains < bare>pointy< brackets", [ - ("data", "this < text > contains < bare>pointy< brackets"), - ]) - - def test_attr_syntax(self): - output = [ - ("starttag", "a", [("b", "v"), ("c", "v"), ("d", "v"), ("e", None)]) - ] - self._run_check("""""", output) - self._run_check("""""", output) - self._run_check("""""", output) - self._run_check("""""", output) - - def test_attr_values(self): - self._run_check("""""", - [("starttag", "a", [("b", "xxx\n\txxx"), - ("c", "yyy\t\nyyy"), - ("d", "\txyz\n")]) - ]) - self._run_check("""""", [ - ("starttag", "a", [("b", ""), ("c", "")]), - ]) - # Regression test for SF patch #669683. - self._run_check("", [ - ("starttag", "e", [("a", "rgb(1,2,3)")]), - ]) - # Regression test for SF bug #921657. - self._run_check("", [ - ("starttag", "a", [("href", "mailto:xyz@example.com")]), - ]) - - def test_attr_entity_replacement(self): - self._run_check("""""", [ - ("starttag", "a", [("b", "&><\"'")]), - ]) - - def test_attr_funky_names(self): - self._run_check("""""", [ - ("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]), - ]) - - def test_illegal_declarations(self): - self._parse_error('') - - def test_starttag_end_boundary(self): - self._run_check("""""", [("starttag", "a", [("b", "<")])]) - self._run_check("""""", [("starttag", "a", [("b", ">")])]) - - def test_buffer_artefacts(self): - output = [("starttag", "a", [("b", "<")])] - self._run_check([""], output) - self._run_check([""], output) - self._run_check([""], output) - self._run_check([""], output) - self._run_check([""], output) - self._run_check([""], output) - - output = [("starttag", "a", [("b", ">")])] - self._run_check([""], output) - self._run_check([""], output) - self._run_check([""], output) - self._run_check(["'>"], output) - self._run_check([""], output) - self._run_check([""], output) - - output = [("comment", "abc")] - self._run_check(["", ""], output) - self._run_check(["<", "!--abc-->"], output) - self._run_check([""], output) - self._run_check([""], output) - self._run_check([""], output) - self._run_check([""], output) - self._run_check([""], output) - self._run_check([""], output) - self._run_check(["", ""], output) - - def test_starttag_junk_chars(self): - self._parse_error("") - self._parse_error("") - self._parse_error("") - self._parse_error("") - self._parse_error("") - self._parse_error("'") - self._parse_error("

", [ - ("starttag", "p", []), - ("startendtag", "img", [("src", "foo")]), - ("endtag", "p"), - ]) - - def test_get_starttag_text(self): - s = """""" - self._run_check_extra(s, [ - ("starttag", "foo:bar", [("one", "1"), ("two", "2")]), - ("starttag_text", s)]) - - def test_cdata_content(self): - s = """""" - self._run_check(s, [ - ("starttag", "script", []), - ("data", " ¬-an-entity-ref; "), - ("endtag", "script"), - ]) - s = """""" - self._run_check(s, [ - ("starttag", "script", []), - ("data", " "), - ("endtag", "script"), - ]) - - -def test_main(): - test_support.run_unittest(HTMLParserTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_httplib.py b/sys/lib/python/test/test_httplib.py deleted file mode 100644 index 90bae887c..000000000 --- a/sys/lib/python/test/test_httplib.py +++ /dev/null @@ -1,172 +0,0 @@ -import httplib -import StringIO -import sys - -from unittest import TestCase - -from test import test_support - -class FakeSocket: - def __init__(self, text, fileclass=StringIO.StringIO): - self.text = text - self.fileclass = fileclass - - def sendall(self, data): - self.data = data - - def makefile(self, mode, bufsize=None): - if mode != 'r' and mode != 'rb': - raise httplib.UnimplementedFileMode() - return self.fileclass(self.text) - -class NoEOFStringIO(StringIO.StringIO): - """Like StringIO, but raises AssertionError on EOF. - - This is used below to test that httplib doesn't try to read - more from the underlying file than it should. - """ - def read(self, n=-1): - data = StringIO.StringIO.read(self, n) - if data == '': - raise AssertionError('caller tried to read past EOF') - return data - - def readline(self, length=None): - data = StringIO.StringIO.readline(self, length) - if data == '': - raise AssertionError('caller tried to read past EOF') - return data - - -class HeaderTests(TestCase): - def test_auto_headers(self): - # Some headers are added automatically, but should not be added by - # .request() if they are explicitly set. - - import httplib - - class HeaderCountingBuffer(list): - def __init__(self): - self.count = {} - def append(self, item): - kv = item.split(':') - if len(kv) > 1: - # item is a 'Key: Value' header string - lcKey = kv[0].lower() - self.count.setdefault(lcKey, 0) - self.count[lcKey] += 1 - list.append(self, item) - - for explicit_header in True, False: - for header in 'Content-length', 'Host', 'Accept-encoding': - conn = httplib.HTTPConnection('example.com') - conn.sock = FakeSocket('blahblahblah') - conn._buffer = HeaderCountingBuffer() - - body = 'spamspamspam' - headers = {} - if explicit_header: - headers[header] = str(len(body)) - conn.request('POST', '/', body, headers) - self.assertEqual(conn._buffer.count[header.lower()], 1) - -# Collect output to a buffer so that we don't have to cope with line-ending -# issues across platforms. Specifically, the headers will have \r\n pairs -# and some platforms will strip them from the output file. - -def test(): - buf = StringIO.StringIO() - _stdout = sys.stdout - try: - sys.stdout = buf - _test() - finally: - sys.stdout = _stdout - - # print individual lines with endings stripped - s = buf.getvalue() - for line in s.split("\n"): - print line.strip() - -def _test(): - # Test HTTP status lines - - body = "HTTP/1.1 200 Ok\r\n\r\nText" - sock = FakeSocket(body) - resp = httplib.HTTPResponse(sock, 1) - resp.begin() - print resp.read() - resp.close() - - body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" - sock = FakeSocket(body) - resp = httplib.HTTPResponse(sock, 1) - try: - resp.begin() - except httplib.BadStatusLine: - print "BadStatusLine raised as expected" - else: - print "Expect BadStatusLine" - - # Check invalid host_port - - for hp in ("www.python.org:abc", "www.python.org:"): - try: - h = httplib.HTTP(hp) - except httplib.InvalidURL: - print "InvalidURL raised as expected" - else: - print "Expect InvalidURL" - - for hp,h,p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", 8000), - ("www.python.org:80", "www.python.org", 80), - ("www.python.org", "www.python.org", 80), - ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)): - try: - http = httplib.HTTP(hp) - except httplib.InvalidURL: - print "InvalidURL raised erroneously" - c = http._conn - if h != c.host: raise AssertionError, ("Host incorrectly parsed", h, c.host) - if p != c.port: raise AssertionError, ("Port incorrectly parsed", p, c.host) - - # test response with multiple message headers with the same field name. - text = ('HTTP/1.1 200 OK\r\n' - 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' - 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' - ' Path="/acme"\r\n' - '\r\n' - 'No body\r\n') - hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' - ', ' - 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') - s = FakeSocket(text) - r = httplib.HTTPResponse(s, 1) - r.begin() - cookies = r.getheader("Set-Cookie") - if cookies != hdr: - raise AssertionError, "multiple headers not combined properly" - - # Test that the library doesn't attempt to read any data - # from a HEAD request. (Tickles SF bug #622042.) - sock = FakeSocket( - 'HTTP/1.1 200 OK\r\n' - 'Content-Length: 14432\r\n' - '\r\n', - NoEOFStringIO) - resp = httplib.HTTPResponse(sock, 1, method="HEAD") - resp.begin() - if resp.read() != "": - raise AssertionError, "Did not expect response from HEAD request" - resp.close() - - -class OfflineTest(TestCase): - def test_responses(self): - self.assertEquals(httplib.responses[httplib.NOT_FOUND], "Not Found") - -def test_main(verbose=None): - tests = [HeaderTests,OfflineTest] - test_support.run_unittest(*tests) - -test() diff --git a/sys/lib/python/test/test_imageop.py b/sys/lib/python/test/test_imageop.py deleted file mode 100755 index b01e83fa2..000000000 --- a/sys/lib/python/test/test_imageop.py +++ /dev/null @@ -1,177 +0,0 @@ -#! /usr/bin/env python - -"""Test script for the imageop module. This has the side - effect of partially testing the imgfile module as well. - Roger E. Masse -""" - -from test.test_support import verbose, unlink - -import imageop, uu, os - -import warnings -warnings.filterwarnings("ignore", - "the rgbimg module is deprecated", - DeprecationWarning, - ".*test_imageop") - -def main(use_rgbimg=1): - - # Create binary test files - uu.decode(get_qualified_path('testrgb'+os.extsep+'uue'), 'test'+os.extsep+'rgb') - - if use_rgbimg: - image, width, height = getrgbimage('test'+os.extsep+'rgb') - else: - image, width, height = getimage('test'+os.extsep+'rgb') - - # Return the selected part of image, which should by width by height - # in size and consist of pixels of psize bytes. - if verbose: - print 'crop' - newimage = imageop.crop (image, 4, width, height, 0, 0, 1, 1) - - # Return image scaled to size newwidth by newheight. No interpolation - # is done, scaling is done by simple-minded pixel duplication or removal. - # Therefore, computer-generated images or dithered images will - # not look nice after scaling. - if verbose: - print 'scale' - scaleimage = imageop.scale(image, 4, width, height, 1, 1) - - # Run a vertical low-pass filter over an image. It does so by computing - # each destination pixel as the average of two vertically-aligned source - # pixels. The main use of this routine is to forestall excessive flicker - # if the image two vertically-aligned source pixels, hence the name. - if verbose: - print 'tovideo' - videoimage = imageop.tovideo (image, 4, width, height) - - # Convert an rgb image to an 8 bit rgb - if verbose: - print 'rgb2rgb8' - greyimage = imageop.rgb2rgb8(image, width, height) - - # Convert an 8 bit rgb image to a 24 bit rgb image - if verbose: - print 'rgb82rgb' - image = imageop.rgb82rgb(greyimage, width, height) - - # Convert an rgb image to an 8 bit greyscale image - if verbose: - print 'rgb2grey' - greyimage = imageop.rgb2grey(image, width, height) - - # Convert an 8 bit greyscale image to a 24 bit rgb image - if verbose: - print 'grey2rgb' - image = imageop.grey2rgb(greyimage, width, height) - - # Convert a 8-bit deep greyscale image to a 1-bit deep image by - # thresholding all the pixels. The resulting image is tightly packed - # and is probably only useful as an argument to mono2grey. - if verbose: - print 'grey2mono' - monoimage = imageop.grey2mono (greyimage, width, height, 0) - - # monoimage, width, height = getimage('monotest.rgb') - # Convert a 1-bit monochrome image to an 8 bit greyscale or color image. - # All pixels that are zero-valued on input get value p0 on output and - # all one-value input pixels get value p1 on output. To convert a - # monochrome black-and-white image to greyscale pass the values 0 and - # 255 respectively. - if verbose: - print 'mono2grey' - greyimage = imageop.mono2grey (monoimage, width, height, 0, 255) - - # Convert an 8-bit greyscale image to a 1-bit monochrome image using a - # (simple-minded) dithering algorithm. - if verbose: - print 'dither2mono' - monoimage = imageop.dither2mono (greyimage, width, height) - - # Convert an 8-bit greyscale image to a 4-bit greyscale image without - # dithering. - if verbose: - print 'grey2grey4' - grey4image = imageop.grey2grey4 (greyimage, width, height) - - # Convert an 8-bit greyscale image to a 2-bit greyscale image without - # dithering. - if verbose: - print 'grey2grey2' - grey2image = imageop.grey2grey2 (greyimage, width, height) - - # Convert an 8-bit greyscale image to a 2-bit greyscale image with - # dithering. As for dither2mono, the dithering algorithm is currently - # very simple. - if verbose: - print 'dither2grey2' - grey2image = imageop.dither2grey2 (greyimage, width, height) - - # Convert a 4-bit greyscale image to an 8-bit greyscale image. - if verbose: - print 'grey42grey' - greyimage = imageop.grey42grey (grey4image, width, height) - - # Convert a 2-bit greyscale image to an 8-bit greyscale image. - if verbose: - print 'grey22grey' - image = imageop.grey22grey (grey2image, width, height) - - # Cleanup - unlink('test'+os.extsep+'rgb') - -def getrgbimage(name): - """return a tuple consisting of image (in 'imgfile' format but - using rgbimg instead) width and height""" - - import rgbimg - - try: - sizes = rgbimg.sizeofimage(name) - except rgbimg.error: - name = get_qualified_path(name) - sizes = rgbimg.sizeofimage(name) - if verbose: - print 'rgbimg opening test image: %s, sizes: %s' % (name, str(sizes)) - - image = rgbimg.longimagedata(name) - return (image, sizes[0], sizes[1]) - -def getimage(name): - """return a tuple consisting of - image (in 'imgfile' format) width and height - """ - - import imgfile - - try: - sizes = imgfile.getsizes(name) - except imgfile.error: - name = get_qualified_path(name) - sizes = imgfile.getsizes(name) - if verbose: - print 'imgfile opening test image: %s, sizes: %s' % (name, str(sizes)) - - image = imgfile.read(name) - return (image, sizes[0], sizes[1]) - -def get_qualified_path(name): - """ return a more qualified path to name""" - import sys - import os - path = sys.path - try: - path = [os.path.dirname(__file__)] + path - except NameError: - pass - for dir in path: - fullname = os.path.join(dir, name) - if os.path.exists(fullname): - return fullname - return name - -# rgbimg (unlike imgfile) is portable to platforms other than SGI. -# So we prefer to use it. -main(use_rgbimg=1) diff --git a/sys/lib/python/test/test_imaplib.py b/sys/lib/python/test/test_imaplib.py deleted file mode 100644 index 78bb61300..000000000 --- a/sys/lib/python/test/test_imaplib.py +++ /dev/null @@ -1,12 +0,0 @@ -import imaplib -import time - -# We can check only that it successfully produces a result, -# not the correctness of the result itself, since the result -# depends on the timezone the machine is in. - -timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), - '"18-May-2033 05:33:20 +0200"'] - -for t in timevalues: - imaplib.Time2Internaldate(t) diff --git a/sys/lib/python/test/test_imgfile.py b/sys/lib/python/test/test_imgfile.py deleted file mode 100755 index bdfd796b1..000000000 --- a/sys/lib/python/test/test_imgfile.py +++ /dev/null @@ -1,116 +0,0 @@ -#! /usr/bin/env python - -"""Simple test script for imgfile.c - Roger E. Masse -""" - -from test.test_support import verbose, unlink, findfile - -import imgfile, uu, os - - -def main(): - - uu.decode(findfile('testrgb.uue'), 'test.rgb') - uu.decode(findfile('greyrgb.uue'), 'greytest.rgb') - - # Test a 3 byte color image - testimage('test.rgb') - - # Test a 1 byte greyscale image - testimage('greytest.rgb') - - unlink('test.rgb') - unlink('greytest.rgb') - -def testimage(name): - """Run through the imgfile's battery of possible methods - on the image passed in name. - """ - - import sys - import os - - outputfile = '/tmp/deleteme' - - # try opening the name directly - try: - # This function returns a tuple (x, y, z) where x and y are the size - # of the image in pixels and z is the number of bytes per pixel. Only - # 3 byte RGB pixels and 1 byte greyscale pixels are supported. - sizes = imgfile.getsizes(name) - except imgfile.error: - # get a more qualified path component of the script... - if __name__ == '__main__': - ourname = sys.argv[0] - else: # ...or the full path of the module - ourname = sys.modules[__name__].__file__ - - parts = ourname.split(os.sep) - parts[-1] = name - name = os.sep.join(parts) - sizes = imgfile.getsizes(name) - if verbose: - print 'Opening test image: %s, sizes: %s' % (name, str(sizes)) - # This function reads and decodes the image on the specified file, - # and returns it as a python string. The string has either 1 byte - # greyscale pixels or 4 byte RGBA pixels. The bottom left pixel - # is the first in the string. This format is suitable to pass - # to gl.lrectwrite, for instance. - image = imgfile.read(name) - - # This function writes the RGB or greyscale data in data to - # image file file. x and y give the size of the image, z is - # 1 for 1 byte greyscale images or 3 for RGB images (which - # are stored as 4 byte values of which only the lower three - # bytes are used). These are the formats returned by gl.lrectread. - if verbose: - print 'Writing output file' - imgfile.write (outputfile, image, sizes[0], sizes[1], sizes[2]) - - - if verbose: - print 'Opening scaled test image: %s, sizes: %s' % (name, str(sizes)) - # This function is identical to read but it returns an image that - # is scaled to the given x and y sizes. If the filter and blur - # parameters are omitted scaling is done by simply dropping - # or duplicating pixels, so the result will be less than perfect, - # especially for computer-generated images. Alternatively, - # you can specify a filter to use to smoothen the image after - # scaling. The filter forms supported are 'impulse', 'box', - # 'triangle', 'quadratic' and 'gaussian'. If a filter is - # specified blur is an optional parameter specifying the - # blurriness of the filter. It defaults to 1.0. readscaled - # makes no attempt to keep the aspect ratio correct, so that - # is the users' responsibility. - if verbose: - print 'Filtering with "impulse"' - simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'impulse', 2.0) - - # This function sets a global flag which defines whether the - # scan lines of the image are read or written from bottom to - # top (flag is zero, compatible with SGI GL) or from top to - # bottom(flag is one, compatible with X). The default is zero. - if verbose: - print 'Switching to X compatibility' - imgfile.ttob (1) - - if verbose: - print 'Filtering with "triangle"' - simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'triangle', 3.0) - if verbose: - print 'Switching back to SGI compatibility' - imgfile.ttob (0) - - if verbose: print 'Filtering with "quadratic"' - simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'quadratic') - if verbose: print 'Filtering with "gaussian"' - simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'gaussian', 1.0) - - if verbose: - print 'Writing output file' - imgfile.write (outputfile, simage, sizes[0]/2, sizes[1]/2, sizes[2]) - - os.unlink(outputfile) - -main() diff --git a/sys/lib/python/test/test_imp.py b/sys/lib/python/test/test_imp.py deleted file mode 100644 index 893ba2461..000000000 --- a/sys/lib/python/test/test_imp.py +++ /dev/null @@ -1,43 +0,0 @@ -import imp -from test.test_support import TestFailed, TestSkipped -try: - import thread -except ImportError: - raise TestSkipped("test only valid when thread support is available") - -def verify_lock_state(expected): - if imp.lock_held() != expected: - raise TestFailed("expected imp.lock_held() to be %r" % expected) - -def testLock(): - LOOPS = 50 - - # The import lock may already be held, e.g. if the test suite is run - # via "import test.autotest". - lock_held_at_start = imp.lock_held() - verify_lock_state(lock_held_at_start) - - for i in range(LOOPS): - imp.acquire_lock() - verify_lock_state(True) - - for i in range(LOOPS): - imp.release_lock() - - # The original state should be restored now. - verify_lock_state(lock_held_at_start) - - if not lock_held_at_start: - try: - imp.release_lock() - except RuntimeError: - pass - else: - raise TestFailed("release_lock() without lock should raise " - "RuntimeError") - -def test_main(): - testLock() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_import.py b/sys/lib/python/test/test_import.py deleted file mode 100644 index ed97f84fe..000000000 --- a/sys/lib/python/test/test_import.py +++ /dev/null @@ -1,236 +0,0 @@ -from test.test_support import TESTFN, TestFailed - -import os -import random -import sys -import py_compile - -# Brief digression to test that import is case-sensitive: if we got this -# far, we know for sure that "random" exists. -try: - import RAnDoM -except ImportError: - pass -else: - raise TestFailed("import of RAnDoM should have failed (case mismatch)") - -# Another brief digression to test the accuracy of manifest float constants. -from test import double_const # don't blink -- that *was* the test - -def remove_files(name): - for f in (name + os.extsep + "py", - name + os.extsep + "pyc", - name + os.extsep + "pyo", - name + os.extsep + "pyw", - name + "$py.class"): - if os.path.exists(f): - os.remove(f) - -def test_with_extension(ext): # ext normally ".py"; perhaps ".pyw" - source = TESTFN + ext - pyo = TESTFN + os.extsep + "pyo" - if sys.platform.startswith('java'): - pyc = TESTFN + "$py.class" - else: - pyc = TESTFN + os.extsep + "pyc" - - f = open(source, "w") - print >> f, "# This tests Python's ability to import a", ext, "file." - a = random.randrange(1000) - b = random.randrange(1000) - print >> f, "a =", a - print >> f, "b =", b - f.close() - - try: - try: - mod = __import__(TESTFN) - except ImportError, err: - raise ValueError("import from %s failed: %s" % (ext, err)) - - if mod.a != a or mod.b != b: - print a, "!=", mod.a - print b, "!=", mod.b - raise ValueError("module loaded (%s) but contents invalid" % mod) - finally: - os.unlink(source) - - try: - try: - reload(mod) - except ImportError, err: - raise ValueError("import from .pyc/.pyo failed: %s" % err) - finally: - try: - os.unlink(pyc) - except os.error: - pass - try: - os.unlink(pyo) - except os.error: - pass - del sys.modules[TESTFN] - -sys.path.insert(0, os.curdir) -try: - test_with_extension(os.extsep + "py") - if sys.platform.startswith("win"): - for ext in ".PY", ".Py", ".pY", ".pyw", ".PYW", ".pYw": - test_with_extension(ext) -finally: - del sys.path[0] - -# Verify that the imp module can correctly load and find .py files -import imp -x = imp.find_module("os") -os = imp.load_module("os", *x) - -def test_module_with_large_stack(module): - # create module w/list of 65000 elements to test bug #561858 - filename = module + os.extsep + 'py' - - # create a file with a list of 65000 elements - f = open(filename, 'w+') - f.write('d = [\n') - for i in range(65000): - f.write('"",\n') - f.write(']') - f.close() - - # compile & remove .py file, we only need .pyc (or .pyo) - f = open(filename, 'r') - py_compile.compile(filename) - f.close() - os.unlink(filename) - - # need to be able to load from current dir - sys.path.append('') - - # this used to crash - exec 'import ' + module - - # cleanup - del sys.path[-1] - for ext in 'pyc', 'pyo': - fname = module + os.extsep + ext - if os.path.exists(fname): - os.unlink(fname) - -test_module_with_large_stack('longlist') - -def test_failing_import_sticks(): - source = TESTFN + os.extsep + "py" - f = open(source, "w") - print >> f, "a = 1/0" - f.close() - - # New in 2.4, we shouldn't be able to import that no matter how often - # we try. - sys.path.insert(0, os.curdir) - try: - for i in 1, 2, 3: - try: - mod = __import__(TESTFN) - except ZeroDivisionError: - if TESTFN in sys.modules: - raise TestFailed("damaged module in sys.modules", i) - else: - raise TestFailed("was able to import a damaged module", i) - finally: - sys.path.pop(0) - remove_files(TESTFN) - -test_failing_import_sticks() - -def test_failing_reload(): - # A failing reload should leave the module object in sys.modules. - source = TESTFN + os.extsep + "py" - f = open(source, "w") - print >> f, "a = 1" - print >> f, "b = 2" - f.close() - - sys.path.insert(0, os.curdir) - try: - mod = __import__(TESTFN) - if TESTFN not in sys.modules: - raise TestFailed("expected module in sys.modules") - if mod.a != 1 or mod.b != 2: - raise TestFailed("module has wrong attribute values") - - # On WinXP, just replacing the .py file wasn't enough to - # convince reload() to reparse it. Maybe the timestamp didn't - # move enough. We force it to get reparsed by removing the - # compiled file too. - remove_files(TESTFN) - - # Now damage the module. - f = open(source, "w") - print >> f, "a = 10" - print >> f, "b = 20//0" - f.close() - try: - reload(mod) - except ZeroDivisionError: - pass - else: - raise TestFailed("was able to reload a damaged module") - - # But we still expect the module to be in sys.modules. - mod = sys.modules.get(TESTFN) - if mod is None: - raise TestFailed("expected module to still be in sys.modules") - # We should have replaced a w/ 10, but the old b value should - # stick. - if mod.a != 10 or mod.b != 2: - raise TestFailed("module has wrong attribute values") - - finally: - sys.path.pop(0) - remove_files(TESTFN) - if TESTFN in sys.modules: - del sys.modules[TESTFN] - -test_failing_reload() - -def test_import_name_binding(): - # import x.y.z binds x in the current namespace - import test as x - import test.test_support - assert x is test, x.__name__ - assert hasattr(test.test_support, "__file__") - - # import x.y.z as w binds z as w - import test.test_support as y - assert y is test.test_support, y.__name__ - -test_import_name_binding() - -def test_import_initless_directory_warning(): - import warnings - oldfilters = warnings.filters[:] - warnings.simplefilter('error', ImportWarning); - try: - # Just a random non-package directory we always expect to be - # somewhere in sys.path... - __import__("site-packages") - except ImportWarning: - pass - else: - raise AssertionError - finally: - warnings.filters = oldfilters - -test_import_initless_directory_warning() - -def test_infinite_reload(): - # Bug #742342 reports that Python segfaults (infinite recursion in C) - # when faced with self-recursive reload()ing. - - sys.path.insert(0, os.path.dirname(__file__)) - try: - import infinite_reload - finally: - sys.path.pop(0) - -test_infinite_reload() diff --git a/sys/lib/python/test/test_importhooks.py b/sys/lib/python/test/test_importhooks.py deleted file mode 100644 index e8b4695c7..000000000 --- a/sys/lib/python/test/test_importhooks.py +++ /dev/null @@ -1,276 +0,0 @@ -import sys -import imp -import os -import unittest -from test import test_support - - -test_src = """\ -def get_name(): - return __name__ -def get_file(): - return __file__ -""" - -absimp = "import sub\n" -relimp = "from . import sub\n" -deeprelimp = "from .... import sub\n" -futimp = "from __future__ import absolute_import\n" - -reload_src = test_src+"""\ -reloaded = True -""" - -test_co = compile(test_src, "", "exec") -reload_co = compile(reload_src, "", "exec") - -test2_oldabs_co = compile(absimp + test_src, "", "exec") -test2_newabs_co = compile(futimp + absimp + test_src, "", "exec") -test2_newrel_co = compile(relimp + test_src, "", "exec") -test2_deeprel_co = compile(deeprelimp + test_src, "", "exec") -test2_futrel_co = compile(futimp + relimp + test_src, "", "exec") - -test_path = "!!!_test_!!!" - - -class ImportTracker: - """Importer that only tracks attempted imports.""" - def __init__(self): - self.imports = [] - def find_module(self, fullname, path=None): - self.imports.append(fullname) - return None - - -class TestImporter: - - modules = { - "hooktestmodule": (False, test_co), - "hooktestpackage": (True, test_co), - "hooktestpackage.sub": (True, test_co), - "hooktestpackage.sub.subber": (True, test_co), - "hooktestpackage.oldabs": (False, test2_oldabs_co), - "hooktestpackage.newabs": (False, test2_newabs_co), - "hooktestpackage.newrel": (False, test2_newrel_co), - "hooktestpackage.sub.subber.subest": (True, test2_deeprel_co), - "hooktestpackage.futrel": (False, test2_futrel_co), - "sub": (False, test_co), - "reloadmodule": (False, test_co), - } - - def __init__(self, path=test_path): - if path != test_path: - # if out class is on sys.path_hooks, we must raise - # ImportError for any path item that we can't handle. - raise ImportError - self.path = path - - def _get__path__(self): - raise NotImplementedError - - def find_module(self, fullname, path=None): - if fullname in self.modules: - return self - else: - return None - - def load_module(self, fullname): - ispkg, code = self.modules[fullname] - mod = sys.modules.setdefault(fullname,imp.new_module(fullname)) - mod.__file__ = "<%s>" % self.__class__.__name__ - mod.__loader__ = self - if ispkg: - mod.__path__ = self._get__path__() - exec code in mod.__dict__ - return mod - - -class MetaImporter(TestImporter): - def _get__path__(self): - return [] - -class PathImporter(TestImporter): - def _get__path__(self): - return [self.path] - - -class ImportBlocker: - """Place an ImportBlocker instance on sys.meta_path and you - can be sure the modules you specified can't be imported, even - if it's a builtin.""" - def __init__(self, *namestoblock): - self.namestoblock = dict.fromkeys(namestoblock) - def find_module(self, fullname, path=None): - if fullname in self.namestoblock: - return self - return None - def load_module(self, fullname): - raise ImportError, "I dare you" - - -class ImpWrapper: - - def __init__(self, path=None): - if path is not None and not os.path.isdir(path): - raise ImportError - self.path = path - - def find_module(self, fullname, path=None): - subname = fullname.split(".")[-1] - if subname != fullname and self.path is None: - return None - if self.path is None: - path = None - else: - path = [self.path] - try: - file, filename, stuff = imp.find_module(subname, path) - except ImportError: - return None - return ImpLoader(file, filename, stuff) - - -class ImpLoader: - - def __init__(self, file, filename, stuff): - self.file = file - self.filename = filename - self.stuff = stuff - - def load_module(self, fullname): - mod = imp.load_module(fullname, self.file, self.filename, self.stuff) - if self.file: - self.file.close() - mod.__loader__ = self # for introspection - return mod - - -class ImportHooksBaseTestCase(unittest.TestCase): - - def setUp(self): - self.path = sys.path[:] - self.meta_path = sys.meta_path[:] - self.path_hooks = sys.path_hooks[:] - sys.path_importer_cache.clear() - self.tracker = ImportTracker() - sys.meta_path.insert(0, self.tracker) - - def tearDown(self): - sys.path[:] = self.path - sys.meta_path[:] = self.meta_path - sys.path_hooks[:] = self.path_hooks - sys.path_importer_cache.clear() - for fullname in self.tracker.imports: - if fullname in sys.modules: - del sys.modules[fullname] - - -class ImportHooksTestCase(ImportHooksBaseTestCase): - - def doTestImports(self, importer=None): - import hooktestmodule - import hooktestpackage - import hooktestpackage.sub - import hooktestpackage.sub.subber - self.assertEqual(hooktestmodule.get_name(), - "hooktestmodule") - self.assertEqual(hooktestpackage.get_name(), - "hooktestpackage") - self.assertEqual(hooktestpackage.sub.get_name(), - "hooktestpackage.sub") - self.assertEqual(hooktestpackage.sub.subber.get_name(), - "hooktestpackage.sub.subber") - if importer: - self.assertEqual(hooktestmodule.__loader__, importer) - self.assertEqual(hooktestpackage.__loader__, importer) - self.assertEqual(hooktestpackage.sub.__loader__, importer) - self.assertEqual(hooktestpackage.sub.subber.__loader__, importer) - - TestImporter.modules['reloadmodule'] = (False, test_co) - import reloadmodule - self.failIf(hasattr(reloadmodule,'reloaded')) - - TestImporter.modules['reloadmodule'] = (False, reload_co) - reload(reloadmodule) - self.failUnless(hasattr(reloadmodule,'reloaded')) - - import hooktestpackage.oldabs - self.assertEqual(hooktestpackage.oldabs.get_name(), - "hooktestpackage.oldabs") - self.assertEqual(hooktestpackage.oldabs.sub, - hooktestpackage.sub) - - import hooktestpackage.newrel - self.assertEqual(hooktestpackage.newrel.get_name(), - "hooktestpackage.newrel") - self.assertEqual(hooktestpackage.newrel.sub, - hooktestpackage.sub) - - import hooktestpackage.sub.subber.subest as subest - self.assertEqual(subest.get_name(), - "hooktestpackage.sub.subber.subest") - self.assertEqual(subest.sub, - hooktestpackage.sub) - - import hooktestpackage.futrel - self.assertEqual(hooktestpackage.futrel.get_name(), - "hooktestpackage.futrel") - self.assertEqual(hooktestpackage.futrel.sub, - hooktestpackage.sub) - - import sub - self.assertEqual(sub.get_name(), "sub") - - import hooktestpackage.newabs - self.assertEqual(hooktestpackage.newabs.get_name(), - "hooktestpackage.newabs") - self.assertEqual(hooktestpackage.newabs.sub, sub) - - def testMetaPath(self): - i = MetaImporter() - sys.meta_path.append(i) - self.doTestImports(i) - - def testPathHook(self): - sys.path_hooks.append(PathImporter) - sys.path.append(test_path) - self.doTestImports() - - def testBlocker(self): - mname = "exceptions" # an arbitrary harmless builtin module - if mname in sys.modules: - del sys.modules[mname] - sys.meta_path.append(ImportBlocker(mname)) - try: - __import__(mname) - except ImportError: - pass - else: - self.fail("'%s' was not supposed to be importable" % mname) - - def testImpWrapper(self): - i = ImpWrapper() - sys.meta_path.append(i) - sys.path_hooks.append(ImpWrapper) - mnames = ("colorsys", "urlparse", "distutils.core", "compiler.misc") - for mname in mnames: - parent = mname.split(".")[0] - for n in sys.modules.keys(): - if n.startswith(parent): - del sys.modules[n] - for mname in mnames: - m = __import__(mname, globals(), locals(), ["__dummy__"]) - m.__loader__ # to make sure we actually handled the import - # Delete urllib from modules because urlparse was imported above. - # Without this hack, test_socket_ssl fails if run in this order: - # regrtest.py test_codecmaps_tw test_importhooks test_socket_ssl - try: - del sys.modules['urllib'] - except KeyError: - pass - -def test_main(): - test_support.run_unittest(ImportHooksTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_index.py b/sys/lib/python/test/test_index.py deleted file mode 100644 index ecb566d5d..000000000 --- a/sys/lib/python/test/test_index.py +++ /dev/null @@ -1,223 +0,0 @@ -import unittest -from test import test_support -import operator -from sys import maxint - -class oldstyle: - def __index__(self): - return self.ind - -class newstyle(object): - def __index__(self): - return self.ind - -class TrapInt(int): - def __index__(self): - return self - -class TrapLong(long): - def __index__(self): - return self - -class BaseTestCase(unittest.TestCase): - def setUp(self): - self.o = oldstyle() - self.n = newstyle() - - def test_basic(self): - self.o.ind = -2 - self.n.ind = 2 - self.assertEqual(operator.index(self.o), -2) - self.assertEqual(operator.index(self.n), 2) - - def test_slice(self): - self.o.ind = 1 - self.n.ind = 2 - slc = slice(self.o, self.o, self.o) - check_slc = slice(1, 1, 1) - self.assertEqual(slc.indices(self.o), check_slc.indices(1)) - slc = slice(self.n, self.n, self.n) - check_slc = slice(2, 2, 2) - self.assertEqual(slc.indices(self.n), check_slc.indices(2)) - - def test_wrappers(self): - self.o.ind = 4 - self.n.ind = 5 - self.assertEqual(6 .__index__(), 6) - self.assertEqual(-7L.__index__(), -7) - self.assertEqual(self.o.__index__(), 4) - self.assertEqual(self.n.__index__(), 5) - - def test_subclasses(self): - r = range(10) - self.assertEqual(r[TrapInt(5):TrapInt(10)], r[5:10]) - self.assertEqual(r[TrapLong(5):TrapLong(10)], r[5:10]) - self.assertEqual(slice(TrapInt()).indices(0), (0,0,1)) - self.assertEqual(slice(TrapLong(0)).indices(0), (0,0,1)) - - def test_error(self): - self.o.ind = 'dumb' - self.n.ind = 'bad' - self.failUnlessRaises(TypeError, operator.index, self.o) - self.failUnlessRaises(TypeError, operator.index, self.n) - self.failUnlessRaises(TypeError, slice(self.o).indices, 0) - self.failUnlessRaises(TypeError, slice(self.n).indices, 0) - - -class SeqTestCase(unittest.TestCase): - # This test case isn't run directly. It just defines common tests - # to the different sequence types below - def setUp(self): - self.o = oldstyle() - self.n = newstyle() - self.o2 = oldstyle() - self.n2 = newstyle() - - def test_index(self): - self.o.ind = -2 - self.n.ind = 2 - self.assertEqual(self.seq[self.n], self.seq[2]) - self.assertEqual(self.seq[self.o], self.seq[-2]) - - def test_slice(self): - self.o.ind = 1 - self.o2.ind = 3 - self.n.ind = 2 - self.n2.ind = 4 - self.assertEqual(self.seq[self.o:self.o2], self.seq[1:3]) - self.assertEqual(self.seq[self.n:self.n2], self.seq[2:4]) - - def test_repeat(self): - self.o.ind = 3 - self.n.ind = 2 - self.assertEqual(self.seq * self.o, self.seq * 3) - self.assertEqual(self.seq * self.n, self.seq * 2) - self.assertEqual(self.o * self.seq, self.seq * 3) - self.assertEqual(self.n * self.seq, self.seq * 2) - - def test_wrappers(self): - self.o.ind = 4 - self.n.ind = 5 - self.assertEqual(self.seq.__getitem__(self.o), self.seq[4]) - self.assertEqual(self.seq.__mul__(self.o), self.seq * 4) - self.assertEqual(self.seq.__rmul__(self.o), self.seq * 4) - self.assertEqual(self.seq.__getitem__(self.n), self.seq[5]) - self.assertEqual(self.seq.__mul__(self.n), self.seq * 5) - self.assertEqual(self.seq.__rmul__(self.n), self.seq * 5) - - def test_subclasses(self): - self.assertEqual(self.seq[TrapInt()], self.seq[0]) - self.assertEqual(self.seq[TrapLong()], self.seq[0]) - - def test_error(self): - self.o.ind = 'dumb' - self.n.ind = 'bad' - indexobj = lambda x, obj: obj.seq[x] - self.failUnlessRaises(TypeError, indexobj, self.o, self) - self.failUnlessRaises(TypeError, indexobj, self.n, self) - sliceobj = lambda x, obj: obj.seq[x:] - self.failUnlessRaises(TypeError, sliceobj, self.o, self) - self.failUnlessRaises(TypeError, sliceobj, self.n, self) - - -class ListTestCase(SeqTestCase): - seq = [0,10,20,30,40,50] - - def test_setdelitem(self): - self.o.ind = -2 - self.n.ind = 2 - lst = list('ab!cdefghi!j') - del lst[self.o] - del lst[self.n] - lst[self.o] = 'X' - lst[self.n] = 'Y' - self.assertEqual(lst, list('abYdefghXj')) - - lst = [5, 6, 7, 8, 9, 10, 11] - lst.__setitem__(self.n, "here") - self.assertEqual(lst, [5, 6, "here", 8, 9, 10, 11]) - lst.__delitem__(self.n) - self.assertEqual(lst, [5, 6, 8, 9, 10, 11]) - - def test_inplace_repeat(self): - self.o.ind = 2 - self.n.ind = 3 - lst = [6, 4] - lst *= self.o - self.assertEqual(lst, [6, 4, 6, 4]) - lst *= self.n - self.assertEqual(lst, [6, 4, 6, 4] * 3) - - lst = [5, 6, 7, 8, 9, 11] - l2 = lst.__imul__(self.n) - self.assert_(l2 is lst) - self.assertEqual(lst, [5, 6, 7, 8, 9, 11] * 3) - - -class TupleTestCase(SeqTestCase): - seq = (0,10,20,30,40,50) - -class StringTestCase(SeqTestCase): - seq = "this is a test" - -class UnicodeTestCase(SeqTestCase): - seq = u"this is a test" - - -class XRangeTestCase(unittest.TestCase): - - def test_xrange(self): - n = newstyle() - n.ind = 5 - self.assertEqual(xrange(1, 20)[n], 6) - self.assertEqual(xrange(1, 20).__getitem__(n), 6) - -class OverflowTestCase(unittest.TestCase): - - def setUp(self): - self.pos = 2**100 - self.neg = -self.pos - - def test_large_longs(self): - self.assertEqual(self.pos.__index__(), self.pos) - self.assertEqual(self.neg.__index__(), self.neg) - - def _getitem_helper(self, base): - class GetItem(base): - def __len__(self): - return maxint - def __getitem__(self, key): - return key - def __getslice__(self, i, j): - return i, j - x = GetItem() - self.assertEqual(x[self.pos], self.pos) - self.assertEqual(x[self.neg], self.neg) - self.assertEqual(x[self.neg:self.pos], (-1, maxint)) - self.assertEqual(x[self.neg:self.pos:1].indices(maxint), (0, maxint, 1)) - - def test_getitem(self): - self._getitem_helper(object) - - def test_getitem_classic(self): - class Empty: pass - self._getitem_helper(Empty) - - def test_sequence_repeat(self): - self.failUnlessRaises(OverflowError, lambda: "a" * self.pos) - self.failUnlessRaises(OverflowError, lambda: "a" * self.neg) - - -def test_main(): - test_support.run_unittest( - BaseTestCase, - ListTestCase, - TupleTestCase, - StringTestCase, - UnicodeTestCase, - XRangeTestCase, - OverflowTestCase, - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_inspect.py b/sys/lib/python/test/test_inspect.py deleted file mode 100644 index d880e87dc..000000000 --- a/sys/lib/python/test/test_inspect.py +++ /dev/null @@ -1,482 +0,0 @@ -import sys -import types -import unittest -import inspect -import datetime - -from test.test_support import TESTFN, run_unittest - -from test import inspect_fodder as mod -from test import inspect_fodder2 as mod2 - -# Functions tested in this suite: -# ismodule, isclass, ismethod, isfunction, istraceback, isframe, iscode, -# isbuiltin, isroutine, getmembers, getdoc, getfile, getmodule, -# getsourcefile, getcomments, getsource, getclasstree, getargspec, -# getargvalues, formatargspec, formatargvalues, currentframe, stack, trace -# isdatadescriptor - -modfile = mod.__file__ -if modfile.endswith(('c', 'o')): - modfile = modfile[:-1] - -import __builtin__ - -try: - 1/0 -except: - tb = sys.exc_traceback - -git = mod.StupidGit() - -class IsTestBase(unittest.TestCase): - predicates = set([inspect.isbuiltin, inspect.isclass, inspect.iscode, - inspect.isframe, inspect.isfunction, inspect.ismethod, - inspect.ismodule, inspect.istraceback]) - - def istest(self, predicate, exp): - obj = eval(exp) - self.failUnless(predicate(obj), '%s(%s)' % (predicate.__name__, exp)) - - for other in self.predicates - set([predicate]): - self.failIf(other(obj), 'not %s(%s)' % (other.__name__, exp)) - -class TestPredicates(IsTestBase): - def test_thirteen(self): - count = len(filter(lambda x:x.startswith('is'), dir(inspect))) - # Doc/lib/libinspect.tex claims there are 13 such functions - expected = 13 - err_msg = "There are %d (not %d) is* functions" % (count, expected) - self.assertEqual(count, expected, err_msg) - - def test_excluding_predicates(self): - self.istest(inspect.isbuiltin, 'sys.exit') - self.istest(inspect.isbuiltin, '[].append') - self.istest(inspect.isclass, 'mod.StupidGit') - self.istest(inspect.iscode, 'mod.spam.func_code') - self.istest(inspect.isframe, 'tb.tb_frame') - self.istest(inspect.isfunction, 'mod.spam') - self.istest(inspect.ismethod, 'mod.StupidGit.abuse') - self.istest(inspect.ismethod, 'git.argue') - self.istest(inspect.ismodule, 'mod') - self.istest(inspect.istraceback, 'tb') - self.istest(inspect.isdatadescriptor, '__builtin__.file.closed') - self.istest(inspect.isdatadescriptor, '__builtin__.file.softspace') - if hasattr(types, 'GetSetDescriptorType'): - self.istest(inspect.isgetsetdescriptor, - 'type(tb.tb_frame).f_locals') - else: - self.failIf(inspect.isgetsetdescriptor(type(tb.tb_frame).f_locals)) - if hasattr(types, 'MemberDescriptorType'): - self.istest(inspect.ismemberdescriptor, 'datetime.timedelta.days') - else: - self.failIf(inspect.ismemberdescriptor(datetime.timedelta.days)) - - def test_isroutine(self): - self.assert_(inspect.isroutine(mod.spam)) - self.assert_(inspect.isroutine([].count)) - -class TestInterpreterStack(IsTestBase): - def __init__(self, *args, **kwargs): - unittest.TestCase.__init__(self, *args, **kwargs) - - git.abuse(7, 8, 9) - - def test_abuse_done(self): - self.istest(inspect.istraceback, 'git.ex[2]') - self.istest(inspect.isframe, 'mod.fr') - - def test_stack(self): - self.assert_(len(mod.st) >= 5) - self.assertEqual(mod.st[0][1:], - (modfile, 16, 'eggs', [' st = inspect.stack()\n'], 0)) - self.assertEqual(mod.st[1][1:], - (modfile, 9, 'spam', [' eggs(b + d, c + f)\n'], 0)) - self.assertEqual(mod.st[2][1:], - (modfile, 43, 'argue', [' spam(a, b, c)\n'], 0)) - self.assertEqual(mod.st[3][1:], - (modfile, 39, 'abuse', [' self.argue(a, b, c)\n'], 0)) - - def test_trace(self): - self.assertEqual(len(git.tr), 3) - self.assertEqual(git.tr[0][1:], (modfile, 43, 'argue', - [' spam(a, b, c)\n'], 0)) - self.assertEqual(git.tr[1][1:], (modfile, 9, 'spam', - [' eggs(b + d, c + f)\n'], 0)) - self.assertEqual(git.tr[2][1:], (modfile, 18, 'eggs', - [' q = y / 0\n'], 0)) - - def test_frame(self): - args, varargs, varkw, locals = inspect.getargvalues(mod.fr) - self.assertEqual(args, ['x', 'y']) - self.assertEqual(varargs, None) - self.assertEqual(varkw, None) - self.assertEqual(locals, {'x': 11, 'p': 11, 'y': 14}) - self.assertEqual(inspect.formatargvalues(args, varargs, varkw, locals), - '(x=11, y=14)') - - def test_previous_frame(self): - args, varargs, varkw, locals = inspect.getargvalues(mod.fr.f_back) - self.assertEqual(args, ['a', 'b', 'c', 'd', ['e', ['f']]]) - self.assertEqual(varargs, 'g') - self.assertEqual(varkw, 'h') - self.assertEqual(inspect.formatargvalues(args, varargs, varkw, locals), - '(a=7, b=8, c=9, d=3, (e=4, (f=5,)), *g=(), **h={})') - -class GetSourceBase(unittest.TestCase): - # Subclasses must override. - fodderFile = None - - def __init__(self, *args, **kwargs): - unittest.TestCase.__init__(self, *args, **kwargs) - - self.source = file(inspect.getsourcefile(self.fodderFile)).read() - - def sourcerange(self, top, bottom): - lines = self.source.split("\n") - return "\n".join(lines[top-1:bottom]) + "\n" - - def assertSourceEqual(self, obj, top, bottom): - self.assertEqual(inspect.getsource(obj), - self.sourcerange(top, bottom)) - -class TestRetrievingSourceCode(GetSourceBase): - fodderFile = mod - - def test_getclasses(self): - classes = inspect.getmembers(mod, inspect.isclass) - self.assertEqual(classes, - [('FesteringGob', mod.FesteringGob), - ('MalodorousPervert', mod.MalodorousPervert), - ('ParrotDroppings', mod.ParrotDroppings), - ('StupidGit', mod.StupidGit)]) - tree = inspect.getclasstree([cls[1] for cls in classes], 1) - self.assertEqual(tree, - [(mod.ParrotDroppings, ()), - (mod.StupidGit, ()), - [(mod.MalodorousPervert, (mod.StupidGit,)), - [(mod.FesteringGob, (mod.MalodorousPervert, - mod.ParrotDroppings)) - ] - ] - ]) - - def test_getfunctions(self): - functions = inspect.getmembers(mod, inspect.isfunction) - self.assertEqual(functions, [('eggs', mod.eggs), - ('spam', mod.spam)]) - - def test_getdoc(self): - self.assertEqual(inspect.getdoc(mod), 'A module docstring.') - self.assertEqual(inspect.getdoc(mod.StupidGit), - 'A longer,\n\nindented\n\ndocstring.') - self.assertEqual(inspect.getdoc(git.abuse), - 'Another\n\ndocstring\n\ncontaining\n\ntabs') - - def test_getcomments(self): - self.assertEqual(inspect.getcomments(mod), '# line 1\n') - self.assertEqual(inspect.getcomments(mod.StupidGit), '# line 20\n') - - def test_getmodule(self): - # Check actual module - self.assertEqual(inspect.getmodule(mod), mod) - # Check class (uses __module__ attribute) - self.assertEqual(inspect.getmodule(mod.StupidGit), mod) - # Check a method (no __module__ attribute, falls back to filename) - self.assertEqual(inspect.getmodule(mod.StupidGit.abuse), mod) - # Do it again (check the caching isn't broken) - self.assertEqual(inspect.getmodule(mod.StupidGit.abuse), mod) - # Check a builtin - self.assertEqual(inspect.getmodule(str), sys.modules["__builtin__"]) - # Check filename override - self.assertEqual(inspect.getmodule(None, modfile), mod) - - def test_getsource(self): - self.assertSourceEqual(git.abuse, 29, 39) - self.assertSourceEqual(mod.StupidGit, 21, 46) - - def test_getsourcefile(self): - self.assertEqual(inspect.getsourcefile(mod.spam), modfile) - self.assertEqual(inspect.getsourcefile(git.abuse), modfile) - - def test_getfile(self): - self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__) - - def test_getmodule_recursion(self): - from new import module - name = '__inspect_dummy' - m = sys.modules[name] = module(name) - m.__file__ = "" # hopefully not a real filename... - m.__loader__ = "dummy" # pretend the filename is understood by a loader - exec "def x(): pass" in m.__dict__ - self.assertEqual(inspect.getsourcefile(m.x.func_code), '') - del sys.modules[name] - inspect.getmodule(compile('a=10','','single')) - -class TestDecorators(GetSourceBase): - fodderFile = mod2 - - def test_wrapped_decorator(self): - self.assertSourceEqual(mod2.wrapped, 14, 17) - - def test_replacing_decorator(self): - self.assertSourceEqual(mod2.gone, 9, 10) - -class TestOneliners(GetSourceBase): - fodderFile = mod2 - def test_oneline_lambda(self): - # Test inspect.getsource with a one-line lambda function. - self.assertSourceEqual(mod2.oll, 25, 25) - - def test_threeline_lambda(self): - # Test inspect.getsource with a three-line lambda function, - # where the second and third lines are _not_ indented. - self.assertSourceEqual(mod2.tll, 28, 30) - - def test_twoline_indented_lambda(self): - # Test inspect.getsource with a two-line lambda function, - # where the second line _is_ indented. - self.assertSourceEqual(mod2.tlli, 33, 34) - - def test_onelinefunc(self): - # Test inspect.getsource with a regular one-line function. - self.assertSourceEqual(mod2.onelinefunc, 37, 37) - - def test_manyargs(self): - # Test inspect.getsource with a regular function where - # the arguments are on two lines and _not_ indented and - # the body on the second line with the last arguments. - self.assertSourceEqual(mod2.manyargs, 40, 41) - - def test_twolinefunc(self): - # Test inspect.getsource with a regular function where - # the body is on two lines, following the argument list and - # continued on the next line by a \\. - self.assertSourceEqual(mod2.twolinefunc, 44, 45) - - def test_lambda_in_list(self): - # Test inspect.getsource with a one-line lambda function - # defined in a list, indented. - self.assertSourceEqual(mod2.a[1], 49, 49) - - def test_anonymous(self): - # Test inspect.getsource with a lambda function defined - # as argument to another function. - self.assertSourceEqual(mod2.anonymous, 55, 55) - -class TestBuggyCases(GetSourceBase): - fodderFile = mod2 - - def test_with_comment(self): - self.assertSourceEqual(mod2.with_comment, 58, 59) - - def test_multiline_sig(self): - self.assertSourceEqual(mod2.multiline_sig[0], 63, 64) - - def test_nested_class(self): - self.assertSourceEqual(mod2.func69().func71, 71, 72) - - def test_one_liner_followed_by_non_name(self): - self.assertSourceEqual(mod2.func77, 77, 77) - - def test_one_liner_dedent_non_name(self): - self.assertSourceEqual(mod2.cls82.func83, 83, 83) - - def test_with_comment_instead_of_docstring(self): - self.assertSourceEqual(mod2.func88, 88, 90) - - def test_method_in_dynamic_class(self): - self.assertSourceEqual(mod2.method_in_dynamic_class, 95, 97) - -# Helper for testing classify_class_attrs. -def attrs_wo_objs(cls): - return [t[:3] for t in inspect.classify_class_attrs(cls)] - -class TestClassesAndFunctions(unittest.TestCase): - def test_classic_mro(self): - # Test classic-class method resolution order. - class A: pass - class B(A): pass - class C(A): pass - class D(B, C): pass - - expected = (D, B, A, C) - got = inspect.getmro(D) - self.assertEqual(expected, got) - - def test_newstyle_mro(self): - # The same w/ new-class MRO. - class A(object): pass - class B(A): pass - class C(A): pass - class D(B, C): pass - - expected = (D, B, C, A, object) - got = inspect.getmro(D) - self.assertEqual(expected, got) - - def assertArgSpecEquals(self, routine, args_e, varargs_e = None, - varkw_e = None, defaults_e = None, - formatted = None): - args, varargs, varkw, defaults = inspect.getargspec(routine) - self.assertEqual(args, args_e) - self.assertEqual(varargs, varargs_e) - self.assertEqual(varkw, varkw_e) - self.assertEqual(defaults, defaults_e) - if formatted is not None: - self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults), - formatted) - - def test_getargspec(self): - self.assertArgSpecEquals(mod.eggs, ['x', 'y'], formatted = '(x, y)') - - self.assertArgSpecEquals(mod.spam, - ['a', 'b', 'c', 'd', ['e', ['f']]], - 'g', 'h', (3, (4, (5,))), - '(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h)') - - def test_getargspec_method(self): - class A(object): - def m(self): - pass - self.assertArgSpecEquals(A.m, ['self']) - - def test_getargspec_sublistofone(self): - def sublistOfOne((foo,)): return 1 - self.assertArgSpecEquals(sublistOfOne, [['foo']]) - - def fakeSublistOfOne((foo)): return 1 - self.assertArgSpecEquals(fakeSublistOfOne, ['foo']) - - def test_classify_oldstyle(self): - class A: - def s(): pass - s = staticmethod(s) - - def c(cls): pass - c = classmethod(c) - - def getp(self): pass - p = property(getp) - - def m(self): pass - - def m1(self): pass - - datablob = '1' - - attrs = attrs_wo_objs(A) - self.assert_(('s', 'static method', A) in attrs, 'missing static method') - self.assert_(('c', 'class method', A) in attrs, 'missing class method') - self.assert_(('p', 'property', A) in attrs, 'missing property') - self.assert_(('m', 'method', A) in attrs, 'missing plain method') - self.assert_(('m1', 'method', A) in attrs, 'missing plain method') - self.assert_(('datablob', 'data', A) in attrs, 'missing data') - - class B(A): - def m(self): pass - - attrs = attrs_wo_objs(B) - self.assert_(('s', 'static method', A) in attrs, 'missing static method') - self.assert_(('c', 'class method', A) in attrs, 'missing class method') - self.assert_(('p', 'property', A) in attrs, 'missing property') - self.assert_(('m', 'method', B) in attrs, 'missing plain method') - self.assert_(('m1', 'method', A) in attrs, 'missing plain method') - self.assert_(('datablob', 'data', A) in attrs, 'missing data') - - - class C(A): - def m(self): pass - def c(self): pass - - attrs = attrs_wo_objs(C) - self.assert_(('s', 'static method', A) in attrs, 'missing static method') - self.assert_(('c', 'method', C) in attrs, 'missing plain method') - self.assert_(('p', 'property', A) in attrs, 'missing property') - self.assert_(('m', 'method', C) in attrs, 'missing plain method') - self.assert_(('m1', 'method', A) in attrs, 'missing plain method') - self.assert_(('datablob', 'data', A) in attrs, 'missing data') - - class D(B, C): - def m1(self): pass - - attrs = attrs_wo_objs(D) - self.assert_(('s', 'static method', A) in attrs, 'missing static method') - self.assert_(('c', 'class method', A) in attrs, 'missing class method') - self.assert_(('p', 'property', A) in attrs, 'missing property') - self.assert_(('m', 'method', B) in attrs, 'missing plain method') - self.assert_(('m1', 'method', D) in attrs, 'missing plain method') - self.assert_(('datablob', 'data', A) in attrs, 'missing data') - - # Repeat all that, but w/ new-style classes. - def test_classify_newstyle(self): - class A(object): - - def s(): pass - s = staticmethod(s) - - def c(cls): pass - c = classmethod(c) - - def getp(self): pass - p = property(getp) - - def m(self): pass - - def m1(self): pass - - datablob = '1' - - attrs = attrs_wo_objs(A) - self.assert_(('s', 'static method', A) in attrs, 'missing static method') - self.assert_(('c', 'class method', A) in attrs, 'missing class method') - self.assert_(('p', 'property', A) in attrs, 'missing property') - self.assert_(('m', 'method', A) in attrs, 'missing plain method') - self.assert_(('m1', 'method', A) in attrs, 'missing plain method') - self.assert_(('datablob', 'data', A) in attrs, 'missing data') - - class B(A): - - def m(self): pass - - attrs = attrs_wo_objs(B) - self.assert_(('s', 'static method', A) in attrs, 'missing static method') - self.assert_(('c', 'class method', A) in attrs, 'missing class method') - self.assert_(('p', 'property', A) in attrs, 'missing property') - self.assert_(('m', 'method', B) in attrs, 'missing plain method') - self.assert_(('m1', 'method', A) in attrs, 'missing plain method') - self.assert_(('datablob', 'data', A) in attrs, 'missing data') - - - class C(A): - - def m(self): pass - def c(self): pass - - attrs = attrs_wo_objs(C) - self.assert_(('s', 'static method', A) in attrs, 'missing static method') - self.assert_(('c', 'method', C) in attrs, 'missing plain method') - self.assert_(('p', 'property', A) in attrs, 'missing property') - self.assert_(('m', 'method', C) in attrs, 'missing plain method') - self.assert_(('m1', 'method', A) in attrs, 'missing plain method') - self.assert_(('datablob', 'data', A) in attrs, 'missing data') - - class D(B, C): - - def m1(self): pass - - attrs = attrs_wo_objs(D) - self.assert_(('s', 'static method', A) in attrs, 'missing static method') - self.assert_(('c', 'method', C) in attrs, 'missing plain method') - self.assert_(('p', 'property', A) in attrs, 'missing property') - self.assert_(('m', 'method', B) in attrs, 'missing plain method') - self.assert_(('m1', 'method', D) in attrs, 'missing plain method') - self.assert_(('datablob', 'data', A) in attrs, 'missing data') - -def test_main(): - run_unittest(TestDecorators, TestRetrievingSourceCode, TestOneliners, - TestBuggyCases, - TestInterpreterStack, TestClassesAndFunctions, TestPredicates) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_ioctl.py b/sys/lib/python/test/test_ioctl.py deleted file mode 100644 index 2b127e2b4..000000000 --- a/sys/lib/python/test/test_ioctl.py +++ /dev/null @@ -1,41 +0,0 @@ -import unittest -from test.test_support import TestSkipped, run_unittest -import os, struct -try: - import fcntl, termios -except ImportError: - raise TestSkipped("No fcntl or termios module") -if not hasattr(termios,'TIOCGPGRP'): - raise TestSkipped("termios module doesn't have TIOCGPGRP") - -try: - tty = open("/dev/tty", "r") - tty.close() -except IOError: - raise TestSkipped("Unable to open /dev/tty") - -class IoctlTests(unittest.TestCase): - def test_ioctl(self): - # If this process has been put into the background, TIOCGPGRP returns - # the session ID instead of the process group id. - ids = (os.getpgrp(), os.getsid(0)) - tty = open("/dev/tty", "r") - r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ") - rpgrp = struct.unpack("i", r)[0] - self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids)) - - def test_ioctl_mutate(self): - import array - buf = array.array('i', [0]) - ids = (os.getpgrp(), os.getsid(0)) - tty = open("/dev/tty", "r") - r = fcntl.ioctl(tty, termios.TIOCGPGRP, buf, 1) - rpgrp = buf[0] - self.assertEquals(r, 0) - self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids)) - -def test_main(): - run_unittest(IoctlTests) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_isinstance.py b/sys/lib/python/test/test_isinstance.py deleted file mode 100644 index 25b081671..000000000 --- a/sys/lib/python/test/test_isinstance.py +++ /dev/null @@ -1,277 +0,0 @@ -# Tests some corner cases with isinstance() and issubclass(). While these -# tests use new style classes and properties, they actually do whitebox -# testing of error conditions uncovered when using extension types. - -import unittest -from test import test_support -import sys - - - -class TestIsInstanceExceptions(unittest.TestCase): - # Test to make sure that an AttributeError when accessing the instance's - # class's bases is masked. This was actually a bug in Python 2.2 and - # 2.2.1 where the exception wasn't caught but it also wasn't being cleared - # (leading to an "undetected error" in the debug build). Set up is, - # isinstance(inst, cls) where: - # - # - inst isn't an InstanceType - # - cls isn't a ClassType, a TypeType, or a TupleType - # - cls has a __bases__ attribute - # - inst has a __class__ attribute - # - inst.__class__ as no __bases__ attribute - # - # Sounds complicated, I know, but this mimics a situation where an - # extension type raises an AttributeError when its __bases__ attribute is - # gotten. In that case, isinstance() should return False. - def test_class_has_no_bases(self): - class I(object): - def getclass(self): - # This must return an object that has no __bases__ attribute - return None - __class__ = property(getclass) - - class C(object): - def getbases(self): - return () - __bases__ = property(getbases) - - self.assertEqual(False, isinstance(I(), C())) - - # Like above except that inst.__class__.__bases__ raises an exception - # other than AttributeError - def test_bases_raises_other_than_attribute_error(self): - class E(object): - def getbases(self): - raise RuntimeError - __bases__ = property(getbases) - - class I(object): - def getclass(self): - return E() - __class__ = property(getclass) - - class C(object): - def getbases(self): - return () - __bases__ = property(getbases) - - self.assertRaises(RuntimeError, isinstance, I(), C()) - - # Here's a situation where getattr(cls, '__bases__') raises an exception. - # If that exception is not AttributeError, it should not get masked - def test_dont_mask_non_attribute_error(self): - class I: pass - - class C(object): - def getbases(self): - raise RuntimeError - __bases__ = property(getbases) - - self.assertRaises(RuntimeError, isinstance, I(), C()) - - # Like above, except that getattr(cls, '__bases__') raises an - # AttributeError, which /should/ get masked as a TypeError - def test_mask_attribute_error(self): - class I: pass - - class C(object): - def getbases(self): - raise AttributeError - __bases__ = property(getbases) - - self.assertRaises(TypeError, isinstance, I(), C()) - - - -# These tests are similar to above, but tickle certain code paths in -# issubclass() instead of isinstance() -- really PyObject_IsSubclass() -# vs. PyObject_IsInstance(). -class TestIsSubclassExceptions(unittest.TestCase): - def test_dont_mask_non_attribute_error(self): - class C(object): - def getbases(self): - raise RuntimeError - __bases__ = property(getbases) - - class S(C): pass - - self.assertRaises(RuntimeError, issubclass, C(), S()) - - def test_mask_attribute_error(self): - class C(object): - def getbases(self): - raise AttributeError - __bases__ = property(getbases) - - class S(C): pass - - self.assertRaises(TypeError, issubclass, C(), S()) - - # Like above, but test the second branch, where the __bases__ of the - # second arg (the cls arg) is tested. This means the first arg must - # return a valid __bases__, and it's okay for it to be a normal -- - # unrelated by inheritance -- class. - def test_dont_mask_non_attribute_error_in_cls_arg(self): - class B: pass - - class C(object): - def getbases(self): - raise RuntimeError - __bases__ = property(getbases) - - self.assertRaises(RuntimeError, issubclass, B, C()) - - def test_mask_attribute_error_in_cls_arg(self): - class B: pass - - class C(object): - def getbases(self): - raise AttributeError - __bases__ = property(getbases) - - self.assertRaises(TypeError, issubclass, B, C()) - - - -# meta classes for creating abstract classes and instances -class AbstractClass(object): - def __init__(self, bases): - self.bases = bases - - def getbases(self): - return self.bases - __bases__ = property(getbases) - - def __call__(self): - return AbstractInstance(self) - -class AbstractInstance(object): - def __init__(self, klass): - self.klass = klass - - def getclass(self): - return self.klass - __class__ = property(getclass) - -# abstract classes -AbstractSuper = AbstractClass(bases=()) - -AbstractChild = AbstractClass(bases=(AbstractSuper,)) - -# normal classes -class Super: - pass - -class Child(Super): - pass - -# new-style classes -class NewSuper(object): - pass - -class NewChild(NewSuper): - pass - - - -class TestIsInstanceIsSubclass(unittest.TestCase): - # Tests to ensure that isinstance and issubclass work on abstract - # classes and instances. Before the 2.2 release, TypeErrors were - # raised when boolean values should have been returned. The bug was - # triggered by mixing 'normal' classes and instances were with - # 'abstract' classes and instances. This case tries to test all - # combinations. - - def test_isinstance_normal(self): - # normal instances - self.assertEqual(True, isinstance(Super(), Super)) - self.assertEqual(False, isinstance(Super(), Child)) - self.assertEqual(False, isinstance(Super(), AbstractSuper)) - self.assertEqual(False, isinstance(Super(), AbstractChild)) - - self.assertEqual(True, isinstance(Child(), Super)) - self.assertEqual(False, isinstance(Child(), AbstractSuper)) - - def test_isinstance_abstract(self): - # abstract instances - self.assertEqual(True, isinstance(AbstractSuper(), AbstractSuper)) - self.assertEqual(False, isinstance(AbstractSuper(), AbstractChild)) - self.assertEqual(False, isinstance(AbstractSuper(), Super)) - self.assertEqual(False, isinstance(AbstractSuper(), Child)) - - self.assertEqual(True, isinstance(AbstractChild(), AbstractChild)) - self.assertEqual(True, isinstance(AbstractChild(), AbstractSuper)) - self.assertEqual(False, isinstance(AbstractChild(), Super)) - self.assertEqual(False, isinstance(AbstractChild(), Child)) - - def test_subclass_normal(self): - # normal classes - self.assertEqual(True, issubclass(Super, Super)) - self.assertEqual(False, issubclass(Super, AbstractSuper)) - self.assertEqual(False, issubclass(Super, Child)) - - self.assertEqual(True, issubclass(Child, Child)) - self.assertEqual(True, issubclass(Child, Super)) - self.assertEqual(False, issubclass(Child, AbstractSuper)) - - def test_subclass_abstract(self): - # abstract classes - self.assertEqual(True, issubclass(AbstractSuper, AbstractSuper)) - self.assertEqual(False, issubclass(AbstractSuper, AbstractChild)) - self.assertEqual(False, issubclass(AbstractSuper, Child)) - - self.assertEqual(True, issubclass(AbstractChild, AbstractChild)) - self.assertEqual(True, issubclass(AbstractChild, AbstractSuper)) - self.assertEqual(False, issubclass(AbstractChild, Super)) - self.assertEqual(False, issubclass(AbstractChild, Child)) - - def test_subclass_tuple(self): - # test with a tuple as the second argument classes - self.assertEqual(True, issubclass(Child, (Child,))) - self.assertEqual(True, issubclass(Child, (Super,))) - self.assertEqual(False, issubclass(Super, (Child,))) - self.assertEqual(True, issubclass(Super, (Child, Super))) - self.assertEqual(False, issubclass(Child, ())) - self.assertEqual(True, issubclass(Super, (Child, (Super,)))) - - self.assertEqual(True, issubclass(NewChild, (NewChild,))) - self.assertEqual(True, issubclass(NewChild, (NewSuper,))) - self.assertEqual(False, issubclass(NewSuper, (NewChild,))) - self.assertEqual(True, issubclass(NewSuper, (NewChild, NewSuper))) - self.assertEqual(False, issubclass(NewChild, ())) - self.assertEqual(True, issubclass(NewSuper, (NewChild, (NewSuper,)))) - - self.assertEqual(True, issubclass(int, (long, (float, int)))) - if test_support.have_unicode: - self.assertEqual(True, issubclass(str, (unicode, (Child, NewChild, basestring)))) - - def test_subclass_recursion_limit(self): - # make sure that issubclass raises RuntimeError before the C stack is - # blown - self.assertRaises(RuntimeError, blowstack, issubclass, str, str) - - def test_isinstance_recursion_limit(self): - # make sure that issubclass raises RuntimeError before the C stack is - # blown - self.assertRaises(RuntimeError, blowstack, isinstance, '', str) - -def blowstack(fxn, arg, compare_to): - # Make sure that calling isinstance with a deeply nested tuple for its - # argument will raise RuntimeError eventually. - tuple_arg = (compare_to,) - for cnt in xrange(sys.getrecursionlimit()+5): - tuple_arg = (tuple_arg,) - fxn(arg, tuple_arg) - - -def test_main(): - test_support.run_unittest( - TestIsInstanceExceptions, - TestIsSubclassExceptions, - TestIsInstanceIsSubclass - ) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_iter.py b/sys/lib/python/test/test_iter.py deleted file mode 100644 index f83de78ad..000000000 --- a/sys/lib/python/test/test_iter.py +++ /dev/null @@ -1,886 +0,0 @@ -# Test iterators. - -import unittest -from test.test_support import run_unittest, TESTFN, unlink, have_unicode - -# Test result of triple loop (too big to inline) -TRIPLETS = [(0, 0, 0), (0, 0, 1), (0, 0, 2), - (0, 1, 0), (0, 1, 1), (0, 1, 2), - (0, 2, 0), (0, 2, 1), (0, 2, 2), - - (1, 0, 0), (1, 0, 1), (1, 0, 2), - (1, 1, 0), (1, 1, 1), (1, 1, 2), - (1, 2, 0), (1, 2, 1), (1, 2, 2), - - (2, 0, 0), (2, 0, 1), (2, 0, 2), - (2, 1, 0), (2, 1, 1), (2, 1, 2), - (2, 2, 0), (2, 2, 1), (2, 2, 2)] - -# Helper classes - -class BasicIterClass: - def __init__(self, n): - self.n = n - self.i = 0 - def next(self): - res = self.i - if res >= self.n: - raise StopIteration - self.i = res + 1 - return res - -class IteratingSequenceClass: - def __init__(self, n): - self.n = n - def __iter__(self): - return BasicIterClass(self.n) - -class SequenceClass: - def __init__(self, n): - self.n = n - def __getitem__(self, i): - if 0 <= i < self.n: - return i - else: - raise IndexError - -# Main test suite - -class TestCase(unittest.TestCase): - - # Helper to check that an iterator returns a given sequence - def check_iterator(self, it, seq): - res = [] - while 1: - try: - val = it.next() - except StopIteration: - break - res.append(val) - self.assertEqual(res, seq) - - # Helper to check that a for loop generates a given sequence - def check_for_loop(self, expr, seq): - res = [] - for val in expr: - res.append(val) - self.assertEqual(res, seq) - - # Test basic use of iter() function - def test_iter_basic(self): - self.check_iterator(iter(range(10)), range(10)) - - # Test that iter(iter(x)) is the same as iter(x) - def test_iter_idempotency(self): - seq = range(10) - it = iter(seq) - it2 = iter(it) - self.assert_(it is it2) - - # Test that for loops over iterators work - def test_iter_for_loop(self): - self.check_for_loop(iter(range(10)), range(10)) - - # Test several independent iterators over the same list - def test_iter_independence(self): - seq = range(3) - res = [] - for i in iter(seq): - for j in iter(seq): - for k in iter(seq): - res.append((i, j, k)) - self.assertEqual(res, TRIPLETS) - - # Test triple list comprehension using iterators - def test_nested_comprehensions_iter(self): - seq = range(3) - res = [(i, j, k) - for i in iter(seq) for j in iter(seq) for k in iter(seq)] - self.assertEqual(res, TRIPLETS) - - # Test triple list comprehension without iterators - def test_nested_comprehensions_for(self): - seq = range(3) - res = [(i, j, k) for i in seq for j in seq for k in seq] - self.assertEqual(res, TRIPLETS) - - # Test a class with __iter__ in a for loop - def test_iter_class_for(self): - self.check_for_loop(IteratingSequenceClass(10), range(10)) - - # Test a class with __iter__ with explicit iter() - def test_iter_class_iter(self): - self.check_iterator(iter(IteratingSequenceClass(10)), range(10)) - - # Test for loop on a sequence class without __iter__ - def test_seq_class_for(self): - self.check_for_loop(SequenceClass(10), range(10)) - - # Test iter() on a sequence class without __iter__ - def test_seq_class_iter(self): - self.check_iterator(iter(SequenceClass(10)), range(10)) - - # Test two-argument iter() with callable instance - def test_iter_callable(self): - class C: - def __init__(self): - self.i = 0 - def __call__(self): - i = self.i - self.i = i + 1 - if i > 100: - raise IndexError # Emergency stop - return i - self.check_iterator(iter(C(), 10), range(10)) - - # Test two-argument iter() with function - def test_iter_function(self): - def spam(state=[0]): - i = state[0] - state[0] = i+1 - return i - self.check_iterator(iter(spam, 10), range(10)) - - # Test two-argument iter() with function that raises StopIteration - def test_iter_function_stop(self): - def spam(state=[0]): - i = state[0] - if i == 10: - raise StopIteration - state[0] = i+1 - return i - self.check_iterator(iter(spam, 20), range(10)) - - # Test exception propagation through function iterator - def test_exception_function(self): - def spam(state=[0]): - i = state[0] - state[0] = i+1 - if i == 10: - raise RuntimeError - return i - res = [] - try: - for x in iter(spam, 20): - res.append(x) - except RuntimeError: - self.assertEqual(res, range(10)) - else: - self.fail("should have raised RuntimeError") - - # Test exception propagation through sequence iterator - def test_exception_sequence(self): - class MySequenceClass(SequenceClass): - def __getitem__(self, i): - if i == 10: - raise RuntimeError - return SequenceClass.__getitem__(self, i) - res = [] - try: - for x in MySequenceClass(20): - res.append(x) - except RuntimeError: - self.assertEqual(res, range(10)) - else: - self.fail("should have raised RuntimeError") - - # Test for StopIteration from __getitem__ - def test_stop_sequence(self): - class MySequenceClass(SequenceClass): - def __getitem__(self, i): - if i == 10: - raise StopIteration - return SequenceClass.__getitem__(self, i) - self.check_for_loop(MySequenceClass(20), range(10)) - - # Test a big range - def test_iter_big_range(self): - self.check_for_loop(iter(range(10000)), range(10000)) - - # Test an empty list - def test_iter_empty(self): - self.check_for_loop(iter([]), []) - - # Test a tuple - def test_iter_tuple(self): - self.check_for_loop(iter((0,1,2,3,4,5,6,7,8,9)), range(10)) - - # Test an xrange - def test_iter_xrange(self): - self.check_for_loop(iter(xrange(10)), range(10)) - - # Test a string - def test_iter_string(self): - self.check_for_loop(iter("abcde"), ["a", "b", "c", "d", "e"]) - - # Test a Unicode string - if have_unicode: - def test_iter_unicode(self): - self.check_for_loop(iter(unicode("abcde")), - [unicode("a"), unicode("b"), unicode("c"), - unicode("d"), unicode("e")]) - - # Test a directory - def test_iter_dict(self): - dict = {} - for i in range(10): - dict[i] = None - self.check_for_loop(dict, dict.keys()) - - # Test a file - def test_iter_file(self): - f = open(TESTFN, "w") - try: - for i in range(5): - f.write("%d\n" % i) - finally: - f.close() - f = open(TESTFN, "r") - try: - self.check_for_loop(f, ["0\n", "1\n", "2\n", "3\n", "4\n"]) - self.check_for_loop(f, []) - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - # Test list()'s use of iterators. - def test_builtin_list(self): - self.assertEqual(list(SequenceClass(5)), range(5)) - self.assertEqual(list(SequenceClass(0)), []) - self.assertEqual(list(()), []) - self.assertEqual(list(range(10, -1, -1)), range(10, -1, -1)) - - d = {"one": 1, "two": 2, "three": 3} - self.assertEqual(list(d), d.keys()) - - self.assertRaises(TypeError, list, list) - self.assertRaises(TypeError, list, 42) - - f = open(TESTFN, "w") - try: - for i in range(5): - f.write("%d\n" % i) - finally: - f.close() - f = open(TESTFN, "r") - try: - self.assertEqual(list(f), ["0\n", "1\n", "2\n", "3\n", "4\n"]) - f.seek(0, 0) - self.assertEqual(list(f), - ["0\n", "1\n", "2\n", "3\n", "4\n"]) - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - # Test tuples()'s use of iterators. - def test_builtin_tuple(self): - self.assertEqual(tuple(SequenceClass(5)), (0, 1, 2, 3, 4)) - self.assertEqual(tuple(SequenceClass(0)), ()) - self.assertEqual(tuple([]), ()) - self.assertEqual(tuple(()), ()) - self.assertEqual(tuple("abc"), ("a", "b", "c")) - - d = {"one": 1, "two": 2, "three": 3} - self.assertEqual(tuple(d), tuple(d.keys())) - - self.assertRaises(TypeError, tuple, list) - self.assertRaises(TypeError, tuple, 42) - - f = open(TESTFN, "w") - try: - for i in range(5): - f.write("%d\n" % i) - finally: - f.close() - f = open(TESTFN, "r") - try: - self.assertEqual(tuple(f), ("0\n", "1\n", "2\n", "3\n", "4\n")) - f.seek(0, 0) - self.assertEqual(tuple(f), - ("0\n", "1\n", "2\n", "3\n", "4\n")) - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - # Test filter()'s use of iterators. - def test_builtin_filter(self): - self.assertEqual(filter(None, SequenceClass(5)), range(1, 5)) - self.assertEqual(filter(None, SequenceClass(0)), []) - self.assertEqual(filter(None, ()), ()) - self.assertEqual(filter(None, "abc"), "abc") - - d = {"one": 1, "two": 2, "three": 3} - self.assertEqual(filter(None, d), d.keys()) - - self.assertRaises(TypeError, filter, None, list) - self.assertRaises(TypeError, filter, None, 42) - - class Boolean: - def __init__(self, truth): - self.truth = truth - def __nonzero__(self): - return self.truth - bTrue = Boolean(1) - bFalse = Boolean(0) - - class Seq: - def __init__(self, *args): - self.vals = args - def __iter__(self): - class SeqIter: - def __init__(self, vals): - self.vals = vals - self.i = 0 - def __iter__(self): - return self - def next(self): - i = self.i - self.i = i + 1 - if i < len(self.vals): - return self.vals[i] - else: - raise StopIteration - return SeqIter(self.vals) - - seq = Seq(*([bTrue, bFalse] * 25)) - self.assertEqual(filter(lambda x: not x, seq), [bFalse]*25) - self.assertEqual(filter(lambda x: not x, iter(seq)), [bFalse]*25) - - # Test max() and min()'s use of iterators. - def test_builtin_max_min(self): - self.assertEqual(max(SequenceClass(5)), 4) - self.assertEqual(min(SequenceClass(5)), 0) - self.assertEqual(max(8, -1), 8) - self.assertEqual(min(8, -1), -1) - - d = {"one": 1, "two": 2, "three": 3} - self.assertEqual(max(d), "two") - self.assertEqual(min(d), "one") - self.assertEqual(max(d.itervalues()), 3) - self.assertEqual(min(iter(d.itervalues())), 1) - - f = open(TESTFN, "w") - try: - f.write("medium line\n") - f.write("xtra large line\n") - f.write("itty-bitty line\n") - finally: - f.close() - f = open(TESTFN, "r") - try: - self.assertEqual(min(f), "itty-bitty line\n") - f.seek(0, 0) - self.assertEqual(max(f), "xtra large line\n") - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - # Test map()'s use of iterators. - def test_builtin_map(self): - self.assertEqual(map(None, SequenceClass(5)), range(5)) - self.assertEqual(map(lambda x: x+1, SequenceClass(5)), range(1, 6)) - - d = {"one": 1, "two": 2, "three": 3} - self.assertEqual(map(None, d), d.keys()) - self.assertEqual(map(lambda k, d=d: (k, d[k]), d), d.items()) - dkeys = d.keys() - expected = [(i < len(d) and dkeys[i] or None, - i, - i < len(d) and dkeys[i] or None) - for i in range(5)] - self.assertEqual(map(None, d, - SequenceClass(5), - iter(d.iterkeys())), - expected) - - f = open(TESTFN, "w") - try: - for i in range(10): - f.write("xy" * i + "\n") # line i has len 2*i+1 - finally: - f.close() - f = open(TESTFN, "r") - try: - self.assertEqual(map(len, f), range(1, 21, 2)) - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - # Test zip()'s use of iterators. - def test_builtin_zip(self): - self.assertEqual(zip(), []) - self.assertEqual(zip(*[]), []) - self.assertEqual(zip(*[(1, 2), 'ab']), [(1, 'a'), (2, 'b')]) - - self.assertRaises(TypeError, zip, None) - self.assertRaises(TypeError, zip, range(10), 42) - self.assertRaises(TypeError, zip, range(10), zip) - - self.assertEqual(zip(IteratingSequenceClass(3)), - [(0,), (1,), (2,)]) - self.assertEqual(zip(SequenceClass(3)), - [(0,), (1,), (2,)]) - - d = {"one": 1, "two": 2, "three": 3} - self.assertEqual(d.items(), zip(d, d.itervalues())) - - # Generate all ints starting at constructor arg. - class IntsFrom: - def __init__(self, start): - self.i = start - - def __iter__(self): - return self - - def next(self): - i = self.i - self.i = i+1 - return i - - f = open(TESTFN, "w") - try: - f.write("a\n" "bbb\n" "cc\n") - finally: - f.close() - f = open(TESTFN, "r") - try: - self.assertEqual(zip(IntsFrom(0), f, IntsFrom(-100)), - [(0, "a\n", -100), - (1, "bbb\n", -99), - (2, "cc\n", -98)]) - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - self.assertEqual(zip(xrange(5)), [(i,) for i in range(5)]) - - # Classes that lie about their lengths. - class NoGuessLen5: - def __getitem__(self, i): - if i >= 5: - raise IndexError - return i - - class Guess3Len5(NoGuessLen5): - def __len__(self): - return 3 - - class Guess30Len5(NoGuessLen5): - def __len__(self): - return 30 - - self.assertEqual(len(Guess3Len5()), 3) - self.assertEqual(len(Guess30Len5()), 30) - self.assertEqual(zip(NoGuessLen5()), zip(range(5))) - self.assertEqual(zip(Guess3Len5()), zip(range(5))) - self.assertEqual(zip(Guess30Len5()), zip(range(5))) - - expected = [(i, i) for i in range(5)] - for x in NoGuessLen5(), Guess3Len5(), Guess30Len5(): - for y in NoGuessLen5(), Guess3Len5(), Guess30Len5(): - self.assertEqual(zip(x, y), expected) - - # Test reduces()'s use of iterators. - def test_builtin_reduce(self): - from operator import add - self.assertEqual(reduce(add, SequenceClass(5)), 10) - self.assertEqual(reduce(add, SequenceClass(5), 42), 52) - self.assertRaises(TypeError, reduce, add, SequenceClass(0)) - self.assertEqual(reduce(add, SequenceClass(0), 42), 42) - self.assertEqual(reduce(add, SequenceClass(1)), 0) - self.assertEqual(reduce(add, SequenceClass(1), 42), 42) - - d = {"one": 1, "two": 2, "three": 3} - self.assertEqual(reduce(add, d), "".join(d.keys())) - - # This test case will be removed if we don't have Unicode - def test_unicode_join_endcase(self): - - # This class inserts a Unicode object into its argument's natural - # iteration, in the 3rd position. - class OhPhooey: - def __init__(self, seq): - self.it = iter(seq) - self.i = 0 - - def __iter__(self): - return self - - def next(self): - i = self.i - self.i = i+1 - if i == 2: - return unicode("fooled you!") - return self.it.next() - - f = open(TESTFN, "w") - try: - f.write("a\n" + "b\n" + "c\n") - finally: - f.close() - - f = open(TESTFN, "r") - # Nasty: string.join(s) can't know whether unicode.join() is needed - # until it's seen all of s's elements. But in this case, f's - # iterator cannot be restarted. So what we're testing here is - # whether string.join() can manage to remember everything it's seen - # and pass that on to unicode.join(). - try: - got = " - ".join(OhPhooey(f)) - self.assertEqual(got, unicode("a\n - b\n - fooled you! - c\n")) - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - if not have_unicode: - def test_unicode_join_endcase(self): pass - - # Test iterators with 'x in y' and 'x not in y'. - def test_in_and_not_in(self): - for sc5 in IteratingSequenceClass(5), SequenceClass(5): - for i in range(5): - self.assert_(i in sc5) - for i in "abc", -1, 5, 42.42, (3, 4), [], {1: 1}, 3-12j, sc5: - self.assert_(i not in sc5) - - self.assertRaises(TypeError, lambda: 3 in 12) - self.assertRaises(TypeError, lambda: 3 not in map) - - d = {"one": 1, "two": 2, "three": 3, 1j: 2j} - for k in d: - self.assert_(k in d) - self.assert_(k not in d.itervalues()) - for v in d.values(): - self.assert_(v in d.itervalues()) - self.assert_(v not in d) - for k, v in d.iteritems(): - self.assert_((k, v) in d.iteritems()) - self.assert_((v, k) not in d.iteritems()) - - f = open(TESTFN, "w") - try: - f.write("a\n" "b\n" "c\n") - finally: - f.close() - f = open(TESTFN, "r") - try: - for chunk in "abc": - f.seek(0, 0) - self.assert_(chunk not in f) - f.seek(0, 0) - self.assert_((chunk + "\n") in f) - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - # Test iterators with operator.countOf (PySequence_Count). - def test_countOf(self): - from operator import countOf - self.assertEqual(countOf([1,2,2,3,2,5], 2), 3) - self.assertEqual(countOf((1,2,2,3,2,5), 2), 3) - self.assertEqual(countOf("122325", "2"), 3) - self.assertEqual(countOf("122325", "6"), 0) - - self.assertRaises(TypeError, countOf, 42, 1) - self.assertRaises(TypeError, countOf, countOf, countOf) - - d = {"one": 3, "two": 3, "three": 3, 1j: 2j} - for k in d: - self.assertEqual(countOf(d, k), 1) - self.assertEqual(countOf(d.itervalues(), 3), 3) - self.assertEqual(countOf(d.itervalues(), 2j), 1) - self.assertEqual(countOf(d.itervalues(), 1j), 0) - - f = open(TESTFN, "w") - try: - f.write("a\n" "b\n" "c\n" "b\n") - finally: - f.close() - f = open(TESTFN, "r") - try: - for letter, count in ("a", 1), ("b", 2), ("c", 1), ("d", 0): - f.seek(0, 0) - self.assertEqual(countOf(f, letter + "\n"), count) - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - # Test iterators with operator.indexOf (PySequence_Index). - def test_indexOf(self): - from operator import indexOf - self.assertEqual(indexOf([1,2,2,3,2,5], 1), 0) - self.assertEqual(indexOf((1,2,2,3,2,5), 2), 1) - self.assertEqual(indexOf((1,2,2,3,2,5), 3), 3) - self.assertEqual(indexOf((1,2,2,3,2,5), 5), 5) - self.assertRaises(ValueError, indexOf, (1,2,2,3,2,5), 0) - self.assertRaises(ValueError, indexOf, (1,2,2,3,2,5), 6) - - self.assertEqual(indexOf("122325", "2"), 1) - self.assertEqual(indexOf("122325", "5"), 5) - self.assertRaises(ValueError, indexOf, "122325", "6") - - self.assertRaises(TypeError, indexOf, 42, 1) - self.assertRaises(TypeError, indexOf, indexOf, indexOf) - - f = open(TESTFN, "w") - try: - f.write("a\n" "b\n" "c\n" "d\n" "e\n") - finally: - f.close() - f = open(TESTFN, "r") - try: - fiter = iter(f) - self.assertEqual(indexOf(fiter, "b\n"), 1) - self.assertEqual(indexOf(fiter, "d\n"), 1) - self.assertEqual(indexOf(fiter, "e\n"), 0) - self.assertRaises(ValueError, indexOf, fiter, "a\n") - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - iclass = IteratingSequenceClass(3) - for i in range(3): - self.assertEqual(indexOf(iclass, i), i) - self.assertRaises(ValueError, indexOf, iclass, -1) - - # Test iterators with file.writelines(). - def test_writelines(self): - f = file(TESTFN, "w") - - try: - self.assertRaises(TypeError, f.writelines, None) - self.assertRaises(TypeError, f.writelines, 42) - - f.writelines(["1\n", "2\n"]) - f.writelines(("3\n", "4\n")) - f.writelines({'5\n': None}) - f.writelines({}) - - # Try a big chunk too. - class Iterator: - def __init__(self, start, finish): - self.start = start - self.finish = finish - self.i = self.start - - def next(self): - if self.i >= self.finish: - raise StopIteration - result = str(self.i) + '\n' - self.i += 1 - return result - - def __iter__(self): - return self - - class Whatever: - def __init__(self, start, finish): - self.start = start - self.finish = finish - - def __iter__(self): - return Iterator(self.start, self.finish) - - f.writelines(Whatever(6, 6+2000)) - f.close() - - f = file(TESTFN) - expected = [str(i) + "\n" for i in range(1, 2006)] - self.assertEqual(list(f), expected) - - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - - # Test iterators on RHS of unpacking assignments. - def test_unpack_iter(self): - a, b = 1, 2 - self.assertEqual((a, b), (1, 2)) - - a, b, c = IteratingSequenceClass(3) - self.assertEqual((a, b, c), (0, 1, 2)) - - try: # too many values - a, b = IteratingSequenceClass(3) - except ValueError: - pass - else: - self.fail("should have raised ValueError") - - try: # not enough values - a, b, c = IteratingSequenceClass(2) - except ValueError: - pass - else: - self.fail("should have raised ValueError") - - try: # not iterable - a, b, c = len - except TypeError: - pass - else: - self.fail("should have raised TypeError") - - a, b, c = {1: 42, 2: 42, 3: 42}.itervalues() - self.assertEqual((a, b, c), (42, 42, 42)) - - f = open(TESTFN, "w") - lines = ("a\n", "bb\n", "ccc\n") - try: - for line in lines: - f.write(line) - finally: - f.close() - f = open(TESTFN, "r") - try: - a, b, c = f - self.assertEqual((a, b, c), lines) - finally: - f.close() - try: - unlink(TESTFN) - except OSError: - pass - - (a, b), (c,) = IteratingSequenceClass(2), {42: 24} - self.assertEqual((a, b, c), (0, 1, 42)) - - # Test reference count behavior - - class C(object): - count = 0 - def __new__(cls): - cls.count += 1 - return object.__new__(cls) - def __del__(self): - cls = self.__class__ - assert cls.count > 0 - cls.count -= 1 - x = C() - self.assertEqual(C.count, 1) - del x - self.assertEqual(C.count, 0) - l = [C(), C(), C()] - self.assertEqual(C.count, 3) - try: - a, b = iter(l) - except ValueError: - pass - del l - self.assertEqual(C.count, 0) - - - # Make sure StopIteration is a "sink state". - # This tests various things that weren't sink states in Python 2.2.1, - # plus various things that always were fine. - - def test_sinkstate_list(self): - # This used to fail - a = range(5) - b = iter(a) - self.assertEqual(list(b), range(5)) - a.extend(range(5, 10)) - self.assertEqual(list(b), []) - - def test_sinkstate_tuple(self): - a = (0, 1, 2, 3, 4) - b = iter(a) - self.assertEqual(list(b), range(5)) - self.assertEqual(list(b), []) - - def test_sinkstate_string(self): - a = "abcde" - b = iter(a) - self.assertEqual(list(b), ['a', 'b', 'c', 'd', 'e']) - self.assertEqual(list(b), []) - - def test_sinkstate_sequence(self): - # This used to fail - a = SequenceClass(5) - b = iter(a) - self.assertEqual(list(b), range(5)) - a.n = 10 - self.assertEqual(list(b), []) - - def test_sinkstate_callable(self): - # This used to fail - def spam(state=[0]): - i = state[0] - state[0] = i+1 - if i == 10: - raise AssertionError, "shouldn't have gotten this far" - return i - b = iter(spam, 5) - self.assertEqual(list(b), range(5)) - self.assertEqual(list(b), []) - - def test_sinkstate_dict(self): - # XXX For a more thorough test, see towards the end of: - # http://mail.python.org/pipermail/python-dev/2002-July/026512.html - a = {1:1, 2:2, 0:0, 4:4, 3:3} - for b in iter(a), a.iterkeys(), a.iteritems(), a.itervalues(): - b = iter(a) - self.assertEqual(len(list(b)), 5) - self.assertEqual(list(b), []) - - def test_sinkstate_yield(self): - def gen(): - for i in range(5): - yield i - b = gen() - self.assertEqual(list(b), range(5)) - self.assertEqual(list(b), []) - - def test_sinkstate_range(self): - a = xrange(5) - b = iter(a) - self.assertEqual(list(b), range(5)) - self.assertEqual(list(b), []) - - def test_sinkstate_enumerate(self): - a = range(5) - e = enumerate(a) - b = iter(e) - self.assertEqual(list(b), zip(range(5), range(5))) - self.assertEqual(list(b), []) - - -def test_main(): - run_unittest(TestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_iterlen.py b/sys/lib/python/test/test_iterlen.py deleted file mode 100644 index af4467e13..000000000 --- a/sys/lib/python/test/test_iterlen.py +++ /dev/null @@ -1,258 +0,0 @@ -""" Test Iterator Length Transparency - -Some functions or methods which accept general iterable arguments have -optional, more efficient code paths if they know how many items to expect. -For instance, map(func, iterable), will pre-allocate the exact amount of -space required whenever the iterable can report its length. - -The desired invariant is: len(it)==len(list(it)). - -A complication is that an iterable and iterator can be the same object. To -maintain the invariant, an iterator needs to dynamically update its length. -For instance, an iterable such as xrange(10) always reports its length as ten, -but it=iter(xrange(10)) starts at ten, and then goes to nine after it.next(). -Having this capability means that map() can ignore the distinction between -map(func, iterable) and map(func, iter(iterable)). - -When the iterable is immutable, the implementation can straight-forwardly -report the original length minus the cumulative number of calls to next(). -This is the case for tuples, xrange objects, and itertools.repeat(). - -Some containers become temporarily immutable during iteration. This includes -dicts, sets, and collections.deque. Their implementation is equally simple -though they need to permantently set their length to zero whenever there is -an attempt to iterate after a length mutation. - -The situation slightly more involved whenever an object allows length mutation -during iteration. Lists and sequence iterators are dynanamically updatable. -So, if a list is extended during iteration, the iterator will continue through -the new items. If it shrinks to a point before the most recent iteration, -then no further items are available and the length is reported at zero. - -Reversed objects can also be wrapped around mutable objects; however, any -appends after the current position are ignored. Any other approach leads -to confusion and possibly returning the same item more than once. - -The iterators not listed above, such as enumerate and the other itertools, -are not length transparent because they have no way to distinguish between -iterables that report static length and iterators whose length changes with -each call (i.e. the difference between enumerate('abc') and -enumerate(iter('abc')). - -""" - -import unittest -from test import test_support -from itertools import repeat -from collections import deque -from UserList import UserList -from __builtin__ import len as _len - -n = 10 - -def len(obj): - try: - return _len(obj) - except TypeError: - try: - # note: this is an internal undocumented API, - # don't rely on it in your own programs - return obj.__length_hint__() - except AttributeError: - raise TypeError - -class TestInvariantWithoutMutations(unittest.TestCase): - - def test_invariant(self): - it = self.it - for i in reversed(xrange(1, n+1)): - self.assertEqual(len(it), i) - it.next() - self.assertEqual(len(it), 0) - self.assertRaises(StopIteration, it.next) - self.assertEqual(len(it), 0) - -class TestTemporarilyImmutable(TestInvariantWithoutMutations): - - def test_immutable_during_iteration(self): - # objects such as deques, sets, and dictionaries enforce - # length immutability during iteration - - it = self.it - self.assertEqual(len(it), n) - it.next() - self.assertEqual(len(it), n-1) - self.mutate() - self.assertRaises(RuntimeError, it.next) - self.assertEqual(len(it), 0) - -## ------- Concrete Type Tests ------- - -class TestRepeat(TestInvariantWithoutMutations): - - def setUp(self): - self.it = repeat(None, n) - - def test_no_len_for_infinite_repeat(self): - # The repeat() object can also be infinite - self.assertRaises(TypeError, len, repeat(None)) - -class TestXrange(TestInvariantWithoutMutations): - - def setUp(self): - self.it = iter(xrange(n)) - -class TestXrangeCustomReversed(TestInvariantWithoutMutations): - - def setUp(self): - self.it = reversed(xrange(n)) - -class TestTuple(TestInvariantWithoutMutations): - - def setUp(self): - self.it = iter(tuple(xrange(n))) - -## ------- Types that should not be mutated during iteration ------- - -class TestDeque(TestTemporarilyImmutable): - - def setUp(self): - d = deque(xrange(n)) - self.it = iter(d) - self.mutate = d.pop - -class TestDequeReversed(TestTemporarilyImmutable): - - def setUp(self): - d = deque(xrange(n)) - self.it = reversed(d) - self.mutate = d.pop - -class TestDictKeys(TestTemporarilyImmutable): - - def setUp(self): - d = dict.fromkeys(xrange(n)) - self.it = iter(d) - self.mutate = d.popitem - -class TestDictItems(TestTemporarilyImmutable): - - def setUp(self): - d = dict.fromkeys(xrange(n)) - self.it = d.iteritems() - self.mutate = d.popitem - -class TestDictValues(TestTemporarilyImmutable): - - def setUp(self): - d = dict.fromkeys(xrange(n)) - self.it = d.itervalues() - self.mutate = d.popitem - -class TestSet(TestTemporarilyImmutable): - - def setUp(self): - d = set(xrange(n)) - self.it = iter(d) - self.mutate = d.pop - -## ------- Types that can mutate during iteration ------- - -class TestList(TestInvariantWithoutMutations): - - def setUp(self): - self.it = iter(range(n)) - - def test_mutation(self): - d = range(n) - it = iter(d) - it.next() - it.next() - self.assertEqual(len(it), n-2) - d.append(n) - self.assertEqual(len(it), n-1) # grow with append - d[1:] = [] - self.assertEqual(len(it), 0) - self.assertEqual(list(it), []) - d.extend(xrange(20)) - self.assertEqual(len(it), 0) - -class TestListReversed(TestInvariantWithoutMutations): - - def setUp(self): - self.it = reversed(range(n)) - - def test_mutation(self): - d = range(n) - it = reversed(d) - it.next() - it.next() - self.assertEqual(len(it), n-2) - d.append(n) - self.assertEqual(len(it), n-2) # ignore append - d[1:] = [] - self.assertEqual(len(it), 0) - self.assertEqual(list(it), []) # confirm invariant - d.extend(xrange(20)) - self.assertEqual(len(it), 0) - -class TestSeqIter(TestInvariantWithoutMutations): - - def setUp(self): - self.it = iter(UserList(range(n))) - - def test_mutation(self): - d = UserList(range(n)) - it = iter(d) - it.next() - it.next() - self.assertEqual(len(it), n-2) - d.append(n) - self.assertEqual(len(it), n-1) # grow with append - d[1:] = [] - self.assertEqual(len(it), 0) - self.assertEqual(list(it), []) - d.extend(xrange(20)) - self.assertEqual(len(it), 0) - -class TestSeqIterReversed(TestInvariantWithoutMutations): - - def setUp(self): - self.it = reversed(UserList(range(n))) - - def test_mutation(self): - d = UserList(range(n)) - it = reversed(d) - it.next() - it.next() - self.assertEqual(len(it), n-2) - d.append(n) - self.assertEqual(len(it), n-2) # ignore append - d[1:] = [] - self.assertEqual(len(it), 0) - self.assertEqual(list(it), []) # confirm invariant - d.extend(xrange(20)) - self.assertEqual(len(it), 0) - - -def test_main(): - unittests = [ - TestRepeat, - TestXrange, - TestXrangeCustomReversed, - TestTuple, - TestDeque, - TestDequeReversed, - TestDictKeys, - TestDictItems, - TestDictValues, - TestSet, - TestList, - TestListReversed, - TestSeqIter, - TestSeqIterReversed, - ] - test_support.run_unittest(*unittests) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_itertools.py b/sys/lib/python/test/test_itertools.py deleted file mode 100644 index c965d4c14..000000000 --- a/sys/lib/python/test/test_itertools.py +++ /dev/null @@ -1,969 +0,0 @@ -import unittest -from test import test_support -from itertools import * -from weakref import proxy -import sys -import operator -import random - -def onearg(x): - 'Test function of one argument' - return 2*x - -def errfunc(*args): - 'Test function that raises an error' - raise ValueError - -def gen3(): - 'Non-restartable source sequence' - for i in (0, 1, 2): - yield i - -def isEven(x): - 'Test predicate' - return x%2==0 - -def isOdd(x): - 'Test predicate' - return x%2==1 - -class StopNow: - 'Class emulating an empty iterable.' - def __iter__(self): - return self - def next(self): - raise StopIteration - -def take(n, seq): - 'Convenience function for partially consuming a long of infinite iterable' - return list(islice(seq, n)) - -class TestBasicOps(unittest.TestCase): - def test_chain(self): - self.assertEqual(list(chain('abc', 'def')), list('abcdef')) - self.assertEqual(list(chain('abc')), list('abc')) - self.assertEqual(list(chain('')), []) - self.assertEqual(take(4, chain('abc', 'def')), list('abcd')) - self.assertRaises(TypeError, chain, 2, 3) - - def test_count(self): - self.assertEqual(zip('abc',count()), [('a', 0), ('b', 1), ('c', 2)]) - self.assertEqual(zip('abc',count(3)), [('a', 3), ('b', 4), ('c', 5)]) - self.assertEqual(take(2, zip('abc',count(3))), [('a', 3), ('b', 4)]) - self.assertRaises(TypeError, count, 2, 3) - self.assertRaises(TypeError, count, 'a') - self.assertRaises(OverflowError, list, islice(count(sys.maxint-5), 10)) - c = count(3) - self.assertEqual(repr(c), 'count(3)') - c.next() - self.assertEqual(repr(c), 'count(4)') - c = count(-9) - self.assertEqual(repr(c), 'count(-9)') - c.next() - self.assertEqual(c.next(), -8) - - def test_cycle(self): - self.assertEqual(take(10, cycle('abc')), list('abcabcabca')) - self.assertEqual(list(cycle('')), []) - self.assertRaises(TypeError, cycle) - self.assertRaises(TypeError, cycle, 5) - self.assertEqual(list(islice(cycle(gen3()),10)), [0,1,2,0,1,2,0,1,2,0]) - - def test_groupby(self): - # Check whether it accepts arguments correctly - self.assertEqual([], list(groupby([]))) - self.assertEqual([], list(groupby([], key=id))) - self.assertRaises(TypeError, list, groupby('abc', [])) - self.assertRaises(TypeError, groupby, None) - self.assertRaises(TypeError, groupby, 'abc', lambda x:x, 10) - - # Check normal input - s = [(0, 10, 20), (0, 11,21), (0,12,21), (1,13,21), (1,14,22), - (2,15,22), (3,16,23), (3,17,23)] - dup = [] - for k, g in groupby(s, lambda r:r[0]): - for elem in g: - self.assertEqual(k, elem[0]) - dup.append(elem) - self.assertEqual(s, dup) - - # Check nested case - dup = [] - for k, g in groupby(s, lambda r:r[0]): - for ik, ig in groupby(g, lambda r:r[2]): - for elem in ig: - self.assertEqual(k, elem[0]) - self.assertEqual(ik, elem[2]) - dup.append(elem) - self.assertEqual(s, dup) - - # Check case where inner iterator is not used - keys = [k for k, g in groupby(s, lambda r:r[0])] - expectedkeys = set([r[0] for r in s]) - self.assertEqual(set(keys), expectedkeys) - self.assertEqual(len(keys), len(expectedkeys)) - - # Exercise pipes and filters style - s = 'abracadabra' - # sort s | uniq - r = [k for k, g in groupby(sorted(s))] - self.assertEqual(r, ['a', 'b', 'c', 'd', 'r']) - # sort s | uniq -d - r = [k for k, g in groupby(sorted(s)) if list(islice(g,1,2))] - self.assertEqual(r, ['a', 'b', 'r']) - # sort s | uniq -c - r = [(len(list(g)), k) for k, g in groupby(sorted(s))] - self.assertEqual(r, [(5, 'a'), (2, 'b'), (1, 'c'), (1, 'd'), (2, 'r')]) - # sort s | uniq -c | sort -rn | head -3 - r = sorted([(len(list(g)) , k) for k, g in groupby(sorted(s))], reverse=True)[:3] - self.assertEqual(r, [(5, 'a'), (2, 'r'), (2, 'b')]) - - # iter.next failure - class ExpectedError(Exception): - pass - def delayed_raise(n=0): - for i in range(n): - yield 'yo' - raise ExpectedError - def gulp(iterable, keyp=None, func=list): - return [func(g) for k, g in groupby(iterable, keyp)] - - # iter.next failure on outer object - self.assertRaises(ExpectedError, gulp, delayed_raise(0)) - # iter.next failure on inner object - self.assertRaises(ExpectedError, gulp, delayed_raise(1)) - - # __cmp__ failure - class DummyCmp: - def __cmp__(self, dst): - raise ExpectedError - s = [DummyCmp(), DummyCmp(), None] - - # __cmp__ failure on outer object - self.assertRaises(ExpectedError, gulp, s, func=id) - # __cmp__ failure on inner object - self.assertRaises(ExpectedError, gulp, s) - - # keyfunc failure - def keyfunc(obj): - if keyfunc.skip > 0: - keyfunc.skip -= 1 - return obj - else: - raise ExpectedError - - # keyfunc failure on outer object - keyfunc.skip = 0 - self.assertRaises(ExpectedError, gulp, [None], keyfunc) - keyfunc.skip = 1 - self.assertRaises(ExpectedError, gulp, [None, None], keyfunc) - - def test_ifilter(self): - self.assertEqual(list(ifilter(isEven, range(6))), [0,2,4]) - self.assertEqual(list(ifilter(None, [0,1,0,2,0])), [1,2]) - self.assertEqual(take(4, ifilter(isEven, count())), [0,2,4,6]) - self.assertRaises(TypeError, ifilter) - self.assertRaises(TypeError, ifilter, lambda x:x) - self.assertRaises(TypeError, ifilter, lambda x:x, range(6), 7) - self.assertRaises(TypeError, ifilter, isEven, 3) - self.assertRaises(TypeError, ifilter(range(6), range(6)).next) - - def test_ifilterfalse(self): - self.assertEqual(list(ifilterfalse(isEven, range(6))), [1,3,5]) - self.assertEqual(list(ifilterfalse(None, [0,1,0,2,0])), [0,0,0]) - self.assertEqual(take(4, ifilterfalse(isEven, count())), [1,3,5,7]) - self.assertRaises(TypeError, ifilterfalse) - self.assertRaises(TypeError, ifilterfalse, lambda x:x) - self.assertRaises(TypeError, ifilterfalse, lambda x:x, range(6), 7) - self.assertRaises(TypeError, ifilterfalse, isEven, 3) - self.assertRaises(TypeError, ifilterfalse(range(6), range(6)).next) - - def test_izip(self): - ans = [(x,y) for x, y in izip('abc',count())] - self.assertEqual(ans, [('a', 0), ('b', 1), ('c', 2)]) - self.assertEqual(list(izip('abc', range(6))), zip('abc', range(6))) - self.assertEqual(list(izip('abcdef', range(3))), zip('abcdef', range(3))) - self.assertEqual(take(3,izip('abcdef', count())), zip('abcdef', range(3))) - self.assertEqual(list(izip('abcdef')), zip('abcdef')) - self.assertEqual(list(izip()), zip()) - self.assertRaises(TypeError, izip, 3) - self.assertRaises(TypeError, izip, range(3), 3) - # Check tuple re-use (implementation detail) - self.assertEqual([tuple(list(pair)) for pair in izip('abc', 'def')], - zip('abc', 'def')) - self.assertEqual([pair for pair in izip('abc', 'def')], - zip('abc', 'def')) - ids = map(id, izip('abc', 'def')) - self.assertEqual(min(ids), max(ids)) - ids = map(id, list(izip('abc', 'def'))) - self.assertEqual(len(dict.fromkeys(ids)), len(ids)) - - def test_repeat(self): - self.assertEqual(zip(xrange(3),repeat('a')), - [(0, 'a'), (1, 'a'), (2, 'a')]) - self.assertEqual(list(repeat('a', 3)), ['a', 'a', 'a']) - self.assertEqual(take(3, repeat('a')), ['a', 'a', 'a']) - self.assertEqual(list(repeat('a', 0)), []) - self.assertEqual(list(repeat('a', -3)), []) - self.assertRaises(TypeError, repeat) - self.assertRaises(TypeError, repeat, None, 3, 4) - self.assertRaises(TypeError, repeat, None, 'a') - r = repeat(1+0j) - self.assertEqual(repr(r), 'repeat((1+0j))') - r = repeat(1+0j, 5) - self.assertEqual(repr(r), 'repeat((1+0j), 5)') - list(r) - self.assertEqual(repr(r), 'repeat((1+0j), 0)') - - def test_imap(self): - self.assertEqual(list(imap(operator.pow, range(3), range(1,7))), - [0**1, 1**2, 2**3]) - self.assertEqual(list(imap(None, 'abc', range(5))), - [('a',0),('b',1),('c',2)]) - self.assertEqual(list(imap(None, 'abc', count())), - [('a',0),('b',1),('c',2)]) - self.assertEqual(take(2,imap(None, 'abc', count())), - [('a',0),('b',1)]) - self.assertEqual(list(imap(operator.pow, [])), []) - self.assertRaises(TypeError, imap) - self.assertRaises(TypeError, imap, operator.neg) - self.assertRaises(TypeError, imap(10, range(5)).next) - self.assertRaises(ValueError, imap(errfunc, [4], [5]).next) - self.assertRaises(TypeError, imap(onearg, [4], [5]).next) - - def test_starmap(self): - self.assertEqual(list(starmap(operator.pow, zip(range(3), range(1,7)))), - [0**1, 1**2, 2**3]) - self.assertEqual(take(3, starmap(operator.pow, izip(count(), count(1)))), - [0**1, 1**2, 2**3]) - self.assertEqual(list(starmap(operator.pow, [])), []) - self.assertRaises(TypeError, list, starmap(operator.pow, [[4,5]])) - self.assertRaises(TypeError, starmap) - self.assertRaises(TypeError, starmap, operator.pow, [(4,5)], 'extra') - self.assertRaises(TypeError, starmap(10, [(4,5)]).next) - self.assertRaises(ValueError, starmap(errfunc, [(4,5)]).next) - self.assertRaises(TypeError, starmap(onearg, [(4,5)]).next) - - def test_islice(self): - for args in [ # islice(args) should agree with range(args) - (10, 20, 3), - (10, 3, 20), - (10, 20), - (10, 3), - (20,) - ]: - self.assertEqual(list(islice(xrange(100), *args)), range(*args)) - - for args, tgtargs in [ # Stop when seqn is exhausted - ((10, 110, 3), ((10, 100, 3))), - ((10, 110), ((10, 100))), - ((110,), (100,)) - ]: - self.assertEqual(list(islice(xrange(100), *args)), range(*tgtargs)) - - # Test stop=None - self.assertEqual(list(islice(xrange(10), None)), range(10)) - self.assertEqual(list(islice(xrange(10), None, None)), range(10)) - self.assertEqual(list(islice(xrange(10), None, None, None)), range(10)) - self.assertEqual(list(islice(xrange(10), 2, None)), range(2, 10)) - self.assertEqual(list(islice(xrange(10), 1, None, 2)), range(1, 10, 2)) - - # Test number of items consumed SF #1171417 - it = iter(range(10)) - self.assertEqual(list(islice(it, 3)), range(3)) - self.assertEqual(list(it), range(3, 10)) - - # Test invalid arguments - self.assertRaises(TypeError, islice, xrange(10)) - self.assertRaises(TypeError, islice, xrange(10), 1, 2, 3, 4) - self.assertRaises(ValueError, islice, xrange(10), -5, 10, 1) - self.assertRaises(ValueError, islice, xrange(10), 1, -5, -1) - self.assertRaises(ValueError, islice, xrange(10), 1, 10, -1) - self.assertRaises(ValueError, islice, xrange(10), 1, 10, 0) - self.assertRaises(ValueError, islice, xrange(10), 'a') - self.assertRaises(ValueError, islice, xrange(10), 'a', 1) - self.assertRaises(ValueError, islice, xrange(10), 1, 'a') - self.assertRaises(ValueError, islice, xrange(10), 'a', 1, 1) - self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1) - self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1) - - def test_takewhile(self): - data = [1, 3, 5, 20, 2, 4, 6, 8] - underten = lambda x: x<10 - self.assertEqual(list(takewhile(underten, data)), [1, 3, 5]) - self.assertEqual(list(takewhile(underten, [])), []) - self.assertRaises(TypeError, takewhile) - self.assertRaises(TypeError, takewhile, operator.pow) - self.assertRaises(TypeError, takewhile, operator.pow, [(4,5)], 'extra') - self.assertRaises(TypeError, takewhile(10, [(4,5)]).next) - self.assertRaises(ValueError, takewhile(errfunc, [(4,5)]).next) - t = takewhile(bool, [1, 1, 1, 0, 0, 0]) - self.assertEqual(list(t), [1, 1, 1]) - self.assertRaises(StopIteration, t.next) - - def test_dropwhile(self): - data = [1, 3, 5, 20, 2, 4, 6, 8] - underten = lambda x: x<10 - self.assertEqual(list(dropwhile(underten, data)), [20, 2, 4, 6, 8]) - self.assertEqual(list(dropwhile(underten, [])), []) - self.assertRaises(TypeError, dropwhile) - self.assertRaises(TypeError, dropwhile, operator.pow) - self.assertRaises(TypeError, dropwhile, operator.pow, [(4,5)], 'extra') - self.assertRaises(TypeError, dropwhile(10, [(4,5)]).next) - self.assertRaises(ValueError, dropwhile(errfunc, [(4,5)]).next) - - def test_tee(self): - n = 200 - def irange(n): - for i in xrange(n): - yield i - - a, b = tee([]) # test empty iterator - self.assertEqual(list(a), []) - self.assertEqual(list(b), []) - - a, b = tee(irange(n)) # test 100% interleaved - self.assertEqual(zip(a,b), zip(range(n),range(n))) - - a, b = tee(irange(n)) # test 0% interleaved - self.assertEqual(list(a), range(n)) - self.assertEqual(list(b), range(n)) - - a, b = tee(irange(n)) # test dealloc of leading iterator - for i in xrange(100): - self.assertEqual(a.next(), i) - del a - self.assertEqual(list(b), range(n)) - - a, b = tee(irange(n)) # test dealloc of trailing iterator - for i in xrange(100): - self.assertEqual(a.next(), i) - del b - self.assertEqual(list(a), range(100, n)) - - for j in xrange(5): # test randomly interleaved - order = [0]*n + [1]*n - random.shuffle(order) - lists = ([], []) - its = tee(irange(n)) - for i in order: - value = its[i].next() - lists[i].append(value) - self.assertEqual(lists[0], range(n)) - self.assertEqual(lists[1], range(n)) - - # test argument format checking - self.assertRaises(TypeError, tee) - self.assertRaises(TypeError, tee, 3) - self.assertRaises(TypeError, tee, [1,2], 'x') - self.assertRaises(TypeError, tee, [1,2], 3, 'x') - - # tee object should be instantiable - a, b = tee('abc') - c = type(a)('def') - self.assertEqual(list(c), list('def')) - - # test long-lagged and multi-way split - a, b, c = tee(xrange(2000), 3) - for i in xrange(100): - self.assertEqual(a.next(), i) - self.assertEqual(list(b), range(2000)) - self.assertEqual([c.next(), c.next()], range(2)) - self.assertEqual(list(a), range(100,2000)) - self.assertEqual(list(c), range(2,2000)) - - # test values of n - self.assertRaises(TypeError, tee, 'abc', 'invalid') - self.assertRaises(ValueError, tee, [], -1) - for n in xrange(5): - result = tee('abc', n) - self.assertEqual(type(result), tuple) - self.assertEqual(len(result), n) - self.assertEqual(map(list, result), [list('abc')]*n) - - # tee pass-through to copyable iterator - a, b = tee('abc') - c, d = tee(a) - self.assert_(a is c) - - # test tee_new - t1, t2 = tee('abc') - tnew = type(t1) - self.assertRaises(TypeError, tnew) - self.assertRaises(TypeError, tnew, 10) - t3 = tnew(t1) - self.assert_(list(t1) == list(t2) == list(t3) == list('abc')) - - # test that tee objects are weak referencable - a, b = tee(xrange(10)) - p = proxy(a) - self.assertEqual(getattr(p, '__class__'), type(b)) - del a - self.assertRaises(ReferenceError, getattr, p, '__class__') - - def test_StopIteration(self): - self.assertRaises(StopIteration, izip().next) - - for f in (chain, cycle, izip, groupby): - self.assertRaises(StopIteration, f([]).next) - self.assertRaises(StopIteration, f(StopNow()).next) - - self.assertRaises(StopIteration, islice([], None).next) - self.assertRaises(StopIteration, islice(StopNow(), None).next) - - p, q = tee([]) - self.assertRaises(StopIteration, p.next) - self.assertRaises(StopIteration, q.next) - p, q = tee(StopNow()) - self.assertRaises(StopIteration, p.next) - self.assertRaises(StopIteration, q.next) - - self.assertRaises(StopIteration, repeat(None, 0).next) - - for f in (ifilter, ifilterfalse, imap, takewhile, dropwhile, starmap): - self.assertRaises(StopIteration, f(lambda x:x, []).next) - self.assertRaises(StopIteration, f(lambda x:x, StopNow()).next) - -class TestGC(unittest.TestCase): - - def makecycle(self, iterator, container): - container.append(iterator) - iterator.next() - del container, iterator - - def test_chain(self): - a = [] - self.makecycle(chain(a), a) - - def test_cycle(self): - a = [] - self.makecycle(cycle([a]*2), a) - - def test_dropwhile(self): - a = [] - self.makecycle(dropwhile(bool, [0, a, a]), a) - - def test_groupby(self): - a = [] - self.makecycle(groupby([a]*2, lambda x:x), a) - - def test_ifilter(self): - a = [] - self.makecycle(ifilter(lambda x:True, [a]*2), a) - - def test_ifilterfalse(self): - a = [] - self.makecycle(ifilterfalse(lambda x:False, a), a) - - def test_izip(self): - a = [] - self.makecycle(izip([a]*2, [a]*3), a) - - def test_imap(self): - a = [] - self.makecycle(imap(lambda x:x, [a]*2), a) - - def test_islice(self): - a = [] - self.makecycle(islice([a]*2, None), a) - - def test_repeat(self): - a = [] - self.makecycle(repeat(a), a) - - def test_starmap(self): - a = [] - self.makecycle(starmap(lambda *t: t, [(a,a)]*2), a) - - def test_takewhile(self): - a = [] - self.makecycle(takewhile(bool, [1, 0, a, a]), a) - -def R(seqn): - 'Regular generator' - for i in seqn: - yield i - -class G: - 'Sequence using __getitem__' - def __init__(self, seqn): - self.seqn = seqn - def __getitem__(self, i): - return self.seqn[i] - -class I: - 'Sequence using iterator protocol' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class Ig: - 'Sequence using iterator protocol defined with a generator' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - for val in self.seqn: - yield val - -class X: - 'Missing __getitem__ and __iter__' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class N: - 'Iterator missing next()' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - -class E: - 'Test propagation of exceptions' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - 3 // 0 - -class S: - 'Test immediate stop' - def __init__(self, seqn): - pass - def __iter__(self): - return self - def next(self): - raise StopIteration - -def L(seqn): - 'Test multiple tiers of iterators' - return chain(imap(lambda x:x, R(Ig(G(seqn))))) - - -class TestVariousIteratorArgs(unittest.TestCase): - - def test_chain(self): - for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(chain(g(s))), list(g(s))) - self.assertEqual(list(chain(g(s), g(s))), list(g(s))+list(g(s))) - self.assertRaises(TypeError, chain, X(s)) - self.assertRaises(TypeError, list, chain(N(s))) - self.assertRaises(ZeroDivisionError, list, chain(E(s))) - - def test_cycle(self): - for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - tgtlen = len(s) * 3 - expected = list(g(s))*3 - actual = list(islice(cycle(g(s)), tgtlen)) - self.assertEqual(actual, expected) - self.assertRaises(TypeError, cycle, X(s)) - self.assertRaises(TypeError, list, cycle(N(s))) - self.assertRaises(ZeroDivisionError, list, cycle(E(s))) - - def test_groupby(self): - for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual([k for k, sb in groupby(g(s))], list(g(s))) - self.assertRaises(TypeError, groupby, X(s)) - self.assertRaises(TypeError, list, groupby(N(s))) - self.assertRaises(ZeroDivisionError, list, groupby(E(s))) - - def test_ifilter(self): - for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(ifilter(isEven, g(s))), filter(isEven, g(s))) - self.assertRaises(TypeError, ifilter, isEven, X(s)) - self.assertRaises(TypeError, list, ifilter(isEven, N(s))) - self.assertRaises(ZeroDivisionError, list, ifilter(isEven, E(s))) - - def test_ifilterfalse(self): - for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(ifilterfalse(isEven, g(s))), filter(isOdd, g(s))) - self.assertRaises(TypeError, ifilterfalse, isEven, X(s)) - self.assertRaises(TypeError, list, ifilterfalse(isEven, N(s))) - self.assertRaises(ZeroDivisionError, list, ifilterfalse(isEven, E(s))) - - def test_izip(self): - for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(izip(g(s))), zip(g(s))) - self.assertEqual(list(izip(g(s), g(s))), zip(g(s), g(s))) - self.assertRaises(TypeError, izip, X(s)) - self.assertRaises(TypeError, list, izip(N(s))) - self.assertRaises(ZeroDivisionError, list, izip(E(s))) - - def test_imap(self): - for s in (range(10), range(0), range(100), (7,11), xrange(20,50,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(imap(onearg, g(s))), map(onearg, g(s))) - self.assertEqual(list(imap(operator.pow, g(s), g(s))), map(operator.pow, g(s), g(s))) - self.assertRaises(TypeError, imap, onearg, X(s)) - self.assertRaises(TypeError, list, imap(onearg, N(s))) - self.assertRaises(ZeroDivisionError, list, imap(onearg, E(s))) - - def test_islice(self): - for s in ("12345", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(islice(g(s),1,None,2)), list(g(s))[1::2]) - self.assertRaises(TypeError, islice, X(s), 10) - self.assertRaises(TypeError, list, islice(N(s), 10)) - self.assertRaises(ZeroDivisionError, list, islice(E(s), 10)) - - def test_starmap(self): - for s in (range(10), range(0), range(100), (7,11), xrange(20,50,5)): - for g in (G, I, Ig, S, L, R): - ss = zip(s, s) - self.assertEqual(list(starmap(operator.pow, g(ss))), map(operator.pow, g(s), g(s))) - self.assertRaises(TypeError, starmap, operator.pow, X(ss)) - self.assertRaises(TypeError, list, starmap(operator.pow, N(ss))) - self.assertRaises(ZeroDivisionError, list, starmap(operator.pow, E(ss))) - - def test_takewhile(self): - for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - tgt = [] - for elem in g(s): - if not isEven(elem): break - tgt.append(elem) - self.assertEqual(list(takewhile(isEven, g(s))), tgt) - self.assertRaises(TypeError, takewhile, isEven, X(s)) - self.assertRaises(TypeError, list, takewhile(isEven, N(s))) - self.assertRaises(ZeroDivisionError, list, takewhile(isEven, E(s))) - - def test_dropwhile(self): - for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - tgt = [] - for elem in g(s): - if not tgt and isOdd(elem): continue - tgt.append(elem) - self.assertEqual(list(dropwhile(isOdd, g(s))), tgt) - self.assertRaises(TypeError, dropwhile, isOdd, X(s)) - self.assertRaises(TypeError, list, dropwhile(isOdd, N(s))) - self.assertRaises(ZeroDivisionError, list, dropwhile(isOdd, E(s))) - - def test_tee(self): - for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - it1, it2 = tee(g(s)) - self.assertEqual(list(it1), list(g(s))) - self.assertEqual(list(it2), list(g(s))) - self.assertRaises(TypeError, tee, X(s)) - self.assertRaises(TypeError, list, tee(N(s))[0]) - self.assertRaises(ZeroDivisionError, list, tee(E(s))[0]) - -class LengthTransparency(unittest.TestCase): - - def test_repeat(self): - from test.test_iterlen import len - self.assertEqual(len(repeat(None, 50)), 50) - self.assertRaises(TypeError, len, repeat(None)) - -class RegressionTests(unittest.TestCase): - - def test_sf_793826(self): - # Fix Armin Rigo's successful efforts to wreak havoc - - def mutatingtuple(tuple1, f, tuple2): - # this builds a tuple t which is a copy of tuple1, - # then calls f(t), then mutates t to be equal to tuple2 - # (needs len(tuple1) == len(tuple2)). - def g(value, first=[1]): - if first: - del first[:] - f(z.next()) - return value - items = list(tuple2) - items[1:1] = list(tuple1) - gen = imap(g, items) - z = izip(*[gen]*len(tuple1)) - z.next() - - def f(t): - global T - T = t - first[:] = list(T) - - first = [] - mutatingtuple((1,2,3), f, (4,5,6)) - second = list(T) - self.assertEqual(first, second) - - - def test_sf_950057(self): - # Make sure that chain() and cycle() catch exceptions immediately - # rather than when shifting between input sources - - def gen1(): - hist.append(0) - yield 1 - hist.append(1) - raise AssertionError - hist.append(2) - - def gen2(x): - hist.append(3) - yield 2 - hist.append(4) - if x: - raise StopIteration - - hist = [] - self.assertRaises(AssertionError, list, chain(gen1(), gen2(False))) - self.assertEqual(hist, [0,1]) - - hist = [] - self.assertRaises(AssertionError, list, chain(gen1(), gen2(True))) - self.assertEqual(hist, [0,1]) - - hist = [] - self.assertRaises(AssertionError, list, cycle(gen1())) - self.assertEqual(hist, [0,1]) - -class SubclassWithKwargsTest(unittest.TestCase): - def test_keywords_in_subclass(self): - # count is not subclassable... - for cls in (repeat, izip, ifilter, ifilterfalse, chain, imap, - starmap, islice, takewhile, dropwhile, cycle): - class Subclass(cls): - def __init__(self, newarg=None, *args): - cls.__init__(self, *args) - try: - Subclass(newarg=1) - except TypeError, err: - # we expect type errors because of wrong argument count - self.failIf("does not take keyword arguments" in err.args[0]) - - -libreftest = """ Doctest for examples in the library reference: libitertools.tex - - ->>> amounts = [120.15, 764.05, 823.14] ->>> for checknum, amount in izip(count(1200), amounts): -... print 'Check %d is for $%.2f' % (checknum, amount) -... -Check 1200 is for $120.15 -Check 1201 is for $764.05 -Check 1202 is for $823.14 - ->>> import operator ->>> for cube in imap(operator.pow, xrange(1,4), repeat(3)): -... print cube -... -1 -8 -27 - ->>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', '', 'martin', '', 'walter', '', 'samuele'] ->>> for name in islice(reportlines, 3, None, 2): -... print name.title() -... -Alex -Laura -Martin -Walter -Samuele - ->>> from operator import itemgetter ->>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) ->>> di = sorted(sorted(d.iteritems()), key=itemgetter(1)) ->>> for k, g in groupby(di, itemgetter(1)): -... print k, map(itemgetter(0), g) -... -1 ['a', 'c', 'e'] -2 ['b', 'd', 'f'] -3 ['g'] - -# Find runs of consecutive numbers using groupby. The key to the solution -# is differencing with a range so that consecutive numbers all appear in -# same group. ->>> data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28] ->>> for k, g in groupby(enumerate(data), lambda (i,x):i-x): -... print map(operator.itemgetter(1), g) -... -[1] -[4, 5, 6] -[10] -[15, 16, 17, 18] -[22] -[25, 26, 27, 28] - ->>> def take(n, seq): -... return list(islice(seq, n)) - ->>> def enumerate(iterable): -... return izip(count(), iterable) - ->>> def tabulate(function): -... "Return function(0), function(1), ..." -... return imap(function, count()) - ->>> def iteritems(mapping): -... return izip(mapping.iterkeys(), mapping.itervalues()) - ->>> def nth(iterable, n): -... "Returns the nth item" -... return list(islice(iterable, n, n+1)) - ->>> def all(seq, pred=None): -... "Returns True if pred(x) is true for every element in the iterable" -... for elem in ifilterfalse(pred, seq): -... return False -... return True - ->>> def any(seq, pred=None): -... "Returns True if pred(x) is true for at least one element in the iterable" -... for elem in ifilter(pred, seq): -... return True -... return False - ->>> def no(seq, pred=None): -... "Returns True if pred(x) is false for every element in the iterable" -... for elem in ifilter(pred, seq): -... return False -... return True - ->>> def quantify(seq, pred=None): -... "Count how many times the predicate is true in the sequence" -... return sum(imap(pred, seq)) - ->>> def padnone(seq): -... "Returns the sequence elements and then returns None indefinitely" -... return chain(seq, repeat(None)) - ->>> def ncycles(seq, n): -... "Returns the sequence elements n times" -... return chain(*repeat(seq, n)) - ->>> def dotproduct(vec1, vec2): -... return sum(imap(operator.mul, vec1, vec2)) - ->>> def flatten(listOfLists): -... return list(chain(*listOfLists)) - ->>> def repeatfunc(func, times=None, *args): -... "Repeat calls to func with specified arguments." -... " Example: repeatfunc(random.random)" -... if times is None: -... return starmap(func, repeat(args)) -... else: -... return starmap(func, repeat(args, times)) - ->>> def pairwise(iterable): -... "s -> (s0,s1), (s1,s2), (s2, s3), ..." -... a, b = tee(iterable) -... try: -... b.next() -... except StopIteration: -... pass -... return izip(a, b) - -This is not part of the examples but it tests to make sure the definitions -perform as purported. - ->>> take(10, count()) -[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - ->>> list(enumerate('abc')) -[(0, 'a'), (1, 'b'), (2, 'c')] - ->>> list(islice(tabulate(lambda x: 2*x), 4)) -[0, 2, 4, 6] - ->>> nth('abcde', 3) -['d'] - ->>> all([2, 4, 6, 8], lambda x: x%2==0) -True - ->>> all([2, 3, 6, 8], lambda x: x%2==0) -False - ->>> any([2, 4, 6, 8], lambda x: x%2==0) -True - ->>> any([1, 3, 5, 9], lambda x: x%2==0,) -False - ->>> no([1, 3, 5, 9], lambda x: x%2==0) -True - ->>> no([1, 2, 5, 9], lambda x: x%2==0) -False - ->>> quantify(xrange(99), lambda x: x%2==0) -50 - ->>> a = [[1, 2, 3], [4, 5, 6]] ->>> flatten(a) -[1, 2, 3, 4, 5, 6] - ->>> list(repeatfunc(pow, 5, 2, 3)) -[8, 8, 8, 8, 8] - ->>> import random ->>> take(5, imap(int, repeatfunc(random.random))) -[0, 0, 0, 0, 0] - ->>> list(pairwise('abcd')) -[('a', 'b'), ('b', 'c'), ('c', 'd')] - ->>> list(pairwise([])) -[] - ->>> list(pairwise('a')) -[] - ->>> list(islice(padnone('abc'), 0, 6)) -['a', 'b', 'c', None, None, None] - ->>> list(ncycles('abc', 3)) -['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] - ->>> dotproduct([1,2,3], [4,5,6]) -32 - -""" - -__test__ = {'libreftest' : libreftest} - -def test_main(verbose=None): - test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC, - RegressionTests, LengthTransparency, - SubclassWithKwargsTest) - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - - # doctest the examples in the library reference - test_support.run_doctest(sys.modules[__name__], verbose) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_largefile.py b/sys/lib/python/test/test_largefile.py deleted file mode 100644 index 4dca97ffd..000000000 --- a/sys/lib/python/test/test_largefile.py +++ /dev/null @@ -1,170 +0,0 @@ -#!python - -#---------------------------------------------------------------------- -# test largefile support on system where this makes sense -# -#---------------------------------------------------------------------- - -from test import test_support -import os, struct, stat, sys - -try: - import signal - # The default handler for SIGXFSZ is to abort the process. - # By ignoring it, system calls exceeding the file size resource - # limit will raise IOError instead of crashing the interpreter. - oldhandler = signal.signal(signal.SIGXFSZ, signal.SIG_IGN) -except (ImportError, AttributeError): - pass - - -# create >2GB file (2GB = 2147483648 bytes) -size = 2500000000L -name = test_support.TESTFN - - -# On Windows and Mac OSX this test comsumes large resources; It takes -# a long time to build the >2GB file and takes >2GB of disk space -# therefore the resource must be enabled to run this test. If not, -# nothing after this line stanza will be executed. -if sys.platform[:3] == 'win' or sys.platform == 'darwin': - test_support.requires( - 'largefile', - 'test requires %s bytes and a long time to run' % str(size)) -else: - # Only run if the current filesystem supports large files. - # (Skip this test on Windows, since we now always support large files.) - f = open(test_support.TESTFN, 'wb') - try: - # 2**31 == 2147483648 - f.seek(2147483649L) - # Seeking is not enough of a test: you must write and flush, too! - f.write("x") - f.flush() - except (IOError, OverflowError): - f.close() - os.unlink(test_support.TESTFN) - raise test_support.TestSkipped, \ - "filesystem does not have largefile support" - else: - f.close() - - -def expect(got_this, expect_this): - if test_support.verbose: - print '%r =?= %r ...' % (got_this, expect_this), - if got_this != expect_this: - if test_support.verbose: - print 'no' - raise test_support.TestFailed, 'got %r, but expected %r' %\ - (got_this, expect_this) - else: - if test_support.verbose: - print 'yes' - - -# test that each file function works as expected for a large (i.e. >2GB, do -# we have to check >4GB) files - -if test_support.verbose: - print 'create large file via seek (may be sparse file) ...' -f = open(name, 'wb') -try: - f.write('z') - f.seek(0) - f.seek(size) - f.write('a') - f.flush() - if test_support.verbose: - print 'check file size with os.fstat' - expect(os.fstat(f.fileno())[stat.ST_SIZE], size+1) -finally: - f.close() -if test_support.verbose: - print 'check file size with os.stat' -expect(os.stat(name)[stat.ST_SIZE], size+1) - -if test_support.verbose: - print 'play around with seek() and read() with the built largefile' -f = open(name, 'rb') -try: - expect(f.tell(), 0) - expect(f.read(1), 'z') - expect(f.tell(), 1) - f.seek(0) - expect(f.tell(), 0) - f.seek(0, 0) - expect(f.tell(), 0) - f.seek(42) - expect(f.tell(), 42) - f.seek(42, 0) - expect(f.tell(), 42) - f.seek(42, 1) - expect(f.tell(), 84) - f.seek(0, 1) - expect(f.tell(), 84) - f.seek(0, 2) # seek from the end - expect(f.tell(), size + 1 + 0) - f.seek(-10, 2) - expect(f.tell(), size + 1 - 10) - f.seek(-size-1, 2) - expect(f.tell(), 0) - f.seek(size) - expect(f.tell(), size) - expect(f.read(1), 'a') # the 'a' that was written at the end of file above - f.seek(-size-1, 1) - expect(f.read(1), 'z') - expect(f.tell(), 1) -finally: - f.close() - -if test_support.verbose: - print 'play around with os.lseek() with the built largefile' -f = open(name, 'rb') -try: - expect(os.lseek(f.fileno(), 0, 0), 0) - expect(os.lseek(f.fileno(), 42, 0), 42) - expect(os.lseek(f.fileno(), 42, 1), 84) - expect(os.lseek(f.fileno(), 0, 1), 84) - expect(os.lseek(f.fileno(), 0, 2), size+1+0) - expect(os.lseek(f.fileno(), -10, 2), size+1-10) - expect(os.lseek(f.fileno(), -size-1, 2), 0) - expect(os.lseek(f.fileno(), size, 0), size) - expect(f.read(1), 'a') # the 'a' that was written at the end of file above -finally: - f.close() - -if hasattr(f, 'truncate'): - if test_support.verbose: - print 'try truncate' - f = open(name, 'r+b') - try: - f.seek(0, 2) - expect(f.tell(), size+1) # else we've lost track of the true size - # Cut it back via seek + truncate with no argument. - newsize = size - 10 - f.seek(newsize) - f.truncate() - expect(f.tell(), newsize) # else pointer moved - f.seek(0, 2) - expect(f.tell(), newsize) # else wasn't truncated - # Ensure that truncate(smaller than true size) shrinks the file. - newsize -= 1 - f.seek(42) - f.truncate(newsize) - expect(f.tell(), 42) # else pointer moved - f.seek(0, 2) - expect(f.tell(), newsize) # else wasn't truncated - - # XXX truncate(larger than true size) is ill-defined across platforms - - # cut it waaaaay back - f.seek(0) - f.truncate(1) - expect(f.tell(), 0) # else pointer moved - expect(len(f.read()), 1) # else wasn't truncated - - finally: - f.close() - -os.unlink(name) diff --git a/sys/lib/python/test/test_linuxaudiodev.py b/sys/lib/python/test/test_linuxaudiodev.py deleted file mode 100644 index fe902b5a0..000000000 --- a/sys/lib/python/test/test_linuxaudiodev.py +++ /dev/null @@ -1,92 +0,0 @@ -from test import test_support -test_support.requires('audio') - -from test.test_support import verbose, findfile, TestFailed, TestSkipped - -import errno -import fcntl -import linuxaudiodev -import os -import sys -import select -import sunaudio -import time -import audioop - -SND_FORMAT_MULAW_8 = 1 - -def play_sound_file(path): - fp = open(path, 'r') - size, enc, rate, nchannels, extra = sunaudio.gethdr(fp) - data = fp.read() - fp.close() - - if enc != SND_FORMAT_MULAW_8: - print "Expect .au file with 8-bit mu-law samples" - return - - try: - a = linuxaudiodev.open('w') - except linuxaudiodev.error, msg: - if msg[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY): - raise TestSkipped, msg - raise TestFailed, msg - - # convert the data to 16-bit signed - data = audioop.ulaw2lin(data, 2) - - # set the data format - if sys.byteorder == 'little': - fmt = linuxaudiodev.AFMT_S16_LE - else: - fmt = linuxaudiodev.AFMT_S16_BE - - # at least check that these methods can be invoked - a.bufsize() - a.obufcount() - a.obuffree() - a.getptr() - a.fileno() - - # set parameters based on .au file headers - a.setparameters(rate, 16, nchannels, fmt) - a.write(data) - a.flush() - a.close() - -def test_errors(): - a = linuxaudiodev.open("w") - size = 8 - fmt = linuxaudiodev.AFMT_U8 - rate = 8000 - nchannels = 1 - try: - a.setparameters(-1, size, nchannels, fmt) - except ValueError, msg: - print msg - try: - a.setparameters(rate, -2, nchannels, fmt) - except ValueError, msg: - print msg - try: - a.setparameters(rate, size, 3, fmt) - except ValueError, msg: - print msg - try: - a.setparameters(rate, size, nchannels, 177) - except ValueError, msg: - print msg - try: - a.setparameters(rate, size, nchannels, linuxaudiodev.AFMT_U16_LE) - except ValueError, msg: - print msg - try: - a.setparameters(rate, 16, nchannels, fmt) - except ValueError, msg: - print msg - -def test(): - play_sound_file(findfile('audiotest.au')) - test_errors() - -test() diff --git a/sys/lib/python/test/test_list.py b/sys/lib/python/test/test_list.py deleted file mode 100644 index 711ac4b75..000000000 --- a/sys/lib/python/test/test_list.py +++ /dev/null @@ -1,37 +0,0 @@ -import unittest -from test import test_support, list_tests - -class ListTest(list_tests.CommonTest): - type2test = list - - def test_truth(self): - super(ListTest, self).test_truth() - self.assert_(not []) - self.assert_([42]) - - def test_identity(self): - self.assert_([] is not []) - - def test_len(self): - super(ListTest, self).test_len() - self.assertEqual(len([]), 0) - self.assertEqual(len([0]), 1) - self.assertEqual(len([0, 1, 2]), 3) - -def test_main(verbose=None): - test_support.run_unittest(ListTest) - - # verify reference counting - import sys - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(ListTest) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_locale.py b/sys/lib/python/test/test_locale.py deleted file mode 100644 index 9e264b9c4..000000000 --- a/sys/lib/python/test/test_locale.py +++ /dev/null @@ -1,115 +0,0 @@ -from test.test_support import verbose, TestSkipped -import locale -import sys - -if sys.platform == 'darwin': - raise TestSkipped("Locale support on MacOSX is minimal and cannot be tested") -oldlocale = locale.setlocale(locale.LC_NUMERIC) - -if sys.platform.startswith("win"): - tlocs = ("en",) -else: - tlocs = ("en_US.UTF-8", "en_US.US-ASCII", "en_US") - -for tloc in tlocs: - try: - locale.setlocale(locale.LC_NUMERIC, tloc) - break - except locale.Error: - continue -else: - raise ImportError, "test locale not supported (tried %s)"%(', '.join(tlocs)) - -def testformat(formatstr, value, grouping = 0, output=None, func=locale.format): - if verbose: - if output: - print "%s %% %s =? %s ..." %\ - (repr(formatstr), repr(value), repr(output)), - else: - print "%s %% %s works? ..." % (repr(formatstr), repr(value)), - result = func(formatstr, value, grouping = grouping) - if output and result != output: - if verbose: - print 'no' - print "%s %% %s == %s != %s" %\ - (repr(formatstr), repr(value), repr(result), repr(output)) - else: - if verbose: - print "yes" - -try: - # On Solaris 10, the thousands_sep is the empty string - sep = locale.localeconv()['thousands_sep'] - testformat("%f", 1024, grouping=1, output='1%s024.000000' % sep) - testformat("%f", 102, grouping=1, output='102.000000') - testformat("%f", -42, grouping=1, output='-42.000000') - testformat("%+f", -42, grouping=1, output='-42.000000') - testformat("%20.f", -42, grouping=1, output=' -42') - testformat("%+10.f", -4200, grouping=1, output=' -4%s200' % sep) - testformat("%-10.f", 4200, grouping=1, output='4%s200 ' % sep) - # Invoke getpreferredencoding to make sure it does not cause exceptions, - locale.getpreferredencoding() - - # === Test format() with more complex formatting strings - # test if grouping is independent from other characters in formatting string - testformat("One million is %i", 1000000, grouping=1, - output='One million is 1%s000%s000' % (sep, sep), - func=locale.format_string) - testformat("One million is %i", 1000000, grouping=1, - output='One million is 1%s000%s000' % (sep, sep), - func=locale.format_string) - # test dots in formatting string - testformat(".%f.", 1000.0, output='.1000.000000.', func=locale.format_string) - # test floats - testformat("--> %10.2f", 1000.0, grouping=1, output='--> 1%s000.00' % sep, - func=locale.format_string) - # test asterisk formats - testformat("%10.*f", (2, 1000.0), grouping=0, output=' 1000.00', - func=locale.format_string) - testformat("%*.*f", (10, 2, 1000.0), grouping=1, output=' 1%s000.00' % sep, - func=locale.format_string) - # test more-in-one - testformat("int %i float %.2f str %s", (1000, 1000.0, 'str'), grouping=1, - output='int 1%s000 float 1%s000.00 str str' % (sep, sep), - func=locale.format_string) - -finally: - locale.setlocale(locale.LC_NUMERIC, oldlocale) - - -# Test BSD Rune locale's bug for isctype functions. -def teststrop(s, method, output): - if verbose: - print "%s.%s() =? %s ..." % (repr(s), method, repr(output)), - result = getattr(s, method)() - if result != output: - if verbose: - print "no" - print "%s.%s() == %s != %s" % (repr(s), method, repr(result), - repr(output)) - elif verbose: - print "yes" - -try: - if sys.platform == 'sunos5': - # On Solaris, in en_US.UTF-8, \xa0 is a space - raise locale.Error - oldlocale = locale.setlocale(locale.LC_CTYPE) - locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8') -except locale.Error: - pass -else: - try: - teststrop('\x20', 'isspace', True) - teststrop('\xa0', 'isspace', False) - teststrop('\xa1', 'isspace', False) - teststrop('\xc0', 'isalpha', False) - teststrop('\xc0', 'isalnum', False) - teststrop('\xc0', 'isupper', False) - teststrop('\xc0', 'islower', False) - teststrop('\xec\xa0\xbc', 'split', ['\xec\xa0\xbc']) - teststrop('\xed\x95\xa0', 'strip', '\xed\x95\xa0') - teststrop('\xcc\x85', 'lower', '\xcc\x85') - teststrop('\xed\x95\xa0', 'upper', '\xed\x95\xa0') - finally: - locale.setlocale(locale.LC_CTYPE, oldlocale) diff --git a/sys/lib/python/test/test_logging.py b/sys/lib/python/test/test_logging.py deleted file mode 100644 index d96d703e1..000000000 --- a/sys/lib/python/test/test_logging.py +++ /dev/null @@ -1,685 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2001-2004 by Vinay Sajip. All Rights Reserved. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, -# provided that the above copyright notice appear in all copies and that -# both that copyright notice and this permission notice appear in -# supporting documentation, and that the name of Vinay Sajip -# not be used in advertising or publicity pertaining to distribution -# of the software without specific, written prior permission. -# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL -# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# This file is part of the Python logging distribution. See -# http://www.red-dove.com/python_logging.html -# -"""Test harness for the logging module. Run all tests. - -Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved. -""" - -import select -import os, sys, string, struct, types, cPickle, cStringIO -import socket, tempfile, threading, time -import logging, logging.handlers, logging.config -from test.test_support import run_with_locale - -BANNER = "-- %-10s %-6s ---------------------------------------------------\n" - -FINISH_UP = "Finish up, it's closing time. Messages should bear numbers 0 through 24." - -#---------------------------------------------------------------------------- -# Log receiver -#---------------------------------------------------------------------------- - -TIMEOUT = 10 - -from SocketServer import ThreadingTCPServer, StreamRequestHandler - -class LogRecordStreamHandler(StreamRequestHandler): - """ - Handler for a streaming logging request. It basically logs the record - using whatever logging policy is configured locally. - """ - - def handle(self): - """ - Handle multiple requests - each expected to be a 4-byte length, - followed by the LogRecord in pickle format. Logs the record - according to whatever policy is configured locally. - """ - while 1: - try: - chunk = self.connection.recv(4) - if len(chunk) < 4: - break - slen = struct.unpack(">L", chunk)[0] - chunk = self.connection.recv(slen) - while len(chunk) < slen: - chunk = chunk + self.connection.recv(slen - len(chunk)) - obj = self.unPickle(chunk) - record = logging.makeLogRecord(obj) - self.handleLogRecord(record) - except: - raise - - def unPickle(self, data): - return cPickle.loads(data) - - def handleLogRecord(self, record): - logname = "logrecv.tcp." + record.name - #If the end-of-messages sentinel is seen, tell the server to terminate - if record.msg == FINISH_UP: - self.server.abort = 1 - record.msg = record.msg + " (via " + logname + ")" - logger = logging.getLogger(logname) - logger.handle(record) - -# The server sets socketDataProcessed when it's done. -socketDataProcessed = threading.Event() - -class LogRecordSocketReceiver(ThreadingTCPServer): - """ - A simple-minded TCP socket-based logging receiver suitable for test - purposes. - """ - - allow_reuse_address = 1 - - def __init__(self, host='localhost', - port=logging.handlers.DEFAULT_TCP_LOGGING_PORT, - handler=LogRecordStreamHandler): - ThreadingTCPServer.__init__(self, (host, port), handler) - self.abort = 0 - self.timeout = 1 - - def serve_until_stopped(self): - while not self.abort: - rd, wr, ex = select.select([self.socket.fileno()], [], [], - self.timeout) - if rd: - self.handle_request() - #notify the main thread that we're about to exit - socketDataProcessed.set() - # close the listen socket - self.server_close() - - def process_request(self, request, client_address): - #import threading - t = threading.Thread(target = self.finish_request, - args = (request, client_address)) - t.start() - -def runTCP(tcpserver): - tcpserver.serve_until_stopped() - -#---------------------------------------------------------------------------- -# Test 0 -#---------------------------------------------------------------------------- - -msgcount = 0 - -def nextmessage(): - global msgcount - rv = "Message %d" % msgcount - msgcount = msgcount + 1 - return rv - -def test0(): - ERR = logging.getLogger("ERR") - ERR.setLevel(logging.ERROR) - INF = logging.getLogger("INF") - INF.setLevel(logging.INFO) - INF_ERR = logging.getLogger("INF.ERR") - INF_ERR.setLevel(logging.ERROR) - DEB = logging.getLogger("DEB") - DEB.setLevel(logging.DEBUG) - - INF_UNDEF = logging.getLogger("INF.UNDEF") - INF_ERR_UNDEF = logging.getLogger("INF.ERR.UNDEF") - UNDEF = logging.getLogger("UNDEF") - - GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF") - CHILD = logging.getLogger("INF.BADPARENT") - - #These should log - ERR.log(logging.FATAL, nextmessage()) - ERR.error(nextmessage()) - - INF.log(logging.FATAL, nextmessage()) - INF.error(nextmessage()) - INF.warn(nextmessage()) - INF.info(nextmessage()) - - INF_UNDEF.log(logging.FATAL, nextmessage()) - INF_UNDEF.error(nextmessage()) - INF_UNDEF.warn (nextmessage()) - INF_UNDEF.info (nextmessage()) - - INF_ERR.log(logging.FATAL, nextmessage()) - INF_ERR.error(nextmessage()) - - INF_ERR_UNDEF.log(logging.FATAL, nextmessage()) - INF_ERR_UNDEF.error(nextmessage()) - - DEB.log(logging.FATAL, nextmessage()) - DEB.error(nextmessage()) - DEB.warn (nextmessage()) - DEB.info (nextmessage()) - DEB.debug(nextmessage()) - - UNDEF.log(logging.FATAL, nextmessage()) - UNDEF.error(nextmessage()) - UNDEF.warn (nextmessage()) - UNDEF.info (nextmessage()) - - GRANDCHILD.log(logging.FATAL, nextmessage()) - CHILD.log(logging.FATAL, nextmessage()) - - #These should not log - ERR.warn(nextmessage()) - ERR.info(nextmessage()) - ERR.debug(nextmessage()) - - INF.debug(nextmessage()) - INF_UNDEF.debug(nextmessage()) - - INF_ERR.warn(nextmessage()) - INF_ERR.info(nextmessage()) - INF_ERR.debug(nextmessage()) - INF_ERR_UNDEF.warn(nextmessage()) - INF_ERR_UNDEF.info(nextmessage()) - INF_ERR_UNDEF.debug(nextmessage()) - - INF.info(FINISH_UP) - -#---------------------------------------------------------------------------- -# Test 1 -#---------------------------------------------------------------------------- - -# -# First, we define our levels. There can be as many as you want - the only -# limitations are that they should be integers, the lowest should be > 0 and -# larger values mean less information being logged. If you need specific -# level values which do not fit into these limitations, you can use a -# mapping dictionary to convert between your application levels and the -# logging system. -# -SILENT = 10 -TACITURN = 9 -TERSE = 8 -EFFUSIVE = 7 -SOCIABLE = 6 -VERBOSE = 5 -TALKATIVE = 4 -GARRULOUS = 3 -CHATTERBOX = 2 -BORING = 1 - -LEVEL_RANGE = range(BORING, SILENT + 1) - -# -# Next, we define names for our levels. You don't need to do this - in which -# case the system will use "Level n" to denote the text for the level. -# -my_logging_levels = { - SILENT : 'Silent', - TACITURN : 'Taciturn', - TERSE : 'Terse', - EFFUSIVE : 'Effusive', - SOCIABLE : 'Sociable', - VERBOSE : 'Verbose', - TALKATIVE : 'Talkative', - GARRULOUS : 'Garrulous', - CHATTERBOX : 'Chatterbox', - BORING : 'Boring', -} - -# -# Now, to demonstrate filtering: suppose for some perverse reason we only -# want to print out all except GARRULOUS messages. Let's create a filter for -# this purpose... -# -class SpecificLevelFilter(logging.Filter): - def __init__(self, lvl): - self.level = lvl - - def filter(self, record): - return self.level != record.levelno - -class GarrulousFilter(SpecificLevelFilter): - def __init__(self): - SpecificLevelFilter.__init__(self, GARRULOUS) - -# -# Now, let's demonstrate filtering at the logger. This time, use a filter -# which excludes SOCIABLE and TACITURN messages. Note that GARRULOUS events -# are still excluded. -# -class VerySpecificFilter(logging.Filter): - def filter(self, record): - return record.levelno not in [SOCIABLE, TACITURN] - -def message(s): - sys.stdout.write("%s\n" % s) - -SHOULD1 = "This should only be seen at the '%s' logging level (or lower)" - -def test1(): -# -# Now, tell the logging system to associate names with our levels. -# - for lvl in my_logging_levels.keys(): - logging.addLevelName(lvl, my_logging_levels[lvl]) - -# -# Now, define a test function which logs an event at each of our levels. -# - - def doLog(log): - for lvl in LEVEL_RANGE: - log.log(lvl, SHOULD1, logging.getLevelName(lvl)) - - log = logging.getLogger("") - hdlr = log.handlers[0] -# -# Set the logging level to each different value and call the utility -# function to log events. -# In the output, you should see that each time round the loop, the number of -# logging events which are actually output decreases. -# - for lvl in LEVEL_RANGE: - message("-- setting logging level to '%s' -----" % - logging.getLevelName(lvl)) - log.setLevel(lvl) - doLog(log) - # - # Now, we demonstrate level filtering at the handler level. Tell the - # handler defined above to filter at level 'SOCIABLE', and repeat the - # above loop. Compare the output from the two runs. - # - hdlr.setLevel(SOCIABLE) - message("-- Filtering at handler level to SOCIABLE --") - for lvl in LEVEL_RANGE: - message("-- setting logging level to '%s' -----" % - logging.getLevelName(lvl)) - log.setLevel(lvl) - doLog(log) - - hdlr.setLevel(0) #turn off level filtering at the handler - - garr = GarrulousFilter() - hdlr.addFilter(garr) - message("-- Filtering using GARRULOUS filter --") - for lvl in LEVEL_RANGE: - message("-- setting logging level to '%s' -----" % - logging.getLevelName(lvl)) - log.setLevel(lvl) - doLog(log) - spec = VerySpecificFilter() - log.addFilter(spec) - message("-- Filtering using specific filter for SOCIABLE, TACITURN --") - for lvl in LEVEL_RANGE: - message("-- setting logging level to '%s' -----" % - logging.getLevelName(lvl)) - log.setLevel(lvl) - doLog(log) - - log.removeFilter(spec) - hdlr.removeFilter(garr) - #Undo the one level which clashes...for regression tests - logging.addLevelName(logging.DEBUG, "DEBUG") - -#---------------------------------------------------------------------------- -# Test 2 -#---------------------------------------------------------------------------- - -MSG = "-- logging %d at INFO, messages should be seen every 10 events --" -def test2(): - logger = logging.getLogger("") - sh = logger.handlers[0] - sh.close() - logger.removeHandler(sh) - mh = logging.handlers.MemoryHandler(10,logging.WARNING, sh) - logger.setLevel(logging.DEBUG) - logger.addHandler(mh) - message("-- logging at DEBUG, nothing should be seen yet --") - logger.debug("Debug message") - message("-- logging at INFO, nothing should be seen yet --") - logger.info("Info message") - message("-- logging at WARNING, 3 messages should be seen --") - logger.warn("Warn message") - for i in xrange(102): - message(MSG % i) - logger.info("Info index = %d", i) - mh.close() - logger.removeHandler(mh) - logger.addHandler(sh) - -#---------------------------------------------------------------------------- -# Test 3 -#---------------------------------------------------------------------------- - -FILTER = "a.b" - -def doLog3(): - logging.getLogger("a").info("Info 1") - logging.getLogger("a.b").info("Info 2") - logging.getLogger("a.c").info("Info 3") - logging.getLogger("a.b.c").info("Info 4") - logging.getLogger("a.b.c.d").info("Info 5") - logging.getLogger("a.bb.c").info("Info 6") - logging.getLogger("b").info("Info 7") - logging.getLogger("b.a").info("Info 8") - logging.getLogger("c.a.b").info("Info 9") - logging.getLogger("a.bb").info("Info 10") - -def test3(): - root = logging.getLogger() - root.setLevel(logging.DEBUG) - hand = root.handlers[0] - message("Unfiltered...") - doLog3() - message("Filtered with '%s'..." % FILTER) - filt = logging.Filter(FILTER) - hand.addFilter(filt) - doLog3() - hand.removeFilter(filt) - -#---------------------------------------------------------------------------- -# Test 4 -#---------------------------------------------------------------------------- - -# config0 is a standard configuration. -config0 = """ -[loggers] -keys=root - -[handlers] -keys=hand1 - -[formatters] -keys=form1 - -[logger_root] -level=NOTSET -handlers=hand1 - -[handler_hand1] -class=StreamHandler -level=NOTSET -formatter=form1 -args=(sys.stdout,) - -[formatter_form1] -format=%(levelname)s:%(name)s:%(message)s -datefmt= -""" - -# config1 adds a little to the standard configuration. -config1 = """ -[loggers] -keys=root,parser - -[handlers] -keys=hand1 - -[formatters] -keys=form1 - -[logger_root] -level=NOTSET -handlers=hand1 - -[logger_parser] -level=DEBUG -handlers=hand1 -propagate=1 -qualname=compiler.parser - -[handler_hand1] -class=StreamHandler -level=NOTSET -formatter=form1 -args=(sys.stdout,) - -[formatter_form1] -format=%(levelname)s:%(name)s:%(message)s -datefmt= -""" - -# config2 has a subtle configuration error that should be reported -config2 = string.replace(config1, "sys.stdout", "sys.stbout") - -# config3 has a less subtle configuration error -config3 = string.replace( - config1, "formatter=form1", "formatter=misspelled_name") - -def test4(): - for i in range(4): - conf = globals()['config%d' % i] - sys.stdout.write('config%d: ' % i) - loggerDict = logging.getLogger().manager.loggerDict - logging._acquireLock() - try: - saved_handlers = logging._handlers.copy() - saved_handler_list = logging._handlerList[:] - saved_loggers = loggerDict.copy() - finally: - logging._releaseLock() - try: - fn = tempfile.mktemp(".ini") - f = open(fn, "w") - f.write(conf) - f.close() - try: - logging.config.fileConfig(fn) - #call again to make sure cleanup is correct - logging.config.fileConfig(fn) - except: - t = sys.exc_info()[0] - message(str(t)) - else: - message('ok.') - os.remove(fn) - finally: - logging._acquireLock() - try: - logging._handlers.clear() - logging._handlers.update(saved_handlers) - logging._handlerList[:] = saved_handler_list - loggerDict = logging.getLogger().manager.loggerDict - loggerDict.clear() - loggerDict.update(saved_loggers) - finally: - logging._releaseLock() - -#---------------------------------------------------------------------------- -# Test 5 -#---------------------------------------------------------------------------- - -test5_config = """ -[loggers] -keys=root - -[handlers] -keys=hand1 - -[formatters] -keys=form1 - -[logger_root] -level=NOTSET -handlers=hand1 - -[handler_hand1] -class=StreamHandler -level=NOTSET -formatter=form1 -args=(sys.stdout,) - -[formatter_form1] -class=test.test_logging.FriendlyFormatter -format=%(levelname)s:%(name)s:%(message)s -datefmt= -""" - -class FriendlyFormatter (logging.Formatter): - def formatException(self, ei): - return "%s... Don't panic!" % str(ei[0]) - - -def test5(): - loggerDict = logging.getLogger().manager.loggerDict - logging._acquireLock() - try: - saved_handlers = logging._handlers.copy() - saved_handler_list = logging._handlerList[:] - saved_loggers = loggerDict.copy() - finally: - logging._releaseLock() - try: - fn = tempfile.mktemp(".ini") - f = open(fn, "w") - f.write(test5_config) - f.close() - logging.config.fileConfig(fn) - try: - raise KeyError - except KeyError: - logging.exception("just testing") - os.remove(fn) - hdlr = logging.getLogger().handlers[0] - logging.getLogger().handlers.remove(hdlr) - finally: - logging._acquireLock() - try: - logging._handlers.clear() - logging._handlers.update(saved_handlers) - logging._handlerList[:] = saved_handler_list - loggerDict = logging.getLogger().manager.loggerDict - loggerDict.clear() - loggerDict.update(saved_loggers) - finally: - logging._releaseLock() - - -#---------------------------------------------------------------------------- -# Test Harness -#---------------------------------------------------------------------------- -def banner(nm, typ): - sep = BANNER % (nm, typ) - sys.stdout.write(sep) - sys.stdout.flush() - -def test_main_inner(): - rootLogger = logging.getLogger("") - rootLogger.setLevel(logging.DEBUG) - hdlr = logging.StreamHandler(sys.stdout) - fmt = logging.Formatter(logging.BASIC_FORMAT) - hdlr.setFormatter(fmt) - rootLogger.addHandler(hdlr) - - # Find an unused port number - port = logging.handlers.DEFAULT_TCP_LOGGING_PORT - while port < logging.handlers.DEFAULT_TCP_LOGGING_PORT+100: - try: - tcpserver = LogRecordSocketReceiver(port=port) - except socket.error: - port += 1 - else: - break - else: - raise ImportError, "Could not find unused port" - - - #Set up a handler such that all events are sent via a socket to the log - #receiver (logrecv). - #The handler will only be added to the rootLogger for some of the tests - shdlr = logging.handlers.SocketHandler('localhost', port) - - #Configure the logger for logrecv so events do not propagate beyond it. - #The sockLogger output is buffered in memory until the end of the test, - #and printed at the end. - sockOut = cStringIO.StringIO() - sockLogger = logging.getLogger("logrecv") - sockLogger.setLevel(logging.DEBUG) - sockhdlr = logging.StreamHandler(sockOut) - sockhdlr.setFormatter(logging.Formatter( - "%(name)s -> %(levelname)s: %(message)s")) - sockLogger.addHandler(sockhdlr) - sockLogger.propagate = 0 - - #Set up servers - threads = [] - #sys.stdout.write("About to start TCP server...\n") - threads.append(threading.Thread(target=runTCP, args=(tcpserver,))) - - for thread in threads: - thread.start() - try: - banner("log_test0", "begin") - - rootLogger.addHandler(shdlr) - test0() - # XXX(nnorwitz): Try to fix timing related test failures. - # This sleep gives us some extra time to read messages. - # The test generally only fails on Solaris without this sleep. - time.sleep(2.0) - shdlr.close() - rootLogger.removeHandler(shdlr) - - banner("log_test0", "end") - - for t in range(1,6): - banner("log_test%d" % t, "begin") - globals()['test%d' % t]() - banner("log_test%d" % t, "end") - - finally: - #wait for TCP receiver to terminate - socketDataProcessed.wait() - # ensure the server dies - tcpserver.abort = 1 - for thread in threads: - thread.join(2.0) - banner("logrecv output", "begin") - sys.stdout.write(sockOut.getvalue()) - sockOut.close() - sockLogger.removeHandler(sockhdlr) - sockhdlr.close() - banner("logrecv output", "end") - sys.stdout.flush() - try: - hdlr.close() - except: - pass - rootLogger.removeHandler(hdlr) - -# Set the locale to the platform-dependent default. I have no idea -# why the test does this, but in any case we save the current locale -# first and restore it at the end. -@run_with_locale('LC_ALL', '') -def test_main(): - # Save and restore the original root logger level across the tests. - # Otherwise, e.g., if any test using cookielib runs after test_logging, - # cookielib's debug-level logger tries to log messages, leading to - # confusing: - # No handlers could be found for logger "cookielib" - # output while the tests are running. - root_logger = logging.getLogger("") - original_logging_level = root_logger.getEffectiveLevel() - try: - test_main_inner() - finally: - root_logger.setLevel(original_logging_level) - -if __name__ == "__main__": - sys.stdout.write("test_logging\n") - test_main() diff --git a/sys/lib/python/test/test_long.py b/sys/lib/python/test/test_long.py deleted file mode 100644 index ae132adad..000000000 --- a/sys/lib/python/test/test_long.py +++ /dev/null @@ -1,503 +0,0 @@ -import unittest -from test import test_support - -import random - -# Used for lazy formatting of failure messages -class Frm(object): - def __init__(self, format, *args): - self.format = format - self.args = args - - def __str__(self): - return self.format % self.args - -# SHIFT should match the value in longintrepr.h for best testing. -SHIFT = 15 -BASE = 2 ** SHIFT -MASK = BASE - 1 -KARATSUBA_CUTOFF = 70 # from longobject.c - -# Max number of base BASE digits to use in test cases. Doubling -# this will more than double the runtime. -MAXDIGITS = 15 - -# build some special values -special = map(long, [0, 1, 2, BASE, BASE >> 1]) -special.append(0x5555555555555555L) -special.append(0xaaaaaaaaaaaaaaaaL) -# some solid strings of one bits -p2 = 4L # 0 and 1 already added -for i in range(2*SHIFT): - special.append(p2 - 1) - p2 = p2 << 1 -del p2 -# add complements & negations -special = special + map(lambda x: ~x, special) + \ - map(lambda x: -x, special) - - -class LongTest(unittest.TestCase): - - # Get quasi-random long consisting of ndigits digits (in base BASE). - # quasi == the most-significant digit will not be 0, and the number - # is constructed to contain long strings of 0 and 1 bits. These are - # more likely than random bits to provoke digit-boundary errors. - # The sign of the number is also random. - - def getran(self, ndigits): - self.assert_(ndigits > 0) - nbits_hi = ndigits * SHIFT - nbits_lo = nbits_hi - SHIFT + 1 - answer = 0L - nbits = 0 - r = int(random.random() * (SHIFT * 2)) | 1 # force 1 bits to start - while nbits < nbits_lo: - bits = (r >> 1) + 1 - bits = min(bits, nbits_hi - nbits) - self.assert_(1 <= bits <= SHIFT) - nbits = nbits + bits - answer = answer << bits - if r & 1: - answer = answer | ((1 << bits) - 1) - r = int(random.random() * (SHIFT * 2)) - self.assert_(nbits_lo <= nbits <= nbits_hi) - if random.random() < 0.5: - answer = -answer - return answer - - # Get random long consisting of ndigits random digits (relative to base - # BASE). The sign bit is also random. - - def getran2(ndigits): - answer = 0L - for i in xrange(ndigits): - answer = (answer << SHIFT) | random.randint(0, MASK) - if random.random() < 0.5: - answer = -answer - return answer - - def check_division(self, x, y): - eq = self.assertEqual - q, r = divmod(x, y) - q2, r2 = x//y, x%y - pab, pba = x*y, y*x - eq(pab, pba, Frm("multiplication does not commute for %r and %r", x, y)) - eq(q, q2, Frm("divmod returns different quotient than / for %r and %r", x, y)) - eq(r, r2, Frm("divmod returns different mod than %% for %r and %r", x, y)) - eq(x, q*y + r, Frm("x != q*y + r after divmod on x=%r, y=%r", x, y)) - if y > 0: - self.assert_(0 <= r < y, Frm("bad mod from divmod on %r and %r", x, y)) - else: - self.assert_(y < r <= 0, Frm("bad mod from divmod on %r and %r", x, y)) - - def test_division(self): - digits = range(1, MAXDIGITS+1) + range(KARATSUBA_CUTOFF, - KARATSUBA_CUTOFF + 14) - digits.append(KARATSUBA_CUTOFF * 3) - for lenx in digits: - x = self.getran(lenx) - for leny in digits: - y = self.getran(leny) or 1L - self.check_division(x, y) - - def test_karatsuba(self): - digits = range(1, 5) + range(KARATSUBA_CUTOFF, KARATSUBA_CUTOFF + 10) - digits.extend([KARATSUBA_CUTOFF * 10, KARATSUBA_CUTOFF * 100]) - - bits = [digit * SHIFT for digit in digits] - - # Test products of long strings of 1 bits -- (2**x-1)*(2**y-1) == - # 2**(x+y) - 2**x - 2**y + 1, so the proper result is easy to check. - for abits in bits: - a = (1L << abits) - 1 - for bbits in bits: - if bbits < abits: - continue - b = (1L << bbits) - 1 - x = a * b - y = ((1L << (abits + bbits)) - - (1L << abits) - - (1L << bbits) + - 1) - self.assertEqual(x, y, - Frm("bad result for a*b: a=%r, b=%r, x=%r, y=%r", a, b, x, y)) - - def check_bitop_identities_1(self, x): - eq = self.assertEqual - eq(x & 0, 0, Frm("x & 0 != 0 for x=%r", x)) - eq(x | 0, x, Frm("x | 0 != x for x=%r", x)) - eq(x ^ 0, x, Frm("x ^ 0 != x for x=%r", x)) - eq(x & -1, x, Frm("x & -1 != x for x=%r", x)) - eq(x | -1, -1, Frm("x | -1 != -1 for x=%r", x)) - eq(x ^ -1, ~x, Frm("x ^ -1 != ~x for x=%r", x)) - eq(x, ~~x, Frm("x != ~~x for x=%r", x)) - eq(x & x, x, Frm("x & x != x for x=%r", x)) - eq(x | x, x, Frm("x | x != x for x=%r", x)) - eq(x ^ x, 0, Frm("x ^ x != 0 for x=%r", x)) - eq(x & ~x, 0, Frm("x & ~x != 0 for x=%r", x)) - eq(x | ~x, -1, Frm("x | ~x != -1 for x=%r", x)) - eq(x ^ ~x, -1, Frm("x ^ ~x != -1 for x=%r", x)) - eq(-x, 1 + ~x, Frm("not -x == 1 + ~x for x=%r", x)) - eq(-x, ~(x-1), Frm("not -x == ~(x-1) forx =%r", x)) - for n in xrange(2*SHIFT): - p2 = 2L ** n - eq(x << n >> n, x, - Frm("x << n >> n != x for x=%r, n=%r", (x, n))) - eq(x // p2, x >> n, - Frm("x // p2 != x >> n for x=%r n=%r p2=%r", (x, n, p2))) - eq(x * p2, x << n, - Frm("x * p2 != x << n for x=%r n=%r p2=%r", (x, n, p2))) - eq(x & -p2, x >> n << n, - Frm("not x & -p2 == x >> n << n for x=%r n=%r p2=%r", (x, n, p2))) - eq(x & -p2, x & ~(p2 - 1), - Frm("not x & -p2 == x & ~(p2 - 1) for x=%r n=%r p2=%r", (x, n, p2))) - - def check_bitop_identities_2(self, x, y): - eq = self.assertEqual - eq(x & y, y & x, Frm("x & y != y & x for x=%r, y=%r", (x, y))) - eq(x | y, y | x, Frm("x | y != y | x for x=%r, y=%r", (x, y))) - eq(x ^ y, y ^ x, Frm("x ^ y != y ^ x for x=%r, y=%r", (x, y))) - eq(x ^ y ^ x, y, Frm("x ^ y ^ x != y for x=%r, y=%r", (x, y))) - eq(x & y, ~(~x | ~y), Frm("x & y != ~(~x | ~y) for x=%r, y=%r", (x, y))) - eq(x | y, ~(~x & ~y), Frm("x | y != ~(~x & ~y) for x=%r, y=%r", (x, y))) - eq(x ^ y, (x | y) & ~(x & y), - Frm("x ^ y != (x | y) & ~(x & y) for x=%r, y=%r", (x, y))) - eq(x ^ y, (x & ~y) | (~x & y), - Frm("x ^ y == (x & ~y) | (~x & y) for x=%r, y=%r", (x, y))) - eq(x ^ y, (x | y) & (~x | ~y), - Frm("x ^ y == (x | y) & (~x | ~y) for x=%r, y=%r", (x, y))) - - def check_bitop_identities_3(self, x, y, z): - eq = self.assertEqual - eq((x & y) & z, x & (y & z), - Frm("(x & y) & z != x & (y & z) for x=%r, y=%r, z=%r", (x, y, z))) - eq((x | y) | z, x | (y | z), - Frm("(x | y) | z != x | (y | z) for x=%r, y=%r, z=%r", (x, y, z))) - eq((x ^ y) ^ z, x ^ (y ^ z), - Frm("(x ^ y) ^ z != x ^ (y ^ z) for x=%r, y=%r, z=%r", (x, y, z))) - eq(x & (y | z), (x & y) | (x & z), - Frm("x & (y | z) != (x & y) | (x & z) for x=%r, y=%r, z=%r", (x, y, z))) - eq(x | (y & z), (x | y) & (x | z), - Frm("x | (y & z) != (x | y) & (x | z) for x=%r, y=%r, z=%r", (x, y, z))) - - def test_bitop_identities(self): - for x in special: - self.check_bitop_identities_1(x) - digits = xrange(1, MAXDIGITS+1) - for lenx in digits: - x = self.getran(lenx) - self.check_bitop_identities_1(x) - for leny in digits: - y = self.getran(leny) - self.check_bitop_identities_2(x, y) - self.check_bitop_identities_3(x, y, self.getran((lenx + leny)//2)) - - def slow_format(self, x, base): - if (x, base) == (0, 8): - # this is an oddball! - return "0L" - digits = [] - sign = 0 - if x < 0: - sign, x = 1, -x - while x: - x, r = divmod(x, base) - digits.append(int(r)) - digits.reverse() - digits = digits or [0] - return '-'[:sign] + \ - {8: '0', 10: '', 16: '0x'}[base] + \ - "".join(map(lambda i: "0123456789abcdef"[i], digits)) + "L" - - def check_format_1(self, x): - for base, mapper in (8, oct), (10, repr), (16, hex): - got = mapper(x) - expected = self.slow_format(x, base) - msg = Frm("%s returned %r but expected %r for %r", - mapper.__name__, got, expected, x) - self.assertEqual(got, expected, msg) - self.assertEqual(long(got, 0), x, Frm('long("%s", 0) != %r', got, x)) - # str() has to be checked a little differently since there's no - # trailing "L" - got = str(x) - expected = self.slow_format(x, 10)[:-1] - msg = Frm("%s returned %r but expected %r for %r", - mapper.__name__, got, expected, x) - self.assertEqual(got, expected, msg) - - def test_format(self): - for x in special: - self.check_format_1(x) - for i in xrange(10): - for lenx in xrange(1, MAXDIGITS+1): - x = self.getran(lenx) - self.check_format_1(x) - - def test_misc(self): - import sys - - # check the extremes in int<->long conversion - hugepos = sys.maxint - hugeneg = -hugepos - 1 - hugepos_aslong = long(hugepos) - hugeneg_aslong = long(hugeneg) - self.assertEqual(hugepos, hugepos_aslong, "long(sys.maxint) != sys.maxint") - self.assertEqual(hugeneg, hugeneg_aslong, - "long(-sys.maxint-1) != -sys.maxint-1") - - # long -> int should not fail for hugepos_aslong or hugeneg_aslong - x = int(hugepos_aslong) - try: - self.assertEqual(x, hugepos, - "converting sys.maxint to long and back to int fails") - except OverflowError: - self.fail("int(long(sys.maxint)) overflowed!") - if not isinstance(x, int): - raise TestFailed("int(long(sys.maxint)) should have returned int") - x = int(hugeneg_aslong) - try: - self.assertEqual(x, hugeneg, - "converting -sys.maxint-1 to long and back to int fails") - except OverflowError: - self.fail("int(long(-sys.maxint-1)) overflowed!") - if not isinstance(x, int): - raise TestFailed("int(long(-sys.maxint-1)) should have " - "returned int") - # but long -> int should overflow for hugepos+1 and hugeneg-1 - x = hugepos_aslong + 1 - try: - y = int(x) - except OverflowError: - self.fail("int(long(sys.maxint) + 1) mustn't overflow") - self.assert_(isinstance(y, long), - "int(long(sys.maxint) + 1) should have returned long") - - x = hugeneg_aslong - 1 - try: - y = int(x) - except OverflowError: - self.fail("int(long(-sys.maxint-1) - 1) mustn't overflow") - self.assert_(isinstance(y, long), - "int(long(-sys.maxint-1) - 1) should have returned long") - - class long2(long): - pass - x = long2(1L<<100) - y = int(x) - self.assert_(type(y) is long, - "overflowing int conversion must return long not long subtype") - - # long -> Py_ssize_t conversion - class X(object): - def __getslice__(self, i, j): - return i, j - - self.assertEqual(X()[-5L:7L], (-5, 7)) - # use the clamping effect to test the smallest and largest longs - # that fit a Py_ssize_t - slicemin, slicemax = X()[-2L**100:2L**100] - self.assertEqual(X()[slicemin:slicemax], (slicemin, slicemax)) - -# ----------------------------------- tests of auto int->long conversion - - def test_auto_overflow(self): - import math, sys - - special = [0, 1, 2, 3, sys.maxint-1, sys.maxint, sys.maxint+1] - sqrt = int(math.sqrt(sys.maxint)) - special.extend([sqrt-1, sqrt, sqrt+1]) - special.extend([-i for i in special]) - - def checkit(*args): - # Heavy use of nested scopes here! - self.assertEqual(got, expected, - Frm("for %r expected %r got %r", args, expected, got)) - - for x in special: - longx = long(x) - - expected = -longx - got = -x - checkit('-', x) - - for y in special: - longy = long(y) - - expected = longx + longy - got = x + y - checkit(x, '+', y) - - expected = longx - longy - got = x - y - checkit(x, '-', y) - - expected = longx * longy - got = x * y - checkit(x, '*', y) - - if y: - expected = longx / longy - got = x / y - checkit(x, '/', y) - - expected = longx // longy - got = x // y - checkit(x, '//', y) - - expected = divmod(longx, longy) - got = divmod(longx, longy) - checkit(x, 'divmod', y) - - if abs(y) < 5 and not (x == 0 and y < 0): - expected = longx ** longy - got = x ** y - checkit(x, '**', y) - - for z in special: - if z != 0 : - if y >= 0: - expected = pow(longx, longy, long(z)) - got = pow(x, y, z) - checkit('pow', x, y, '%', z) - else: - self.assertRaises(TypeError, pow,longx, longy, long(z)) - - def test_float_overflow(self): - import math - - for x in -2.0, -1.0, 0.0, 1.0, 2.0: - self.assertEqual(float(long(x)), x) - - shuge = '12345' * 120 - huge = 1L << 30000 - mhuge = -huge - namespace = {'huge': huge, 'mhuge': mhuge, 'shuge': shuge, 'math': math} - for test in ["float(huge)", "float(mhuge)", - "complex(huge)", "complex(mhuge)", - "complex(huge, 1)", "complex(mhuge, 1)", - "complex(1, huge)", "complex(1, mhuge)", - "1. + huge", "huge + 1.", "1. + mhuge", "mhuge + 1.", - "1. - huge", "huge - 1.", "1. - mhuge", "mhuge - 1.", - "1. * huge", "huge * 1.", "1. * mhuge", "mhuge * 1.", - "1. // huge", "huge // 1.", "1. // mhuge", "mhuge // 1.", - "1. / huge", "huge / 1.", "1. / mhuge", "mhuge / 1.", - "1. ** huge", "huge ** 1.", "1. ** mhuge", "mhuge ** 1.", - "math.sin(huge)", "math.sin(mhuge)", - "math.sqrt(huge)", "math.sqrt(mhuge)", # should do better - "math.floor(huge)", "math.floor(mhuge)"]: - - self.assertRaises(OverflowError, eval, test, namespace) - - # XXX Perhaps float(shuge) can raise OverflowError on some box? - # The comparison should not. - self.assertNotEqual(float(shuge), int(shuge), - "float(shuge) should not equal int(shuge)") - - def test_logs(self): - import math - - LOG10E = math.log10(math.e) - - for exp in range(10) + [100, 1000, 10000]: - value = 10 ** exp - log10 = math.log10(value) - self.assertAlmostEqual(log10, exp) - - # log10(value) == exp, so log(value) == log10(value)/log10(e) == - # exp/LOG10E - expected = exp / LOG10E - log = math.log(value) - self.assertAlmostEqual(log, expected) - - for bad in -(1L << 10000), -2L, 0L: - self.assertRaises(ValueError, math.log, bad) - self.assertRaises(ValueError, math.log10, bad) - - def test_mixed_compares(self): - eq = self.assertEqual - import math - import sys - - # We're mostly concerned with that mixing floats and longs does the - # right stuff, even when longs are too large to fit in a float. - # The safest way to check the results is to use an entirely different - # method, which we do here via a skeletal rational class (which - # represents all Python ints, longs and floats exactly). - class Rat: - def __init__(self, value): - if isinstance(value, (int, long)): - self.n = value - self.d = 1 - elif isinstance(value, float): - # Convert to exact rational equivalent. - f, e = math.frexp(abs(value)) - assert f == 0 or 0.5 <= f < 1.0 - # |value| = f * 2**e exactly - - # Suck up CHUNK bits at a time; 28 is enough so that we suck - # up all bits in 2 iterations for all known binary double- - # precision formats, and small enough to fit in an int. - CHUNK = 28 - top = 0 - # invariant: |value| = (top + f) * 2**e exactly - while f: - f = math.ldexp(f, CHUNK) - digit = int(f) - assert digit >> CHUNK == 0 - top = (top << CHUNK) | digit - f -= digit - assert 0.0 <= f < 1.0 - e -= CHUNK - - # Now |value| = top * 2**e exactly. - if e >= 0: - n = top << e - d = 1 - else: - n = top - d = 1 << -e - if value < 0: - n = -n - self.n = n - self.d = d - assert float(n) / float(d) == value - else: - raise TypeError("can't deal with %r" % val) - - def __cmp__(self, other): - if not isinstance(other, Rat): - other = Rat(other) - return cmp(self.n * other.d, self.d * other.n) - - cases = [0, 0.001, 0.99, 1.0, 1.5, 1e20, 1e200] - # 2**48 is an important boundary in the internals. 2**53 is an - # important boundary for IEEE double precision. - for t in 2.0**48, 2.0**50, 2.0**53: - cases.extend([t - 1.0, t - 0.3, t, t + 0.3, t + 1.0, - long(t-1), long(t), long(t+1)]) - cases.extend([0, 1, 2, sys.maxint, float(sys.maxint)]) - # 1L<<20000 should exceed all double formats. long(1e200) is to - # check that we get equality with 1e200 above. - t = long(1e200) - cases.extend([0L, 1L, 2L, 1L << 20000, t-1, t, t+1]) - cases.extend([-x for x in cases]) - for x in cases: - Rx = Rat(x) - for y in cases: - Ry = Rat(y) - Rcmp = cmp(Rx, Ry) - xycmp = cmp(x, y) - eq(Rcmp, xycmp, Frm("%r %r %d %d", x, y, Rcmp, xycmp)) - eq(x == y, Rcmp == 0, Frm("%r == %r %d", x, y, Rcmp)) - eq(x != y, Rcmp != 0, Frm("%r != %r %d", x, y, Rcmp)) - eq(x < y, Rcmp < 0, Frm("%r < %r %d", x, y, Rcmp)) - eq(x <= y, Rcmp <= 0, Frm("%r <= %r %d", x, y, Rcmp)) - eq(x > y, Rcmp > 0, Frm("%r > %r %d", x, y, Rcmp)) - eq(x >= y, Rcmp >= 0, Frm("%r >= %r %d", x, y, Rcmp)) - -def test_main(): - test_support.run_unittest(LongTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_long_future.py b/sys/lib/python/test/test_long_future.py deleted file mode 100644 index 074c1489f..000000000 --- a/sys/lib/python/test/test_long_future.py +++ /dev/null @@ -1,55 +0,0 @@ -from __future__ import division -# When true division is the default, get rid of this and add it to -# test_long.py instead. In the meantime, it's too obscure to try to -# trick just part of test_long into using future division. - -from test.test_support import TestFailed, verify, verbose - -def test_true_division(): - if verbose: - print "long true division" - huge = 1L << 40000 - mhuge = -huge - verify(huge / huge == 1.0) - verify(mhuge / mhuge == 1.0) - verify(huge / mhuge == -1.0) - verify(mhuge / huge == -1.0) - verify(1 / huge == 0.0) - verify(1L / huge == 0.0) - verify(1 / mhuge == 0.0) - verify(1L / mhuge == 0.0) - verify((666 * huge + (huge >> 1)) / huge == 666.5) - verify((666 * mhuge + (mhuge >> 1)) / mhuge == 666.5) - verify((666 * huge + (huge >> 1)) / mhuge == -666.5) - verify((666 * mhuge + (mhuge >> 1)) / huge == -666.5) - verify(huge / (huge << 1) == 0.5) - verify((1000000 * huge) / huge == 1000000) - - namespace = {'huge': huge, 'mhuge': mhuge} - - for overflow in ["float(huge)", "float(mhuge)", - "huge / 1", "huge / 2L", "huge / -1", "huge / -2L", - "mhuge / 100", "mhuge / 100L"]: - try: - eval(overflow, namespace) - except OverflowError: - pass - else: - raise TestFailed("expected OverflowError from %r" % overflow) - - for underflow in ["1 / huge", "2L / huge", "-1 / huge", "-2L / huge", - "100 / mhuge", "100L / mhuge"]: - result = eval(underflow, namespace) - if result != 0.0: - raise TestFailed("expected underflow to 0 from %r" % underflow) - - for zero in ["huge / 0", "huge / 0L", - "mhuge / 0", "mhuge / 0L"]: - try: - eval(zero, namespace) - except ZeroDivisionError: - pass - else: - raise TestFailed("expected ZeroDivisionError from %r" % zero) - -test_true_division() diff --git a/sys/lib/python/test/test_longexp.py b/sys/lib/python/test/test_longexp.py deleted file mode 100644 index dd222a19b..000000000 --- a/sys/lib/python/test/test_longexp.py +++ /dev/null @@ -1,14 +0,0 @@ -import unittest -from test import test_support - -class LongExpText(unittest.TestCase): - def test_longexp(self): - REPS = 65580 - l = eval("[" + "2," * REPS + "]") - self.assertEqual(len(l), REPS) - -def test_main(): - test_support.run_unittest(LongExpText) - -if __name__=="__main__": - test_main() diff --git a/sys/lib/python/test/test_macfs.py b/sys/lib/python/test/test_macfs.py deleted file mode 100644 index 9c0e3a1a7..000000000 --- a/sys/lib/python/test/test_macfs.py +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright (C) 2003 Python Software Foundation - -import unittest -import warnings -warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) -import macfs -import os -import sys -import tempfile -from test import test_support - -class TestMacfs(unittest.TestCase): - - def setUp(self): - fp = open(test_support.TESTFN, 'w') - fp.write('hello world\n') - fp.close() - - def tearDown(self): - try: - os.unlink(test_support.TESTFN) - except: - pass - - def test_fsspec(self): - fss = macfs.FSSpec(test_support.TESTFN) - self.assertEqual(os.path.realpath(test_support.TESTFN), fss.as_pathname()) - - def test_fsref(self): - fsr = macfs.FSRef(test_support.TESTFN) - self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) - - def test_fsref_unicode(self): - if sys.getfilesystemencoding(): - testfn_unicode = unicode(test_support.TESTFN) - fsr = macfs.FSRef(testfn_unicode) - self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) - - def test_coercion(self): - fss = macfs.FSSpec(test_support.TESTFN) - fsr = macfs.FSRef(test_support.TESTFN) - fss2 = fsr.as_fsspec() - fsr2 = fss.as_fsref() - self.assertEqual(fss.as_pathname(), fss2.as_pathname()) - self.assertEqual(fsr.as_pathname(), fsr2.as_pathname()) - - def test_dates(self): - import time - fss = macfs.FSSpec(test_support.TESTFN) - now = int(time.time()) - fss.SetDates(now, now+1, now+2) - dates = fss.GetDates() - self.assertEqual(dates, (now, now+1, now+2)) - - def test_ctor_type(self): - fss = macfs.FSSpec(test_support.TESTFN) - fss.SetCreatorType('Pyth', 'TEXT') - filecr, filetp = fss.GetCreatorType() - self.assertEqual((filecr, filetp), ('Pyth', 'TEXT')) - - def test_alias(self): - fss = macfs.FSSpec(test_support.TESTFN) - alias = fss.NewAlias() - fss2, changed = alias.Resolve() - self.assertEqual(changed, 0) - self.assertEqual(fss.as_pathname(), fss2.as_pathname()) - - - def test_fss_alias(self): - fss = macfs.FSSpec(test_support.TESTFN) - - -def test_main(): - test_support.run_unittest(TestMacfs) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_macostools.py b/sys/lib/python/test/test_macostools.py deleted file mode 100644 index f3292ced3..000000000 --- a/sys/lib/python/test/test_macostools.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (C) 2003 Python Software Foundation - -import unittest -import macostools -import Carbon.File -import MacOS -import os -import sys -from test import test_support - -TESTFN2 = test_support.TESTFN + '2' - -class TestMacostools(unittest.TestCase): - - def setUp(self): - fp = open(test_support.TESTFN, 'w') - fp.write('hello world\n') - fp.close() - rfp = MacOS.openrf(test_support.TESTFN, '*wb') - rfp.write('goodbye world\n') - rfp.close() - - def tearDown(self): - try: - os.unlink(test_support.TESTFN) - except: - pass - try: - os.unlink(TESTFN2) - except: - pass - - def compareData(self): - fp = open(test_support.TESTFN, 'r') - data1 = fp.read() - fp.close() - fp = open(TESTFN2, 'r') - data2 = fp.read() - fp.close() - if data1 != data2: - return 'Data forks differ' - rfp = MacOS.openrf(test_support.TESTFN, '*rb') - data1 = rfp.read(1000) - rfp.close() - rfp = MacOS.openrf(TESTFN2, '*rb') - data2 = rfp.read(1000) - rfp.close() - if data1 != data2: - return 'Resource forks differ' - return '' - - def test_touched(self): - # This really only tests that nothing unforeseen happens. - macostools.touched(test_support.TESTFN) - - def test_copy(self): - try: - os.unlink(TESTFN2) - except: - pass - macostools.copy(test_support.TESTFN, TESTFN2) - self.assertEqual(self.compareData(), '') - - def test_mkalias(self): - try: - os.unlink(TESTFN2) - except: - pass - macostools.mkalias(test_support.TESTFN, TESTFN2) - fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0) - self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN)) - - def test_mkalias_relative(self): - try: - os.unlink(TESTFN2) - except: - pass - # If the directory doesn't exist, then chances are this is a new - # install of Python so don't create it since the user might end up - # running ``sudo make install`` and creating the directory here won't - # leave it with the proper permissions. - if not os.path.exists(sys.prefix): - return - macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix) - fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0) - self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN)) - - -def test_main(): - test_support.run_unittest(TestMacostools) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_macpath.py b/sys/lib/python/test/test_macpath.py deleted file mode 100644 index 3a3cf04c8..000000000 --- a/sys/lib/python/test/test_macpath.py +++ /dev/null @@ -1,63 +0,0 @@ -import macpath -from test import test_support -import unittest - - -class MacPathTestCase(unittest.TestCase): - - def test_abspath(self): - self.assert_(macpath.abspath("xx:yy") == "xx:yy") - - def test_isabs(self): - isabs = macpath.isabs - self.assert_(isabs("xx:yy")) - self.assert_(isabs("xx:yy:")) - self.assert_(isabs("xx:")) - self.failIf(isabs("foo")) - self.failIf(isabs(":foo")) - self.failIf(isabs(":foo:bar")) - self.failIf(isabs(":foo:bar:")) - - - def test_commonprefix(self): - commonprefix = macpath.commonprefix - self.assert_(commonprefix(["home:swenson:spam", "home:swen:spam"]) - == "home:swen") - self.assert_(commonprefix([":home:swen:spam", ":home:swen:eggs"]) - == ":home:swen:") - self.assert_(commonprefix([":home:swen:spam", ":home:swen:spam"]) - == ":home:swen:spam") - - def test_split(self): - split = macpath.split - self.assertEquals(split("foo:bar"), - ('foo:', 'bar')) - self.assertEquals(split("conky:mountpoint:foo:bar"), - ('conky:mountpoint:foo', 'bar')) - - self.assertEquals(split(":"), ('', '')) - self.assertEquals(split(":conky:mountpoint:"), - (':conky:mountpoint', '')) - - def test_splitdrive(self): - splitdrive = macpath.splitdrive - self.assertEquals(splitdrive("foo:bar"), ('', 'foo:bar')) - self.assertEquals(splitdrive(":foo:bar"), ('', ':foo:bar')) - - def test_splitext(self): - splitext = macpath.splitext - self.assertEquals(splitext(":foo.ext"), (':foo', '.ext')) - self.assertEquals(splitext("foo:foo.ext"), ('foo:foo', '.ext')) - self.assertEquals(splitext(".ext"), ('', '.ext')) - self.assertEquals(splitext("foo.ext:foo"), ('foo.ext:foo', '')) - self.assertEquals(splitext(":foo.ext:"), (':foo.ext:', '')) - self.assertEquals(splitext(""), ('', '')) - self.assertEquals(splitext("foo.bar.ext"), ('foo.bar', '.ext')) - - -def test_main(): - test_support.run_unittest(MacPathTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_mailbox.py b/sys/lib/python/test/test_mailbox.py deleted file mode 100644 index 264e23722..000000000 --- a/sys/lib/python/test/test_mailbox.py +++ /dev/null @@ -1,1848 +0,0 @@ -import os -import sys -import time -import stat -import socket -import email -import email.Message -import rfc822 -import re -import StringIO -from test import test_support -import unittest -import mailbox -import glob -try: - import fcntl -except ImportError: - pass - - -class TestBase(unittest.TestCase): - - def _check_sample(self, msg): - # Inspect a mailbox.Message representation of the sample message - self.assert_(isinstance(msg, email.Message.Message)) - self.assert_(isinstance(msg, mailbox.Message)) - for key, value in _sample_headers.iteritems(): - self.assert_(value in msg.get_all(key)) - self.assert_(msg.is_multipart()) - self.assert_(len(msg.get_payload()) == len(_sample_payloads)) - for i, payload in enumerate(_sample_payloads): - part = msg.get_payload(i) - self.assert_(isinstance(part, email.Message.Message)) - self.assert_(not isinstance(part, mailbox.Message)) - self.assert_(part.get_payload() == payload) - - def _delete_recursively(self, target): - # Delete a file or delete a directory recursively - if os.path.isdir(target): - for path, dirs, files in os.walk(target, topdown=False): - for name in files: - os.remove(os.path.join(path, name)) - for name in dirs: - os.rmdir(os.path.join(path, name)) - os.rmdir(target) - elif os.path.exists(target): - os.remove(target) - - -class TestMailbox(TestBase): - - _factory = None # Overridden by subclasses to reuse tests - _template = 'From: foo\n\n%s' - - def setUp(self): - self._path = test_support.TESTFN - self._box = self._factory(self._path) - - def tearDown(self): - self._box.close() - self._delete_recursively(self._path) - - def test_add(self): - # Add copies of a sample message - keys = [] - keys.append(self._box.add(self._template % 0)) - self.assert_(len(self._box) == 1) - keys.append(self._box.add(mailbox.Message(_sample_message))) - self.assert_(len(self._box) == 2) - keys.append(self._box.add(email.message_from_string(_sample_message))) - self.assert_(len(self._box) == 3) - keys.append(self._box.add(StringIO.StringIO(_sample_message))) - self.assert_(len(self._box) == 4) - keys.append(self._box.add(_sample_message)) - self.assert_(len(self._box) == 5) - self.assert_(self._box.get_string(keys[0]) == self._template % 0) - for i in (1, 2, 3, 4): - self._check_sample(self._box[keys[i]]) - - def test_remove(self): - # Remove messages using remove() - self._test_remove_or_delitem(self._box.remove) - - def test_delitem(self): - # Remove messages using __delitem__() - self._test_remove_or_delitem(self._box.__delitem__) - - def _test_remove_or_delitem(self, method): - # (Used by test_remove() and test_delitem().) - key0 = self._box.add(self._template % 0) - key1 = self._box.add(self._template % 1) - self.assert_(len(self._box) == 2) - method(key0) - l = len(self._box) - self.assert_(l == 1, "actual l: %s" % l) - self.assertRaises(KeyError, lambda: self._box[key0]) - self.assertRaises(KeyError, lambda: method(key0)) - self.assert_(self._box.get_string(key1) == self._template % 1) - key2 = self._box.add(self._template % 2) - self.assert_(len(self._box) == 2) - method(key2) - l = len(self._box) - self.assert_(l == 1, "actual l: %s" % l) - self.assertRaises(KeyError, lambda: self._box[key2]) - self.assertRaises(KeyError, lambda: method(key2)) - self.assert_(self._box.get_string(key1) == self._template % 1) - method(key1) - self.assert_(len(self._box) == 0) - self.assertRaises(KeyError, lambda: self._box[key1]) - self.assertRaises(KeyError, lambda: method(key1)) - - def test_discard(self, repetitions=10): - # Discard messages - key0 = self._box.add(self._template % 0) - key1 = self._box.add(self._template % 1) - self.assert_(len(self._box) == 2) - self._box.discard(key0) - self.assert_(len(self._box) == 1) - self.assertRaises(KeyError, lambda: self._box[key0]) - self._box.discard(key0) - self.assert_(len(self._box) == 1) - self.assertRaises(KeyError, lambda: self._box[key0]) - - def test_get(self): - # Retrieve messages using get() - key0 = self._box.add(self._template % 0) - msg = self._box.get(key0) - self.assert_(msg['from'] == 'foo') - self.assert_(msg.get_payload() == '0') - self.assert_(self._box.get('foo') is None) - self.assert_(self._box.get('foo', False) is False) - self._box.close() - self._box = self._factory(self._path, factory=rfc822.Message) - key1 = self._box.add(self._template % 1) - msg = self._box.get(key1) - self.assert_(msg['from'] == 'foo') - self.assert_(msg.fp.read() == '1') - - def test_getitem(self): - # Retrieve message using __getitem__() - key0 = self._box.add(self._template % 0) - msg = self._box[key0] - self.assert_(msg['from'] == 'foo') - self.assert_(msg.get_payload() == '0') - self.assertRaises(KeyError, lambda: self._box['foo']) - self._box.discard(key0) - self.assertRaises(KeyError, lambda: self._box[key0]) - - def test_get_message(self): - # Get Message representations of messages - key0 = self._box.add(self._template % 0) - key1 = self._box.add(_sample_message) - msg0 = self._box.get_message(key0) - self.assert_(isinstance(msg0, mailbox.Message)) - self.assert_(msg0['from'] == 'foo') - self.assert_(msg0.get_payload() == '0') - self._check_sample(self._box.get_message(key1)) - - def test_get_string(self): - # Get string representations of messages - key0 = self._box.add(self._template % 0) - key1 = self._box.add(_sample_message) - self.assert_(self._box.get_string(key0) == self._template % 0) - self.assert_(self._box.get_string(key1) == _sample_message) - - def test_get_file(self): - # Get file representations of messages - key0 = self._box.add(self._template % 0) - key1 = self._box.add(_sample_message) - self.assert_(self._box.get_file(key0).read().replace(os.linesep, '\n') - == self._template % 0) - self.assert_(self._box.get_file(key1).read().replace(os.linesep, '\n') - == _sample_message) - - def test_iterkeys(self): - # Get keys using iterkeys() - self._check_iteration(self._box.iterkeys, do_keys=True, do_values=False) - - def test_keys(self): - # Get keys using keys() - self._check_iteration(self._box.keys, do_keys=True, do_values=False) - - def test_itervalues(self): - # Get values using itervalues() - self._check_iteration(self._box.itervalues, do_keys=False, - do_values=True) - - def test_iter(self): - # Get values using __iter__() - self._check_iteration(self._box.__iter__, do_keys=False, - do_values=True) - - def test_values(self): - # Get values using values() - self._check_iteration(self._box.values, do_keys=False, do_values=True) - - def test_iteritems(self): - # Get keys and values using iteritems() - self._check_iteration(self._box.iteritems, do_keys=True, - do_values=True) - - def test_items(self): - # Get keys and values using items() - self._check_iteration(self._box.items, do_keys=True, do_values=True) - - def _check_iteration(self, method, do_keys, do_values, repetitions=10): - for value in method(): - self.fail("Not empty") - keys, values = [], [] - for i in xrange(repetitions): - keys.append(self._box.add(self._template % i)) - values.append(self._template % i) - if do_keys and not do_values: - returned_keys = list(method()) - elif do_values and not do_keys: - returned_values = list(method()) - else: - returned_keys, returned_values = [], [] - for key, value in method(): - returned_keys.append(key) - returned_values.append(value) - if do_keys: - self.assert_(len(keys) == len(returned_keys)) - self.assert_(set(keys) == set(returned_keys)) - if do_values: - count = 0 - for value in returned_values: - self.assert_(value['from'] == 'foo') - self.assert_(int(value.get_payload()) < repetitions) - count += 1 - self.assert_(len(values) == count) - - def test_has_key(self): - # Check existence of keys using has_key() - self._test_has_key_or_contains(self._box.has_key) - - def test_contains(self): - # Check existence of keys using __contains__() - self._test_has_key_or_contains(self._box.__contains__) - - def _test_has_key_or_contains(self, method): - # (Used by test_has_key() and test_contains().) - self.assert_(not method('foo')) - key0 = self._box.add(self._template % 0) - self.assert_(method(key0)) - self.assert_(not method('foo')) - key1 = self._box.add(self._template % 1) - self.assert_(method(key1)) - self.assert_(method(key0)) - self.assert_(not method('foo')) - self._box.remove(key0) - self.assert_(not method(key0)) - self.assert_(method(key1)) - self.assert_(not method('foo')) - self._box.remove(key1) - self.assert_(not method(key1)) - self.assert_(not method(key0)) - self.assert_(not method('foo')) - - def test_len(self, repetitions=10): - # Get message count - keys = [] - for i in xrange(repetitions): - self.assert_(len(self._box) == i) - keys.append(self._box.add(self._template % i)) - self.assert_(len(self._box) == i + 1) - for i in xrange(repetitions): - self.assert_(len(self._box) == repetitions - i) - self._box.remove(keys[i]) - self.assert_(len(self._box) == repetitions - i - 1) - - def test_set_item(self): - # Modify messages using __setitem__() - key0 = self._box.add(self._template % 'original 0') - self.assert_(self._box.get_string(key0) == \ - self._template % 'original 0') - key1 = self._box.add(self._template % 'original 1') - self.assert_(self._box.get_string(key1) == \ - self._template % 'original 1') - self._box[key0] = self._template % 'changed 0' - self.assert_(self._box.get_string(key0) == \ - self._template % 'changed 0') - self._box[key1] = self._template % 'changed 1' - self.assert_(self._box.get_string(key1) == \ - self._template % 'changed 1') - self._box[key0] = _sample_message - self._check_sample(self._box[key0]) - self._box[key1] = self._box[key0] - self._check_sample(self._box[key1]) - self._box[key0] = self._template % 'original 0' - self.assert_(self._box.get_string(key0) == - self._template % 'original 0') - self._check_sample(self._box[key1]) - self.assertRaises(KeyError, - lambda: self._box.__setitem__('foo', 'bar')) - self.assertRaises(KeyError, lambda: self._box['foo']) - self.assert_(len(self._box) == 2) - - def test_clear(self, iterations=10): - # Remove all messages using clear() - keys = [] - for i in xrange(iterations): - self._box.add(self._template % i) - for i, key in enumerate(keys): - self.assert_(self._box.get_string(key) == self._template % i) - self._box.clear() - self.assert_(len(self._box) == 0) - for i, key in enumerate(keys): - self.assertRaises(KeyError, lambda: self._box.get_string(key)) - - def test_pop(self): - # Get and remove a message using pop() - key0 = self._box.add(self._template % 0) - self.assert_(key0 in self._box) - key1 = self._box.add(self._template % 1) - self.assert_(key1 in self._box) - self.assert_(self._box.pop(key0).get_payload() == '0') - self.assert_(key0 not in self._box) - self.assert_(key1 in self._box) - key2 = self._box.add(self._template % 2) - self.assert_(key2 in self._box) - self.assert_(self._box.pop(key2).get_payload() == '2') - self.assert_(key2 not in self._box) - self.assert_(key1 in self._box) - self.assert_(self._box.pop(key1).get_payload() == '1') - self.assert_(key1 not in self._box) - self.assert_(len(self._box) == 0) - - def test_popitem(self, iterations=10): - # Get and remove an arbitrary (key, message) using popitem() - keys = [] - for i in xrange(10): - keys.append(self._box.add(self._template % i)) - seen = [] - for i in xrange(10): - key, msg = self._box.popitem() - self.assert_(key in keys) - self.assert_(key not in seen) - seen.append(key) - self.assert_(int(msg.get_payload()) == keys.index(key)) - self.assert_(len(self._box) == 0) - for key in keys: - self.assertRaises(KeyError, lambda: self._box[key]) - - def test_update(self): - # Modify multiple messages using update() - key0 = self._box.add(self._template % 'original 0') - key1 = self._box.add(self._template % 'original 1') - key2 = self._box.add(self._template % 'original 2') - self._box.update({key0: self._template % 'changed 0', - key2: _sample_message}) - self.assert_(len(self._box) == 3) - self.assert_(self._box.get_string(key0) == - self._template % 'changed 0') - self.assert_(self._box.get_string(key1) == - self._template % 'original 1') - self._check_sample(self._box[key2]) - self._box.update([(key2, self._template % 'changed 2'), - (key1, self._template % 'changed 1'), - (key0, self._template % 'original 0')]) - self.assert_(len(self._box) == 3) - self.assert_(self._box.get_string(key0) == - self._template % 'original 0') - self.assert_(self._box.get_string(key1) == - self._template % 'changed 1') - self.assert_(self._box.get_string(key2) == - self._template % 'changed 2') - self.assertRaises(KeyError, - lambda: self._box.update({'foo': 'bar', - key0: self._template % "changed 0"})) - self.assert_(len(self._box) == 3) - self.assert_(self._box.get_string(key0) == - self._template % "changed 0") - self.assert_(self._box.get_string(key1) == - self._template % "changed 1") - self.assert_(self._box.get_string(key2) == - self._template % "changed 2") - - def test_flush(self): - # Write changes to disk - self._test_flush_or_close(self._box.flush) - - def test_lock_unlock(self): - # Lock and unlock the mailbox - self.assert_(not os.path.exists(self._get_lock_path())) - self._box.lock() - self.assert_(os.path.exists(self._get_lock_path())) - self._box.unlock() - self.assert_(not os.path.exists(self._get_lock_path())) - - def test_close(self): - # Close mailbox and flush changes to disk - self._test_flush_or_close(self._box.close) - - def _test_flush_or_close(self, method): - contents = [self._template % i for i in xrange(3)] - self._box.add(contents[0]) - self._box.add(contents[1]) - self._box.add(contents[2]) - method() - self._box = self._factory(self._path) - keys = self._box.keys() - self.assert_(len(keys) == 3) - for key in keys: - self.assert_(self._box.get_string(key) in contents) - - def test_dump_message(self): - # Write message representations to disk - for input in (email.message_from_string(_sample_message), - _sample_message, StringIO.StringIO(_sample_message)): - output = StringIO.StringIO() - self._box._dump_message(input, output) - self.assert_(output.getvalue() == - _sample_message.replace('\n', os.linesep)) - output = StringIO.StringIO() - self.assertRaises(TypeError, - lambda: self._box._dump_message(None, output)) - - def _get_lock_path(self): - # Return the path of the dot lock file. May be overridden. - return self._path + '.lock' - - -class TestMailboxSuperclass(TestBase): - - def test_notimplemented(self): - # Test that all Mailbox methods raise NotImplementedException. - box = mailbox.Mailbox('path') - self.assertRaises(NotImplementedError, lambda: box.add('')) - self.assertRaises(NotImplementedError, lambda: box.remove('')) - self.assertRaises(NotImplementedError, lambda: box.__delitem__('')) - self.assertRaises(NotImplementedError, lambda: box.discard('')) - self.assertRaises(NotImplementedError, lambda: box.__setitem__('', '')) - self.assertRaises(NotImplementedError, lambda: box.iterkeys()) - self.assertRaises(NotImplementedError, lambda: box.keys()) - self.assertRaises(NotImplementedError, lambda: box.itervalues().next()) - self.assertRaises(NotImplementedError, lambda: box.__iter__().next()) - self.assertRaises(NotImplementedError, lambda: box.values()) - self.assertRaises(NotImplementedError, lambda: box.iteritems().next()) - self.assertRaises(NotImplementedError, lambda: box.items()) - self.assertRaises(NotImplementedError, lambda: box.get('')) - self.assertRaises(NotImplementedError, lambda: box.__getitem__('')) - self.assertRaises(NotImplementedError, lambda: box.get_message('')) - self.assertRaises(NotImplementedError, lambda: box.get_string('')) - self.assertRaises(NotImplementedError, lambda: box.get_file('')) - self.assertRaises(NotImplementedError, lambda: box.has_key('')) - self.assertRaises(NotImplementedError, lambda: box.__contains__('')) - self.assertRaises(NotImplementedError, lambda: box.__len__()) - self.assertRaises(NotImplementedError, lambda: box.clear()) - self.assertRaises(NotImplementedError, lambda: box.pop('')) - self.assertRaises(NotImplementedError, lambda: box.popitem()) - self.assertRaises(NotImplementedError, lambda: box.update((('', ''),))) - self.assertRaises(NotImplementedError, lambda: box.flush()) - self.assertRaises(NotImplementedError, lambda: box.lock()) - self.assertRaises(NotImplementedError, lambda: box.unlock()) - self.assertRaises(NotImplementedError, lambda: box.close()) - - -class TestMaildir(TestMailbox): - - _factory = lambda self, path, factory=None: mailbox.Maildir(path, factory) - - def setUp(self): - TestMailbox.setUp(self) - if os.name in ('nt', 'os2') or sys.platform == 'cygwin': - self._box.colon = '!' - - def test_add_MM(self): - # Add a MaildirMessage instance - msg = mailbox.MaildirMessage(self._template % 0) - msg.set_subdir('cur') - msg.set_info('foo') - key = self._box.add(msg) - self.assert_(os.path.exists(os.path.join(self._path, 'cur', '%s%sfoo' % - (key, self._box.colon)))) - - def test_get_MM(self): - # Get a MaildirMessage instance - msg = mailbox.MaildirMessage(self._template % 0) - msg.set_subdir('cur') - msg.set_flags('RF') - key = self._box.add(msg) - msg_returned = self._box.get_message(key) - self.assert_(isinstance(msg_returned, mailbox.MaildirMessage)) - self.assert_(msg_returned.get_subdir() == 'cur') - self.assert_(msg_returned.get_flags() == 'FR') - - def test_set_MM(self): - # Set with a MaildirMessage instance - msg0 = mailbox.MaildirMessage(self._template % 0) - msg0.set_flags('TP') - key = self._box.add(msg0) - msg_returned = self._box.get_message(key) - self.assert_(msg_returned.get_subdir() == 'new') - self.assert_(msg_returned.get_flags() == 'PT') - msg1 = mailbox.MaildirMessage(self._template % 1) - self._box[key] = msg1 - msg_returned = self._box.get_message(key) - self.assert_(msg_returned.get_subdir() == 'new') - self.assert_(msg_returned.get_flags() == '') - self.assert_(msg_returned.get_payload() == '1') - msg2 = mailbox.MaildirMessage(self._template % 2) - msg2.set_info('2,S') - self._box[key] = msg2 - self._box[key] = self._template % 3 - msg_returned = self._box.get_message(key) - self.assert_(msg_returned.get_subdir() == 'new') - self.assert_(msg_returned.get_flags() == 'S') - self.assert_(msg_returned.get_payload() == '3') - - def test_initialize_new(self): - # Initialize a non-existent mailbox - self.tearDown() - self._box = mailbox.Maildir(self._path) - self._check_basics(factory=rfc822.Message) - self._delete_recursively(self._path) - self._box = self._factory(self._path, factory=None) - self._check_basics() - - def test_initialize_existing(self): - # Initialize an existing mailbox - self.tearDown() - for subdir in '', 'tmp', 'new', 'cur': - os.mkdir(os.path.normpath(os.path.join(self._path, subdir))) - self._box = mailbox.Maildir(self._path) - self._check_basics(factory=rfc822.Message) - self._box = mailbox.Maildir(self._path, factory=None) - self._check_basics() - - def _check_basics(self, factory=None): - # (Used by test_open_new() and test_open_existing().) - self.assertEqual(self._box._path, os.path.abspath(self._path)) - self.assertEqual(self._box._factory, factory) - for subdir in '', 'tmp', 'new', 'cur': - path = os.path.join(self._path, subdir) - mode = os.stat(path)[stat.ST_MODE] - self.assert_(stat.S_ISDIR(mode), "Not a directory: '%s'" % path) - - def test_list_folders(self): - # List folders - self._box.add_folder('one') - self._box.add_folder('two') - self._box.add_folder('three') - self.assert_(len(self._box.list_folders()) == 3) - self.assert_(set(self._box.list_folders()) == - set(('one', 'two', 'three'))) - - def test_get_folder(self): - # Open folders - self._box.add_folder('foo.bar') - folder0 = self._box.get_folder('foo.bar') - folder0.add(self._template % 'bar') - self.assert_(os.path.isdir(os.path.join(self._path, '.foo.bar'))) - folder1 = self._box.get_folder('foo.bar') - self.assert_(folder1.get_string(folder1.keys()[0]) == \ - self._template % 'bar') - - def test_add_and_remove_folders(self): - # Delete folders - self._box.add_folder('one') - self._box.add_folder('two') - self.assert_(len(self._box.list_folders()) == 2) - self.assert_(set(self._box.list_folders()) == set(('one', 'two'))) - self._box.remove_folder('one') - self.assert_(len(self._box.list_folders()) == 1) - self.assert_(set(self._box.list_folders()) == set(('two',))) - self._box.add_folder('three') - self.assert_(len(self._box.list_folders()) == 2) - self.assert_(set(self._box.list_folders()) == set(('two', 'three'))) - self._box.remove_folder('three') - self.assert_(len(self._box.list_folders()) == 1) - self.assert_(set(self._box.list_folders()) == set(('two',))) - self._box.remove_folder('two') - self.assert_(len(self._box.list_folders()) == 0) - self.assert_(self._box.list_folders() == []) - - def test_clean(self): - # Remove old files from 'tmp' - foo_path = os.path.join(self._path, 'tmp', 'foo') - bar_path = os.path.join(self._path, 'tmp', 'bar') - f = open(foo_path, 'w') - f.write("@") - f.close() - f = open(bar_path, 'w') - f.write("@") - f.close() - self._box.clean() - self.assert_(os.path.exists(foo_path)) - self.assert_(os.path.exists(bar_path)) - foo_stat = os.stat(foo_path) - os.utime(foo_path, (time.time() - 129600 - 2, - foo_stat.st_mtime)) - self._box.clean() - self.assert_(not os.path.exists(foo_path)) - self.assert_(os.path.exists(bar_path)) - - def test_create_tmp(self, repetitions=10): - # Create files in tmp directory - hostname = socket.gethostname() - if '/' in hostname: - hostname = hostname.replace('/', r'\057') - if ':' in hostname: - hostname = hostname.replace(':', r'\072') - pid = os.getpid() - pattern = re.compile(r"(?P

\d+)" - r"Q(?P\d+)\.(?P[^:/]+)") - previous_groups = None - for x in xrange(repetitions): - tmp_file = self._box._create_tmp() - head, tail = os.path.split(tmp_file.name) - self.assertEqual(head, os.path.abspath(os.path.join(self._path, - "tmp")), - "File in wrong location: '%s'" % head) - match = pattern.match(tail) - self.assert_(match != None, "Invalid file name: '%s'" % tail) - groups = match.groups() - if previous_groups != None: - self.assert_(int(groups[0] >= previous_groups[0]), - "Non-monotonic seconds: '%s' before '%s'" % - (previous_groups[0], groups[0])) - self.assert_(int(groups[1] >= previous_groups[1]) or - groups[0] != groups[1], - "Non-monotonic milliseconds: '%s' before '%s'" % - (previous_groups[1], groups[1])) - self.assert_(int(groups[2]) == pid, - "Process ID mismatch: '%s' should be '%s'" % - (groups[2], pid)) - self.assert_(int(groups[3]) == int(previous_groups[3]) + 1, - "Non-sequential counter: '%s' before '%s'" % - (previous_groups[3], groups[3])) - self.assert_(groups[4] == hostname, - "Host name mismatch: '%s' should be '%s'" % - (groups[4], hostname)) - previous_groups = groups - tmp_file.write(_sample_message) - tmp_file.seek(0) - self.assert_(tmp_file.read() == _sample_message) - tmp_file.close() - file_count = len(os.listdir(os.path.join(self._path, "tmp"))) - self.assert_(file_count == repetitions, - "Wrong file count: '%s' should be '%s'" % - (file_count, repetitions)) - - def test_refresh(self): - # Update the table of contents - self.assert_(self._box._toc == {}) - key0 = self._box.add(self._template % 0) - key1 = self._box.add(self._template % 1) - self.assert_(self._box._toc == {}) - self._box._refresh() - self.assert_(self._box._toc == {key0: os.path.join('new', key0), - key1: os.path.join('new', key1)}) - key2 = self._box.add(self._template % 2) - self.assert_(self._box._toc == {key0: os.path.join('new', key0), - key1: os.path.join('new', key1)}) - self._box._refresh() - self.assert_(self._box._toc == {key0: os.path.join('new', key0), - key1: os.path.join('new', key1), - key2: os.path.join('new', key2)}) - - def test_lookup(self): - # Look up message subpaths in the TOC - self.assertRaises(KeyError, lambda: self._box._lookup('foo')) - key0 = self._box.add(self._template % 0) - self.assert_(self._box._lookup(key0) == os.path.join('new', key0)) - os.remove(os.path.join(self._path, 'new', key0)) - self.assert_(self._box._toc == {key0: os.path.join('new', key0)}) - self.assertRaises(KeyError, lambda: self._box._lookup(key0)) - self.assert_(self._box._toc == {}) - - def test_lock_unlock(self): - # Lock and unlock the mailbox. For Maildir, this does nothing. - self._box.lock() - self._box.unlock() - - def test_folder (self): - # Test for bug #1569790: verify that folders returned by .get_folder() - # use the same factory function. - def dummy_factory (s): - return None - box = self._factory(self._path, factory=dummy_factory) - folder = box.add_folder('folder1') - self.assert_(folder._factory is dummy_factory) - - folder1_alias = box.get_folder('folder1') - self.assert_(folder1_alias._factory is dummy_factory) - - - -class _TestMboxMMDF(TestMailbox): - - def tearDown(self): - self._box.close() - self._delete_recursively(self._path) - for lock_remnant in glob.glob(self._path + '.*'): - os.remove(lock_remnant) - - def test_add_from_string(self): - # Add a string starting with 'From ' to the mailbox - key = self._box.add('From foo@bar blah\nFrom: foo\n\n0') - self.assert_(self._box[key].get_from() == 'foo@bar blah') - self.assert_(self._box[key].get_payload() == '0') - - def test_add_mbox_or_mmdf_message(self): - # Add an mboxMessage or MMDFMessage - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - msg = class_('From foo@bar blah\nFrom: foo\n\n0') - key = self._box.add(msg) - - def test_open_close_open(self): - # Open and inspect previously-created mailbox - values = [self._template % i for i in xrange(3)] - for value in values: - self._box.add(value) - self._box.close() - mtime = os.path.getmtime(self._path) - self._box = self._factory(self._path) - self.assert_(len(self._box) == 3) - for key in self._box.iterkeys(): - self.assert_(self._box.get_string(key) in values) - self._box.close() - self.assert_(mtime == os.path.getmtime(self._path)) - - def test_add_and_close(self): - # Verifying that closing a mailbox doesn't change added items - self._box.add(_sample_message) - for i in xrange(3): - self._box.add(self._template % i) - self._box.add(_sample_message) - self._box._file.flush() - self._box._file.seek(0) - contents = self._box._file.read() - self._box.close() - self.assert_(contents == open(self._path, 'rb').read()) - self._box = self._factory(self._path) - - def test_lock_conflict(self): - # Fork off a subprocess that will lock the file for 2 seconds, - # unlock it, and then exit. - if not hasattr(os, 'fork'): - return - pid = os.fork() - if pid == 0: - # In the child, lock the mailbox. - self._box.lock() - time.sleep(2) - self._box.unlock() - os._exit(0) - - # In the parent, sleep a bit to give the child time to acquire - # the lock. - time.sleep(0.5) - try: - self.assertRaises(mailbox.ExternalClashError, - self._box.lock) - finally: - # Wait for child to exit. Locking should now succeed. - exited_pid, status = os.waitpid(pid, 0) - - self._box.lock() - self._box.unlock() - - def test_relock(self): - # Test case for bug #1575506: the mailbox class was locking the - # wrong file object in its flush() method. - msg = "Subject: sub\n\nbody\n" - key1 = self._box.add(msg) - self._box.flush() - self._box.close() - - self._box = self._factory(self._path) - self._box.lock() - key2 = self._box.add(msg) - self._box.flush() - self.assert_(self._box._locked) - self._box.close() - - - -class TestMbox(_TestMboxMMDF): - - _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) - - -class TestMMDF(_TestMboxMMDF): - - _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) - - -class TestMH(TestMailbox): - - _factory = lambda self, path, factory=None: mailbox.MH(path, factory) - - def test_list_folders(self): - # List folders - self._box.add_folder('one') - self._box.add_folder('two') - self._box.add_folder('three') - self.assert_(len(self._box.list_folders()) == 3) - self.assert_(set(self._box.list_folders()) == - set(('one', 'two', 'three'))) - - def test_get_folder(self): - # Open folders - def dummy_factory (s): - return None - self._box = self._factory(self._path, dummy_factory) - - new_folder = self._box.add_folder('foo.bar') - folder0 = self._box.get_folder('foo.bar') - folder0.add(self._template % 'bar') - self.assert_(os.path.isdir(os.path.join(self._path, 'foo.bar'))) - folder1 = self._box.get_folder('foo.bar') - self.assert_(folder1.get_string(folder1.keys()[0]) == \ - self._template % 'bar') - - # Test for bug #1569790: verify that folders returned by .get_folder() - # use the same factory function. - self.assert_(new_folder._factory is self._box._factory) - self.assert_(folder0._factory is self._box._factory) - - def test_add_and_remove_folders(self): - # Delete folders - self._box.add_folder('one') - self._box.add_folder('two') - self.assert_(len(self._box.list_folders()) == 2) - self.assert_(set(self._box.list_folders()) == set(('one', 'two'))) - self._box.remove_folder('one') - self.assert_(len(self._box.list_folders()) == 1) - self.assert_(set(self._box.list_folders()) == set(('two',))) - self._box.add_folder('three') - self.assert_(len(self._box.list_folders()) == 2) - self.assert_(set(self._box.list_folders()) == set(('two', 'three'))) - self._box.remove_folder('three') - self.assert_(len(self._box.list_folders()) == 1) - self.assert_(set(self._box.list_folders()) == set(('two',))) - self._box.remove_folder('two') - self.assert_(len(self._box.list_folders()) == 0) - self.assert_(self._box.list_folders() == []) - - def test_sequences(self): - # Get and set sequences - self.assert_(self._box.get_sequences() == {}) - msg0 = mailbox.MHMessage(self._template % 0) - msg0.add_sequence('foo') - key0 = self._box.add(msg0) - self.assert_(self._box.get_sequences() == {'foo':[key0]}) - msg1 = mailbox.MHMessage(self._template % 1) - msg1.set_sequences(['bar', 'replied', 'foo']) - key1 = self._box.add(msg1) - self.assert_(self._box.get_sequences() == - {'foo':[key0, key1], 'bar':[key1], 'replied':[key1]}) - msg0.set_sequences(['flagged']) - self._box[key0] = msg0 - self.assert_(self._box.get_sequences() == - {'foo':[key1], 'bar':[key1], 'replied':[key1], - 'flagged':[key0]}) - self._box.remove(key1) - self.assert_(self._box.get_sequences() == {'flagged':[key0]}) - - def test_pack(self): - # Pack the contents of the mailbox - msg0 = mailbox.MHMessage(self._template % 0) - msg1 = mailbox.MHMessage(self._template % 1) - msg2 = mailbox.MHMessage(self._template % 2) - msg3 = mailbox.MHMessage(self._template % 3) - msg0.set_sequences(['foo', 'unseen']) - msg1.set_sequences(['foo']) - msg2.set_sequences(['foo', 'flagged']) - msg3.set_sequences(['foo', 'bar', 'replied']) - key0 = self._box.add(msg0) - key1 = self._box.add(msg1) - key2 = self._box.add(msg2) - key3 = self._box.add(msg3) - self.assert_(self._box.get_sequences() == - {'foo':[key0,key1,key2,key3], 'unseen':[key0], - 'flagged':[key2], 'bar':[key3], 'replied':[key3]}) - self._box.remove(key2) - self.assert_(self._box.get_sequences() == - {'foo':[key0,key1,key3], 'unseen':[key0], 'bar':[key3], - 'replied':[key3]}) - self._box.pack() - self.assert_(self._box.keys() == [1, 2, 3]) - key0 = key0 - key1 = key0 + 1 - key2 = key1 + 1 - self.assert_(self._box.get_sequences() == - {'foo':[1, 2, 3], 'unseen':[1], 'bar':[3], 'replied':[3]}) - - # Test case for packing while holding the mailbox locked. - key0 = self._box.add(msg1) - key1 = self._box.add(msg1) - key2 = self._box.add(msg1) - key3 = self._box.add(msg1) - - self._box.remove(key0) - self._box.remove(key2) - self._box.lock() - self._box.pack() - self._box.unlock() - self.assert_(self._box.get_sequences() == - {'foo':[1, 2, 3, 4, 5], - 'unseen':[1], 'bar':[3], 'replied':[3]}) - - def _get_lock_path(self): - return os.path.join(self._path, '.mh_sequences.lock') - - -class TestBabyl(TestMailbox): - - _factory = lambda self, path, factory=None: mailbox.Babyl(path, factory) - - def tearDown(self): - self._box.close() - self._delete_recursively(self._path) - for lock_remnant in glob.glob(self._path + '.*'): - os.remove(lock_remnant) - - def test_labels(self): - # Get labels from the mailbox - self.assert_(self._box.get_labels() == []) - msg0 = mailbox.BabylMessage(self._template % 0) - msg0.add_label('foo') - key0 = self._box.add(msg0) - self.assert_(self._box.get_labels() == ['foo']) - msg1 = mailbox.BabylMessage(self._template % 1) - msg1.set_labels(['bar', 'answered', 'foo']) - key1 = self._box.add(msg1) - self.assert_(set(self._box.get_labels()) == set(['foo', 'bar'])) - msg0.set_labels(['blah', 'filed']) - self._box[key0] = msg0 - self.assert_(set(self._box.get_labels()) == - set(['foo', 'bar', 'blah'])) - self._box.remove(key1) - self.assert_(set(self._box.get_labels()) == set(['blah'])) - - -class TestMessage(TestBase): - - _factory = mailbox.Message # Overridden by subclasses to reuse tests - - def setUp(self): - self._path = test_support.TESTFN - - def tearDown(self): - self._delete_recursively(self._path) - - def test_initialize_with_eMM(self): - # Initialize based on email.Message.Message instance - eMM = email.message_from_string(_sample_message) - msg = self._factory(eMM) - self._post_initialize_hook(msg) - self._check_sample(msg) - - def test_initialize_with_string(self): - # Initialize based on string - msg = self._factory(_sample_message) - self._post_initialize_hook(msg) - self._check_sample(msg) - - def test_initialize_with_file(self): - # Initialize based on contents of file - f = open(self._path, 'w+') - f.write(_sample_message) - f.seek(0) - msg = self._factory(f) - self._post_initialize_hook(msg) - self._check_sample(msg) - f.close() - - def test_initialize_with_nothing(self): - # Initialize without arguments - msg = self._factory() - self._post_initialize_hook(msg) - self.assert_(isinstance(msg, email.Message.Message)) - self.assert_(isinstance(msg, mailbox.Message)) - self.assert_(isinstance(msg, self._factory)) - self.assert_(msg.keys() == []) - self.assert_(not msg.is_multipart()) - self.assert_(msg.get_payload() == None) - - def test_initialize_incorrectly(self): - # Initialize with invalid argument - self.assertRaises(TypeError, lambda: self._factory(object())) - - def test_become_message(self): - # Take on the state of another message - eMM = email.message_from_string(_sample_message) - msg = self._factory() - msg._become_message(eMM) - self._check_sample(msg) - - def test_explain_to(self): - # Copy self's format-specific data to other message formats. - # This test is superficial; better ones are in TestMessageConversion. - msg = self._factory() - for class_ in (mailbox.Message, mailbox.MaildirMessage, - mailbox.mboxMessage, mailbox.MHMessage, - mailbox.BabylMessage, mailbox.MMDFMessage): - other_msg = class_() - msg._explain_to(other_msg) - other_msg = email.Message.Message() - self.assertRaises(TypeError, lambda: msg._explain_to(other_msg)) - - def _post_initialize_hook(self, msg): - # Overridden by subclasses to check extra things after initialization - pass - - -class TestMaildirMessage(TestMessage): - - _factory = mailbox.MaildirMessage - - def _post_initialize_hook(self, msg): - self.assert_(msg._subdir == 'new') - self.assert_(msg._info == '') - - def test_subdir(self): - # Use get_subdir() and set_subdir() - msg = mailbox.MaildirMessage(_sample_message) - self.assert_(msg.get_subdir() == 'new') - msg.set_subdir('cur') - self.assert_(msg.get_subdir() == 'cur') - msg.set_subdir('new') - self.assert_(msg.get_subdir() == 'new') - self.assertRaises(ValueError, lambda: msg.set_subdir('tmp')) - self.assert_(msg.get_subdir() == 'new') - msg.set_subdir('new') - self.assert_(msg.get_subdir() == 'new') - self._check_sample(msg) - - def test_flags(self): - # Use get_flags(), set_flags(), add_flag(), remove_flag() - msg = mailbox.MaildirMessage(_sample_message) - self.assert_(msg.get_flags() == '') - self.assert_(msg.get_subdir() == 'new') - msg.set_flags('F') - self.assert_(msg.get_subdir() == 'new') - self.assert_(msg.get_flags() == 'F') - msg.set_flags('SDTP') - self.assert_(msg.get_flags() == 'DPST') - msg.add_flag('FT') - self.assert_(msg.get_flags() == 'DFPST') - msg.remove_flag('TDRP') - self.assert_(msg.get_flags() == 'FS') - self.assert_(msg.get_subdir() == 'new') - self._check_sample(msg) - - def test_date(self): - # Use get_date() and set_date() - msg = mailbox.MaildirMessage(_sample_message) - self.assert_(abs(msg.get_date() - time.time()) < 60) - msg.set_date(0.0) - self.assert_(msg.get_date() == 0.0) - - def test_info(self): - # Use get_info() and set_info() - msg = mailbox.MaildirMessage(_sample_message) - self.assert_(msg.get_info() == '') - msg.set_info('1,foo=bar') - self.assert_(msg.get_info() == '1,foo=bar') - self.assertRaises(TypeError, lambda: msg.set_info(None)) - self._check_sample(msg) - - def test_info_and_flags(self): - # Test interaction of info and flag methods - msg = mailbox.MaildirMessage(_sample_message) - self.assert_(msg.get_info() == '') - msg.set_flags('SF') - self.assert_(msg.get_flags() == 'FS') - self.assert_(msg.get_info() == '2,FS') - msg.set_info('1,') - self.assert_(msg.get_flags() == '') - self.assert_(msg.get_info() == '1,') - msg.remove_flag('RPT') - self.assert_(msg.get_flags() == '') - self.assert_(msg.get_info() == '1,') - msg.add_flag('D') - self.assert_(msg.get_flags() == 'D') - self.assert_(msg.get_info() == '2,D') - self._check_sample(msg) - - -class _TestMboxMMDFMessage(TestMessage): - - _factory = mailbox._mboxMMDFMessage - - def _post_initialize_hook(self, msg): - self._check_from(msg) - - def test_initialize_with_unixfrom(self): - # Initialize with a message that already has a _unixfrom attribute - msg = mailbox.Message(_sample_message) - msg.set_unixfrom('From foo@bar blah') - msg = mailbox.mboxMessage(msg) - self.assert_(msg.get_from() == 'foo@bar blah', msg.get_from()) - - def test_from(self): - # Get and set "From " line - msg = mailbox.mboxMessage(_sample_message) - self._check_from(msg) - msg.set_from('foo bar') - self.assert_(msg.get_from() == 'foo bar') - msg.set_from('foo@bar', True) - self._check_from(msg, 'foo@bar') - msg.set_from('blah@temp', time.localtime()) - self._check_from(msg, 'blah@temp') - - def test_flags(self): - # Use get_flags(), set_flags(), add_flag(), remove_flag() - msg = mailbox.mboxMessage(_sample_message) - self.assert_(msg.get_flags() == '') - msg.set_flags('F') - self.assert_(msg.get_flags() == 'F') - msg.set_flags('XODR') - self.assert_(msg.get_flags() == 'RODX') - msg.add_flag('FA') - self.assert_(msg.get_flags() == 'RODFAX') - msg.remove_flag('FDXA') - self.assert_(msg.get_flags() == 'RO') - self._check_sample(msg) - - def _check_from(self, msg, sender=None): - # Check contents of "From " line - if sender is None: - sender = "MAILER-DAEMON" - self.assert_(re.match(sender + r" \w{3} \w{3} [\d ]\d [\d ]\d:\d{2}:" - r"\d{2} \d{4}", msg.get_from()) is not None) - - -class TestMboxMessage(_TestMboxMMDFMessage): - - _factory = mailbox.mboxMessage - - -class TestMHMessage(TestMessage): - - _factory = mailbox.MHMessage - - def _post_initialize_hook(self, msg): - self.assert_(msg._sequences == []) - - def test_sequences(self): - # Get, set, join, and leave sequences - msg = mailbox.MHMessage(_sample_message) - self.assert_(msg.get_sequences() == []) - msg.set_sequences(['foobar']) - self.assert_(msg.get_sequences() == ['foobar']) - msg.set_sequences([]) - self.assert_(msg.get_sequences() == []) - msg.add_sequence('unseen') - self.assert_(msg.get_sequences() == ['unseen']) - msg.add_sequence('flagged') - self.assert_(msg.get_sequences() == ['unseen', 'flagged']) - msg.add_sequence('flagged') - self.assert_(msg.get_sequences() == ['unseen', 'flagged']) - msg.remove_sequence('unseen') - self.assert_(msg.get_sequences() == ['flagged']) - msg.add_sequence('foobar') - self.assert_(msg.get_sequences() == ['flagged', 'foobar']) - msg.remove_sequence('replied') - self.assert_(msg.get_sequences() == ['flagged', 'foobar']) - msg.set_sequences(['foobar', 'replied']) - self.assert_(msg.get_sequences() == ['foobar', 'replied']) - - -class TestBabylMessage(TestMessage): - - _factory = mailbox.BabylMessage - - def _post_initialize_hook(self, msg): - self.assert_(msg._labels == []) - - def test_labels(self): - # Get, set, join, and leave labels - msg = mailbox.BabylMessage(_sample_message) - self.assert_(msg.get_labels() == []) - msg.set_labels(['foobar']) - self.assert_(msg.get_labels() == ['foobar']) - msg.set_labels([]) - self.assert_(msg.get_labels() == []) - msg.add_label('filed') - self.assert_(msg.get_labels() == ['filed']) - msg.add_label('resent') - self.assert_(msg.get_labels() == ['filed', 'resent']) - msg.add_label('resent') - self.assert_(msg.get_labels() == ['filed', 'resent']) - msg.remove_label('filed') - self.assert_(msg.get_labels() == ['resent']) - msg.add_label('foobar') - self.assert_(msg.get_labels() == ['resent', 'foobar']) - msg.remove_label('unseen') - self.assert_(msg.get_labels() == ['resent', 'foobar']) - msg.set_labels(['foobar', 'answered']) - self.assert_(msg.get_labels() == ['foobar', 'answered']) - - def test_visible(self): - # Get, set, and update visible headers - msg = mailbox.BabylMessage(_sample_message) - visible = msg.get_visible() - self.assert_(visible.keys() == []) - self.assert_(visible.get_payload() is None) - visible['User-Agent'] = 'FooBar 1.0' - visible['X-Whatever'] = 'Blah' - self.assert_(msg.get_visible().keys() == []) - msg.set_visible(visible) - visible = msg.get_visible() - self.assert_(visible.keys() == ['User-Agent', 'X-Whatever']) - self.assert_(visible['User-Agent'] == 'FooBar 1.0') - self.assert_(visible['X-Whatever'] == 'Blah') - self.assert_(visible.get_payload() is None) - msg.update_visible() - self.assert_(visible.keys() == ['User-Agent', 'X-Whatever']) - self.assert_(visible.get_payload() is None) - visible = msg.get_visible() - self.assert_(visible.keys() == ['User-Agent', 'Date', 'From', 'To', - 'Subject']) - for header in ('User-Agent', 'Date', 'From', 'To', 'Subject'): - self.assert_(visible[header] == msg[header]) - - -class TestMMDFMessage(_TestMboxMMDFMessage): - - _factory = mailbox.MMDFMessage - - -class TestMessageConversion(TestBase): - - def test_plain_to_x(self): - # Convert Message to all formats - for class_ in (mailbox.Message, mailbox.MaildirMessage, - mailbox.mboxMessage, mailbox.MHMessage, - mailbox.BabylMessage, mailbox.MMDFMessage): - msg_plain = mailbox.Message(_sample_message) - msg = class_(msg_plain) - self._check_sample(msg) - - def test_x_to_plain(self): - # Convert all formats to Message - for class_ in (mailbox.Message, mailbox.MaildirMessage, - mailbox.mboxMessage, mailbox.MHMessage, - mailbox.BabylMessage, mailbox.MMDFMessage): - msg = class_(_sample_message) - msg_plain = mailbox.Message(msg) - self._check_sample(msg_plain) - - def test_x_to_invalid(self): - # Convert all formats to an invalid format - for class_ in (mailbox.Message, mailbox.MaildirMessage, - mailbox.mboxMessage, mailbox.MHMessage, - mailbox.BabylMessage, mailbox.MMDFMessage): - self.assertRaises(TypeError, lambda: class_(False)) - - def test_maildir_to_maildir(self): - # Convert MaildirMessage to MaildirMessage - msg_maildir = mailbox.MaildirMessage(_sample_message) - msg_maildir.set_flags('DFPRST') - msg_maildir.set_subdir('cur') - date = msg_maildir.get_date() - msg = mailbox.MaildirMessage(msg_maildir) - self._check_sample(msg) - self.assert_(msg.get_flags() == 'DFPRST') - self.assert_(msg.get_subdir() == 'cur') - self.assert_(msg.get_date() == date) - - def test_maildir_to_mboxmmdf(self): - # Convert MaildirMessage to mboxmessage and MMDFMessage - pairs = (('D', ''), ('F', 'F'), ('P', ''), ('R', 'A'), ('S', 'R'), - ('T', 'D'), ('DFPRST', 'RDFA')) - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - msg_maildir = mailbox.MaildirMessage(_sample_message) - msg_maildir.set_date(0.0) - for setting, result in pairs: - msg_maildir.set_flags(setting) - msg = class_(msg_maildir) - self.assert_(msg.get_flags() == result) - self.assert_(msg.get_from() == 'MAILER-DAEMON %s' % - time.asctime(time.gmtime(0.0))) - msg_maildir.set_subdir('cur') - self.assert_(class_(msg_maildir).get_flags() == 'RODFA') - - def test_maildir_to_mh(self): - # Convert MaildirMessage to MHMessage - msg_maildir = mailbox.MaildirMessage(_sample_message) - pairs = (('D', ['unseen']), ('F', ['unseen', 'flagged']), - ('P', ['unseen']), ('R', ['unseen', 'replied']), ('S', []), - ('T', ['unseen']), ('DFPRST', ['replied', 'flagged'])) - for setting, result in pairs: - msg_maildir.set_flags(setting) - self.assert_(mailbox.MHMessage(msg_maildir).get_sequences() == \ - result) - - def test_maildir_to_babyl(self): - # Convert MaildirMessage to Babyl - msg_maildir = mailbox.MaildirMessage(_sample_message) - pairs = (('D', ['unseen']), ('F', ['unseen']), - ('P', ['unseen', 'forwarded']), ('R', ['unseen', 'answered']), - ('S', []), ('T', ['unseen', 'deleted']), - ('DFPRST', ['deleted', 'answered', 'forwarded'])) - for setting, result in pairs: - msg_maildir.set_flags(setting) - self.assert_(mailbox.BabylMessage(msg_maildir).get_labels() == \ - result) - - def test_mboxmmdf_to_maildir(self): - # Convert mboxMessage and MMDFMessage to MaildirMessage - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - msg_mboxMMDF = class_(_sample_message) - msg_mboxMMDF.set_from('foo@bar', time.gmtime(0.0)) - pairs = (('R', 'S'), ('O', ''), ('D', 'T'), ('F', 'F'), ('A', 'R'), - ('RODFA', 'FRST')) - for setting, result in pairs: - msg_mboxMMDF.set_flags(setting) - msg = mailbox.MaildirMessage(msg_mboxMMDF) - self.assert_(msg.get_flags() == result) - self.assert_(msg.get_date() == 0.0, msg.get_date()) - msg_mboxMMDF.set_flags('O') - self.assert_(mailbox.MaildirMessage(msg_mboxMMDF).get_subdir() == \ - 'cur') - - def test_mboxmmdf_to_mboxmmdf(self): - # Convert mboxMessage and MMDFMessage to mboxMessage and MMDFMessage - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - msg_mboxMMDF = class_(_sample_message) - msg_mboxMMDF.set_flags('RODFA') - msg_mboxMMDF.set_from('foo@bar') - for class2_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - msg2 = class2_(msg_mboxMMDF) - self.assert_(msg2.get_flags() == 'RODFA') - self.assert_(msg2.get_from() == 'foo@bar') - - def test_mboxmmdf_to_mh(self): - # Convert mboxMessage and MMDFMessage to MHMessage - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - msg_mboxMMDF = class_(_sample_message) - pairs = (('R', []), ('O', ['unseen']), ('D', ['unseen']), - ('F', ['unseen', 'flagged']), - ('A', ['unseen', 'replied']), - ('RODFA', ['replied', 'flagged'])) - for setting, result in pairs: - msg_mboxMMDF.set_flags(setting) - self.assert_(mailbox.MHMessage(msg_mboxMMDF).get_sequences() \ - == result) - - def test_mboxmmdf_to_babyl(self): - # Convert mboxMessage and MMDFMessage to BabylMessage - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - msg = class_(_sample_message) - pairs = (('R', []), ('O', ['unseen']), - ('D', ['unseen', 'deleted']), ('F', ['unseen']), - ('A', ['unseen', 'answered']), - ('RODFA', ['deleted', 'answered'])) - for setting, result in pairs: - msg.set_flags(setting) - self.assert_(mailbox.BabylMessage(msg).get_labels() == result) - - def test_mh_to_maildir(self): - # Convert MHMessage to MaildirMessage - pairs = (('unseen', ''), ('replied', 'RS'), ('flagged', 'FS')) - for setting, result in pairs: - msg = mailbox.MHMessage(_sample_message) - msg.add_sequence(setting) - self.assert_(mailbox.MaildirMessage(msg).get_flags() == result) - self.assert_(mailbox.MaildirMessage(msg).get_subdir() == 'cur') - msg = mailbox.MHMessage(_sample_message) - msg.add_sequence('unseen') - msg.add_sequence('replied') - msg.add_sequence('flagged') - self.assert_(mailbox.MaildirMessage(msg).get_flags() == 'FR') - self.assert_(mailbox.MaildirMessage(msg).get_subdir() == 'cur') - - def test_mh_to_mboxmmdf(self): - # Convert MHMessage to mboxMessage and MMDFMessage - pairs = (('unseen', 'O'), ('replied', 'ROA'), ('flagged', 'ROF')) - for setting, result in pairs: - msg = mailbox.MHMessage(_sample_message) - msg.add_sequence(setting) - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - self.assert_(class_(msg).get_flags() == result) - msg = mailbox.MHMessage(_sample_message) - msg.add_sequence('unseen') - msg.add_sequence('replied') - msg.add_sequence('flagged') - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - self.assert_(class_(msg).get_flags() == 'OFA') - - def test_mh_to_mh(self): - # Convert MHMessage to MHMessage - msg = mailbox.MHMessage(_sample_message) - msg.add_sequence('unseen') - msg.add_sequence('replied') - msg.add_sequence('flagged') - self.assert_(mailbox.MHMessage(msg).get_sequences() == \ - ['unseen', 'replied', 'flagged']) - - def test_mh_to_babyl(self): - # Convert MHMessage to BabylMessage - pairs = (('unseen', ['unseen']), ('replied', ['answered']), - ('flagged', [])) - for setting, result in pairs: - msg = mailbox.MHMessage(_sample_message) - msg.add_sequence(setting) - self.assert_(mailbox.BabylMessage(msg).get_labels() == result) - msg = mailbox.MHMessage(_sample_message) - msg.add_sequence('unseen') - msg.add_sequence('replied') - msg.add_sequence('flagged') - self.assert_(mailbox.BabylMessage(msg).get_labels() == \ - ['unseen', 'answered']) - - def test_babyl_to_maildir(self): - # Convert BabylMessage to MaildirMessage - pairs = (('unseen', ''), ('deleted', 'ST'), ('filed', 'S'), - ('answered', 'RS'), ('forwarded', 'PS'), ('edited', 'S'), - ('resent', 'PS')) - for setting, result in pairs: - msg = mailbox.BabylMessage(_sample_message) - msg.add_label(setting) - self.assert_(mailbox.MaildirMessage(msg).get_flags() == result) - self.assert_(mailbox.MaildirMessage(msg).get_subdir() == 'cur') - msg = mailbox.BabylMessage(_sample_message) - for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded', - 'edited', 'resent'): - msg.add_label(label) - self.assert_(mailbox.MaildirMessage(msg).get_flags() == 'PRT') - self.assert_(mailbox.MaildirMessage(msg).get_subdir() == 'cur') - - def test_babyl_to_mboxmmdf(self): - # Convert BabylMessage to mboxMessage and MMDFMessage - pairs = (('unseen', 'O'), ('deleted', 'ROD'), ('filed', 'RO'), - ('answered', 'ROA'), ('forwarded', 'RO'), ('edited', 'RO'), - ('resent', 'RO')) - for setting, result in pairs: - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - msg = mailbox.BabylMessage(_sample_message) - msg.add_label(setting) - self.assert_(class_(msg).get_flags() == result) - msg = mailbox.BabylMessage(_sample_message) - for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded', - 'edited', 'resent'): - msg.add_label(label) - for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): - self.assert_(class_(msg).get_flags() == 'ODA') - - def test_babyl_to_mh(self): - # Convert BabylMessage to MHMessage - pairs = (('unseen', ['unseen']), ('deleted', []), ('filed', []), - ('answered', ['replied']), ('forwarded', []), ('edited', []), - ('resent', [])) - for setting, result in pairs: - msg = mailbox.BabylMessage(_sample_message) - msg.add_label(setting) - self.assert_(mailbox.MHMessage(msg).get_sequences() == result) - msg = mailbox.BabylMessage(_sample_message) - for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded', - 'edited', 'resent'): - msg.add_label(label) - self.assert_(mailbox.MHMessage(msg).get_sequences() == \ - ['unseen', 'replied']) - - def test_babyl_to_babyl(self): - # Convert BabylMessage to BabylMessage - msg = mailbox.BabylMessage(_sample_message) - msg.update_visible() - for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded', - 'edited', 'resent'): - msg.add_label(label) - msg2 = mailbox.BabylMessage(msg) - self.assert_(msg2.get_labels() == ['unseen', 'deleted', 'filed', - 'answered', 'forwarded', 'edited', - 'resent']) - self.assert_(msg.get_visible().keys() == msg2.get_visible().keys()) - for key in msg.get_visible().keys(): - self.assert_(msg.get_visible()[key] == msg2.get_visible()[key]) - - -class TestProxyFileBase(TestBase): - - def _test_read(self, proxy): - # Read by byte - proxy.seek(0) - self.assert_(proxy.read() == 'bar') - proxy.seek(1) - self.assert_(proxy.read() == 'ar') - proxy.seek(0) - self.assert_(proxy.read(2) == 'ba') - proxy.seek(1) - self.assert_(proxy.read(-1) == 'ar') - proxy.seek(2) - self.assert_(proxy.read(1000) == 'r') - - def _test_readline(self, proxy): - # Read by line - proxy.seek(0) - self.assert_(proxy.readline() == 'foo' + os.linesep) - self.assert_(proxy.readline() == 'bar' + os.linesep) - self.assert_(proxy.readline() == 'fred' + os.linesep) - self.assert_(proxy.readline() == 'bob') - proxy.seek(2) - self.assert_(proxy.readline() == 'o' + os.linesep) - proxy.seek(6 + 2 * len(os.linesep)) - self.assert_(proxy.readline() == 'fred' + os.linesep) - proxy.seek(6 + 2 * len(os.linesep)) - self.assert_(proxy.readline(2) == 'fr') - self.assert_(proxy.readline(-10) == 'ed' + os.linesep) - - def _test_readlines(self, proxy): - # Read multiple lines - proxy.seek(0) - self.assert_(proxy.readlines() == ['foo' + os.linesep, - 'bar' + os.linesep, - 'fred' + os.linesep, 'bob']) - proxy.seek(0) - self.assert_(proxy.readlines(2) == ['foo' + os.linesep]) - proxy.seek(3 + len(os.linesep)) - self.assert_(proxy.readlines(4 + len(os.linesep)) == - ['bar' + os.linesep, 'fred' + os.linesep]) - proxy.seek(3) - self.assert_(proxy.readlines(1000) == [os.linesep, 'bar' + os.linesep, - 'fred' + os.linesep, 'bob']) - - def _test_iteration(self, proxy): - # Iterate by line - proxy.seek(0) - iterator = iter(proxy) - self.assert_(iterator.next() == 'foo' + os.linesep) - self.assert_(iterator.next() == 'bar' + os.linesep) - self.assert_(iterator.next() == 'fred' + os.linesep) - self.assert_(iterator.next() == 'bob') - self.assertRaises(StopIteration, lambda: iterator.next()) - - def _test_seek_and_tell(self, proxy): - # Seek and use tell to check position - proxy.seek(3) - self.assert_(proxy.tell() == 3) - self.assert_(proxy.read(len(os.linesep)) == os.linesep) - proxy.seek(2, 1) - self.assert_(proxy.read(1 + len(os.linesep)) == 'r' + os.linesep) - proxy.seek(-3 - len(os.linesep), 2) - self.assert_(proxy.read(3) == 'bar') - proxy.seek(2, 0) - self.assert_(proxy.read() == 'o' + os.linesep + 'bar' + os.linesep) - proxy.seek(100) - self.assert_(proxy.read() == '') - - def _test_close(self, proxy): - # Close a file - proxy.close() - self.assertRaises(AttributeError, lambda: proxy.close()) - - -class TestProxyFile(TestProxyFileBase): - - def setUp(self): - self._path = test_support.TESTFN - self._file = open(self._path, 'wb+') - - def tearDown(self): - self._file.close() - self._delete_recursively(self._path) - - def test_initialize(self): - # Initialize and check position - self._file.write('foo') - pos = self._file.tell() - proxy0 = mailbox._ProxyFile(self._file) - self.assert_(proxy0.tell() == pos) - self.assert_(self._file.tell() == pos) - proxy1 = mailbox._ProxyFile(self._file, 0) - self.assert_(proxy1.tell() == 0) - self.assert_(self._file.tell() == pos) - - def test_read(self): - self._file.write('bar') - self._test_read(mailbox._ProxyFile(self._file)) - - def test_readline(self): - self._file.write('foo%sbar%sfred%sbob' % (os.linesep, os.linesep, - os.linesep)) - self._test_readline(mailbox._ProxyFile(self._file)) - - def test_readlines(self): - self._file.write('foo%sbar%sfred%sbob' % (os.linesep, os.linesep, - os.linesep)) - self._test_readlines(mailbox._ProxyFile(self._file)) - - def test_iteration(self): - self._file.write('foo%sbar%sfred%sbob' % (os.linesep, os.linesep, - os.linesep)) - self._test_iteration(mailbox._ProxyFile(self._file)) - - def test_seek_and_tell(self): - self._file.write('foo%sbar%s' % (os.linesep, os.linesep)) - self._test_seek_and_tell(mailbox._ProxyFile(self._file)) - - def test_close(self): - self._file.write('foo%sbar%s' % (os.linesep, os.linesep)) - self._test_close(mailbox._ProxyFile(self._file)) - - -class TestPartialFile(TestProxyFileBase): - - def setUp(self): - self._path = test_support.TESTFN - self._file = open(self._path, 'wb+') - - def tearDown(self): - self._file.close() - self._delete_recursively(self._path) - - def test_initialize(self): - # Initialize and check position - self._file.write('foo' + os.linesep + 'bar') - pos = self._file.tell() - proxy = mailbox._PartialFile(self._file, 2, 5) - self.assert_(proxy.tell() == 0) - self.assert_(self._file.tell() == pos) - - def test_read(self): - self._file.write('***bar***') - self._test_read(mailbox._PartialFile(self._file, 3, 6)) - - def test_readline(self): - self._file.write('!!!!!foo%sbar%sfred%sbob!!!!!' % - (os.linesep, os.linesep, os.linesep)) - self._test_readline(mailbox._PartialFile(self._file, 5, - 18 + 3 * len(os.linesep))) - - def test_readlines(self): - self._file.write('foo%sbar%sfred%sbob?????' % - (os.linesep, os.linesep, os.linesep)) - self._test_readlines(mailbox._PartialFile(self._file, 0, - 13 + 3 * len(os.linesep))) - - def test_iteration(self): - self._file.write('____foo%sbar%sfred%sbob####' % - (os.linesep, os.linesep, os.linesep)) - self._test_iteration(mailbox._PartialFile(self._file, 4, - 17 + 3 * len(os.linesep))) - - def test_seek_and_tell(self): - self._file.write('(((foo%sbar%s$$$' % (os.linesep, os.linesep)) - self._test_seek_and_tell(mailbox._PartialFile(self._file, 3, - 9 + 2 * len(os.linesep))) - - def test_close(self): - self._file.write('&foo%sbar%s^' % (os.linesep, os.linesep)) - self._test_close(mailbox._PartialFile(self._file, 1, - 6 + 3 * len(os.linesep))) - - -## Start: tests from the original module (for backward compatibility). - -FROM_ = "From some.body@dummy.domain Sat Jul 24 13:43:35 2004\n" -DUMMY_MESSAGE = """\ -From: some.body@dummy.domain -To: me@my.domain -Subject: Simple Test - -This is a dummy message. -""" - -class MaildirTestCase(unittest.TestCase): - - def setUp(self): - # create a new maildir mailbox to work with: - self._dir = test_support.TESTFN - os.mkdir(self._dir) - os.mkdir(os.path.join(self._dir, "cur")) - os.mkdir(os.path.join(self._dir, "tmp")) - os.mkdir(os.path.join(self._dir, "new")) - self._counter = 1 - self._msgfiles = [] - - def tearDown(self): - map(os.unlink, self._msgfiles) - os.rmdir(os.path.join(self._dir, "cur")) - os.rmdir(os.path.join(self._dir, "tmp")) - os.rmdir(os.path.join(self._dir, "new")) - os.rmdir(self._dir) - - def createMessage(self, dir, mbox=False): - t = int(time.time() % 1000000) - pid = self._counter - self._counter += 1 - filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain")) - tmpname = os.path.join(self._dir, "tmp", filename) - newname = os.path.join(self._dir, dir, filename) - fp = open(tmpname, "w") - self._msgfiles.append(tmpname) - if mbox: - fp.write(FROM_) - fp.write(DUMMY_MESSAGE) - fp.close() - if hasattr(os, "link"): - os.link(tmpname, newname) - else: - fp = open(newname, "w") - fp.write(DUMMY_MESSAGE) - fp.close() - self._msgfiles.append(newname) - return tmpname - - def test_empty_maildir(self): - """Test an empty maildir mailbox""" - # Test for regression on bug #117490: - # Make sure the boxes attribute actually gets set. - self.mbox = mailbox.Maildir(test_support.TESTFN) - #self.assert_(hasattr(self.mbox, "boxes")) - #self.assert_(len(self.mbox.boxes) == 0) - self.assert_(self.mbox.next() is None) - self.assert_(self.mbox.next() is None) - - def test_nonempty_maildir_cur(self): - self.createMessage("cur") - self.mbox = mailbox.Maildir(test_support.TESTFN) - #self.assert_(len(self.mbox.boxes) == 1) - self.assert_(self.mbox.next() is not None) - self.assert_(self.mbox.next() is None) - self.assert_(self.mbox.next() is None) - - def test_nonempty_maildir_new(self): - self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) - #self.assert_(len(self.mbox.boxes) == 1) - self.assert_(self.mbox.next() is not None) - self.assert_(self.mbox.next() is None) - self.assert_(self.mbox.next() is None) - - def test_nonempty_maildir_both(self): - self.createMessage("cur") - self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) - #self.assert_(len(self.mbox.boxes) == 2) - self.assert_(self.mbox.next() is not None) - self.assert_(self.mbox.next() is not None) - self.assert_(self.mbox.next() is None) - self.assert_(self.mbox.next() is None) - - def test_unix_mbox(self): - ### should be better! - import email.Parser - fname = self.createMessage("cur", True) - n = 0 - for msg in mailbox.PortableUnixMailbox(open(fname), - email.Parser.Parser().parse): - n += 1 - self.assertEqual(msg["subject"], "Simple Test") - self.assertEqual(len(str(msg)), len(FROM_)+len(DUMMY_MESSAGE)) - self.assertEqual(n, 1) - -## End: classes from the original module (for backward compatibility). - - -_sample_message = """\ -Return-Path: -X-Original-To: gkj+person@localhost -Delivered-To: gkj+person@localhost -Received: from localhost (localhost [127.0.0.1]) - by andy.gregorykjohnson.com (Postfix) with ESMTP id 356ED9DD17 - for ; Wed, 13 Jul 2005 17:23:16 -0400 (EDT) -Delivered-To: gkj@sundance.gregorykjohnson.com -Received: from localhost [127.0.0.1] - by localhost with POP3 (fetchmail-6.2.5) - for gkj+person@localhost (single-drop); Wed, 13 Jul 2005 17:23:16 -0400 (EDT) -Received: from andy.gregorykjohnson.com (andy.gregorykjohnson.com [64.32.235.228]) - by sundance.gregorykjohnson.com (Postfix) with ESMTP id 5B056316746 - for ; Wed, 13 Jul 2005 17:23:11 -0400 (EDT) -Received: by andy.gregorykjohnson.com (Postfix, from userid 1000) - id 490CD9DD17; Wed, 13 Jul 2005 17:23:11 -0400 (EDT) -Date: Wed, 13 Jul 2005 17:23:11 -0400 -From: "Gregory K. Johnson" -To: gkj@gregorykjohnson.com -Subject: Sample message -Message-ID: <20050713212311.GC4701@andy.gregorykjohnson.com> -Mime-Version: 1.0 -Content-Type: multipart/mixed; boundary="NMuMz9nt05w80d4+" -Content-Disposition: inline -User-Agent: Mutt/1.5.9i - - ---NMuMz9nt05w80d4+ -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -This is a sample message. - --- -Gregory K. Johnson - ---NMuMz9nt05w80d4+ -Content-Type: application/octet-stream -Content-Disposition: attachment; filename="text.gz" -Content-Transfer-Encoding: base64 - -H4sICM2D1UIAA3RleHQAC8nILFYAokSFktSKEoW0zJxUPa7wzJIMhZLyfIWczLzUYj0uAHTs -3FYlAAAA - ---NMuMz9nt05w80d4+-- -""" - -_sample_headers = { - "Return-Path":"", - "X-Original-To":"gkj+person@localhost", - "Delivered-To":"gkj+person@localhost", - "Received":"""from localhost (localhost [127.0.0.1]) - by andy.gregorykjohnson.com (Postfix) with ESMTP id 356ED9DD17 - for ; Wed, 13 Jul 2005 17:23:16 -0400 (EDT)""", - "Delivered-To":"gkj@sundance.gregorykjohnson.com", - "Received":"""from localhost [127.0.0.1] - by localhost with POP3 (fetchmail-6.2.5) - for gkj+person@localhost (single-drop); Wed, 13 Jul 2005 17:23:16 -0400 (EDT)""", - "Received":"""from andy.gregorykjohnson.com (andy.gregorykjohnson.com [64.32.235.228]) - by sundance.gregorykjohnson.com (Postfix) with ESMTP id 5B056316746 - for ; Wed, 13 Jul 2005 17:23:11 -0400 (EDT)""", - "Received":"""by andy.gregorykjohnson.com (Postfix, from userid 1000) - id 490CD9DD17; Wed, 13 Jul 2005 17:23:11 -0400 (EDT)""", - "Date":"Wed, 13 Jul 2005 17:23:11 -0400", - "From":""""Gregory K. Johnson" """, - "To":"gkj@gregorykjohnson.com", - "Subject":"Sample message", - "Mime-Version":"1.0", - "Content-Type":"""multipart/mixed; boundary="NMuMz9nt05w80d4+\"""", - "Content-Disposition":"inline", - "User-Agent": "Mutt/1.5.9i" } - -_sample_payloads = ("""This is a sample message. - --- -Gregory K. Johnson -""", -"""H4sICM2D1UIAA3RleHQAC8nILFYAokSFktSKEoW0zJxUPa7wzJIMhZLyfIWczLzUYj0uAHTs -3FYlAAAA -""") - - -def test_main(): - tests = (TestMailboxSuperclass, TestMaildir, TestMbox, TestMMDF, TestMH, - TestBabyl, TestMessage, TestMaildirMessage, TestMboxMessage, - TestMHMessage, TestBabylMessage, TestMMDFMessage, - TestMessageConversion, TestProxyFile, TestPartialFile, - MaildirTestCase) - test_support.run_unittest(*tests) - test_support.reap_children() - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_marshal.py b/sys/lib/python/test/test_marshal.py deleted file mode 100644 index f87495bae..000000000 --- a/sys/lib/python/test/test_marshal.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env python -# -*- coding: iso-8859-1 -*- - -from test import test_support -import marshal -import sys -import unittest -import os - -class IntTestCase(unittest.TestCase): - def test_ints(self): - # Test the full range of Python ints. - n = sys.maxint - while n: - for expected in (-n, n): - s = marshal.dumps(expected) - got = marshal.loads(s) - self.assertEqual(expected, got) - marshal.dump(expected, file(test_support.TESTFN, "wb")) - got = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(expected, got) - n = n >> 1 - os.unlink(test_support.TESTFN) - - def test_int64(self): - # Simulate int marshaling on a 64-bit box. This is most interesting if - # we're running the test on a 32-bit box, of course. - - def to_little_endian_string(value, nbytes): - bytes = [] - for i in range(nbytes): - bytes.append(chr(value & 0xff)) - value >>= 8 - return ''.join(bytes) - - maxint64 = (1L << 63) - 1 - minint64 = -maxint64-1 - - for base in maxint64, minint64, -maxint64, -(minint64 >> 1): - while base: - s = 'I' + to_little_endian_string(base, 8) - got = marshal.loads(s) - self.assertEqual(base, got) - if base == -1: # a fixed-point for shifting right 1 - base = 0 - else: - base >>= 1 - - def test_bool(self): - for b in (True, False): - new = marshal.loads(marshal.dumps(b)) - self.assertEqual(b, new) - self.assertEqual(type(b), type(new)) - marshal.dump(b, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(b, new) - self.assertEqual(type(b), type(new)) - -class FloatTestCase(unittest.TestCase): - def test_floats(self): - # Test a few floats - small = 1e-25 - n = sys.maxint * 3.7e250 - while n > small: - for expected in (-n, n): - f = float(expected) - s = marshal.dumps(f) - got = marshal.loads(s) - self.assertEqual(f, got) - marshal.dump(f, file(test_support.TESTFN, "wb")) - got = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(f, got) - n /= 123.4567 - - f = 0.0 - s = marshal.dumps(f, 2) - got = marshal.loads(s) - self.assertEqual(f, got) - # and with version <= 1 (floats marshalled differently then) - s = marshal.dumps(f, 1) - got = marshal.loads(s) - self.assertEqual(f, got) - - n = sys.maxint * 3.7e-250 - while n < small: - for expected in (-n, n): - f = float(expected) - - s = marshal.dumps(f) - got = marshal.loads(s) - self.assertEqual(f, got) - - s = marshal.dumps(f, 1) - got = marshal.loads(s) - self.assertEqual(f, got) - - marshal.dump(f, file(test_support.TESTFN, "wb")) - got = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(f, got) - - marshal.dump(f, file(test_support.TESTFN, "wb"), 1) - got = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(f, got) - n *= 123.4567 - os.unlink(test_support.TESTFN) - -class StringTestCase(unittest.TestCase): - def test_unicode(self): - for s in [u"", u"Andrè Previn", u"abc", u" "*10000]: - new = marshal.loads(marshal.dumps(s)) - self.assertEqual(s, new) - self.assertEqual(type(s), type(new)) - marshal.dump(s, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(s, new) - self.assertEqual(type(s), type(new)) - os.unlink(test_support.TESTFN) - - def test_string(self): - for s in ["", "Andrè Previn", "abc", " "*10000]: - new = marshal.loads(marshal.dumps(s)) - self.assertEqual(s, new) - self.assertEqual(type(s), type(new)) - marshal.dump(s, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(s, new) - self.assertEqual(type(s), type(new)) - os.unlink(test_support.TESTFN) - - def test_buffer(self): - for s in ["", "Andrè Previn", "abc", " "*10000]: - b = buffer(s) - new = marshal.loads(marshal.dumps(b)) - self.assertEqual(s, new) - marshal.dump(b, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(s, new) - os.unlink(test_support.TESTFN) - -class ExceptionTestCase(unittest.TestCase): - def test_exceptions(self): - new = marshal.loads(marshal.dumps(StopIteration)) - self.assertEqual(StopIteration, new) - -class CodeTestCase(unittest.TestCase): - def test_code(self): - co = ExceptionTestCase.test_exceptions.func_code - new = marshal.loads(marshal.dumps(co)) - self.assertEqual(co, new) - -class ContainerTestCase(unittest.TestCase): - d = {'astring': 'foo@bar.baz.spam', - 'afloat': 7283.43, - 'anint': 2**20, - 'ashortlong': 2L, - 'alist': ['.zyx.41'], - 'atuple': ('.zyx.41',)*10, - 'aboolean': False, - 'aunicode': u"Andrè Previn" - } - def test_dict(self): - new = marshal.loads(marshal.dumps(self.d)) - self.assertEqual(self.d, new) - marshal.dump(self.d, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(self.d, new) - os.unlink(test_support.TESTFN) - - def test_list(self): - lst = self.d.items() - new = marshal.loads(marshal.dumps(lst)) - self.assertEqual(lst, new) - marshal.dump(lst, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(lst, new) - os.unlink(test_support.TESTFN) - - def test_tuple(self): - t = tuple(self.d.keys()) - new = marshal.loads(marshal.dumps(t)) - self.assertEqual(t, new) - marshal.dump(t, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(t, new) - os.unlink(test_support.TESTFN) - - def test_sets(self): - for constructor in (set, frozenset): - t = constructor(self.d.keys()) - new = marshal.loads(marshal.dumps(t)) - self.assertEqual(t, new) - self.assert_(isinstance(new, constructor)) - self.assertNotEqual(id(t), id(new)) - marshal.dump(t, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) - self.assertEqual(t, new) - os.unlink(test_support.TESTFN) - -class BugsTestCase(unittest.TestCase): - def test_bug_5888452(self): - # Simple-minded check for SF 588452: Debug build crashes - marshal.dumps([128] * 1000) - - def test_patch_873224(self): - self.assertRaises(Exception, marshal.loads, '0') - self.assertRaises(Exception, marshal.loads, 'f') - self.assertRaises(Exception, marshal.loads, marshal.dumps(5L)[:-1]) - - def test_version_argument(self): - # Python 2.4.0 crashes for any call to marshal.dumps(x, y) - self.assertEquals(marshal.loads(marshal.dumps(5, 0)), 5) - self.assertEquals(marshal.loads(marshal.dumps(5, 1)), 5) - - def test_fuzz(self): - # simple test that it's at least not *totally* trivial to - # crash from bad marshal data - for c in [chr(i) for i in range(256)]: - try: - marshal.loads(c) - except Exception: - pass - -def test_main(): - test_support.run_unittest(IntTestCase, - FloatTestCase, - StringTestCase, - CodeTestCase, - ContainerTestCase, - ExceptionTestCase, - BugsTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_math.py b/sys/lib/python/test/test_math.py deleted file mode 100644 index a092265b7..000000000 --- a/sys/lib/python/test/test_math.py +++ /dev/null @@ -1,208 +0,0 @@ -# Python test set -- math module -# XXXX Should not do tests around zero only - -from test.test_support import TestFailed, verbose - -seps='1e-05' -eps = eval(seps) -print 'math module, testing with eps', seps -import math - -def testit(name, value, expected): - if abs(value-expected) > eps: - raise TestFailed, '%s returned %f, expected %f'%\ - (name, value, expected) - -print 'constants' -testit('pi', math.pi, 3.1415926) -testit('e', math.e, 2.7182818) - -print 'acos' -testit('acos(-1)', math.acos(-1), math.pi) -testit('acos(0)', math.acos(0), math.pi/2) -testit('acos(1)', math.acos(1), 0) - -print 'asin' -testit('asin(-1)', math.asin(-1), -math.pi/2) -testit('asin(0)', math.asin(0), 0) -testit('asin(1)', math.asin(1), math.pi/2) - -print 'atan' -testit('atan(-1)', math.atan(-1), -math.pi/4) -testit('atan(0)', math.atan(0), 0) -testit('atan(1)', math.atan(1), math.pi/4) - -print 'atan2' -testit('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2) -testit('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4) -testit('atan2(0, 1)', math.atan2(0, 1), 0) -testit('atan2(1, 1)', math.atan2(1, 1), math.pi/4) -testit('atan2(1, 0)', math.atan2(1, 0), math.pi/2) - -print 'ceil' -testit('ceil(0.5)', math.ceil(0.5), 1) -testit('ceil(1.0)', math.ceil(1.0), 1) -testit('ceil(1.5)', math.ceil(1.5), 2) -testit('ceil(-0.5)', math.ceil(-0.5), 0) -testit('ceil(-1.0)', math.ceil(-1.0), -1) -testit('ceil(-1.5)', math.ceil(-1.5), -1) - -print 'cos' -testit('cos(-pi/2)', math.cos(-math.pi/2), 0) -testit('cos(0)', math.cos(0), 1) -testit('cos(pi/2)', math.cos(math.pi/2), 0) -testit('cos(pi)', math.cos(math.pi), -1) - -print 'cosh' -testit('cosh(0)', math.cosh(0), 1) -testit('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert - -print 'degrees' -testit('degrees(pi)', math.degrees(math.pi), 180.0) -testit('degrees(pi/2)', math.degrees(math.pi/2), 90.0) -testit('degrees(-pi/4)', math.degrees(-math.pi/4), -45.0) - -print 'exp' -testit('exp(-1)', math.exp(-1), 1/math.e) -testit('exp(0)', math.exp(0), 1) -testit('exp(1)', math.exp(1), math.e) - -print 'fabs' -testit('fabs(-1)', math.fabs(-1), 1) -testit('fabs(0)', math.fabs(0), 0) -testit('fabs(1)', math.fabs(1), 1) - -print 'floor' -testit('floor(0.5)', math.floor(0.5), 0) -testit('floor(1.0)', math.floor(1.0), 1) -testit('floor(1.5)', math.floor(1.5), 1) -testit('floor(-0.5)', math.floor(-0.5), -1) -testit('floor(-1.0)', math.floor(-1.0), -1) -testit('floor(-1.5)', math.floor(-1.5), -2) - -print 'fmod' -testit('fmod(10,1)', math.fmod(10,1), 0) -testit('fmod(10,0.5)', math.fmod(10,0.5), 0) -testit('fmod(10,1.5)', math.fmod(10,1.5), 1) -testit('fmod(-10,1)', math.fmod(-10,1), 0) -testit('fmod(-10,0.5)', math.fmod(-10,0.5), 0) -testit('fmod(-10,1.5)', math.fmod(-10,1.5), -1) - -print 'frexp' -def testfrexp(name, (mant, exp), (emant, eexp)): - if abs(mant-emant) > eps or exp != eexp: - raise TestFailed, '%s returned %r, expected %r'%\ - (name, (mant, exp), (emant,eexp)) - -testfrexp('frexp(-1)', math.frexp(-1), (-0.5, 1)) -testfrexp('frexp(0)', math.frexp(0), (0, 0)) -testfrexp('frexp(1)', math.frexp(1), (0.5, 1)) -testfrexp('frexp(2)', math.frexp(2), (0.5, 2)) - -print 'hypot' -testit('hypot(0,0)', math.hypot(0,0), 0) -testit('hypot(3,4)', math.hypot(3,4), 5) - -print 'ldexp' -testit('ldexp(0,1)', math.ldexp(0,1), 0) -testit('ldexp(1,1)', math.ldexp(1,1), 2) -testit('ldexp(1,-1)', math.ldexp(1,-1), 0.5) -testit('ldexp(-1,1)', math.ldexp(-1,1), -2) - -print 'log' -testit('log(1/e)', math.log(1/math.e), -1) -testit('log(1)', math.log(1), 0) -testit('log(e)', math.log(math.e), 1) -testit('log(32,2)', math.log(32,2), 5) -testit('log(10**40, 10)', math.log(10**40, 10), 40) -testit('log(10**40, 10**20)', math.log(10**40, 10**20), 2) - -print 'log10' -testit('log10(0.1)', math.log10(0.1), -1) -testit('log10(1)', math.log10(1), 0) -testit('log10(10)', math.log10(10), 1) - -print 'modf' -def testmodf(name, (v1, v2), (e1, e2)): - if abs(v1-e1) > eps or abs(v2-e2): - raise TestFailed, '%s returned %r, expected %r'%\ - (name, (v1,v2), (e1,e2)) - -testmodf('modf(1.5)', math.modf(1.5), (0.5, 1.0)) -testmodf('modf(-1.5)', math.modf(-1.5), (-0.5, -1.0)) - -print 'pow' -testit('pow(0,1)', math.pow(0,1), 0) -testit('pow(1,0)', math.pow(1,0), 1) -testit('pow(2,1)', math.pow(2,1), 2) -testit('pow(2,-1)', math.pow(2,-1), 0.5) - -print 'radians' -testit('radians(180)', math.radians(180), math.pi) -testit('radians(90)', math.radians(90), math.pi/2) -testit('radians(-45)', math.radians(-45), -math.pi/4) - -print 'sin' -testit('sin(0)', math.sin(0), 0) -testit('sin(pi/2)', math.sin(math.pi/2), 1) -testit('sin(-pi/2)', math.sin(-math.pi/2), -1) - -print 'sinh' -testit('sinh(0)', math.sinh(0), 0) -testit('sinh(1)**2-cosh(1)**2', math.sinh(1)**2-math.cosh(1)**2, -1) -testit('sinh(1)+sinh(-1)', math.sinh(1)+math.sinh(-1), 0) - -print 'sqrt' -testit('sqrt(0)', math.sqrt(0), 0) -testit('sqrt(1)', math.sqrt(1), 1) -testit('sqrt(4)', math.sqrt(4), 2) - -print 'tan' -testit('tan(0)', math.tan(0), 0) -testit('tan(pi/4)', math.tan(math.pi/4), 1) -testit('tan(-pi/4)', math.tan(-math.pi/4), -1) - -print 'tanh' -testit('tanh(0)', math.tanh(0), 0) -testit('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0) - -# RED_FLAG 16-Oct-2000 Tim -# While 2.0 is more consistent about exceptions than previous releases, it -# still fails this part of the test on some platforms. For now, we only -# *run* test_exceptions() in verbose mode, so that this isn't normally -# tested. - -def test_exceptions(): - print 'exceptions' - try: - x = math.exp(-1000000000) - except: - # mathmodule.c is failing to weed out underflows from libm, or - # we've got an fp format with huge dynamic range - raise TestFailed("underflowing exp() should not have raised " - "an exception") - if x != 0: - raise TestFailed("underflowing exp() should have returned 0") - - # If this fails, probably using a strict IEEE-754 conforming libm, and x - # is +Inf afterwards. But Python wants overflows detected by default. - try: - x = math.exp(1000000000) - except OverflowError: - pass - else: - raise TestFailed("overflowing exp() didn't trigger OverflowError") - - # If this fails, it could be a puzzle. One odd possibility is that - # mathmodule.c's macros are getting confused while comparing - # Inf (HUGE_VAL) to a NaN, and artificially setting errno to ERANGE - # as a result (and so raising OverflowError instead). - try: - x = math.sqrt(-1.0) - except ValueError: - pass - else: - raise TestFailed("sqrt(-1) didn't raise ValueError") - -if verbose: - test_exceptions() diff --git a/sys/lib/python/test/test_md5.py b/sys/lib/python/test/test_md5.py deleted file mode 100644 index 1f0856850..000000000 --- a/sys/lib/python/test/test_md5.py +++ /dev/null @@ -1,58 +0,0 @@ -# Testing md5 module - -import unittest -from md5 import md5 -from test import test_support - -def hexstr(s): - import string - h = string.hexdigits - r = '' - for c in s: - i = ord(c) - r = r + h[(i >> 4) & 0xF] + h[i & 0xF] - return r - -class MD5_Test(unittest.TestCase): - - def md5test(self, s, expected): - self.assertEqual(hexstr(md5(s).digest()), expected) - self.assertEqual(md5(s).hexdigest(), expected) - - def test_basics(self): - eq = self.md5test - eq('', 'd41d8cd98f00b204e9800998ecf8427e') - eq('a', '0cc175b9c0f1b6a831c399e269772661') - eq('abc', '900150983cd24fb0d6963f7d28e17f72') - eq('message digest', 'f96b697d7cb7938d525a2f31aaf161d0') - eq('abcdefghijklmnopqrstuvwxyz', 'c3fcd3d76192e4007dfb496cca67e13b') - eq('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', - 'd174ab98d277d9f5a5611c2c9f419d9f') - eq('12345678901234567890123456789012345678901234567890123456789012345678901234567890', - '57edf4a22be3c955ac49da2e2107b67a') - - def test_hexdigest(self): - # hexdigest is new with Python 2.0 - m = md5('testing the hexdigest method') - h = m.hexdigest() - self.assertEqual(hexstr(m.digest()), h) - - def test_large_update(self): - aas = 'a' * 64 - bees = 'b' * 64 - cees = 'c' * 64 - - m1 = md5() - m1.update(aas) - m1.update(bees) - m1.update(cees) - - m2 = md5() - m2.update(aas + bees + cees) - self.assertEqual(m1.digest(), m2.digest()) - -def test_main(): - test_support.run_unittest(MD5_Test) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_mhlib.py b/sys/lib/python/test/test_mhlib.py deleted file mode 100644 index a6dc00ad9..000000000 --- a/sys/lib/python/test/test_mhlib.py +++ /dev/null @@ -1,348 +0,0 @@ -""" - Tests for the mhlib module - Nick Mathewson -""" - -### BUG: This suite doesn't currently test the mime functionality of -### mhlib. It should. - -import unittest -from test.test_support import run_unittest, TESTFN, TestSkipped -import os, StringIO -import sys -import mhlib - -if (sys.platform.startswith("win") or sys.platform=="riscos" or - sys.platform.startswith("atheos")): - # mhlib.updateline() renames a file to the name of a file that already - # exists. That causes a reasonable OS to complain in test_sequence - # here, like the "OSError: [Errno 17] File exists" raised on Windows. - # mhlib's listsubfolders() and listallfolders() do something with - # link counts, and that causes test_listfolders() here to get back - # an empty list from its call of listallfolders(). - # The other tests here pass on Windows. - raise TestSkipped("skipped on %s -- " % sys.platform + - "too many Unix assumptions") - -_mhroot = TESTFN+"_MH" -_mhpath = os.path.join(_mhroot, "MH") -_mhprofile = os.path.join(_mhroot, ".mh_profile") - -def normF(f): - return os.path.join(*f.split('/')) - -def writeFile(fname, contents): - dir = os.path.split(fname)[0] - if dir and not os.path.exists(dir): - mkdirs(dir) - f = open(fname, 'w') - f.write(contents) - f.close() - -def readFile(fname): - f = open(fname) - r = f.read() - f.close() - return r - -def writeProfile(dict): - contents = [ "%s: %s\n" % (k, v) for k, v in dict.iteritems() ] - writeFile(_mhprofile, "".join(contents)) - -def writeContext(folder): - folder = normF(folder) - writeFile(os.path.join(_mhpath, "context"), - "Current-Folder: %s\n" % folder) - -def writeCurMessage(folder, cur): - folder = normF(folder) - writeFile(os.path.join(_mhpath, folder, ".mh_sequences"), - "cur: %s\n"%cur) - -def writeMessage(folder, n, headers, body): - folder = normF(folder) - headers = "".join([ "%s: %s\n" % (k, v) for k, v in headers.iteritems() ]) - contents = "%s\n%s\n" % (headers,body) - mkdirs(os.path.join(_mhpath, folder)) - writeFile(os.path.join(_mhpath, folder, str(n)), contents) - -def getMH(): - return mhlib.MH(os.path.abspath(_mhpath), _mhprofile) - -def sortLines(s): - lines = s.split("\n") - lines = [ line.strip() for line in lines if len(line) >= 2 ] - lines.sort() - return lines - -# These next 2 functions are copied from test_glob.py. -def mkdirs(fname): - if os.path.exists(fname) or fname == '': - return - base, file = os.path.split(fname) - mkdirs(base) - os.mkdir(fname) - -def deltree(fname): - if not os.path.exists(fname): - return - for f in os.listdir(fname): - fullname = os.path.join(fname, f) - if os.path.isdir(fullname): - deltree(fullname) - else: - try: - os.unlink(fullname) - except: - pass - try: - os.rmdir(fname) - except: - pass - -class MhlibTests(unittest.TestCase): - def setUp(self): - deltree(_mhroot) - mkdirs(_mhpath) - writeProfile({'Path' : os.path.abspath(_mhpath), - 'Editor': 'emacs', - 'ignored-attribute': 'camping holiday'}) - # Note: These headers aren't really conformant to RFC822, but - # mhlib shouldn't care about that. - - # An inbox with a couple of messages. - writeMessage('inbox', 1, - {'From': 'Mrs. Premise', - 'To': 'Mrs. Conclusion', - 'Date': '18 July 2001'}, "Hullo, Mrs. Conclusion!\n") - writeMessage('inbox', 2, - {'From': 'Mrs. Conclusion', - 'To': 'Mrs. Premise', - 'Date': '29 July 2001'}, "Hullo, Mrs. Premise!\n") - - # A folder with many messages - for i in range(5, 101)+range(101, 201, 2): - writeMessage('wide', i, - {'From': 'nowhere', 'Subject': 'message #%s' % i}, - "This is message number %s\n" % i) - - # A deeply nested folder - def deep(folder, n): - writeMessage(folder, n, - {'Subject': 'Message %s/%s' % (folder, n) }, - "This is message number %s in %s\n" % (n, folder) ) - deep('deep/f1', 1) - deep('deep/f1', 2) - deep('deep/f1', 3) - deep('deep/f2', 4) - deep('deep/f2', 6) - deep('deep', 3) - deep('deep/f2/f3', 1) - deep('deep/f2/f3', 2) - - def tearDown(self): - deltree(_mhroot) - - def test_basic(self): - writeContext('inbox') - writeCurMessage('inbox', 2) - mh = getMH() - - eq = self.assertEquals - eq(mh.getprofile('Editor'), 'emacs') - eq(mh.getprofile('not-set'), None) - eq(mh.getpath(), os.path.abspath(_mhpath)) - eq(mh.getcontext(), 'inbox') - - mh.setcontext('wide') - eq(mh.getcontext(), 'wide') - eq(readFile(os.path.join(_mhpath, 'context')), - "Current-Folder: wide\n") - - mh.setcontext('inbox') - - inbox = mh.openfolder('inbox') - eq(inbox.getfullname(), - os.path.join(os.path.abspath(_mhpath), 'inbox')) - eq(inbox.getsequencesfilename(), - os.path.join(os.path.abspath(_mhpath), 'inbox', '.mh_sequences')) - eq(inbox.getmessagefilename(1), - os.path.join(os.path.abspath(_mhpath), 'inbox', '1')) - - def test_listfolders(self): - mh = getMH() - eq = self.assertEquals - - folders = mh.listfolders() - folders.sort() - eq(folders, ['deep', 'inbox', 'wide']) - - folders = mh.listallfolders() - folders.sort() - tfolders = map(normF, ['deep', 'deep/f1', 'deep/f2', 'deep/f2/f3', - 'inbox', 'wide']) - tfolders.sort() - eq(folders, tfolders) - - folders = mh.listsubfolders('deep') - folders.sort() - eq(folders, map(normF, ['deep/f1', 'deep/f2'])) - - folders = mh.listallsubfolders('deep') - folders.sort() - eq(folders, map(normF, ['deep/f1', 'deep/f2', 'deep/f2/f3'])) - eq(mh.listsubfolders(normF('deep/f2')), [normF('deep/f2/f3')]) - - eq(mh.listsubfolders('inbox'), []) - eq(mh.listallsubfolders('inbox'), []) - - def test_sequence(self): - mh = getMH() - eq = self.assertEquals - writeCurMessage('wide', 55) - - f = mh.openfolder('wide') - all = f.listmessages() - eq(all, range(5, 101)+range(101, 201, 2)) - eq(f.getcurrent(), 55) - f.setcurrent(99) - eq(readFile(os.path.join(_mhpath, 'wide', '.mh_sequences')), - 'cur: 99\n') - - def seqeq(seq, val): - eq(f.parsesequence(seq), val) - - seqeq('5-55', range(5, 56)) - seqeq('90-108', range(90, 101)+range(101, 109, 2)) - seqeq('90-108', range(90, 101)+range(101, 109, 2)) - - seqeq('10:10', range(10, 20)) - seqeq('10:+10', range(10, 20)) - seqeq('101:10', range(101, 121, 2)) - - seqeq('cur', [99]) - seqeq('.', [99]) - seqeq('prev', [98]) - seqeq('next', [100]) - seqeq('cur:-3', [97, 98, 99]) - seqeq('first-cur', range(5, 100)) - seqeq('150-last', range(151, 201, 2)) - seqeq('prev-next', [98, 99, 100]) - - lowprimes = [5, 7, 11, 13, 17, 19, 23, 29] - lowcompos = [x for x in range(5, 31) if not x in lowprimes ] - f.putsequences({'cur': [5], - 'lowprime': lowprimes, - 'lowcompos': lowcompos}) - seqs = readFile(os.path.join(_mhpath, 'wide', '.mh_sequences')) - seqs = sortLines(seqs) - eq(seqs, ["cur: 5", - "lowcompos: 6 8-10 12 14-16 18 20-22 24-28 30", - "lowprime: 5 7 11 13 17 19 23 29"]) - - seqeq('lowprime', lowprimes) - seqeq('lowprime:1', [5]) - seqeq('lowprime:2', [5, 7]) - seqeq('lowprime:-2', [23, 29]) - - ## Not supported - #seqeq('lowprime:first', [5]) - #seqeq('lowprime:last', [29]) - #seqeq('lowprime:prev', [29]) - #seqeq('lowprime:next', [29]) - - def test_modify(self): - mh = getMH() - eq = self.assertEquals - - mh.makefolder("dummy1") - self.assert_("dummy1" in mh.listfolders()) - path = os.path.join(_mhpath, "dummy1") - self.assert_(os.path.exists(path)) - - f = mh.openfolder('dummy1') - def create(n): - msg = "From: foo\nSubject: %s\n\nDummy Message %s\n" % (n,n) - f.createmessage(n, StringIO.StringIO(msg)) - - create(7) - create(8) - create(9) - - eq(readFile(f.getmessagefilename(9)), - "From: foo\nSubject: 9\n\nDummy Message 9\n") - - eq(f.listmessages(), [7, 8, 9]) - files = os.listdir(path) - files.sort() - eq(files, ['7', '8', '9']) - - f.removemessages(['7', '8']) - files = os.listdir(path) - files.sort() - eq(files, [',7', ',8', '9']) - eq(f.listmessages(), [9]) - create(10) - create(11) - create(12) - - mh.makefolder("dummy2") - f2 = mh.openfolder("dummy2") - eq(f2.listmessages(), []) - f.movemessage(10, f2, 3) - f.movemessage(11, f2, 5) - eq(f.listmessages(), [9, 12]) - eq(f2.listmessages(), [3, 5]) - eq(readFile(f2.getmessagefilename(3)), - "From: foo\nSubject: 10\n\nDummy Message 10\n") - - f.copymessage(9, f2, 4) - eq(f.listmessages(), [9, 12]) - eq(readFile(f2.getmessagefilename(4)), - "From: foo\nSubject: 9\n\nDummy Message 9\n") - - f.refilemessages([9, 12], f2) - eq(f.listmessages(), []) - eq(f2.listmessages(), [3, 4, 5, 6, 7]) - eq(readFile(f2.getmessagefilename(7)), - "From: foo\nSubject: 12\n\nDummy Message 12\n") - # XXX This should check that _copysequences does the right thing. - - mh.deletefolder('dummy1') - mh.deletefolder('dummy2') - self.assert_('dummy1' not in mh.listfolders()) - self.assert_(not os.path.exists(path)) - - def test_read(self): - mh = getMH() - eq = self.assertEquals - - f = mh.openfolder('inbox') - msg = f.openmessage(1) - # Check some basic stuff from rfc822 - eq(msg.getheader('From'), "Mrs. Premise") - eq(msg.getheader('To'), "Mrs. Conclusion") - - # Okay, we have the right message. Let's check the stuff from - # mhlib. - lines = sortLines(msg.getheadertext()) - eq(lines, ["Date: 18 July 2001", - "From: Mrs. Premise", - "To: Mrs. Conclusion"]) - lines = sortLines(msg.getheadertext(lambda h: len(h)==4)) - eq(lines, ["Date: 18 July 2001", - "From: Mrs. Premise"]) - eq(msg.getbodytext(), "Hullo, Mrs. Conclusion!\n\n") - eq(msg.getbodytext(0), "Hullo, Mrs. Conclusion!\n\n") - - # XXXX there should be a better way to reclaim the file handle - msg.fp.close() - del msg - - -def test_main(): - run_unittest(MhlibTests) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_mimetools.py b/sys/lib/python/test/test_mimetools.py deleted file mode 100644 index b0b5b01be..000000000 --- a/sys/lib/python/test/test_mimetools.py +++ /dev/null @@ -1,50 +0,0 @@ -import unittest -from test import test_support - -import string, StringIO, mimetools - -msgtext1 = mimetools.Message(StringIO.StringIO( -"""Content-Type: text/plain; charset=iso-8859-1; format=flowed -Content-Transfer-Encoding: 8bit - -Foo! -""")) - -class MimeToolsTest(unittest.TestCase): - - def test_decodeencode(self): - start = string.ascii_letters + "=" + string.digits + "\n" - for enc in ['7bit','8bit','base64','quoted-printable', - 'uuencode', 'x-uuencode', 'uue', 'x-uue']: - i = StringIO.StringIO(start) - o = StringIO.StringIO() - mimetools.encode(i, o, enc) - i = StringIO.StringIO(o.getvalue()) - o = StringIO.StringIO() - mimetools.decode(i, o, enc) - self.assertEqual(o.getvalue(), start) - - def test_boundary(self): - s = set([""]) - for i in xrange(100): - nb = mimetools.choose_boundary() - self.assert_(nb not in s) - s.add(nb) - - def test_message(self): - msg = mimetools.Message(StringIO.StringIO(msgtext1)) - self.assertEqual(msg.gettype(), "text/plain") - self.assertEqual(msg.getmaintype(), "text") - self.assertEqual(msg.getsubtype(), "plain") - self.assertEqual(msg.getplist(), ["charset=iso-8859-1", "format=flowed"]) - self.assertEqual(msg.getparamnames(), ["charset", "format"]) - self.assertEqual(msg.getparam("charset"), "iso-8859-1") - self.assertEqual(msg.getparam("format"), "flowed") - self.assertEqual(msg.getparam("spam"), None) - self.assertEqual(msg.getencoding(), "8bit") - -def test_main(): - test_support.run_unittest(MimeToolsTest) - -if __name__=="__main__": - test_main() diff --git a/sys/lib/python/test/test_mimetypes.py b/sys/lib/python/test/test_mimetypes.py deleted file mode 100644 index 0190c2f3c..000000000 --- a/sys/lib/python/test/test_mimetypes.py +++ /dev/null @@ -1,70 +0,0 @@ -import mimetypes -import StringIO -import unittest - -from test import test_support - -# Tell it we don't know about external files: -mimetypes.knownfiles = [] -mimetypes.inited = False -mimetypes._default_mime_types() - - -class MimeTypesTestCase(unittest.TestCase): - def setUp(self): - self.db = mimetypes.MimeTypes() - - def test_default_data(self): - eq = self.assertEqual - eq(self.db.guess_type("foo.html"), ("text/html", None)) - eq(self.db.guess_type("foo.tgz"), ("application/x-tar", "gzip")) - eq(self.db.guess_type("foo.tar.gz"), ("application/x-tar", "gzip")) - eq(self.db.guess_type("foo.tar.Z"), ("application/x-tar", "compress")) - - def test_data_urls(self): - eq = self.assertEqual - guess_type = self.db.guess_type - eq(guess_type("data:,thisIsTextPlain"), ("text/plain", None)) - eq(guess_type("data:;base64,thisIsTextPlain"), ("text/plain", None)) - eq(guess_type("data:text/x-foo,thisIsTextXFoo"), ("text/x-foo", None)) - - def test_file_parsing(self): - eq = self.assertEqual - sio = StringIO.StringIO("x-application/x-unittest pyunit\n") - self.db.readfp(sio) - eq(self.db.guess_type("foo.pyunit"), - ("x-application/x-unittest", None)) - eq(self.db.guess_extension("x-application/x-unittest"), ".pyunit") - - def test_non_standard_types(self): - eq = self.assertEqual - # First try strict - eq(self.db.guess_type('foo.xul', strict=True), (None, None)) - eq(self.db.guess_extension('image/jpg', strict=True), None) - # And then non-strict - eq(self.db.guess_type('foo.xul', strict=False), ('text/xul', None)) - eq(self.db.guess_extension('image/jpg', strict=False), '.jpg') - - def test_guess_all_types(self): - eq = self.assertEqual - unless = self.failUnless - # First try strict. Use a set here for testing the results because if - # test_urllib2 is run before test_mimetypes, global state is modified - # such that the 'all' set will have more items in it. - all = set(self.db.guess_all_extensions('text/plain', strict=True)) - unless(all >= set(['.bat', '.c', '.h', '.ksh', '.pl', '.txt'])) - # And now non-strict - all = self.db.guess_all_extensions('image/jpg', strict=False) - all.sort() - eq(all, ['.jpg']) - # And now for no hits - all = self.db.guess_all_extensions('image/jpg', strict=True) - eq(all, []) - - -def test_main(): - test_support.run_unittest(MimeTypesTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_minidom.py b/sys/lib/python/test/test_minidom.py deleted file mode 100644 index a6d309f7d..000000000 --- a/sys/lib/python/test/test_minidom.py +++ /dev/null @@ -1,1397 +0,0 @@ -# test for xml.dom.minidom - -import os -import sys -import pickle -import traceback -from StringIO import StringIO -from test.test_support import verbose - -import xml.dom -import xml.dom.minidom -import xml.parsers.expat - -from xml.dom.minidom import parse, Node, Document, parseString -from xml.dom.minidom import getDOMImplementation - - -if __name__ == "__main__": - base = sys.argv[0] -else: - base = __file__ -tstfile = os.path.join(os.path.dirname(base), "test"+os.extsep+"xml") -del base - -def confirm(test, testname = "Test"): - if not test: - print "Failed " + testname - raise Exception - -def testParseFromFile(): - dom = parse(StringIO(open(tstfile).read())) - dom.unlink() - confirm(isinstance(dom,Document)) - -def testGetElementsByTagName(): - dom = parse(tstfile) - confirm(dom.getElementsByTagName("LI") == \ - dom.documentElement.getElementsByTagName("LI")) - dom.unlink() - -def testInsertBefore(): - dom = parseString("") - root = dom.documentElement - elem = root.childNodes[0] - nelem = dom.createElement("element") - root.insertBefore(nelem, elem) - confirm(len(root.childNodes) == 2 - and root.childNodes.length == 2 - and root.childNodes[0] is nelem - and root.childNodes.item(0) is nelem - and root.childNodes[1] is elem - and root.childNodes.item(1) is elem - and root.firstChild is nelem - and root.lastChild is elem - and root.toxml() == "" - , "testInsertBefore -- node properly placed in tree") - nelem = dom.createElement("element") - root.insertBefore(nelem, None) - confirm(len(root.childNodes) == 3 - and root.childNodes.length == 3 - and root.childNodes[1] is elem - and root.childNodes.item(1) is elem - and root.childNodes[2] is nelem - and root.childNodes.item(2) is nelem - and root.lastChild is nelem - and nelem.previousSibling is elem - and root.toxml() == "" - , "testInsertBefore -- node properly placed in tree") - nelem2 = dom.createElement("bar") - root.insertBefore(nelem2, nelem) - confirm(len(root.childNodes) == 4 - and root.childNodes.length == 4 - and root.childNodes[2] is nelem2 - and root.childNodes.item(2) is nelem2 - and root.childNodes[3] is nelem - and root.childNodes.item(3) is nelem - and nelem2.nextSibling is nelem - and nelem.previousSibling is nelem2 - and root.toxml() == "" - , "testInsertBefore -- node properly placed in tree") - dom.unlink() - -def _create_fragment_test_nodes(): - dom = parseString("") - orig = dom.createTextNode("original") - c1 = dom.createTextNode("foo") - c2 = dom.createTextNode("bar") - c3 = dom.createTextNode("bat") - dom.documentElement.appendChild(orig) - frag = dom.createDocumentFragment() - frag.appendChild(c1) - frag.appendChild(c2) - frag.appendChild(c3) - return dom, orig, c1, c2, c3, frag - -def testInsertBeforeFragment(): - dom, orig, c1, c2, c3, frag = _create_fragment_test_nodes() - dom.documentElement.insertBefore(frag, None) - confirm(tuple(dom.documentElement.childNodes) == (orig, c1, c2, c3), - "insertBefore(, None)") - frag.unlink() - dom.unlink() - # - dom, orig, c1, c2, c3, frag = _create_fragment_test_nodes() - dom.documentElement.insertBefore(frag, orig) - confirm(tuple(dom.documentElement.childNodes) == (c1, c2, c3, orig), - "insertBefore(, orig)") - frag.unlink() - dom.unlink() - -def testAppendChild(): - dom = parse(tstfile) - dom.documentElement.appendChild(dom.createComment(u"Hello")) - confirm(dom.documentElement.childNodes[-1].nodeName == "#comment") - confirm(dom.documentElement.childNodes[-1].data == "Hello") - dom.unlink() - -def testAppendChildFragment(): - dom, orig, c1, c2, c3, frag = _create_fragment_test_nodes() - dom.documentElement.appendChild(frag) - confirm(tuple(dom.documentElement.childNodes) == (orig, c1, c2, c3), - "appendChild()") - frag.unlink() - dom.unlink() - -def testReplaceChildFragment(): - dom, orig, c1, c2, c3, frag = _create_fragment_test_nodes() - dom.documentElement.replaceChild(frag, orig) - orig.unlink() - confirm(tuple(dom.documentElement.childNodes) == (c1, c2, c3), - "replaceChild()") - frag.unlink() - dom.unlink() - -def testLegalChildren(): - dom = Document() - elem = dom.createElement('element') - text = dom.createTextNode('text') - - try: dom.appendChild(text) - except xml.dom.HierarchyRequestErr: pass - else: - print "dom.appendChild didn't raise HierarchyRequestErr" - - dom.appendChild(elem) - try: dom.insertBefore(text, elem) - except xml.dom.HierarchyRequestErr: pass - else: - print "dom.appendChild didn't raise HierarchyRequestErr" - - try: dom.replaceChild(text, elem) - except xml.dom.HierarchyRequestErr: pass - else: - print "dom.appendChild didn't raise HierarchyRequestErr" - - nodemap = elem.attributes - try: nodemap.setNamedItem(text) - except xml.dom.HierarchyRequestErr: pass - else: - print "NamedNodeMap.setNamedItem didn't raise HierarchyRequestErr" - - try: nodemap.setNamedItemNS(text) - except xml.dom.HierarchyRequestErr: pass - else: - print "NamedNodeMap.setNamedItemNS didn't raise HierarchyRequestErr" - - elem.appendChild(text) - dom.unlink() - -def testNamedNodeMapSetItem(): - dom = Document() - elem = dom.createElement('element') - attrs = elem.attributes - attrs["foo"] = "bar" - a = attrs.item(0) - confirm(a.ownerDocument is dom, - "NamedNodeMap.__setitem__() sets ownerDocument") - confirm(a.ownerElement is elem, - "NamedNodeMap.__setitem__() sets ownerElement") - confirm(a.value == "bar", - "NamedNodeMap.__setitem__() sets value") - confirm(a.nodeValue == "bar", - "NamedNodeMap.__setitem__() sets nodeValue") - elem.unlink() - dom.unlink() - -def testNonZero(): - dom = parse(tstfile) - confirm(dom)# should not be zero - dom.appendChild(dom.createComment("foo")) - confirm(not dom.childNodes[-1].childNodes) - dom.unlink() - -def testUnlink(): - dom = parse(tstfile) - dom.unlink() - -def testElement(): - dom = Document() - dom.appendChild(dom.createElement("abc")) - confirm(dom.documentElement) - dom.unlink() - -def testAAA(): - dom = parseString("") - el = dom.documentElement - el.setAttribute("spam", "jam2") - confirm(el.toxml() == '', "testAAA") - a = el.getAttributeNode("spam") - confirm(a.ownerDocument is dom, - "setAttribute() sets ownerDocument") - confirm(a.ownerElement is dom.documentElement, - "setAttribute() sets ownerElement") - dom.unlink() - -def testAAB(): - dom = parseString("") - el = dom.documentElement - el.setAttribute("spam", "jam") - el.setAttribute("spam", "jam2") - confirm(el.toxml() == '', "testAAB") - dom.unlink() - -def testAddAttr(): - dom = Document() - child = dom.appendChild(dom.createElement("abc")) - - child.setAttribute("def", "ghi") - confirm(child.getAttribute("def") == "ghi") - confirm(child.attributes["def"].value == "ghi") - - child.setAttribute("jkl", "mno") - confirm(child.getAttribute("jkl") == "mno") - confirm(child.attributes["jkl"].value == "mno") - - confirm(len(child.attributes) == 2) - - child.setAttribute("def", "newval") - confirm(child.getAttribute("def") == "newval") - confirm(child.attributes["def"].value == "newval") - - confirm(len(child.attributes) == 2) - dom.unlink() - -def testDeleteAttr(): - dom = Document() - child = dom.appendChild(dom.createElement("abc")) - - confirm(len(child.attributes) == 0) - child.setAttribute("def", "ghi") - confirm(len(child.attributes) == 1) - del child.attributes["def"] - confirm(len(child.attributes) == 0) - dom.unlink() - -def testRemoveAttr(): - dom = Document() - child = dom.appendChild(dom.createElement("abc")) - - child.setAttribute("def", "ghi") - confirm(len(child.attributes) == 1) - child.removeAttribute("def") - confirm(len(child.attributes) == 0) - - dom.unlink() - -def testRemoveAttrNS(): - dom = Document() - child = dom.appendChild( - dom.createElementNS("http://www.python.org", "python:abc")) - child.setAttributeNS("http://www.w3.org", "xmlns:python", - "http://www.python.org") - child.setAttributeNS("http://www.python.org", "python:abcattr", "foo") - confirm(len(child.attributes) == 2) - child.removeAttributeNS("http://www.python.org", "abcattr") - confirm(len(child.attributes) == 1) - - dom.unlink() - -def testRemoveAttributeNode(): - dom = Document() - child = dom.appendChild(dom.createElement("foo")) - child.setAttribute("spam", "jam") - confirm(len(child.attributes) == 1) - node = child.getAttributeNode("spam") - child.removeAttributeNode(node) - confirm(len(child.attributes) == 0 - and child.getAttributeNode("spam") is None) - - dom.unlink() - -def testChangeAttr(): - dom = parseString("") - el = dom.documentElement - el.setAttribute("spam", "jam") - confirm(len(el.attributes) == 1) - el.setAttribute("spam", "bam") - # Set this attribute to be an ID and make sure that doesn't change - # when changing the value: - el.setIdAttribute("spam") - confirm(len(el.attributes) == 1 - and el.attributes["spam"].value == "bam" - and el.attributes["spam"].nodeValue == "bam" - and el.getAttribute("spam") == "bam" - and el.getAttributeNode("spam").isId) - el.attributes["spam"] = "ham" - confirm(len(el.attributes) == 1 - and el.attributes["spam"].value == "ham" - and el.attributes["spam"].nodeValue == "ham" - and el.getAttribute("spam") == "ham" - and el.attributes["spam"].isId) - el.setAttribute("spam2", "bam") - confirm(len(el.attributes) == 2 - and el.attributes["spam"].value == "ham" - and el.attributes["spam"].nodeValue == "ham" - and el.getAttribute("spam") == "ham" - and el.attributes["spam2"].value == "bam" - and el.attributes["spam2"].nodeValue == "bam" - and el.getAttribute("spam2") == "bam") - el.attributes["spam2"] = "bam2" - confirm(len(el.attributes) == 2 - and el.attributes["spam"].value == "ham" - and el.attributes["spam"].nodeValue == "ham" - and el.getAttribute("spam") == "ham" - and el.attributes["spam2"].value == "bam2" - and el.attributes["spam2"].nodeValue == "bam2" - and el.getAttribute("spam2") == "bam2") - dom.unlink() - -def testGetAttrList(): - pass - -def testGetAttrValues(): pass - -def testGetAttrLength(): pass - -def testGetAttribute(): pass - -def testGetAttributeNS(): pass - -def testGetAttributeNode(): pass - -def testGetElementsByTagNameNS(): - d=""" - - """ - dom = parseString(d) - elems = dom.getElementsByTagNameNS("http://pyxml.sf.net/minidom", "myelem") - confirm(len(elems) == 1 - and elems[0].namespaceURI == "http://pyxml.sf.net/minidom" - and elems[0].localName == "myelem" - and elems[0].prefix == "minidom" - and elems[0].tagName == "minidom:myelem" - and elems[0].nodeName == "minidom:myelem") - dom.unlink() - -def get_empty_nodelist_from_elements_by_tagName_ns_helper(doc, nsuri, lname): - nodelist = doc.getElementsByTagNameNS(nsuri, lname) - confirm(len(nodelist) == 0) - -def testGetEmptyNodeListFromElementsByTagNameNS(): - doc = parseString('') - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, 'http://xml.python.org/namespaces/a', 'localname') - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, '*', 'splat') - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, 'http://xml.python.org/namespaces/a', '*') - - doc = parseString('') - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, "http://xml.python.org/splat", "not-there") - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, "*", "not-there") - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, "http://somewhere.else.net/not-there", "e") - -def testElementReprAndStr(): - dom = Document() - el = dom.appendChild(dom.createElement("abc")) - string1 = repr(el) - string2 = str(el) - confirm(string1 == string2) - dom.unlink() - -# commented out until Fredrick's fix is checked in -def _testElementReprAndStrUnicode(): - dom = Document() - el = dom.appendChild(dom.createElement(u"abc")) - string1 = repr(el) - string2 = str(el) - confirm(string1 == string2) - dom.unlink() - -# commented out until Fredrick's fix is checked in -def _testElementReprAndStrUnicodeNS(): - dom = Document() - el = dom.appendChild( - dom.createElementNS(u"http://www.slashdot.org", u"slash:abc")) - string1 = repr(el) - string2 = str(el) - confirm(string1 == string2) - confirm(string1.find("slash:abc") != -1) - dom.unlink() - -def testAttributeRepr(): - dom = Document() - el = dom.appendChild(dom.createElement(u"abc")) - node = el.setAttribute("abc", "def") - confirm(str(node) == repr(node)) - dom.unlink() - -def testTextNodeRepr(): pass - -def testWriteXML(): - str = '' - dom = parseString(str) - domstr = dom.toxml() - dom.unlink() - confirm(str == domstr) - -def testAltNewline(): - str = '\n\n' - dom = parseString(str) - domstr = dom.toprettyxml(newl="\r\n") - dom.unlink() - confirm(domstr == str.replace("\n", "\r\n")) - -def testProcessingInstruction(): - dom = parseString('') - pi = dom.documentElement.firstChild - confirm(pi.target == "mypi" - and pi.data == "data \t\n " - and pi.nodeName == "mypi" - and pi.nodeType == Node.PROCESSING_INSTRUCTION_NODE - and pi.attributes is None - and not pi.hasChildNodes() - and len(pi.childNodes) == 0 - and pi.firstChild is None - and pi.lastChild is None - and pi.localName is None - and pi.namespaceURI == xml.dom.EMPTY_NAMESPACE) - -def testProcessingInstructionRepr(): pass - -def testTextRepr(): pass - -def testWriteText(): pass - -def testDocumentElement(): pass - -def testTooManyDocumentElements(): - doc = parseString("") - elem = doc.createElement("extra") - try: - doc.appendChild(elem) - except xml.dom.HierarchyRequestErr: - pass - else: - print "Failed to catch expected exception when" \ - " adding extra document element." - elem.unlink() - doc.unlink() - -def testCreateElementNS(): pass - -def testCreateAttributeNS(): pass - -def testParse(): pass - -def testParseString(): pass - -def testComment(): pass - -def testAttrListItem(): pass - -def testAttrListItems(): pass - -def testAttrListItemNS(): pass - -def testAttrListKeys(): pass - -def testAttrListKeysNS(): pass - -def testRemoveNamedItem(): - doc = parseString("") - e = doc.documentElement - attrs = e.attributes - a1 = e.getAttributeNode("a") - a2 = attrs.removeNamedItem("a") - confirm(a1.isSameNode(a2)) - try: - attrs.removeNamedItem("a") - except xml.dom.NotFoundErr: - pass - -def testRemoveNamedItemNS(): - doc = parseString("") - e = doc.documentElement - attrs = e.attributes - a1 = e.getAttributeNodeNS("http://xml.python.org/", "b") - a2 = attrs.removeNamedItemNS("http://xml.python.org/", "b") - confirm(a1.isSameNode(a2)) - try: - attrs.removeNamedItemNS("http://xml.python.org/", "b") - except xml.dom.NotFoundErr: - pass - -def testAttrListValues(): pass - -def testAttrListLength(): pass - -def testAttrList__getitem__(): pass - -def testAttrList__setitem__(): pass - -def testSetAttrValueandNodeValue(): pass - -def testParseElement(): pass - -def testParseAttributes(): pass - -def testParseElementNamespaces(): pass - -def testParseAttributeNamespaces(): pass - -def testParseProcessingInstructions(): pass - -def testChildNodes(): pass - -def testFirstChild(): pass - -def testHasChildNodes(): pass - -def testCloneElementShallow(): - dom, clone = _setupCloneElement(0) - confirm(len(clone.childNodes) == 0 - and clone.childNodes.length == 0 - and clone.parentNode is None - and clone.toxml() == '' - , "testCloneElementShallow") - dom.unlink() - -def testCloneElementDeep(): - dom, clone = _setupCloneElement(1) - confirm(len(clone.childNodes) == 1 - and clone.childNodes.length == 1 - and clone.parentNode is None - and clone.toxml() == '' - , "testCloneElementDeep") - dom.unlink() - -def _setupCloneElement(deep): - dom = parseString("") - root = dom.documentElement - clone = root.cloneNode(deep) - _testCloneElementCopiesAttributes( - root, clone, "testCloneElement" + (deep and "Deep" or "Shallow")) - # mutilate the original so shared data is detected - root.tagName = root.nodeName = "MODIFIED" - root.setAttribute("attr", "NEW VALUE") - root.setAttribute("added", "VALUE") - return dom, clone - -def _testCloneElementCopiesAttributes(e1, e2, test): - attrs1 = e1.attributes - attrs2 = e2.attributes - keys1 = attrs1.keys() - keys2 = attrs2.keys() - keys1.sort() - keys2.sort() - confirm(keys1 == keys2, "clone of element has same attribute keys") - for i in range(len(keys1)): - a1 = attrs1.item(i) - a2 = attrs2.item(i) - confirm(a1 is not a2 - and a1.value == a2.value - and a1.nodeValue == a2.nodeValue - and a1.namespaceURI == a2.namespaceURI - and a1.localName == a2.localName - , "clone of attribute node has proper attribute values") - confirm(a2.ownerElement is e2, - "clone of attribute node correctly owned") - -def testCloneDocumentShallow(): - doc = parseString("\n" - "" - "\n" - "]>\n" - "") - doc2 = doc.cloneNode(0) - confirm(doc2 is None, - "testCloneDocumentShallow:" - " shallow cloning of documents makes no sense!") - -def testCloneDocumentDeep(): - doc = parseString("\n" - "" - "\n" - "]>\n" - "") - doc2 = doc.cloneNode(1) - confirm(not (doc.isSameNode(doc2) or doc2.isSameNode(doc)), - "testCloneDocumentDeep: document objects not distinct") - confirm(len(doc.childNodes) == len(doc2.childNodes), - "testCloneDocumentDeep: wrong number of Document children") - confirm(doc2.documentElement.nodeType == Node.ELEMENT_NODE, - "testCloneDocumentDeep: documentElement not an ELEMENT_NODE") - confirm(doc2.documentElement.ownerDocument.isSameNode(doc2), - "testCloneDocumentDeep: documentElement owner is not new document") - confirm(not doc.documentElement.isSameNode(doc2.documentElement), - "testCloneDocumentDeep: documentElement should not be shared") - if doc.doctype is not None: - # check the doctype iff the original DOM maintained it - confirm(doc2.doctype.nodeType == Node.DOCUMENT_TYPE_NODE, - "testCloneDocumentDeep: doctype not a DOCUMENT_TYPE_NODE") - confirm(doc2.doctype.ownerDocument.isSameNode(doc2)) - confirm(not doc.doctype.isSameNode(doc2.doctype)) - -def testCloneDocumentTypeDeepOk(): - doctype = create_nonempty_doctype() - clone = doctype.cloneNode(1) - confirm(clone is not None - and clone.nodeName == doctype.nodeName - and clone.name == doctype.name - and clone.publicId == doctype.publicId - and clone.systemId == doctype.systemId - and len(clone.entities) == len(doctype.entities) - and clone.entities.item(len(clone.entities)) is None - and len(clone.notations) == len(doctype.notations) - and clone.notations.item(len(clone.notations)) is None - and len(clone.childNodes) == 0) - for i in range(len(doctype.entities)): - se = doctype.entities.item(i) - ce = clone.entities.item(i) - confirm((not se.isSameNode(ce)) - and (not ce.isSameNode(se)) - and ce.nodeName == se.nodeName - and ce.notationName == se.notationName - and ce.publicId == se.publicId - and ce.systemId == se.systemId - and ce.encoding == se.encoding - and ce.actualEncoding == se.actualEncoding - and ce.version == se.version) - for i in range(len(doctype.notations)): - sn = doctype.notations.item(i) - cn = clone.notations.item(i) - confirm((not sn.isSameNode(cn)) - and (not cn.isSameNode(sn)) - and cn.nodeName == sn.nodeName - and cn.publicId == sn.publicId - and cn.systemId == sn.systemId) - -def testCloneDocumentTypeDeepNotOk(): - doc = create_doc_with_doctype() - clone = doc.doctype.cloneNode(1) - confirm(clone is None, "testCloneDocumentTypeDeepNotOk") - -def testCloneDocumentTypeShallowOk(): - doctype = create_nonempty_doctype() - clone = doctype.cloneNode(0) - confirm(clone is not None - and clone.nodeName == doctype.nodeName - and clone.name == doctype.name - and clone.publicId == doctype.publicId - and clone.systemId == doctype.systemId - and len(clone.entities) == 0 - and clone.entities.item(0) is None - and len(clone.notations) == 0 - and clone.notations.item(0) is None - and len(clone.childNodes) == 0) - -def testCloneDocumentTypeShallowNotOk(): - doc = create_doc_with_doctype() - clone = doc.doctype.cloneNode(0) - confirm(clone is None, "testCloneDocumentTypeShallowNotOk") - -def check_import_document(deep, testName): - doc1 = parseString("") - doc2 = parseString("") - try: - doc1.importNode(doc2, deep) - except xml.dom.NotSupportedErr: - pass - else: - raise Exception(testName + - ": expected NotSupportedErr when importing a document") - -def testImportDocumentShallow(): - check_import_document(0, "testImportDocumentShallow") - -def testImportDocumentDeep(): - check_import_document(1, "testImportDocumentDeep") - -# The tests of DocumentType importing use these helpers to construct -# the documents to work with, since not all DOM builders actually -# create the DocumentType nodes. - -def create_doc_without_doctype(doctype=None): - return getDOMImplementation().createDocument(None, "doc", doctype) - -def create_nonempty_doctype(): - doctype = getDOMImplementation().createDocumentType("doc", None, None) - doctype.entities._seq = [] - doctype.notations._seq = [] - notation = xml.dom.minidom.Notation("my-notation", None, - "http://xml.python.org/notations/my") - doctype.notations._seq.append(notation) - entity = xml.dom.minidom.Entity("my-entity", None, - "http://xml.python.org/entities/my", - "my-notation") - entity.version = "1.0" - entity.encoding = "utf-8" - entity.actualEncoding = "us-ascii" - doctype.entities._seq.append(entity) - return doctype - -def create_doc_with_doctype(): - doctype = create_nonempty_doctype() - doc = create_doc_without_doctype(doctype) - doctype.entities.item(0).ownerDocument = doc - doctype.notations.item(0).ownerDocument = doc - return doc - -def testImportDocumentTypeShallow(): - src = create_doc_with_doctype() - target = create_doc_without_doctype() - try: - imported = target.importNode(src.doctype, 0) - except xml.dom.NotSupportedErr: - pass - else: - raise Exception( - "testImportDocumentTypeShallow: expected NotSupportedErr") - -def testImportDocumentTypeDeep(): - src = create_doc_with_doctype() - target = create_doc_without_doctype() - try: - imported = target.importNode(src.doctype, 1) - except xml.dom.NotSupportedErr: - pass - else: - raise Exception( - "testImportDocumentTypeDeep: expected NotSupportedErr") - -# Testing attribute clones uses a helper, and should always be deep, -# even if the argument to cloneNode is false. -def check_clone_attribute(deep, testName): - doc = parseString("") - attr = doc.documentElement.getAttributeNode("attr") - assert attr is not None - clone = attr.cloneNode(deep) - confirm(not clone.isSameNode(attr)) - confirm(not attr.isSameNode(clone)) - confirm(clone.ownerElement is None, - testName + ": ownerElement should be None") - confirm(clone.ownerDocument.isSameNode(attr.ownerDocument), - testName + ": ownerDocument does not match") - confirm(clone.specified, - testName + ": cloned attribute must have specified == True") - -def testCloneAttributeShallow(): - check_clone_attribute(0, "testCloneAttributeShallow") - -def testCloneAttributeDeep(): - check_clone_attribute(1, "testCloneAttributeDeep") - -def check_clone_pi(deep, testName): - doc = parseString("") - pi = doc.firstChild - assert pi.nodeType == Node.PROCESSING_INSTRUCTION_NODE - clone = pi.cloneNode(deep) - confirm(clone.target == pi.target - and clone.data == pi.data) - -def testClonePIShallow(): - check_clone_pi(0, "testClonePIShallow") - -def testClonePIDeep(): - check_clone_pi(1, "testClonePIDeep") - -def testNormalize(): - doc = parseString("") - root = doc.documentElement - root.appendChild(doc.createTextNode("first")) - root.appendChild(doc.createTextNode("second")) - confirm(len(root.childNodes) == 2 - and root.childNodes.length == 2, "testNormalize -- preparation") - doc.normalize() - confirm(len(root.childNodes) == 1 - and root.childNodes.length == 1 - and root.firstChild is root.lastChild - and root.firstChild.data == "firstsecond" - , "testNormalize -- result") - doc.unlink() - - doc = parseString("") - root = doc.documentElement - root.appendChild(doc.createTextNode("")) - doc.normalize() - confirm(len(root.childNodes) == 0 - and root.childNodes.length == 0, - "testNormalize -- single empty node removed") - doc.unlink() - -def testSiblings(): - doc = parseString("text?") - root = doc.documentElement - (pi, text, elm) = root.childNodes - - confirm(pi.nextSibling is text and - pi.previousSibling is None and - text.nextSibling is elm and - text.previousSibling is pi and - elm.nextSibling is None and - elm.previousSibling is text, "testSiblings") - - doc.unlink() - -def testParents(): - doc = parseString("") - root = doc.documentElement - elm1 = root.childNodes[0] - (elm2a, elm2b) = elm1.childNodes - elm3 = elm2b.childNodes[0] - - confirm(root.parentNode is doc and - elm1.parentNode is root and - elm2a.parentNode is elm1 and - elm2b.parentNode is elm1 and - elm3.parentNode is elm2b, "testParents") - - doc.unlink() - -def testNodeListItem(): - doc = parseString("") - children = doc.childNodes - docelem = children[0] - confirm(children[0] is children.item(0) - and children.item(1) is None - and docelem.childNodes.item(0) is docelem.childNodes[0] - and docelem.childNodes.item(1) is docelem.childNodes[1] - and docelem.childNodes.item(0).childNodes.item(0) is None, - "test NodeList.item()") - doc.unlink() - -def testSAX2DOM(): - from xml.dom import pulldom - - sax2dom = pulldom.SAX2DOM() - sax2dom.startDocument() - sax2dom.startElement("doc", {}) - sax2dom.characters("text") - sax2dom.startElement("subelm", {}) - sax2dom.characters("text") - sax2dom.endElement("subelm") - sax2dom.characters("text") - sax2dom.endElement("doc") - sax2dom.endDocument() - - doc = sax2dom.document - root = doc.documentElement - (text1, elm1, text2) = root.childNodes - text3 = elm1.childNodes[0] - - confirm(text1.previousSibling is None and - text1.nextSibling is elm1 and - elm1.previousSibling is text1 and - elm1.nextSibling is text2 and - text2.previousSibling is elm1 and - text2.nextSibling is None and - text3.previousSibling is None and - text3.nextSibling is None, "testSAX2DOM - siblings") - - confirm(root.parentNode is doc and - text1.parentNode is root and - elm1.parentNode is root and - text2.parentNode is root and - text3.parentNode is elm1, "testSAX2DOM - parents") - - doc.unlink() - -def testEncodings(): - doc = parseString('') - confirm(doc.toxml() == u'\u20ac' - and doc.toxml('utf-8') == '\xe2\x82\xac' - and doc.toxml('iso-8859-15') == '\xa4', - "testEncodings - encoding EURO SIGN") - - # Verify that character decoding errors throw exceptions instead of crashing - try: - doc = parseString('Comment \xe7a va ? Tr\xe8s bien ?') - except UnicodeDecodeError: - pass - else: - print 'parsing with bad encoding should raise a UnicodeDecodeError' - - doc.unlink() - -class UserDataHandler: - called = 0 - def handle(self, operation, key, data, src, dst): - dst.setUserData(key, data + 1, self) - src.setUserData(key, None, None) - self.called = 1 - -def testUserData(): - dom = Document() - n = dom.createElement('e') - confirm(n.getUserData("foo") is None) - n.setUserData("foo", None, None) - confirm(n.getUserData("foo") is None) - n.setUserData("foo", 12, 12) - n.setUserData("bar", 13, 13) - confirm(n.getUserData("foo") == 12) - confirm(n.getUserData("bar") == 13) - n.setUserData("foo", None, None) - confirm(n.getUserData("foo") is None) - confirm(n.getUserData("bar") == 13) - - handler = UserDataHandler() - n.setUserData("bar", 12, handler) - c = n.cloneNode(1) - confirm(handler.called - and n.getUserData("bar") is None - and c.getUserData("bar") == 13) - n.unlink() - c.unlink() - dom.unlink() - -def testRenameAttribute(): - doc = parseString("") - elem = doc.documentElement - attrmap = elem.attributes - attr = elem.attributes['a'] - - # Simple renaming - attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b") - confirm(attr.name == "b" - and attr.nodeName == "b" - and attr.localName is None - and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE - and attr.prefix is None - and attr.value == "v" - and elem.getAttributeNode("a") is None - and elem.getAttributeNode("b").isSameNode(attr) - and attrmap["b"].isSameNode(attr) - and attr.ownerDocument.isSameNode(doc) - and attr.ownerElement.isSameNode(elem)) - - # Rename to have a namespace, no prefix - attr = doc.renameNode(attr, "http://xml.python.org/ns", "c") - confirm(attr.name == "c" - and attr.nodeName == "c" - and attr.localName == "c" - and attr.namespaceURI == "http://xml.python.org/ns" - and attr.prefix is None - and attr.value == "v" - and elem.getAttributeNode("a") is None - and elem.getAttributeNode("b") is None - and elem.getAttributeNode("c").isSameNode(attr) - and elem.getAttributeNodeNS( - "http://xml.python.org/ns", "c").isSameNode(attr) - and attrmap["c"].isSameNode(attr) - and attrmap[("http://xml.python.org/ns", "c")].isSameNode(attr)) - - # Rename to have a namespace, with prefix - attr = doc.renameNode(attr, "http://xml.python.org/ns2", "p:d") - confirm(attr.name == "p:d" - and attr.nodeName == "p:d" - and attr.localName == "d" - and attr.namespaceURI == "http://xml.python.org/ns2" - and attr.prefix == "p" - and attr.value == "v" - and elem.getAttributeNode("a") is None - and elem.getAttributeNode("b") is None - and elem.getAttributeNode("c") is None - and elem.getAttributeNodeNS( - "http://xml.python.org/ns", "c") is None - and elem.getAttributeNode("p:d").isSameNode(attr) - and elem.getAttributeNodeNS( - "http://xml.python.org/ns2", "d").isSameNode(attr) - and attrmap["p:d"].isSameNode(attr) - and attrmap[("http://xml.python.org/ns2", "d")].isSameNode(attr)) - - # Rename back to a simple non-NS node - attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e") - confirm(attr.name == "e" - and attr.nodeName == "e" - and attr.localName is None - and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE - and attr.prefix is None - and attr.value == "v" - and elem.getAttributeNode("a") is None - and elem.getAttributeNode("b") is None - and elem.getAttributeNode("c") is None - and elem.getAttributeNode("p:d") is None - and elem.getAttributeNodeNS( - "http://xml.python.org/ns", "c") is None - and elem.getAttributeNode("e").isSameNode(attr) - and attrmap["e"].isSameNode(attr)) - - try: - doc.renameNode(attr, "http://xml.python.org/ns", "xmlns") - except xml.dom.NamespaceErr: - pass - else: - print "expected NamespaceErr" - - checkRenameNodeSharedConstraints(doc, attr) - doc.unlink() - -def testRenameElement(): - doc = parseString("") - elem = doc.documentElement - - # Simple renaming - elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a") - confirm(elem.tagName == "a" - and elem.nodeName == "a" - and elem.localName is None - and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE - and elem.prefix is None - and elem.ownerDocument.isSameNode(doc)) - - # Rename to have a namespace, no prefix - elem = doc.renameNode(elem, "http://xml.python.org/ns", "b") - confirm(elem.tagName == "b" - and elem.nodeName == "b" - and elem.localName == "b" - and elem.namespaceURI == "http://xml.python.org/ns" - and elem.prefix is None - and elem.ownerDocument.isSameNode(doc)) - - # Rename to have a namespace, with prefix - elem = doc.renameNode(elem, "http://xml.python.org/ns2", "p:c") - confirm(elem.tagName == "p:c" - and elem.nodeName == "p:c" - and elem.localName == "c" - and elem.namespaceURI == "http://xml.python.org/ns2" - and elem.prefix == "p" - and elem.ownerDocument.isSameNode(doc)) - - # Rename back to a simple non-NS node - elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d") - confirm(elem.tagName == "d" - and elem.nodeName == "d" - and elem.localName is None - and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE - and elem.prefix is None - and elem.ownerDocument.isSameNode(doc)) - - checkRenameNodeSharedConstraints(doc, elem) - doc.unlink() - -def checkRenameNodeSharedConstraints(doc, node): - # Make sure illegal NS usage is detected: - try: - doc.renameNode(node, "http://xml.python.org/ns", "xmlns:foo") - except xml.dom.NamespaceErr: - pass - else: - print "expected NamespaceErr" - - doc2 = parseString("") - try: - doc2.renameNode(node, xml.dom.EMPTY_NAMESPACE, "foo") - except xml.dom.WrongDocumentErr: - pass - else: - print "expected WrongDocumentErr" - -def testRenameOther(): - # We have to create a comment node explicitly since not all DOM - # builders used with minidom add comments to the DOM. - doc = xml.dom.minidom.getDOMImplementation().createDocument( - xml.dom.EMPTY_NAMESPACE, "e", None) - node = doc.createComment("comment") - try: - doc.renameNode(node, xml.dom.EMPTY_NAMESPACE, "foo") - except xml.dom.NotSupportedErr: - pass - else: - print "expected NotSupportedErr when renaming comment node" - doc.unlink() - -def checkWholeText(node, s): - t = node.wholeText - confirm(t == s, "looking for %s, found %s" % (repr(s), repr(t))) - -def testWholeText(): - doc = parseString("a") - elem = doc.documentElement - text = elem.childNodes[0] - assert text.nodeType == Node.TEXT_NODE - - checkWholeText(text, "a") - elem.appendChild(doc.createTextNode("b")) - checkWholeText(text, "ab") - elem.insertBefore(doc.createCDATASection("c"), text) - checkWholeText(text, "cab") - - # make sure we don't cross other nodes - splitter = doc.createComment("comment") - elem.appendChild(splitter) - text2 = doc.createTextNode("d") - elem.appendChild(text2) - checkWholeText(text, "cab") - checkWholeText(text2, "d") - - x = doc.createElement("x") - elem.replaceChild(x, splitter) - splitter = x - checkWholeText(text, "cab") - checkWholeText(text2, "d") - - x = doc.createProcessingInstruction("y", "z") - elem.replaceChild(x, splitter) - splitter = x - checkWholeText(text, "cab") - checkWholeText(text2, "d") - - elem.removeChild(splitter) - checkWholeText(text, "cabd") - checkWholeText(text2, "cabd") - -def testPatch1094164 (): - doc = parseString("") - elem = doc.documentElement - e = elem.firstChild - confirm(e.parentNode is elem, "Before replaceChild()") - # Check that replacing a child with itself leaves the tree unchanged - elem.replaceChild(e, e) - confirm(e.parentNode is elem, "After replaceChild()") - - - -def testReplaceWholeText(): - def setup(): - doc = parseString("ad") - elem = doc.documentElement - text1 = elem.firstChild - text2 = elem.lastChild - splitter = text1.nextSibling - elem.insertBefore(doc.createTextNode("b"), splitter) - elem.insertBefore(doc.createCDATASection("c"), text1) - return doc, elem, text1, splitter, text2 - - doc, elem, text1, splitter, text2 = setup() - text = text1.replaceWholeText("new content") - checkWholeText(text, "new content") - checkWholeText(text2, "d") - confirm(len(elem.childNodes) == 3) - - doc, elem, text1, splitter, text2 = setup() - text = text2.replaceWholeText("new content") - checkWholeText(text, "new content") - checkWholeText(text1, "cab") - confirm(len(elem.childNodes) == 5) - - doc, elem, text1, splitter, text2 = setup() - text = text1.replaceWholeText("") - checkWholeText(text2, "d") - confirm(text is None - and len(elem.childNodes) == 2) - -def testSchemaType(): - doc = parseString( - "\n" - " \n" - " \n" - "]>") - elem = doc.documentElement - # We don't want to rely on any specific loader at this point, so - # just make sure we can get to all the names, and that the - # DTD-based namespace is right. The names can vary by loader - # since each supports a different level of DTD information. - t = elem.schemaType - confirm(t.name is None - and t.namespace == xml.dom.EMPTY_NAMESPACE) - names = "id notid text enum ref refs ent ents nm nms".split() - for name in names: - a = elem.getAttributeNode(name) - t = a.schemaType - confirm(hasattr(t, "name") - and t.namespace == xml.dom.EMPTY_NAMESPACE) - -def testSetIdAttribute(): - doc = parseString("") - e = doc.documentElement - a1 = e.getAttributeNode("a1") - a2 = e.getAttributeNode("a2") - confirm(doc.getElementById("v") is None - and not a1.isId - and not a2.isId) - e.setIdAttribute("a1") - confirm(e.isSameNode(doc.getElementById("v")) - and a1.isId - and not a2.isId) - e.setIdAttribute("a2") - confirm(e.isSameNode(doc.getElementById("v")) - and e.isSameNode(doc.getElementById("w")) - and a1.isId - and a2.isId) - # replace the a1 node; the new node should *not* be an ID - a3 = doc.createAttribute("a1") - a3.value = "v" - e.setAttributeNode(a3) - confirm(doc.getElementById("v") is None - and e.isSameNode(doc.getElementById("w")) - and not a1.isId - and a2.isId - and not a3.isId) - # renaming an attribute should not affect its ID-ness: - doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") - confirm(e.isSameNode(doc.getElementById("w")) - and a2.isId) - -def testSetIdAttributeNS(): - NS1 = "http://xml.python.org/ns1" - NS2 = "http://xml.python.org/ns2" - doc = parseString("") - e = doc.documentElement - a1 = e.getAttributeNodeNS(NS1, "a1") - a2 = e.getAttributeNodeNS(NS2, "a2") - confirm(doc.getElementById("v") is None - and not a1.isId - and not a2.isId) - e.setIdAttributeNS(NS1, "a1") - confirm(e.isSameNode(doc.getElementById("v")) - and a1.isId - and not a2.isId) - e.setIdAttributeNS(NS2, "a2") - confirm(e.isSameNode(doc.getElementById("v")) - and e.isSameNode(doc.getElementById("w")) - and a1.isId - and a2.isId) - # replace the a1 node; the new node should *not* be an ID - a3 = doc.createAttributeNS(NS1, "a1") - a3.value = "v" - e.setAttributeNode(a3) - confirm(e.isSameNode(doc.getElementById("w"))) - confirm(not a1.isId) - confirm(a2.isId) - confirm(not a3.isId) - confirm(doc.getElementById("v") is None) - # renaming an attribute should not affect its ID-ness: - doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") - confirm(e.isSameNode(doc.getElementById("w")) - and a2.isId) - -def testSetIdAttributeNode(): - NS1 = "http://xml.python.org/ns1" - NS2 = "http://xml.python.org/ns2" - doc = parseString("") - e = doc.documentElement - a1 = e.getAttributeNodeNS(NS1, "a1") - a2 = e.getAttributeNodeNS(NS2, "a2") - confirm(doc.getElementById("v") is None - and not a1.isId - and not a2.isId) - e.setIdAttributeNode(a1) - confirm(e.isSameNode(doc.getElementById("v")) - and a1.isId - and not a2.isId) - e.setIdAttributeNode(a2) - confirm(e.isSameNode(doc.getElementById("v")) - and e.isSameNode(doc.getElementById("w")) - and a1.isId - and a2.isId) - # replace the a1 node; the new node should *not* be an ID - a3 = doc.createAttributeNS(NS1, "a1") - a3.value = "v" - e.setAttributeNode(a3) - confirm(e.isSameNode(doc.getElementById("w"))) - confirm(not a1.isId) - confirm(a2.isId) - confirm(not a3.isId) - confirm(doc.getElementById("v") is None) - # renaming an attribute should not affect its ID-ness: - doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") - confirm(e.isSameNode(doc.getElementById("w")) - and a2.isId) - -def testPickledDocument(): - doc = parseString("\n" - "\n" - " \n" - "]> text\n" - " ") - s = pickle.dumps(doc) - doc2 = pickle.loads(s) - stack = [(doc, doc2)] - while stack: - n1, n2 = stack.pop() - confirm(n1.nodeType == n2.nodeType - and len(n1.childNodes) == len(n2.childNodes) - and n1.nodeName == n2.nodeName - and not n1.isSameNode(n2) - and not n2.isSameNode(n1)) - if n1.nodeType == Node.DOCUMENT_TYPE_NODE: - len(n1.entities) - len(n2.entities) - len(n1.notations) - len(n2.notations) - confirm(len(n1.entities) == len(n2.entities) - and len(n1.notations) == len(n2.notations)) - for i in range(len(n1.notations)): - no1 = n1.notations.item(i) - no2 = n1.notations.item(i) - confirm(no1.name == no2.name - and no1.publicId == no2.publicId - and no1.systemId == no2.systemId) - statck.append((no1, no2)) - for i in range(len(n1.entities)): - e1 = n1.entities.item(i) - e2 = n2.entities.item(i) - confirm(e1.notationName == e2.notationName - and e1.publicId == e2.publicId - and e1.systemId == e2.systemId) - stack.append((e1, e2)) - if n1.nodeType != Node.DOCUMENT_NODE: - confirm(n1.ownerDocument.isSameNode(doc) - and n2.ownerDocument.isSameNode(doc2)) - for i in range(len(n1.childNodes)): - stack.append((n1.childNodes[i], n2.childNodes[i])) - - -# --- MAIN PROGRAM - -names = globals().keys() -names.sort() - -failed = [] - -try: - Node.allnodes -except AttributeError: - # We don't actually have the minidom from the standard library, - # but are picking up the PyXML version from site-packages. - def check_allnodes(): - pass -else: - def check_allnodes(): - confirm(len(Node.allnodes) == 0, - "assertion: len(Node.allnodes) == 0") - if len(Node.allnodes): - print "Garbage left over:" - if verbose: - print Node.allnodes.items()[0:10] - else: - # Don't print specific nodes if repeatable results - # are needed - print len(Node.allnodes) - Node.allnodes = {} - -for name in names: - if name.startswith("test"): - func = globals()[name] - try: - func() - check_allnodes() - except: - failed.append(name) - print "Test Failed: ", name - sys.stdout.flush() - traceback.print_exception(*sys.exc_info()) - print repr(sys.exc_info()[1]) - Node.allnodes = {} - -if failed: - print "\n\n\n**** Check for failures in these tests:" - for name in failed: - print " " + name diff --git a/sys/lib/python/test/test_mmap.py b/sys/lib/python/test/test_mmap.py deleted file mode 100644 index d2a24770c..000000000 --- a/sys/lib/python/test/test_mmap.py +++ /dev/null @@ -1,395 +0,0 @@ -from test.test_support import verify, vereq, TESTFN -import mmap -import os, re - -PAGESIZE = mmap.PAGESIZE - -def test_both(): - "Test mmap module on Unix systems and Windows" - - # Create a file to be mmap'ed. - if os.path.exists(TESTFN): - os.unlink(TESTFN) - f = open(TESTFN, 'w+') - - try: # unlink TESTFN no matter what - # Write 2 pages worth of data to the file - f.write('\0'* PAGESIZE) - f.write('foo') - f.write('\0'* (PAGESIZE-3) ) - f.flush() - m = mmap.mmap(f.fileno(), 2 * PAGESIZE) - f.close() - - # Simple sanity checks - - print type(m) # SF bug 128713: segfaulted on Linux - print ' Position of foo:', m.find('foo') / float(PAGESIZE), 'pages' - vereq(m.find('foo'), PAGESIZE) - - print ' Length of file:', len(m) / float(PAGESIZE), 'pages' - vereq(len(m), 2*PAGESIZE) - - print ' Contents of byte 0:', repr(m[0]) - vereq(m[0], '\0') - print ' Contents of first 3 bytes:', repr(m[0:3]) - vereq(m[0:3], '\0\0\0') - - # Modify the file's content - print "\n Modifying file's content..." - m[0] = '3' - m[PAGESIZE +3: PAGESIZE +3+3] = 'bar' - - # Check that the modification worked - print ' Contents of byte 0:', repr(m[0]) - vereq(m[0], '3') - print ' Contents of first 3 bytes:', repr(m[0:3]) - vereq(m[0:3], '3\0\0') - print ' Contents of second page:', repr(m[PAGESIZE-1 : PAGESIZE + 7]) - vereq(m[PAGESIZE-1 : PAGESIZE + 7], '\0foobar\0') - - m.flush() - - # Test doing a regular expression match in an mmap'ed file - match = re.search('[A-Za-z]+', m) - if match is None: - print ' ERROR: regex match on mmap failed!' - else: - start, end = match.span(0) - length = end - start - - print ' Regex match on mmap (page start, length of match):', - print start / float(PAGESIZE), length - - vereq(start, PAGESIZE) - vereq(end, PAGESIZE + 6) - - # test seeking around (try to overflow the seek implementation) - m.seek(0,0) - print ' Seek to zeroth byte' - vereq(m.tell(), 0) - m.seek(42,1) - print ' Seek to 42nd byte' - vereq(m.tell(), 42) - m.seek(0,2) - print ' Seek to last byte' - vereq(m.tell(), len(m)) - - print ' Try to seek to negative position...' - try: - m.seek(-1) - except ValueError: - pass - else: - verify(0, 'expected a ValueError but did not get it') - - print ' Try to seek beyond end of mmap...' - try: - m.seek(1,2) - except ValueError: - pass - else: - verify(0, 'expected a ValueError but did not get it') - - print ' Try to seek to negative position...' - try: - m.seek(-len(m)-1,2) - except ValueError: - pass - else: - verify(0, 'expected a ValueError but did not get it') - - # Try resizing map - print ' Attempting resize()' - try: - m.resize(512) - except SystemError: - # resize() not supported - # No messages are printed, since the output of this test suite - # would then be different across platforms. - pass - else: - # resize() is supported - verify(len(m) == 512, - "len(m) is %d, but expecting 512" % (len(m),) ) - # Check that we can no longer seek beyond the new size. - try: - m.seek(513,0) - except ValueError: - pass - else: - verify(0, 'Could seek beyond the new size') - - # Check that the underlying file is truncated too - # (bug #728515) - f = open(TESTFN) - f.seek(0, 2) - verify(f.tell() == 512, 'Underlying file not truncated') - f.close() - verify(m.size() == 512, 'New size not reflected in file') - - m.close() - - finally: - try: - f.close() - except OSError: - pass - try: - os.unlink(TESTFN) - except OSError: - pass - - # Test for "access" keyword parameter - try: - mapsize = 10 - print " Creating", mapsize, "byte test data file." - open(TESTFN, "wb").write("a"*mapsize) - print " Opening mmap with access=ACCESS_READ" - f = open(TESTFN, "rb") - m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_READ) - verify(m[:] == 'a'*mapsize, "Readonly memory map data incorrect.") - - print " Ensuring that readonly mmap can't be slice assigned." - try: - m[:] = 'b'*mapsize - except TypeError: - pass - else: - verify(0, "Able to write to readonly memory map") - - print " Ensuring that readonly mmap can't be item assigned." - try: - m[0] = 'b' - except TypeError: - pass - else: - verify(0, "Able to write to readonly memory map") - - print " Ensuring that readonly mmap can't be write() to." - try: - m.seek(0,0) - m.write('abc') - except TypeError: - pass - else: - verify(0, "Able to write to readonly memory map") - - print " Ensuring that readonly mmap can't be write_byte() to." - try: - m.seek(0,0) - m.write_byte('d') - except TypeError: - pass - else: - verify(0, "Able to write to readonly memory map") - - print " Ensuring that readonly mmap can't be resized." - try: - m.resize(2*mapsize) - except SystemError: # resize is not universally supported - pass - except TypeError: - pass - else: - verify(0, "Able to resize readonly memory map") - del m, f - verify(open(TESTFN, "rb").read() == 'a'*mapsize, - "Readonly memory map data file was modified") - - print " Opening mmap with size too big" - import sys - f = open(TESTFN, "r+b") - try: - m = mmap.mmap(f.fileno(), mapsize+1) - except ValueError: - # we do not expect a ValueError on Windows - # CAUTION: This also changes the size of the file on disk, and - # later tests assume that the length hasn't changed. We need to - # repair that. - if sys.platform.startswith('win'): - verify(0, "Opening mmap with size+1 should work on Windows.") - else: - # we expect a ValueError on Unix, but not on Windows - if not sys.platform.startswith('win'): - verify(0, "Opening mmap with size+1 should raise ValueError.") - m.close() - f.close() - if sys.platform.startswith('win'): - # Repair damage from the resizing test. - f = open(TESTFN, 'r+b') - f.truncate(mapsize) - f.close() - - print " Opening mmap with access=ACCESS_WRITE" - f = open(TESTFN, "r+b") - m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_WRITE) - print " Modifying write-through memory map." - m[:] = 'c'*mapsize - verify(m[:] == 'c'*mapsize, - "Write-through memory map memory not updated properly.") - m.flush() - m.close() - f.close() - f = open(TESTFN, 'rb') - stuff = f.read() - f.close() - verify(stuff == 'c'*mapsize, - "Write-through memory map data file not updated properly.") - - print " Opening mmap with access=ACCESS_COPY" - f = open(TESTFN, "r+b") - m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_COPY) - print " Modifying copy-on-write memory map." - m[:] = 'd'*mapsize - verify(m[:] == 'd' * mapsize, - "Copy-on-write memory map data not written correctly.") - m.flush() - verify(open(TESTFN, "rb").read() == 'c'*mapsize, - "Copy-on-write test data file should not be modified.") - try: - print " Ensuring copy-on-write maps cannot be resized." - m.resize(2*mapsize) - except TypeError: - pass - else: - verify(0, "Copy-on-write mmap resize did not raise exception.") - del m, f - try: - print " Ensuring invalid access parameter raises exception." - f = open(TESTFN, "r+b") - m = mmap.mmap(f.fileno(), mapsize, access=4) - except ValueError: - pass - else: - verify(0, "Invalid access code should have raised exception.") - - if os.name == "posix": - # Try incompatible flags, prot and access parameters. - f = open(TESTFN, "r+b") - try: - m = mmap.mmap(f.fileno(), mapsize, flags=mmap.MAP_PRIVATE, - prot=mmap.PROT_READ, access=mmap.ACCESS_WRITE) - except ValueError: - pass - else: - verify(0, "Incompatible parameters should raise ValueError.") - f.close() - finally: - try: - os.unlink(TESTFN) - except OSError: - pass - - print ' Try opening a bad file descriptor...' - try: - mmap.mmap(-2, 4096) - except mmap.error: - pass - else: - verify(0, 'expected a mmap.error but did not get it') - - # Do a tougher .find() test. SF bug 515943 pointed out that, in 2.2, - # searching for data with embedded \0 bytes didn't work. - f = open(TESTFN, 'w+') - - try: # unlink TESTFN no matter what - data = 'aabaac\x00deef\x00\x00aa\x00' - n = len(data) - f.write(data) - f.flush() - m = mmap.mmap(f.fileno(), n) - f.close() - - for start in range(n+1): - for finish in range(start, n+1): - slice = data[start : finish] - vereq(m.find(slice), data.find(slice)) - vereq(m.find(slice + 'x'), -1) - m.close() - - finally: - os.unlink(TESTFN) - - # make sure a double close doesn't crash on Solaris (Bug# 665913) - f = open(TESTFN, 'w+') - - try: # unlink TESTFN no matter what - f.write(2**16 * 'a') # Arbitrary character - f.close() - - f = open(TESTFN) - mf = mmap.mmap(f.fileno(), 2**16, access=mmap.ACCESS_READ) - mf.close() - mf.close() - f.close() - - finally: - os.unlink(TESTFN) - - # test mapping of entire file by passing 0 for map length - if hasattr(os, "stat"): - print " Ensuring that passing 0 as map length sets map size to current file size." - f = open(TESTFN, "w+") - - try: - f.write(2**16 * 'm') # Arbitrary character - f.close() - - f = open(TESTFN, "rb+") - mf = mmap.mmap(f.fileno(), 0) - verify(len(mf) == 2**16, "Map size should equal file size.") - vereq(mf.read(2**16), 2**16 * "m") - mf.close() - f.close() - - finally: - os.unlink(TESTFN) - - # test mapping of entire file by passing 0 for map length - if hasattr(os, "stat"): - print " Ensuring that passing 0 as map length sets map size to current file size." - f = open(TESTFN, "w+") - try: - f.write(2**16 * 'm') # Arbitrary character - f.close() - - f = open(TESTFN, "rb+") - mf = mmap.mmap(f.fileno(), 0) - verify(len(mf) == 2**16, "Map size should equal file size.") - vereq(mf.read(2**16), 2**16 * "m") - mf.close() - f.close() - - finally: - os.unlink(TESTFN) - - # make move works everywhere (64-bit format problem earlier) - f = open(TESTFN, 'w+') - - try: # unlink TESTFN no matter what - f.write("ABCDEabcde") # Arbitrary character - f.flush() - - mf = mmap.mmap(f.fileno(), 10) - mf.move(5, 0, 5) - verify(mf[:] == "ABCDEABCDE", "Map move should have duplicated front 5") - mf.close() - f.close() - - finally: - os.unlink(TESTFN) - -def test_anon(): - print " anonymous mmap.mmap(-1, PAGESIZE)..." - m = mmap.mmap(-1, PAGESIZE) - for x in xrange(PAGESIZE): - verify(m[x] == '\0', "anonymously mmap'ed contents should be zero") - - for x in xrange(PAGESIZE): - m[x] = ch = chr(x & 255) - vereq(m[x], ch) - -test_both() -test_anon() -print ' Test passed' diff --git a/sys/lib/python/test/test_module.py b/sys/lib/python/test/test_module.py deleted file mode 100644 index 2b35a531a..000000000 --- a/sys/lib/python/test/test_module.py +++ /dev/null @@ -1,48 +0,0 @@ -# Test the module type - -from test.test_support import verify, vereq, verbose, TestFailed - -import sys -module = type(sys) - -# An uninitialized module has no __dict__ or __name__, and __doc__ is None -foo = module.__new__(module) -verify(foo.__dict__ is None) -try: - s = foo.__name__ -except AttributeError: - pass -else: - raise TestFailed, "__name__ = %s" % repr(s) -vereq(foo.__doc__, module.__doc__) - -# Regularly initialized module, no docstring -foo = module("foo") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, None) -vereq(foo.__dict__, {"__name__": "foo", "__doc__": None}) - -# ASCII docstring -foo = module("foo", "foodoc") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, "foodoc") -vereq(foo.__dict__, {"__name__": "foo", "__doc__": "foodoc"}) - -# Unicode docstring -foo = module("foo", u"foodoc\u1234") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, u"foodoc\u1234") -vereq(foo.__dict__, {"__name__": "foo", "__doc__": u"foodoc\u1234"}) - -# Reinitialization should not replace the __dict__ -foo.bar = 42 -d = foo.__dict__ -foo.__init__("foo", "foodoc") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, "foodoc") -vereq(foo.bar, 42) -vereq(foo.__dict__, {"__name__": "foo", "__doc__": "foodoc", "bar": 42}) -verify(foo.__dict__ is d) - -if verbose: - print "All OK" diff --git a/sys/lib/python/test/test_multibytecodec.py b/sys/lib/python/test/test_multibytecodec.py deleted file mode 100644 index a8666d31c..000000000 --- a/sys/lib/python/test/test_multibytecodec.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/env python -# -# test_multibytecodec.py -# Unit test for multibytecodec itself -# - -from test import test_support -from test import test_multibytecodec_support -from test.test_support import TESTFN -import unittest, StringIO, codecs, sys, os - -ALL_CJKENCODINGS = [ -# _codecs_cn - 'gb2312', 'gbk', 'gb18030', 'hz', -# _codecs_hk - 'big5hkscs', -# _codecs_jp - 'cp932', 'shift_jis', 'euc_jp', 'euc_jisx0213', 'shift_jisx0213', - 'euc_jis_2004', 'shift_jis_2004', -# _codecs_kr - 'cp949', 'euc_kr', 'johab', -# _codecs_tw - 'big5', 'cp950', -# _codecs_iso2022 - 'iso2022_jp', 'iso2022_jp_1', 'iso2022_jp_2', 'iso2022_jp_2004', - 'iso2022_jp_3', 'iso2022_jp_ext', 'iso2022_kr', -] - -class Test_MultibyteCodec(unittest.TestCase): - - def test_nullcoding(self): - for enc in ALL_CJKENCODINGS: - self.assertEqual(''.decode(enc), u'') - self.assertEqual(unicode('', enc), u'') - self.assertEqual(u''.encode(enc), '') - - def test_str_decode(self): - for enc in ALL_CJKENCODINGS: - self.assertEqual('abcd'.encode(enc), 'abcd') - - def test_errorcallback_longindex(self): - dec = codecs.getdecoder('euc-kr') - myreplace = lambda exc: (u'', sys.maxint+1) - codecs.register_error('test.cjktest', myreplace) - self.assertRaises(IndexError, dec, - 'apple\x92ham\x93spam', 'test.cjktest') - - def test_codingspec(self): - try: - for enc in ALL_CJKENCODINGS: - print >> open(TESTFN, 'w'), '# coding:', enc - exec open(TESTFN) - finally: - os.unlink(TESTFN) - -class Test_IncrementalEncoder(unittest.TestCase): - - def test_stateless(self): - # cp949 encoder isn't stateful at all. - encoder = codecs.getincrementalencoder('cp949')() - self.assertEqual(encoder.encode(u'\ud30c\uc774\uc36c \ub9c8\uc744'), - '\xc6\xc4\xc0\xcc\xbd\xe3 \xb8\xb6\xc0\xbb') - self.assertEqual(encoder.reset(), None) - self.assertEqual(encoder.encode(u'\u2606\u223c\u2606', True), - '\xa1\xd9\xa1\xad\xa1\xd9') - self.assertEqual(encoder.reset(), None) - self.assertEqual(encoder.encode(u'', True), '') - self.assertEqual(encoder.encode(u'', False), '') - self.assertEqual(encoder.reset(), None) - - def test_stateful(self): - # jisx0213 encoder is stateful for a few codepoints. eg) - # U+00E6 => A9DC - # U+00E6 U+0300 => ABC4 - # U+0300 => ABDC - - encoder = codecs.getincrementalencoder('jisx0213')() - self.assertEqual(encoder.encode(u'\u00e6\u0300'), '\xab\xc4') - self.assertEqual(encoder.encode(u'\u00e6'), '') - self.assertEqual(encoder.encode(u'\u0300'), '\xab\xc4') - self.assertEqual(encoder.encode(u'\u00e6', True), '\xa9\xdc') - - self.assertEqual(encoder.reset(), None) - self.assertEqual(encoder.encode(u'\u0300'), '\xab\xdc') - - self.assertEqual(encoder.encode(u'\u00e6'), '') - self.assertEqual(encoder.encode('', True), '\xa9\xdc') - self.assertEqual(encoder.encode('', True), '') - - def test_stateful_keep_buffer(self): - encoder = codecs.getincrementalencoder('jisx0213')() - self.assertEqual(encoder.encode(u'\u00e6'), '') - self.assertRaises(UnicodeEncodeError, encoder.encode, u'\u0123') - self.assertEqual(encoder.encode(u'\u0300\u00e6'), '\xab\xc4') - self.assertRaises(UnicodeEncodeError, encoder.encode, u'\u0123') - self.assertEqual(encoder.reset(), None) - self.assertEqual(encoder.encode(u'\u0300'), '\xab\xdc') - self.assertEqual(encoder.encode(u'\u00e6'), '') - self.assertRaises(UnicodeEncodeError, encoder.encode, u'\u0123') - self.assertEqual(encoder.encode(u'', True), '\xa9\xdc') - - -class Test_IncrementalDecoder(unittest.TestCase): - - def test_dbcs(self): - # cp949 decoder is simple with only 1 or 2 bytes sequences. - decoder = codecs.getincrementaldecoder('cp949')() - self.assertEqual(decoder.decode('\xc6\xc4\xc0\xcc\xbd'), - u'\ud30c\uc774') - self.assertEqual(decoder.decode('\xe3 \xb8\xb6\xc0\xbb'), - u'\uc36c \ub9c8\uc744') - self.assertEqual(decoder.decode(''), u'') - - def test_dbcs_keep_buffer(self): - decoder = codecs.getincrementaldecoder('cp949')() - self.assertEqual(decoder.decode('\xc6\xc4\xc0'), u'\ud30c') - self.assertRaises(UnicodeDecodeError, decoder.decode, '', True) - self.assertEqual(decoder.decode('\xcc'), u'\uc774') - - self.assertEqual(decoder.decode('\xc6\xc4\xc0'), u'\ud30c') - self.assertRaises(UnicodeDecodeError, decoder.decode, '\xcc\xbd', True) - self.assertEqual(decoder.decode('\xcc'), u'\uc774') - - def test_iso2022(self): - decoder = codecs.getincrementaldecoder('iso2022-jp')() - ESC = '\x1b' - self.assertEqual(decoder.decode(ESC + '('), u'') - self.assertEqual(decoder.decode('B', True), u'') - self.assertEqual(decoder.decode(ESC + '$'), u'') - self.assertEqual(decoder.decode('B@$'), u'\u4e16') - self.assertEqual(decoder.decode('@$@'), u'\u4e16') - self.assertEqual(decoder.decode('$', True), u'\u4e16') - self.assertEqual(decoder.reset(), None) - self.assertEqual(decoder.decode('@$'), u'@$') - self.assertEqual(decoder.decode(ESC + '$'), u'') - self.assertRaises(UnicodeDecodeError, decoder.decode, '', True) - self.assertEqual(decoder.decode('B@$'), u'\u4e16') - - -class Test_StreamWriter(unittest.TestCase): - if len(u'\U00012345') == 2: # UCS2 - def test_gb18030(self): - s= StringIO.StringIO() - c = codecs.getwriter('gb18030')(s) - c.write(u'123') - self.assertEqual(s.getvalue(), '123') - c.write(u'\U00012345') - self.assertEqual(s.getvalue(), '123\x907\x959') - c.write(u'\U00012345'[0]) - self.assertEqual(s.getvalue(), '123\x907\x959') - c.write(u'\U00012345'[1] + u'\U00012345' + u'\uac00\u00ac') - self.assertEqual(s.getvalue(), - '123\x907\x959\x907\x959\x907\x959\x827\xcf5\x810\x851') - c.write(u'\U00012345'[0]) - self.assertEqual(s.getvalue(), - '123\x907\x959\x907\x959\x907\x959\x827\xcf5\x810\x851') - self.assertRaises(UnicodeError, c.reset) - self.assertEqual(s.getvalue(), - '123\x907\x959\x907\x959\x907\x959\x827\xcf5\x810\x851') - - def test_utf_8(self): - s= StringIO.StringIO() - c = codecs.getwriter('utf-8')(s) - c.write(u'123') - self.assertEqual(s.getvalue(), '123') - c.write(u'\U00012345') - self.assertEqual(s.getvalue(), '123\xf0\x92\x8d\x85') - - # Python utf-8 codec can't buffer surrogate pairs yet. - if 0: - c.write(u'\U00012345'[0]) - self.assertEqual(s.getvalue(), '123\xf0\x92\x8d\x85') - c.write(u'\U00012345'[1] + u'\U00012345' + u'\uac00\u00ac') - self.assertEqual(s.getvalue(), - '123\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85' - '\xea\xb0\x80\xc2\xac') - c.write(u'\U00012345'[0]) - self.assertEqual(s.getvalue(), - '123\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85' - '\xea\xb0\x80\xc2\xac') - c.reset() - self.assertEqual(s.getvalue(), - '123\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85' - '\xea\xb0\x80\xc2\xac\xed\xa0\x88') - c.write(u'\U00012345'[1]) - self.assertEqual(s.getvalue(), - '123\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85' - '\xea\xb0\x80\xc2\xac\xed\xa0\x88\xed\xbd\x85') - - else: # UCS4 - pass - - def test_streamwriter_strwrite(self): - s = StringIO.StringIO() - wr = codecs.getwriter('gb18030')(s) - wr.write('abcd') - self.assertEqual(s.getvalue(), 'abcd') - -class Test_ISO2022(unittest.TestCase): - def test_g2(self): - iso2022jp2 = '\x1b(B:hu4:unit\x1b.A\x1bNi de famille' - uni = u':hu4:unit\xe9 de famille' - self.assertEqual(iso2022jp2.decode('iso2022-jp-2'), uni) - - def test_iso2022_jp_g0(self): - self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2')) - for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'): - e = u'\u3406'.encode(encoding) - self.failIf(filter(lambda x: x >= '\x80', e)) - - def test_bug1572832(self): - if sys.maxunicode >= 0x10000: - myunichr = unichr - else: - myunichr = lambda x: unichr(0xD7C0+(x>>10)) + unichr(0xDC00+(x&0x3FF)) - - for x in xrange(0x10000, 0x110000): - # Any ISO 2022 codec will cause the segfault - myunichr(x).encode('iso_2022_jp', 'ignore') - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_MultibyteCodec)) - suite.addTest(unittest.makeSuite(Test_IncrementalEncoder)) - suite.addTest(unittest.makeSuite(Test_IncrementalDecoder)) - suite.addTest(unittest.makeSuite(Test_StreamWriter)) - suite.addTest(unittest.makeSuite(Test_ISO2022)) - test_support.run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_multibytecodec_support.py b/sys/lib/python/test/test_multibytecodec_support.py deleted file mode 100644 index bec32de1d..000000000 --- a/sys/lib/python/test/test_multibytecodec_support.py +++ /dev/null @@ -1,318 +0,0 @@ -#!/usr/bin/env python -# -# test_multibytecodec_support.py -# Common Unittest Routines for CJK codecs -# - -import sys, codecs, os.path -import unittest -from test import test_support -from StringIO import StringIO - -class TestBase: - encoding = '' # codec name - codec = None # codec tuple (with 4 elements) - tstring = '' # string to test StreamReader - - codectests = None # must set. codec test tuple - roundtriptest = 1 # set if roundtrip is possible with unicode - has_iso10646 = 0 # set if this encoding contains whole iso10646 map - xmlcharnametest = None # string to test xmlcharrefreplace - unmappedunicode = u'\udeee' # a unicode codepoint that is not mapped. - - def setUp(self): - if self.codec is None: - self.codec = codecs.lookup(self.encoding) - self.encode = self.codec.encode - self.decode = self.codec.decode - self.reader = self.codec.streamreader - self.writer = self.codec.streamwriter - self.incrementalencoder = self.codec.incrementalencoder - self.incrementaldecoder = self.codec.incrementaldecoder - - def test_chunkcoding(self): - for native, utf8 in zip(*[StringIO(f).readlines() - for f in self.tstring]): - u = self.decode(native)[0] - self.assertEqual(u, utf8.decode('utf-8')) - if self.roundtriptest: - self.assertEqual(native, self.encode(u)[0]) - - def test_errorhandle(self): - for source, scheme, expected in self.codectests: - if type(source) == type(''): - func = self.decode - else: - func = self.encode - if expected: - result = func(source, scheme)[0] - self.assertEqual(result, expected) - else: - self.assertRaises(UnicodeError, func, source, scheme) - - def test_xmlcharrefreplace(self): - if self.has_iso10646: - return - - s = u"\u0b13\u0b23\u0b60 nd eggs" - self.assertEqual( - self.encode(s, "xmlcharrefreplace")[0], - "ଓଣୠ nd eggs" - ) - - def test_customreplace_encode(self): - if self.has_iso10646: - return - - from htmlentitydefs import codepoint2name - - def xmlcharnamereplace(exc): - if not isinstance(exc, UnicodeEncodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [] - for c in exc.object[exc.start:exc.end]: - if ord(c) in codepoint2name: - l.append(u"&%s;" % codepoint2name[ord(c)]) - else: - l.append(u"&#%d;" % ord(c)) - return (u"".join(l), exc.end) - - codecs.register_error("test.xmlcharnamereplace", xmlcharnamereplace) - - if self.xmlcharnametest: - sin, sout = self.xmlcharnametest - else: - sin = u"\xab\u211c\xbb = \u2329\u1234\u232a" - sout = "«ℜ» = ⟨ሴ⟩" - self.assertEqual(self.encode(sin, - "test.xmlcharnamereplace")[0], sout) - - def test_callback_wrong_objects(self): - def myreplace(exc): - return (ret, exc.end) - codecs.register_error("test.cjktest", myreplace) - - for ret in ([1, 2, 3], [], None, object(), 'string', ''): - self.assertRaises(TypeError, self.encode, self.unmappedunicode, - 'test.cjktest') - - def test_callback_long_index(self): - def myreplace(exc): - return (u'x', long(exc.end)) - codecs.register_error("test.cjktest", myreplace) - self.assertEqual(self.encode(u'abcd' + self.unmappedunicode + u'efgh', - 'test.cjktest'), ('abcdxefgh', 9)) - - def myreplace(exc): - return (u'x', sys.maxint + 1) - codecs.register_error("test.cjktest", myreplace) - self.assertRaises(IndexError, self.encode, self.unmappedunicode, - 'test.cjktest') - - def test_callback_None_index(self): - def myreplace(exc): - return (u'x', None) - codecs.register_error("test.cjktest", myreplace) - self.assertRaises(TypeError, self.encode, self.unmappedunicode, - 'test.cjktest') - - def test_callback_backward_index(self): - def myreplace(exc): - if myreplace.limit > 0: - myreplace.limit -= 1 - return (u'REPLACED', 0) - else: - return (u'TERMINAL', exc.end) - myreplace.limit = 3 - codecs.register_error("test.cjktest", myreplace) - self.assertEqual(self.encode(u'abcd' + self.unmappedunicode + u'efgh', - 'test.cjktest'), - ('abcdREPLACEDabcdREPLACEDabcdREPLACEDabcdTERMINALefgh', 9)) - - def test_callback_forward_index(self): - def myreplace(exc): - return (u'REPLACED', exc.end + 2) - codecs.register_error("test.cjktest", myreplace) - self.assertEqual(self.encode(u'abcd' + self.unmappedunicode + u'efgh', - 'test.cjktest'), ('abcdREPLACEDgh', 9)) - - def test_callback_index_outofbound(self): - def myreplace(exc): - return (u'TERM', 100) - codecs.register_error("test.cjktest", myreplace) - self.assertRaises(IndexError, self.encode, self.unmappedunicode, - 'test.cjktest') - - def test_incrementalencoder(self): - UTF8Reader = codecs.getreader('utf-8') - for sizehint in [None] + range(1, 33) + \ - [64, 128, 256, 512, 1024]: - istream = UTF8Reader(StringIO(self.tstring[1])) - ostream = StringIO() - encoder = self.incrementalencoder() - while 1: - if sizehint is not None: - data = istream.read(sizehint) - else: - data = istream.read() - - if not data: - break - e = encoder.encode(data) - ostream.write(e) - - self.assertEqual(ostream.getvalue(), self.tstring[0]) - - def test_incrementaldecoder(self): - UTF8Writer = codecs.getwriter('utf-8') - for sizehint in [None, -1] + range(1, 33) + \ - [64, 128, 256, 512, 1024]: - istream = StringIO(self.tstring[0]) - ostream = UTF8Writer(StringIO()) - decoder = self.incrementaldecoder() - while 1: - data = istream.read(sizehint) - if not data: - break - else: - u = decoder.decode(data) - ostream.write(u) - - self.assertEqual(ostream.getvalue(), self.tstring[1]) - - def test_incrementalencoder_error_callback(self): - inv = self.unmappedunicode - - e = self.incrementalencoder() - self.assertRaises(UnicodeEncodeError, e.encode, inv, True) - - e.errors = 'ignore' - self.assertEqual(e.encode(inv, True), '') - - e.reset() - def tempreplace(exc): - return (u'called', exc.end) - codecs.register_error('test.incremental_error_callback', tempreplace) - e.errors = 'test.incremental_error_callback' - self.assertEqual(e.encode(inv, True), 'called') - - # again - e.errors = 'ignore' - self.assertEqual(e.encode(inv, True), '') - - def test_streamreader(self): - UTF8Writer = codecs.getwriter('utf-8') - for name in ["read", "readline", "readlines"]: - for sizehint in [None, -1] + range(1, 33) + \ - [64, 128, 256, 512, 1024]: - istream = self.reader(StringIO(self.tstring[0])) - ostream = UTF8Writer(StringIO()) - func = getattr(istream, name) - while 1: - data = func(sizehint) - if not data: - break - if name == "readlines": - ostream.writelines(data) - else: - ostream.write(data) - - self.assertEqual(ostream.getvalue(), self.tstring[1]) - - def test_streamwriter(self): - readfuncs = ('read', 'readline', 'readlines') - UTF8Reader = codecs.getreader('utf-8') - for name in readfuncs: - for sizehint in [None] + range(1, 33) + \ - [64, 128, 256, 512, 1024]: - istream = UTF8Reader(StringIO(self.tstring[1])) - ostream = self.writer(StringIO()) - func = getattr(istream, name) - while 1: - if sizehint is not None: - data = func(sizehint) - else: - data = func() - - if not data: - break - if name == "readlines": - ostream.writelines(data) - else: - ostream.write(data) - - self.assertEqual(ostream.getvalue(), self.tstring[0]) - -if len(u'\U00012345') == 2: # ucs2 build - _unichr = unichr - def unichr(v): - if v >= 0x10000: - return _unichr(0xd800 + ((v - 0x10000) >> 10)) + \ - _unichr(0xdc00 + ((v - 0x10000) & 0x3ff)) - else: - return _unichr(v) - _ord = ord - def ord(c): - if len(c) == 2: - return 0x10000 + ((_ord(c[0]) - 0xd800) << 10) + \ - (ord(c[1]) - 0xdc00) - else: - return _ord(c) - -class TestBase_Mapping(unittest.TestCase): - pass_enctest = [] - pass_dectest = [] - supmaps = [] - - def __init__(self, *args, **kw): - unittest.TestCase.__init__(self, *args, **kw) - self.open_mapping_file() # test it to report the error early - - def open_mapping_file(self): - return test_support.open_urlresource(self.mapfileurl) - - def test_mapping_file(self): - unichrs = lambda s: u''.join(map(unichr, map(eval, s.split('+')))) - urt_wa = {} - - for line in self.open_mapping_file(): - if not line: - break - data = line.split('#')[0].strip().split() - if len(data) != 2: - continue - - csetval = eval(data[0]) - if csetval <= 0x7F: - csetch = chr(csetval & 0xff) - elif csetval >= 0x1000000: - csetch = chr(csetval >> 24) + chr((csetval >> 16) & 0xff) + \ - chr((csetval >> 8) & 0xff) + chr(csetval & 0xff) - elif csetval >= 0x10000: - csetch = chr(csetval >> 16) + \ - chr((csetval >> 8) & 0xff) + chr(csetval & 0xff) - elif csetval >= 0x100: - csetch = chr(csetval >> 8) + chr(csetval & 0xff) - else: - continue - - unich = unichrs(data[1]) - if ord(unich) == 0xfffd or urt_wa.has_key(unich): - continue - urt_wa[unich] = csetch - - self._testpoint(csetch, unich) - - def test_mapping_supplemental(self): - for mapping in self.supmaps: - self._testpoint(*mapping) - - def _testpoint(self, csetch, unich): - if (csetch, unich) not in self.pass_enctest: - self.assertEqual(unich.encode(self.encoding), csetch) - if (csetch, unich) not in self.pass_dectest: - self.assertEqual(unicode(csetch, self.encoding), unich) - -def load_teststring(encoding): - from test import cjkencodings_test - return cjkencodings_test.teststring[encoding] diff --git a/sys/lib/python/test/test_multifile.py b/sys/lib/python/test/test_multifile.py deleted file mode 100644 index 437c394e1..000000000 --- a/sys/lib/python/test/test_multifile.py +++ /dev/null @@ -1,66 +0,0 @@ -import mimetools -import multifile -import cStringIO - -msg = """Mime-Version: 1.0 -Content-Type: multipart/mixed; - boundary="=====================_590453667==_" -X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7] - ---=====================_590453667==_ -Content-Type: multipart/alternative; - boundary="=====================_590453677==_.ALT" - ---=====================_590453677==_.ALT -Content-Type: text/plain; charset="us-ascii"; format=flowed - -test A ---=====================_590453677==_.ALT -Content-Type: text/html; charset="us-ascii" - - -test B - ---=====================_590453677==_.ALT-- - ---=====================_590453667==_ -Content-Type: text/plain; charset="us-ascii" -Content-Disposition: attachment; filename="att.txt" - -Attached Content. -Attached Content. -Attached Content. -Attached Content. - ---=====================_590453667==_-- - -""" - -def getMIMEMsg(mf): - global boundaries, linecount - msg = mimetools.Message(mf) - - #print "TYPE: %s" % msg.gettype() - if msg.getmaintype() == 'multipart': - boundary = msg.getparam("boundary") - boundaries += 1 - - mf.push(boundary) - while mf.next(): - getMIMEMsg(mf) - mf.pop() - else: - lines = mf.readlines() - linecount += len(lines) - -def test_main(): - global boundaries, linecount - boundaries = 0 - linecount = 0 - f = cStringIO.StringIO(msg) - getMIMEMsg(multifile.MultiFile(f)) - assert boundaries == 2 - assert linecount == 9 - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_mutants.py b/sys/lib/python/test/test_mutants.py deleted file mode 100644 index a219450b2..000000000 --- a/sys/lib/python/test/test_mutants.py +++ /dev/null @@ -1,292 +0,0 @@ -from test.test_support import verbose, TESTFN -import random -import os - -# From SF bug #422121: Insecurities in dict comparison. - -# Safety of code doing comparisons has been an historical Python weak spot. -# The problem is that comparison of structures written in C *naturally* -# wants to hold on to things like the size of the container, or "the -# biggest" containee so far, across a traversal of the container; but -# code to do containee comparisons can call back into Python and mutate -# the container in arbitrary ways while the C loop is in midstream. If the -# C code isn't extremely paranoid about digging things out of memory on -# each trip, and artificially boosting refcounts for the duration, anything -# from infinite loops to OS crashes can result (yes, I use Windows ). -# -# The other problem is that code designed to provoke a weakness is usually -# white-box code, and so catches only the particular vulnerabilities the -# author knew to protect against. For example, Python's list.sort() code -# went thru many iterations as one "new" vulnerability after another was -# discovered. -# -# So the dict comparison test here uses a black-box approach instead, -# generating dicts of various sizes at random, and performing random -# mutations on them at random times. This proved very effective, -# triggering at least six distinct failure modes the first 20 times I -# ran it. Indeed, at the start, the driver never got beyond 6 iterations -# before the test died. - -# The dicts are global to make it easy to mutate tham from within functions. -dict1 = {} -dict2 = {} - -# The current set of keys in dict1 and dict2. These are materialized as -# lists to make it easy to pick a dict key at random. -dict1keys = [] -dict2keys = [] - -# Global flag telling maybe_mutate() whether to *consider* mutating. -mutate = 0 - -# If global mutate is true, consider mutating a dict. May or may not -# mutate a dict even if mutate is true. If it does decide to mutate a -# dict, it picks one of {dict1, dict2} at random, and deletes a random -# entry from it; or, more rarely, adds a random element. - -def maybe_mutate(): - global mutate - if not mutate: - return - if random.random() < 0.5: - return - - if random.random() < 0.5: - target, keys = dict1, dict1keys - else: - target, keys = dict2, dict2keys - - if random.random() < 0.2: - # Insert a new key. - mutate = 0 # disable mutation until key inserted - while 1: - newkey = Horrid(random.randrange(100)) - if newkey not in target: - break - target[newkey] = Horrid(random.randrange(100)) - keys.append(newkey) - mutate = 1 - - elif keys: - # Delete a key at random. - mutate = 0 # disable mutation until key deleted - i = random.randrange(len(keys)) - key = keys[i] - del target[key] - del keys[i] - mutate = 1 - -# A horrid class that triggers random mutations of dict1 and dict2 when -# instances are compared. - -class Horrid: - def __init__(self, i): - # Comparison outcomes are determined by the value of i. - self.i = i - - # An artificial hashcode is selected at random so that we don't - # have any systematic relationship between comparison outcomes - # (based on self.i and other.i) and relative position within the - # hash vector (based on hashcode). - self.hashcode = random.randrange(1000000000) - - def __hash__(self): - return 42 - return self.hashcode - - def __cmp__(self, other): - maybe_mutate() # The point of the test. - return cmp(self.i, other.i) - - def __eq__(self, other): - maybe_mutate() # The point of the test. - return self.i == other.i - - def __repr__(self): - return "Horrid(%d)" % self.i - -# Fill dict d with numentries (Horrid(i), Horrid(j)) key-value pairs, -# where i and j are selected at random from the candidates list. -# Return d.keys() after filling. - -def fill_dict(d, candidates, numentries): - d.clear() - for i in xrange(numentries): - d[Horrid(random.choice(candidates))] = \ - Horrid(random.choice(candidates)) - return d.keys() - -# Test one pair of randomly generated dicts, each with n entries. -# Note that dict comparison is trivial if they don't have the same number -# of entires (then the "shorter" dict is instantly considered to be the -# smaller one, without even looking at the entries). - -def test_one(n): - global mutate, dict1, dict2, dict1keys, dict2keys - - # Fill the dicts without mutating them. - mutate = 0 - dict1keys = fill_dict(dict1, range(n), n) - dict2keys = fill_dict(dict2, range(n), n) - - # Enable mutation, then compare the dicts so long as they have the - # same size. - mutate = 1 - if verbose: - print "trying w/ lengths", len(dict1), len(dict2), - while dict1 and len(dict1) == len(dict2): - if verbose: - print ".", - if random.random() < 0.5: - c = cmp(dict1, dict2) - else: - c = dict1 == dict2 - if verbose: - print - -# Run test_one n times. At the start (before the bugs were fixed), 20 -# consecutive runs of this test each blew up on or before the sixth time -# test_one was run. So n doesn't have to be large to get an interesting -# test. -# OTOH, calling with large n is also interesting, to ensure that the fixed -# code doesn't hold on to refcounts *too* long (in which case memory would -# leak). - -def test(n): - for i in xrange(n): - test_one(random.randrange(1, 100)) - -# See last comment block for clues about good values for n. -test(100) - -########################################################################## -# Another segfault bug, distilled by Michael Hudson from a c.l.py post. - -class Child: - def __init__(self, parent): - self.__dict__['parent'] = parent - def __getattr__(self, attr): - self.parent.a = 1 - self.parent.b = 1 - self.parent.c = 1 - self.parent.d = 1 - self.parent.e = 1 - self.parent.f = 1 - self.parent.g = 1 - self.parent.h = 1 - self.parent.i = 1 - return getattr(self.parent, attr) - -class Parent: - def __init__(self): - self.a = Child(self) - -# Hard to say what this will print! May vary from time to time. But -# we're specifically trying to test the tp_print slot here, and this is -# the clearest way to do it. We print the result to a temp file so that -# the expected-output file doesn't need to change. - -f = open(TESTFN, "w") -print >> f, Parent().__dict__ -f.close() -os.unlink(TESTFN) - -########################################################################## -# And another core-dumper from Michael Hudson. - -dict = {} - -# Force dict to malloc its table. -for i in range(1, 10): - dict[i] = i - -f = open(TESTFN, "w") - -class Machiavelli: - def __repr__(self): - dict.clear() - - # Michael sez: "doesn't crash without this. don't know why." - # Tim sez: "luck of the draw; crashes with or without for me." - print >> f - - return `"machiavelli"` - - def __hash__(self): - return 0 - -dict[Machiavelli()] = Machiavelli() - -print >> f, str(dict) -f.close() -os.unlink(TESTFN) -del f, dict - - -########################################################################## -# And another core-dumper from Michael Hudson. - -dict = {} - -# let's force dict to malloc its table -for i in range(1, 10): - dict[i] = i - -class Machiavelli2: - def __eq__(self, other): - dict.clear() - return 1 - - def __hash__(self): - return 0 - -dict[Machiavelli2()] = Machiavelli2() - -try: - dict[Machiavelli2()] -except KeyError: - pass - -del dict - -########################################################################## -# And another core-dumper from Michael Hudson. - -dict = {} - -# let's force dict to malloc its table -for i in range(1, 10): - dict[i] = i - -class Machiavelli3: - def __init__(self, id): - self.id = id - - def __eq__(self, other): - if self.id == other.id: - dict.clear() - return 1 - else: - return 0 - - def __repr__(self): - return "%s(%s)"%(self.__class__.__name__, self.id) - - def __hash__(self): - return 0 - -dict[Machiavelli3(1)] = Machiavelli3(0) -dict[Machiavelli3(2)] = Machiavelli3(0) - -f = open(TESTFN, "w") -try: - try: - print >> f, dict[Machiavelli3(2)] - except KeyError: - pass -finally: - f.close() - os.unlink(TESTFN) - -del dict -del dict1, dict2, dict1keys, dict2keys diff --git a/sys/lib/python/test/test_netrc.py b/sys/lib/python/test/test_netrc.py deleted file mode 100644 index b536255ab..000000000 --- a/sys/lib/python/test/test_netrc.py +++ /dev/null @@ -1,48 +0,0 @@ - -import netrc, os, unittest, sys -from test import test_support - -TEST_NETRC = """ -machine foo login log1 password pass1 account acct1 - -macdef macro1 -line1 -line2 - -macdef macro2 -line3 -line4 - -default login log2 password pass2 - -""" - -temp_filename = test_support.TESTFN - -class NetrcTestCase(unittest.TestCase): - - def setUp (self): - mode = 'w' - if sys.platform not in ['cygwin']: - mode += 't' - fp = open(temp_filename, mode) - fp.write(TEST_NETRC) - fp.close() - self.netrc = netrc.netrc(temp_filename) - - def tearDown (self): - del self.netrc - os.unlink(temp_filename) - - def test_case_1(self): - self.assert_(self.netrc.macros == {'macro1':['line1\n', 'line2\n'], - 'macro2':['line3\n', 'line4\n']} - ) - self.assert_(self.netrc.hosts['foo'] == ('log1', 'acct1', 'pass1')) - self.assert_(self.netrc.hosts['default'] == ('log2', None, 'pass2')) - -def test_main(): - test_support.run_unittest(NetrcTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_new.py b/sys/lib/python/test/test_new.py deleted file mode 100644 index eb7a40792..000000000 --- a/sys/lib/python/test/test_new.py +++ /dev/null @@ -1,183 +0,0 @@ -from test.test_support import verbose, verify, TestFailed -import sys -import new - -class Eggs: - def get_yolks(self): - return self.yolks - -print 'new.module()' -m = new.module('Spam') -if verbose: - print m -m.Eggs = Eggs -sys.modules['Spam'] = m -import Spam - -def get_more_yolks(self): - return self.yolks + 3 - -print 'new.classobj()' -C = new.classobj('Spam', (Spam.Eggs,), {'get_more_yolks': get_more_yolks}) -if verbose: - print C -print 'new.instance()' -c = new.instance(C, {'yolks': 3}) -if verbose: - print c -o = new.instance(C) -verify(o.__dict__ == {}, - "new __dict__ should be empty") -del o -o = new.instance(C, None) -verify(o.__dict__ == {}, - "new __dict__ should be empty") -del o - -def break_yolks(self): - self.yolks = self.yolks - 2 -print 'new.instancemethod()' -im = new.instancemethod(break_yolks, c, C) -if verbose: - print im - -verify(c.get_yolks() == 3 and c.get_more_yolks() == 6, - 'Broken call of hand-crafted class instance') -im() -verify(c.get_yolks() == 1 and c.get_more_yolks() == 4, - 'Broken call of hand-crafted instance method') - -im = new.instancemethod(break_yolks, c) -im() -verify(c.get_yolks() == -1) -try: - new.instancemethod(break_yolks, None) -except TypeError: - pass -else: - raise TestFailed, "dangerous instance method creation allowed" - -# Verify that instancemethod() doesn't allow keyword args -try: - new.instancemethod(break_yolks, c, kw=1) -except TypeError: - pass -else: - raise TestFailed, "instancemethod shouldn't accept keyword args" - -# It's unclear what the semantics should be for a code object compiled at -# module scope, but bound and run in a function. In CPython, `c' is global -# (by accident?) while in Jython, `c' is local. The intent of the test -# clearly is to make `c' global, so let's be explicit about it. -codestr = ''' -global c -a = 1 -b = 2 -c = a + b -''' - -ccode = compile(codestr, '', 'exec') -# Jython doesn't have a __builtins__, so use a portable alternative -import __builtin__ -g = {'c': 0, '__builtins__': __builtin__} -# this test could be more robust -print 'new.function()' -func = new.function(ccode, g) -if verbose: - print func -func() -verify(g['c'] == 3, - 'Could not create a proper function object') - -# test the various extended flavors of function.new -def f(x): - def g(y): - return x + y - return g -g = f(4) -new.function(f.func_code, {}, "blah") -g2 = new.function(g.func_code, {}, "blah", (2,), g.func_closure) -verify(g2() == 6) -g3 = new.function(g.func_code, {}, "blah", None, g.func_closure) -verify(g3(5) == 9) -def test_closure(func, closure, exc): - try: - new.function(func.func_code, {}, "", None, closure) - except exc: - pass - else: - print "corrupt closure accepted" - -test_closure(g, None, TypeError) # invalid closure -test_closure(g, (1,), TypeError) # non-cell in closure -test_closure(g, (1, 1), ValueError) # closure is wrong size -test_closure(f, g.func_closure, ValueError) # no closure needed - -print 'new.code()' -# bogus test of new.code() -# Note: Jython will never have new.code() -if hasattr(new, 'code'): - def f(a): pass - - c = f.func_code - argcount = c.co_argcount - nlocals = c.co_nlocals - stacksize = c.co_stacksize - flags = c.co_flags - codestring = c.co_code - constants = c.co_consts - names = c.co_names - varnames = c.co_varnames - filename = c.co_filename - name = c.co_name - firstlineno = c.co_firstlineno - lnotab = c.co_lnotab - freevars = c.co_freevars - cellvars = c.co_cellvars - - d = new.code(argcount, nlocals, stacksize, flags, codestring, - constants, names, varnames, filename, name, - firstlineno, lnotab, freevars, cellvars) - - # test backwards-compatibility version with no freevars or cellvars - d = new.code(argcount, nlocals, stacksize, flags, codestring, - constants, names, varnames, filename, name, - firstlineno, lnotab) - - try: # this used to trigger a SystemError - d = new.code(-argcount, nlocals, stacksize, flags, codestring, - constants, names, varnames, filename, name, - firstlineno, lnotab) - except ValueError: - pass - else: - raise TestFailed, "negative co_argcount didn't trigger an exception" - - try: # this used to trigger a SystemError - d = new.code(argcount, -nlocals, stacksize, flags, codestring, - constants, names, varnames, filename, name, - firstlineno, lnotab) - except ValueError: - pass - else: - raise TestFailed, "negative co_nlocals didn't trigger an exception" - - try: # this used to trigger a Py_FatalError! - d = new.code(argcount, nlocals, stacksize, flags, codestring, - constants, (5,), varnames, filename, name, - firstlineno, lnotab) - except TypeError: - pass - else: - raise TestFailed, "non-string co_name didn't trigger an exception" - - # new.code used to be a way to mutate a tuple... - class S(str): pass - t = (S("ab"),) - d = new.code(argcount, nlocals, stacksize, flags, codestring, - constants, t, varnames, filename, name, - firstlineno, lnotab) - verify(type(t[0]) is S, "eek, tuple changed under us!") - - if verbose: - print d diff --git a/sys/lib/python/test/test_nis.py b/sys/lib/python/test/test_nis.py deleted file mode 100644 index 74ceeea91..000000000 --- a/sys/lib/python/test/test_nis.py +++ /dev/null @@ -1,39 +0,0 @@ -from test.test_support import verbose, TestFailed, TestSkipped -import nis - -print 'nis.maps()' -try: - maps = nis.maps() -except nis.error, msg: - # NIS is probably not active, so this test isn't useful - if verbose: - raise TestFailed, msg - # only do this if running under the regression suite - raise TestSkipped, msg - -try: - # On some systems, this map is only accessible to the - # super user - maps.remove("passwd.adjunct.byname") -except ValueError: - pass - -done = 0 -for nismap in maps: - if verbose: - print nismap - mapping = nis.cat(nismap) - for k, v in mapping.items(): - if verbose: - print ' ', k, v - if not k: - continue - if nis.match(k, nismap) != v: - print "NIS match failed for key `%s' in map `%s'" % (k, nismap) - else: - # just test the one key, otherwise this test could take a - # very long time - done = 1 - break - if done: - break diff --git a/sys/lib/python/test/test_normalization.py b/sys/lib/python/test/test_normalization.py deleted file mode 100644 index 81bdfbd96..000000000 --- a/sys/lib/python/test/test_normalization.py +++ /dev/null @@ -1,88 +0,0 @@ -from test.test_support import (verbose, TestFailed, TestSkipped, verify, - open_urlresource) -import sys -import os -from unicodedata import normalize - -TESTDATAFILE = "NormalizationTest" + os.extsep + "txt" -TESTDATAURL = "http://www.unicode.org/Public/4.1.0/ucd/" + TESTDATAFILE - -class RangeError(Exception): - pass - -def NFC(str): - return normalize("NFC", str) - -def NFKC(str): - return normalize("NFKC", str) - -def NFD(str): - return normalize("NFD", str) - -def NFKD(str): - return normalize("NFKD", str) - -def unistr(data): - data = [int(x, 16) for x in data.split(" ")] - for x in data: - if x > sys.maxunicode: - raise RangeError - return u"".join([unichr(x) for x in data]) - -def test_main(): - part1_data = {} - for line in open_urlresource(TESTDATAURL): - if '#' in line: - line = line.split('#')[0] - line = line.strip() - if not line: - continue - if line.startswith("@Part"): - part = line.split()[0] - continue - if part == "@Part3": - # XXX we don't support PRI #29 yet, so skip these tests for now - continue - try: - c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]] - except RangeError: - # Skip unsupported characters; - # try atleast adding c1 if we are in part1 - if part == "@Part1": - try: - c1=unistr(line.split(';')[0]) - except RangeError: - pass - else: - part1_data[c1] = 1 - continue - - if verbose: - print line - - # Perform tests - verify(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) - verify(c4 == NFC(c4) == NFC(c5), line) - verify(c3 == NFD(c1) == NFD(c2) == NFD(c3), line) - verify(c5 == NFD(c4) == NFD(c5), line) - verify(c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5), - line) - verify(c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5), - line) - - # Record part 1 data - if part == "@Part1": - part1_data[c1] = 1 - - # Perform tests for all other data - for c in range(sys.maxunicode+1): - X = unichr(c) - if X in part1_data: - continue - assert X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c - - # Check for bug 834676 - normalize('NFC',u'\ud55c\uae00') - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_ntpath.py b/sys/lib/python/test/test_ntpath.py deleted file mode 100644 index 139aa1f28..000000000 --- a/sys/lib/python/test/test_ntpath.py +++ /dev/null @@ -1,133 +0,0 @@ -import ntpath -from test.test_support import verbose, TestFailed -import os - -errors = 0 - -def tester(fn, wantResult): - global errors - fn = fn.replace("\\", "\\\\") - gotResult = eval(fn) - if wantResult != gotResult: - print "error!" - print "evaluated: " + str(fn) - print "should be: " + str(wantResult) - print " returned: " + str(gotResult) - print "" - errors = errors + 1 - -tester('ntpath.splitext("foo.ext")', ('foo', '.ext')) -tester('ntpath.splitext("/foo/foo.ext")', ('/foo/foo', '.ext')) -tester('ntpath.splitext(".ext")', ('', '.ext')) -tester('ntpath.splitext("\\foo.ext\\foo")', ('\\foo.ext\\foo', '')) -tester('ntpath.splitext("foo.ext\\")', ('foo.ext\\', '')) -tester('ntpath.splitext("")', ('', '')) -tester('ntpath.splitext("foo.bar.ext")', ('foo.bar', '.ext')) -tester('ntpath.splitext("xx/foo.bar.ext")', ('xx/foo.bar', '.ext')) -tester('ntpath.splitext("xx\\foo.bar.ext")', ('xx\\foo.bar', '.ext')) - -tester('ntpath.splitdrive("c:\\foo\\bar")', - ('c:', '\\foo\\bar')) -tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', - ('\\\\conky\\mountpoint', '\\foo\\bar')) -tester('ntpath.splitdrive("c:/foo/bar")', - ('c:', '/foo/bar')) -tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', - ('//conky/mountpoint', '/foo/bar')) - -tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar')) -tester('ntpath.split("\\\\conky\\mountpoint\\foo\\bar")', - ('\\\\conky\\mountpoint\\foo', 'bar')) - -tester('ntpath.split("c:\\")', ('c:\\', '')) -tester('ntpath.split("\\\\conky\\mountpoint\\")', - ('\\\\conky\\mountpoint', '')) - -tester('ntpath.split("c:/")', ('c:/', '')) -tester('ntpath.split("//conky/mountpoint/")', ('//conky/mountpoint', '')) - -tester('ntpath.isabs("c:\\")', 1) -tester('ntpath.isabs("\\\\conky\\mountpoint\\")', 1) -tester('ntpath.isabs("\\foo")', 1) -tester('ntpath.isabs("\\foo\\bar")', 1) - -tester('ntpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])', - "/home/swen") -tester('ntpath.commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])', - "\\home\\swen\\") -tester('ntpath.commonprefix(["/home/swen/spam", "/home/swen/spam"])', - "/home/swen/spam") - -tester('ntpath.join("")', '') -tester('ntpath.join("", "", "")', '') -tester('ntpath.join("a")', 'a') -tester('ntpath.join("/a")', '/a') -tester('ntpath.join("\\a")', '\\a') -tester('ntpath.join("a:")', 'a:') -tester('ntpath.join("a:", "b")', 'a:b') -tester('ntpath.join("a:", "/b")', 'a:/b') -tester('ntpath.join("a:", "\\b")', 'a:\\b') -tester('ntpath.join("a", "/b")', '/b') -tester('ntpath.join("a", "\\b")', '\\b') -tester('ntpath.join("a", "b", "c")', 'a\\b\\c') -tester('ntpath.join("a\\", "b", "c")', 'a\\b\\c') -tester('ntpath.join("a", "b\\", "c")', 'a\\b\\c') -tester('ntpath.join("a", "b", "\\c")', '\\c') -tester('ntpath.join("d:\\", "\\pleep")', 'd:\\pleep') -tester('ntpath.join("d:\\", "a", "b")', 'd:\\a\\b') -tester("ntpath.join('c:', '/a')", 'c:/a') -tester("ntpath.join('c:/', '/a')", 'c:/a') -tester("ntpath.join('c:/a', '/b')", '/b') -tester("ntpath.join('c:', 'd:/')", 'd:/') -tester("ntpath.join('c:/', 'd:/')", 'd:/') -tester("ntpath.join('c:/', 'd:/a/b')", 'd:/a/b') - -tester("ntpath.join('')", '') -tester("ntpath.join('', '', '', '', '')", '') -tester("ntpath.join('a')", 'a') -tester("ntpath.join('', 'a')", 'a') -tester("ntpath.join('', '', '', '', 'a')", 'a') -tester("ntpath.join('a', '')", 'a\\') -tester("ntpath.join('a', '', '', '', '')", 'a\\') -tester("ntpath.join('a\\', '')", 'a\\') -tester("ntpath.join('a\\', '', '', '', '')", 'a\\') - -tester("ntpath.normpath('A//////././//.//B')", r'A\B') -tester("ntpath.normpath('A/./B')", r'A\B') -tester("ntpath.normpath('A/foo/../B')", r'A\B') -tester("ntpath.normpath('C:A//B')", r'C:A\B') -tester("ntpath.normpath('D:A/./B')", r'D:A\B') -tester("ntpath.normpath('e:A/foo/../B')", r'e:A\B') - -tester("ntpath.normpath('C:///A//B')", r'C:\A\B') -tester("ntpath.normpath('D:///A/./B')", r'D:\A\B') -tester("ntpath.normpath('e:///A/foo/../B')", r'e:\A\B') - -tester("ntpath.normpath('..')", r'..') -tester("ntpath.normpath('.')", r'.') -tester("ntpath.normpath('')", r'.') -tester("ntpath.normpath('/')", '\\') -tester("ntpath.normpath('c:/')", 'c:\\') -tester("ntpath.normpath('/../.././..')", '\\') -tester("ntpath.normpath('c:/../../..')", 'c:\\') -tester("ntpath.normpath('../.././..')", r'..\..\..') -tester("ntpath.normpath('K:../.././..')", r'K:..\..\..') -tester("ntpath.normpath('C:////a/b')", r'C:\a\b') -tester("ntpath.normpath('//machine/share//a/b')", r'\\machine\share\a\b') - -# ntpath.abspath() can only be used on a system with the "nt" module -# (reasonably), so we protect this test with "import nt". This allows -# the rest of the tests for the ntpath module to be run to completion -# on any platform, since most of the module is intended to be usable -# from any platform. -try: - import nt -except ImportError: - pass -else: - tester('ntpath.abspath("C:\\")', "C:\\") - -if errors: - raise TestFailed(str(errors) + " errors.") -elif verbose: - print "No errors. Thank your lucky stars." diff --git a/sys/lib/python/test/test_old_mailbox.py b/sys/lib/python/test/test_old_mailbox.py deleted file mode 100644 index c8f6bac64..000000000 --- a/sys/lib/python/test/test_old_mailbox.py +++ /dev/null @@ -1,153 +0,0 @@ -# This set of tests exercises the backward-compatibility class -# in mailbox.py (the ones without write support). - -import mailbox -import os -import time -import unittest -from test import test_support - -# cleanup earlier tests -try: - os.unlink(test_support.TESTFN) -except os.error: - pass - -FROM_ = "From some.body@dummy.domain Sat Jul 24 13:43:35 2004\n" -DUMMY_MESSAGE = """\ -From: some.body@dummy.domain -To: me@my.domain -Subject: Simple Test - -This is a dummy message. -""" - -class MaildirTestCase(unittest.TestCase): - - def setUp(self): - # create a new maildir mailbox to work with: - self._dir = test_support.TESTFN - os.mkdir(self._dir) - os.mkdir(os.path.join(self._dir, "cur")) - os.mkdir(os.path.join(self._dir, "tmp")) - os.mkdir(os.path.join(self._dir, "new")) - self._counter = 1 - self._msgfiles = [] - - def tearDown(self): - map(os.unlink, self._msgfiles) - os.rmdir(os.path.join(self._dir, "cur")) - os.rmdir(os.path.join(self._dir, "tmp")) - os.rmdir(os.path.join(self._dir, "new")) - os.rmdir(self._dir) - - def createMessage(self, dir, mbox=False): - t = int(time.time() % 1000000) - pid = self._counter - self._counter += 1 - filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain")) - tmpname = os.path.join(self._dir, "tmp", filename) - newname = os.path.join(self._dir, dir, filename) - fp = open(tmpname, "w") - self._msgfiles.append(tmpname) - if mbox: - fp.write(FROM_) - fp.write(DUMMY_MESSAGE) - fp.close() - if hasattr(os, "link"): - os.link(tmpname, newname) - else: - fp = open(newname, "w") - fp.write(DUMMY_MESSAGE) - fp.close() - self._msgfiles.append(newname) - return tmpname - - def test_empty_maildir(self): - """Test an empty maildir mailbox""" - # Test for regression on bug #117490: - self.mbox = mailbox.Maildir(test_support.TESTFN) - self.assert_(len(self.mbox) == 0) - self.assert_(self.mbox.next() is None) - self.assert_(self.mbox.next() is None) - - def test_nonempty_maildir_cur(self): - self.createMessage("cur") - self.mbox = mailbox.Maildir(test_support.TESTFN) - self.assert_(len(self.mbox) == 1) - self.assert_(self.mbox.next() is not None) - self.assert_(self.mbox.next() is None) - self.assert_(self.mbox.next() is None) - - def test_nonempty_maildir_new(self): - self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) - self.assert_(len(self.mbox) == 1) - self.assert_(self.mbox.next() is not None) - self.assert_(self.mbox.next() is None) - self.assert_(self.mbox.next() is None) - - def test_nonempty_maildir_both(self): - self.createMessage("cur") - self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) - self.assert_(len(self.mbox) == 2) - self.assert_(self.mbox.next() is not None) - self.assert_(self.mbox.next() is not None) - self.assert_(self.mbox.next() is None) - self.assert_(self.mbox.next() is None) - - def test_unix_mbox(self): - ### should be better! - import email.Parser - fname = self.createMessage("cur", True) - n = 0 - for msg in mailbox.PortableUnixMailbox(open(fname), - email.Parser.Parser().parse): - n += 1 - self.assertEqual(msg["subject"], "Simple Test") - self.assertEqual(len(str(msg)), len(FROM_)+len(DUMMY_MESSAGE)) - self.assertEqual(n, 1) - -class MboxTestCase(unittest.TestCase): - def setUp(self): - # create a new maildir mailbox to work with: - self._path = test_support.TESTFN - - def tearDown(self): - os.unlink(self._path) - - def test_from_regex (self): - # Testing new regex from bug #1633678 - f = open(self._path, 'w') - f.write("""From fred@example.com Mon May 31 13:24:50 2004 +0200 -Subject: message 1 - -body1 -From fred@example.com Mon May 31 13:24:50 2004 -0200 -Subject: message 2 - -body2 -From fred@example.com Mon May 31 13:24:50 2004 -Subject: message 3 - -body3 -From fred@example.com Mon May 31 13:24:50 2004 -Subject: message 4 - -body4 -""") - f.close() - box = mailbox.UnixMailbox(open(self._path, 'r')) - self.assert_(len(list(iter(box))) == 4) - - - # XXX We still need more tests! - - -def test_main(): - test_support.run_unittest(MaildirTestCase, MboxTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_opcodes.py b/sys/lib/python/test/test_opcodes.py deleted file mode 100644 index c1929637a..000000000 --- a/sys/lib/python/test/test_opcodes.py +++ /dev/null @@ -1,101 +0,0 @@ -# Python test set -- part 2, opcodes - -from test.test_support import TestFailed - - -print '2. Opcodes' -print 'XXX Not yet fully implemented' - -print '2.1 try inside for loop' -n = 0 -for i in range(10): - n = n+i - try: 1/0 - except NameError: pass - except ZeroDivisionError: pass - except TypeError: pass - try: pass - except: pass - try: pass - finally: pass - n = n+i -if n != 90: - raise TestFailed, 'try inside for' - - -print '2.2 raise class exceptions' - -class AClass: pass -class BClass(AClass): pass -class CClass: pass -class DClass(AClass): - def __init__(self, ignore): - pass - -try: raise AClass() -except: pass - -try: raise AClass() -except AClass: pass - -try: raise BClass() -except AClass: pass - -try: raise BClass() -except CClass: raise TestFailed -except: pass - -a = AClass() -b = BClass() - -try: raise AClass, b -except BClass, v: - if v != b: raise TestFailed, "v!=b" -else: raise TestFailed, "no exception" - -try: raise b -except AClass, v: - if v != b: raise TestFailed, "v!=b AClass" - -# not enough arguments -try: raise BClass, a -except TypeError: pass - -try: raise DClass, a -except DClass, v: - if not isinstance(v, DClass): - raise TestFailed, "v not DClass" - -print '2.3 comparing function objects' - -f = eval('lambda: None') -g = eval('lambda: None') -if f == g: raise TestFailed, "functions should not be same" - -f = eval('lambda a: a') -g = eval('lambda a: a') -if f == g: raise TestFailed, "functions should not be same" - -f = eval('lambda a=1: a') -g = eval('lambda a=1: a') -if f == g: raise TestFailed, "functions should not be same" - -f = eval('lambda: 0') -g = eval('lambda: 1') -if f == g: raise TestFailed - -f = eval('lambda: None') -g = eval('lambda a: None') -if f == g: raise TestFailed - -f = eval('lambda a: None') -g = eval('lambda b: None') -if f == g: raise TestFailed - -f = eval('lambda a: None') -g = eval('lambda a=None: None') -if f == g: raise TestFailed - -f = eval('lambda a=0: None') -g = eval('lambda a=1: None') -if f == g: raise TestFailed diff --git a/sys/lib/python/test/test_openpty.py b/sys/lib/python/test/test_openpty.py deleted file mode 100644 index a8b8550c3..000000000 --- a/sys/lib/python/test/test_openpty.py +++ /dev/null @@ -1,19 +0,0 @@ -# Test to see if openpty works. (But don't worry if it isn't available.) - -import os -from test.test_support import verbose, TestFailed, TestSkipped - -try: - if verbose: - print "Calling os.openpty()" - master, slave = os.openpty() - if verbose: - print "(master, slave) = (%d, %d)"%(master, slave) -except AttributeError: - raise TestSkipped, "No openpty() available." - -if not os.isatty(slave): - raise TestFailed, "Slave-end of pty is not a terminal." - -os.write(slave, 'Ping!') -print os.read(master, 1024) diff --git a/sys/lib/python/test/test_operations.py b/sys/lib/python/test/test_operations.py deleted file mode 100644 index fafc06221..000000000 --- a/sys/lib/python/test/test_operations.py +++ /dev/null @@ -1,78 +0,0 @@ -# Python test set -- part 3, built-in operations. - - -print '3. Operations' -print 'XXX Mostly not yet implemented' - - -print '3.1 Dictionary lookups fail if __cmp__() raises an exception' - -class BadDictKey: - - def __hash__(self): - return hash(self.__class__) - - def __cmp__(self, other): - if isinstance(other, self.__class__): - print "raising error" - raise RuntimeError, "gotcha" - return other - -d = {} -x1 = BadDictKey() -x2 = BadDictKey() -d[x1] = 1 -for stmt in ['d[x2] = 2', - 'z = d[x2]', - 'x2 in d', - 'd.has_key(x2)', - 'd.get(x2)', - 'd.setdefault(x2, 42)', - 'd.pop(x2)', - 'd.update({x2: 2})']: - try: - exec stmt - except RuntimeError: - print "%s: caught the RuntimeError outside" % (stmt,) - else: - print "%s: No exception passed through!" # old CPython behavior - - -# Dict resizing bug, found by Jack Jansen in 2.2 CVS development. -# This version got an assert failure in debug build, infinite loop in -# release build. Unfortunately, provoking this kind of stuff requires -# a mix of inserts and deletes hitting exactly the right hash codes in -# exactly the right order, and I can't think of a randomized approach -# that would be *likely* to hit a failing case in reasonable time. - -d = {} -for i in range(5): - d[i] = i -for i in range(5): - del d[i] -for i in range(5, 9): # i==8 was the problem - d[i] = i - - -# Another dict resizing bug (SF bug #1456209). -# This caused Segmentation faults or Illegal instructions. - -class X(object): - def __hash__(self): - return 5 - def __eq__(self, other): - if resizing: - d.clear() - return False -d = {} -resizing = False -d[X()] = 1 -d[X()] = 2 -d[X()] = 3 -d[X()] = 4 -d[X()] = 5 -# now trigger a resize -resizing = True -d[9] = 6 - -print 'resize bugs not triggered.' diff --git a/sys/lib/python/test/test_operator.py b/sys/lib/python/test/test_operator.py deleted file mode 100644 index 085f8c440..000000000 --- a/sys/lib/python/test/test_operator.py +++ /dev/null @@ -1,490 +0,0 @@ -import operator -import unittest - -from test import test_support - -class Seq1: - def __init__(self, lst): - self.lst = lst - def __len__(self): - return len(self.lst) - def __getitem__(self, i): - return self.lst[i] - def __add__(self, other): - return self.lst + other.lst - def __mul__(self, other): - return self.lst * other - def __rmul__(self, other): - return other * self.lst - -class Seq2(object): - def __init__(self, lst): - self.lst = lst - def __len__(self): - return len(self.lst) - def __getitem__(self, i): - return self.lst[i] - def __add__(self, other): - return self.lst + other.lst - def __mul__(self, other): - return self.lst * other - def __rmul__(self, other): - return other * self.lst - - -class OperatorTestCase(unittest.TestCase): - def test_lt(self): - self.failUnlessRaises(TypeError, operator.lt) - self.failUnlessRaises(TypeError, operator.lt, 1j, 2j) - self.failIf(operator.lt(1, 0)) - self.failIf(operator.lt(1, 0.0)) - self.failIf(operator.lt(1, 1)) - self.failIf(operator.lt(1, 1.0)) - self.failUnless(operator.lt(1, 2)) - self.failUnless(operator.lt(1, 2.0)) - - def test_le(self): - self.failUnlessRaises(TypeError, operator.le) - self.failUnlessRaises(TypeError, operator.le, 1j, 2j) - self.failIf(operator.le(1, 0)) - self.failIf(operator.le(1, 0.0)) - self.failUnless(operator.le(1, 1)) - self.failUnless(operator.le(1, 1.0)) - self.failUnless(operator.le(1, 2)) - self.failUnless(operator.le(1, 2.0)) - - def test_eq(self): - class C(object): - def __eq__(self, other): - raise SyntaxError - self.failUnlessRaises(TypeError, operator.eq) - self.failUnlessRaises(SyntaxError, operator.eq, C(), C()) - self.failIf(operator.eq(1, 0)) - self.failIf(operator.eq(1, 0.0)) - self.failUnless(operator.eq(1, 1)) - self.failUnless(operator.eq(1, 1.0)) - self.failIf(operator.eq(1, 2)) - self.failIf(operator.eq(1, 2.0)) - - def test_ne(self): - class C(object): - def __ne__(self, other): - raise SyntaxError - self.failUnlessRaises(TypeError, operator.ne) - self.failUnlessRaises(SyntaxError, operator.ne, C(), C()) - self.failUnless(operator.ne(1, 0)) - self.failUnless(operator.ne(1, 0.0)) - self.failIf(operator.ne(1, 1)) - self.failIf(operator.ne(1, 1.0)) - self.failUnless(operator.ne(1, 2)) - self.failUnless(operator.ne(1, 2.0)) - - def test_ge(self): - self.failUnlessRaises(TypeError, operator.ge) - self.failUnlessRaises(TypeError, operator.ge, 1j, 2j) - self.failUnless(operator.ge(1, 0)) - self.failUnless(operator.ge(1, 0.0)) - self.failUnless(operator.ge(1, 1)) - self.failUnless(operator.ge(1, 1.0)) - self.failIf(operator.ge(1, 2)) - self.failIf(operator.ge(1, 2.0)) - - def test_gt(self): - self.failUnlessRaises(TypeError, operator.gt) - self.failUnlessRaises(TypeError, operator.gt, 1j, 2j) - self.failUnless(operator.gt(1, 0)) - self.failUnless(operator.gt(1, 0.0)) - self.failIf(operator.gt(1, 1)) - self.failIf(operator.gt(1, 1.0)) - self.failIf(operator.gt(1, 2)) - self.failIf(operator.gt(1, 2.0)) - - def test_abs(self): - self.failUnlessRaises(TypeError, operator.abs) - self.failUnlessRaises(TypeError, operator.abs, None) - self.failUnless(operator.abs(-1) == 1) - self.failUnless(operator.abs(1) == 1) - - def test_add(self): - self.failUnlessRaises(TypeError, operator.add) - self.failUnlessRaises(TypeError, operator.add, None, None) - self.failUnless(operator.add(3, 4) == 7) - - def test_bitwise_and(self): - self.failUnlessRaises(TypeError, operator.and_) - self.failUnlessRaises(TypeError, operator.and_, None, None) - self.failUnless(operator.and_(0xf, 0xa) == 0xa) - - def test_concat(self): - self.failUnlessRaises(TypeError, operator.concat) - self.failUnlessRaises(TypeError, operator.concat, None, None) - self.failUnless(operator.concat('py', 'thon') == 'python') - self.failUnless(operator.concat([1, 2], [3, 4]) == [1, 2, 3, 4]) - self.failUnless(operator.concat(Seq1([5, 6]), Seq1([7])) == [5, 6, 7]) - self.failUnless(operator.concat(Seq2([5, 6]), Seq2([7])) == [5, 6, 7]) - self.failUnlessRaises(TypeError, operator.concat, 13, 29) - - def test_countOf(self): - self.failUnlessRaises(TypeError, operator.countOf) - self.failUnlessRaises(TypeError, operator.countOf, None, None) - self.failUnless(operator.countOf([1, 2, 1, 3, 1, 4], 3) == 1) - self.failUnless(operator.countOf([1, 2, 1, 3, 1, 4], 5) == 0) - - def test_delitem(self): - a = [4, 3, 2, 1] - self.failUnlessRaises(TypeError, operator.delitem, a) - self.failUnlessRaises(TypeError, operator.delitem, a, None) - self.failUnless(operator.delitem(a, 1) is None) - self.assert_(a == [4, 2, 1]) - - def test_delslice(self): - a = range(10) - self.failUnlessRaises(TypeError, operator.delslice, a) - self.failUnlessRaises(TypeError, operator.delslice, a, None, None) - self.failUnless(operator.delslice(a, 2, 8) is None) - self.assert_(a == [0, 1, 8, 9]) - operator.delslice(a, 0, test_support.MAX_Py_ssize_t) - self.assert_(a == []) - - def test_div(self): - self.failUnlessRaises(TypeError, operator.div, 5) - self.failUnlessRaises(TypeError, operator.div, None, None) - self.failUnless(operator.floordiv(5, 2) == 2) - - def test_floordiv(self): - self.failUnlessRaises(TypeError, operator.floordiv, 5) - self.failUnlessRaises(TypeError, operator.floordiv, None, None) - self.failUnless(operator.floordiv(5, 2) == 2) - - def test_truediv(self): - self.failUnlessRaises(TypeError, operator.truediv, 5) - self.failUnlessRaises(TypeError, operator.truediv, None, None) - self.failUnless(operator.truediv(5, 2) == 2.5) - - def test_getitem(self): - a = range(10) - self.failUnlessRaises(TypeError, operator.getitem) - self.failUnlessRaises(TypeError, operator.getitem, a, None) - self.failUnless(operator.getitem(a, 2) == 2) - - def test_getslice(self): - a = range(10) - self.failUnlessRaises(TypeError, operator.getslice) - self.failUnlessRaises(TypeError, operator.getslice, a, None, None) - self.failUnless(operator.getslice(a, 4, 6) == [4, 5]) - b = operator.getslice(a, 0, test_support.MAX_Py_ssize_t) - self.assert_(b == a) - - def test_indexOf(self): - self.failUnlessRaises(TypeError, operator.indexOf) - self.failUnlessRaises(TypeError, operator.indexOf, None, None) - self.failUnless(operator.indexOf([4, 3, 2, 1], 3) == 1) - self.assertRaises(ValueError, operator.indexOf, [4, 3, 2, 1], 0) - - def test_invert(self): - self.failUnlessRaises(TypeError, operator.invert) - self.failUnlessRaises(TypeError, operator.invert, None) - self.failUnless(operator.inv(4) == -5) - - def test_isCallable(self): - self.failUnlessRaises(TypeError, operator.isCallable) - class C: - pass - def check(self, o, v): - self.assert_(operator.isCallable(o) == callable(o) == v) - check(self, 4, 0) - check(self, operator.isCallable, 1) - check(self, C, 1) - check(self, C(), 0) - - def test_isMappingType(self): - self.failUnlessRaises(TypeError, operator.isMappingType) - self.failIf(operator.isMappingType(1)) - self.failIf(operator.isMappingType(operator.isMappingType)) - self.failUnless(operator.isMappingType(operator.__dict__)) - self.failUnless(operator.isMappingType({})) - - def test_isNumberType(self): - self.failUnlessRaises(TypeError, operator.isNumberType) - self.failUnless(operator.isNumberType(8)) - self.failUnless(operator.isNumberType(8j)) - self.failUnless(operator.isNumberType(8L)) - self.failUnless(operator.isNumberType(8.3)) - self.failIf(operator.isNumberType(dir())) - - def test_isSequenceType(self): - self.failUnlessRaises(TypeError, operator.isSequenceType) - self.failUnless(operator.isSequenceType(dir())) - self.failUnless(operator.isSequenceType(())) - self.failUnless(operator.isSequenceType(xrange(10))) - self.failUnless(operator.isSequenceType('yeahbuddy')) - self.failIf(operator.isSequenceType(3)) - class Dict(dict): pass - self.failIf(operator.isSequenceType(Dict())) - - def test_lshift(self): - self.failUnlessRaises(TypeError, operator.lshift) - self.failUnlessRaises(TypeError, operator.lshift, None, 42) - self.failUnless(operator.lshift(5, 1) == 10) - self.failUnless(operator.lshift(5, 0) == 5) - self.assertRaises(ValueError, operator.lshift, 2, -1) - - def test_mod(self): - self.failUnlessRaises(TypeError, operator.mod) - self.failUnlessRaises(TypeError, operator.mod, None, 42) - self.failUnless(operator.mod(5, 2) == 1) - - def test_mul(self): - self.failUnlessRaises(TypeError, operator.mul) - self.failUnlessRaises(TypeError, operator.mul, None, None) - self.failUnless(operator.mul(5, 2) == 10) - - def test_neg(self): - self.failUnlessRaises(TypeError, operator.neg) - self.failUnlessRaises(TypeError, operator.neg, None) - self.failUnless(operator.neg(5) == -5) - self.failUnless(operator.neg(-5) == 5) - self.failUnless(operator.neg(0) == 0) - self.failUnless(operator.neg(-0) == 0) - - def test_bitwise_or(self): - self.failUnlessRaises(TypeError, operator.or_) - self.failUnlessRaises(TypeError, operator.or_, None, None) - self.failUnless(operator.or_(0xa, 0x5) == 0xf) - - def test_pos(self): - self.failUnlessRaises(TypeError, operator.pos) - self.failUnlessRaises(TypeError, operator.pos, None) - self.failUnless(operator.pos(5) == 5) - self.failUnless(operator.pos(-5) == -5) - self.failUnless(operator.pos(0) == 0) - self.failUnless(operator.pos(-0) == 0) - - def test_pow(self): - self.failUnlessRaises(TypeError, operator.pow) - self.failUnlessRaises(TypeError, operator.pow, None, None) - self.failUnless(operator.pow(3,5) == 3**5) - self.failUnless(operator.__pow__(3,5) == 3**5) - self.assertRaises(TypeError, operator.pow, 1) - self.assertRaises(TypeError, operator.pow, 1, 2, 3) - - def test_repeat(self): - a = range(3) - self.failUnlessRaises(TypeError, operator.repeat) - self.failUnlessRaises(TypeError, operator.repeat, a, None) - self.failUnless(operator.repeat(a, 2) == a+a) - self.failUnless(operator.repeat(a, 1) == a) - self.failUnless(operator.repeat(a, 0) == []) - a = (1, 2, 3) - self.failUnless(operator.repeat(a, 2) == a+a) - self.failUnless(operator.repeat(a, 1) == a) - self.failUnless(operator.repeat(a, 0) == ()) - a = '123' - self.failUnless(operator.repeat(a, 2) == a+a) - self.failUnless(operator.repeat(a, 1) == a) - self.failUnless(operator.repeat(a, 0) == '') - a = Seq1([4, 5, 6]) - self.failUnless(operator.repeat(a, 2) == [4, 5, 6, 4, 5, 6]) - self.failUnless(operator.repeat(a, 1) == [4, 5, 6]) - self.failUnless(operator.repeat(a, 0) == []) - a = Seq2([4, 5, 6]) - self.failUnless(operator.repeat(a, 2) == [4, 5, 6, 4, 5, 6]) - self.failUnless(operator.repeat(a, 1) == [4, 5, 6]) - self.failUnless(operator.repeat(a, 0) == []) - self.failUnlessRaises(TypeError, operator.repeat, 6, 7) - - def test_rshift(self): - self.failUnlessRaises(TypeError, operator.rshift) - self.failUnlessRaises(TypeError, operator.rshift, None, 42) - self.failUnless(operator.rshift(5, 1) == 2) - self.failUnless(operator.rshift(5, 0) == 5) - self.assertRaises(ValueError, operator.rshift, 2, -1) - - def test_contains(self): - self.failUnlessRaises(TypeError, operator.contains) - self.failUnlessRaises(TypeError, operator.contains, None, None) - self.failUnless(operator.contains(range(4), 2)) - self.failIf(operator.contains(range(4), 5)) - self.failUnless(operator.sequenceIncludes(range(4), 2)) - self.failIf(operator.sequenceIncludes(range(4), 5)) - - def test_setitem(self): - a = range(3) - self.failUnlessRaises(TypeError, operator.setitem, a) - self.failUnlessRaises(TypeError, operator.setitem, a, None, None) - self.failUnless(operator.setitem(a, 0, 2) is None) - self.assert_(a == [2, 1, 2]) - self.assertRaises(IndexError, operator.setitem, a, 4, 2) - - def test_setslice(self): - a = range(4) - self.failUnlessRaises(TypeError, operator.setslice, a) - self.failUnlessRaises(TypeError, operator.setslice, a, None, None, None) - self.failUnless(operator.setslice(a, 1, 3, [2, 1]) is None) - self.assert_(a == [0, 2, 1, 3]) - operator.setslice(a, 0, test_support.MAX_Py_ssize_t, []) - self.assert_(a == []) - - def test_sub(self): - self.failUnlessRaises(TypeError, operator.sub) - self.failUnlessRaises(TypeError, operator.sub, None, None) - self.failUnless(operator.sub(5, 2) == 3) - - def test_truth(self): - class C(object): - def __nonzero__(self): - raise SyntaxError - self.failUnlessRaises(TypeError, operator.truth) - self.failUnlessRaises(SyntaxError, operator.truth, C()) - self.failUnless(operator.truth(5)) - self.failUnless(operator.truth([0])) - self.failIf(operator.truth(0)) - self.failIf(operator.truth([])) - - def test_bitwise_xor(self): - self.failUnlessRaises(TypeError, operator.xor) - self.failUnlessRaises(TypeError, operator.xor, None, None) - self.failUnless(operator.xor(0xb, 0xc) == 0x7) - - def test_is(self): - a = b = 'xyzpdq' - c = a[:3] + b[3:] - self.failUnlessRaises(TypeError, operator.is_) - self.failUnless(operator.is_(a, b)) - self.failIf(operator.is_(a,c)) - - def test_is_not(self): - a = b = 'xyzpdq' - c = a[:3] + b[3:] - self.failUnlessRaises(TypeError, operator.is_not) - self.failIf(operator.is_not(a, b)) - self.failUnless(operator.is_not(a,c)) - - def test_attrgetter(self): - class A: - pass - a = A() - a.name = 'arthur' - f = operator.attrgetter('name') - self.assertEqual(f(a), 'arthur') - f = operator.attrgetter('rank') - self.assertRaises(AttributeError, f, a) - f = operator.attrgetter(2) - self.assertRaises(TypeError, f, a) - self.assertRaises(TypeError, operator.attrgetter) - - # multiple gets - record = A() - record.x = 'X' - record.y = 'Y' - record.z = 'Z' - self.assertEqual(operator.attrgetter('x','z','y')(record), ('X', 'Z', 'Y')) - self.assertRaises(TypeError, operator.attrgetter('x', (), 'y'), record) - - class C(object): - def __getattr(self, name): - raise SyntaxError - self.failUnlessRaises(AttributeError, operator.attrgetter('foo'), C()) - - def test_itemgetter(self): - a = 'ABCDE' - f = operator.itemgetter(2) - self.assertEqual(f(a), 'C') - f = operator.itemgetter(10) - self.assertRaises(IndexError, f, a) - - class C(object): - def __getitem(self, name): - raise SyntaxError - self.failUnlessRaises(TypeError, operator.itemgetter(42), C()) - - f = operator.itemgetter('name') - self.assertRaises(TypeError, f, a) - self.assertRaises(TypeError, operator.itemgetter) - - d = dict(key='val') - f = operator.itemgetter('key') - self.assertEqual(f(d), 'val') - f = operator.itemgetter('nonkey') - self.assertRaises(KeyError, f, d) - - # example used in the docs - inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)] - getcount = operator.itemgetter(1) - self.assertEqual(map(getcount, inventory), [3, 2, 5, 1]) - self.assertEqual(sorted(inventory, key=getcount), - [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]) - - # multiple gets - data = map(str, range(20)) - self.assertEqual(operator.itemgetter(2,10,5)(data), ('2', '10', '5')) - self.assertRaises(TypeError, operator.itemgetter(2, 'x', 5), data) - - def test_inplace(self): - class C(object): - def __iadd__ (self, other): return "iadd" - def __iand__ (self, other): return "iand" - def __idiv__ (self, other): return "idiv" - def __ifloordiv__(self, other): return "ifloordiv" - def __ilshift__ (self, other): return "ilshift" - def __imod__ (self, other): return "imod" - def __imul__ (self, other): return "imul" - def __ior__ (self, other): return "ior" - def __ipow__ (self, other): return "ipow" - def __irshift__ (self, other): return "irshift" - def __isub__ (self, other): return "isub" - def __itruediv__ (self, other): return "itruediv" - def __ixor__ (self, other): return "ixor" - def __getitem__(self, other): return 5 # so that C is a sequence - c = C() - self.assertEqual(operator.iadd (c, 5), "iadd") - self.assertEqual(operator.iand (c, 5), "iand") - self.assertEqual(operator.idiv (c, 5), "idiv") - self.assertEqual(operator.ifloordiv(c, 5), "ifloordiv") - self.assertEqual(operator.ilshift (c, 5), "ilshift") - self.assertEqual(operator.imod (c, 5), "imod") - self.assertEqual(operator.imul (c, 5), "imul") - self.assertEqual(operator.ior (c, 5), "ior") - self.assertEqual(operator.ipow (c, 5), "ipow") - self.assertEqual(operator.irshift (c, 5), "irshift") - self.assertEqual(operator.isub (c, 5), "isub") - self.assertEqual(operator.itruediv (c, 5), "itruediv") - self.assertEqual(operator.ixor (c, 5), "ixor") - self.assertEqual(operator.iconcat (c, c), "iadd") - self.assertEqual(operator.irepeat (c, 5), "imul") - self.assertEqual(operator.__iadd__ (c, 5), "iadd") - self.assertEqual(operator.__iand__ (c, 5), "iand") - self.assertEqual(operator.__idiv__ (c, 5), "idiv") - self.assertEqual(operator.__ifloordiv__(c, 5), "ifloordiv") - self.assertEqual(operator.__ilshift__ (c, 5), "ilshift") - self.assertEqual(operator.__imod__ (c, 5), "imod") - self.assertEqual(operator.__imul__ (c, 5), "imul") - self.assertEqual(operator.__ior__ (c, 5), "ior") - self.assertEqual(operator.__ipow__ (c, 5), "ipow") - self.assertEqual(operator.__irshift__ (c, 5), "irshift") - self.assertEqual(operator.__isub__ (c, 5), "isub") - self.assertEqual(operator.__itruediv__ (c, 5), "itruediv") - self.assertEqual(operator.__ixor__ (c, 5), "ixor") - self.assertEqual(operator.__iconcat__ (c, c), "iadd") - self.assertEqual(operator.__irepeat__ (c, 5), "imul") - -def test_main(verbose=None): - import sys - test_classes = ( - OperatorTestCase, - ) - - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_optparse.py b/sys/lib/python/test/test_optparse.py deleted file mode 100644 index 86a3e61d3..000000000 --- a/sys/lib/python/test/test_optparse.py +++ /dev/null @@ -1,1640 +0,0 @@ -#!/usr/bin/python - -# -# Test suite for Optik. Supplied by Johannes Gijsbers -# (taradino@softhome.net) -- translated from the original Optik -# test suite to this PyUnit-based version. -# -# $Id: test_optparse.py 50791 2006-07-23 16:05:51Z greg.ward $ -# - -import sys -import os -import re -import copy -import types -import unittest - -from StringIO import StringIO -from pprint import pprint -from test import test_support - - -from optparse import make_option, Option, IndentedHelpFormatter, \ - TitledHelpFormatter, OptionParser, OptionContainer, OptionGroup, \ - SUPPRESS_HELP, SUPPRESS_USAGE, OptionError, OptionConflictError, \ - BadOptionError, OptionValueError, Values -from optparse import _match_abbrev -from optparse import _parse_num - -# Do the right thing with boolean values for all known Python versions. -try: - True, False -except NameError: - (True, False) = (1, 0) - -retype = type(re.compile('')) - -class InterceptedError(Exception): - def __init__(self, - error_message=None, - exit_status=None, - exit_message=None): - self.error_message = error_message - self.exit_status = exit_status - self.exit_message = exit_message - - def __str__(self): - return self.error_message or self.exit_message or "intercepted error" - -class InterceptingOptionParser(OptionParser): - def exit(self, status=0, msg=None): - raise InterceptedError(exit_status=status, exit_message=msg) - - def error(self, msg): - raise InterceptedError(error_message=msg) - - -class BaseTest(unittest.TestCase): - def assertParseOK(self, args, expected_opts, expected_positional_args): - """Assert the options are what we expected when parsing arguments. - - Otherwise, fail with a nicely formatted message. - - Keyword arguments: - args -- A list of arguments to parse with OptionParser. - expected_opts -- The options expected. - expected_positional_args -- The positional arguments expected. - - Returns the options and positional args for further testing. - """ - - (options, positional_args) = self.parser.parse_args(args) - optdict = vars(options) - - self.assertEqual(optdict, expected_opts, - """ -Options are %(optdict)s. -Should be %(expected_opts)s. -Args were %(args)s.""" % locals()) - - self.assertEqual(positional_args, expected_positional_args, - """ -Positional arguments are %(positional_args)s. -Should be %(expected_positional_args)s. -Args were %(args)s.""" % locals ()) - - return (options, positional_args) - - def assertRaises(self, - func, - args, - kwargs, - expected_exception, - expected_message): - """ - Assert that the expected exception is raised when calling a - function, and that the right error message is included with - that exception. - - Arguments: - func -- the function to call - args -- positional arguments to `func` - kwargs -- keyword arguments to `func` - expected_exception -- exception that should be raised - expected_message -- expected exception message (or pattern - if a compiled regex object) - - Returns the exception raised for further testing. - """ - if args is None: - args = () - if kwargs is None: - kwargs = {} - - try: - func(*args, **kwargs) - except expected_exception, err: - actual_message = str(err) - if isinstance(expected_message, retype): - self.assert_(expected_message.search(actual_message), - """\ -expected exception message pattern: -/%s/ -actual exception message: -'''%s''' -""" % (expected_message.pattern, actual_message)) - else: - self.assertEqual(actual_message, - expected_message, - """\ -expected exception message: -'''%s''' -actual exception message: -'''%s''' -""" % (expected_message, actual_message)) - - return err - else: - self.fail("""expected exception %(expected_exception)s not raised -called %(func)r -with args %(args)r -and kwargs %(kwargs)r -""" % locals ()) - - - # -- Assertions used in more than one class -------------------- - - def assertParseFail(self, cmdline_args, expected_output): - """ - Assert the parser fails with the expected message. Caller - must ensure that self.parser is an InterceptingOptionParser. - """ - try: - self.parser.parse_args(cmdline_args) - except InterceptedError, err: - self.assertEqual(err.error_message, expected_output) - else: - self.assertFalse("expected parse failure") - - def assertOutput(self, - cmdline_args, - expected_output, - expected_status=0, - expected_error=None): - """Assert the parser prints the expected output on stdout.""" - save_stdout = sys.stdout - encoding = getattr(save_stdout, 'encoding', None) - try: - try: - sys.stdout = StringIO() - if encoding: - sys.stdout.encoding = encoding - self.parser.parse_args(cmdline_args) - finally: - output = sys.stdout.getvalue() - sys.stdout = save_stdout - - except InterceptedError, err: - self.assert_( - type(output) is types.StringType, - "expected output to be an ordinary string, not %r" - % type(output)) - - if output != expected_output: - self.fail("expected: \n'''\n" + expected_output + - "'''\nbut got \n'''\n" + output + "'''") - self.assertEqual(err.exit_status, expected_status) - self.assertEqual(err.exit_message, expected_error) - else: - self.assertFalse("expected parser.exit()") - - def assertTypeError(self, func, expected_message, *args): - """Assert that TypeError is raised when executing func.""" - self.assertRaises(func, args, None, TypeError, expected_message) - - def assertHelp(self, parser, expected_help): - actual_help = parser.format_help() - if actual_help != expected_help: - raise self.failureException( - 'help text failure; expected:\n"' + - expected_help + '"; got:\n"' + - actual_help + '"\n') - -# -- Test make_option() aka Option ------------------------------------- - -# It's not necessary to test correct options here. All the tests in the -# parser.parse_args() section deal with those, because they're needed -# there. - -class TestOptionChecks(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - - def assertOptionError(self, expected_message, args=[], kwargs={}): - self.assertRaises(make_option, args, kwargs, - OptionError, expected_message) - - def test_opt_string_empty(self): - self.assertTypeError(make_option, - "at least one option string must be supplied") - - def test_opt_string_too_short(self): - self.assertOptionError( - "invalid option string 'b': must be at least two characters long", - ["b"]) - - def test_opt_string_short_invalid(self): - self.assertOptionError( - "invalid short option string '--': must be " - "of the form -x, (x any non-dash char)", - ["--"]) - - def test_opt_string_long_invalid(self): - self.assertOptionError( - "invalid long option string '---': " - "must start with --, followed by non-dash", - ["---"]) - - def test_attr_invalid(self): - self.assertOptionError( - "option -b: invalid keyword arguments: bar, foo", - ["-b"], {'foo': None, 'bar': None}) - - def test_action_invalid(self): - self.assertOptionError( - "option -b: invalid action: 'foo'", - ["-b"], {'action': 'foo'}) - - def test_type_invalid(self): - self.assertOptionError( - "option -b: invalid option type: 'foo'", - ["-b"], {'type': 'foo'}) - self.assertOptionError( - "option -b: invalid option type: 'tuple'", - ["-b"], {'type': tuple}) - - def test_no_type_for_action(self): - self.assertOptionError( - "option -b: must not supply a type for action 'count'", - ["-b"], {'action': 'count', 'type': 'int'}) - - def test_no_choices_list(self): - self.assertOptionError( - "option -b/--bad: must supply a list of " - "choices for type 'choice'", - ["-b", "--bad"], {'type': "choice"}) - - def test_bad_choices_list(self): - typename = type('').__name__ - self.assertOptionError( - "option -b/--bad: choices must be a list of " - "strings ('%s' supplied)" % typename, - ["-b", "--bad"], - {'type': "choice", 'choices':"bad choices"}) - - def test_no_choices_for_type(self): - self.assertOptionError( - "option -b: must not supply choices for type 'int'", - ["-b"], {'type': 'int', 'choices':"bad"}) - - def test_no_const_for_action(self): - self.assertOptionError( - "option -b: 'const' must not be supplied for action 'store'", - ["-b"], {'action': 'store', 'const': 1}) - - def test_no_nargs_for_action(self): - self.assertOptionError( - "option -b: 'nargs' must not be supplied for action 'count'", - ["-b"], {'action': 'count', 'nargs': 2}) - - def test_callback_not_callable(self): - self.assertOptionError( - "option -b: callback not callable: 'foo'", - ["-b"], {'action': 'callback', - 'callback': 'foo'}) - - def dummy(self): - pass - - def test_callback_args_no_tuple(self): - self.assertOptionError( - "option -b: callback_args, if supplied, " - "must be a tuple: not 'foo'", - ["-b"], {'action': 'callback', - 'callback': self.dummy, - 'callback_args': 'foo'}) - - def test_callback_kwargs_no_dict(self): - self.assertOptionError( - "option -b: callback_kwargs, if supplied, " - "must be a dict: not 'foo'", - ["-b"], {'action': 'callback', - 'callback': self.dummy, - 'callback_kwargs': 'foo'}) - - def test_no_callback_for_action(self): - self.assertOptionError( - "option -b: callback supplied ('foo') for non-callback option", - ["-b"], {'action': 'store', - 'callback': 'foo'}) - - def test_no_callback_args_for_action(self): - self.assertOptionError( - "option -b: callback_args supplied for non-callback option", - ["-b"], {'action': 'store', - 'callback_args': 'foo'}) - - def test_no_callback_kwargs_for_action(self): - self.assertOptionError( - "option -b: callback_kwargs supplied for non-callback option", - ["-b"], {'action': 'store', - 'callback_kwargs': 'foo'}) - -class TestOptionParser(BaseTest): - def setUp(self): - self.parser = OptionParser() - self.parser.add_option("-v", "--verbose", "-n", "--noisy", - action="store_true", dest="verbose") - self.parser.add_option("-q", "--quiet", "--silent", - action="store_false", dest="verbose") - - def test_add_option_no_Option(self): - self.assertTypeError(self.parser.add_option, - "not an Option instance: None", None) - - def test_add_option_invalid_arguments(self): - self.assertTypeError(self.parser.add_option, - "invalid arguments", None, None) - - def test_get_option(self): - opt1 = self.parser.get_option("-v") - self.assert_(isinstance(opt1, Option)) - self.assertEqual(opt1._short_opts, ["-v", "-n"]) - self.assertEqual(opt1._long_opts, ["--verbose", "--noisy"]) - self.assertEqual(opt1.action, "store_true") - self.assertEqual(opt1.dest, "verbose") - - def test_get_option_equals(self): - opt1 = self.parser.get_option("-v") - opt2 = self.parser.get_option("--verbose") - opt3 = self.parser.get_option("-n") - opt4 = self.parser.get_option("--noisy") - self.assert_(opt1 is opt2 is opt3 is opt4) - - def test_has_option(self): - self.assert_(self.parser.has_option("-v")) - self.assert_(self.parser.has_option("--verbose")) - - def assert_removed(self): - self.assert_(self.parser.get_option("-v") is None) - self.assert_(self.parser.get_option("--verbose") is None) - self.assert_(self.parser.get_option("-n") is None) - self.assert_(self.parser.get_option("--noisy") is None) - - self.failIf(self.parser.has_option("-v")) - self.failIf(self.parser.has_option("--verbose")) - self.failIf(self.parser.has_option("-n")) - self.failIf(self.parser.has_option("--noisy")) - - self.assert_(self.parser.has_option("-q")) - self.assert_(self.parser.has_option("--silent")) - - def test_remove_short_opt(self): - self.parser.remove_option("-n") - self.assert_removed() - - def test_remove_long_opt(self): - self.parser.remove_option("--verbose") - self.assert_removed() - - def test_remove_nonexistent(self): - self.assertRaises(self.parser.remove_option, ('foo',), None, - ValueError, "no such option 'foo'") - - def test_refleak(self): - # If an OptionParser is carrying around a reference to a large - # object, various cycles can prevent it from being GC'd in - # a timely fashion. destroy() breaks the cycles to ensure stuff - # can be cleaned up. - big_thing = [42] - refcount = sys.getrefcount(big_thing) - parser = OptionParser() - parser.add_option("-a", "--aaarggh") - parser.big_thing = big_thing - - parser.destroy() - #self.assertEqual(refcount, sys.getrefcount(big_thing)) - del parser - self.assertEqual(refcount, sys.getrefcount(big_thing)) - - -class TestOptionValues(BaseTest): - def setUp(self): - pass - - def test_basics(self): - values = Values() - self.assertEqual(vars(values), {}) - self.assertEqual(values, {}) - self.assertNotEqual(values, {"foo": "bar"}) - self.assertNotEqual(values, "") - - dict = {"foo": "bar", "baz": 42} - values = Values(defaults=dict) - self.assertEqual(vars(values), dict) - self.assertEqual(values, dict) - self.assertNotEqual(values, {"foo": "bar"}) - self.assertNotEqual(values, {}) - self.assertNotEqual(values, "") - self.assertNotEqual(values, []) - - -class TestTypeAliases(BaseTest): - def setUp(self): - self.parser = OptionParser() - - def test_str_aliases_string(self): - self.parser.add_option("-s", type="str") - self.assertEquals(self.parser.get_option("-s").type, "string") - - def test_new_type_object(self): - self.parser.add_option("-s", type=str) - self.assertEquals(self.parser.get_option("-s").type, "string") - self.parser.add_option("-x", type=int) - self.assertEquals(self.parser.get_option("-x").type, "int") - - def test_old_type_object(self): - self.parser.add_option("-s", type=types.StringType) - self.assertEquals(self.parser.get_option("-s").type, "string") - self.parser.add_option("-x", type=types.IntType) - self.assertEquals(self.parser.get_option("-x").type, "int") - - -# Custom type for testing processing of default values. -_time_units = { 's' : 1, 'm' : 60, 'h' : 60*60, 'd' : 60*60*24 } - -def _check_duration(option, opt, value): - try: - if value[-1].isdigit(): - return int(value) - else: - return int(value[:-1]) * _time_units[value[-1]] - except ValueError, IndexError: - raise OptionValueError( - 'option %s: invalid duration: %r' % (opt, value)) - -class DurationOption(Option): - TYPES = Option.TYPES + ('duration',) - TYPE_CHECKER = copy.copy(Option.TYPE_CHECKER) - TYPE_CHECKER['duration'] = _check_duration - -class TestDefaultValues(BaseTest): - def setUp(self): - self.parser = OptionParser() - self.parser.add_option("-v", "--verbose", default=True) - self.parser.add_option("-q", "--quiet", dest='verbose') - self.parser.add_option("-n", type="int", default=37) - self.parser.add_option("-m", type="int") - self.parser.add_option("-s", default="foo") - self.parser.add_option("-t") - self.parser.add_option("-u", default=None) - self.expected = { 'verbose': True, - 'n': 37, - 'm': None, - 's': "foo", - 't': None, - 'u': None } - - def test_basic_defaults(self): - self.assertEqual(self.parser.get_default_values(), self.expected) - - def test_mixed_defaults_post(self): - self.parser.set_defaults(n=42, m=-100) - self.expected.update({'n': 42, 'm': -100}) - self.assertEqual(self.parser.get_default_values(), self.expected) - - def test_mixed_defaults_pre(self): - self.parser.set_defaults(x="barf", y="blah") - self.parser.add_option("-x", default="frob") - self.parser.add_option("-y") - - self.expected.update({'x': "frob", 'y': "blah"}) - self.assertEqual(self.parser.get_default_values(), self.expected) - - self.parser.remove_option("-y") - self.parser.add_option("-y", default=None) - self.expected.update({'y': None}) - self.assertEqual(self.parser.get_default_values(), self.expected) - - def test_process_default(self): - self.parser.option_class = DurationOption - self.parser.add_option("-d", type="duration", default=300) - self.parser.add_option("-e", type="duration", default="6m") - self.parser.set_defaults(n="42") - self.expected.update({'d': 300, 'e': 360, 'n': 42}) - self.assertEqual(self.parser.get_default_values(), self.expected) - - self.parser.set_process_default_values(False) - self.expected.update({'d': 300, 'e': "6m", 'n': "42"}) - self.assertEqual(self.parser.get_default_values(), self.expected) - - -class TestProgName(BaseTest): - """ - Test that %prog expands to the right thing in usage, version, - and help strings. - """ - - def assertUsage(self, parser, expected_usage): - self.assertEqual(parser.get_usage(), expected_usage) - - def assertVersion(self, parser, expected_version): - self.assertEqual(parser.get_version(), expected_version) - - - def test_default_progname(self): - # Make sure that program name taken from sys.argv[0] by default. - save_argv = sys.argv[:] - try: - sys.argv[0] = os.path.join("foo", "bar", "baz.py") - parser = OptionParser("%prog ...", version="%prog 1.2") - expected_usage = "Usage: baz.py ...\n" - self.assertUsage(parser, expected_usage) - self.assertVersion(parser, "baz.py 1.2") - self.assertHelp(parser, - expected_usage + "\n" + - "Options:\n" - " --version show program's version number and exit\n" - " -h, --help show this help message and exit\n") - finally: - sys.argv[:] = save_argv - - def test_custom_progname(self): - parser = OptionParser(prog="thingy", - version="%prog 0.1", - usage="%prog arg arg") - parser.remove_option("-h") - parser.remove_option("--version") - expected_usage = "Usage: thingy arg arg\n" - self.assertUsage(parser, expected_usage) - self.assertVersion(parser, "thingy 0.1") - self.assertHelp(parser, expected_usage + "\n") - - -class TestExpandDefaults(BaseTest): - def setUp(self): - self.parser = OptionParser(prog="test") - self.help_prefix = """\ -Usage: test [options] - -Options: - -h, --help show this help message and exit -""" - self.file_help = "read from FILE [default: %default]" - self.expected_help_file = self.help_prefix + \ - " -f FILE, --file=FILE read from FILE [default: foo.txt]\n" - self.expected_help_none = self.help_prefix + \ - " -f FILE, --file=FILE read from FILE [default: none]\n" - - def test_option_default(self): - self.parser.add_option("-f", "--file", - default="foo.txt", - help=self.file_help) - self.assertHelp(self.parser, self.expected_help_file) - - def test_parser_default_1(self): - self.parser.add_option("-f", "--file", - help=self.file_help) - self.parser.set_default('file', "foo.txt") - self.assertHelp(self.parser, self.expected_help_file) - - def test_parser_default_2(self): - self.parser.add_option("-f", "--file", - help=self.file_help) - self.parser.set_defaults(file="foo.txt") - self.assertHelp(self.parser, self.expected_help_file) - - def test_no_default(self): - self.parser.add_option("-f", "--file", - help=self.file_help) - self.assertHelp(self.parser, self.expected_help_none) - - def test_default_none_1(self): - self.parser.add_option("-f", "--file", - default=None, - help=self.file_help) - self.assertHelp(self.parser, self.expected_help_none) - - def test_default_none_2(self): - self.parser.add_option("-f", "--file", - help=self.file_help) - self.parser.set_defaults(file=None) - self.assertHelp(self.parser, self.expected_help_none) - - def test_float_default(self): - self.parser.add_option( - "-p", "--prob", - help="blow up with probability PROB [default: %default]") - self.parser.set_defaults(prob=0.43) - expected_help = self.help_prefix + \ - " -p PROB, --prob=PROB blow up with probability PROB [default: 0.43]\n" - self.assertHelp(self.parser, expected_help) - - def test_alt_expand(self): - self.parser.add_option("-f", "--file", - default="foo.txt", - help="read from FILE [default: *DEFAULT*]") - self.parser.formatter.default_tag = "*DEFAULT*" - self.assertHelp(self.parser, self.expected_help_file) - - def test_no_expand(self): - self.parser.add_option("-f", "--file", - default="foo.txt", - help="read from %default file") - self.parser.formatter.default_tag = None - expected_help = self.help_prefix + \ - " -f FILE, --file=FILE read from %default file\n" - self.assertHelp(self.parser, expected_help) - - -# -- Test parser.parse_args() ------------------------------------------ - -class TestStandard(BaseTest): - def setUp(self): - options = [make_option("-a", type="string"), - make_option("-b", "--boo", type="int", dest='boo'), - make_option("--foo", action="append")] - - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE, - option_list=options) - - def test_required_value(self): - self.assertParseFail(["-a"], "-a option requires an argument") - - def test_invalid_integer(self): - self.assertParseFail(["-b", "5x"], - "option -b: invalid integer value: '5x'") - - def test_no_such_option(self): - self.assertParseFail(["--boo13"], "no such option: --boo13") - - def test_long_invalid_integer(self): - self.assertParseFail(["--boo=x5"], - "option --boo: invalid integer value: 'x5'") - - def test_empty(self): - self.assertParseOK([], {'a': None, 'boo': None, 'foo': None}, []) - - def test_shortopt_empty_longopt_append(self): - self.assertParseOK(["-a", "", "--foo=blah", "--foo="], - {'a': "", 'boo': None, 'foo': ["blah", ""]}, - []) - - def test_long_option_append(self): - self.assertParseOK(["--foo", "bar", "--foo", "", "--foo=x"], - {'a': None, - 'boo': None, - 'foo': ["bar", "", "x"]}, - []) - - def test_option_argument_joined(self): - self.assertParseOK(["-abc"], - {'a': "bc", 'boo': None, 'foo': None}, - []) - - def test_option_argument_split(self): - self.assertParseOK(["-a", "34"], - {'a': "34", 'boo': None, 'foo': None}, - []) - - def test_option_argument_joined_integer(self): - self.assertParseOK(["-b34"], - {'a': None, 'boo': 34, 'foo': None}, - []) - - def test_option_argument_split_negative_integer(self): - self.assertParseOK(["-b", "-5"], - {'a': None, 'boo': -5, 'foo': None}, - []) - - def test_long_option_argument_joined(self): - self.assertParseOK(["--boo=13"], - {'a': None, 'boo': 13, 'foo': None}, - []) - - def test_long_option_argument_split(self): - self.assertParseOK(["--boo", "111"], - {'a': None, 'boo': 111, 'foo': None}, - []) - - def test_long_option_short_option(self): - self.assertParseOK(["--foo=bar", "-axyz"], - {'a': 'xyz', 'boo': None, 'foo': ["bar"]}, - []) - - def test_abbrev_long_option(self): - self.assertParseOK(["--f=bar", "-axyz"], - {'a': 'xyz', 'boo': None, 'foo': ["bar"]}, - []) - - def test_defaults(self): - (options, args) = self.parser.parse_args([]) - defaults = self.parser.get_default_values() - self.assertEqual(vars(defaults), vars(options)) - - def test_ambiguous_option(self): - self.parser.add_option("--foz", action="store", - type="string", dest="foo") - self.assertParseFail(["--f=bar"], - "ambiguous option: --f (--foo, --foz?)") - - - def test_short_and_long_option_split(self): - self.assertParseOK(["-a", "xyz", "--foo", "bar"], - {'a': 'xyz', 'boo': None, 'foo': ["bar"]}, - []), - - def test_short_option_split_long_option_append(self): - self.assertParseOK(["--foo=bar", "-b", "123", "--foo", "baz"], - {'a': None, 'boo': 123, 'foo': ["bar", "baz"]}, - []) - - def test_short_option_split_one_positional_arg(self): - self.assertParseOK(["-a", "foo", "bar"], - {'a': "foo", 'boo': None, 'foo': None}, - ["bar"]), - - def test_short_option_consumes_separator(self): - self.assertParseOK(["-a", "--", "foo", "bar"], - {'a': "--", 'boo': None, 'foo': None}, - ["foo", "bar"]), - self.assertParseOK(["-a", "--", "--foo", "bar"], - {'a': "--", 'boo': None, 'foo': ["bar"]}, - []), - - def test_short_option_joined_and_separator(self): - self.assertParseOK(["-ab", "--", "--foo", "bar"], - {'a': "b", 'boo': None, 'foo': None}, - ["--foo", "bar"]), - - def test_hyphen_becomes_positional_arg(self): - self.assertParseOK(["-ab", "-", "--foo", "bar"], - {'a': "b", 'boo': None, 'foo': ["bar"]}, - ["-"]) - - def test_no_append_versus_append(self): - self.assertParseOK(["-b3", "-b", "5", "--foo=bar", "--foo", "baz"], - {'a': None, 'boo': 5, 'foo': ["bar", "baz"]}, - []) - - def test_option_consumes_optionlike_string(self): - self.assertParseOK(["-a", "-b3"], - {'a': "-b3", 'boo': None, 'foo': None}, - []) - -class TestBool(BaseTest): - def setUp(self): - options = [make_option("-v", - "--verbose", - action="store_true", - dest="verbose", - default=''), - make_option("-q", - "--quiet", - action="store_false", - dest="verbose")] - self.parser = OptionParser(option_list = options) - - def test_bool_default(self): - self.assertParseOK([], - {'verbose': ''}, - []) - - def test_bool_false(self): - (options, args) = self.assertParseOK(["-q"], - {'verbose': 0}, - []) - if hasattr(__builtins__, 'False'): - self.failUnless(options.verbose is False) - - def test_bool_true(self): - (options, args) = self.assertParseOK(["-v"], - {'verbose': 1}, - []) - if hasattr(__builtins__, 'True'): - self.failUnless(options.verbose is True) - - def test_bool_flicker_on_and_off(self): - self.assertParseOK(["-qvq", "-q", "-v"], - {'verbose': 1}, - []) - -class TestChoice(BaseTest): - def setUp(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE) - self.parser.add_option("-c", action="store", type="choice", - dest="choice", choices=["one", "two", "three"]) - - def test_valid_choice(self): - self.assertParseOK(["-c", "one", "xyz"], - {'choice': 'one'}, - ["xyz"]) - - def test_invalid_choice(self): - self.assertParseFail(["-c", "four", "abc"], - "option -c: invalid choice: 'four' " - "(choose from 'one', 'two', 'three')") - - def test_add_choice_option(self): - self.parser.add_option("-d", "--default", - choices=["four", "five", "six"]) - opt = self.parser.get_option("-d") - self.assertEqual(opt.type, "choice") - self.assertEqual(opt.action, "store") - -class TestCount(BaseTest): - def setUp(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE) - self.v_opt = make_option("-v", action="count", dest="verbose") - self.parser.add_option(self.v_opt) - self.parser.add_option("--verbose", type="int", dest="verbose") - self.parser.add_option("-q", "--quiet", - action="store_const", dest="verbose", const=0) - - def test_empty(self): - self.assertParseOK([], {'verbose': None}, []) - - def test_count_one(self): - self.assertParseOK(["-v"], {'verbose': 1}, []) - - def test_count_three(self): - self.assertParseOK(["-vvv"], {'verbose': 3}, []) - - def test_count_three_apart(self): - self.assertParseOK(["-v", "-v", "-v"], {'verbose': 3}, []) - - def test_count_override_amount(self): - self.assertParseOK(["-vvv", "--verbose=2"], {'verbose': 2}, []) - - def test_count_override_quiet(self): - self.assertParseOK(["-vvv", "--verbose=2", "-q"], {'verbose': 0}, []) - - def test_count_overriding(self): - self.assertParseOK(["-vvv", "--verbose=2", "-q", "-v"], - {'verbose': 1}, []) - - def test_count_interspersed_args(self): - self.assertParseOK(["--quiet", "3", "-v"], - {'verbose': 1}, - ["3"]) - - def test_count_no_interspersed_args(self): - self.parser.disable_interspersed_args() - self.assertParseOK(["--quiet", "3", "-v"], - {'verbose': 0}, - ["3", "-v"]) - - def test_count_no_such_option(self): - self.assertParseFail(["-q3", "-v"], "no such option: -3") - - def test_count_option_no_value(self): - self.assertParseFail(["--quiet=3", "-v"], - "--quiet option does not take a value") - - def test_count_with_default(self): - self.parser.set_default('verbose', 0) - self.assertParseOK([], {'verbose':0}, []) - - def test_count_overriding_default(self): - self.parser.set_default('verbose', 0) - self.assertParseOK(["-vvv", "--verbose=2", "-q", "-v"], - {'verbose': 1}, []) - -class TestMultipleArgs(BaseTest): - def setUp(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE) - self.parser.add_option("-p", "--point", - action="store", nargs=3, type="float", dest="point") - - def test_nargs_with_positional_args(self): - self.assertParseOK(["foo", "-p", "1", "2.5", "-4.3", "xyz"], - {'point': (1.0, 2.5, -4.3)}, - ["foo", "xyz"]) - - def test_nargs_long_opt(self): - self.assertParseOK(["--point", "-1", "2.5", "-0", "xyz"], - {'point': (-1.0, 2.5, -0.0)}, - ["xyz"]) - - def test_nargs_invalid_float_value(self): - self.assertParseFail(["-p", "1.0", "2x", "3.5"], - "option -p: " - "invalid floating-point value: '2x'") - - def test_nargs_required_values(self): - self.assertParseFail(["--point", "1.0", "3.5"], - "--point option requires 3 arguments") - -class TestMultipleArgsAppend(BaseTest): - def setUp(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE) - self.parser.add_option("-p", "--point", action="store", nargs=3, - type="float", dest="point") - self.parser.add_option("-f", "--foo", action="append", nargs=2, - type="int", dest="foo") - self.parser.add_option("-z", "--zero", action="append_const", - dest="foo", const=(0, 0)) - - def test_nargs_append(self): - self.assertParseOK(["-f", "4", "-3", "blah", "--foo", "1", "666"], - {'point': None, 'foo': [(4, -3), (1, 666)]}, - ["blah"]) - - def test_nargs_append_required_values(self): - self.assertParseFail(["-f4,3"], - "-f option requires 2 arguments") - - def test_nargs_append_simple(self): - self.assertParseOK(["--foo=3", "4"], - {'point': None, 'foo':[(3, 4)]}, - []) - - def test_nargs_append_const(self): - self.assertParseOK(["--zero", "--foo", "3", "4", "-z"], - {'point': None, 'foo':[(0, 0), (3, 4), (0, 0)]}, - []) - -class TestVersion(BaseTest): - def test_version(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE, - version="%prog 0.1") - save_argv = sys.argv[:] - try: - sys.argv[0] = os.path.join(os.curdir, "foo", "bar") - self.assertOutput(["--version"], "bar 0.1\n") - finally: - sys.argv[:] = save_argv - - def test_no_version(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE) - self.assertParseFail(["--version"], - "no such option: --version") - -# -- Test conflicting default values and parser.parse_args() ----------- - -class TestConflictingDefaults(BaseTest): - """Conflicting default values: the last one should win.""" - def setUp(self): - self.parser = OptionParser(option_list=[ - make_option("-v", action="store_true", dest="verbose", default=1)]) - - def test_conflict_default(self): - self.parser.add_option("-q", action="store_false", dest="verbose", - default=0) - self.assertParseOK([], {'verbose': 0}, []) - - def test_conflict_default_none(self): - self.parser.add_option("-q", action="store_false", dest="verbose", - default=None) - self.assertParseOK([], {'verbose': None}, []) - -class TestOptionGroup(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - - def test_option_group_create_instance(self): - group = OptionGroup(self.parser, "Spam") - self.parser.add_option_group(group) - group.add_option("--spam", action="store_true", - help="spam spam spam spam") - self.assertParseOK(["--spam"], {'spam': 1}, []) - - def test_add_group_no_group(self): - self.assertTypeError(self.parser.add_option_group, - "not an OptionGroup instance: None", None) - - def test_add_group_invalid_arguments(self): - self.assertTypeError(self.parser.add_option_group, - "invalid arguments", None, None) - - def test_add_group_wrong_parser(self): - group = OptionGroup(self.parser, "Spam") - group.parser = OptionParser() - self.assertRaises(self.parser.add_option_group, (group,), None, - ValueError, "invalid OptionGroup (wrong parser)") - - def test_group_manipulate(self): - group = self.parser.add_option_group("Group 2", - description="Some more options") - group.set_title("Bacon") - group.add_option("--bacon", type="int") - self.assert_(self.parser.get_option_group("--bacon"), group) - -# -- Test extending and parser.parse_args() ---------------------------- - -class TestExtendAddTypes(BaseTest): - def setUp(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE, - option_class=self.MyOption) - self.parser.add_option("-a", None, type="string", dest="a") - self.parser.add_option("-f", "--file", type="file", dest="file") - - def tearDown(self): - if os.path.isdir(test_support.TESTFN): - os.rmdir(test_support.TESTFN) - elif os.path.isfile(test_support.TESTFN): - os.unlink(test_support.TESTFN) - - class MyOption (Option): - def check_file(option, opt, value): - if not os.path.exists(value): - raise OptionValueError("%s: file does not exist" % value) - elif not os.path.isfile(value): - raise OptionValueError("%s: not a regular file" % value) - return value - - TYPES = Option.TYPES + ("file",) - TYPE_CHECKER = copy.copy(Option.TYPE_CHECKER) - TYPE_CHECKER["file"] = check_file - - def test_filetype_ok(self): - open(test_support.TESTFN, "w").close() - self.assertParseOK(["--file", test_support.TESTFN, "-afoo"], - {'file': test_support.TESTFN, 'a': 'foo'}, - []) - - def test_filetype_noexist(self): - self.assertParseFail(["--file", test_support.TESTFN, "-afoo"], - "%s: file does not exist" % - test_support.TESTFN) - - def test_filetype_notfile(self): - os.mkdir(test_support.TESTFN) - self.assertParseFail(["--file", test_support.TESTFN, "-afoo"], - "%s: not a regular file" % - test_support.TESTFN) - - -class TestExtendAddActions(BaseTest): - def setUp(self): - options = [self.MyOption("-a", "--apple", action="extend", - type="string", dest="apple")] - self.parser = OptionParser(option_list=options) - - class MyOption (Option): - ACTIONS = Option.ACTIONS + ("extend",) - STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) - TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) - - def take_action(self, action, dest, opt, value, values, parser): - if action == "extend": - lvalue = value.split(",") - values.ensure_value(dest, []).extend(lvalue) - else: - Option.take_action(self, action, dest, opt, parser, value, - values) - - def test_extend_add_action(self): - self.assertParseOK(["-afoo,bar", "--apple=blah"], - {'apple': ["foo", "bar", "blah"]}, - []) - - def test_extend_add_action_normal(self): - self.assertParseOK(["-a", "foo", "-abar", "--apple=x,y"], - {'apple': ["foo", "bar", "x", "y"]}, - []) - -# -- Test callbacks and parser.parse_args() ---------------------------- - -class TestCallback(BaseTest): - def setUp(self): - options = [make_option("-x", - None, - action="callback", - callback=self.process_opt), - make_option("-f", - "--file", - action="callback", - callback=self.process_opt, - type="string", - dest="filename")] - self.parser = OptionParser(option_list=options) - - def process_opt(self, option, opt, value, parser_): - if opt == "-x": - self.assertEqual(option._short_opts, ["-x"]) - self.assertEqual(option._long_opts, []) - self.assert_(parser_ is self.parser) - self.assert_(value is None) - self.assertEqual(vars(parser_.values), {'filename': None}) - - parser_.values.x = 42 - elif opt == "--file": - self.assertEqual(option._short_opts, ["-f"]) - self.assertEqual(option._long_opts, ["--file"]) - self.assert_(parser_ is self.parser) - self.assertEqual(value, "foo") - self.assertEqual(vars(parser_.values), {'filename': None, 'x': 42}) - - setattr(parser_.values, option.dest, value) - else: - self.fail("Unknown option %r in process_opt." % opt) - - def test_callback(self): - self.assertParseOK(["-x", "--file=foo"], - {'filename': "foo", 'x': 42}, - []) - - def test_callback_help(self): - # This test was prompted by SF bug #960515 -- the point is - # not to inspect the help text, just to make sure that - # format_help() doesn't crash. - parser = OptionParser(usage=SUPPRESS_USAGE) - parser.remove_option("-h") - parser.add_option("-t", "--test", action="callback", - callback=lambda: None, type="string", - help="foo") - - expected_help = ("Options:\n" - " -t TEST, --test=TEST foo\n") - self.assertHelp(parser, expected_help) - - -class TestCallbackExtraArgs(BaseTest): - def setUp(self): - options = [make_option("-p", "--point", action="callback", - callback=self.process_tuple, - callback_args=(3, int), type="string", - dest="points", default=[])] - self.parser = OptionParser(option_list=options) - - def process_tuple(self, option, opt, value, parser_, len, type): - self.assertEqual(len, 3) - self.assert_(type is int) - - if opt == "-p": - self.assertEqual(value, "1,2,3") - elif opt == "--point": - self.assertEqual(value, "4,5,6") - - value = tuple(map(type, value.split(","))) - getattr(parser_.values, option.dest).append(value) - - def test_callback_extra_args(self): - self.assertParseOK(["-p1,2,3", "--point", "4,5,6"], - {'points': [(1,2,3), (4,5,6)]}, - []) - -class TestCallbackMeddleArgs(BaseTest): - def setUp(self): - options = [make_option(str(x), action="callback", - callback=self.process_n, dest='things') - for x in range(-1, -6, -1)] - self.parser = OptionParser(option_list=options) - - # Callback that meddles in rargs, largs - def process_n(self, option, opt, value, parser_): - # option is -3, -5, etc. - nargs = int(opt[1:]) - rargs = parser_.rargs - if len(rargs) < nargs: - self.fail("Expected %d arguments for %s option." % (nargs, opt)) - dest = parser_.values.ensure_value(option.dest, []) - dest.append(tuple(rargs[0:nargs])) - parser_.largs.append(nargs) - del rargs[0:nargs] - - def test_callback_meddle_args(self): - self.assertParseOK(["-1", "foo", "-3", "bar", "baz", "qux"], - {'things': [("foo",), ("bar", "baz", "qux")]}, - [1, 3]) - - def test_callback_meddle_args_separator(self): - self.assertParseOK(["-2", "foo", "--"], - {'things': [('foo', '--')]}, - [2]) - -class TestCallbackManyArgs(BaseTest): - def setUp(self): - options = [make_option("-a", "--apple", action="callback", nargs=2, - callback=self.process_many, type="string"), - make_option("-b", "--bob", action="callback", nargs=3, - callback=self.process_many, type="int")] - self.parser = OptionParser(option_list=options) - - def process_many(self, option, opt, value, parser_): - if opt == "-a": - self.assertEqual(value, ("foo", "bar")) - elif opt == "--apple": - self.assertEqual(value, ("ding", "dong")) - elif opt == "-b": - self.assertEqual(value, (1, 2, 3)) - elif opt == "--bob": - self.assertEqual(value, (-666, 42, 0)) - - def test_many_args(self): - self.assertParseOK(["-a", "foo", "bar", "--apple", "ding", "dong", - "-b", "1", "2", "3", "--bob", "-666", "42", - "0"], - {"apple": None, "bob": None}, - []) - -class TestCallbackCheckAbbrev(BaseTest): - def setUp(self): - self.parser = OptionParser() - self.parser.add_option("--foo-bar", action="callback", - callback=self.check_abbrev) - - def check_abbrev(self, option, opt, value, parser): - self.assertEqual(opt, "--foo-bar") - - def test_abbrev_callback_expansion(self): - self.assertParseOK(["--foo"], {}, []) - -class TestCallbackVarArgs(BaseTest): - def setUp(self): - options = [make_option("-a", type="int", nargs=2, dest="a"), - make_option("-b", action="store_true", dest="b"), - make_option("-c", "--callback", action="callback", - callback=self.variable_args, dest="c")] - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE, - option_list=options) - - def variable_args(self, option, opt, value, parser): - self.assert_(value is None) - done = 0 - value = [] - rargs = parser.rargs - while rargs: - arg = rargs[0] - if ((arg[:2] == "--" and len(arg) > 2) or - (arg[:1] == "-" and len(arg) > 1 and arg[1] != "-")): - break - else: - value.append(arg) - del rargs[0] - setattr(parser.values, option.dest, value) - - def test_variable_args(self): - self.assertParseOK(["-a3", "-5", "--callback", "foo", "bar"], - {'a': (3, -5), 'b': None, 'c': ["foo", "bar"]}, - []) - - def test_consume_separator_stop_at_option(self): - self.assertParseOK(["-c", "37", "--", "xxx", "-b", "hello"], - {'a': None, - 'b': True, - 'c': ["37", "--", "xxx"]}, - ["hello"]) - - def test_positional_arg_and_variable_args(self): - self.assertParseOK(["hello", "-c", "foo", "-", "bar"], - {'a': None, - 'b': None, - 'c':["foo", "-", "bar"]}, - ["hello"]) - - def test_stop_at_option(self): - self.assertParseOK(["-c", "foo", "-b"], - {'a': None, 'b': True, 'c': ["foo"]}, - []) - - def test_stop_at_invalid_option(self): - self.assertParseFail(["-c", "3", "-5", "-a"], "no such option: -5") - - -# -- Test conflict handling and parser.parse_args() -------------------- - -class ConflictBase(BaseTest): - def setUp(self): - options = [make_option("-v", "--verbose", action="count", - dest="verbose", help="increment verbosity")] - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE, - option_list=options) - - def show_version(self, option, opt, value, parser): - parser.values.show_version = 1 - -class TestConflict(ConflictBase): - """Use the default conflict resolution for Optik 1.2: error.""" - def assert_conflict_error(self, func): - err = self.assertRaises( - func, ("-v", "--version"), {'action' : "callback", - 'callback' : self.show_version, - 'help' : "show version"}, - OptionConflictError, - "option -v/--version: conflicting option string(s): -v") - - self.assertEqual(err.msg, "conflicting option string(s): -v") - self.assertEqual(err.option_id, "-v/--version") - - def test_conflict_error(self): - self.assert_conflict_error(self.parser.add_option) - - def test_conflict_error_group(self): - group = OptionGroup(self.parser, "Group 1") - self.assert_conflict_error(group.add_option) - - def test_no_such_conflict_handler(self): - self.assertRaises( - self.parser.set_conflict_handler, ('foo',), None, - ValueError, "invalid conflict_resolution value 'foo'") - - -class TestConflictResolve(ConflictBase): - def setUp(self): - ConflictBase.setUp(self) - self.parser.set_conflict_handler("resolve") - self.parser.add_option("-v", "--version", action="callback", - callback=self.show_version, help="show version") - - def test_conflict_resolve(self): - v_opt = self.parser.get_option("-v") - verbose_opt = self.parser.get_option("--verbose") - version_opt = self.parser.get_option("--version") - - self.assert_(v_opt is version_opt) - self.assert_(v_opt is not verbose_opt) - self.assertEqual(v_opt._long_opts, ["--version"]) - self.assertEqual(version_opt._short_opts, ["-v"]) - self.assertEqual(version_opt._long_opts, ["--version"]) - self.assertEqual(verbose_opt._short_opts, []) - self.assertEqual(verbose_opt._long_opts, ["--verbose"]) - - def test_conflict_resolve_help(self): - self.assertOutput(["-h"], """\ -Options: - --verbose increment verbosity - -h, --help show this help message and exit - -v, --version show version -""") - - def test_conflict_resolve_short_opt(self): - self.assertParseOK(["-v"], - {'verbose': None, 'show_version': 1}, - []) - - def test_conflict_resolve_long_opt(self): - self.assertParseOK(["--verbose"], - {'verbose': 1}, - []) - - def test_conflict_resolve_long_opts(self): - self.assertParseOK(["--verbose", "--version"], - {'verbose': 1, 'show_version': 1}, - []) - -class TestConflictOverride(BaseTest): - def setUp(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE) - self.parser.set_conflict_handler("resolve") - self.parser.add_option("-n", "--dry-run", - action="store_true", dest="dry_run", - help="don't do anything") - self.parser.add_option("--dry-run", "-n", - action="store_const", const=42, dest="dry_run", - help="dry run mode") - - def test_conflict_override_opts(self): - opt = self.parser.get_option("--dry-run") - self.assertEqual(opt._short_opts, ["-n"]) - self.assertEqual(opt._long_opts, ["--dry-run"]) - - def test_conflict_override_help(self): - self.assertOutput(["-h"], """\ -Options: - -h, --help show this help message and exit - -n, --dry-run dry run mode -""") - - def test_conflict_override_args(self): - self.assertParseOK(["-n"], - {'dry_run': 42}, - []) - -# -- Other testing. ---------------------------------------------------- - -_expected_help_basic = """\ -Usage: bar.py [options] - -Options: - -a APPLE throw APPLEs at basket - -b NUM, --boo=NUM shout "boo!" NUM times (in order to frighten away all the - evil spirits that cause trouble and mayhem) - --foo=FOO store FOO in the foo list for later fooing - -h, --help show this help message and exit -""" - -_expected_help_long_opts_first = """\ -Usage: bar.py [options] - -Options: - -a APPLE throw APPLEs at basket - --boo=NUM, -b NUM shout "boo!" NUM times (in order to frighten away all the - evil spirits that cause trouble and mayhem) - --foo=FOO store FOO in the foo list for later fooing - --help, -h show this help message and exit -""" - -_expected_help_title_formatter = """\ -Usage -===== - bar.py [options] - -Options -======= --a APPLE throw APPLEs at basket ---boo=NUM, -b NUM shout "boo!" NUM times (in order to frighten away all the - evil spirits that cause trouble and mayhem) ---foo=FOO store FOO in the foo list for later fooing ---help, -h show this help message and exit -""" - -_expected_help_short_lines = """\ -Usage: bar.py [options] - -Options: - -a APPLE throw APPLEs at basket - -b NUM, --boo=NUM shout "boo!" NUM times (in order to - frighten away all the evil spirits - that cause trouble and mayhem) - --foo=FOO store FOO in the foo list for later - fooing - -h, --help show this help message and exit -""" - -class TestHelp(BaseTest): - def setUp(self): - self.parser = self.make_parser(80) - - def make_parser(self, columns): - options = [ - make_option("-a", type="string", dest='a', - metavar="APPLE", help="throw APPLEs at basket"), - make_option("-b", "--boo", type="int", dest='boo', - metavar="NUM", - help= - "shout \"boo!\" NUM times (in order to frighten away " - "all the evil spirits that cause trouble and mayhem)"), - make_option("--foo", action="append", type="string", dest='foo', - help="store FOO in the foo list for later fooing"), - ] - - # We need to set COLUMNS for the OptionParser constructor, but - # we must restore its original value -- otherwise, this test - # screws things up for other tests when it's part of the Python - # test suite. - orig_columns = os.environ.get('COLUMNS') - os.environ['COLUMNS'] = str(columns) - try: - return InterceptingOptionParser(option_list=options) - finally: - if orig_columns is None: - del os.environ['COLUMNS'] - else: - os.environ['COLUMNS'] = orig_columns - - def assertHelpEquals(self, expected_output): - if type(expected_output) is types.UnicodeType: - encoding = self.parser._get_encoding(sys.stdout) - expected_output = expected_output.encode(encoding, "replace") - - save_argv = sys.argv[:] - try: - # Make optparse believe bar.py is being executed. - sys.argv[0] = os.path.join("foo", "bar.py") - self.assertOutput(["-h"], expected_output) - finally: - sys.argv[:] = save_argv - - def test_help(self): - self.assertHelpEquals(_expected_help_basic) - - def test_help_old_usage(self): - self.parser.set_usage("Usage: %prog [options]") - self.assertHelpEquals(_expected_help_basic) - - def test_help_long_opts_first(self): - self.parser.formatter.short_first = 0 - self.assertHelpEquals(_expected_help_long_opts_first) - - def test_help_title_formatter(self): - self.parser.formatter = TitledHelpFormatter() - self.assertHelpEquals(_expected_help_title_formatter) - - def test_wrap_columns(self): - # Ensure that wrapping respects $COLUMNS environment variable. - # Need to reconstruct the parser, since that's the only time - # we look at $COLUMNS. - self.parser = self.make_parser(60) - self.assertHelpEquals(_expected_help_short_lines) - - def test_help_unicode(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE) - self.parser.add_option("-a", action="store_true", help=u"ol\u00E9!") - expect = u"""\ -Options: - -h, --help show this help message and exit - -a ol\u00E9! -""" - self.assertHelpEquals(expect) - - def test_help_unicode_description(self): - self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE, - description=u"ol\u00E9!") - expect = u"""\ -ol\u00E9! - -Options: - -h, --help show this help message and exit -""" - self.assertHelpEquals(expect) - - def test_help_description_groups(self): - self.parser.set_description( - "This is the program description for %prog. %prog has " - "an option group as well as single options.") - - group = OptionGroup( - self.parser, "Dangerous Options", - "Caution: use of these options is at your own risk. " - "It is believed that some of them bite.") - group.add_option("-g", action="store_true", help="Group option.") - self.parser.add_option_group(group) - - expect = """\ -Usage: bar.py [options] - -This is the program description for bar.py. bar.py has an option group as -well as single options. - -Options: - -a APPLE throw APPLEs at basket - -b NUM, --boo=NUM shout "boo!" NUM times (in order to frighten away all the - evil spirits that cause trouble and mayhem) - --foo=FOO store FOO in the foo list for later fooing - -h, --help show this help message and exit - - Dangerous Options: - Caution: use of these options is at your own risk. It is believed - that some of them bite. - - -g Group option. -""" - - self.assertHelpEquals(expect) - - self.parser.epilog = "Please report bugs to /dev/null." - self.assertHelpEquals(expect + "\nPlease report bugs to /dev/null.\n") - - -class TestMatchAbbrev(BaseTest): - def test_match_abbrev(self): - self.assertEqual(_match_abbrev("--f", - {"--foz": None, - "--foo": None, - "--fie": None, - "--f": None}), - "--f") - - def test_match_abbrev_error(self): - s = "--f" - wordmap = {"--foz": None, "--foo": None, "--fie": None} - self.assertRaises( - _match_abbrev, (s, wordmap), None, - BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") - - -class TestParseNumber(BaseTest): - def setUp(self): - self.parser = InterceptingOptionParser() - self.parser.add_option("-n", type=int) - self.parser.add_option("-l", type=long) - - def test_parse_num_fail(self): - self.assertRaises( - _parse_num, ("", int), {}, - ValueError, - re.compile(r"invalid literal for int().*: '?'?")) - self.assertRaises( - _parse_num, ("0xOoops", long), {}, - ValueError, - re.compile(r"invalid literal for long().*: '?0xOoops'?")) - - def test_parse_num_ok(self): - self.assertEqual(_parse_num("0", int), 0) - self.assertEqual(_parse_num("0x10", int), 16) - self.assertEqual(_parse_num("0XA", long), 10L) - self.assertEqual(_parse_num("010", long), 8L) - self.assertEqual(_parse_num("0b11", int), 3) - self.assertEqual(_parse_num("0b", long), 0L) - - def test_numeric_options(self): - self.assertParseOK(["-n", "42", "-l", "0x20"], - { "n": 42, "l": 0x20 }, []) - self.assertParseOK(["-n", "0b0101", "-l010"], - { "n": 5, "l": 8 }, []) - self.assertParseFail(["-n008"], - "option -n: invalid integer value: '008'") - self.assertParseFail(["-l0b0123"], - "option -l: invalid long integer value: '0b0123'") - self.assertParseFail(["-l", "0x12x"], - "option -l: invalid long integer value: '0x12x'") - - -def _testclasses(): - mod = sys.modules[__name__] - return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] - -def suite(): - suite = unittest.TestSuite() - for testclass in _testclasses(): - suite.addTest(unittest.makeSuite(testclass)) - return suite - -def test_main(): - test_support.run_suite(suite()) - -if __name__ == '__main__': - unittest.main() diff --git a/sys/lib/python/test/test_os.py b/sys/lib/python/test/test_os.py deleted file mode 100644 index 69e456c1b..000000000 --- a/sys/lib/python/test/test_os.py +++ /dev/null @@ -1,438 +0,0 @@ -# As a test suite for the os module, this is woefully inadequate, but this -# does add tests for a few functions which have been determined to be more -# portable than they had been thought to be. - -import os -import unittest -import warnings -import sys -from test import test_support - -warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__) -warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) - -# Tests creating TESTFN -class FileTests(unittest.TestCase): - def setUp(self): - if os.path.exists(test_support.TESTFN): - os.unlink(test_support.TESTFN) - tearDown = setUp - - def test_access(self): - f = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR) - os.close(f) - self.assert_(os.access(test_support.TESTFN, os.W_OK)) - - -class TemporaryFileTests(unittest.TestCase): - def setUp(self): - self.files = [] - os.mkdir(test_support.TESTFN) - - def tearDown(self): - for name in self.files: - os.unlink(name) - os.rmdir(test_support.TESTFN) - - def check_tempfile(self, name): - # make sure it doesn't already exist: - self.failIf(os.path.exists(name), - "file already exists for temporary file") - # make sure we can create the file - open(name, "w") - self.files.append(name) - - def test_tempnam(self): - if not hasattr(os, "tempnam"): - return - warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, - r"test_os$") - self.check_tempfile(os.tempnam()) - - name = os.tempnam(test_support.TESTFN) - self.check_tempfile(name) - - name = os.tempnam(test_support.TESTFN, "pfx") - self.assert_(os.path.basename(name)[:3] == "pfx") - self.check_tempfile(name) - - def test_tmpfile(self): - if not hasattr(os, "tmpfile"): - return - fp = os.tmpfile() - fp.write("foobar") - fp.seek(0,0) - s = fp.read() - fp.close() - self.assert_(s == "foobar") - - def test_tmpnam(self): - import sys - if not hasattr(os, "tmpnam"): - return - warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, - r"test_os$") - name = os.tmpnam() - if sys.platform in ("win32",): - # The Windows tmpnam() seems useless. From the MS docs: - # - # The character string that tmpnam creates consists of - # the path prefix, defined by the entry P_tmpdir in the - # file STDIO.H, followed by a sequence consisting of the - # digit characters '0' through '9'; the numerical value - # of this string is in the range 1 - 65,535. Changing the - # definitions of L_tmpnam or P_tmpdir in STDIO.H does not - # change the operation of tmpnam. - # - # The really bizarre part is that, at least under MSVC6, - # P_tmpdir is "\\". That is, the path returned refers to - # the root of the current drive. That's a terrible place to - # put temp files, and, depending on privileges, the user - # may not even be able to open a file in the root directory. - self.failIf(os.path.exists(name), - "file already exists for temporary file") - else: - self.check_tempfile(name) - -# Test attributes on return values from os.*stat* family. -class StatAttributeTests(unittest.TestCase): - def setUp(self): - os.mkdir(test_support.TESTFN) - self.fname = os.path.join(test_support.TESTFN, "f1") - f = open(self.fname, 'wb') - f.write("ABC") - f.close() - - def tearDown(self): - os.unlink(self.fname) - os.rmdir(test_support.TESTFN) - - def test_stat_attributes(self): - if not hasattr(os, "stat"): - return - - import stat - result = os.stat(self.fname) - - # Make sure direct access works - self.assertEquals(result[stat.ST_SIZE], 3) - self.assertEquals(result.st_size, 3) - - import sys - - # Make sure all the attributes are there - members = dir(result) - for name in dir(stat): - if name[:3] == 'ST_': - attr = name.lower() - if name.endswith("TIME"): - def trunc(x): return int(x) - else: - def trunc(x): return x - self.assertEquals(trunc(getattr(result, attr)), - result[getattr(stat, name)]) - self.assert_(attr in members) - - try: - result[200] - self.fail("No exception thrown") - except IndexError: - pass - - # Make sure that assignment fails - try: - result.st_mode = 1 - self.fail("No exception thrown") - except TypeError: - pass - - try: - result.st_rdev = 1 - self.fail("No exception thrown") - except (AttributeError, TypeError): - pass - - try: - result.parrot = 1 - self.fail("No exception thrown") - except AttributeError: - pass - - # Use the stat_result constructor with a too-short tuple. - try: - result2 = os.stat_result((10,)) - self.fail("No exception thrown") - except TypeError: - pass - - # Use the constructr with a too-long tuple. - try: - result2 = os.stat_result((0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)) - except TypeError: - pass - - - def test_statvfs_attributes(self): - if not hasattr(os, "statvfs"): - return - - import statvfs - try: - result = os.statvfs(self.fname) - except OSError, e: - # On AtheOS, glibc always returns ENOSYS - import errno - if e.errno == errno.ENOSYS: - return - - # Make sure direct access works - self.assertEquals(result.f_bfree, result[statvfs.F_BFREE]) - - # Make sure all the attributes are there - members = dir(result) - for name in dir(statvfs): - if name[:2] == 'F_': - attr = name.lower() - self.assertEquals(getattr(result, attr), - result[getattr(statvfs, name)]) - self.assert_(attr in members) - - # Make sure that assignment really fails - try: - result.f_bfree = 1 - self.fail("No exception thrown") - except TypeError: - pass - - try: - result.parrot = 1 - self.fail("No exception thrown") - except AttributeError: - pass - - # Use the constructor with a too-short tuple. - try: - result2 = os.statvfs_result((10,)) - self.fail("No exception thrown") - except TypeError: - pass - - # Use the constructr with a too-long tuple. - try: - result2 = os.statvfs_result((0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)) - except TypeError: - pass - - # Restrict test to Win32, since there is no guarantee other - # systems support centiseconds - if sys.platform == 'win32': - def test_1565150(self): - t1 = 1159195039.25 - os.utime(self.fname, (t1, t1)) - self.assertEquals(os.stat(self.fname).st_mtime, t1) - - def test_1686475(self): - # Verify that an open file can be stat'ed - try: - os.stat(r"c:\pagefile.sys") - except WindowsError, e: - if e == 2: # file does not exist; cannot run test - return - self.fail("Could not stat pagefile.sys") - -from test import mapping_tests - -class EnvironTests(mapping_tests.BasicTestMappingProtocol): - """check that os.environ object conform to mapping protocol""" - type2test = None - def _reference(self): - return {"KEY1":"VALUE1", "KEY2":"VALUE2", "KEY3":"VALUE3"} - def _empty_mapping(self): - os.environ.clear() - return os.environ - def setUp(self): - self.__save = dict(os.environ) - os.environ.clear() - def tearDown(self): - os.environ.clear() - os.environ.update(self.__save) - - # Bug 1110478 - def test_update2(self): - if os.path.exists("/bin/sh"): - os.environ.update(HELLO="World") - value = os.popen("/bin/sh -c 'echo $HELLO'").read().strip() - self.assertEquals(value, "World") - -class WalkTests(unittest.TestCase): - """Tests for os.walk().""" - - def test_traversal(self): - import os - from os.path import join - - # Build: - # TESTFN/ a file kid and two directory kids - # tmp1 - # SUB1/ a file kid and a directory kid - # tmp2 - # SUB11/ no kids - # SUB2/ just a file kid - # tmp3 - sub1_path = join(test_support.TESTFN, "SUB1") - sub11_path = join(sub1_path, "SUB11") - sub2_path = join(test_support.TESTFN, "SUB2") - tmp1_path = join(test_support.TESTFN, "tmp1") - tmp2_path = join(sub1_path, "tmp2") - tmp3_path = join(sub2_path, "tmp3") - - # Create stuff. - os.makedirs(sub11_path) - os.makedirs(sub2_path) - for path in tmp1_path, tmp2_path, tmp3_path: - f = file(path, "w") - f.write("I'm " + path + " and proud of it. Blame test_os.\n") - f.close() - - # Walk top-down. - all = list(os.walk(test_support.TESTFN)) - self.assertEqual(len(all), 4) - # We can't know which order SUB1 and SUB2 will appear in. - # Not flipped: TESTFN, SUB1, SUB11, SUB2 - # flipped: TESTFN, SUB2, SUB1, SUB11 - flipped = all[0][1][0] != "SUB1" - all[0][1].sort() - self.assertEqual(all[0], (test_support.TESTFN, ["SUB1", "SUB2"], ["tmp1"])) - self.assertEqual(all[1 + flipped], (sub1_path, ["SUB11"], ["tmp2"])) - self.assertEqual(all[2 + flipped], (sub11_path, [], [])) - self.assertEqual(all[3 - 2 * flipped], (sub2_path, [], ["tmp3"])) - - # Prune the search. - all = [] - for root, dirs, files in os.walk(test_support.TESTFN): - all.append((root, dirs, files)) - # Don't descend into SUB1. - if 'SUB1' in dirs: - # Note that this also mutates the dirs we appended to all! - dirs.remove('SUB1') - self.assertEqual(len(all), 2) - self.assertEqual(all[0], (test_support.TESTFN, ["SUB2"], ["tmp1"])) - self.assertEqual(all[1], (sub2_path, [], ["tmp3"])) - - # Walk bottom-up. - all = list(os.walk(test_support.TESTFN, topdown=False)) - self.assertEqual(len(all), 4) - # We can't know which order SUB1 and SUB2 will appear in. - # Not flipped: SUB11, SUB1, SUB2, TESTFN - # flipped: SUB2, SUB11, SUB1, TESTFN - flipped = all[3][1][0] != "SUB1" - all[3][1].sort() - self.assertEqual(all[3], (test_support.TESTFN, ["SUB1", "SUB2"], ["tmp1"])) - self.assertEqual(all[flipped], (sub11_path, [], [])) - self.assertEqual(all[flipped + 1], (sub1_path, ["SUB11"], ["tmp2"])) - self.assertEqual(all[2 - 2 * flipped], (sub2_path, [], ["tmp3"])) - - # Tear everything down. This is a decent use for bottom-up on - # Windows, which doesn't have a recursive delete command. The - # (not so) subtlety is that rmdir will fail unless the dir's - # kids are removed first, so bottom up is essential. - for root, dirs, files in os.walk(test_support.TESTFN, topdown=False): - for name in files: - os.remove(join(root, name)) - for name in dirs: - os.rmdir(join(root, name)) - os.rmdir(test_support.TESTFN) - -class MakedirTests (unittest.TestCase): - def setUp(self): - os.mkdir(test_support.TESTFN) - - def test_makedir(self): - base = test_support.TESTFN - path = os.path.join(base, 'dir1', 'dir2', 'dir3') - os.makedirs(path) # Should work - path = os.path.join(base, 'dir1', 'dir2', 'dir3', 'dir4') - os.makedirs(path) - - # Try paths with a '.' in them - self.failUnlessRaises(OSError, os.makedirs, os.curdir) - path = os.path.join(base, 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', os.curdir) - os.makedirs(path) - path = os.path.join(base, 'dir1', os.curdir, 'dir2', 'dir3', 'dir4', - 'dir5', 'dir6') - os.makedirs(path) - - - - - def tearDown(self): - path = os.path.join(test_support.TESTFN, 'dir1', 'dir2', 'dir3', - 'dir4', 'dir5', 'dir6') - # If the tests failed, the bottom-most directory ('../dir6') - # may not have been created, so we look for the outermost directory - # that exists. - while not os.path.exists(path) and path != test_support.TESTFN: - path = os.path.dirname(path) - - os.removedirs(path) - -class DevNullTests (unittest.TestCase): - def test_devnull(self): - f = file(os.devnull, 'w') - f.write('hello') - f.close() - f = file(os.devnull, 'r') - self.assertEqual(f.read(), '') - f.close() - -class URandomTests (unittest.TestCase): - def test_urandom(self): - try: - self.assertEqual(len(os.urandom(1)), 1) - self.assertEqual(len(os.urandom(10)), 10) - self.assertEqual(len(os.urandom(100)), 100) - self.assertEqual(len(os.urandom(1000)), 1000) - except NotImplementedError: - pass - -class Win32ErrorTests(unittest.TestCase): - def test_rename(self): - self.assertRaises(WindowsError, os.rename, test_support.TESTFN, test_support.TESTFN+".bak") - - def test_remove(self): - self.assertRaises(WindowsError, os.remove, test_support.TESTFN) - - def test_chdir(self): - self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) - - def test_mkdir(self): - self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) - - def test_utime(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, None) - - def test_access(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) - - def test_chmod(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) - -if sys.platform != 'win32': - class Win32ErrorTests(unittest.TestCase): - pass - -def test_main(): - test_support.run_unittest( - FileTests, - TemporaryFileTests, - StatAttributeTests, - EnvironTests, - WalkTests, - MakedirTests, - DevNullTests, - URandomTests, - Win32ErrorTests - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_ossaudiodev.py b/sys/lib/python/test/test_ossaudiodev.py deleted file mode 100644 index 5868ea7f1..000000000 --- a/sys/lib/python/test/test_ossaudiodev.py +++ /dev/null @@ -1,163 +0,0 @@ -from test import test_support -test_support.requires('audio') - -from test.test_support import verbose, findfile, TestFailed, TestSkipped - -import errno -import fcntl -import ossaudiodev -import os -import sys -import select -import sunaudio -import time -import audioop - -# Arggh, AFMT_S16_NE not defined on all platforms -- seems to be a -# fairly recent addition to OSS. -try: - from ossaudiodev import AFMT_S16_NE -except ImportError: - if sys.byteorder == "little": - AFMT_S16_NE = ossaudiodev.AFMT_S16_LE - else: - AFMT_S16_NE = ossaudiodev.AFMT_S16_BE - - -SND_FORMAT_MULAW_8 = 1 - -def read_sound_file(path): - fp = open(path, 'rb') - size, enc, rate, nchannels, extra = sunaudio.gethdr(fp) - data = fp.read() - fp.close() - - if enc != SND_FORMAT_MULAW_8: - print "Expect .au file with 8-bit mu-law samples" - return - - # Convert the data to 16-bit signed. - data = audioop.ulaw2lin(data, 2) - return (data, rate, 16, nchannels) - -# version of assert that still works with -O -def _assert(expr, message=None): - if not expr: - raise AssertionError(message or "assertion failed") - -def play_sound_file(data, rate, ssize, nchannels): - try: - dsp = ossaudiodev.open('w') - except IOError, msg: - if msg[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY): - raise TestSkipped, msg - raise TestFailed, msg - - # at least check that these methods can be invoked - dsp.bufsize() - dsp.obufcount() - dsp.obuffree() - dsp.getptr() - dsp.fileno() - - # Make sure the read-only attributes work. - _assert(dsp.closed is False, "dsp.closed is not False") - _assert(dsp.name == "/dev/dsp") - _assert(dsp.mode == 'w', "bad dsp.mode: %r" % dsp.mode) - - # And make sure they're really read-only. - for attr in ('closed', 'name', 'mode'): - try: - setattr(dsp, attr, 42) - raise RuntimeError("dsp.%s not read-only" % attr) - except TypeError: - pass - - # Compute expected running time of sound sample (in seconds). - expected_time = float(len(data)) / (ssize/8) / nchannels / rate - - # set parameters based on .au file headers - dsp.setparameters(AFMT_S16_NE, nchannels, rate) - print ("playing test sound file (expected running time: %.2f sec)" - % expected_time) - t1 = time.time() - dsp.write(data) - dsp.close() - t2 = time.time() - elapsed_time = t2 - t1 - - percent_diff = (abs(elapsed_time - expected_time) / expected_time) * 100 - _assert(percent_diff <= 10.0, \ - ("elapsed time (%.2f sec) > 10%% off of expected time (%.2f sec)" - % (elapsed_time, expected_time))) - -def test_setparameters(dsp): - # Two configurations for testing: - # config1 (8-bit, mono, 8 kHz) should work on even the most - # ancient and crufty sound card, but maybe not on special- - # purpose high-end hardware - # config2 (16-bit, stereo, 44.1kHz) should work on all but the - # most ancient and crufty hardware - config1 = (ossaudiodev.AFMT_U8, 1, 8000) - config2 = (AFMT_S16_NE, 2, 44100) - - for config in [config1, config2]: - (fmt, channels, rate) = config - if (dsp.setfmt(fmt) == fmt and - dsp.channels(channels) == channels and - dsp.speed(rate) == rate): - break - else: - raise RuntimeError("unable to set audio sampling parameters: " - "you must have really weird audio hardware") - - # setparameters() should be able to set this configuration in - # either strict or non-strict mode. - result = dsp.setparameters(fmt, channels, rate, False) - _assert(result == (fmt, channels, rate), - "setparameters%r: returned %r" % (config, result)) - result = dsp.setparameters(fmt, channels, rate, True) - _assert(result == (fmt, channels, rate), - "setparameters%r: returned %r" % (config, result)) - -def test_bad_setparameters(dsp): - - # Now try some configurations that are presumably bogus: eg. 300 - # channels currently exceeds even Hollywood's ambitions, and - # negative sampling rate is utter nonsense. setparameters() should - # accept these in non-strict mode, returning something other than - # was requested, but should barf in strict mode. - fmt = AFMT_S16_NE - rate = 44100 - channels = 2 - for config in [(fmt, 300, rate), # ridiculous nchannels - (fmt, -5, rate), # impossible nchannels - (fmt, channels, -50), # impossible rate - ]: - (fmt, channels, rate) = config - result = dsp.setparameters(fmt, channels, rate, False) - _assert(result != config, - "setparameters: unexpectedly got requested configuration") - - try: - result = dsp.setparameters(fmt, channels, rate, True) - raise AssertionError("setparameters: expected OSSAudioError") - except ossaudiodev.OSSAudioError, err: - print "setparameters: got OSSAudioError as expected" - -def test(): - (data, rate, ssize, nchannels) = read_sound_file(findfile('audiotest.au')) - play_sound_file(data, rate, ssize, nchannels) - - dsp = ossaudiodev.open("w") - try: - test_setparameters(dsp) - - # Disabled because it fails under Linux 2.6 with ALSA's OSS - # emulation layer. - #test_bad_setparameters(dsp) - finally: - dsp.close() - _assert(dsp.closed is True, "dsp.closed is not True") - -test() diff --git a/sys/lib/python/test/test_parser.py b/sys/lib/python/test/test_parser.py deleted file mode 100644 index 8aa1657e6..000000000 --- a/sys/lib/python/test/test_parser.py +++ /dev/null @@ -1,448 +0,0 @@ -import parser -import unittest -from test import test_support - -# -# First, we test that we can generate trees from valid source fragments, -# and that these valid trees are indeed allowed by the tree-loading side -# of the parser module. -# - -class RoundtripLegalSyntaxTestCase(unittest.TestCase): - - def roundtrip(self, f, s): - st1 = f(s) - t = st1.totuple() - try: - st2 = parser.sequence2st(t) - except parser.ParserError, why: - self.fail("could not roundtrip %r: %s" % (s, why)) - - self.assertEquals(t, st2.totuple(), - "could not re-generate syntax tree") - - def check_expr(self, s): - self.roundtrip(parser.expr, s) - - def check_suite(self, s): - self.roundtrip(parser.suite, s) - - def test_yield_statement(self): - self.check_suite("def f(): yield 1") - self.check_suite("def f(): yield") - self.check_suite("def f(): x += yield") - self.check_suite("def f(): x = yield 1") - self.check_suite("def f(): x = y = yield 1") - self.check_suite("def f(): x = yield") - self.check_suite("def f(): x = y = yield") - self.check_suite("def f(): 1 + (yield)*2") - self.check_suite("def f(): (yield 1)*2") - self.check_suite("def f(): return; yield 1") - self.check_suite("def f(): yield 1; return") - self.check_suite("def f():\n" - " for x in range(30):\n" - " yield x\n") - self.check_suite("def f():\n" - " if (yield):\n" - " yield x\n") - - def test_expressions(self): - self.check_expr("foo(1)") - self.check_expr("[1, 2, 3]") - self.check_expr("[x**3 for x in range(20)]") - self.check_expr("[x**3 for x in range(20) if x % 3]") - self.check_expr("[x**3 for x in range(20) if x % 2 if x % 3]") - self.check_expr("list(x**3 for x in range(20))") - self.check_expr("list(x**3 for x in range(20) if x % 3)") - self.check_expr("list(x**3 for x in range(20) if x % 2 if x % 3)") - self.check_expr("foo(*args)") - self.check_expr("foo(*args, **kw)") - self.check_expr("foo(**kw)") - self.check_expr("foo(key=value)") - self.check_expr("foo(key=value, *args)") - self.check_expr("foo(key=value, *args, **kw)") - self.check_expr("foo(key=value, **kw)") - self.check_expr("foo(a, b, c, *args)") - self.check_expr("foo(a, b, c, *args, **kw)") - self.check_expr("foo(a, b, c, **kw)") - self.check_expr("foo + bar") - self.check_expr("foo - bar") - self.check_expr("foo * bar") - self.check_expr("foo / bar") - self.check_expr("foo // bar") - self.check_expr("lambda: 0") - self.check_expr("lambda x: 0") - self.check_expr("lambda *y: 0") - self.check_expr("lambda *y, **z: 0") - self.check_expr("lambda **z: 0") - self.check_expr("lambda x, y: 0") - self.check_expr("lambda foo=bar: 0") - self.check_expr("lambda foo=bar, spaz=nifty+spit: 0") - self.check_expr("lambda foo=bar, **z: 0") - self.check_expr("lambda foo=bar, blaz=blat+2, **z: 0") - self.check_expr("lambda foo=bar, blaz=blat+2, *y, **z: 0") - self.check_expr("lambda x, *y, **z: 0") - self.check_expr("(x for x in range(10))") - self.check_expr("foo(x for x in range(10))") - - def test_print(self): - self.check_suite("print") - self.check_suite("print 1") - self.check_suite("print 1,") - self.check_suite("print >>fp") - self.check_suite("print >>fp, 1") - self.check_suite("print >>fp, 1,") - - def test_simple_expression(self): - # expr_stmt - self.check_suite("a") - - def test_simple_assignments(self): - self.check_suite("a = b") - self.check_suite("a = b = c = d = e") - - def test_simple_augmented_assignments(self): - self.check_suite("a += b") - self.check_suite("a -= b") - self.check_suite("a *= b") - self.check_suite("a /= b") - self.check_suite("a //= b") - self.check_suite("a %= b") - self.check_suite("a &= b") - self.check_suite("a |= b") - self.check_suite("a ^= b") - self.check_suite("a <<= b") - self.check_suite("a >>= b") - self.check_suite("a **= b") - - def test_function_defs(self): - self.check_suite("def f(): pass") - self.check_suite("def f(*args): pass") - self.check_suite("def f(*args, **kw): pass") - self.check_suite("def f(**kw): pass") - self.check_suite("def f(foo=bar): pass") - self.check_suite("def f(foo=bar, *args): pass") - self.check_suite("def f(foo=bar, *args, **kw): pass") - self.check_suite("def f(foo=bar, **kw): pass") - - self.check_suite("def f(a, b): pass") - self.check_suite("def f(a, b, *args): pass") - self.check_suite("def f(a, b, *args, **kw): pass") - self.check_suite("def f(a, b, **kw): pass") - self.check_suite("def f(a, b, foo=bar): pass") - self.check_suite("def f(a, b, foo=bar, *args): pass") - self.check_suite("def f(a, b, foo=bar, *args, **kw): pass") - self.check_suite("def f(a, b, foo=bar, **kw): pass") - - self.check_suite("@staticmethod\n" - "def f(): pass") - self.check_suite("@staticmethod\n" - "@funcattrs(x, y)\n" - "def f(): pass") - self.check_suite("@funcattrs()\n" - "def f(): pass") - - def test_class_defs(self): - self.check_suite("class foo():pass") - - def test_import_from_statement(self): - self.check_suite("from sys.path import *") - self.check_suite("from sys.path import dirname") - self.check_suite("from sys.path import (dirname)") - self.check_suite("from sys.path import (dirname,)") - self.check_suite("from sys.path import dirname as my_dirname") - self.check_suite("from sys.path import (dirname as my_dirname)") - self.check_suite("from sys.path import (dirname as my_dirname,)") - self.check_suite("from sys.path import dirname, basename") - self.check_suite("from sys.path import (dirname, basename)") - self.check_suite("from sys.path import (dirname, basename,)") - self.check_suite( - "from sys.path import dirname as my_dirname, basename") - self.check_suite( - "from sys.path import (dirname as my_dirname, basename)") - self.check_suite( - "from sys.path import (dirname as my_dirname, basename,)") - self.check_suite( - "from sys.path import dirname, basename as my_basename") - self.check_suite( - "from sys.path import (dirname, basename as my_basename)") - self.check_suite( - "from sys.path import (dirname, basename as my_basename,)") - - def test_basic_import_statement(self): - self.check_suite("import sys") - self.check_suite("import sys as system") - self.check_suite("import sys, math") - self.check_suite("import sys as system, math") - self.check_suite("import sys, math as my_math") - - def test_pep263(self): - self.check_suite("# -*- coding: iso-8859-1 -*-\n" - "pass\n") - - def test_assert(self): - self.check_suite("assert alo < ahi and blo < bhi\n") - -# -# Second, we take *invalid* trees and make sure we get ParserError -# rejections for them. -# - -class IllegalSyntaxTestCase(unittest.TestCase): - - def check_bad_tree(self, tree, label): - try: - parser.sequence2st(tree) - except parser.ParserError: - pass - else: - self.fail("did not detect invalid tree for %r" % label) - - def test_junk(self): - # not even remotely valid: - self.check_bad_tree((1, 2, 3), "") - - def test_illegal_yield_1(self): - # Illegal yield statement: def f(): return 1; yield 1 - tree = \ - (257, - (264, - (285, - (259, - (1, 'def'), - (1, 'f'), - (260, (7, '('), (8, ')')), - (11, ':'), - (291, - (4, ''), - (5, ''), - (264, - (265, - (266, - (272, - (275, - (1, 'return'), - (313, - (292, - (293, - (294, - (295, - (297, - (298, - (299, - (300, - (301, - (302, (303, (304, (305, (2, '1')))))))))))))))))), - (264, - (265, - (266, - (272, - (276, - (1, 'yield'), - (313, - (292, - (293, - (294, - (295, - (297, - (298, - (299, - (300, - (301, - (302, - (303, (304, (305, (2, '1')))))))))))))))))), - (4, ''))), - (6, ''))))), - (4, ''), - (0, '')))) - self.check_bad_tree(tree, "def f():\n return 1\n yield 1") - - def test_illegal_yield_2(self): - # Illegal return in generator: def f(): return 1; yield 1 - tree = \ - (257, - (264, - (265, - (266, - (278, - (1, 'from'), - (281, (1, '__future__')), - (1, 'import'), - (279, (1, 'generators')))), - (4, ''))), - (264, - (285, - (259, - (1, 'def'), - (1, 'f'), - (260, (7, '('), (8, ')')), - (11, ':'), - (291, - (4, ''), - (5, ''), - (264, - (265, - (266, - (272, - (275, - (1, 'return'), - (313, - (292, - (293, - (294, - (295, - (297, - (298, - (299, - (300, - (301, - (302, (303, (304, (305, (2, '1')))))))))))))))))), - (264, - (265, - (266, - (272, - (276, - (1, 'yield'), - (313, - (292, - (293, - (294, - (295, - (297, - (298, - (299, - (300, - (301, - (302, - (303, (304, (305, (2, '1')))))))))))))))))), - (4, ''))), - (6, ''))))), - (4, ''), - (0, '')))) - self.check_bad_tree(tree, "def f():\n return 1\n yield 1") - - def test_print_chevron_comma(self): - # Illegal input: print >>fp, - tree = \ - (257, - (264, - (265, - (266, - (268, - (1, 'print'), - (35, '>>'), - (290, - (291, - (292, - (293, - (295, - (296, - (297, - (298, (299, (300, (301, (302, (303, (1, 'fp')))))))))))))), - (12, ','))), - (4, ''))), - (0, '')) - self.check_bad_tree(tree, "print >>fp,") - - def test_a_comma_comma_c(self): - # Illegal input: a,,c - tree = \ - (258, - (311, - (290, - (291, - (292, - (293, - (295, - (296, - (297, - (298, (299, (300, (301, (302, (303, (1, 'a')))))))))))))), - (12, ','), - (12, ','), - (290, - (291, - (292, - (293, - (295, - (296, - (297, - (298, (299, (300, (301, (302, (303, (1, 'c'))))))))))))))), - (4, ''), - (0, '')) - self.check_bad_tree(tree, "a,,c") - - def test_illegal_operator(self): - # Illegal input: a $= b - tree = \ - (257, - (264, - (265, - (266, - (267, - (312, - (291, - (292, - (293, - (294, - (296, - (297, - (298, - (299, - (300, (301, (302, (303, (304, (1, 'a'))))))))))))))), - (268, (37, '$=')), - (312, - (291, - (292, - (293, - (294, - (296, - (297, - (298, - (299, - (300, (301, (302, (303, (304, (1, 'b'))))))))))))))))), - (4, ''))), - (0, '')) - self.check_bad_tree(tree, "a $= b") - - def test_malformed_global(self): - #doesn't have global keyword in ast - tree = (257, - (264, - (265, - (266, - (282, (1, 'foo'))), (4, ''))), - (4, ''), - (0, '')) - self.check_bad_tree(tree, "malformed global ast") - - -class CompileTestCase(unittest.TestCase): - - # These tests are very minimal. :-( - - def test_compile_expr(self): - st = parser.expr('2 + 3') - code = parser.compilest(st) - self.assertEquals(eval(code), 5) - - def test_compile_suite(self): - st = parser.suite('x = 2; y = x + 3') - code = parser.compilest(st) - globs = {} - exec code in globs - self.assertEquals(globs['y'], 5) - - def test_compile_error(self): - st = parser.suite('1 = 3 + 4') - self.assertRaises(SyntaxError, parser.compilest, st) - -def test_main(): - test_support.run_unittest( - RoundtripLegalSyntaxTestCase, - IllegalSyntaxTestCase, - CompileTestCase, - ) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_peepholer.py b/sys/lib/python/test/test_peepholer.py deleted file mode 100644 index 16d0268b1..000000000 --- a/sys/lib/python/test/test_peepholer.py +++ /dev/null @@ -1,188 +0,0 @@ -import dis -import sys -from cStringIO import StringIO -import unittest - -def disassemble(func): - f = StringIO() - tmp = sys.stdout - sys.stdout = f - dis.dis(func) - sys.stdout = tmp - result = f.getvalue() - f.close() - return result - -def dis_single(line): - return disassemble(compile(line, '', 'single')) - -class TestTranforms(unittest.TestCase): - - def test_unot(self): - # UNARY_NOT JUMP_IF_FALSE POP_TOP --> JUMP_IF_TRUE POP_TOP' - def unot(x): - if not x == 2: - del x - asm = disassemble(unot) - for elem in ('UNARY_NOT', 'JUMP_IF_FALSE'): - self.assert_(elem not in asm) - for elem in ('JUMP_IF_TRUE', 'POP_TOP'): - self.assert_(elem in asm) - - def test_elim_inversion_of_is_or_in(self): - for line, elem in ( - ('not a is b', '(is not)',), - ('not a in b', '(not in)',), - ('not a is not b', '(is)',), - ('not a not in b', '(in)',), - ): - asm = dis_single(line) - self.assert_(elem in asm) - - def test_none_as_constant(self): - # LOAD_GLOBAL None --> LOAD_CONST None - def f(x): - None - return x - asm = disassemble(f) - for elem in ('LOAD_GLOBAL',): - self.assert_(elem not in asm) - for elem in ('LOAD_CONST', '(None)'): - self.assert_(elem in asm) - def f(): - 'Adding a docstring made this test fail in Py2.5.0' - return None - self.assert_('LOAD_CONST' in disassemble(f)) - self.assert_('LOAD_GLOBAL' not in disassemble(f)) - - def test_while_one(self): - # Skip over: LOAD_CONST trueconst JUMP_IF_FALSE xx POP_TOP - def f(): - while 1: - pass - return list - asm = disassemble(f) - for elem in ('LOAD_CONST', 'JUMP_IF_FALSE'): - self.assert_(elem not in asm) - for elem in ('JUMP_ABSOLUTE',): - self.assert_(elem in asm) - - def test_pack_unpack(self): - for line, elem in ( - ('a, = a,', 'LOAD_CONST',), - ('a, b = a, b', 'ROT_TWO',), - ('a, b, c = a, b, c', 'ROT_THREE',), - ): - asm = dis_single(line) - self.assert_(elem in asm) - self.assert_('BUILD_TUPLE' not in asm) - self.assert_('UNPACK_TUPLE' not in asm) - - def test_folding_of_tuples_of_constants(self): - for line, elem in ( - ('a = 1,2,3', '((1, 2, 3))'), - ('("a","b","c")', "(('a', 'b', 'c'))"), - ('a,b,c = 1,2,3', '((1, 2, 3))'), - ('(None, 1, None)', '((None, 1, None))'), - ('((1, 2), 3, 4)', '(((1, 2), 3, 4))'), - ): - asm = dis_single(line) - self.assert_(elem in asm) - self.assert_('BUILD_TUPLE' not in asm) - - # Bug 1053819: Tuple of constants misidentified when presented with: - # . . . opcode_with_arg 100 unary_opcode BUILD_TUPLE 1 . . . - # The following would segfault upon compilation - def crater(): - (~[ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - ],) - - def test_folding_of_binops_on_constants(self): - for line, elem in ( - ('a = 2+3+4', '(9)'), # chained fold - ('"@"*4', "('@@@@')"), # check string ops - ('a="abc" + "def"', "('abcdef')"), # check string ops - ('a = 3**4', '(81)'), # binary power - ('a = 3*4', '(12)'), # binary multiply - ('a = 13//4', '(3)'), # binary floor divide - ('a = 14%4', '(2)'), # binary modulo - ('a = 2+3', '(5)'), # binary add - ('a = 13-4', '(9)'), # binary subtract - ('a = (12,13)[1]', '(13)'), # binary subscr - ('a = 13 << 2', '(52)'), # binary lshift - ('a = 13 >> 2', '(3)'), # binary rshift - ('a = 13 & 7', '(5)'), # binary and - ('a = 13 ^ 7', '(10)'), # binary xor - ('a = 13 | 7', '(15)'), # binary or - ): - asm = dis_single(line) - self.assert_(elem in asm, asm) - self.assert_('BINARY_' not in asm) - - # Verify that unfoldables are skipped - asm = dis_single('a=2+"b"') - self.assert_('(2)' in asm) - self.assert_("('b')" in asm) - - # Verify that large sequences do not result from folding - asm = dis_single('a="x"*1000') - self.assert_('(1000)' in asm) - - def test_folding_of_unaryops_on_constants(self): - for line, elem in ( - ('`1`', "('1')"), # unary convert - ('-0.5', '(-0.5)'), # unary negative - ('~-2', '(1)'), # unary invert - ): - asm = dis_single(line) - self.assert_(elem in asm, asm) - self.assert_('UNARY_' not in asm) - - # Verify that unfoldables are skipped - for line, elem in ( - ('-"abc"', "('abc')"), # unary negative - ('~"abc"', "('abc')"), # unary invert - ): - asm = dis_single(line) - self.assert_(elem in asm, asm) - self.assert_('UNARY_' in asm) - - def test_elim_extra_return(self): - # RETURN LOAD_CONST None RETURN --> RETURN - def f(x): - return x - asm = disassemble(f) - self.assert_('LOAD_CONST' not in asm) - self.assert_('(None)' not in asm) - self.assertEqual(asm.split().count('RETURN_VALUE'), 1) - - - -def test_main(verbose=None): - import sys - from test import test_support - test_classes = (TestTranforms,) - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_pep247.py b/sys/lib/python/test/test_pep247.py deleted file mode 100644 index 88f246131..000000000 --- a/sys/lib/python/test/test_pep247.py +++ /dev/null @@ -1,50 +0,0 @@ -# -# Test suite to check compliance with PEP 247, the standard API for -# hashing algorithms. -# - -import md5, sha, hmac - -def check_hash_module(module, key=None): - assert hasattr(module, 'digest_size'), "Must have digest_size" - assert (module.digest_size is None or - module.digest_size > 0), "digest_size must be None or positive" - - if key is not None: - obj1 = module.new(key) - obj2 = module.new(key, "string") - - h1 = module.new(key, "string").digest() - obj3 = module.new(key) ; obj3.update("string") ; h2 = obj3.digest() - assert h1 == h2, "Hashes must match" - - else: - obj1 = module.new() - obj2 = module.new("string") - - h1 = module.new("string").digest() - obj3 = module.new() ; obj3.update("string") ; h2 = obj3.digest() - assert h1 == h2, "Hashes must match" - - assert hasattr(obj1, 'digest_size'), "Objects must have digest_size attr" - if module.digest_size is not None: - assert obj1.digest_size == module.digest_size, "digest_size must match" - assert obj1.digest_size == len(h1), "digest_size must match actual size" - obj1.update("string") - obj_copy = obj1.copy() - assert obj1.digest() == obj_copy.digest(), "Copied objects must match" - assert obj1.hexdigest() == obj_copy.hexdigest(), \ - "Copied objects must match" - digest, hexdigest = obj1.digest(), obj1.hexdigest() - hd2 = "" - for byte in digest: - hd2 += "%02x" % ord(byte) - assert hd2 == hexdigest, "hexdigest doesn't appear correct" - - print 'Module', module.__name__, 'seems to comply with PEP 247' - - -if __name__ == '__main__': - check_hash_module(md5) - check_hash_module(sha) - check_hash_module(hmac, key='abc') diff --git a/sys/lib/python/test/test_pep263.py b/sys/lib/python/test/test_pep263.py deleted file mode 100644 index 3b09c120d..000000000 --- a/sys/lib/python/test/test_pep263.py +++ /dev/null @@ -1,23 +0,0 @@ -#! -*- coding: koi8-r -*- -# This file is marked as binary in the CVS, to prevent MacCVS from recoding it. - -import unittest -from test import test_support - -class PEP263Test(unittest.TestCase): - - def test_pep263(self): - self.assertEqual( - u"ðÉÔÏÎ".encode("utf-8"), - '\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd' - ) - self.assertEqual( - u"\ð".encode("utf-8"), - '\\\xd0\x9f' - ) - -def test_main(): - test_support.run_unittest(PEP263Test) - -if __name__=="__main__": - test_main() diff --git a/sys/lib/python/test/test_pep277.py b/sys/lib/python/test/test_pep277.py deleted file mode 100644 index f3070893f..000000000 --- a/sys/lib/python/test/test_pep277.py +++ /dev/null @@ -1,115 +0,0 @@ -# Test the Unicode versions of normal file functions -# open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir -import sys, os, unittest -from test import test_support -if not os.path.supports_unicode_filenames: - raise test_support.TestSkipped, "test works only on NT+" - -filenames = [ - 'abc', - u'ascii', - u'Gr\xfc\xdf-Gott', - u'\u0393\u03b5\u03b9\u03ac-\u03c3\u03b1\u03c2', - u'\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435', - u'\u306b\u307d\u3093', - u'\u05d4\u05e9\u05e7\u05e6\u05e5\u05e1', - u'\u66e8\u66e9\u66eb', - u'\u66e8\u05e9\u3093\u0434\u0393\xdf', - ] - -# Destroy directory dirname and all files under it, to one level. -def deltree(dirname): - # Don't hide legitimate errors: if one of these suckers exists, it's - # an error if we can't remove it. - if os.path.exists(dirname): - # must pass unicode to os.listdir() so we get back unicode results. - for fname in os.listdir(unicode(dirname)): - os.unlink(os.path.join(dirname, fname)) - os.rmdir(dirname) - -class UnicodeFileTests(unittest.TestCase): - files = [os.path.join(test_support.TESTFN, f) for f in filenames] - - def setUp(self): - try: - os.mkdir(test_support.TESTFN) - except OSError: - pass - for name in self.files: - f = open(name, 'w') - f.write((name+'\n').encode("utf-8")) - f.close() - os.stat(name) - - def tearDown(self): - deltree(test_support.TESTFN) - - def _apply_failure(self, fn, filename, expected_exception, - check_fn_in_exception = True): - try: - fn(filename) - raise test_support.TestFailed("Expected to fail calling '%s(%r)'" - % (fn.__name__, filename)) - except expected_exception, details: - if check_fn_in_exception and details.filename != filename: - raise test_support.TestFailed("Function '%s(%r) failed with " - "bad filename in the exception: %r" - % (fn.__name__, filename, - details.filename)) - - def test_failures(self): - # Pass non-existing Unicode filenames all over the place. - for name in self.files: - name = "not_" + name - self._apply_failure(open, name, IOError) - self._apply_failure(os.stat, name, OSError) - self._apply_failure(os.chdir, name, OSError) - self._apply_failure(os.rmdir, name, OSError) - self._apply_failure(os.remove, name, OSError) - # listdir may append a wildcard to the filename, so dont check - self._apply_failure(os.listdir, name, OSError, False) - - def test_open(self): - for name in self.files: - f = open(name, 'w') - f.write((name+'\n').encode("utf-8")) - f.close() - os.stat(name) - - def test_listdir(self): - f1 = os.listdir(test_support.TESTFN) - # Printing f1 is not appropriate, as specific filenames - # returned depend on the local encoding - f2 = os.listdir(unicode(test_support.TESTFN, - sys.getfilesystemencoding())) - f2.sort() - print f2 - - def test_rename(self): - for name in self.files: - os.rename(name,"tmp") - os.rename("tmp",name) - - def test_directory(self): - dirname = os.path.join(test_support.TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') - filename = u'\xdf-\u66e8\u66e9\u66eb' - oldwd = os.getcwd() - os.mkdir(dirname) - os.chdir(dirname) - f = open(filename, 'w') - f.write((filename + '\n').encode("utf-8")) - f.close() - print repr(filename) - os.access(filename,os.R_OK) - os.remove(filename) - os.chdir(oldwd) - os.rmdir(dirname) - -def test_main(): - try: - test_support.run_unittest(UnicodeFileTests) - finally: - deltree(test_support.TESTFN) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_pep292.py b/sys/lib/python/test/test_pep292.py deleted file mode 100644 index d1100ea8f..000000000 --- a/sys/lib/python/test/test_pep292.py +++ /dev/null @@ -1,194 +0,0 @@ -# Copyright (C) 2004 Python Software Foundation -# Author: barry@python.org (Barry Warsaw) -# License: http://www.opensource.org/licenses/PythonSoftFoundation.php - -import unittest -from string import Template - - -class Bag: - pass - -class Mapping: - def __getitem__(self, name): - obj = self - for part in name.split('.'): - try: - obj = getattr(obj, part) - except AttributeError: - raise KeyError(name) - return obj - - -class TestTemplate(unittest.TestCase): - def test_regular_templates(self): - s = Template('$who likes to eat a bag of $what worth $$100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - self.assertRaises(KeyError, s.substitute, dict(who='tim')) - - def test_regular_templates_with_braces(self): - s = Template('$who likes ${what} for ${meal}') - d = dict(who='tim', what='ham', meal='dinner') - self.assertEqual(s.substitute(d), 'tim likes ham for dinner') - self.assertRaises(KeyError, s.substitute, - dict(who='tim', what='ham')) - - def test_escapes(self): - eq = self.assertEqual - s = Template('$who likes to eat a bag of $$what worth $$100') - eq(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of $what worth $100') - s = Template('$who likes $$') - eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') - - def test_percents(self): - eq = self.assertEqual - s = Template('%(foo)s $foo ${foo}') - d = dict(foo='baz') - eq(s.substitute(d), '%(foo)s baz baz') - eq(s.safe_substitute(d), '%(foo)s baz baz') - - def test_stringification(self): - eq = self.assertEqual - s = Template('tim has eaten $count bags of ham today') - d = dict(count=7) - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') - s = Template('tim has eaten ${count} bags of ham today') - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - - def test_tupleargs(self): - eq = self.assertEqual - s = Template('$who ate ${meal}') - d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) - eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - - def test_SafeTemplate(self): - eq = self.assertEqual - s = Template('$who likes ${what} for ${meal}') - eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') - eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') - eq(s.safe_substitute(dict(what='ham', meal='dinner')), - '$who likes ham for dinner') - eq(s.safe_substitute(dict(who='tim', what='ham')), - 'tim likes ham for ${meal}') - eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), - 'tim likes ham for dinner') - - def test_invalid_placeholders(self): - raises = self.assertRaises - s = Template('$who likes $') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes ${what)') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes $100') - raises(ValueError, s.substitute, dict(who='tim')) - - def test_delimiter_override(self): - class PieDelims(Template): - delimiter = '@' - s = PieDelims('@who likes to eat a bag of @{what} worth $100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - - def test_idpattern_override(self): - class PathPattern(Template): - idpattern = r'[_a-z][._a-z0-9]*' - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - def test_pattern_override(self): - class MyPattern(Template): - pattern = r""" - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) - """ - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - class BadPattern(Template): - pattern = r""" - (?P.*) | - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) | - """ - s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertRaises(ValueError, s.substitute, {}) - self.assertRaises(ValueError, s.safe_substitute, {}) - - def test_unicode_values(self): - s = Template('$who likes $what') - d = dict(who=u't\xffm', what=u'f\xfe\fed') - self.assertEqual(s.substitute(d), u't\xffm likes f\xfe\x0ced') - - def test_keyword_arguments(self): - eq = self.assertEqual - s = Template('$who likes $what') - eq(s.substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - - def test_keyword_arguments_safe(self): - eq = self.assertEqual - raises = self.assertRaises - s = Template('$who likes $what') - eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.safe_substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - d = dict(mapping='one') - raises(TypeError, s.substitute, d, {}) - raises(TypeError, s.safe_substitute, d, {}) - - def test_delimiter_override(self): - eq = self.assertEqual - raises = self.assertRaises - class AmpersandTemplate(Template): - delimiter = '&' - s = AmpersandTemplate('this &gift is for &{who} &&') - eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') - raises(KeyError, s.substitute) - eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &') - eq(s.safe_substitute(), 'this &gift is for &{who} &') - s = AmpersandTemplate('this &gift is for &{who} &') - raises(ValueError, s.substitute, dict(gift='bud', who='you')) - eq(s.safe_substitute(), 'this &gift is for &{who} &') - - -def test_main(): - from test import test_support - test_classes = [TestTemplate,] - test_support.run_unittest(*test_classes) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_pep352.py b/sys/lib/python/test/test_pep352.py deleted file mode 100644 index b2322b0a3..000000000 --- a/sys/lib/python/test/test_pep352.py +++ /dev/null @@ -1,182 +0,0 @@ -import unittest -import __builtin__ -import exceptions -import warnings -from test.test_support import run_unittest -import os -from platform import system as platform_system - -class ExceptionClassTests(unittest.TestCase): - - """Tests for anything relating to exception objects themselves (e.g., - inheritance hierarchy)""" - - def test_builtins_new_style(self): - self.failUnless(issubclass(Exception, object)) - - def verify_instance_interface(self, ins): - for attr in ("args", "message", "__str__", "__repr__", "__getitem__"): - self.failUnless(hasattr(ins, attr), "%s missing %s attribute" % - (ins.__class__.__name__, attr)) - - def test_inheritance(self): - # Make sure the inheritance hierarchy matches the documentation - exc_set = set(x for x in dir(exceptions) if not x.startswith('_')) - inheritance_tree = open(os.path.join(os.path.split(__file__)[0], - 'exception_hierarchy.txt')) - try: - superclass_name = inheritance_tree.readline().rstrip() - try: - last_exc = getattr(__builtin__, superclass_name) - except AttributeError: - self.fail("base class %s not a built-in" % superclass_name) - self.failUnless(superclass_name in exc_set) - exc_set.discard(superclass_name) - superclasses = [] # Loop will insert base exception - last_depth = 0 - for exc_line in inheritance_tree: - exc_line = exc_line.rstrip() - depth = exc_line.rindex('-') - exc_name = exc_line[depth+2:] # Slice past space - if '(' in exc_name: - paren_index = exc_name.index('(') - platform_name = exc_name[paren_index+1:-1] - exc_name = exc_name[:paren_index-1] # Slice off space - if platform_system() != platform_name: - exc_set.discard(exc_name) - continue - if '[' in exc_name: - left_bracket = exc_name.index('[') - exc_name = exc_name[:left_bracket-1] # cover space - try: - exc = getattr(__builtin__, exc_name) - except AttributeError: - self.fail("%s not a built-in exception" % exc_name) - if last_depth < depth: - superclasses.append((last_depth, last_exc)) - elif last_depth > depth: - while superclasses[-1][0] >= depth: - superclasses.pop() - self.failUnless(issubclass(exc, superclasses[-1][1]), - "%s is not a subclass of %s" % (exc.__name__, - superclasses[-1][1].__name__)) - try: # Some exceptions require arguments; just skip them - self.verify_instance_interface(exc()) - except TypeError: - pass - self.failUnless(exc_name in exc_set) - exc_set.discard(exc_name) - last_exc = exc - last_depth = depth - finally: - inheritance_tree.close() - self.failUnlessEqual(len(exc_set), 0, "%s not accounted for" % exc_set) - - interface_tests = ("length", "args", "message", "str", "unicode", "repr", - "indexing") - - def interface_test_driver(self, results): - for test_name, (given, expected) in zip(self.interface_tests, results): - self.failUnlessEqual(given, expected, "%s: %s != %s" % (test_name, - given, expected)) - - def test_interface_single_arg(self): - # Make sure interface works properly when given a single argument - arg = "spam" - exc = Exception(arg) - results = ([len(exc.args), 1], [exc.args[0], arg], [exc.message, arg], - [str(exc), str(arg)], [unicode(exc), unicode(arg)], - [repr(exc), exc.__class__.__name__ + repr(exc.args)], [exc[0], arg]) - self.interface_test_driver(results) - - def test_interface_multi_arg(self): - # Make sure interface correct when multiple arguments given - arg_count = 3 - args = tuple(range(arg_count)) - exc = Exception(*args) - results = ([len(exc.args), arg_count], [exc.args, args], - [exc.message, ''], [str(exc), str(args)], - [unicode(exc), unicode(args)], - [repr(exc), exc.__class__.__name__ + repr(exc.args)], - [exc[-1], args[-1]]) - self.interface_test_driver(results) - - def test_interface_no_arg(self): - # Make sure that with no args that interface is correct - exc = Exception() - results = ([len(exc.args), 0], [exc.args, tuple()], [exc.message, ''], - [str(exc), ''], [unicode(exc), u''], - [repr(exc), exc.__class__.__name__ + '()'], [True, True]) - self.interface_test_driver(results) - -class UsageTests(unittest.TestCase): - - """Test usage of exceptions""" - - def setUp(self): - self._filters = warnings.filters[:] - - def tearDown(self): - warnings.filters = self._filters[:] - - def test_raise_classic(self): - class ClassicClass: - pass - try: - raise ClassicClass - except ClassicClass: - pass - except: - self.fail("unable to raise classic class") - try: - raise ClassicClass() - except ClassicClass: - pass - except: - self.fail("unable to raise class class instance") - - def test_raise_new_style_non_exception(self): - class NewStyleClass(object): - pass - try: - raise NewStyleClass - except TypeError: - pass - except: - self.fail("unable to raise new-style class") - try: - raise NewStyleClass() - except TypeError: - pass - except: - self.fail("unable to raise new-style class instance") - - def test_raise_string(self): - warnings.resetwarnings() - warnings.filterwarnings("error") - try: - raise "spam" - except DeprecationWarning: - pass - except: - self.fail("raising a string did not cause a DeprecationWarning") - - def test_catch_string(self): - # Test will be pertinent when catching exceptions raises a - # DeprecationWarning - warnings.filterwarnings("ignore", "raising") - str_exc = "spam" - try: - raise str_exc - except str_exc: - pass - except: - self.fail("catching a string exception failed") - -def test_main(): - run_unittest(ExceptionClassTests, UsageTests) - - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_pickle.py b/sys/lib/python/test/test_pickle.py deleted file mode 100644 index 585644e10..000000000 --- a/sys/lib/python/test/test_pickle.py +++ /dev/null @@ -1,73 +0,0 @@ -import pickle -import unittest -from cStringIO import StringIO - -from test import test_support - -from test.pickletester import AbstractPickleTests -from test.pickletester import AbstractPickleModuleTests -from test.pickletester import AbstractPersistentPicklerTests - -class PickleTests(AbstractPickleTests, AbstractPickleModuleTests): - - def dumps(self, arg, proto=0, fast=0): - # Ignore fast - return pickle.dumps(arg, proto) - - def loads(self, buf): - # Ignore fast - return pickle.loads(buf) - - module = pickle - error = KeyError - -class PicklerTests(AbstractPickleTests): - - error = KeyError - - def dumps(self, arg, proto=0, fast=0): - f = StringIO() - p = pickle.Pickler(f, proto) - if fast: - p.fast = fast - p.dump(arg) - f.seek(0) - return f.read() - - def loads(self, buf): - f = StringIO(buf) - u = pickle.Unpickler(f) - return u.load() - -class PersPicklerTests(AbstractPersistentPicklerTests): - - def dumps(self, arg, proto=0, fast=0): - class PersPickler(pickle.Pickler): - def persistent_id(subself, obj): - return self.persistent_id(obj) - f = StringIO() - p = PersPickler(f, proto) - if fast: - p.fast = fast - p.dump(arg) - f.seek(0) - return f.read() - - def loads(self, buf): - class PersUnpickler(pickle.Unpickler): - def persistent_load(subself, obj): - return self.persistent_load(obj) - f = StringIO(buf) - u = PersUnpickler(f) - return u.load() - -def test_main(): - test_support.run_unittest( - PickleTests, - PicklerTests, - PersPicklerTests - ) - test_support.run_doctest(pickle) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_pickletools.py b/sys/lib/python/test/test_pickletools.py deleted file mode 100644 index 2e2fe50b0..000000000 --- a/sys/lib/python/test/test_pickletools.py +++ /dev/null @@ -1,3 +0,0 @@ -import pickletools -from test import test_support -test_support.run_doctest(pickletools) diff --git a/sys/lib/python/test/test_pkg.py b/sys/lib/python/test/test_pkg.py deleted file mode 100644 index 919a019ca..000000000 --- a/sys/lib/python/test/test_pkg.py +++ /dev/null @@ -1,259 +0,0 @@ -# Test packages (dotted-name import) - -import sys, os, tempfile, traceback -from os import mkdir, rmdir, extsep # Can't test if these fail -del mkdir, rmdir -from test.test_support import verify, verbose, TestFailed - -# Helpers to create and destroy hierarchies. - -def mkhier(root, descr): - if not os.path.isdir(root): - mkdir(root) - for name, contents in descr: - comps = name.split() - fullname = root - for c in comps: - fullname = os.path.join(fullname, c) - if contents is None: - mkdir(fullname) - else: - if verbose: print "write", fullname - f = open(fullname, "w") - f.write(contents) - if contents and contents[-1] != '\n': - f.write('\n') - f.close() - -def mkdir(x): - if verbose: print "mkdir", x - os.mkdir(x) - -def cleanout(root): - names = os.listdir(root) - for name in names: - fullname = os.path.join(root, name) - if os.path.isdir(fullname) and not os.path.islink(fullname): - cleanout(fullname) - else: - os.remove(fullname) - rmdir(root) - -def rmdir(x): - if verbose: print "rmdir", x - os.rmdir(x) - -def fixdir(lst): - try: - lst.remove('__builtins__') - except ValueError: - pass - return lst - -# Helper to run a test - -def runtest(hier, code): - root = tempfile.mkdtemp() - mkhier(root, hier) - savepath = sys.path[:] - fd, fname = tempfile.mkstemp(text=True) - os.write(fd, code) - os.close(fd) - try: - sys.path.insert(0, root) - if verbose: print "sys.path =", sys.path - try: - execfile(fname, globals(), {}) - except: - traceback.print_exc(file=sys.stdout) - finally: - sys.path[:] = savepath - os.unlink(fname) - try: - cleanout(root) - except (os.error, IOError): - pass - -# Test descriptions - -tests = [ - ("t1", [("t1", None), ("t1 __init__"+os.extsep+"py", "")], "import t1"), - - ("t2", [ - ("t2", None), - ("t2 __init__"+os.extsep+"py", "'doc for t2'; print __name__, 'loading'"), - ("t2 sub", None), - ("t2 sub __init__"+os.extsep+"py", ""), - ("t2 sub subsub", None), - ("t2 sub subsub __init__"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), - ], -""" -import t2 -print t2.__doc__ -import t2.sub -import t2.sub.subsub -print t2.__name__, t2.sub.__name__, t2.sub.subsub.__name__ -import t2 -from t2 import * -print dir() -from t2 import sub -from t2.sub import subsub -from t2.sub.subsub import spam -print sub.__name__, subsub.__name__ -print sub.subsub.__name__ -print dir() -import t2.sub -import t2.sub.subsub -print t2.__name__, t2.sub.__name__, t2.sub.subsub.__name__ -from t2 import * -print dir() -"""), - - ("t3", [ - ("t3", None), - ("t3 __init__"+os.extsep+"py", "print __name__, 'loading'"), - ("t3 sub", None), - ("t3 sub __init__"+os.extsep+"py", ""), - ("t3 sub subsub", None), - ("t3 sub subsub __init__"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), - ], -""" -import t3.sub.subsub -print t3.__name__, t3.sub.__name__, t3.sub.subsub.__name__ -reload(t3) -reload(t3.sub) -reload(t3.sub.subsub) -"""), - - ("t4", [ - ("t4"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (t4"+os.extsep+"py)'"), - ("t4", None), - ("t4 __init__"+os.extsep+"py", "print __name__, 'loading'"), - ("t4 sub"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)'"), - ("t4 sub", None), - ("t4 sub __init__"+os.extsep+"py", ""), - ("t4 sub subsub"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)'"), - ("t4 sub subsub", None), - ("t4 sub subsub __init__"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), - ], -""" -from t4.sub.subsub import * -print "t4.sub.subsub.spam =", spam -"""), - - ("t5", [ - ("t5", None), - ("t5 __init__"+os.extsep+"py", "import t5.foo"), - ("t5 string"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), - ("t5 foo"+os.extsep+"py", - "print __name__, 'loading'; import string; print string.spam"), - ], -""" -import t5 -from t5 import * -print dir() -import t5 -print fixdir(dir(t5)) -print fixdir(dir(t5.foo)) -print fixdir(dir(t5.string)) -"""), - - ("t6", [ - ("t6", None), - ("t6 __init__"+os.extsep+"py", "__all__ = ['spam', 'ham', 'eggs']"), - ("t6 spam"+os.extsep+"py", "print __name__, 'loading'"), - ("t6 ham"+os.extsep+"py", "print __name__, 'loading'"), - ("t6 eggs"+os.extsep+"py", "print __name__, 'loading'"), - ], -""" -import t6 -print fixdir(dir(t6)) -from t6 import * -print fixdir(dir(t6)) -print dir() -"""), - - ("t7", [ - ("t7"+os.extsep+"py", "print 'Importing t7"+os.extsep+"py'"), - ("t7", None), - ("t7 __init__"+os.extsep+"py", "print __name__, 'loading'"), - ("t7 sub"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)'"), - ("t7 sub", None), - ("t7 sub __init__"+os.extsep+"py", ""), - ("t7 sub subsub"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)'"), - ("t7 sub subsub", None), - ("t7 sub subsub __init__"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), - ], -""" -t7, sub, subsub = None, None, None -import t7 as tas -print fixdir(dir(tas)) -verify(not t7) -from t7 import sub as subpar -print fixdir(dir(subpar)) -verify(not t7 and not sub) -from t7.sub import subsub as subsubsub -print fixdir(dir(subsubsub)) -verify(not t7 and not sub and not subsub) -from t7.sub.subsub import spam as ham -print "t7.sub.subsub.spam =", ham -verify(not t7 and not sub and not subsub) -"""), - -] - -nontests = [ - ("x5", [], ("import a" + ".a"*400)), - ("x6", [], ("import a" + ".a"*499)), - ("x7", [], ("import a" + ".a"*500)), - ("x8", [], ("import a" + ".a"*1100)), - ("x9", [], ("import " + "a"*400)), - ("x10", [], ("import " + "a"*500)), - ("x11", [], ("import " + "a"*998)), - ("x12", [], ("import " + "a"*999)), - ("x13", [], ("import " + "a"*999)), - ("x14", [], ("import " + "a"*2000)), -] - -"""XXX Things to test - -import package without __init__ -import package with __init__ -__init__ importing submodule -__init__ importing global module -__init__ defining variables -submodule importing other submodule -submodule importing global module -submodule import submodule via global name -from package import submodule -from package import subpackage -from package import variable (defined in __init__) -from package import * (defined in __init__) -""" - -# Run the tests - -args = [] -if __name__ == '__main__': - args = sys.argv[1:] - if args and args[0] == '-q': - verbose = 0 - del args[0] - -for name, hier, code in tests: - if args and name not in args: - print "skipping test", name - continue - print "running test", name - runtest(hier, code) - -# Test -import sys -import imp -try: - import sys.imp -except ImportError: - # This is what we expect - pass -else: - raise TestFailed, "No ImportError exception on 'import sys.imp'" diff --git a/sys/lib/python/test/test_pkgimport.py b/sys/lib/python/test/test_pkgimport.py deleted file mode 100644 index c87c342b7..000000000 --- a/sys/lib/python/test/test_pkgimport.py +++ /dev/null @@ -1,82 +0,0 @@ -import os, sys, string, random, tempfile, unittest - -from test.test_support import run_unittest - -class TestImport(unittest.TestCase): - - def __init__(self, *args, **kw): - self.package_name = 'PACKAGE_' - while sys.modules.has_key(self.package_name): - self.package_name += random.choose(string.letters) - self.module_name = self.package_name + '.foo' - unittest.TestCase.__init__(self, *args, **kw) - - def remove_modules(self): - for module_name in (self.package_name, self.module_name): - if sys.modules.has_key(module_name): - del sys.modules[module_name] - - def setUp(self): - self.test_dir = tempfile.mkdtemp() - sys.path.append(self.test_dir) - self.package_dir = os.path.join(self.test_dir, - self.package_name) - os.mkdir(self.package_dir) - open(os.path.join(self.package_dir, '__init__'+os.extsep+'py'), 'w') - self.module_path = os.path.join(self.package_dir, 'foo'+os.extsep+'py') - - def tearDown(self): - for file in os.listdir(self.package_dir): - os.remove(os.path.join(self.package_dir, file)) - os.rmdir(self.package_dir) - os.rmdir(self.test_dir) - self.assertNotEqual(sys.path.count(self.test_dir), 0) - sys.path.remove(self.test_dir) - self.remove_modules() - - def rewrite_file(self, contents): - for extension in "co": - compiled_path = self.module_path + extension - if os.path.exists(compiled_path): - os.remove(compiled_path) - f = open(self.module_path, 'w') - f.write(contents) - f.close() - - def test_package_import__semantics(self): - - # Generate a couple of broken modules to try importing. - - # ...try loading the module when there's a SyntaxError - self.rewrite_file('for') - try: __import__(self.module_name) - except SyntaxError: pass - else: raise RuntimeError, 'Failed to induce SyntaxError' - self.assert_(not sys.modules.has_key(self.module_name) and - not hasattr(sys.modules[self.package_name], 'foo')) - - # ...make up a variable name that isn't bound in __builtins__ - var = 'a' - while var in dir(__builtins__): - var += random.choose(string.letters) - - # ...make a module that just contains that - self.rewrite_file(var) - - try: __import__(self.module_name) - except NameError: pass - else: raise RuntimeError, 'Failed to induce NameError.' - - # ...now change the module so that the NameError doesn't - # happen - self.rewrite_file('%s = 1' % var) - module = __import__(self.module_name).foo - self.assertEqual(getattr(module, var), 1) - - -def test_main(): - run_unittest(TestImport) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_platform.py b/sys/lib/python/test/test_platform.py deleted file mode 100644 index 22307cd65..000000000 --- a/sys/lib/python/test/test_platform.py +++ /dev/null @@ -1,79 +0,0 @@ -import unittest -from test import test_support -import platform - -class PlatformTest(unittest.TestCase): - def test_architecture(self): - res = platform.architecture() - - def test_machine(self): - res = platform.machine() - - def test_node(self): - res = platform.node() - - def test_platform(self): - for aliased in (False, True): - for terse in (False, True): - res = platform.platform(aliased, terse) - - def test_processor(self): - res = platform.processor() - - def test_python_build(self): - res = platform.python_build() - - def test_python_compiler(self): - res = platform.python_compiler() - - def test_version(self): - res1 = platform.version() - res2 = platform.version_tuple() - self.assertEqual(res1, ".".join(res2)) - - def test_release(self): - res = platform.release() - - def test_system(self): - res = platform.system() - - def test_version(self): - res = platform.version() - - def test_system_alias(self): - res = platform.system_alias( - platform.system(), - platform.release(), - platform.version(), - ) - - def test_uname(self): - res = platform.uname() - - def test_java_ver(self): - res = platform.java_ver() - - def test_win32_ver(self): - res = platform.win32_ver() - - def test_mac_ver(self): - res = platform.mac_ver() - - def test_dist(self): - res = platform.dist() - - def test_libc_ver(self): - from sys import executable - import os - if os.path.isdir(executable) and os.path.exists(executable+'.exe'): - # Cygwin horror - executable = executable + '.exe' - res = platform.libc_ver(executable) - -def test_main(): - test_support.run_unittest( - PlatformTest - ) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_plistlib.py b/sys/lib/python/test/test_plistlib.py deleted file mode 100644 index 8e8d3e380..000000000 --- a/sys/lib/python/test/test_plistlib.py +++ /dev/null @@ -1,193 +0,0 @@ -# Copyright (C) 2003 Python Software Foundation - -import unittest -import plistlib -import os -import time -import datetime -from test import test_support - - -# This test data was generated through Cocoa's NSDictionary class -TESTDATA = """ - - - - aDate - 2004-10-26T10:33:33Z - aDict - - aFalseValue - - aTrueValue - - aUnicodeValue - M\xc3\xa4ssig, Ma\xc3\x9f - anotherString - <hello & 'hi' there!> - deeperDict - - a - 17 - b - 32.5 - c - - 1 - 2 - text - - - - aFloat - 0.5 - aList - - A - B - 12 - 32.5 - - 1 - 2 - 3 - - - aString - Doodah - anInt - 728 - nestedData - - - PGxvdHMgb2YgYmluYXJ5IGd1bms+AAECAzxsb3RzIG9mIGJpbmFyeSBndW5r - PgABAgM8bG90cyBvZiBiaW5hcnkgZ3Vuaz4AAQIDPGxvdHMgb2YgYmluYXJ5 - IGd1bms+AAECAzxsb3RzIG9mIGJpbmFyeSBndW5rPgABAgM8bG90cyBvZiBi - aW5hcnkgZ3Vuaz4AAQIDPGxvdHMgb2YgYmluYXJ5IGd1bms+AAECAzxsb3Rz - IG9mIGJpbmFyeSBndW5rPgABAgM8bG90cyBvZiBiaW5hcnkgZ3Vuaz4AAQID - PGxvdHMgb2YgYmluYXJ5IGd1bms+AAECAw== - - - someData - - PGJpbmFyeSBndW5rPg== - - someMoreData - - PGxvdHMgb2YgYmluYXJ5IGd1bms+AAECAzxsb3RzIG9mIGJpbmFyeSBndW5rPgABAgM8 - bG90cyBvZiBiaW5hcnkgZ3Vuaz4AAQIDPGxvdHMgb2YgYmluYXJ5IGd1bms+AAECAzxs - b3RzIG9mIGJpbmFyeSBndW5rPgABAgM8bG90cyBvZiBiaW5hcnkgZ3Vuaz4AAQIDPGxv - dHMgb2YgYmluYXJ5IGd1bms+AAECAzxsb3RzIG9mIGJpbmFyeSBndW5rPgABAgM8bG90 - cyBvZiBiaW5hcnkgZ3Vuaz4AAQIDPGxvdHMgb2YgYmluYXJ5IGd1bms+AAECAw== - - \xc3\x85benraa - That was a unicode key. - - -""".replace(" " * 8, "\t") # Apple as well as plistlib.py output hard tabs - - -class TestPlistlib(unittest.TestCase): - - def tearDown(self): - try: - os.unlink(test_support.TESTFN) - except: - pass - - def _create(self): - pl = dict( - aString="Doodah", - aList=["A", "B", 12, 32.5, [1, 2, 3]], - aFloat = 0.5, - anInt = 728, - aDict=dict( - anotherString="", - aUnicodeValue=u'M\xe4ssig, Ma\xdf', - aTrueValue=True, - aFalseValue=False, - deeperDict=dict(a=17, b=32.5, c=[1, 2, "text"]), - ), - someData = plistlib.Data(""), - someMoreData = plistlib.Data("\0\1\2\3" * 10), - nestedData = [plistlib.Data("\0\1\2\3" * 10)], - aDate = datetime.datetime(2004, 10, 26, 10, 33, 33), - ) - pl[u'\xc5benraa'] = "That was a unicode key." - return pl - - def test_create(self): - pl = self._create() - self.assertEqual(pl["aString"], "Doodah") - self.assertEqual(pl["aDict"]["aFalseValue"], False) - - def test_io(self): - pl = self._create() - plistlib.writePlist(pl, test_support.TESTFN) - pl2 = plistlib.readPlist(test_support.TESTFN) - self.assertEqual(dict(pl), dict(pl2)) - - def test_string(self): - pl = self._create() - data = plistlib.writePlistToString(pl) - pl2 = plistlib.readPlistFromString(data) - self.assertEqual(dict(pl), dict(pl2)) - data2 = plistlib.writePlistToString(pl2) - self.assertEqual(data, data2) - - def test_appleformatting(self): - pl = plistlib.readPlistFromString(TESTDATA) - data = plistlib.writePlistToString(pl) - self.assertEqual(data, TESTDATA, - "generated data was not identical to Apple's output") - - def test_appleformattingfromliteral(self): - pl = self._create() - pl2 = plistlib.readPlistFromString(TESTDATA) - self.assertEqual(dict(pl), dict(pl2), - "generated data was not identical to Apple's output") - - def test_stringio(self): - from StringIO import StringIO - f = StringIO() - pl = self._create() - plistlib.writePlist(pl, f) - pl2 = plistlib.readPlist(StringIO(f.getvalue())) - self.assertEqual(dict(pl), dict(pl2)) - - def test_cstringio(self): - from cStringIO import StringIO - f = StringIO() - pl = self._create() - plistlib.writePlist(pl, f) - pl2 = plistlib.readPlist(StringIO(f.getvalue())) - self.assertEqual(dict(pl), dict(pl2)) - - def test_controlcharacters(self): - for i in range(128): - c = chr(i) - testString = "string containing %s" % c - if i >= 32 or c in "\r\n\t": - # \r, \n and \t are the only legal control chars in XML - plistlib.writePlistToString(testString) - else: - self.assertRaises(ValueError, - plistlib.writePlistToString, - testString) - - def test_nondictroot(self): - test1 = "abc" - test2 = [1, 2, 3, "abc"] - result1 = plistlib.readPlistFromString(plistlib.writePlistToString(test1)) - result2 = plistlib.readPlistFromString(plistlib.writePlistToString(test2)) - self.assertEqual(test1, result1) - self.assertEqual(test2, result2) - - -def test_main(): - test_support.run_unittest(TestPlistlib) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_poll.py b/sys/lib/python/test/test_poll.py deleted file mode 100644 index 3a48bceca..000000000 --- a/sys/lib/python/test/test_poll.py +++ /dev/null @@ -1,192 +0,0 @@ -# Test case for the os.poll() function - -import sys, os, select, random -from test.test_support import verify, verbose, TestSkipped, TESTFN - -try: - select.poll -except AttributeError: - raise TestSkipped, "select.poll not defined -- skipping test_poll" - - -def find_ready_matching(ready, flag): - match = [] - for fd, mode in ready: - if mode & flag: - match.append(fd) - return match - -def test_poll1(): - """Basic functional test of poll object - - Create a bunch of pipe and test that poll works with them. - """ - print 'Running poll test 1' - p = select.poll() - - NUM_PIPES = 12 - MSG = " This is a test." - MSG_LEN = len(MSG) - readers = [] - writers = [] - r2w = {} - w2r = {} - - for i in range(NUM_PIPES): - rd, wr = os.pipe() - p.register(rd, select.POLLIN) - p.register(wr, select.POLLOUT) - readers.append(rd) - writers.append(wr) - r2w[rd] = wr - w2r[wr] = rd - - while writers: - ready = p.poll() - ready_writers = find_ready_matching(ready, select.POLLOUT) - if not ready_writers: - raise RuntimeError, "no pipes ready for writing" - wr = random.choice(ready_writers) - os.write(wr, MSG) - - ready = p.poll() - ready_readers = find_ready_matching(ready, select.POLLIN) - if not ready_readers: - raise RuntimeError, "no pipes ready for reading" - rd = random.choice(ready_readers) - buf = os.read(rd, MSG_LEN) - verify(len(buf) == MSG_LEN) - print buf - os.close(r2w[rd]) ; os.close( rd ) - p.unregister( r2w[rd] ) - p.unregister( rd ) - writers.remove(r2w[rd]) - - poll_unit_tests() - print 'Poll test 1 complete' - -def poll_unit_tests(): - # returns NVAL for invalid file descriptor - FD = 42 - try: - os.close(FD) - except OSError: - pass - p = select.poll() - p.register(FD) - r = p.poll() - verify(r[0] == (FD, select.POLLNVAL)) - - f = open(TESTFN, 'w') - fd = f.fileno() - p = select.poll() - p.register(f) - r = p.poll() - verify(r[0][0] == fd) - f.close() - r = p.poll() - verify(r[0] == (fd, select.POLLNVAL)) - os.unlink(TESTFN) - - # type error for invalid arguments - p = select.poll() - try: - p.register(p) - except TypeError: - pass - else: - print "Bogus register call did not raise TypeError" - try: - p.unregister(p) - except TypeError: - pass - else: - print "Bogus unregister call did not raise TypeError" - - # can't unregister non-existent object - p = select.poll() - try: - p.unregister(3) - except KeyError: - pass - else: - print "Bogus unregister call did not raise KeyError" - - # Test error cases - pollster = select.poll() - class Nope: - pass - - class Almost: - def fileno(self): - return 'fileno' - - try: - pollster.register( Nope(), 0 ) - except TypeError: pass - else: print 'expected TypeError exception, not raised' - - try: - pollster.register( Almost(), 0 ) - except TypeError: pass - else: print 'expected TypeError exception, not raised' - - -# Another test case for poll(). This is copied from the test case for -# select(), modified to use poll() instead. - -def test_poll2(): - print 'Running poll test 2' - cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' - p = os.popen(cmd, 'r') - pollster = select.poll() - pollster.register( p, select.POLLIN ) - for tout in (0, 1000, 2000, 4000, 8000, 16000) + (-1,)*10: - if verbose: - print 'timeout =', tout - fdlist = pollster.poll(tout) - if (fdlist == []): - continue - fd, flags = fdlist[0] - if flags & select.POLLHUP: - line = p.readline() - if line != "": - print 'error: pipe seems to be closed, but still returns data' - continue - - elif flags & select.POLLIN: - line = p.readline() - if verbose: - print repr(line) - if not line: - if verbose: - print 'EOF' - break - continue - else: - print 'Unexpected return value from select.poll:', fdlist - p.close() - print 'Poll test 2 complete' - -def test_poll3(): - # test int overflow - print 'Running poll test 3' - pollster = select.poll() - pollster.register(1) - - try: - pollster.poll(1L << 64) - except OverflowError: - pass - else: - print 'Expected OverflowError with excessive timeout' - - x = 2 + 3 - if x != 5: - print 'Overflow must have occurred' - print 'Poll test 3 complete' - - -test_poll1() -test_poll2() -test_poll3() diff --git a/sys/lib/python/test/test_popen.py b/sys/lib/python/test/test_popen.py deleted file mode 100644 index fbf5e054e..000000000 --- a/sys/lib/python/test/test_popen.py +++ /dev/null @@ -1,40 +0,0 @@ -#! /usr/bin/env python -"""Basic tests for os.popen() - - Particularly useful for platforms that fake popen. -""" - -import os -import sys -from test.test_support import TestSkipped, reap_children -from os import popen - -# Test that command-lines get down as we expect. -# To do this we execute: -# python -c "import sys;print sys.argv" {rest_of_commandline} -# This results in Python being spawned and printing the sys.argv list. -# We can then eval() the result of this, and see what each argv was. -python = sys.executable -if ' ' in python: - python = '"' + python + '"' # quote embedded space for cmdline -def _do_test_commandline(cmdline, expected): - cmd = '%s -c "import sys;print sys.argv" %s' % (python, cmdline) - data = popen(cmd).read() - got = eval(data)[1:] # strip off argv[0] - if got != expected: - print "Error in popen commandline handling." - print " executed '%s', expected '%r', but got '%r'" \ - % (cmdline, expected, got) - -def _test_commandline(): - _do_test_commandline("foo bar", ["foo", "bar"]) - _do_test_commandline('foo "spam and eggs" "silly walk"', ["foo", "spam and eggs", "silly walk"]) - _do_test_commandline('foo "a \\"quoted\\" arg" bar', ["foo", 'a "quoted" arg', "bar"]) - print "popen seemed to process the command-line correctly" - -def main(): - print "Test popen:" - _test_commandline() - reap_children() - -main() diff --git a/sys/lib/python/test/test_popen2.py b/sys/lib/python/test/test_popen2.py deleted file mode 100644 index 2d54eb008..000000000 --- a/sys/lib/python/test/test_popen2.py +++ /dev/null @@ -1,78 +0,0 @@ -#! /usr/bin/env python -"""Test script for popen2.py - Christian Tismer -""" - -import os -import sys -from test.test_support import TestSkipped, reap_children - -# popen2 contains its own testing routine -# which is especially useful to see if open files -# like stdin can be read successfully by a forked -# subprocess. - -def main(): - print "Test popen2 module:" - if (sys.platform[:4] == 'beos' or sys.platform[:6] == 'atheos') \ - and __name__ != '__main__': - # Locks get messed up or something. Generally we're supposed - # to avoid mixing "posix" fork & exec with native threads, and - # they may be right about that after all. - raise TestSkipped, "popen2() doesn't work during import on " + sys.platform - try: - from os import popen - except ImportError: - # if we don't have os.popen, check that - # we have os.fork. if not, skip the test - # (by raising an ImportError) - from os import fork - import popen2 - popen2._test() - - -def _test(): - # same test as popen2._test(), but using the os.popen*() API - print "Testing os module:" - import popen2 - # When the test runs, there shouldn't be any open pipes - popen2._cleanup() - assert not popen2._active, "Active pipes when test starts " + repr([c.cmd for c in popen2._active]) - cmd = "cat" - teststr = "ab cd\n" - if os.name == "nt": - cmd = "more" - # "more" doesn't act the same way across Windows flavors, - # sometimes adding an extra newline at the start or the - # end. So we strip whitespace off both ends for comparison. - expected = teststr.strip() - print "testing popen2..." - w, r = os.popen2(cmd) - w.write(teststr) - w.close() - got = r.read() - if got.strip() != expected: - raise ValueError("wrote %r read %r" % (teststr, got)) - print "testing popen3..." - try: - w, r, e = os.popen3([cmd]) - except: - w, r, e = os.popen3(cmd) - w.write(teststr) - w.close() - got = r.read() - if got.strip() != expected: - raise ValueError("wrote %r read %r" % (teststr, got)) - got = e.read() - if got: - raise ValueError("unexpected %r on stderr" % (got,)) - for inst in popen2._active[:]: - inst.wait() - popen2._cleanup() - if popen2._active: - raise ValueError("_active not empty") - print "All OK" - -main() -_test() -reap_children() diff --git a/sys/lib/python/test/test_posix.py b/sys/lib/python/test/test_posix.py deleted file mode 100644 index f98c72319..000000000 --- a/sys/lib/python/test/test_posix.py +++ /dev/null @@ -1,199 +0,0 @@ -"Test posix functions" - -from test import test_support - -try: - import posix -except ImportError: - raise test_support.TestSkipped, "posix is not available" - -import time -import os -import sys -import unittest -import warnings -warnings.filterwarnings('ignore', '.* potential security risk .*', - RuntimeWarning) - -class PosixTester(unittest.TestCase): - - def setUp(self): - # create empty file - fp = open(test_support.TESTFN, 'w+') - fp.close() - - def tearDown(self): - os.unlink(test_support.TESTFN) - - def testNoArgFunctions(self): - # test posix functions which take no arguments and have - # no side-effects which we need to cleanup (e.g., fork, wait, abort) - NO_ARG_FUNCTIONS = [ "ctermid", "getcwd", "getcwdu", "uname", - "times", "getloadavg", "tmpnam", - "getegid", "geteuid", "getgid", "getgroups", - "getpid", "getpgrp", "getppid", "getuid", - ] - - for name in NO_ARG_FUNCTIONS: - posix_func = getattr(posix, name, None) - if posix_func is not None: - posix_func() - self.assertRaises(TypeError, posix_func, 1) - - def test_statvfs(self): - if hasattr(posix, 'statvfs'): - self.assert_(posix.statvfs(os.curdir)) - - def test_fstatvfs(self): - if hasattr(posix, 'fstatvfs'): - fp = open(test_support.TESTFN) - try: - self.assert_(posix.fstatvfs(fp.fileno())) - finally: - fp.close() - - def test_ftruncate(self): - if hasattr(posix, 'ftruncate'): - fp = open(test_support.TESTFN, 'w+') - try: - # we need to have some data to truncate - fp.write('test') - fp.flush() - posix.ftruncate(fp.fileno(), 0) - finally: - fp.close() - - def test_dup(self): - if hasattr(posix, 'dup'): - fp = open(test_support.TESTFN) - try: - fd = posix.dup(fp.fileno()) - self.assert_(isinstance(fd, int)) - os.close(fd) - finally: - fp.close() - - def test_confstr(self): - if hasattr(posix, 'confstr'): - self.assertRaises(ValueError, posix.confstr, "CS_garbage") - self.assertEqual(len(posix.confstr("CS_PATH")) > 0, True) - - def test_dup2(self): - if hasattr(posix, 'dup2'): - fp1 = open(test_support.TESTFN) - fp2 = open(test_support.TESTFN) - try: - posix.dup2(fp1.fileno(), fp2.fileno()) - finally: - fp1.close() - fp2.close() - - def fdopen_helper(self, *args): - fd = os.open(test_support.TESTFN, os.O_RDONLY) - fp2 = posix.fdopen(fd, *args) - fp2.close() - - def test_fdopen(self): - if hasattr(posix, 'fdopen'): - self.fdopen_helper() - self.fdopen_helper('r') - self.fdopen_helper('r', 100) - - def test_osexlock(self): - if hasattr(posix, "O_EXLOCK"): - fd = os.open(test_support.TESTFN, - os.O_WRONLY|os.O_EXLOCK|os.O_CREAT) - self.assertRaises(OSError, os.open, test_support.TESTFN, - os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK) - os.close(fd) - - if hasattr(posix, "O_SHLOCK"): - fd = os.open(test_support.TESTFN, - os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - self.assertRaises(OSError, os.open, test_support.TESTFN, - os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK) - os.close(fd) - - def test_osshlock(self): - if hasattr(posix, "O_SHLOCK"): - fd1 = os.open(test_support.TESTFN, - os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - fd2 = os.open(test_support.TESTFN, - os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - os.close(fd2) - os.close(fd1) - - if hasattr(posix, "O_EXLOCK"): - fd = os.open(test_support.TESTFN, - os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - self.assertRaises(OSError, os.open, test_support.TESTFN, - os.O_RDONLY|os.O_EXLOCK|os.O_NONBLOCK) - os.close(fd) - - def test_fstat(self): - if hasattr(posix, 'fstat'): - fp = open(test_support.TESTFN) - try: - self.assert_(posix.fstat(fp.fileno())) - finally: - fp.close() - - def test_stat(self): - if hasattr(posix, 'stat'): - self.assert_(posix.stat(test_support.TESTFN)) - - def test_chdir(self): - if hasattr(posix, 'chdir'): - posix.chdir(os.curdir) - self.assertRaises(OSError, posix.chdir, test_support.TESTFN) - - def test_lsdir(self): - if hasattr(posix, 'lsdir'): - self.assert_(test_support.TESTFN in posix.lsdir(os.curdir)) - - def test_access(self): - if hasattr(posix, 'access'): - self.assert_(posix.access(test_support.TESTFN, os.R_OK)) - - def test_umask(self): - if hasattr(posix, 'umask'): - old_mask = posix.umask(0) - self.assert_(isinstance(old_mask, int)) - posix.umask(old_mask) - - def test_strerror(self): - if hasattr(posix, 'strerror'): - self.assert_(posix.strerror(0)) - - def test_pipe(self): - if hasattr(posix, 'pipe'): - reader, writer = posix.pipe() - os.close(reader) - os.close(writer) - - def test_tempnam(self): - if hasattr(posix, 'tempnam'): - self.assert_(posix.tempnam()) - self.assert_(posix.tempnam(os.curdir)) - self.assert_(posix.tempnam(os.curdir, 'blah')) - - def test_tmpfile(self): - if hasattr(posix, 'tmpfile'): - fp = posix.tmpfile() - fp.close() - - def test_utime(self): - if hasattr(posix, 'utime'): - now = time.time() - posix.utime(test_support.TESTFN, None) - self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (None, None)) - self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (now, None)) - self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (None, now)) - posix.utime(test_support.TESTFN, (int(now), int(now))) - posix.utime(test_support.TESTFN, (now, now)) - -def test_main(): - test_support.run_unittest(PosixTester) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_posixpath.py b/sys/lib/python/test/test_posixpath.py deleted file mode 100644 index 3984157ed..000000000 --- a/sys/lib/python/test/test_posixpath.py +++ /dev/null @@ -1,515 +0,0 @@ -import unittest -from test import test_support - -import posixpath, os -from posixpath import realpath, abspath, join, dirname, basename - -# An absolute path to a temporary filename for testing. We can't rely on TESTFN -# being an absolute path, so we need this. - -ABSTFN = abspath(test_support.TESTFN) - -class PosixPathTest(unittest.TestCase): - - def assertIs(self, a, b): - self.assert_(a is b) - - def test_normcase(self): - # Check that normcase() is idempotent - p = "FoO/./BaR" - p = posixpath.normcase(p) - self.assertEqual(p, posixpath.normcase(p)) - - self.assertRaises(TypeError, posixpath.normcase) - - def test_join(self): - self.assertEqual(posixpath.join("/foo", "bar", "/bar", "baz"), "/bar/baz") - self.assertEqual(posixpath.join("/foo", "bar", "baz"), "/foo/bar/baz") - self.assertEqual(posixpath.join("/foo/", "bar/", "baz/"), "/foo/bar/baz/") - - self.assertRaises(TypeError, posixpath.join) - - def test_splitdrive(self): - self.assertEqual(posixpath.splitdrive("/foo/bar"), ("", "/foo/bar")) - - self.assertRaises(TypeError, posixpath.splitdrive) - - def test_split(self): - self.assertEqual(posixpath.split("/foo/bar"), ("/foo", "bar")) - self.assertEqual(posixpath.split("/"), ("/", "")) - self.assertEqual(posixpath.split("foo"), ("", "foo")) - self.assertEqual(posixpath.split("////foo"), ("////", "foo")) - self.assertEqual(posixpath.split("//foo//bar"), ("//foo", "bar")) - - self.assertRaises(TypeError, posixpath.split) - - def test_splitext(self): - self.assertEqual(posixpath.splitext("foo.ext"), ("foo", ".ext")) - self.assertEqual(posixpath.splitext("/foo/foo.ext"), ("/foo/foo", ".ext")) - self.assertEqual(posixpath.splitext(".ext"), ("", ".ext")) - self.assertEqual(posixpath.splitext("/foo.ext/foo"), ("/foo.ext/foo", "")) - self.assertEqual(posixpath.splitext("foo.ext/"), ("foo.ext/", "")) - self.assertEqual(posixpath.splitext(""), ("", "")) - self.assertEqual(posixpath.splitext("foo.bar.ext"), ("foo.bar", ".ext")) - - self.assertRaises(TypeError, posixpath.splitext) - - def test_isabs(self): - self.assertIs(posixpath.isabs(""), False) - self.assertIs(posixpath.isabs("/"), True) - self.assertIs(posixpath.isabs("/foo"), True) - self.assertIs(posixpath.isabs("/foo/bar"), True) - self.assertIs(posixpath.isabs("foo/bar"), False) - - self.assertRaises(TypeError, posixpath.isabs) - - def test_splitdrive(self): - self.assertEqual(posixpath.splitdrive("/foo/bar"), ("", "/foo/bar")) - - self.assertRaises(TypeError, posixpath.splitdrive) - - def test_basename(self): - self.assertEqual(posixpath.basename("/foo/bar"), "bar") - self.assertEqual(posixpath.basename("/"), "") - self.assertEqual(posixpath.basename("foo"), "foo") - self.assertEqual(posixpath.basename("////foo"), "foo") - self.assertEqual(posixpath.basename("//foo//bar"), "bar") - - self.assertRaises(TypeError, posixpath.basename) - - def test_dirname(self): - self.assertEqual(posixpath.dirname("/foo/bar"), "/foo") - self.assertEqual(posixpath.dirname("/"), "/") - self.assertEqual(posixpath.dirname("foo"), "") - self.assertEqual(posixpath.dirname("////foo"), "////") - self.assertEqual(posixpath.dirname("//foo//bar"), "//foo") - - self.assertRaises(TypeError, posixpath.dirname) - - def test_commonprefix(self): - self.assertEqual( - posixpath.commonprefix([]), - "" - ) - self.assertEqual( - posixpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"]), - "/home/swen" - ) - self.assertEqual( - posixpath.commonprefix(["/home/swen/spam", "/home/swen/eggs"]), - "/home/swen/" - ) - self.assertEqual( - posixpath.commonprefix(["/home/swen/spam", "/home/swen/spam"]), - "/home/swen/spam" - ) - - def test_getsize(self): - f = open(test_support.TESTFN, "wb") - try: - f.write("foo") - f.close() - self.assertEqual(posixpath.getsize(test_support.TESTFN), 3) - finally: - if not f.closed: - f.close() - os.remove(test_support.TESTFN) - - def test_time(self): - f = open(test_support.TESTFN, "wb") - try: - f.write("foo") - f.close() - f = open(test_support.TESTFN, "ab") - f.write("bar") - f.close() - f = open(test_support.TESTFN, "rb") - d = f.read() - f.close() - self.assertEqual(d, "foobar") - - self.assert_( - posixpath.getctime(test_support.TESTFN) <= - posixpath.getmtime(test_support.TESTFN) - ) - finally: - if not f.closed: - f.close() - os.remove(test_support.TESTFN) - - def test_islink(self): - self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) - f = open(test_support.TESTFN + "1", "wb") - try: - f.write("foo") - f.close() - self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) - if hasattr(os, "symlink"): - os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2") - self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) - os.remove(test_support.TESTFN + "1") - self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) - self.assertIs(posixpath.exists(test_support.TESTFN + "2"), False) - self.assertIs(posixpath.lexists(test_support.TESTFN + "2"), True) - finally: - if not f.close(): - f.close() - try: - os.remove(test_support.TESTFN + "1") - except os.error: - pass - try: - os.remove(test_support.TESTFN + "2") - except os.error: - pass - - self.assertRaises(TypeError, posixpath.islink) - - def test_exists(self): - self.assertIs(posixpath.exists(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") - try: - f.write("foo") - f.close() - self.assertIs(posixpath.exists(test_support.TESTFN), True) - self.assertIs(posixpath.lexists(test_support.TESTFN), True) - finally: - if not f.close(): - f.close() - try: - os.remove(test_support.TESTFN) - except os.error: - pass - - self.assertRaises(TypeError, posixpath.exists) - - def test_isdir(self): - self.assertIs(posixpath.isdir(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") - try: - f.write("foo") - f.close() - self.assertIs(posixpath.isdir(test_support.TESTFN), False) - os.remove(test_support.TESTFN) - os.mkdir(test_support.TESTFN) - self.assertIs(posixpath.isdir(test_support.TESTFN), True) - os.rmdir(test_support.TESTFN) - finally: - if not f.close(): - f.close() - try: - os.remove(test_support.TESTFN) - except os.error: - pass - try: - os.rmdir(test_support.TESTFN) - except os.error: - pass - - self.assertRaises(TypeError, posixpath.isdir) - - def test_isfile(self): - self.assertIs(posixpath.isfile(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") - try: - f.write("foo") - f.close() - self.assertIs(posixpath.isfile(test_support.TESTFN), True) - os.remove(test_support.TESTFN) - os.mkdir(test_support.TESTFN) - self.assertIs(posixpath.isfile(test_support.TESTFN), False) - os.rmdir(test_support.TESTFN) - finally: - if not f.close(): - f.close() - try: - os.remove(test_support.TESTFN) - except os.error: - pass - try: - os.rmdir(test_support.TESTFN) - except os.error: - pass - - self.assertRaises(TypeError, posixpath.isdir) - - def test_samefile(self): - f = open(test_support.TESTFN + "1", "wb") - try: - f.write("foo") - f.close() - self.assertIs( - posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "1" - ), - True - ) - # If we don't have links, assume that os.stat doesn't return resonable - # inode information and thus, that samefile() doesn't work - if hasattr(os, "symlink"): - os.symlink( - test_support.TESTFN + "1", - test_support.TESTFN + "2" - ) - self.assertIs( - posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" - ), - True - ) - os.remove(test_support.TESTFN + "2") - f = open(test_support.TESTFN + "2", "wb") - f.write("bar") - f.close() - self.assertIs( - posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" - ), - False - ) - finally: - if not f.close(): - f.close() - try: - os.remove(test_support.TESTFN + "1") - except os.error: - pass - try: - os.remove(test_support.TESTFN + "2") - except os.error: - pass - - self.assertRaises(TypeError, posixpath.samefile) - - def test_samestat(self): - f = open(test_support.TESTFN + "1", "wb") - try: - f.write("foo") - f.close() - self.assertIs( - posixpath.samestat( - os.stat(test_support.TESTFN + "1"), - os.stat(test_support.TESTFN + "1") - ), - True - ) - # If we don't have links, assume that os.stat() doesn't return resonable - # inode information and thus, that samefile() doesn't work - if hasattr(os, "symlink"): - if hasattr(os, "symlink"): - os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2") - self.assertIs( - posixpath.samestat( - os.stat(test_support.TESTFN + "1"), - os.stat(test_support.TESTFN + "2") - ), - True - ) - os.remove(test_support.TESTFN + "2") - f = open(test_support.TESTFN + "2", "wb") - f.write("bar") - f.close() - self.assertIs( - posixpath.samestat( - os.stat(test_support.TESTFN + "1"), - os.stat(test_support.TESTFN + "2") - ), - False - ) - finally: - if not f.close(): - f.close() - try: - os.remove(test_support.TESTFN + "1") - except os.error: - pass - try: - os.remove(test_support.TESTFN + "2") - except os.error: - pass - - self.assertRaises(TypeError, posixpath.samestat) - - def test_ismount(self): - self.assertIs(posixpath.ismount("/"), True) - - self.assertRaises(TypeError, posixpath.ismount) - - def test_expanduser(self): - self.assertEqual(posixpath.expanduser("foo"), "foo") - try: - import pwd - except ImportError: - pass - else: - self.assert_(isinstance(posixpath.expanduser("~/"), basestring)) - # if home directory == root directory, this test makes no sense - if posixpath.expanduser("~") != '/': - self.assertEqual( - posixpath.expanduser("~") + "/", - posixpath.expanduser("~/") - ) - self.assert_(isinstance(posixpath.expanduser("~root/"), basestring)) - self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring)) - - self.assertRaises(TypeError, posixpath.expanduser) - - def test_expandvars(self): - oldenv = os.environ.copy() - try: - os.environ.clear() - os.environ["foo"] = "bar" - os.environ["{foo"] = "baz1" - os.environ["{foo}"] = "baz2" - self.assertEqual(posixpath.expandvars("foo"), "foo") - self.assertEqual(posixpath.expandvars("$foo bar"), "bar bar") - self.assertEqual(posixpath.expandvars("${foo}bar"), "barbar") - self.assertEqual(posixpath.expandvars("$[foo]bar"), "$[foo]bar") - self.assertEqual(posixpath.expandvars("$bar bar"), "$bar bar") - self.assertEqual(posixpath.expandvars("$?bar"), "$?bar") - self.assertEqual(posixpath.expandvars("${foo}bar"), "barbar") - self.assertEqual(posixpath.expandvars("$foo}bar"), "bar}bar") - self.assertEqual(posixpath.expandvars("${foo"), "${foo") - self.assertEqual(posixpath.expandvars("${{foo}}"), "baz1}") - finally: - os.environ.clear() - os.environ.update(oldenv) - - self.assertRaises(TypeError, posixpath.expandvars) - - def test_normpath(self): - self.assertEqual(posixpath.normpath(""), ".") - self.assertEqual(posixpath.normpath("/"), "/") - self.assertEqual(posixpath.normpath("//"), "//") - self.assertEqual(posixpath.normpath("///"), "/") - self.assertEqual(posixpath.normpath("///foo/.//bar//"), "/foo/bar") - self.assertEqual(posixpath.normpath("///foo/.//bar//.//..//.//baz"), "/foo/baz") - self.assertEqual(posixpath.normpath("///..//./foo/.//bar"), "/foo/bar") - - self.assertRaises(TypeError, posixpath.normpath) - - def test_abspath(self): - self.assert_("foo" in posixpath.abspath("foo")) - - self.assertRaises(TypeError, posixpath.abspath) - - def test_realpath(self): - self.assert_("foo" in realpath("foo")) - self.assertRaises(TypeError, posixpath.realpath) - - if hasattr(os, "symlink"): - def test_realpath_basic(self): - # Basic operation. - try: - os.symlink(ABSTFN+"1", ABSTFN) - self.assertEqual(realpath(ABSTFN), ABSTFN+"1") - finally: - self.safe_remove(ABSTFN) - - def test_realpath_symlink_loops(self): - # Bug #930024, return the path unchanged if we get into an infinite - # symlink loop. - try: - old_path = abspath('.') - os.symlink(ABSTFN, ABSTFN) - self.assertEqual(realpath(ABSTFN), ABSTFN) - - os.symlink(ABSTFN+"1", ABSTFN+"2") - os.symlink(ABSTFN+"2", ABSTFN+"1") - self.assertEqual(realpath(ABSTFN+"1"), ABSTFN+"1") - self.assertEqual(realpath(ABSTFN+"2"), ABSTFN+"2") - - # Test using relative path as well. - os.chdir(dirname(ABSTFN)) - self.assertEqual(realpath(basename(ABSTFN)), ABSTFN) - finally: - os.chdir(old_path) - self.safe_remove(ABSTFN) - self.safe_remove(ABSTFN+"1") - self.safe_remove(ABSTFN+"2") - - def test_realpath_resolve_parents(self): - # We also need to resolve any symlinks in the parents of a relative - # path passed to realpath. E.g.: current working directory is - # /usr/doc with 'doc' being a symlink to /usr/share/doc. We call - # realpath("a"). This should return /usr/share/doc/a/. - try: - old_path = abspath('.') - os.mkdir(ABSTFN) - os.mkdir(ABSTFN + "/y") - os.symlink(ABSTFN + "/y", ABSTFN + "/k") - - os.chdir(ABSTFN + "/k") - self.assertEqual(realpath("a"), ABSTFN + "/y/a") - finally: - os.chdir(old_path) - self.safe_remove(ABSTFN + "/k") - self.safe_rmdir(ABSTFN + "/y") - self.safe_rmdir(ABSTFN) - - def test_realpath_resolve_before_normalizing(self): - # Bug #990669: Symbolic links should be resolved before we - # normalize the path. E.g.: if we have directories 'a', 'k' and 'y' - # in the following hierarchy: - # a/k/y - # - # and a symbolic link 'link-y' pointing to 'y' in directory 'a', - # then realpath("link-y/..") should return 'k', not 'a'. - try: - old_path = abspath('.') - os.mkdir(ABSTFN) - os.mkdir(ABSTFN + "/k") - os.mkdir(ABSTFN + "/k/y") - os.symlink(ABSTFN + "/k/y", ABSTFN + "/link-y") - - # Absolute path. - self.assertEqual(realpath(ABSTFN + "/link-y/.."), ABSTFN + "/k") - # Relative path. - os.chdir(dirname(ABSTFN)) - self.assertEqual(realpath(basename(ABSTFN) + "/link-y/.."), ABSTFN + "/k") - finally: - os.chdir(old_path) - self.safe_remove(ABSTFN + "/link-y") - self.safe_rmdir(ABSTFN + "/k/y") - self.safe_rmdir(ABSTFN + "/k") - self.safe_rmdir(ABSTFN) - - def test_realpath_resolve_first(self): - # Bug #1213894: The first component of the path, if not absolute, - # must be resolved too. - - try: - old_path = abspath('.') - os.mkdir(ABSTFN) - os.mkdir(ABSTFN + "/k") - os.symlink(ABSTFN, ABSTFN + "link") - os.chdir(dirname(ABSTFN)) - - base = basename(ABSTFN) - self.assertEqual(realpath(base + "link"), ABSTFN) - self.assertEqual(realpath(base + "link/k"), ABSTFN + "/k") - finally: - os.chdir(old_path) - self.safe_remove(ABSTFN + "link") - self.safe_rmdir(ABSTFN + "/k") - self.safe_rmdir(ABSTFN) - - # Convenience functions for removing temporary files. - def pass_os_error(self, func, filename): - try: func(filename) - except OSError: pass - - def safe_remove(self, filename): - self.pass_os_error(os.remove, filename) - - def safe_rmdir(self, dirname): - self.pass_os_error(os.rmdir, dirname) - -def test_main(): - test_support.run_unittest(PosixPathTest) - -if __name__=="__main__": - test_main() diff --git a/sys/lib/python/test/test_pow.py b/sys/lib/python/test/test_pow.py deleted file mode 100644 index c6ab218eb..000000000 --- a/sys/lib/python/test/test_pow.py +++ /dev/null @@ -1,126 +0,0 @@ -import test.test_support, unittest - -class PowTest(unittest.TestCase): - - def powtest(self, type): - if type != float: - for i in range(-1000, 1000): - self.assertEquals(pow(type(i), 0), 1) - self.assertEquals(pow(type(i), 1), type(i)) - self.assertEquals(pow(type(0), 1), type(0)) - self.assertEquals(pow(type(1), 1), type(1)) - - for i in range(-100, 100): - self.assertEquals(pow(type(i), 3), i*i*i) - - pow2 = 1 - for i in range(0,31): - self.assertEquals(pow(2, i), pow2) - if i != 30 : pow2 = pow2*2 - - for othertype in int, long: - for i in range(-10, 0) + range(1, 10): - ii = type(i) - for j in range(1, 11): - jj = -othertype(j) - pow(ii, jj) - - for othertype in int, long, float: - for i in range(1, 100): - zero = type(0) - exp = -othertype(i/10.0) - if exp == 0: - continue - self.assertRaises(ZeroDivisionError, pow, zero, exp) - - il, ih = -20, 20 - jl, jh = -5, 5 - kl, kh = -10, 10 - asseq = self.assertEqual - if type == float: - il = 1 - asseq = self.assertAlmostEqual - elif type == int: - jl = 0 - elif type == long: - jl, jh = 0, 15 - for i in range(il, ih+1): - for j in range(jl, jh+1): - for k in range(kl, kh+1): - if k != 0: - if type == float or j < 0: - self.assertRaises(TypeError, pow, type(i), j, k) - continue - asseq( - pow(type(i),j,k), - pow(type(i),j)% type(k) - ) - - def test_powint(self): - self.powtest(int) - - def test_powlong(self): - self.powtest(long) - - def test_powfloat(self): - self.powtest(float) - - def test_other(self): - # Other tests-- not very systematic - self.assertEquals(pow(3,3) % 8, pow(3,3,8)) - self.assertEquals(pow(3,3) % -8, pow(3,3,-8)) - self.assertEquals(pow(3,2) % -2, pow(3,2,-2)) - self.assertEquals(pow(-3,3) % 8, pow(-3,3,8)) - self.assertEquals(pow(-3,3) % -8, pow(-3,3,-8)) - self.assertEquals(pow(5,2) % -8, pow(5,2,-8)) - - self.assertEquals(pow(3L,3L) % 8, pow(3L,3L,8)) - self.assertEquals(pow(3L,3L) % -8, pow(3L,3L,-8)) - self.assertEquals(pow(3L,2) % -2, pow(3L,2,-2)) - self.assertEquals(pow(-3L,3L) % 8, pow(-3L,3L,8)) - self.assertEquals(pow(-3L,3L) % -8, pow(-3L,3L,-8)) - self.assertEquals(pow(5L,2) % -8, pow(5L,2,-8)) - - for i in range(-10, 11): - for j in range(0, 6): - for k in range(-7, 11): - if j >= 0 and k != 0: - self.assertEquals( - pow(i,j) % k, - pow(i,j,k) - ) - if j >= 0 and k != 0: - self.assertEquals( - pow(long(i),j) % k, - pow(long(i),j,k) - ) - - def test_bug643260(self): - class TestRpow: - def __rpow__(self, other): - return None - None ** TestRpow() # Won't fail when __rpow__ invoked. SF bug #643260. - - def test_bug705231(self): - # -1.0 raised to an integer should never blow up. It did if the - # platform pow() was buggy, and Python didn't worm around it. - eq = self.assertEquals - a = -1.0 - eq(pow(a, 1.23e167), 1.0) - eq(pow(a, -1.23e167), 1.0) - for b in range(-10, 11): - eq(pow(a, float(b)), b & 1 and -1.0 or 1.0) - for n in range(0, 100): - fiveto = float(5 ** n) - # For small n, fiveto will be odd. Eventually we run out of - # mantissa bits, though, and thereafer fiveto will be even. - expected = fiveto % 2.0 and -1.0 or 1.0 - eq(pow(a, fiveto), expected) - eq(pow(a, -fiveto), expected) - eq(expected, 1.0) # else we didn't push fiveto to evenness - -def test_main(): - test.test_support.run_unittest(PowTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_pprint.py b/sys/lib/python/test/test_pprint.py deleted file mode 100644 index 09ba268f7..000000000 --- a/sys/lib/python/test/test_pprint.py +++ /dev/null @@ -1,217 +0,0 @@ -import pprint -import test.test_support -import unittest - -try: - uni = unicode -except NameError: - def uni(x): - return x - -# list, tuple and dict subclasses that do or don't overwrite __repr__ -class list2(list): - pass - -class list3(list): - def __repr__(self): - return list.__repr__(self) - -class tuple2(tuple): - pass - -class tuple3(tuple): - def __repr__(self): - return tuple.__repr__(self) - -class dict2(dict): - pass - -class dict3(dict): - def __repr__(self): - return dict.__repr__(self) - -class QueryTestCase(unittest.TestCase): - - def setUp(self): - self.a = range(100) - self.b = range(200) - self.a[-12] = self.b - - def test_basic(self): - # Verify .isrecursive() and .isreadable() w/o recursion - verify = self.assert_ - pp = pprint.PrettyPrinter() - for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, uni("yaddayadda"), - self.a, self.b): - # module-level convenience functions - verify(not pprint.isrecursive(safe), - "expected not isrecursive for %r" % (safe,)) - verify(pprint.isreadable(safe), - "expected isreadable for %r" % (safe,)) - # PrettyPrinter methods - verify(not pp.isrecursive(safe), - "expected not isrecursive for %r" % (safe,)) - verify(pp.isreadable(safe), - "expected isreadable for %r" % (safe,)) - - def test_knotted(self): - # Verify .isrecursive() and .isreadable() w/ recursion - # Tie a knot. - self.b[67] = self.a - # Messy dict. - self.d = {} - self.d[0] = self.d[1] = self.d[2] = self.d - - verify = self.assert_ - pp = pprint.PrettyPrinter() - - for icky in self.a, self.b, self.d, (self.d, self.d): - verify(pprint.isrecursive(icky), "expected isrecursive") - verify(not pprint.isreadable(icky), "expected not isreadable") - verify(pp.isrecursive(icky), "expected isrecursive") - verify(not pp.isreadable(icky), "expected not isreadable") - - # Break the cycles. - self.d.clear() - del self.a[:] - del self.b[:] - - for safe in self.a, self.b, self.d, (self.d, self.d): - # module-level convenience functions - verify(not pprint.isrecursive(safe), - "expected not isrecursive for %r" % (safe,)) - verify(pprint.isreadable(safe), - "expected isreadable for %r" % (safe,)) - # PrettyPrinter methods - verify(not pp.isrecursive(safe), - "expected not isrecursive for %r" % (safe,)) - verify(pp.isreadable(safe), - "expected isreadable for %r" % (safe,)) - - def test_unreadable(self): - # Not recursive but not readable anyway - verify = self.assert_ - pp = pprint.PrettyPrinter() - for unreadable in type(3), pprint, pprint.isrecursive: - # module-level convenience functions - verify(not pprint.isrecursive(unreadable), - "expected not isrecursive for %r" % (unreadable,)) - verify(not pprint.isreadable(unreadable), - "expected not isreadable for %r" % (unreadable,)) - # PrettyPrinter methods - verify(not pp.isrecursive(unreadable), - "expected not isrecursive for %r" % (unreadable,)) - verify(not pp.isreadable(unreadable), - "expected not isreadable for %r" % (unreadable,)) - - def test_same_as_repr(self): - # Simple objects, small containers and classes that overwrite __repr__ - # For those the result should be the same as repr(). - # Ahem. The docs don't say anything about that -- this appears to - # be testing an implementation quirk. Starting in Python 2.5, it's - # not true for dicts: pprint always sorts dicts by key now; before, - # it sorted a dict display if and only if the display required - # multiple lines. For that reason, dicts with more than one element - # aren't tested here. - verify = self.assert_ - for simple in (0, 0L, 0+0j, 0.0, "", uni(""), - (), tuple2(), tuple3(), - [], list2(), list3(), - {}, dict2(), dict3(), - verify, pprint, - -6, -6L, -6-6j, -1.5, "x", uni("x"), (3,), [3], {3: 6}, - (1,2), [3,4], {5: 6, 7: 8}, - tuple2((1,2)), tuple3((1,2)), tuple3(range(100)), - [3,4], list2([3,4]), list3([3,4]), list3(range(100)), - {5: 6, 7: 8}, dict2({5: 6}), dict3({5: 6}), - range(10, -11, -1) - ): - native = repr(simple) - for function in "pformat", "saferepr": - f = getattr(pprint, function) - got = f(simple) - verify(native == got, "expected %s got %s from pprint.%s" % - (native, got, function)) - - def test_basic_line_wrap(self): - # verify basic line-wrapping operation - o = {'RPM_cal': 0, - 'RPM_cal2': 48059, - 'Speed_cal': 0, - 'controldesk_runtime_us': 0, - 'main_code_runtime_us': 0, - 'read_io_runtime_us': 0, - 'write_io_runtime_us': 43690} - exp = """\ -{'RPM_cal': 0, - 'RPM_cal2': 48059, - 'Speed_cal': 0, - 'controldesk_runtime_us': 0, - 'main_code_runtime_us': 0, - 'read_io_runtime_us': 0, - 'write_io_runtime_us': 43690}""" - for type in [dict, dict2]: - self.assertEqual(pprint.pformat(type(o)), exp) - - o = range(100) - exp = '[%s]' % ',\n '.join(map(str, o)) - for type in [list, list2]: - self.assertEqual(pprint.pformat(type(o)), exp) - - o = tuple(range(100)) - exp = '(%s)' % ',\n '.join(map(str, o)) - for type in [tuple, tuple2]: - self.assertEqual(pprint.pformat(type(o)), exp) - - # indent parameter - o = range(100) - exp = '[ %s]' % ',\n '.join(map(str, o)) - for type in [list, list2]: - self.assertEqual(pprint.pformat(type(o), indent=4), exp) - - def test_sorted_dict(self): - # Starting in Python 2.5, pprint sorts dict displays by key regardless - # of how small the dictionary may be. - # Before the change, on 32-bit Windows pformat() gave order - # 'a', 'c', 'b' here, so this test failed. - d = {'a': 1, 'b': 1, 'c': 1} - self.assertEqual(pprint.pformat(d), "{'a': 1, 'b': 1, 'c': 1}") - self.assertEqual(pprint.pformat([d, d]), - "[{'a': 1, 'b': 1, 'c': 1}, {'a': 1, 'b': 1, 'c': 1}]") - - # The next one is kind of goofy. The sorted order depends on the - # alphabetic order of type names: "int" < "str" < "tuple". Before - # Python 2.5, this was in the test_same_as_repr() test. It's worth - # keeping around for now because it's one of few tests of pprint - # against a crazy mix of types. - self.assertEqual(pprint.pformat({"xy\tab\n": (3,), 5: [[]], (): {}}), - r"{5: [[]], 'xy\tab\n': (3,), (): {}}") - - def test_subclassing(self): - o = {'names with spaces': 'should be presented using repr()', - 'others.should.not.be': 'like.this'} - exp = """\ -{'names with spaces': 'should be presented using repr()', - others.should.not.be: like.this}""" - self.assertEqual(DottedPrettyPrinter().pformat(o), exp) - - -class DottedPrettyPrinter(pprint.PrettyPrinter): - - def format(self, object, context, maxlevels, level): - if isinstance(object, str): - if ' ' in object: - return repr(object), 1, 0 - else: - return object, 0, 0 - else: - return pprint.PrettyPrinter.format( - self, object, context, maxlevels, level) - - -def test_main(): - test.test_support.run_unittest(QueryTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_profile.py b/sys/lib/python/test/test_profile.py deleted file mode 100644 index 95ad8d2db..000000000 --- a/sys/lib/python/test/test_profile.py +++ /dev/null @@ -1,123 +0,0 @@ -"""Test suite for the profile module.""" - -import profile, pstats, sys - -# In order to have reproducible time, we simulate a timer in the global -# variable 'ticks', which represents simulated time in milliseconds. -# (We can't use a helper function increment the timer since it would be -# included in the profile and would appear to consume all the time.) -ticks = 0 - -# IMPORTANT: this is an output test. *ALL* NUMBERS in the expected -# output are relevant. If you change the formatting of pstats, -# please don't just regenerate output/test_profile without checking -# very carefully that not a single number has changed. - -def test_main(): - global ticks - ticks = 42000 - prof = profile.Profile(timer) - prof.runctx("testfunc()", globals(), locals()) - assert ticks == 43000, ticks - st = pstats.Stats(prof) - st.strip_dirs().sort_stats('stdname').print_stats() - st.print_callees() - st.print_callers() - -def timer(): - return ticks*0.001 - -def testfunc(): - # 1 call - # 1000 ticks total: 270 ticks local, 730 ticks in subfunctions - global ticks - ticks += 99 - helper() # 300 - helper() # 300 - ticks += 171 - factorial(14) # 130 - -def factorial(n): - # 23 calls total - # 170 ticks total, 150 ticks local - # 3 primitive calls, 130, 20 and 20 ticks total - # including 116, 17, 17 ticks local - global ticks - if n > 0: - ticks += n - return mul(n, factorial(n-1)) - else: - ticks += 11 - return 1 - -def mul(a, b): - # 20 calls - # 1 tick, local - global ticks - ticks += 1 - return a * b - -def helper(): - # 2 calls - # 300 ticks total: 20 ticks local, 260 ticks in subfunctions - global ticks - ticks += 1 - helper1() # 30 - ticks += 2 - helper1() # 30 - ticks += 6 - helper2() # 50 - ticks += 3 - helper2() # 50 - ticks += 2 - helper2() # 50 - ticks += 5 - helper2_indirect() # 70 - ticks += 1 - -def helper1(): - # 4 calls - # 30 ticks total: 29 ticks local, 1 tick in subfunctions - global ticks - ticks += 10 - hasattr(C(), "foo") # 1 - ticks += 19 - lst = [] - lst.append(42) # 0 - sys.exc_info() # 0 - -def helper2_indirect(): - helper2() # 50 - factorial(3) # 20 - -def helper2(): - # 8 calls - # 50 ticks local: 39 ticks local, 11 ticks in subfunctions - global ticks - ticks += 11 - hasattr(C(), "bar") # 1 - ticks += 13 - subhelper() # 10 - ticks += 15 - -def subhelper(): - # 8 calls - # 10 ticks total: 8 ticks local, 2 ticks in subfunctions - global ticks - ticks += 2 - for i in range(2): # 0 - try: - C().foo # 1 x 2 - except AttributeError: - ticks += 3 # 3 x 2 - -class C: - def __getattr__(self, name): - # 28 calls - # 1 tick, local - global ticks - ticks += 1 - raise AttributeError - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_profilehooks.py b/sys/lib/python/test/test_profilehooks.py deleted file mode 100644 index 53f882a3f..000000000 --- a/sys/lib/python/test/test_profilehooks.py +++ /dev/null @@ -1,368 +0,0 @@ -import pprint -import sys -import unittest - -from test import test_support - - -class HookWatcher: - def __init__(self): - self.frames = [] - self.events = [] - - def callback(self, frame, event, arg): - if (event == "call" - or event == "return" - or event == "exception"): - self.add_event(event, frame) - - def add_event(self, event, frame=None): - """Add an event to the log.""" - if frame is None: - frame = sys._getframe(1) - - try: - frameno = self.frames.index(frame) - except ValueError: - frameno = len(self.frames) - self.frames.append(frame) - - self.events.append((frameno, event, ident(frame))) - - def get_events(self): - """Remove calls to add_event().""" - disallowed = [ident(self.add_event.im_func), ident(ident)] - self.frames = None - - return [item for item in self.events if item[2] not in disallowed] - - -class ProfileSimulator(HookWatcher): - def __init__(self, testcase): - self.testcase = testcase - self.stack = [] - HookWatcher.__init__(self) - - def callback(self, frame, event, arg): - # Callback registered with sys.setprofile()/sys.settrace() - self.dispatch[event](self, frame) - - def trace_call(self, frame): - self.add_event('call', frame) - self.stack.append(frame) - - def trace_return(self, frame): - self.add_event('return', frame) - self.stack.pop() - - def trace_exception(self, frame): - self.testcase.fail( - "the profiler should never receive exception events") - - def trace_pass(self, frame): - pass - - dispatch = { - 'call': trace_call, - 'exception': trace_exception, - 'return': trace_return, - 'c_call': trace_pass, - 'c_return': trace_pass, - 'c_exception': trace_pass, - } - - -class TestCaseBase(unittest.TestCase): - def check_events(self, callable, expected): - events = capture_events(callable, self.new_watcher()) - if events != expected: - self.fail("Expected events:\n%s\nReceived events:\n%s" - % (pprint.pformat(expected), pprint.pformat(events))) - - -class ProfileHookTestCase(TestCaseBase): - def new_watcher(self): - return HookWatcher() - - def test_simple(self): - def f(p): - pass - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_exception(self): - def f(p): - 1/0 - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_caught_exception(self): - def f(p): - try: 1/0 - except: pass - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_caught_nested_exception(self): - def f(p): - try: 1/0 - except: pass - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_nested_exception(self): - def f(p): - 1/0 - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - # This isn't what I expected: - # (0, 'exception', protect_ident), - # I expected this again: - (1, 'return', f_ident), - ]) - - def test_exception_in_except_clause(self): - def f(p): - 1/0 - def g(p): - try: - f(p) - except: - try: f(p) - except: pass - f_ident = ident(f) - g_ident = ident(g) - self.check_events(g, [(1, 'call', g_ident), - (2, 'call', f_ident), - (2, 'return', f_ident), - (3, 'call', f_ident), - (3, 'return', f_ident), - (1, 'return', g_ident), - ]) - - def test_exception_propogation(self): - def f(p): - 1/0 - def g(p): - try: f(p) - finally: p.add_event("falling through") - f_ident = ident(f) - g_ident = ident(g) - self.check_events(g, [(1, 'call', g_ident), - (2, 'call', f_ident), - (2, 'return', f_ident), - (1, 'falling through', g_ident), - (1, 'return', g_ident), - ]) - - def test_raise_twice(self): - def f(p): - try: 1/0 - except: 1/0 - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_raise_reraise(self): - def f(p): - try: 1/0 - except: raise - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_raise(self): - def f(p): - raise Exception() - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_distant_exception(self): - def f(): - 1/0 - def g(): - f() - def h(): - g() - def i(): - h() - def j(p): - i() - f_ident = ident(f) - g_ident = ident(g) - h_ident = ident(h) - i_ident = ident(i) - j_ident = ident(j) - self.check_events(j, [(1, 'call', j_ident), - (2, 'call', i_ident), - (3, 'call', h_ident), - (4, 'call', g_ident), - (5, 'call', f_ident), - (5, 'return', f_ident), - (4, 'return', g_ident), - (3, 'return', h_ident), - (2, 'return', i_ident), - (1, 'return', j_ident), - ]) - - def test_generator(self): - def f(): - for i in range(2): - yield i - def g(p): - for i in f(): - pass - f_ident = ident(f) - g_ident = ident(g) - self.check_events(g, [(1, 'call', g_ident), - # call the iterator twice to generate values - (2, 'call', f_ident), - (2, 'return', f_ident), - (2, 'call', f_ident), - (2, 'return', f_ident), - # once more; returns end-of-iteration with - # actually raising an exception - (2, 'call', f_ident), - (2, 'return', f_ident), - (1, 'return', g_ident), - ]) - - def test_stop_iteration(self): - def f(): - for i in range(2): - yield i - raise StopIteration - def g(p): - for i in f(): - pass - f_ident = ident(f) - g_ident = ident(g) - self.check_events(g, [(1, 'call', g_ident), - # call the iterator twice to generate values - (2, 'call', f_ident), - (2, 'return', f_ident), - (2, 'call', f_ident), - (2, 'return', f_ident), - # once more to hit the raise: - (2, 'call', f_ident), - (2, 'return', f_ident), - (1, 'return', g_ident), - ]) - - -class ProfileSimulatorTestCase(TestCaseBase): - def new_watcher(self): - return ProfileSimulator(self) - - def test_simple(self): - def f(p): - pass - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_basic_exception(self): - def f(p): - 1/0 - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_caught_exception(self): - def f(p): - try: 1/0 - except: pass - f_ident = ident(f) - self.check_events(f, [(1, 'call', f_ident), - (1, 'return', f_ident), - ]) - - def test_distant_exception(self): - def f(): - 1/0 - def g(): - f() - def h(): - g() - def i(): - h() - def j(p): - i() - f_ident = ident(f) - g_ident = ident(g) - h_ident = ident(h) - i_ident = ident(i) - j_ident = ident(j) - self.check_events(j, [(1, 'call', j_ident), - (2, 'call', i_ident), - (3, 'call', h_ident), - (4, 'call', g_ident), - (5, 'call', f_ident), - (5, 'return', f_ident), - (4, 'return', g_ident), - (3, 'return', h_ident), - (2, 'return', i_ident), - (1, 'return', j_ident), - ]) - - -def ident(function): - if hasattr(function, "f_code"): - code = function.f_code - else: - code = function.func_code - return code.co_firstlineno, code.co_name - - -def protect(f, p): - try: f(p) - except: pass - -protect_ident = ident(protect) - - -def capture_events(callable, p=None): - try: - sys.setprofile() - except TypeError: - pass - else: - raise test_support.TestFailed( - 'sys.setprofile() did not raise TypeError') - - if p is None: - p = HookWatcher() - sys.setprofile(p.callback) - protect(callable, p) - sys.setprofile(None) - return p.get_events()[1:-1] - - -def show_events(callable): - import pprint - pprint.pprint(capture_events(callable)) - - -def test_main(): - test_support.run_unittest( - ProfileHookTestCase, - ProfileSimulatorTestCase - ) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_pty.py b/sys/lib/python/test/test_pty.py deleted file mode 100644 index 02290be71..000000000 --- a/sys/lib/python/test/test_pty.py +++ /dev/null @@ -1,147 +0,0 @@ -import pty, os, sys, signal -from test.test_support import verbose, TestFailed, TestSkipped - -TEST_STRING_1 = "I wish to buy a fish license.\n" -TEST_STRING_2 = "For my pet fish, Eric.\n" - -if verbose: - def debug(msg): - print msg -else: - def debug(msg): - pass - -def normalize_output(data): - # Some operating systems do conversions on newline. We could possibly - # fix that by doing the appropriate termios.tcsetattr()s. I couldn't - # figure out the right combo on Tru64 and I don't have an IRIX box. - # So just normalize the output and doc the problem O/Ses by allowing - # certain combinations for some platforms, but avoid allowing other - # differences (like extra whitespace, trailing garbage, etc.) - - # This is about the best we can do without getting some feedback - # from someone more knowledgable. - - # OSF/1 (Tru64) apparently turns \n into \r\r\n. - if data.endswith('\r\r\n'): - return data.replace('\r\r\n', '\n') - - # IRIX apparently turns \n into \r\n. - if data.endswith('\r\n'): - return data.replace('\r\n', '\n') - - return data - -# Marginal testing of pty suite. Cannot do extensive 'do or fail' testing -# because pty code is not too portable. - -def test_basic_pty(): - try: - debug("Calling master_open()") - master_fd, slave_name = pty.master_open() - debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) - debug("Calling slave_open(%r)"%(slave_name,)) - slave_fd = pty.slave_open(slave_name) - debug("Got slave_fd '%d'"%slave_fd) - except OSError: - # " An optional feature could not be imported " ... ? - raise TestSkipped, "Pseudo-terminals (seemingly) not functional." - - if not os.isatty(slave_fd): - raise TestFailed, "slave_fd is not a tty" - - debug("Writing to slave_fd") - os.write(slave_fd, TEST_STRING_1) - s1 = os.read(master_fd, 1024) - sys.stdout.write(normalize_output(s1)) - - debug("Writing chunked output") - os.write(slave_fd, TEST_STRING_2[:5]) - os.write(slave_fd, TEST_STRING_2[5:]) - s2 = os.read(master_fd, 1024) - sys.stdout.write(normalize_output(s2)) - - os.close(slave_fd) - os.close(master_fd) - -def handle_sig(sig, frame): - raise TestFailed, "isatty hung" - -# isatty() and close() can hang on some platforms -# set an alarm before running the test to make sure we don't hang forever -old_alarm = signal.signal(signal.SIGALRM, handle_sig) -signal.alarm(10) - -try: - test_basic_pty() -finally: - # remove alarm, restore old alarm handler - signal.alarm(0) - signal.signal(signal.SIGALRM, old_alarm) - -# basic pty passed. - -debug("calling pty.fork()") -pid, master_fd = pty.fork() -if pid == pty.CHILD: - # stdout should be connected to a tty. - if not os.isatty(1): - debug("Child's fd 1 is not a tty?!") - os._exit(3) - - # After pty.fork(), the child should already be a session leader. - # (on those systems that have that concept.) - debug("In child, calling os.setsid()") - try: - os.setsid() - except OSError: - # Good, we already were session leader - debug("Good: OSError was raised.") - pass - except AttributeError: - # Have pty, but not setsid() ? - debug("No setsid() available ?") - pass - except: - # We don't want this error to propagate, escaping the call to - # os._exit() and causing very peculiar behavior in the calling - # regrtest.py ! - # Note: could add traceback printing here. - debug("An unexpected error was raised.") - os._exit(1) - else: - debug("os.setsid() succeeded! (bad!)") - os._exit(2) - os._exit(4) -else: - debug("Waiting for child (%d) to finish."%pid) - ##line = os.read(master_fd, 80) - ##lines = line.replace('\r\n', '\n').split('\n') - ##if False and lines != ['In child, calling os.setsid()', - ## 'Good: OSError was raised.', '']: - ## raise TestFailed("Unexpected output from child: %r" % line) - - (pid, status) = os.waitpid(pid, 0) - res = status >> 8 - debug("Child (%d) exited with status %d (%d)."%(pid, res, status)) - if res == 1: - raise TestFailed, "Child raised an unexpected exception in os.setsid()" - elif res == 2: - raise TestFailed, "pty.fork() failed to make child a session leader." - elif res == 3: - raise TestFailed, "Child spawned by pty.fork() did not have a tty as stdout" - elif res != 4: - raise TestFailed, "pty.fork() failed for unknown reasons." - - ##debug("Reading from master_fd now that the child has exited") - ##try: - ## s1 = os.read(master_fd, 1024) - ##except os.error: - ## pass - ##else: - ## raise TestFailed("Read from master_fd did not raise exception") - - -os.close(master_fd) - -# pty.fork() passed. diff --git a/sys/lib/python/test/test_pwd.py b/sys/lib/python/test/test_pwd.py deleted file mode 100644 index 12d2bc991..000000000 --- a/sys/lib/python/test/test_pwd.py +++ /dev/null @@ -1,94 +0,0 @@ -import unittest -from test import test_support - -import pwd - -class PwdTest(unittest.TestCase): - - def test_values(self): - entries = pwd.getpwall() - entriesbyname = {} - entriesbyuid = {} - - for e in entries: - self.assertEqual(len(e), 7) - self.assertEqual(e[0], e.pw_name) - self.assert_(isinstance(e.pw_name, basestring)) - self.assertEqual(e[1], e.pw_passwd) - self.assert_(isinstance(e.pw_passwd, basestring)) - self.assertEqual(e[2], e.pw_uid) - self.assert_(isinstance(e.pw_uid, int)) - self.assertEqual(e[3], e.pw_gid) - self.assert_(isinstance(e.pw_gid, int)) - self.assertEqual(e[4], e.pw_gecos) - self.assert_(isinstance(e.pw_gecos, basestring)) - self.assertEqual(e[5], e.pw_dir) - self.assert_(isinstance(e.pw_dir, basestring)) - self.assertEqual(e[6], e.pw_shell) - self.assert_(isinstance(e.pw_shell, basestring)) - - # The following won't work, because of duplicate entries - # for one uid - # self.assertEqual(pwd.getpwuid(e.pw_uid), e) - # instead of this collect all entries for one uid - # and check afterwards - entriesbyname.setdefault(e.pw_name, []).append(e) - entriesbyuid.setdefault(e.pw_uid, []).append(e) - - # check whether the entry returned by getpwuid() - # for each uid is among those from getpwall() for this uid - for e in entries: - if not e[0] or e[0] == '+': - continue # skip NIS entries etc. - self.assert_(pwd.getpwnam(e.pw_name) in entriesbyname[e.pw_name]) - self.assert_(pwd.getpwuid(e.pw_uid) in entriesbyuid[e.pw_uid]) - - def test_errors(self): - self.assertRaises(TypeError, pwd.getpwuid) - self.assertRaises(TypeError, pwd.getpwnam) - self.assertRaises(TypeError, pwd.getpwall, 42) - - # try to get some errors - bynames = {} - byuids = {} - for (n, p, u, g, gecos, d, s) in pwd.getpwall(): - bynames[n] = u - byuids[u] = n - - allnames = bynames.keys() - namei = 0 - fakename = allnames[namei] - while fakename in bynames: - chars = map(None, fakename) - for i in xrange(len(chars)): - if chars[i] == 'z': - chars[i] = 'A' - break - elif chars[i] == 'Z': - continue - else: - chars[i] = chr(ord(chars[i]) + 1) - break - else: - namei = namei + 1 - try: - fakename = allnames[namei] - except IndexError: - # should never happen... if so, just forget it - break - fakename = ''.join(map(None, chars)) - - self.assertRaises(KeyError, pwd.getpwnam, fakename) - - # Choose a non-existent uid. - fakeuid = 4127 - while fakeuid in byuids: - fakeuid = (fakeuid * 3) % 0x10000 - - self.assertRaises(KeyError, pwd.getpwuid, fakeuid) - -def test_main(): - test_support.run_unittest(PwdTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_pyclbr.py b/sys/lib/python/test/test_pyclbr.py deleted file mode 100644 index 5188bb350..000000000 --- a/sys/lib/python/test/test_pyclbr.py +++ /dev/null @@ -1,188 +0,0 @@ -''' - Test cases for pyclbr.py - Nick Mathewson -''' -from test.test_support import run_unittest -import unittest, sys -from types import ClassType, FunctionType, MethodType, BuiltinFunctionType -import pyclbr -from unittest import TestCase - -StaticMethodType = type(staticmethod(lambda: None)) -ClassMethodType = type(classmethod(lambda c: None)) - -# This next line triggers an error on old versions of pyclbr. - -from commands import getstatus - -# Here we test the python class browser code. -# -# The main function in this suite, 'testModule', compares the output -# of pyclbr with the introspected members of a module. Because pyclbr -# is imperfect (as designed), testModule is called with a set of -# members to ignore. - -class PyclbrTest(TestCase): - - def assertListEq(self, l1, l2, ignore): - ''' succeed iff {l1} - {ignore} == {l2} - {ignore} ''' - missing = (set(l1) ^ set(l2)) - set(ignore) - if missing: - print >>sys.stderr, "l1=%r\nl2=%r\nignore=%r" % (l1, l2, ignore) - self.fail("%r missing" % missing.pop()) - - def assertHasattr(self, obj, attr, ignore): - ''' succeed iff hasattr(obj,attr) or attr in ignore. ''' - if attr in ignore: return - if not hasattr(obj, attr): print "???", attr - self.failUnless(hasattr(obj, attr), - 'expected hasattr(%r, %r)' % (obj, attr)) - - - def assertHaskey(self, obj, key, ignore): - ''' succeed iff obj.has_key(key) or key in ignore. ''' - if key in ignore: return - if not obj.has_key(key): - print >>sys.stderr, "***",key - self.failUnless(obj.has_key(key)) - - def assertEqualsOrIgnored(self, a, b, ignore): - ''' succeed iff a == b or a in ignore or b in ignore ''' - if a not in ignore and b not in ignore: - self.assertEquals(a, b) - - def checkModule(self, moduleName, module=None, ignore=()): - ''' succeed iff pyclbr.readmodule_ex(modulename) corresponds - to the actual module object, module. Any identifiers in - ignore are ignored. If no module is provided, the appropriate - module is loaded with __import__.''' - - if module == None: - # Import it. - # ('' is to work around an API silliness in __import__) - module = __import__(moduleName, globals(), {}, ['']) - - dict = pyclbr.readmodule_ex(moduleName) - - def ismethod(oclass, obj, name): - classdict = oclass.__dict__ - if isinstance(obj, FunctionType): - if not isinstance(classdict[name], StaticMethodType): - return False - else: - if not isinstance(obj, MethodType): - return False - if obj.im_self is not None: - if (not isinstance(classdict[name], ClassMethodType) or - obj.im_self is not oclass): - return False - else: - if not isinstance(classdict[name], FunctionType): - return False - - objname = obj.__name__ - if objname.startswith("__") and not objname.endswith("__"): - objname = "_%s%s" % (obj.im_class.__name__, objname) - return objname == name - - # Make sure the toplevel functions and classes are the same. - for name, value in dict.items(): - if name in ignore: - continue - self.assertHasattr(module, name, ignore) - py_item = getattr(module, name) - if isinstance(value, pyclbr.Function): - self.assert_(isinstance(py_item, (FunctionType, BuiltinFunctionType))) - if py_item.__module__ != moduleName: - continue # skip functions that came from somewhere else - self.assertEquals(py_item.__module__, value.module) - else: - self.failUnless(isinstance(py_item, (ClassType, type))) - if py_item.__module__ != moduleName: - continue # skip classes that came from somewhere else - - real_bases = [base.__name__ for base in py_item.__bases__] - pyclbr_bases = [ getattr(base, 'name', base) - for base in value.super ] - - try: - self.assertListEq(real_bases, pyclbr_bases, ignore) - except: - print >>sys.stderr, "class=%s" % py_item - raise - - actualMethods = [] - for m in py_item.__dict__.keys(): - if ismethod(py_item, getattr(py_item, m), m): - actualMethods.append(m) - foundMethods = [] - for m in value.methods.keys(): - if m[:2] == '__' and m[-2:] != '__': - foundMethods.append('_'+name+m) - else: - foundMethods.append(m) - - try: - self.assertListEq(foundMethods, actualMethods, ignore) - self.assertEquals(py_item.__module__, value.module) - - self.assertEqualsOrIgnored(py_item.__name__, value.name, - ignore) - # can't check file or lineno - except: - print >>sys.stderr, "class=%s" % py_item - raise - - # Now check for missing stuff. - def defined_in(item, module): - if isinstance(item, ClassType): - return item.__module__ == module.__name__ - if isinstance(item, FunctionType): - return item.func_globals is module.__dict__ - return False - for name in dir(module): - item = getattr(module, name) - if isinstance(item, (ClassType, FunctionType)): - if defined_in(item, module): - self.assertHaskey(dict, name, ignore) - - def test_easy(self): - self.checkModule('pyclbr') - self.checkModule('doctest') - self.checkModule('rfc822') - self.checkModule('difflib') - - def test_decorators(self): - # XXX: See comment in pyclbr_input.py for a test that would fail - # if it were not commented out. - # - self.checkModule('test.pyclbr_input') - - def test_others(self): - cm = self.checkModule - - # These were once about the 10 longest modules - cm('random', ignore=('Random',)) # from _random import Random as CoreGenerator - cm('cgi', ignore=('log',)) # set with = in module - cm('mhlib') - cm('urllib', ignore=('getproxies_registry', - 'open_https', - 'getproxies_internetconfig',)) # not on all platforms - cm('pickle') - cm('aifc', ignore=('openfp',)) # set with = in module - cm('Cookie') - cm('sre_parse', ignore=('dump',)) # from sre_constants import * - cm('pdb') - cm('pydoc') - - # Tests for modules inside packages - cm('email.parser') - cm('test.test_pyclbr') - - -def test_main(): - run_unittest(PyclbrTest) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_pyexpat.py b/sys/lib/python/test/test_pyexpat.py deleted file mode 100644 index 06988183e..000000000 --- a/sys/lib/python/test/test_pyexpat.py +++ /dev/null @@ -1,388 +0,0 @@ -# Very simple test - Parse a file and print what happens - -# XXX TypeErrors on calling handlers, or on bad return values from a -# handler, are obscure and unhelpful. - -import pyexpat -from xml.parsers import expat - -from test.test_support import sortdict, TestFailed - -class Outputter: - def StartElementHandler(self, name, attrs): - print 'Start element:\n\t', repr(name), sortdict(attrs) - - def EndElementHandler(self, name): - print 'End element:\n\t', repr(name) - - def CharacterDataHandler(self, data): - data = data.strip() - if data: - print 'Character data:' - print '\t', repr(data) - - def ProcessingInstructionHandler(self, target, data): - print 'PI:\n\t', repr(target), repr(data) - - def StartNamespaceDeclHandler(self, prefix, uri): - print 'NS decl:\n\t', repr(prefix), repr(uri) - - def EndNamespaceDeclHandler(self, prefix): - print 'End of NS decl:\n\t', repr(prefix) - - def StartCdataSectionHandler(self): - print 'Start of CDATA section' - - def EndCdataSectionHandler(self): - print 'End of CDATA section' - - def CommentHandler(self, text): - print 'Comment:\n\t', repr(text) - - def NotationDeclHandler(self, *args): - name, base, sysid, pubid = args - print 'Notation declared:', args - - def UnparsedEntityDeclHandler(self, *args): - entityName, base, systemId, publicId, notationName = args - print 'Unparsed entity decl:\n\t', args - - def NotStandaloneHandler(self, userData): - print 'Not standalone' - return 1 - - def ExternalEntityRefHandler(self, *args): - context, base, sysId, pubId = args - print 'External entity ref:', args[1:] - return 1 - - def DefaultHandler(self, userData): - pass - - def DefaultHandlerExpand(self, userData): - pass - - -def confirm(ok): - if ok: - print "OK." - else: - print "Not OK." - -out = Outputter() -parser = expat.ParserCreate(namespace_separator='!') - -# Test getting/setting returns_unicode -parser.returns_unicode = 0; confirm(parser.returns_unicode == 0) -parser.returns_unicode = 1; confirm(parser.returns_unicode == 1) -parser.returns_unicode = 2; confirm(parser.returns_unicode == 1) -parser.returns_unicode = 0; confirm(parser.returns_unicode == 0) - -# Test getting/setting ordered_attributes -parser.ordered_attributes = 0; confirm(parser.ordered_attributes == 0) -parser.ordered_attributes = 1; confirm(parser.ordered_attributes == 1) -parser.ordered_attributes = 2; confirm(parser.ordered_attributes == 1) -parser.ordered_attributes = 0; confirm(parser.ordered_attributes == 0) - -# Test getting/setting specified_attributes -parser.specified_attributes = 0; confirm(parser.specified_attributes == 0) -parser.specified_attributes = 1; confirm(parser.specified_attributes == 1) -parser.specified_attributes = 2; confirm(parser.specified_attributes == 1) -parser.specified_attributes = 0; confirm(parser.specified_attributes == 0) - -HANDLER_NAMES = [ - 'StartElementHandler', 'EndElementHandler', - 'CharacterDataHandler', 'ProcessingInstructionHandler', - 'UnparsedEntityDeclHandler', 'NotationDeclHandler', - 'StartNamespaceDeclHandler', 'EndNamespaceDeclHandler', - 'CommentHandler', 'StartCdataSectionHandler', - 'EndCdataSectionHandler', - 'DefaultHandler', 'DefaultHandlerExpand', - #'NotStandaloneHandler', - 'ExternalEntityRefHandler' - ] -for name in HANDLER_NAMES: - setattr(parser, name, getattr(out, name)) - -data = '''\ - - - - - - - - -%unparsed_entity; -]> - - - - Contents of subelements - - -&external_entity; - -''' - -# Produce UTF-8 output -parser.returns_unicode = 0 -try: - parser.Parse(data, 1) -except expat.error: - print '** Error', parser.ErrorCode, expat.ErrorString(parser.ErrorCode) - print '** Line', parser.ErrorLineNumber - print '** Column', parser.ErrorColumnNumber - print '** Byte', parser.ErrorByteIndex - -# Try the parse again, this time producing Unicode output -parser = expat.ParserCreate(namespace_separator='!') -parser.returns_unicode = 1 - -for name in HANDLER_NAMES: - setattr(parser, name, getattr(out, name)) -try: - parser.Parse(data, 1) -except expat.error: - print '** Error', parser.ErrorCode, expat.ErrorString(parser.ErrorCode) - print '** Line', parser.ErrorLineNumber - print '** Column', parser.ErrorColumnNumber - print '** Byte', parser.ErrorByteIndex - -# Try parsing a file -parser = expat.ParserCreate(namespace_separator='!') -parser.returns_unicode = 1 - -for name in HANDLER_NAMES: - setattr(parser, name, getattr(out, name)) -import StringIO -file = StringIO.StringIO(data) -try: - parser.ParseFile(file) -except expat.error: - print '** Error', parser.ErrorCode, expat.ErrorString(parser.ErrorCode) - print '** Line', parser.ErrorLineNumber - print '** Column', parser.ErrorColumnNumber - print '** Byte', parser.ErrorByteIndex - - -# Tests that make sure we get errors when the namespace_separator value -# is illegal, and that we don't for good values: -print -print "Testing constructor for proper handling of namespace_separator values:" -expat.ParserCreate() -expat.ParserCreate(namespace_separator=None) -expat.ParserCreate(namespace_separator=' ') -print "Legal values tested o.k." -try: - expat.ParserCreate(namespace_separator=42) -except TypeError, e: - print "Caught expected TypeError:" - print e -else: - print "Failed to catch expected TypeError." - -try: - expat.ParserCreate(namespace_separator='too long') -except ValueError, e: - print "Caught expected ValueError:" - print e -else: - print "Failed to catch expected ValueError." - -# ParserCreate() needs to accept a namespace_separator of zero length -# to satisfy the requirements of RDF applications that are required -# to simply glue together the namespace URI and the localname. Though -# considered a wart of the RDF specifications, it needs to be supported. -# -# See XML-SIG mailing list thread starting with -# http://mail.python.org/pipermail/xml-sig/2001-April/005202.html -# -expat.ParserCreate(namespace_separator='') # too short - -# Test the interning machinery. -p = expat.ParserCreate() -L = [] -def collector(name, *args): - L.append(name) -p.StartElementHandler = collector -p.EndElementHandler = collector -p.Parse(" ", 1) -tag = L[0] -if len(L) != 6: - print "L should only contain 6 entries; found", len(L) -for entry in L: - if tag is not entry: - print "expected L to contain many references to the same string", - print "(it didn't)" - print "L =", repr(L) - break - -# Tests of the buffer_text attribute. -import sys - -class TextCollector: - def __init__(self, parser): - self.stuff = [] - - def check(self, expected, label): - require(self.stuff == expected, - "%s\nstuff = %r\nexpected = %r" - % (label, self.stuff, map(unicode, expected))) - - def CharacterDataHandler(self, text): - self.stuff.append(text) - - def StartElementHandler(self, name, attrs): - self.stuff.append("<%s>" % name) - bt = attrs.get("buffer-text") - if bt == "yes": - parser.buffer_text = 1 - elif bt == "no": - parser.buffer_text = 0 - - def EndElementHandler(self, name): - self.stuff.append("" % name) - - def CommentHandler(self, data): - self.stuff.append("" % data) - -def require(cond, label): - # similar to confirm(), but no extraneous output - if not cond: - raise TestFailed(label) - -def setup(handlers=[]): - parser = expat.ParserCreate() - require(not parser.buffer_text, - "buffer_text not disabled by default") - parser.buffer_text = 1 - handler = TextCollector(parser) - parser.CharacterDataHandler = handler.CharacterDataHandler - for name in handlers: - setattr(parser, name, getattr(handler, name)) - return parser, handler - -parser, handler = setup() -require(parser.buffer_text, - "text buffering either not acknowledged or not enabled") -parser.Parse("123", 1) -handler.check(["123"], - "buffered text not properly collapsed") - -# XXX This test exposes more detail of Expat's text chunking than we -# XXX like, but it tests what we need to concisely. -parser, handler = setup(["StartElementHandler"]) -parser.Parse("12\n34\n5", 1) -handler.check(["", "1", "", "2", "\n", "3", "", "4\n5"], - "buffering control not reacting as expected") - -parser, handler = setup() -parser.Parse("1<2> \n 3", 1) -handler.check(["1<2> \n 3"], - "buffered text not properly collapsed") - -parser, handler = setup(["StartElementHandler"]) -parser.Parse("123", 1) -handler.check(["", "1", "", "2", "", "3"], - "buffered text not properly split") - -parser, handler = setup(["StartElementHandler", "EndElementHandler"]) -parser.CharacterDataHandler = None -parser.Parse("123", 1) -handler.check(["", "", "", "", "", ""], - "huh?") - -parser, handler = setup(["StartElementHandler", "EndElementHandler"]) -parser.Parse("123", 1) -handler.check(["", "1", "", "", "2", "", "", "3", ""], - "huh?") - -parser, handler = setup(["CommentHandler", "EndElementHandler", - "StartElementHandler"]) -parser.Parse("12345 ", 1) -handler.check(["", "1", "", "", "2", "", "", "345", ""], - "buffered text not properly split") - -parser, handler = setup(["CommentHandler", "EndElementHandler", - "StartElementHandler"]) -parser.Parse("12345 ", 1) -handler.check(["", "1", "", "", "2", "", "", "3", - "", "4", "", "5", ""], - "buffered text not properly split") - -# Test handling of exception from callback: -def StartElementHandler(name, attrs): - raise RuntimeError(name) - -parser = expat.ParserCreate() -parser.StartElementHandler = StartElementHandler - -try: - parser.Parse("", 1) -except RuntimeError, e: - if e.args[0] != "a": - print "Expected RuntimeError for element 'a'; found %r" % e.args[0] -else: - print "Expected RuntimeError for 'a'" - -# Test Current* members: -class PositionTest: - - def __init__(self, expected_list, parser): - self.parser = parser - self.parser.StartElementHandler = self.StartElementHandler - self.parser.EndElementHandler = self.EndElementHandler - self.expected_list = expected_list - self.upto = 0 - - def StartElementHandler(self, name, attrs): - self.check_pos('s') - - def EndElementHandler(self, name): - self.check_pos('e') - - def check_pos(self, event): - pos = (event, - self.parser.CurrentByteIndex, - self.parser.CurrentLineNumber, - self.parser.CurrentColumnNumber) - require(self.upto < len(self.expected_list), - 'too many parser events') - expected = self.expected_list[self.upto] - require(pos == expected, - 'expected position %s, got %s' % (expected, pos)) - self.upto += 1 - - -parser = expat.ParserCreate() -handler = PositionTest([('s', 0, 1, 0), ('s', 5, 2, 1), ('s', 11, 3, 2), - ('e', 15, 3, 6), ('e', 17, 4, 1), ('e', 22, 5, 0)], - parser) -parser.Parse(''' - - - -''', 1) - - -def test_parse_only_xml_data(): - # http://python.org/sf/1296433 - # - xml = "%s" % ('a' * 1025) - # this one doesn't crash - #xml = "%s" % ('a' * 10000) - - def handler(text): - raise Exception - - parser = expat.ParserCreate() - parser.CharacterDataHandler = handler - - try: - parser.Parse(xml) - except: - pass - -test_parse_only_xml_data() diff --git a/sys/lib/python/test/test_queue.py b/sys/lib/python/test/test_queue.py deleted file mode 100644 index 66977e64f..000000000 --- a/sys/lib/python/test/test_queue.py +++ /dev/null @@ -1,281 +0,0 @@ -# Some simple Queue module tests, plus some failure conditions -# to ensure the Queue locks remain stable. -import Queue -import sys -import threading -import time - -from test.test_support import verify, TestFailed, verbose - -QUEUE_SIZE = 5 - -# A thread to run a function that unclogs a blocked Queue. -class _TriggerThread(threading.Thread): - def __init__(self, fn, args): - self.fn = fn - self.args = args - self.startedEvent = threading.Event() - threading.Thread.__init__(self) - - def run(self): - # The sleep isn't necessary, but is intended to give the blocking - # function in the main thread a chance at actually blocking before - # we unclog it. But if the sleep is longer than the timeout-based - # tests wait in their blocking functions, those tests will fail. - # So we give them much longer timeout values compared to the - # sleep here (I aimed at 10 seconds for blocking functions -- - # they should never actually wait that long - they should make - # progress as soon as we call self.fn()). - time.sleep(0.1) - self.startedEvent.set() - self.fn(*self.args) - -# Execute a function that blocks, and in a separate thread, a function that -# triggers the release. Returns the result of the blocking function. -# Caution: block_func must guarantee to block until trigger_func is -# called, and trigger_func must guarantee to change queue state so that -# block_func can make enough progress to return. In particular, a -# block_func that just raises an exception regardless of whether trigger_func -# is called will lead to timing-dependent sporadic failures, and one of -# those went rarely seen but undiagnosed for years. Now block_func -# must be unexceptional. If block_func is supposed to raise an exception, -# call _doExceptionalBlockingTest() instead. -def _doBlockingTest(block_func, block_args, trigger_func, trigger_args): - t = _TriggerThread(trigger_func, trigger_args) - t.start() - result = block_func(*block_args) - # If block_func returned before our thread made the call, we failed! - if not t.startedEvent.isSet(): - raise TestFailed("blocking function '%r' appeared not to block" % - block_func) - t.join(10) # make sure the thread terminates - if t.isAlive(): - raise TestFailed("trigger function '%r' appeared to not return" % - trigger_func) - return result - -# Call this instead if block_func is supposed to raise an exception. -def _doExceptionalBlockingTest(block_func, block_args, trigger_func, - trigger_args, expected_exception_class): - t = _TriggerThread(trigger_func, trigger_args) - t.start() - try: - try: - block_func(*block_args) - except expected_exception_class: - raise - else: - raise TestFailed("expected exception of kind %r" % - expected_exception_class) - finally: - t.join(10) # make sure the thread terminates - if t.isAlive(): - raise TestFailed("trigger function '%r' appeared to not return" % - trigger_func) - if not t.startedEvent.isSet(): - raise TestFailed("trigger thread ended but event never set") - -# A Queue subclass that can provoke failure at a moment's notice :) -class FailingQueueException(Exception): - pass - -class FailingQueue(Queue.Queue): - def __init__(self, *args): - self.fail_next_put = False - self.fail_next_get = False - Queue.Queue.__init__(self, *args) - def _put(self, item): - if self.fail_next_put: - self.fail_next_put = False - raise FailingQueueException, "You Lose" - return Queue.Queue._put(self, item) - def _get(self): - if self.fail_next_get: - self.fail_next_get = False - raise FailingQueueException, "You Lose" - return Queue.Queue._get(self) - -def FailingQueueTest(q): - if not q.empty(): - raise RuntimeError, "Call this function with an empty queue" - for i in range(QUEUE_SIZE-1): - q.put(i) - # Test a failing non-blocking put. - q.fail_next_put = True - try: - q.put("oops", block=0) - raise TestFailed("The queue didn't fail when it should have") - except FailingQueueException: - pass - q.fail_next_put = True - try: - q.put("oops", timeout=0.1) - raise TestFailed("The queue didn't fail when it should have") - except FailingQueueException: - pass - q.put("last") - verify(q.full(), "Queue should be full") - # Test a failing blocking put - q.fail_next_put = True - try: - _doBlockingTest(q.put, ("full",), q.get, ()) - raise TestFailed("The queue didn't fail when it should have") - except FailingQueueException: - pass - # Check the Queue isn't damaged. - # put failed, but get succeeded - re-add - q.put("last") - # Test a failing timeout put - q.fail_next_put = True - try: - _doExceptionalBlockingTest(q.put, ("full", True, 10), q.get, (), - FailingQueueException) - raise TestFailed("The queue didn't fail when it should have") - except FailingQueueException: - pass - # Check the Queue isn't damaged. - # put failed, but get succeeded - re-add - q.put("last") - verify(q.full(), "Queue should be full") - q.get() - verify(not q.full(), "Queue should not be full") - q.put("last") - verify(q.full(), "Queue should be full") - # Test a blocking put - _doBlockingTest( q.put, ("full",), q.get, ()) - # Empty it - for i in range(QUEUE_SIZE): - q.get() - verify(q.empty(), "Queue should be empty") - q.put("first") - q.fail_next_get = True - try: - q.get() - raise TestFailed("The queue didn't fail when it should have") - except FailingQueueException: - pass - verify(not q.empty(), "Queue should not be empty") - q.fail_next_get = True - try: - q.get(timeout=0.1) - raise TestFailed("The queue didn't fail when it should have") - except FailingQueueException: - pass - verify(not q.empty(), "Queue should not be empty") - q.get() - verify(q.empty(), "Queue should be empty") - q.fail_next_get = True - try: - _doExceptionalBlockingTest(q.get, (), q.put, ('empty',), - FailingQueueException) - raise TestFailed("The queue didn't fail when it should have") - except FailingQueueException: - pass - # put succeeded, but get failed. - verify(not q.empty(), "Queue should not be empty") - q.get() - verify(q.empty(), "Queue should be empty") - -def SimpleQueueTest(q): - if not q.empty(): - raise RuntimeError, "Call this function with an empty queue" - # I guess we better check things actually queue correctly a little :) - q.put(111) - q.put(222) - verify(q.get() == 111 and q.get() == 222, - "Didn't seem to queue the correct data!") - for i in range(QUEUE_SIZE-1): - q.put(i) - verify(not q.empty(), "Queue should not be empty") - verify(not q.full(), "Queue should not be full") - q.put("last") - verify(q.full(), "Queue should be full") - try: - q.put("full", block=0) - raise TestFailed("Didn't appear to block with a full queue") - except Queue.Full: - pass - try: - q.put("full", timeout=0.01) - raise TestFailed("Didn't appear to time-out with a full queue") - except Queue.Full: - pass - # Test a blocking put - _doBlockingTest(q.put, ("full",), q.get, ()) - _doBlockingTest(q.put, ("full", True, 10), q.get, ()) - # Empty it - for i in range(QUEUE_SIZE): - q.get() - verify(q.empty(), "Queue should be empty") - try: - q.get(block=0) - raise TestFailed("Didn't appear to block with an empty queue") - except Queue.Empty: - pass - try: - q.get(timeout=0.01) - raise TestFailed("Didn't appear to time-out with an empty queue") - except Queue.Empty: - pass - # Test a blocking get - _doBlockingTest(q.get, (), q.put, ('empty',)) - _doBlockingTest(q.get, (True, 10), q.put, ('empty',)) - -cum = 0 -cumlock = threading.Lock() - -def worker(q): - global cum - while True: - x = q.get() - if x is None: - q.task_done() - return - cumlock.acquire() - try: - cum += x - finally: - cumlock.release() - q.task_done() - -def QueueJoinTest(q): - global cum - cum = 0 - for i in (0,1): - threading.Thread(target=worker, args=(q,)).start() - for i in xrange(100): - q.put(i) - q.join() - verify(cum==sum(range(100)), "q.join() did not block until all tasks were done") - for i in (0,1): - q.put(None) # instruct the threads to close - q.join() # verify that you can join twice - -def QueueTaskDoneTest(q): - try: - q.task_done() - except ValueError: - pass - else: - raise TestFailed("Did not detect task count going negative") - -def test(): - q = Queue.Queue() - QueueTaskDoneTest(q) - QueueJoinTest(q) - QueueJoinTest(q) - QueueTaskDoneTest(q) - - q = Queue.Queue(QUEUE_SIZE) - # Do it a couple of times on the same queue - SimpleQueueTest(q) - SimpleQueueTest(q) - if verbose: - print "Simple Queue tests seemed to work" - q = FailingQueue(QUEUE_SIZE) - FailingQueueTest(q) - FailingQueueTest(q) - if verbose: - print "Failing Queue tests seemed to work" - -test() diff --git a/sys/lib/python/test/test_quopri.py b/sys/lib/python/test/test_quopri.py deleted file mode 100644 index 631c97435..000000000 --- a/sys/lib/python/test/test_quopri.py +++ /dev/null @@ -1,199 +0,0 @@ -from test import test_support -import unittest - -import sys, os, cStringIO, subprocess -import quopri - - - -ENCSAMPLE = """\ -Here's a bunch of special=20 - -=A1=A2=A3=A4=A5=A6=A7=A8=A9 -=AA=AB=AC=AD=AE=AF=B0=B1=B2=B3 -=B4=B5=B6=B7=B8=B9=BA=BB=BC=BD=BE -=BF=C0=C1=C2=C3=C4=C5=C6 -=C7=C8=C9=CA=CB=CC=CD=CE=CF -=D0=D1=D2=D3=D4=D5=D6=D7 -=D8=D9=DA=DB=DC=DD=DE=DF -=E0=E1=E2=E3=E4=E5=E6=E7 -=E8=E9=EA=EB=EC=ED=EE=EF -=F0=F1=F2=F3=F4=F5=F6=F7 -=F8=F9=FA=FB=FC=FD=FE=FF - -characters... have fun! -""" - -# First line ends with a space -DECSAMPLE = "Here's a bunch of special \n" + \ -"""\ - -\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9 -\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3 -\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe -\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6 -\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf -\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7 -\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf -\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7 -\xe8\xe9\xea\xeb\xec\xed\xee\xef -\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7 -\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff - -characters... have fun! -""" - - -def withpythonimplementation(testfunc): - def newtest(self): - # Test default implementation - testfunc(self) - # Test Python implementation - if quopri.b2a_qp is not None or quopri.a2b_qp is not None: - oldencode = quopri.b2a_qp - olddecode = quopri.a2b_qp - try: - quopri.b2a_qp = None - quopri.a2b_qp = None - testfunc(self) - finally: - quopri.b2a_qp = oldencode - quopri.a2b_qp = olddecode - newtest.__name__ = testfunc.__name__ - return newtest - -class QuopriTestCase(unittest.TestCase): - # Each entry is a tuple of (plaintext, encoded string). These strings are - # used in the "quotetabs=0" tests. - STRINGS = ( - # Some normal strings - ('hello', 'hello'), - ('''hello - there - world''', '''hello - there - world'''), - ('''hello - there - world -''', '''hello - there - world -'''), - ('\201\202\203', '=81=82=83'), - # Add some trailing MUST QUOTE strings - ('hello ', 'hello=20'), - ('hello\t', 'hello=09'), - # Some long lines. First, a single line of 108 characters - ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', - '''xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=D8=D9=DA=DB=DC=DD=DE=DFx= -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'''), - # A line of exactly 76 characters, no soft line break should be needed - ('yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', - 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'), - # A line of 77 characters, forcing a soft line break at position 75, - # and a second line of exactly 2 characters (because the soft line - # break `=' sign counts against the line length limit). - ('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', - '''zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz= -zz'''), - # A line of 151 characters, forcing a soft line break at position 75, - # with a second line of exactly 76 characters and no trailing = - ('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', - '''zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz= -zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'''), - # A string containing a hard line break, but which the first line is - # 151 characters and the second line is exactly 76 characters. This - # should leave us with three lines, the first which has a soft line - # break, and which the second and third do not. - ('''yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy -zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''', - '''yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy= -yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy -zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'''), - # Now some really complex stuff ;) - (DECSAMPLE, ENCSAMPLE), - ) - - # These are used in the "quotetabs=1" tests. - ESTRINGS = ( - ('hello world', 'hello=20world'), - ('hello\tworld', 'hello=09world'), - ) - - # These are used in the "header=1" tests. - HSTRINGS = ( - ('hello world', 'hello_world'), - ('hello_world', 'hello=5Fworld'), - ) - - @withpythonimplementation - def test_encodestring(self): - for p, e in self.STRINGS: - self.assert_(quopri.encodestring(p) == e) - - @withpythonimplementation - def test_decodestring(self): - for p, e in self.STRINGS: - self.assert_(quopri.decodestring(e) == p) - - @withpythonimplementation - def test_idempotent_string(self): - for p, e in self.STRINGS: - self.assert_(quopri.decodestring(quopri.encodestring(e)) == e) - - @withpythonimplementation - def test_encode(self): - for p, e in self.STRINGS: - infp = cStringIO.StringIO(p) - outfp = cStringIO.StringIO() - quopri.encode(infp, outfp, quotetabs=False) - self.assert_(outfp.getvalue() == e) - - @withpythonimplementation - def test_decode(self): - for p, e in self.STRINGS: - infp = cStringIO.StringIO(e) - outfp = cStringIO.StringIO() - quopri.decode(infp, outfp) - self.assert_(outfp.getvalue() == p) - - @withpythonimplementation - def test_embedded_ws(self): - for p, e in self.ESTRINGS: - self.assert_(quopri.encodestring(p, quotetabs=True) == e) - self.assert_(quopri.decodestring(e) == p) - - @withpythonimplementation - def test_encode_header(self): - for p, e in self.HSTRINGS: - self.assert_(quopri.encodestring(p, header=True) == e) - - @withpythonimplementation - def test_decode_header(self): - for p, e in self.HSTRINGS: - self.assert_(quopri.decodestring(e, header=True) == p) - - def test_scriptencode(self): - (p, e) = self.STRINGS[-1] - process = subprocess.Popen([sys.executable, "-mquopri"], - stdin=subprocess.PIPE, stdout=subprocess.PIPE) - cout, cerr = process.communicate(p) - # On Windows, Python will output the result to stdout using - # CRLF, as the mode of stdout is text mode. To compare this - # with the expected result, we need to do a line-by-line comparison. - self.assert_(cout.splitlines() == e.splitlines()) - - def test_scriptdecode(self): - (p, e) = self.STRINGS[-1] - process = subprocess.Popen([sys.executable, "-mquopri", "-d"], - stdin=subprocess.PIPE, stdout=subprocess.PIPE) - cout, cerr = process.communicate(e) - self.assert_(cout.splitlines() == p.splitlines()) - -def test_main(): - test_support.run_unittest(QuopriTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_random.py b/sys/lib/python/test/test_random.py deleted file mode 100644 index 6ddfb813e..000000000 --- a/sys/lib/python/test/test_random.py +++ /dev/null @@ -1,552 +0,0 @@ -#!/usr/bin/env python - -import unittest -import random -import time -import pickle -import warnings -from math import log, exp, sqrt, pi -from test import test_support - -class TestBasicOps(unittest.TestCase): - # Superclass with tests common to all generators. - # Subclasses must arrange for self.gen to retrieve the Random instance - # to be tested. - - def randomlist(self, n): - """Helper function to make a list of random numbers""" - return [self.gen.random() for i in xrange(n)] - - def test_autoseed(self): - self.gen.seed() - state1 = self.gen.getstate() - time.sleep(0.1) - self.gen.seed() # diffent seeds at different times - state2 = self.gen.getstate() - self.assertNotEqual(state1, state2) - - def test_saverestore(self): - N = 1000 - self.gen.seed() - state = self.gen.getstate() - randseq = self.randomlist(N) - self.gen.setstate(state) # should regenerate the same sequence - self.assertEqual(randseq, self.randomlist(N)) - - def test_seedargs(self): - for arg in [None, 0, 0L, 1, 1L, -1, -1L, 10**20, -(10**20), - 3.14, 1+2j, 'a', tuple('abc')]: - self.gen.seed(arg) - for arg in [range(3), dict(one=1)]: - self.assertRaises(TypeError, self.gen.seed, arg) - self.assertRaises(TypeError, self.gen.seed, 1, 2) - self.assertRaises(TypeError, type(self.gen), []) - - def test_jumpahead(self): - self.gen.seed() - state1 = self.gen.getstate() - self.gen.jumpahead(100) - state2 = self.gen.getstate() # s/b distinct from state1 - self.assertNotEqual(state1, state2) - self.gen.jumpahead(100) - state3 = self.gen.getstate() # s/b distinct from state2 - self.assertNotEqual(state2, state3) - - self.assertRaises(TypeError, self.gen.jumpahead) # needs an arg - self.assertRaises(TypeError, self.gen.jumpahead, "ick") # wrong type - self.assertRaises(TypeError, self.gen.jumpahead, 2.3) # wrong type - self.assertRaises(TypeError, self.gen.jumpahead, 2, 3) # too many - - def test_sample(self): - # For the entire allowable range of 0 <= k <= N, validate that - # the sample is of the correct length and contains only unique items - N = 100 - population = xrange(N) - for k in xrange(N+1): - s = self.gen.sample(population, k) - self.assertEqual(len(s), k) - uniq = set(s) - self.assertEqual(len(uniq), k) - self.failUnless(uniq <= set(population)) - self.assertEqual(self.gen.sample([], 0), []) # test edge case N==k==0 - - def test_sample_distribution(self): - # For the entire allowable range of 0 <= k <= N, validate that - # sample generates all possible permutations - n = 5 - pop = range(n) - trials = 10000 # large num prevents false negatives without slowing normal case - def factorial(n): - return reduce(int.__mul__, xrange(1, n), 1) - for k in xrange(n): - expected = factorial(n) // factorial(n-k) - perms = {} - for i in xrange(trials): - perms[tuple(self.gen.sample(pop, k))] = None - if len(perms) == expected: - break - else: - self.fail() - - def test_sample_inputs(self): - # SF bug #801342 -- population can be any iterable defining __len__() - self.gen.sample(set(range(20)), 2) - self.gen.sample(range(20), 2) - self.gen.sample(xrange(20), 2) - self.gen.sample(str('abcdefghijklmnopqrst'), 2) - self.gen.sample(tuple('abcdefghijklmnopqrst'), 2) - - def test_sample_on_dicts(self): - self.gen.sample(dict.fromkeys('abcdefghijklmnopqrst'), 2) - - # SF bug #1460340 -- random.sample can raise KeyError - a = dict.fromkeys(range(10)+range(10,100,2)+range(100,110)) - self.gen.sample(a, 3) - - # A followup to bug #1460340: sampling from a dict could return - # a subset of its keys or of its values, depending on the size of - # the subset requested. - N = 30 - d = dict((i, complex(i, i)) for i in xrange(N)) - for k in xrange(N+1): - samp = self.gen.sample(d, k) - # Verify that we got ints back (keys); the values are complex. - for x in samp: - self.assert_(type(x) is int) - samp.sort() - self.assertEqual(samp, range(N)) - - def test_gauss(self): - # Ensure that the seed() method initializes all the hidden state. In - # particular, through 2.2.1 it failed to reset a piece of state used - # by (and only by) the .gauss() method. - - for seed in 1, 12, 123, 1234, 12345, 123456, 654321: - self.gen.seed(seed) - x1 = self.gen.random() - y1 = self.gen.gauss(0, 1) - - self.gen.seed(seed) - x2 = self.gen.random() - y2 = self.gen.gauss(0, 1) - - self.assertEqual(x1, x2) - self.assertEqual(y1, y2) - - def test_pickling(self): - state = pickle.dumps(self.gen) - origseq = [self.gen.random() for i in xrange(10)] - newgen = pickle.loads(state) - restoredseq = [newgen.random() for i in xrange(10)] - self.assertEqual(origseq, restoredseq) - -class WichmannHill_TestBasicOps(TestBasicOps): - gen = random.WichmannHill() - - def test_setstate_first_arg(self): - self.assertRaises(ValueError, self.gen.setstate, (2, None, None)) - - def test_strong_jumpahead(self): - # tests that jumpahead(n) semantics correspond to n calls to random() - N = 1000 - s = self.gen.getstate() - self.gen.jumpahead(N) - r1 = self.gen.random() - # now do it the slow way - self.gen.setstate(s) - for i in xrange(N): - self.gen.random() - r2 = self.gen.random() - self.assertEqual(r1, r2) - - def test_gauss_with_whseed(self): - # Ensure that the seed() method initializes all the hidden state. In - # particular, through 2.2.1 it failed to reset a piece of state used - # by (and only by) the .gauss() method. - - for seed in 1, 12, 123, 1234, 12345, 123456, 654321: - self.gen.whseed(seed) - x1 = self.gen.random() - y1 = self.gen.gauss(0, 1) - - self.gen.whseed(seed) - x2 = self.gen.random() - y2 = self.gen.gauss(0, 1) - - self.assertEqual(x1, x2) - self.assertEqual(y1, y2) - - def test_bigrand(self): - # Verify warnings are raised when randrange is too large for random() - oldfilters = warnings.filters[:] - warnings.filterwarnings("error", "Underlying random") - self.assertRaises(UserWarning, self.gen.randrange, 2**60) - warnings.filters[:] = oldfilters - -class SystemRandom_TestBasicOps(TestBasicOps): - gen = random.SystemRandom() - - def test_autoseed(self): - # Doesn't need to do anything except not fail - self.gen.seed() - - def test_saverestore(self): - self.assertRaises(NotImplementedError, self.gen.getstate) - self.assertRaises(NotImplementedError, self.gen.setstate, None) - - def test_seedargs(self): - # Doesn't need to do anything except not fail - self.gen.seed(100) - - def test_jumpahead(self): - # Doesn't need to do anything except not fail - self.gen.jumpahead(100) - - def test_gauss(self): - self.gen.gauss_next = None - self.gen.seed(100) - self.assertEqual(self.gen.gauss_next, None) - - def test_pickling(self): - self.assertRaises(NotImplementedError, pickle.dumps, self.gen) - - def test_53_bits_per_float(self): - # This should pass whenever a C double has 53 bit precision. - span = 2 ** 53 - cum = 0 - for i in xrange(100): - cum |= int(self.gen.random() * span) - self.assertEqual(cum, span-1) - - def test_bigrand(self): - # The randrange routine should build-up the required number of bits - # in stages so that all bit positions are active. - span = 2 ** 500 - cum = 0 - for i in xrange(100): - r = self.gen.randrange(span) - self.assert_(0 <= r < span) - cum |= r - self.assertEqual(cum, span-1) - - def test_bigrand_ranges(self): - for i in [40,80, 160, 200, 211, 250, 375, 512, 550]: - start = self.gen.randrange(2 ** i) - stop = self.gen.randrange(2 ** (i-2)) - if stop <= start: - return - self.assert_(start <= self.gen.randrange(start, stop) < stop) - - def test_rangelimits(self): - for start, stop in [(-2,0), (-(2**60)-2,-(2**60)), (2**60,2**60+2)]: - self.assertEqual(set(range(start,stop)), - set([self.gen.randrange(start,stop) for i in xrange(100)])) - - def test_genrandbits(self): - # Verify ranges - for k in xrange(1, 1000): - self.assert_(0 <= self.gen.getrandbits(k) < 2**k) - - # Verify all bits active - getbits = self.gen.getrandbits - for span in [1, 2, 3, 4, 31, 32, 32, 52, 53, 54, 119, 127, 128, 129]: - cum = 0 - for i in xrange(100): - cum |= getbits(span) - self.assertEqual(cum, 2**span-1) - - # Verify argument checking - self.assertRaises(TypeError, self.gen.getrandbits) - self.assertRaises(TypeError, self.gen.getrandbits, 1, 2) - self.assertRaises(ValueError, self.gen.getrandbits, 0) - self.assertRaises(ValueError, self.gen.getrandbits, -1) - self.assertRaises(TypeError, self.gen.getrandbits, 10.1) - - def test_randbelow_logic(self, _log=log, int=int): - # check bitcount transition points: 2**i and 2**(i+1)-1 - # show that: k = int(1.001 + _log(n, 2)) - # is equal to or one greater than the number of bits in n - for i in xrange(1, 1000): - n = 1L << i # check an exact power of two - numbits = i+1 - k = int(1.00001 + _log(n, 2)) - self.assertEqual(k, numbits) - self.assert_(n == 2**(k-1)) - - n += n - 1 # check 1 below the next power of two - k = int(1.00001 + _log(n, 2)) - self.assert_(k in [numbits, numbits+1]) - self.assert_(2**k > n > 2**(k-2)) - - n -= n >> 15 # check a little farther below the next power of two - k = int(1.00001 + _log(n, 2)) - self.assertEqual(k, numbits) # note the stronger assertion - self.assert_(2**k > n > 2**(k-1)) # note the stronger assertion - - -class MersenneTwister_TestBasicOps(TestBasicOps): - gen = random.Random() - - def test_setstate_first_arg(self): - self.assertRaises(ValueError, self.gen.setstate, (1, None, None)) - - def test_setstate_middle_arg(self): - # Wrong type, s/b tuple - self.assertRaises(TypeError, self.gen.setstate, (2, None, None)) - # Wrong length, s/b 625 - self.assertRaises(ValueError, self.gen.setstate, (2, (1,2,3), None)) - # Wrong type, s/b tuple of 625 ints - self.assertRaises(TypeError, self.gen.setstate, (2, ('a',)*625, None)) - # Last element s/b an int also - self.assertRaises(TypeError, self.gen.setstate, (2, (0,)*624+('a',), None)) - - def test_referenceImplementation(self): - # Compare the python implementation with results from the original - # code. Create 2000 53-bit precision random floats. Compare only - # the last ten entries to show that the independent implementations - # are tracking. Here is the main() function needed to create the - # list of expected random numbers: - # void main(void){ - # int i; - # unsigned long init[4]={61731, 24903, 614, 42143}, length=4; - # init_by_array(init, length); - # for (i=0; i<2000; i++) { - # printf("%.15f ", genrand_res53()); - # if (i%5==4) printf("\n"); - # } - # } - expected = [0.45839803073713259, - 0.86057815201978782, - 0.92848331726782152, - 0.35932681119782461, - 0.081823493762449573, - 0.14332226470169329, - 0.084297823823520024, - 0.53814864671831453, - 0.089215024911993401, - 0.78486196105372907] - - self.gen.seed(61731L + (24903L<<32) + (614L<<64) + (42143L<<96)) - actual = self.randomlist(2000)[-10:] - for a, e in zip(actual, expected): - self.assertAlmostEqual(a,e,places=14) - - def test_strong_reference_implementation(self): - # Like test_referenceImplementation, but checks for exact bit-level - # equality. This should pass on any box where C double contains - # at least 53 bits of precision (the underlying algorithm suffers - # no rounding errors -- all results are exact). - from math import ldexp - - expected = [0x0eab3258d2231fL, - 0x1b89db315277a5L, - 0x1db622a5518016L, - 0x0b7f9af0d575bfL, - 0x029e4c4db82240L, - 0x04961892f5d673L, - 0x02b291598e4589L, - 0x11388382c15694L, - 0x02dad977c9e1feL, - 0x191d96d4d334c6L] - self.gen.seed(61731L + (24903L<<32) + (614L<<64) + (42143L<<96)) - actual = self.randomlist(2000)[-10:] - for a, e in zip(actual, expected): - self.assertEqual(long(ldexp(a, 53)), e) - - def test_long_seed(self): - # This is most interesting to run in debug mode, just to make sure - # nothing blows up. Under the covers, a dynamically resized array - # is allocated, consuming space proportional to the number of bits - # in the seed. Unfortunately, that's a quadratic-time algorithm, - # so don't make this horribly big. - seed = (1L << (10000 * 8)) - 1 # about 10K bytes - self.gen.seed(seed) - - def test_53_bits_per_float(self): - # This should pass whenever a C double has 53 bit precision. - span = 2 ** 53 - cum = 0 - for i in xrange(100): - cum |= int(self.gen.random() * span) - self.assertEqual(cum, span-1) - - def test_bigrand(self): - # The randrange routine should build-up the required number of bits - # in stages so that all bit positions are active. - span = 2 ** 500 - cum = 0 - for i in xrange(100): - r = self.gen.randrange(span) - self.assert_(0 <= r < span) - cum |= r - self.assertEqual(cum, span-1) - - def test_bigrand_ranges(self): - for i in [40,80, 160, 200, 211, 250, 375, 512, 550]: - start = self.gen.randrange(2 ** i) - stop = self.gen.randrange(2 ** (i-2)) - if stop <= start: - return - self.assert_(start <= self.gen.randrange(start, stop) < stop) - - def test_rangelimits(self): - for start, stop in [(-2,0), (-(2**60)-2,-(2**60)), (2**60,2**60+2)]: - self.assertEqual(set(range(start,stop)), - set([self.gen.randrange(start,stop) for i in xrange(100)])) - - def test_genrandbits(self): - # Verify cross-platform repeatability - self.gen.seed(1234567) - self.assertEqual(self.gen.getrandbits(100), - 97904845777343510404718956115L) - # Verify ranges - for k in xrange(1, 1000): - self.assert_(0 <= self.gen.getrandbits(k) < 2**k) - - # Verify all bits active - getbits = self.gen.getrandbits - for span in [1, 2, 3, 4, 31, 32, 32, 52, 53, 54, 119, 127, 128, 129]: - cum = 0 - for i in xrange(100): - cum |= getbits(span) - self.assertEqual(cum, 2**span-1) - - # Verify argument checking - self.assertRaises(TypeError, self.gen.getrandbits) - self.assertRaises(TypeError, self.gen.getrandbits, 'a') - self.assertRaises(TypeError, self.gen.getrandbits, 1, 2) - self.assertRaises(ValueError, self.gen.getrandbits, 0) - self.assertRaises(ValueError, self.gen.getrandbits, -1) - - def test_randbelow_logic(self, _log=log, int=int): - # check bitcount transition points: 2**i and 2**(i+1)-1 - # show that: k = int(1.001 + _log(n, 2)) - # is equal to or one greater than the number of bits in n - for i in xrange(1, 1000): - n = 1L << i # check an exact power of two - numbits = i+1 - k = int(1.00001 + _log(n, 2)) - self.assertEqual(k, numbits) - self.assert_(n == 2**(k-1)) - - n += n - 1 # check 1 below the next power of two - k = int(1.00001 + _log(n, 2)) - self.assert_(k in [numbits, numbits+1]) - self.assert_(2**k > n > 2**(k-2)) - - n -= n >> 15 # check a little farther below the next power of two - k = int(1.00001 + _log(n, 2)) - self.assertEqual(k, numbits) # note the stronger assertion - self.assert_(2**k > n > 2**(k-1)) # note the stronger assertion - - def test_randrange_bug_1590891(self): - start = 1000000000000 - stop = -100000000000000000000 - step = -200 - x = self.gen.randrange(start, stop, step) - self.assert_(stop < x <= start) - self.assertEqual((x+stop)%step, 0) - -_gammacoeff = (0.9999999999995183, 676.5203681218835, -1259.139216722289, - 771.3234287757674, -176.6150291498386, 12.50734324009056, - -0.1385710331296526, 0.9934937113930748e-05, 0.1659470187408462e-06) - -def gamma(z, cof=_gammacoeff, g=7): - z -= 1.0 - sum = cof[0] - for i in xrange(1,len(cof)): - sum += cof[i] / (z+i) - z += 0.5 - return (z+g)**z / exp(z+g) * sqrt(2*pi) * sum - -class TestDistributions(unittest.TestCase): - def test_zeroinputs(self): - # Verify that distributions can handle a series of zero inputs' - g = random.Random() - x = [g.random() for i in xrange(50)] + [0.0]*5 - g.random = x[:].pop; g.uniform(1,10) - g.random = x[:].pop; g.paretovariate(1.0) - g.random = x[:].pop; g.expovariate(1.0) - g.random = x[:].pop; g.weibullvariate(1.0, 1.0) - g.random = x[:].pop; g.normalvariate(0.0, 1.0) - g.random = x[:].pop; g.gauss(0.0, 1.0) - g.random = x[:].pop; g.lognormvariate(0.0, 1.0) - g.random = x[:].pop; g.vonmisesvariate(0.0, 1.0) - g.random = x[:].pop; g.gammavariate(0.01, 1.0) - g.random = x[:].pop; g.gammavariate(1.0, 1.0) - g.random = x[:].pop; g.gammavariate(200.0, 1.0) - g.random = x[:].pop; g.betavariate(3.0, 3.0) - - def test_avg_std(self): - # Use integration to test distribution average and standard deviation. - # Only works for distributions which do not consume variates in pairs - g = random.Random() - N = 5000 - x = [i/float(N) for i in xrange(1,N)] - for variate, args, mu, sigmasqrd in [ - (g.uniform, (1.0,10.0), (10.0+1.0)/2, (10.0-1.0)**2/12), - (g.expovariate, (1.5,), 1/1.5, 1/1.5**2), - (g.paretovariate, (5.0,), 5.0/(5.0-1), - 5.0/((5.0-1)**2*(5.0-2))), - (g.weibullvariate, (1.0, 3.0), gamma(1+1/3.0), - gamma(1+2/3.0)-gamma(1+1/3.0)**2) ]: - g.random = x[:].pop - y = [] - for i in xrange(len(x)): - try: - y.append(variate(*args)) - except IndexError: - pass - s1 = s2 = 0 - for e in y: - s1 += e - s2 += (e - mu) ** 2 - N = len(y) - self.assertAlmostEqual(s1/N, mu, 2) - self.assertAlmostEqual(s2/(N-1), sigmasqrd, 2) - -class TestModule(unittest.TestCase): - def testMagicConstants(self): - self.assertAlmostEqual(random.NV_MAGICCONST, 1.71552776992141) - self.assertAlmostEqual(random.TWOPI, 6.28318530718) - self.assertAlmostEqual(random.LOG4, 1.38629436111989) - self.assertAlmostEqual(random.SG_MAGICCONST, 2.50407739677627) - - def test__all__(self): - # tests validity but not completeness of the __all__ list - self.failUnless(set(random.__all__) <= set(dir(random))) - - def test_random_subclass_with_kwargs(self): - # SF bug #1486663 -- this used to erroneously raise a TypeError - class Subclass(random.Random): - def __init__(self, newarg=None): - random.Random.__init__(self) - Subclass(newarg=1) - - -def test_main(verbose=None): - testclasses = [WichmannHill_TestBasicOps, - MersenneTwister_TestBasicOps, - TestDistributions, - TestModule] - - try: - random.SystemRandom().random() - except NotImplementedError: - pass - else: - testclasses.append(SystemRandom_TestBasicOps) - - test_support.run_unittest(*testclasses) - - # verify reference counting - import sys - if verbose and hasattr(sys, "gettotalrefcount"): - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*testclasses) - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_re.py b/sys/lib/python/test/test_re.py deleted file mode 100644 index f15ce09fb..000000000 --- a/sys/lib/python/test/test_re.py +++ /dev/null @@ -1,744 +0,0 @@ -import sys -sys.path = ['.'] + sys.path - -from test.test_support import verbose, run_unittest -import re -from re import Scanner -import sys, os, traceback -from weakref import proxy - -# Misc tests from Tim Peters' re.doc - -# WARNING: Don't change details in these tests if you don't know -# what you're doing. Some of these tests were carefuly modeled to -# cover most of the code. - -import unittest - -class ReTests(unittest.TestCase): - - def test_weakref(self): - s = 'QabbbcR' - x = re.compile('ab+c') - y = proxy(x) - self.assertEqual(x.findall('QabbbcR'), y.findall('QabbbcR')) - - def test_search_star_plus(self): - self.assertEqual(re.search('x*', 'axx').span(0), (0, 0)) - self.assertEqual(re.search('x*', 'axx').span(), (0, 0)) - self.assertEqual(re.search('x+', 'axx').span(0), (1, 3)) - self.assertEqual(re.search('x+', 'axx').span(), (1, 3)) - self.assertEqual(re.search('x', 'aaa'), None) - self.assertEqual(re.match('a*', 'xxx').span(0), (0, 0)) - self.assertEqual(re.match('a*', 'xxx').span(), (0, 0)) - self.assertEqual(re.match('x*', 'xxxa').span(0), (0, 3)) - self.assertEqual(re.match('x*', 'xxxa').span(), (0, 3)) - self.assertEqual(re.match('a+', 'xxx'), None) - - def bump_num(self, matchobj): - int_value = int(matchobj.group(0)) - return str(int_value + 1) - - def test_basic_re_sub(self): - self.assertEqual(re.sub("(?i)b+", "x", "bbbb BBBB"), 'x x') - self.assertEqual(re.sub(r'\d+', self.bump_num, '08.2 -2 23x99y'), - '9.3 -3 24x100y') - self.assertEqual(re.sub(r'\d+', self.bump_num, '08.2 -2 23x99y', 3), - '9.3 -3 23x99y') - - self.assertEqual(re.sub('.', lambda m: r"\n", 'x'), '\\n') - self.assertEqual(re.sub('.', r"\n", 'x'), '\n') - - s = r"\1\1" - self.assertEqual(re.sub('(.)', s, 'x'), 'xx') - self.assertEqual(re.sub('(.)', re.escape(s), 'x'), s) - self.assertEqual(re.sub('(.)', lambda m: s, 'x'), s) - - self.assertEqual(re.sub('(?Px)', '\g\g', 'xx'), 'xxxx') - self.assertEqual(re.sub('(?Px)', '\g\g<1>', 'xx'), 'xxxx') - self.assertEqual(re.sub('(?Px)', '\g\g', 'xx'), 'xxxx') - self.assertEqual(re.sub('(?Px)', '\g<1>\g<1>', 'xx'), 'xxxx') - - self.assertEqual(re.sub('a',r'\t\n\v\r\f\a\b\B\Z\a\A\w\W\s\S\d\D','a'), - '\t\n\v\r\f\a\b\\B\\Z\a\\A\\w\\W\\s\\S\\d\\D') - self.assertEqual(re.sub('a', '\t\n\v\r\f\a', 'a'), '\t\n\v\r\f\a') - self.assertEqual(re.sub('a', '\t\n\v\r\f\a', 'a'), - (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7))) - - self.assertEqual(re.sub('^\s*', 'X', 'test'), 'Xtest') - - def test_bug_449964(self): - # fails for group followed by other escape - self.assertEqual(re.sub(r'(?Px)', '\g<1>\g<1>\\b', 'xx'), - 'xx\bxx\b') - - def test_bug_449000(self): - # Test for sub() on escaped characters - self.assertEqual(re.sub(r'\r\n', r'\n', 'abc\r\ndef\r\n'), - 'abc\ndef\n') - self.assertEqual(re.sub('\r\n', r'\n', 'abc\r\ndef\r\n'), - 'abc\ndef\n') - self.assertEqual(re.sub(r'\r\n', '\n', 'abc\r\ndef\r\n'), - 'abc\ndef\n') - self.assertEqual(re.sub('\r\n', '\n', 'abc\r\ndef\r\n'), - 'abc\ndef\n') - - def test_sub_template_numeric_escape(self): - # bug 776311 and friends - self.assertEqual(re.sub('x', r'\0', 'x'), '\0') - self.assertEqual(re.sub('x', r'\000', 'x'), '\000') - self.assertEqual(re.sub('x', r'\001', 'x'), '\001') - self.assertEqual(re.sub('x', r'\008', 'x'), '\0' + '8') - self.assertEqual(re.sub('x', r'\009', 'x'), '\0' + '9') - self.assertEqual(re.sub('x', r'\111', 'x'), '\111') - self.assertEqual(re.sub('x', r'\117', 'x'), '\117') - - self.assertEqual(re.sub('x', r'\1111', 'x'), '\1111') - self.assertEqual(re.sub('x', r'\1111', 'x'), '\111' + '1') - - self.assertEqual(re.sub('x', r'\00', 'x'), '\x00') - self.assertEqual(re.sub('x', r'\07', 'x'), '\x07') - self.assertEqual(re.sub('x', r'\08', 'x'), '\0' + '8') - self.assertEqual(re.sub('x', r'\09', 'x'), '\0' + '9') - self.assertEqual(re.sub('x', r'\0a', 'x'), '\0' + 'a') - - self.assertEqual(re.sub('x', r'\400', 'x'), '\0') - self.assertEqual(re.sub('x', r'\777', 'x'), '\377') - - self.assertRaises(re.error, re.sub, 'x', r'\1', 'x') - self.assertRaises(re.error, re.sub, 'x', r'\8', 'x') - self.assertRaises(re.error, re.sub, 'x', r'\9', 'x') - self.assertRaises(re.error, re.sub, 'x', r'\11', 'x') - self.assertRaises(re.error, re.sub, 'x', r'\18', 'x') - self.assertRaises(re.error, re.sub, 'x', r'\1a', 'x') - self.assertRaises(re.error, re.sub, 'x', r'\90', 'x') - self.assertRaises(re.error, re.sub, 'x', r'\99', 'x') - self.assertRaises(re.error, re.sub, 'x', r'\118', 'x') # r'\11' + '8' - self.assertRaises(re.error, re.sub, 'x', r'\11a', 'x') - self.assertRaises(re.error, re.sub, 'x', r'\181', 'x') # r'\18' + '1' - self.assertRaises(re.error, re.sub, 'x', r'\800', 'x') # r'\80' + '0' - - # in python2.3 (etc), these loop endlessly in sre_parser.py - self.assertEqual(re.sub('(((((((((((x)))))))))))', r'\11', 'x'), 'x') - self.assertEqual(re.sub('((((((((((y))))))))))(.)', r'\118', 'xyz'), - 'xz8') - self.assertEqual(re.sub('((((((((((y))))))))))(.)', r'\11a', 'xyz'), - 'xza') - - def test_qualified_re_sub(self): - self.assertEqual(re.sub('a', 'b', 'aaaaa'), 'bbbbb') - self.assertEqual(re.sub('a', 'b', 'aaaaa', 1), 'baaaa') - - def test_bug_114660(self): - self.assertEqual(re.sub(r'(\S)\s+(\S)', r'\1 \2', 'hello there'), - 'hello there') - - def test_bug_462270(self): - # Test for empty sub() behaviour, see SF bug #462270 - self.assertEqual(re.sub('x*', '-', 'abxd'), '-a-b-d-') - self.assertEqual(re.sub('x+', '-', 'abxd'), 'ab-d') - - def test_symbolic_refs(self): - self.assertRaises(re.error, re.sub, '(?Px)', '\gx)', '\g<', 'xx') - self.assertRaises(re.error, re.sub, '(?Px)', '\g', 'xx') - self.assertRaises(re.error, re.sub, '(?Px)', '\g', 'xx') - self.assertRaises(re.error, re.sub, '(?Px)', '\g<1a1>', 'xx') - self.assertRaises(IndexError, re.sub, '(?Px)', '\g', 'xx') - self.assertRaises(re.error, re.sub, '(?Px)|(?Py)', '\g', 'xx') - self.assertRaises(re.error, re.sub, '(?Px)|(?Py)', '\\2', 'xx') - self.assertRaises(re.error, re.sub, '(?Px)', '\g<-1>', 'xx') - - def test_re_subn(self): - self.assertEqual(re.subn("(?i)b+", "x", "bbbb BBBB"), ('x x', 2)) - self.assertEqual(re.subn("b+", "x", "bbbb BBBB"), ('x BBBB', 1)) - self.assertEqual(re.subn("b+", "x", "xyz"), ('xyz', 0)) - self.assertEqual(re.subn("b*", "x", "xyz"), ('xxxyxzx', 4)) - self.assertEqual(re.subn("b*", "x", "xyz", 2), ('xxxyz', 2)) - - def test_re_split(self): - self.assertEqual(re.split(":", ":a:b::c"), ['', 'a', 'b', '', 'c']) - self.assertEqual(re.split(":*", ":a:b::c"), ['', 'a', 'b', 'c']) - self.assertEqual(re.split("(:*)", ":a:b::c"), - ['', ':', 'a', ':', 'b', '::', 'c']) - self.assertEqual(re.split("(?::*)", ":a:b::c"), ['', 'a', 'b', 'c']) - self.assertEqual(re.split("(:)*", ":a:b::c"), - ['', ':', 'a', ':', 'b', ':', 'c']) - self.assertEqual(re.split("([b:]+)", ":a:b::c"), - ['', ':', 'a', ':b::', 'c']) - self.assertEqual(re.split("(b)|(:+)", ":a:b::c"), - ['', None, ':', 'a', None, ':', '', 'b', None, '', - None, '::', 'c']) - self.assertEqual(re.split("(?:b)|(?::+)", ":a:b::c"), - ['', 'a', '', '', 'c']) - - def test_qualified_re_split(self): - self.assertEqual(re.split(":", ":a:b::c", 2), ['', 'a', 'b::c']) - self.assertEqual(re.split(':', 'a:b:c:d', 2), ['a', 'b', 'c:d']) - self.assertEqual(re.split("(:)", ":a:b::c", 2), - ['', ':', 'a', ':', 'b::c']) - self.assertEqual(re.split("(:*)", ":a:b::c", 2), - ['', ':', 'a', ':', 'b::c']) - - def test_re_findall(self): - self.assertEqual(re.findall(":+", "abc"), []) - self.assertEqual(re.findall(":+", "a:b::c:::d"), [":", "::", ":::"]) - self.assertEqual(re.findall("(:+)", "a:b::c:::d"), [":", "::", ":::"]) - self.assertEqual(re.findall("(:)(:*)", "a:b::c:::d"), [(":", ""), - (":", ":"), - (":", "::")]) - - def test_bug_117612(self): - self.assertEqual(re.findall(r"(a|(b))", "aba"), - [("a", ""),("b", "b"),("a", "")]) - - def test_re_match(self): - self.assertEqual(re.match('a', 'a').groups(), ()) - self.assertEqual(re.match('(a)', 'a').groups(), ('a',)) - self.assertEqual(re.match(r'(a)', 'a').group(0), 'a') - self.assertEqual(re.match(r'(a)', 'a').group(1), 'a') - self.assertEqual(re.match(r'(a)', 'a').group(1, 1), ('a', 'a')) - - pat = re.compile('((a)|(b))(c)?') - self.assertEqual(pat.match('a').groups(), ('a', 'a', None, None)) - self.assertEqual(pat.match('b').groups(), ('b', None, 'b', None)) - self.assertEqual(pat.match('ac').groups(), ('a', 'a', None, 'c')) - self.assertEqual(pat.match('bc').groups(), ('b', None, 'b', 'c')) - self.assertEqual(pat.match('bc').groups(""), ('b', "", 'b', 'c')) - - # A single group - m = re.match('(a)', 'a') - self.assertEqual(m.group(0), 'a') - self.assertEqual(m.group(0), 'a') - self.assertEqual(m.group(1), 'a') - self.assertEqual(m.group(1, 1), ('a', 'a')) - - pat = re.compile('(?:(?Pa)|(?Pb))(?Pc)?') - self.assertEqual(pat.match('a').group(1, 2, 3), ('a', None, None)) - self.assertEqual(pat.match('b').group('a1', 'b2', 'c3'), - (None, 'b', None)) - self.assertEqual(pat.match('ac').group(1, 'b2', 3), ('a', None, 'c')) - - def test_re_groupref_exists(self): - self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', '(a)').groups(), - ('(', 'a')) - self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', 'a').groups(), - (None, 'a')) - self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', 'a)'), None) - self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', '(a'), None) - self.assertEqual(re.match('^(?:(a)|c)((?(1)b|d))$', 'ab').groups(), - ('a', 'b')) - self.assertEqual(re.match('^(?:(a)|c)((?(1)b|d))$', 'cd').groups(), - (None, 'd')) - self.assertEqual(re.match('^(?:(a)|c)((?(1)|d))$', 'cd').groups(), - (None, 'd')) - self.assertEqual(re.match('^(?:(a)|c)((?(1)|d))$', 'a').groups(), - ('a', '')) - - # Tests for bug #1177831: exercise groups other than the first group - p = re.compile('(?Pa)(?Pb)?((?(g2)c|d))') - self.assertEqual(p.match('abc').groups(), - ('a', 'b', 'c')) - self.assertEqual(p.match('ad').groups(), - ('a', None, 'd')) - self.assertEqual(p.match('abd'), None) - self.assertEqual(p.match('ac'), None) - - - def test_re_groupref(self): - self.assertEqual(re.match(r'^(\|)?([^()]+)\1$', '|a|').groups(), - ('|', 'a')) - self.assertEqual(re.match(r'^(\|)?([^()]+)\1?$', 'a').groups(), - (None, 'a')) - self.assertEqual(re.match(r'^(\|)?([^()]+)\1$', 'a|'), None) - self.assertEqual(re.match(r'^(\|)?([^()]+)\1$', '|a'), None) - self.assertEqual(re.match(r'^(?:(a)|c)(\1)$', 'aa').groups(), - ('a', 'a')) - self.assertEqual(re.match(r'^(?:(a)|c)(\1)?$', 'c').groups(), - (None, None)) - - def test_groupdict(self): - self.assertEqual(re.match('(?Pfirst) (?Psecond)', - 'first second').groupdict(), - {'first':'first', 'second':'second'}) - - def test_expand(self): - self.assertEqual(re.match("(?Pfirst) (?Psecond)", - "first second") - .expand(r"\2 \1 \g \g"), - "second first second first") - - def test_repeat_minmax(self): - self.assertEqual(re.match("^(\w){1}$", "abc"), None) - self.assertEqual(re.match("^(\w){1}?$", "abc"), None) - self.assertEqual(re.match("^(\w){1,2}$", "abc"), None) - self.assertEqual(re.match("^(\w){1,2}?$", "abc"), None) - - self.assertEqual(re.match("^(\w){3}$", "abc").group(1), "c") - self.assertEqual(re.match("^(\w){1,3}$", "abc").group(1), "c") - self.assertEqual(re.match("^(\w){1,4}$", "abc").group(1), "c") - self.assertEqual(re.match("^(\w){3,4}?$", "abc").group(1), "c") - self.assertEqual(re.match("^(\w){3}?$", "abc").group(1), "c") - self.assertEqual(re.match("^(\w){1,3}?$", "abc").group(1), "c") - self.assertEqual(re.match("^(\w){1,4}?$", "abc").group(1), "c") - self.assertEqual(re.match("^(\w){3,4}?$", "abc").group(1), "c") - - self.assertEqual(re.match("^x{1}$", "xxx"), None) - self.assertEqual(re.match("^x{1}?$", "xxx"), None) - self.assertEqual(re.match("^x{1,2}$", "xxx"), None) - self.assertEqual(re.match("^x{1,2}?$", "xxx"), None) - - self.assertNotEqual(re.match("^x{3}$", "xxx"), None) - self.assertNotEqual(re.match("^x{1,3}$", "xxx"), None) - self.assertNotEqual(re.match("^x{1,4}$", "xxx"), None) - self.assertNotEqual(re.match("^x{3,4}?$", "xxx"), None) - self.assertNotEqual(re.match("^x{3}?$", "xxx"), None) - self.assertNotEqual(re.match("^x{1,3}?$", "xxx"), None) - self.assertNotEqual(re.match("^x{1,4}?$", "xxx"), None) - self.assertNotEqual(re.match("^x{3,4}?$", "xxx"), None) - - self.assertEqual(re.match("^x{}$", "xxx"), None) - self.assertNotEqual(re.match("^x{}$", "x{}"), None) - - def test_getattr(self): - self.assertEqual(re.match("(a)", "a").pos, 0) - self.assertEqual(re.match("(a)", "a").endpos, 1) - self.assertEqual(re.match("(a)", "a").string, "a") - self.assertEqual(re.match("(a)", "a").regs, ((0, 1), (0, 1))) - self.assertNotEqual(re.match("(a)", "a").re, None) - - def test_special_escapes(self): - self.assertEqual(re.search(r"\b(b.)\b", - "abcd abc bcd bx").group(1), "bx") - self.assertEqual(re.search(r"\B(b.)\B", - "abc bcd bc abxd").group(1), "bx") - self.assertEqual(re.search(r"\b(b.)\b", - "abcd abc bcd bx", re.LOCALE).group(1), "bx") - self.assertEqual(re.search(r"\B(b.)\B", - "abc bcd bc abxd", re.LOCALE).group(1), "bx") - self.assertEqual(re.search(r"\b(b.)\b", - "abcd abc bcd bx", re.UNICODE).group(1), "bx") - self.assertEqual(re.search(r"\B(b.)\B", - "abc bcd bc abxd", re.UNICODE).group(1), "bx") - self.assertEqual(re.search(r"^abc$", "\nabc\n", re.M).group(0), "abc") - self.assertEqual(re.search(r"^\Aabc\Z$", "abc", re.M).group(0), "abc") - self.assertEqual(re.search(r"^\Aabc\Z$", "\nabc\n", re.M), None) - self.assertEqual(re.search(r"\b(b.)\b", - u"abcd abc bcd bx").group(1), "bx") - self.assertEqual(re.search(r"\B(b.)\B", - u"abc bcd bc abxd").group(1), "bx") - self.assertEqual(re.search(r"^abc$", u"\nabc\n", re.M).group(0), "abc") - self.assertEqual(re.search(r"^\Aabc\Z$", u"abc", re.M).group(0), "abc") - self.assertEqual(re.search(r"^\Aabc\Z$", u"\nabc\n", re.M), None) - self.assertEqual(re.search(r"\d\D\w\W\s\S", - "1aa! a").group(0), "1aa! a") - self.assertEqual(re.search(r"\d\D\w\W\s\S", - "1aa! a", re.LOCALE).group(0), "1aa! a") - self.assertEqual(re.search(r"\d\D\w\W\s\S", - "1aa! a", re.UNICODE).group(0), "1aa! a") - - def test_ignore_case(self): - self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC") - self.assertEqual(re.match("abc", u"ABC", re.I).group(0), "ABC") - - def test_bigcharset(self): - self.assertEqual(re.match(u"([\u2222\u2223])", - u"\u2222").group(1), u"\u2222") - self.assertEqual(re.match(u"([\u2222\u2223])", - u"\u2222", re.UNICODE).group(1), u"\u2222") - - def test_anyall(self): - self.assertEqual(re.match("a.b", "a\nb", re.DOTALL).group(0), - "a\nb") - self.assertEqual(re.match("a.*b", "a\n\nb", re.DOTALL).group(0), - "a\n\nb") - - def test_non_consuming(self): - self.assertEqual(re.match("(a(?=\s[^a]))", "a b").group(1), "a") - self.assertEqual(re.match("(a(?=\s[^a]*))", "a b").group(1), "a") - self.assertEqual(re.match("(a(?=\s[abc]))", "a b").group(1), "a") - self.assertEqual(re.match("(a(?=\s[abc]*))", "a bc").group(1), "a") - self.assertEqual(re.match(r"(a)(?=\s\1)", "a a").group(1), "a") - self.assertEqual(re.match(r"(a)(?=\s\1*)", "a aa").group(1), "a") - self.assertEqual(re.match(r"(a)(?=\s(abc|a))", "a a").group(1), "a") - - self.assertEqual(re.match(r"(a(?!\s[^a]))", "a a").group(1), "a") - self.assertEqual(re.match(r"(a(?!\s[abc]))", "a d").group(1), "a") - self.assertEqual(re.match(r"(a)(?!\s\1)", "a b").group(1), "a") - self.assertEqual(re.match(r"(a)(?!\s(abc|a))", "a b").group(1), "a") - - def test_ignore_case(self): - self.assertEqual(re.match(r"(a\s[^a])", "a b", re.I).group(1), "a b") - self.assertEqual(re.match(r"(a\s[^a]*)", "a bb", re.I).group(1), "a bb") - self.assertEqual(re.match(r"(a\s[abc])", "a b", re.I).group(1), "a b") - self.assertEqual(re.match(r"(a\s[abc]*)", "a bb", re.I).group(1), "a bb") - self.assertEqual(re.match(r"((a)\s\2)", "a a", re.I).group(1), "a a") - self.assertEqual(re.match(r"((a)\s\2*)", "a aa", re.I).group(1), "a aa") - self.assertEqual(re.match(r"((a)\s(abc|a))", "a a", re.I).group(1), "a a") - self.assertEqual(re.match(r"((a)\s(abc|a)*)", "a aa", re.I).group(1), "a aa") - - def test_category(self): - self.assertEqual(re.match(r"(\s)", " ").group(1), " ") - - def test_getlower(self): - import _sre - self.assertEqual(_sre.getlower(ord('A'), 0), ord('a')) - self.assertEqual(_sre.getlower(ord('A'), re.LOCALE), ord('a')) - self.assertEqual(_sre.getlower(ord('A'), re.UNICODE), ord('a')) - - self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC") - self.assertEqual(re.match("abc", u"ABC", re.I).group(0), "ABC") - - def test_not_literal(self): - self.assertEqual(re.search("\s([^a])", " b").group(1), "b") - self.assertEqual(re.search("\s([^a]*)", " bb").group(1), "bb") - - def test_search_coverage(self): - self.assertEqual(re.search("\s(b)", " b").group(1), "b") - self.assertEqual(re.search("a\s", "a ").group(0), "a ") - - def test_re_escape(self): - p="" - for i in range(0, 256): - p = p + chr(i) - self.assertEqual(re.match(re.escape(chr(i)), chr(i)) is not None, - True) - self.assertEqual(re.match(re.escape(chr(i)), chr(i)).span(), (0,1)) - - pat=re.compile(re.escape(p)) - self.assertEqual(pat.match(p) is not None, True) - self.assertEqual(pat.match(p).span(), (0,256)) - - def test_pickling(self): - import pickle - self.pickle_test(pickle) - import cPickle - self.pickle_test(cPickle) - # old pickles expect the _compile() reconstructor in sre module - import warnings - original_filters = warnings.filters[:] - try: - warnings.filterwarnings("ignore", "The sre module is deprecated", - DeprecationWarning) - from sre import _compile - finally: - warnings.filters = original_filters - - def pickle_test(self, pickle): - oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)') - s = pickle.dumps(oldpat) - newpat = pickle.loads(s) - self.assertEqual(oldpat, newpat) - - def test_constants(self): - self.assertEqual(re.I, re.IGNORECASE) - self.assertEqual(re.L, re.LOCALE) - self.assertEqual(re.M, re.MULTILINE) - self.assertEqual(re.S, re.DOTALL) - self.assertEqual(re.X, re.VERBOSE) - - def test_flags(self): - for flag in [re.I, re.M, re.X, re.S, re.L]: - self.assertNotEqual(re.compile('^pattern$', flag), None) - - def test_sre_character_literals(self): - for i in [0, 8, 16, 32, 64, 127, 128, 255]: - self.assertNotEqual(re.match(r"\%03o" % i, chr(i)), None) - self.assertNotEqual(re.match(r"\%03o0" % i, chr(i)+"0"), None) - self.assertNotEqual(re.match(r"\%03o8" % i, chr(i)+"8"), None) - self.assertNotEqual(re.match(r"\x%02x" % i, chr(i)), None) - self.assertNotEqual(re.match(r"\x%02x0" % i, chr(i)+"0"), None) - self.assertNotEqual(re.match(r"\x%02xz" % i, chr(i)+"z"), None) - self.assertRaises(re.error, re.match, "\911", "") - - def test_sre_character_class_literals(self): - for i in [0, 8, 16, 32, 64, 127, 128, 255]: - self.assertNotEqual(re.match(r"[\%03o]" % i, chr(i)), None) - self.assertNotEqual(re.match(r"[\%03o0]" % i, chr(i)), None) - self.assertNotEqual(re.match(r"[\%03o8]" % i, chr(i)), None) - self.assertNotEqual(re.match(r"[\x%02x]" % i, chr(i)), None) - self.assertNotEqual(re.match(r"[\x%02x0]" % i, chr(i)), None) - self.assertNotEqual(re.match(r"[\x%02xz]" % i, chr(i)), None) - self.assertRaises(re.error, re.match, "[\911]", "") - - def test_bug_113254(self): - self.assertEqual(re.match(r'(a)|(b)', 'b').start(1), -1) - self.assertEqual(re.match(r'(a)|(b)', 'b').end(1), -1) - self.assertEqual(re.match(r'(a)|(b)', 'b').span(1), (-1, -1)) - - def test_bug_527371(self): - # bug described in patches 527371/672491 - self.assertEqual(re.match(r'(a)?a','a').lastindex, None) - self.assertEqual(re.match(r'(a)(b)?b','ab').lastindex, 1) - self.assertEqual(re.match(r'(?Pa)(?Pb)?b','ab').lastgroup, 'a') - self.assertEqual(re.match("(?Pa(b))", "ab").lastgroup, 'a') - self.assertEqual(re.match("((a))", "a").lastindex, 1) - - def test_bug_545855(self): - # bug 545855 -- This pattern failed to cause a compile error as it - # should, instead provoking a TypeError. - self.assertRaises(re.error, re.compile, 'foo[a-') - - def test_bug_418626(self): - # bugs 418626 at al. -- Testing Greg Chapman's addition of op code - # SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of - # pattern '*?' on a long string. - self.assertEqual(re.match('.*?c', 10000*'ab'+'cd').end(0), 20001) - self.assertEqual(re.match('.*?cd', 5000*'ab'+'c'+5000*'ab'+'cde').end(0), - 20003) - self.assertEqual(re.match('.*?cd', 20000*'abc'+'de').end(0), 60001) - # non-simple '*?' still used to hit the recursion limit, before the - # non-recursive scheme was implemented. - self.assertEqual(re.search('(a|b)*?c', 10000*'ab'+'cd').end(0), 20001) - - def test_bug_612074(self): - pat=u"["+re.escape(u"\u2039")+u"]" - self.assertEqual(re.compile(pat) and 1, 1) - - def test_stack_overflow(self): - # nasty cases that used to overflow the straightforward recursive - # implementation of repeated groups. - self.assertEqual(re.match('(x)*', 50000*'x').group(1), 'x') - self.assertEqual(re.match('(x)*y', 50000*'x'+'y').group(1), 'x') - self.assertEqual(re.match('(x)*?y', 50000*'x'+'y').group(1), 'x') - - def test_scanner(self): - def s_ident(scanner, token): return token - def s_operator(scanner, token): return "op%s" % token - def s_float(scanner, token): return float(token) - def s_int(scanner, token): return int(token) - - scanner = Scanner([ - (r"[a-zA-Z_]\w*", s_ident), - (r"\d+\.\d*", s_float), - (r"\d+", s_int), - (r"=|\+|-|\*|/", s_operator), - (r"\s+", None), - ]) - - self.assertNotEqual(scanner.scanner.scanner("").pattern, None) - - self.assertEqual(scanner.scan("sum = 3*foo + 312.50 + bar"), - (['sum', 'op=', 3, 'op*', 'foo', 'op+', 312.5, - 'op+', 'bar'], '')) - - def test_bug_448951(self): - # bug 448951 (similar to 429357, but with single char match) - # (Also test greedy matches.) - for op in '','?','*': - self.assertEqual(re.match(r'((.%s):)?z'%op, 'z').groups(), - (None, None)) - self.assertEqual(re.match(r'((.%s):)?z'%op, 'a:z').groups(), - ('a:', 'a')) - - def test_bug_725106(self): - # capturing groups in alternatives in repeats - self.assertEqual(re.match('^((a)|b)*', 'abc').groups(), - ('b', 'a')) - self.assertEqual(re.match('^(([ab])|c)*', 'abc').groups(), - ('c', 'b')) - self.assertEqual(re.match('^((d)|[ab])*', 'abc').groups(), - ('b', None)) - self.assertEqual(re.match('^((a)c|[ab])*', 'abc').groups(), - ('b', None)) - self.assertEqual(re.match('^((a)|b)*?c', 'abc').groups(), - ('b', 'a')) - self.assertEqual(re.match('^(([ab])|c)*?d', 'abcd').groups(), - ('c', 'b')) - self.assertEqual(re.match('^((d)|[ab])*?c', 'abc').groups(), - ('b', None)) - self.assertEqual(re.match('^((a)c|[ab])*?c', 'abc').groups(), - ('b', None)) - - def test_bug_725149(self): - # mark_stack_base restoring before restoring marks - self.assertEqual(re.match('(a)(?:(?=(b)*)c)*', 'abb').groups(), - ('a', None)) - self.assertEqual(re.match('(a)((?!(b)*))*', 'abb').groups(), - ('a', None, None)) - - def test_bug_764548(self): - # bug 764548, re.compile() barfs on str/unicode subclasses - try: - unicode - except NameError: - return # no problem if we have no unicode - class my_unicode(unicode): pass - pat = re.compile(my_unicode("abc")) - self.assertEqual(pat.match("xyz"), None) - - def test_finditer(self): - iter = re.finditer(r":+", "a:b::c:::d") - self.assertEqual([item.group(0) for item in iter], - [":", "::", ":::"]) - - def test_bug_926075(self): - try: - unicode - except NameError: - return # no problem if we have no unicode - self.assert_(re.compile('bug_926075') is not - re.compile(eval("u'bug_926075'"))) - - def test_bug_931848(self): - try: - unicode - except NameError: - pass - pattern = eval('u"[\u002E\u3002\uFF0E\uFF61]"') - self.assertEqual(re.compile(pattern).split("a.b.c"), - ['a','b','c']) - - def test_bug_581080(self): - iter = re.finditer(r"\s", "a b") - self.assertEqual(iter.next().span(), (1,2)) - self.assertRaises(StopIteration, iter.next) - - scanner = re.compile(r"\s").scanner("a b") - self.assertEqual(scanner.search().span(), (1, 2)) - self.assertEqual(scanner.search(), None) - - def test_bug_817234(self): - iter = re.finditer(r".*", "asdf") - self.assertEqual(iter.next().span(), (0, 4)) - self.assertEqual(iter.next().span(), (4, 4)) - self.assertRaises(StopIteration, iter.next) - - def test_empty_array(self): - # SF buf 1647541 - import array - for typecode in 'cbBuhHiIlLfd': - a = array.array(typecode) - self.assertEqual(re.compile("bla").match(a), None) - self.assertEqual(re.compile("").match(a).groups(), ()) - -def run_re_tests(): - from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR - if verbose: - print 'Running re_tests test suite' - else: - # To save time, only run the first and last 10 tests - #tests = tests[:10] + tests[-10:] - pass - - for t in tests: - sys.stdout.flush() - pattern = s = outcome = repl = expected = None - if len(t) == 5: - pattern, s, outcome, repl, expected = t - elif len(t) == 3: - pattern, s, outcome = t - else: - raise ValueError, ('Test tuples should have 3 or 5 fields', t) - - try: - obj = re.compile(pattern) - except re.error: - if outcome == SYNTAX_ERROR: pass # Expected a syntax error - else: - print '=== Syntax error:', t - except KeyboardInterrupt: raise KeyboardInterrupt - except: - print '*** Unexpected error ***', t - if verbose: - traceback.print_exc(file=sys.stdout) - else: - try: - result = obj.search(s) - except re.error, msg: - print '=== Unexpected exception', t, repr(msg) - if outcome == SYNTAX_ERROR: - # This should have been a syntax error; forget it. - pass - elif outcome == FAIL: - if result is None: pass # No match, as expected - else: print '=== Succeeded incorrectly', t - elif outcome == SUCCEED: - if result is not None: - # Matched, as expected, so now we compute the - # result string and compare it to our expected result. - start, end = result.span(0) - vardict={'found': result.group(0), - 'groups': result.group(), - 'flags': result.re.flags} - for i in range(1, 100): - try: - gi = result.group(i) - # Special hack because else the string concat fails: - if gi is None: - gi = "None" - except IndexError: - gi = "Error" - vardict['g%d' % i] = gi - for i in result.re.groupindex.keys(): - try: - gi = result.group(i) - if gi is None: - gi = "None" - except IndexError: - gi = "Error" - vardict[i] = gi - repl = eval(repl, vardict) - if repl != expected: - print '=== grouping error', t, - print repr(repl) + ' should be ' + repr(expected) - else: - print '=== Failed incorrectly', t - - # Try the match on a unicode string, and check that it - # still succeeds. - try: - result = obj.search(unicode(s, "latin-1")) - if result is None: - print '=== Fails on unicode match', t - except NameError: - continue # 1.5.2 - except TypeError: - continue # unicode test case - - # Try the match on a unicode pattern, and check that it - # still succeeds. - obj=re.compile(unicode(pattern, "latin-1")) - result = obj.search(s) - if result is None: - print '=== Fails on unicode pattern match', t - - # Try the match with the search area limited to the extent - # of the match and see if it still succeeds. \B will - # break (because it won't match at the end or start of a - # string), so we'll ignore patterns that feature it. - - if pattern[:2] != '\\B' and pattern[-2:] != '\\B' \ - and result is not None: - obj = re.compile(pattern) - result = obj.search(s, result.start(0), result.end(0) + 1) - if result is None: - print '=== Failed on range-limited match', t - - # Try the match with IGNORECASE enabled, and check that it - # still succeeds. - obj = re.compile(pattern, re.IGNORECASE) - result = obj.search(s) - if result is None: - print '=== Fails on case-insensitive match', t - - # Try the match with LOCALE enabled, and check that it - # still succeeds. - obj = re.compile(pattern, re.LOCALE) - result = obj.search(s) - if result is None: - print '=== Fails on locale-sensitive match', t - - # Try the match with UNICODE locale enabled, and check - # that it still succeeds. - obj = re.compile(pattern, re.UNICODE) - result = obj.search(s) - if result is None: - print '=== Fails on unicode-sensitive match', t - -def test_main(): - run_unittest(ReTests) - run_re_tests() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_repr.py b/sys/lib/python/test/test_repr.py deleted file mode 100644 index a37499f1f..000000000 --- a/sys/lib/python/test/test_repr.py +++ /dev/null @@ -1,307 +0,0 @@ -""" - Test cases for the repr module - Nick Mathewson -""" - -import sys -import os -import shutil -import unittest - -from test.test_support import run_unittest -from repr import repr as r # Don't shadow builtin repr - - -def nestedTuple(nesting): - t = () - for i in range(nesting): - t = (t,) - return t - -class ReprTests(unittest.TestCase): - - def test_string(self): - eq = self.assertEquals - eq(r("abc"), "'abc'") - eq(r("abcdefghijklmnop"),"'abcdefghijklmnop'") - - s = "a"*30+"b"*30 - expected = repr(s)[:13] + "..." + repr(s)[-14:] - eq(r(s), expected) - - eq(r("\"'"), repr("\"'")) - s = "\""*30+"'"*100 - expected = repr(s)[:13] + "..." + repr(s)[-14:] - eq(r(s), expected) - - def test_container(self): - from array import array - from collections import deque - - eq = self.assertEquals - # Tuples give up after 6 elements - eq(r(()), "()") - eq(r((1,)), "(1,)") - eq(r((1, 2, 3)), "(1, 2, 3)") - eq(r((1, 2, 3, 4, 5, 6)), "(1, 2, 3, 4, 5, 6)") - eq(r((1, 2, 3, 4, 5, 6, 7)), "(1, 2, 3, 4, 5, 6, ...)") - - # Lists give up after 6 as well - eq(r([]), "[]") - eq(r([1]), "[1]") - eq(r([1, 2, 3]), "[1, 2, 3]") - eq(r([1, 2, 3, 4, 5, 6]), "[1, 2, 3, 4, 5, 6]") - eq(r([1, 2, 3, 4, 5, 6, 7]), "[1, 2, 3, 4, 5, 6, ...]") - - # Sets give up after 6 as well - eq(r(set([])), "set([])") - eq(r(set([1])), "set([1])") - eq(r(set([1, 2, 3])), "set([1, 2, 3])") - eq(r(set([1, 2, 3, 4, 5, 6])), "set([1, 2, 3, 4, 5, 6])") - eq(r(set([1, 2, 3, 4, 5, 6, 7])), "set([1, 2, 3, 4, 5, 6, ...])") - - # Frozensets give up after 6 as well - eq(r(frozenset([])), "frozenset([])") - eq(r(frozenset([1])), "frozenset([1])") - eq(r(frozenset([1, 2, 3])), "frozenset([1, 2, 3])") - eq(r(frozenset([1, 2, 3, 4, 5, 6])), "frozenset([1, 2, 3, 4, 5, 6])") - eq(r(frozenset([1, 2, 3, 4, 5, 6, 7])), "frozenset([1, 2, 3, 4, 5, 6, ...])") - - # collections.deque after 6 - eq(r(deque([1, 2, 3, 4, 5, 6, 7])), "deque([1, 2, 3, 4, 5, 6, ...])") - - # Dictionaries give up after 4. - eq(r({}), "{}") - d = {'alice': 1, 'bob': 2, 'charles': 3, 'dave': 4} - eq(r(d), "{'alice': 1, 'bob': 2, 'charles': 3, 'dave': 4}") - d['arthur'] = 1 - eq(r(d), "{'alice': 1, 'arthur': 1, 'bob': 2, 'charles': 3, ...}") - - # array.array after 5. - eq(r(array('i')), "array('i', [])") - eq(r(array('i', [1])), "array('i', [1])") - eq(r(array('i', [1, 2])), "array('i', [1, 2])") - eq(r(array('i', [1, 2, 3])), "array('i', [1, 2, 3])") - eq(r(array('i', [1, 2, 3, 4])), "array('i', [1, 2, 3, 4])") - eq(r(array('i', [1, 2, 3, 4, 5])), "array('i', [1, 2, 3, 4, 5])") - eq(r(array('i', [1, 2, 3, 4, 5, 6])), - "array('i', [1, 2, 3, 4, 5, ...])") - - def test_numbers(self): - eq = self.assertEquals - eq(r(123), repr(123)) - eq(r(123L), repr(123L)) - eq(r(1.0/3), repr(1.0/3)) - - n = 10L**100 - expected = repr(n)[:18] + "..." + repr(n)[-19:] - eq(r(n), expected) - - def test_instance(self): - eq = self.assertEquals - i1 = ClassWithRepr("a") - eq(r(i1), repr(i1)) - - i2 = ClassWithRepr("x"*1000) - expected = repr(i2)[:13] + "..." + repr(i2)[-14:] - eq(r(i2), expected) - - i3 = ClassWithFailingRepr() - eq(r(i3), (""%id(i3))) - - s = r(ClassWithFailingRepr) - self.failUnless(s.startswith("")) - self.failUnless(s.find("...") == 8) - - def test_file(self): - fp = open(unittest.__file__) - self.failUnless(repr(fp).startswith( - "') - # Methods - self.failUnless(repr(''.split).startswith( - '") - # XXX member descriptors - # XXX attribute descriptors - # XXX slot descriptors - # static and class methods - class C: - def foo(cls): pass - x = staticmethod(C.foo) - self.failUnless(repr(x).startswith('" % (areallylongpackageandmodulenametotestreprtruncation.__name__, areallylongpackageandmodulenametotestreprtruncation.__file__)) - eq(repr(sys), "") - - def test_type(self): - eq = self.assertEquals - touch(os.path.join(self.subpkgname, 'foo'+os.extsep+'py'), '''\ -class foo(object): - pass -''') - from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import foo - eq(repr(foo.foo), - "" % foo.__name__) - - def test_object(self): - # XXX Test the repr of a type with a really long tp_name but with no - # tp_repr. WIBNI we had ::Inline? :) - pass - - def test_class(self): - touch(os.path.join(self.subpkgname, 'bar'+os.extsep+'py'), '''\ -class bar: - pass -''') - from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import bar - # Module name may be prefixed with "test.", depending on how run. - self.failUnless(repr(bar.bar).startswith( - "') - # Bound method next - iqux = qux.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() - self.failUnless(repr(iqux.amethod).startswith( - '\n\ntest\n') - self.assert_(msg.get("to") == '"last, first" ') - self.assert_(msg.get("TO") == '"last, first" ') - self.assert_(msg.get("No-Such-Header") is None) - self.assert_(msg.get("No-Such-Header", "No-Such-Value") - == "No-Such-Value") - - def test_setdefault(self): - msg = self.create_message( - 'To: "last, first" \n\ntest\n') - self.assert_(not msg.has_key("New-Header")) - self.assert_(msg.setdefault("New-Header", "New-Value") == "New-Value") - self.assert_(msg.setdefault("New-Header", "Different-Value") - == "New-Value") - self.assert_(msg["new-header"] == "New-Value") - - self.assert_(msg.setdefault("Another-Header") == "") - self.assert_(msg["another-header"] == "") - - def check(self, msg, results): - """Check addresses and the date.""" - m = self.create_message(msg) - i = 0 - for n, a in m.getaddrlist('to') + m.getaddrlist('cc'): - try: - mn, ma = results[i][0], results[i][1] - except IndexError: - print 'extra parsed address:', repr(n), repr(a) - continue - i = i + 1 - self.assertEqual(mn, n, - "Un-expected name: %s != %s" % (`mn`, `n`)) - self.assertEqual(ma, a, - "Un-expected address: %s != %s" % (`ma`, `a`)) - if mn == n and ma == a: - pass - else: - print 'not found:', repr(n), repr(a) - - out = m.getdate('date') - if out: - self.assertEqual(out, - (1999, 1, 13, 23, 57, 35, 0, 1, 0), - "date conversion failed") - - - # Note: all test cases must have the same date (in various formats), - # or no date! - - def test_basic(self): - self.check( - 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' - 'From: Guido van Rossum \n' - 'To: "Guido van\n' - '\t : Rossum" \n' - 'Subject: test2\n' - '\n' - 'test2\n', - [('Guido van\n\t : Rossum', 'guido@python.org')]) - - self.check( - 'From: Barry \n' - 'Date: 13-Jan-1999 23:57:35 EST\n' - '\n' - 'test', - [('Guido: the Barbarian', 'guido@python.org'), - ('Guido: the Madman', 'guido@python.org') - ]) - - self.check( - 'To: "The monster with\n' - ' the very long name: Guido" \n' - 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' - '\n' - 'test', - [('The monster with\n the very long name: Guido', - 'guido@python.org')]) - - self.check( - 'To: "Amit J. Patel" \n' - 'CC: Mike Fletcher ,\n' - ' "\'string-sig@python.org\'" \n' - 'Cc: fooz@bat.com, bart@toof.com\n' - 'Cc: goit@lip.com\n' - 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' - '\n' - 'test', - [('Amit J. Patel', 'amitp@Theory.Stanford.EDU'), - ('Mike Fletcher', 'mfletch@vrtelecom.com'), - ("'string-sig@python.org'", 'string-sig@python.org'), - ('', 'fooz@bat.com'), - ('', 'bart@toof.com'), - ('', 'goit@lip.com'), - ]) - - self.check( - 'To: Some One \n' - 'From: Anudder Persin \n' - 'Date:\n' - '\n' - 'test', - [('Some One', 'someone@dom.ain')]) - - self.check( - 'To: person@dom.ain (User J. Person)\n\n', - [('User J. Person', 'person@dom.ain')]) - - def test_doublecomment(self): - # The RFC allows comments within comments in an email addr - self.check( - 'To: person@dom.ain ((User J. Person)), John Doe \n\n', - [('User J. Person', 'person@dom.ain'), ('John Doe', 'foo@bar.com')]) - - def test_twisted(self): - # This one is just twisted. I don't know what the proper - # result should be, but it shouldn't be to infloop, which is - # what used to happen! - self.check( - 'To: <[smtp:dd47@mail.xxx.edu]_at_hmhq@hdq-mdm1-imgout.companay.com>\n' - 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' - '\n' - 'test', - [('', ''), - ('', 'dd47@mail.xxx.edu'), - ('', '_at_hmhq@hdq-mdm1-imgout.companay.com'), - ]) - - def test_commas_in_full_name(self): - # This exercises the old commas-in-a-full-name bug, which - # should be doing the right thing in recent versions of the - # module. - self.check( - 'To: "last, first" \n' - '\n' - 'test', - [('last, first', 'userid@foo.net')]) - - def test_quoted_name(self): - self.check( - 'To: (Comment stuff) "Quoted name"@somewhere.com\n' - '\n' - 'test', - [('Comment stuff', '"Quoted name"@somewhere.com')]) - - def test_bogus_to_header(self): - self.check( - 'To: :\n' - 'Cc: goit@lip.com\n' - 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' - '\n' - 'test', - [('', 'goit@lip.com')]) - - def test_addr_ipquad(self): - self.check( - 'To: guido@[132.151.1.21]\n' - '\n' - 'foo', - [('', 'guido@[132.151.1.21]')]) - - def test_iter(self): - m = rfc822.Message(StringIO( - 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' - 'From: Guido van Rossum \n' - 'To: "Guido van\n' - '\t : Rossum" \n' - 'Subject: test2\n' - '\n' - 'test2\n' )) - self.assertEqual(sorted(m), ['date', 'from', 'subject', 'to']) - - def test_rfc2822_phrases(self): - # RFC 2822 (the update to RFC 822) specifies that dots in phrases are - # obsolete syntax, which conforming programs MUST recognize but NEVER - # generate (see $4.1 Miscellaneous obsolete tokens). This is a - # departure from RFC 822 which did not allow dots in non-quoted - # phrases. - self.check('To: User J. Person \n\n', - [('User J. Person', 'person@dom.ain')]) - - # This takes too long to add to the test suite -## def test_an_excrutiatingly_long_address_field(self): -## OBSCENELY_LONG_HEADER_MULTIPLIER = 10000 -## oneaddr = ('Person' * 10) + '@' + ('.'.join(['dom']*10)) + '.com' -## addr = ', '.join([oneaddr] * OBSCENELY_LONG_HEADER_MULTIPLIER) -## lst = rfc822.AddrlistClass(addr).getaddrlist() -## self.assertEqual(len(lst), OBSCENELY_LONG_HEADER_MULTIPLIER) - - def test_2getaddrlist(self): - eq = self.assertEqual - msg = self.create_message("""\ -To: aperson@dom.ain -Cc: bperson@dom.ain -Cc: cperson@dom.ain -Cc: dperson@dom.ain - -A test message. -""") - ccs = [('', a) for a in - ['bperson@dom.ain', 'cperson@dom.ain', 'dperson@dom.ain']] - addrs = msg.getaddrlist('cc') - addrs.sort() - eq(addrs, ccs) - # Try again, this one used to fail - addrs = msg.getaddrlist('cc') - addrs.sort() - eq(addrs, ccs) - - def test_parseaddr(self): - eq = self.assertEqual - eq(rfc822.parseaddr('<>'), ('', '')) - eq(rfc822.parseaddr('aperson@dom.ain'), ('', 'aperson@dom.ain')) - eq(rfc822.parseaddr('bperson@dom.ain (Bea A. Person)'), - ('Bea A. Person', 'bperson@dom.ain')) - eq(rfc822.parseaddr('Cynthia Person '), - ('Cynthia Person', 'cperson@dom.ain')) - - def test_quote_unquote(self): - eq = self.assertEqual - eq(rfc822.quote('foo\\wacky"name'), 'foo\\\\wacky\\"name') - eq(rfc822.unquote('"foo\\\\wacky\\"name"'), 'foo\\wacky"name') - - -def test_main(): - test_support.run_unittest(MessageTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_rgbimg.py b/sys/lib/python/test/test_rgbimg.py deleted file mode 100644 index 650c02aa0..000000000 --- a/sys/lib/python/test/test_rgbimg.py +++ /dev/null @@ -1,70 +0,0 @@ -# Testing rgbimg module - -import warnings -warnings.filterwarnings("ignore", - "the rgbimg module is deprecated", - DeprecationWarning, - ".*test_rgbimg$") -import rgbimg - -import os, uu - -from test.test_support import verbose, unlink, findfile - -class error(Exception): - pass - -print 'RGBimg test suite:' - -def testimg(rgb_file, raw_file): - rgb_file = findfile(rgb_file) - raw_file = findfile(raw_file) - width, height = rgbimg.sizeofimage(rgb_file) - rgb = rgbimg.longimagedata(rgb_file) - if len(rgb) != width * height * 4: - raise error, 'bad image length' - raw = open(raw_file, 'rb').read() - if rgb != raw: - raise error, \ - 'images don\'t match for '+rgb_file+' and '+raw_file - for depth in [1, 3, 4]: - rgbimg.longstoimage(rgb, width, height, depth, '@.rgb') - os.unlink('@.rgb') - -table = [ - ('testrgb'+os.extsep+'uue', 'test'+os.extsep+'rgb'), - ('testimg'+os.extsep+'uue', 'test'+os.extsep+'rawimg'), - ('testimgr'+os.extsep+'uue', 'test'+os.extsep+'rawimg'+os.extsep+'rev'), - ] -for source, target in table: - source = findfile(source) - target = findfile(target) - if verbose: - print "uudecoding", source, "->", target, "..." - uu.decode(source, target) - -if verbose: - print "testing..." - -ttob = rgbimg.ttob(0) -if ttob != 0: - raise error, 'ttob should start out as zero' - -testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg') - -ttob = rgbimg.ttob(1) -if ttob != 0: - raise error, 'ttob should be zero' - -testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg'+os.extsep+'rev') - -ttob = rgbimg.ttob(0) -if ttob != 1: - raise error, 'ttob should be one' - -ttob = rgbimg.ttob(0) -if ttob != 0: - raise error, 'ttob should be zero' - -for source, target in table: - unlink(findfile(target)) diff --git a/sys/lib/python/test/test_richcmp.py b/sys/lib/python/test/test_richcmp.py deleted file mode 100644 index f412a8905..000000000 --- a/sys/lib/python/test/test_richcmp.py +++ /dev/null @@ -1,337 +0,0 @@ -# Tests for rich comparisons - -import unittest -from test import test_support - -import operator - -class Number: - - def __init__(self, x): - self.x = x - - def __lt__(self, other): - return self.x < other - - def __le__(self, other): - return self.x <= other - - def __eq__(self, other): - return self.x == other - - def __ne__(self, other): - return self.x != other - - def __gt__(self, other): - return self.x > other - - def __ge__(self, other): - return self.x >= other - - def __cmp__(self, other): - raise test_support.TestFailed, "Number.__cmp__() should not be called" - - def __repr__(self): - return "Number(%r)" % (self.x, ) - -class Vector: - - def __init__(self, data): - self.data = data - - def __len__(self): - return len(self.data) - - def __getitem__(self, i): - return self.data[i] - - def __setitem__(self, i, v): - self.data[i] = v - - def __hash__(self): - raise TypeError, "Vectors cannot be hashed" - - def __nonzero__(self): - raise TypeError, "Vectors cannot be used in Boolean contexts" - - def __cmp__(self, other): - raise test_support.TestFailed, "Vector.__cmp__() should not be called" - - def __repr__(self): - return "Vector(%r)" % (self.data, ) - - def __lt__(self, other): - return Vector([a < b for a, b in zip(self.data, self.__cast(other))]) - - def __le__(self, other): - return Vector([a <= b for a, b in zip(self.data, self.__cast(other))]) - - def __eq__(self, other): - return Vector([a == b for a, b in zip(self.data, self.__cast(other))]) - - def __ne__(self, other): - return Vector([a != b for a, b in zip(self.data, self.__cast(other))]) - - def __gt__(self, other): - return Vector([a > b for a, b in zip(self.data, self.__cast(other))]) - - def __ge__(self, other): - return Vector([a >= b for a, b in zip(self.data, self.__cast(other))]) - - def __cast(self, other): - if isinstance(other, Vector): - other = other.data - if len(self.data) != len(other): - raise ValueError, "Cannot compare vectors of different length" - return other - -opmap = { - "lt": (lambda a,b: a< b, operator.lt, operator.__lt__), - "le": (lambda a,b: a<=b, operator.le, operator.__le__), - "eq": (lambda a,b: a==b, operator.eq, operator.__eq__), - "ne": (lambda a,b: a!=b, operator.ne, operator.__ne__), - "gt": (lambda a,b: a> b, operator.gt, operator.__gt__), - "ge": (lambda a,b: a>=b, operator.ge, operator.__ge__) -} - -class VectorTest(unittest.TestCase): - - def checkfail(self, error, opname, *args): - for op in opmap[opname]: - self.assertRaises(error, op, *args) - - def checkequal(self, opname, a, b, expres): - for op in opmap[opname]: - realres = op(a, b) - # can't use assertEqual(realres, expres) here - self.assertEqual(len(realres), len(expres)) - for i in xrange(len(realres)): - # results are bool, so we can use "is" here - self.assert_(realres[i] is expres[i]) - - def test_mixed(self): - # check that comparisons involving Vector objects - # which return rich results (i.e. Vectors with itemwise - # comparison results) work - a = Vector(range(2)) - b = Vector(range(3)) - # all comparisons should fail for different length - for opname in opmap: - self.checkfail(ValueError, opname, a, b) - - a = range(5) - b = 5 * [2] - # try mixed arguments (but not (a, b) as that won't return a bool vector) - args = [(a, Vector(b)), (Vector(a), b), (Vector(a), Vector(b))] - for (a, b) in args: - self.checkequal("lt", a, b, [True, True, False, False, False]) - self.checkequal("le", a, b, [True, True, True, False, False]) - self.checkequal("eq", a, b, [False, False, True, False, False]) - self.checkequal("ne", a, b, [True, True, False, True, True ]) - self.checkequal("gt", a, b, [False, False, False, True, True ]) - self.checkequal("ge", a, b, [False, False, True, True, True ]) - - for ops in opmap.itervalues(): - for op in ops: - # calls __nonzero__, which should fail - self.assertRaises(TypeError, bool, op(a, b)) - -class NumberTest(unittest.TestCase): - - def test_basic(self): - # Check that comparisons involving Number objects - # give the same results give as comparing the - # corresponding ints - for a in xrange(3): - for b in xrange(3): - for typea in (int, Number): - for typeb in (int, Number): - if typea==typeb==int: - continue # the combination int, int is useless - ta = typea(a) - tb = typeb(b) - for ops in opmap.itervalues(): - for op in ops: - realoutcome = op(a, b) - testoutcome = op(ta, tb) - self.assertEqual(realoutcome, testoutcome) - - def checkvalue(self, opname, a, b, expres): - for typea in (int, Number): - for typeb in (int, Number): - ta = typea(a) - tb = typeb(b) - for op in opmap[opname]: - realres = op(ta, tb) - realres = getattr(realres, "x", realres) - self.assert_(realres is expres) - - def test_values(self): - # check all operators and all comparison results - self.checkvalue("lt", 0, 0, False) - self.checkvalue("le", 0, 0, True ) - self.checkvalue("eq", 0, 0, True ) - self.checkvalue("ne", 0, 0, False) - self.checkvalue("gt", 0, 0, False) - self.checkvalue("ge", 0, 0, True ) - - self.checkvalue("lt", 0, 1, True ) - self.checkvalue("le", 0, 1, True ) - self.checkvalue("eq", 0, 1, False) - self.checkvalue("ne", 0, 1, True ) - self.checkvalue("gt", 0, 1, False) - self.checkvalue("ge", 0, 1, False) - - self.checkvalue("lt", 1, 0, False) - self.checkvalue("le", 1, 0, False) - self.checkvalue("eq", 1, 0, False) - self.checkvalue("ne", 1, 0, True ) - self.checkvalue("gt", 1, 0, True ) - self.checkvalue("ge", 1, 0, True ) - -class MiscTest(unittest.TestCase): - - def test_misbehavin(self): - class Misb: - def __lt__(self, other): return 0 - def __gt__(self, other): return 0 - def __eq__(self, other): return 0 - def __le__(self, other): raise TestFailed, "This shouldn't happen" - def __ge__(self, other): raise TestFailed, "This shouldn't happen" - def __ne__(self, other): raise TestFailed, "This shouldn't happen" - def __cmp__(self, other): raise RuntimeError, "expected" - a = Misb() - b = Misb() - self.assertEqual(ab, 0) - self.assertRaises(RuntimeError, cmp, a, b) - - def test_not(self): - # Check that exceptions in __nonzero__ are properly - # propagated by the not operator - import operator - class Exc(Exception): - pass - class Bad: - def __nonzero__(self): - raise Exc - - def do(bad): - not bad - - for func in (do, operator.not_): - self.assertRaises(Exc, func, Bad()) - - def test_recursion(self): - # Check that comparison for recursive objects fails gracefully - from UserList import UserList - a = UserList() - b = UserList() - a.append(b) - b.append(a) - self.assertRaises(RuntimeError, operator.eq, a, b) - self.assertRaises(RuntimeError, operator.ne, a, b) - self.assertRaises(RuntimeError, operator.lt, a, b) - self.assertRaises(RuntimeError, operator.le, a, b) - self.assertRaises(RuntimeError, operator.gt, a, b) - self.assertRaises(RuntimeError, operator.ge, a, b) - - b.append(17) - # Even recursive lists of different lengths are different, - # but they cannot be ordered - self.assert_(not (a == b)) - self.assert_(a != b) - self.assertRaises(RuntimeError, operator.lt, a, b) - self.assertRaises(RuntimeError, operator.le, a, b) - self.assertRaises(RuntimeError, operator.gt, a, b) - self.assertRaises(RuntimeError, operator.ge, a, b) - a.append(17) - self.assertRaises(RuntimeError, operator.eq, a, b) - self.assertRaises(RuntimeError, operator.ne, a, b) - a.insert(0, 11) - b.insert(0, 12) - self.assert_(not (a == b)) - self.assert_(a != b) - self.assert_(a < b) - -class DictTest(unittest.TestCase): - - def test_dicts(self): - # Verify that __eq__ and __ne__ work for dicts even if the keys and - # values don't support anything other than __eq__ and __ne__ (and - # __hash__). Complex numbers are a fine example of that. - import random - imag1a = {} - for i in range(50): - imag1a[random.randrange(100)*1j] = random.randrange(100)*1j - items = imag1a.items() - random.shuffle(items) - imag1b = {} - for k, v in items: - imag1b[k] = v - imag2 = imag1b.copy() - imag2[k] = v + 1.0 - self.assert_(imag1a == imag1a) - self.assert_(imag1a == imag1b) - self.assert_(imag2 == imag2) - self.assert_(imag1a != imag2) - for opname in ("lt", "le", "gt", "ge"): - for op in opmap[opname]: - self.assertRaises(TypeError, op, imag1a, imag2) - -class ListTest(unittest.TestCase): - - def assertIs(self, a, b): - self.assert_(a is b) - - def test_coverage(self): - # exercise all comparisons for lists - x = [42] - self.assertIs(xx, False) - self.assertIs(x>=x, True) - y = [42, 42] - self.assertIs(xy, False) - self.assertIs(x>=y, False) - - def test_badentry(self): - # make sure that exceptions for item comparison are properly - # propagated in list comparisons - class Exc(Exception): - pass - class Bad: - def __eq__(self, other): - raise Exc - - x = [Bad()] - y = [Bad()] - - for op in opmap["eq"]: - self.assertRaises(Exc, op, x, y) - - def test_goodentry(self): - # This test exercises the final call to PyObject_RichCompare() - # in Objects/listobject.c::list_richcompare() - class Good: - def __lt__(self, other): - return True - - x = [Good()] - y = [Good()] - - for op in opmap["lt"]: - self.assertIs(op(x, y), True) - -def test_main(): - test_support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_robotparser.py b/sys/lib/python/test/test_robotparser.py deleted file mode 100644 index 6a23b22db..000000000 --- a/sys/lib/python/test/test_robotparser.py +++ /dev/null @@ -1,142 +0,0 @@ -import unittest, StringIO, robotparser -from test import test_support - -class RobotTestCase(unittest.TestCase): - def __init__(self, index, parser, url, good, agent): - unittest.TestCase.__init__(self) - if good: - self.str = "RobotTest(%d, good, %s)" % (index, url) - else: - self.str = "RobotTest(%d, bad, %s)" % (index, url) - self.parser = parser - self.url = url - self.good = good - self.agent = agent - - def runTest(self): - if isinstance(self.url, tuple): - agent, url = self.url - else: - url = self.url - agent = self.agent - if self.good: - self.failUnless(self.parser.can_fetch(agent, url)) - else: - self.failIf(self.parser.can_fetch(agent, url)) - - def __str__(self): - return self.str - -tests = unittest.TestSuite() - -def RobotTest(index, robots_txt, good_urls, bad_urls, - agent="test_robotparser"): - - lines = StringIO.StringIO(robots_txt).readlines() - parser = robotparser.RobotFileParser() - parser.parse(lines) - for url in good_urls: - tests.addTest(RobotTestCase(index, parser, url, 1, agent)) - for url in bad_urls: - tests.addTest(RobotTestCase(index, parser, url, 0, agent)) - -# Examples from http://www.robotstxt.org/wc/norobots.html (fetched 2002) - -# 1. -doc = """ -User-agent: * -Disallow: /cyberworld/map/ # This is an infinite virtual URL space -Disallow: /tmp/ # these will soon disappear -Disallow: /foo.html -""" - -good = ['/','/test.html'] -bad = ['/cyberworld/map/index.html','/tmp/xxx','/foo.html'] - -RobotTest(1, doc, good, bad) - -# 2. -doc = """ -# robots.txt for http://www.example.com/ - -User-agent: * -Disallow: /cyberworld/map/ # This is an infinite virtual URL space - -# Cybermapper knows where to go. -User-agent: cybermapper -Disallow: - -""" - -good = ['/','/test.html',('cybermapper','/cyberworld/map/index.html')] -bad = ['/cyberworld/map/index.html'] - -RobotTest(2, doc, good, bad) - -# 3. -doc = """ -# go away -User-agent: * -Disallow: / -""" - -good = [] -bad = ['/cyberworld/map/index.html','/','/tmp/'] - -RobotTest(3, doc, good, bad) - -# Examples from http://www.robotstxt.org/wc/norobots-rfc.html (fetched 2002) - -# 4. -doc = """ -User-agent: figtree -Disallow: /tmp -Disallow: /a%3cd.html -Disallow: /a%2fb.html -Disallow: /%7ejoe/index.html -""" - -good = [] # XFAIL '/a/b.html' -bad = ['/tmp','/tmp.html','/tmp/a.html', - '/a%3cd.html','/a%3Cd.html','/a%2fb.html', - '/~joe/index.html' - ] - -RobotTest(4, doc, good, bad, 'figtree') -RobotTest(5, doc, good, bad, 'FigTree Robot libwww-perl/5.04') - -# 6. -doc = """ -User-agent: * -Disallow: /tmp/ -Disallow: /a%3Cd.html -Disallow: /a/b.html -Disallow: /%7ejoe/index.html -""" - -good = ['/tmp',] # XFAIL: '/a%2fb.html' -bad = ['/tmp/','/tmp/a.html', - '/a%3cd.html','/a%3Cd.html',"/a/b.html", - '/%7Ejoe/index.html'] - -RobotTest(6, doc, good, bad) - -# From bug report #523041 - -# 7. -doc = """ -User-Agent: * -Disallow: /. -""" - -good = ['/foo.html'] -bad = [] # Bug report says "/" should be denied, but that is not in the RFC - -RobotTest(7, doc, good, bad) - -def test_main(): - test_support.run_suite(tests) - -if __name__=='__main__': - test_support.Verbose = 1 - test_support.run_suite(tests) diff --git a/sys/lib/python/test/test_runpy.py b/sys/lib/python/test/test_runpy.py deleted file mode 100644 index 88e990098..000000000 --- a/sys/lib/python/test/test_runpy.py +++ /dev/null @@ -1,172 +0,0 @@ -# Test the runpy module -import unittest -import os -import os.path -import sys -import tempfile -from test.test_support import verbose, run_unittest -from runpy import _run_module_code, run_module - -# Set up the test code and expected results - -class RunModuleCodeTest(unittest.TestCase): - - expected_result = ["Top level assignment", "Lower level reference"] - test_source = ( - "# Check basic code execution\n" - "result = ['Top level assignment']\n" - "def f():\n" - " result.append('Lower level reference')\n" - "f()\n" - "# Check the sys module\n" - "import sys\n" - "run_argv0 = sys.argv[0]\n" - "if __name__ in sys.modules:\n" - " run_name = sys.modules[__name__].__name__\n" - "# Check nested operation\n" - "import runpy\n" - "nested = runpy._run_module_code('x=1\\n', mod_name='',\n" - " alter_sys=True)\n" - ) - - - def test_run_module_code(self): - initial = object() - name = "" - file = "Some other nonsense" - loader = "Now you're just being silly" - d1 = dict(initial=initial) - saved_argv0 = sys.argv[0] - d2 = _run_module_code(self.test_source, - d1, - name, - file, - loader, - True) - self.failUnless("result" not in d1) - self.failUnless(d2["initial"] is initial) - self.failUnless(d2["result"] == self.expected_result) - self.failUnless(d2["nested"]["x"] == 1) - self.failUnless(d2["__name__"] is name) - self.failUnless(d2["run_name"] is name) - self.failUnless(d2["__file__"] is file) - self.failUnless(d2["run_argv0"] is file) - self.failUnless(d2["__loader__"] is loader) - self.failUnless(sys.argv[0] is saved_argv0) - self.failUnless(name not in sys.modules) - - def test_run_module_code_defaults(self): - saved_argv0 = sys.argv[0] - d = _run_module_code(self.test_source) - self.failUnless(d["result"] == self.expected_result) - self.failUnless(d["__name__"] is None) - self.failUnless(d["__file__"] is None) - self.failUnless(d["__loader__"] is None) - self.failUnless(d["run_argv0"] is saved_argv0) - self.failUnless("run_name" not in d) - self.failUnless(sys.argv[0] is saved_argv0) - -class RunModuleTest(unittest.TestCase): - - def expect_import_error(self, mod_name): - try: - run_module(mod_name) - except ImportError: - pass - else: - self.fail("Expected import error for " + mod_name) - - def test_invalid_names(self): - self.expect_import_error("sys") - self.expect_import_error("sys.imp.eric") - self.expect_import_error("os.path.half") - self.expect_import_error("a.bee") - self.expect_import_error(".howard") - self.expect_import_error("..eaten") - - def test_library_module(self): - run_module("runpy") - - def _make_pkg(self, source, depth): - pkg_name = "__runpy_pkg__" - init_fname = "__init__"+os.extsep+"py" - test_fname = "runpy_test"+os.extsep+"py" - pkg_dir = sub_dir = tempfile.mkdtemp() - if verbose: print " Package tree in:", sub_dir - sys.path.insert(0, pkg_dir) - if verbose: print " Updated sys.path:", sys.path[0] - for i in range(depth): - sub_dir = os.path.join(sub_dir, pkg_name) - os.mkdir(sub_dir) - if verbose: print " Next level in:", sub_dir - pkg_fname = os.path.join(sub_dir, init_fname) - pkg_file = open(pkg_fname, "w") - pkg_file.close() - if verbose: print " Created:", pkg_fname - mod_fname = os.path.join(sub_dir, test_fname) - mod_file = open(mod_fname, "w") - mod_file.write(source) - mod_file.close() - if verbose: print " Created:", mod_fname - mod_name = (pkg_name+".")*depth + "runpy_test" - return pkg_dir, mod_fname, mod_name - - def _del_pkg(self, top, depth, mod_name): - for i in range(depth+1): # Don't forget the module itself - parts = mod_name.rsplit(".", i) - entry = parts[0] - try: - del sys.modules[entry] - except KeyError, ex: - if verbose: print ex # Persist with cleaning up - if verbose: print " Removed sys.modules entries" - del sys.path[0] - if verbose: print " Removed sys.path entry" - for root, dirs, files in os.walk(top, topdown=False): - for name in files: - try: - os.remove(os.path.join(root, name)) - except OSError, ex: - if verbose: print ex # Persist with cleaning up - for name in dirs: - fullname = os.path.join(root, name) - try: - os.rmdir(fullname) - except OSError, ex: - if verbose: print ex # Persist with cleaning up - try: - os.rmdir(top) - if verbose: print " Removed package tree" - except OSError, ex: - if verbose: print ex # Persist with cleaning up - - def _check_module(self, depth): - pkg_dir, mod_fname, mod_name = ( - self._make_pkg("x=1\n", depth)) - try: - if verbose: print "Running from source:", mod_name - d1 = run_module(mod_name) # Read from source - self.failUnless(d1["x"] == 1) - del d1 # Ensure __loader__ entry doesn't keep file open - __import__(mod_name) - os.remove(mod_fname) - if verbose: print "Running from compiled:", mod_name - d2 = run_module(mod_name) # Read from bytecode - self.failUnless(d2["x"] == 1) - del d2 # Ensure __loader__ entry doesn't keep file open - finally: - self._del_pkg(pkg_dir, depth, mod_name) - if verbose: print "Module executed successfully" - - def test_run_module(self): - for depth in range(4): - if verbose: print "Testing package depth:", depth - self._check_module(depth) - - -def test_main(): - run_unittest(RunModuleCodeTest) - run_unittest(RunModuleTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_sax.py b/sys/lib/python/test/test_sax.py deleted file mode 100644 index 67aaf4dc7..000000000 --- a/sys/lib/python/test/test_sax.py +++ /dev/null @@ -1,788 +0,0 @@ -# regression test for SAX 2.0 -*- coding: iso-8859-1 -*- -# $Id: test_sax.py 53755 2007-02-12 12:21:41Z martin.v.loewis $ - -from xml.sax import make_parser, ContentHandler, \ - SAXException, SAXReaderNotAvailable, SAXParseException -try: - make_parser() -except SAXReaderNotAvailable: - # don't try to test this module if we cannot create a parser - raise ImportError("no XML parsers available") -from xml.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \ - XMLFilterBase -from xml.sax.expatreader import create_parser -from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl -from cStringIO import StringIO -from test.test_support import verify, verbose, TestFailed, findfile -import os - -# ===== Utilities - -tests = 0 -failures = [] - -def confirm(outcome, name): - global tests - - tests = tests + 1 - if outcome: - if verbose: - print "Passed", name - else: - failures.append(name) - -def test_make_parser2(): - try: - # Creating parsers several times in a row should succeed. - # Testing this because there have been failures of this kind - # before. - from xml.sax import make_parser - p = make_parser() - from xml.sax import make_parser - p = make_parser() - from xml.sax import make_parser - p = make_parser() - from xml.sax import make_parser - p = make_parser() - from xml.sax import make_parser - p = make_parser() - from xml.sax import make_parser - p = make_parser() - except: - return 0 - else: - return p - - -# =========================================================================== -# -# saxutils tests -# -# =========================================================================== - -# ===== escape - -def test_escape_basic(): - return escape("Donald Duck & Co") == "Donald Duck & Co" - -def test_escape_all(): - return escape("") == "<Donald Duck & Co>" - -def test_escape_extra(): - return escape("Hei på deg", {"å" : "å"}) == "Hei på deg" - -# ===== unescape - -def test_unescape_basic(): - return unescape("Donald Duck & Co") == "Donald Duck & Co" - -def test_unescape_all(): - return unescape("<Donald Duck & Co>") == "" - -def test_unescape_extra(): - return unescape("Hei på deg", {"å" : "å"}) == "Hei på deg" - -def test_unescape_amp_extra(): - return unescape("&foo;", {"&foo;": "splat"}) == "&foo;" - -# ===== quoteattr - -def test_quoteattr_basic(): - return quoteattr("Donald Duck & Co") == '"Donald Duck & Co"' - -def test_single_quoteattr(): - return (quoteattr('Includes "double" quotes') - == '\'Includes "double" quotes\'') - -def test_double_quoteattr(): - return (quoteattr("Includes 'single' quotes") - == "\"Includes 'single' quotes\"") - -def test_single_double_quoteattr(): - return (quoteattr("Includes 'single' and \"double\" quotes") - == "\"Includes 'single' and "double" quotes\"") - -# ===== make_parser - -def test_make_parser(): - try: - # Creating a parser should succeed - it should fall back - # to the expatreader - p = make_parser(['xml.parsers.no_such_parser']) - except: - return 0 - else: - return p - - -# ===== XMLGenerator - -start = '\n' - -def test_xmlgen_basic(): - result = StringIO() - gen = XMLGenerator(result) - gen.startDocument() - gen.startElement("doc", {}) - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + "" - -def test_xmlgen_content(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startElement("doc", {}) - gen.characters("huhei") - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + "huhei" - -def test_xmlgen_pi(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.processingInstruction("test", "data") - gen.startElement("doc", {}) - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + "" - -def test_xmlgen_content_escape(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startElement("doc", {}) - gen.characters("<huhei&" - -def test_xmlgen_attr_escape(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startElement("doc", {"a": '"'}) - gen.startElement("e", {"a": "'"}) - gen.endElement("e") - gen.startElement("e", {"a": "'\""}) - gen.endElement("e") - gen.startElement("e", {"a": "\n\r\t"}) - gen.endElement("e") - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + ("" - "" - "") - -def test_xmlgen_ignorable(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startElement("doc", {}) - gen.ignorableWhitespace(" ") - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + " " - -ns_uri = "http://www.python.org/xml-ns/saxtest/" - -def test_xmlgen_ns(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startPrefixMapping("ns1", ns_uri) - gen.startElementNS((ns_uri, "doc"), "ns1:doc", {}) - # add an unqualified name - gen.startElementNS((None, "udoc"), None, {}) - gen.endElementNS((None, "udoc"), None) - gen.endElementNS((ns_uri, "doc"), "ns1:doc") - gen.endPrefixMapping("ns1") - gen.endDocument() - - return result.getvalue() == start + \ - ('' % - ns_uri) - -def test_1463026_1(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startElementNS((None, 'a'), 'a', {(None, 'b'):'c'}) - gen.endElementNS((None, 'a'), 'a') - gen.endDocument() - - return result.getvalue() == start+'' - -def test_1463026_2(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startPrefixMapping(None, 'qux') - gen.startElementNS(('qux', 'a'), 'a', {}) - gen.endElementNS(('qux', 'a'), 'a') - gen.endPrefixMapping(None) - gen.endDocument() - - return result.getvalue() == start+'' - -def test_1463026_3(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startPrefixMapping('my', 'qux') - gen.startElementNS(('qux', 'a'), 'a', {(None, 'b'):'c'}) - gen.endElementNS(('qux', 'a'), 'a') - gen.endPrefixMapping('my') - gen.endDocument() - - return result.getvalue() == start+'' - -# ===== Xmlfilterbase - -def test_filter_basic(): - result = StringIO() - gen = XMLGenerator(result) - filter = XMLFilterBase() - filter.setContentHandler(gen) - - filter.startDocument() - filter.startElement("doc", {}) - filter.characters("content") - filter.ignorableWhitespace(" ") - filter.endElement("doc") - filter.endDocument() - - return result.getvalue() == start + "content " - -# =========================================================================== -# -# expatreader tests -# -# =========================================================================== - -# ===== XMLReader support - -def test_expat_file(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) - - parser.setContentHandler(xmlgen) - parser.parse(open(findfile("test"+os.extsep+"xml"))) - - return result.getvalue() == xml_test_out - -# ===== DTDHandler support - -class TestDTDHandler: - - def __init__(self): - self._notations = [] - self._entities = [] - - def notationDecl(self, name, publicId, systemId): - self._notations.append((name, publicId, systemId)) - - def unparsedEntityDecl(self, name, publicId, systemId, ndata): - self._entities.append((name, publicId, systemId, ndata)) - -def test_expat_dtdhandler(): - parser = create_parser() - handler = TestDTDHandler() - parser.setDTDHandler(handler) - - parser.feed('\n') - parser.feed(' \n') - parser.feed(']>\n') - parser.feed('') - parser.close() - - return handler._notations == [("GIF", "-//CompuServe//NOTATION Graphics Interchange Format 89a//EN", None)] and \ - handler._entities == [("img", None, "expat.gif", "GIF")] - -# ===== EntityResolver support - -class TestEntityResolver: - - def resolveEntity(self, publicId, systemId): - inpsrc = InputSource() - inpsrc.setByteStream(StringIO("")) - return inpsrc - -def test_expat_entityresolver(): - parser = create_parser() - parser.setEntityResolver(TestEntityResolver()) - result = StringIO() - parser.setContentHandler(XMLGenerator(result)) - - parser.feed('\n') - parser.feed(']>\n') - parser.feed('&test;') - parser.close() - - return result.getvalue() == start + "" - -# ===== Attributes support - -class AttrGatherer(ContentHandler): - - def startElement(self, name, attrs): - self._attrs = attrs - - def startElementNS(self, name, qname, attrs): - self._attrs = attrs - -def test_expat_attrs_empty(): - parser = create_parser() - gather = AttrGatherer() - parser.setContentHandler(gather) - - parser.feed("") - parser.close() - - return verify_empty_attrs(gather._attrs) - -def test_expat_attrs_wattr(): - parser = create_parser() - gather = AttrGatherer() - parser.setContentHandler(gather) - - parser.feed("") - parser.close() - - return verify_attrs_wattr(gather._attrs) - -def test_expat_nsattrs_empty(): - parser = create_parser(1) - gather = AttrGatherer() - parser.setContentHandler(gather) - - parser.feed("") - parser.close() - - return verify_empty_nsattrs(gather._attrs) - -def test_expat_nsattrs_wattr(): - parser = create_parser(1) - gather = AttrGatherer() - parser.setContentHandler(gather) - - parser.feed("" % ns_uri) - parser.close() - - attrs = gather._attrs - - return attrs.getLength() == 1 and \ - attrs.getNames() == [(ns_uri, "attr")] and \ - (attrs.getQNames() == [] or attrs.getQNames() == ["ns:attr"]) and \ - len(attrs) == 1 and \ - attrs.has_key((ns_uri, "attr")) and \ - attrs.keys() == [(ns_uri, "attr")] and \ - attrs.get((ns_uri, "attr")) == "val" and \ - attrs.get((ns_uri, "attr"), 25) == "val" and \ - attrs.items() == [((ns_uri, "attr"), "val")] and \ - attrs.values() == ["val"] and \ - attrs.getValue((ns_uri, "attr")) == "val" and \ - attrs[(ns_uri, "attr")] == "val" - -# ===== InputSource support - -xml_test_out = open(findfile("test"+os.extsep+"xml"+os.extsep+"out")).read() - -def test_expat_inpsource_filename(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) - - parser.setContentHandler(xmlgen) - parser.parse(findfile("test"+os.extsep+"xml")) - - return result.getvalue() == xml_test_out - -def test_expat_inpsource_sysid(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) - - parser.setContentHandler(xmlgen) - parser.parse(InputSource(findfile("test"+os.extsep+"xml"))) - - return result.getvalue() == xml_test_out - -def test_expat_inpsource_stream(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) - - parser.setContentHandler(xmlgen) - inpsrc = InputSource() - inpsrc.setByteStream(open(findfile("test"+os.extsep+"xml"))) - parser.parse(inpsrc) - - return result.getvalue() == xml_test_out - -# ===== IncrementalParser support - -def test_expat_incremental(): - result = StringIO() - xmlgen = XMLGenerator(result) - parser = create_parser() - parser.setContentHandler(xmlgen) - - parser.feed("") - parser.feed("") - parser.close() - - return result.getvalue() == start + "" - -def test_expat_incremental_reset(): - result = StringIO() - xmlgen = XMLGenerator(result) - parser = create_parser() - parser.setContentHandler(xmlgen) - - parser.feed("") - parser.feed("text") - - result = StringIO() - xmlgen = XMLGenerator(result) - parser.setContentHandler(xmlgen) - parser.reset() - - parser.feed("") - parser.feed("text") - parser.feed("") - parser.close() - - return result.getvalue() == start + "text" - -# ===== Locator support - -def test_expat_locator_noinfo(): - result = StringIO() - xmlgen = XMLGenerator(result) - parser = create_parser() - parser.setContentHandler(xmlgen) - - parser.feed("") - parser.feed("") - parser.close() - - return parser.getSystemId() is None and \ - parser.getPublicId() is None and \ - parser.getLineNumber() == 1 - -def test_expat_locator_withinfo(): - result = StringIO() - xmlgen = XMLGenerator(result) - parser = create_parser() - parser.setContentHandler(xmlgen) - parser.parse(findfile("test.xml")) - - return parser.getSystemId() == findfile("test.xml") and \ - parser.getPublicId() is None - - -# =========================================================================== -# -# error reporting -# -# =========================================================================== - -def test_expat_inpsource_location(): - parser = create_parser() - parser.setContentHandler(ContentHandler()) # do nothing - source = InputSource() - source.setByteStream(StringIO("")) #ill-formed - name = "a file name" - source.setSystemId(name) - try: - parser.parse(source) - except SAXException, e: - return e.getSystemId() == name - -def test_expat_incomplete(): - parser = create_parser() - parser.setContentHandler(ContentHandler()) # do nothing - try: - parser.parse(StringIO("")) - except SAXParseException: - return 1 # ok, error found - else: - return 0 - -def test_sax_parse_exception_str(): - # pass various values from a locator to the SAXParseException to - # make sure that the __str__() doesn't fall apart when None is - # passed instead of an integer line and column number - # - # use "normal" values for the locator: - str(SAXParseException("message", None, - DummyLocator(1, 1))) - # use None for the line number: - str(SAXParseException("message", None, - DummyLocator(None, 1))) - # use None for the column number: - str(SAXParseException("message", None, - DummyLocator(1, None))) - # use None for both: - str(SAXParseException("message", None, - DummyLocator(None, None))) - return 1 - -class DummyLocator: - def __init__(self, lineno, colno): - self._lineno = lineno - self._colno = colno - - def getPublicId(self): - return "pubid" - - def getSystemId(self): - return "sysid" - - def getLineNumber(self): - return self._lineno - - def getColumnNumber(self): - return self._colno - -# =========================================================================== -# -# xmlreader tests -# -# =========================================================================== - -# ===== AttributesImpl - -def verify_empty_attrs(attrs): - try: - attrs.getValue("attr") - gvk = 0 - except KeyError: - gvk = 1 - - try: - attrs.getValueByQName("attr") - gvqk = 0 - except KeyError: - gvqk = 1 - - try: - attrs.getNameByQName("attr") - gnqk = 0 - except KeyError: - gnqk = 1 - - try: - attrs.getQNameByName("attr") - gqnk = 0 - except KeyError: - gqnk = 1 - - try: - attrs["attr"] - gik = 0 - except KeyError: - gik = 1 - - return attrs.getLength() == 0 and \ - attrs.getNames() == [] and \ - attrs.getQNames() == [] and \ - len(attrs) == 0 and \ - not attrs.has_key("attr") and \ - attrs.keys() == [] and \ - attrs.get("attrs") is None and \ - attrs.get("attrs", 25) == 25 and \ - attrs.items() == [] and \ - attrs.values() == [] and \ - gvk and gvqk and gnqk and gik and gqnk - -def verify_attrs_wattr(attrs): - return attrs.getLength() == 1 and \ - attrs.getNames() == ["attr"] and \ - attrs.getQNames() == ["attr"] and \ - len(attrs) == 1 and \ - attrs.has_key("attr") and \ - attrs.keys() == ["attr"] and \ - attrs.get("attr") == "val" and \ - attrs.get("attr", 25) == "val" and \ - attrs.items() == [("attr", "val")] and \ - attrs.values() == ["val"] and \ - attrs.getValue("attr") == "val" and \ - attrs.getValueByQName("attr") == "val" and \ - attrs.getNameByQName("attr") == "attr" and \ - attrs["attr"] == "val" and \ - attrs.getQNameByName("attr") == "attr" - -def test_attrs_empty(): - return verify_empty_attrs(AttributesImpl({})) - -def test_attrs_wattr(): - return verify_attrs_wattr(AttributesImpl({"attr" : "val"})) - -# ===== AttributesImpl - -def verify_empty_nsattrs(attrs): - try: - attrs.getValue((ns_uri, "attr")) - gvk = 0 - except KeyError: - gvk = 1 - - try: - attrs.getValueByQName("ns:attr") - gvqk = 0 - except KeyError: - gvqk = 1 - - try: - attrs.getNameByQName("ns:attr") - gnqk = 0 - except KeyError: - gnqk = 1 - - try: - attrs.getQNameByName((ns_uri, "attr")) - gqnk = 0 - except KeyError: - gqnk = 1 - - try: - attrs[(ns_uri, "attr")] - gik = 0 - except KeyError: - gik = 1 - - return attrs.getLength() == 0 and \ - attrs.getNames() == [] and \ - attrs.getQNames() == [] and \ - len(attrs) == 0 and \ - not attrs.has_key((ns_uri, "attr")) and \ - attrs.keys() == [] and \ - attrs.get((ns_uri, "attr")) is None and \ - attrs.get((ns_uri, "attr"), 25) == 25 and \ - attrs.items() == [] and \ - attrs.values() == [] and \ - gvk and gvqk and gnqk and gik and gqnk - -def test_nsattrs_empty(): - return verify_empty_nsattrs(AttributesNSImpl({}, {})) - -def test_nsattrs_wattr(): - attrs = AttributesNSImpl({(ns_uri, "attr") : "val"}, - {(ns_uri, "attr") : "ns:attr"}) - - return attrs.getLength() == 1 and \ - attrs.getNames() == [(ns_uri, "attr")] and \ - attrs.getQNames() == ["ns:attr"] and \ - len(attrs) == 1 and \ - attrs.has_key((ns_uri, "attr")) and \ - attrs.keys() == [(ns_uri, "attr")] and \ - attrs.get((ns_uri, "attr")) == "val" and \ - attrs.get((ns_uri, "attr"), 25) == "val" and \ - attrs.items() == [((ns_uri, "attr"), "val")] and \ - attrs.values() == ["val"] and \ - attrs.getValue((ns_uri, "attr")) == "val" and \ - attrs.getValueByQName("ns:attr") == "val" and \ - attrs.getNameByQName("ns:attr") == (ns_uri, "attr") and \ - attrs[(ns_uri, "attr")] == "val" and \ - attrs.getQNameByName((ns_uri, "attr")) == "ns:attr" - - -# During the development of Python 2.5, an attempt to move the "xml" -# package implementation to a new package ("xmlcore") proved painful. -# The goal of this change was to allow applications to be able to -# obtain and rely on behavior in the standard library implementation -# of the XML support without needing to be concerned about the -# availability of the PyXML implementation. -# -# While the existing import hackery in Lib/xml/__init__.py can cause -# PyXML's _xmlpus package to supplant the "xml" package, that only -# works because either implementation uses the "xml" package name for -# imports. -# -# The move resulted in a number of problems related to the fact that -# the import machinery's "package context" is based on the name that's -# being imported rather than the __name__ of the actual package -# containment; it wasn't possible for the "xml" package to be replaced -# by a simple module that indirected imports to the "xmlcore" package. -# -# The following two tests exercised bugs that were introduced in that -# attempt. Keeping these tests around will help detect problems with -# other attempts to provide reliable access to the standard library's -# implementation of the XML support. - -def test_sf_1511497(): - # Bug report: http://www.python.org/sf/1511497 - import sys - old_modules = sys.modules.copy() - for modname in sys.modules.keys(): - if modname.startswith("xml."): - del sys.modules[modname] - try: - import xml.sax.expatreader - module = xml.sax.expatreader - return module.__name__ == "xml.sax.expatreader" - finally: - sys.modules.update(old_modules) - -def test_sf_1513611(): - # Bug report: http://www.python.org/sf/1513611 - sio = StringIO("invalid") - parser = make_parser() - from xml.sax import SAXParseException - try: - parser.parse(sio) - except SAXParseException: - return True - else: - return False - -# ===== Main program - -def make_test_output(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) - - parser.setContentHandler(xmlgen) - parser.parse(findfile("test"+os.extsep+"xml")) - - outf = open(findfile("test"+os.extsep+"xml"+os.extsep+"out"), "w") - outf.write(result.getvalue()) - outf.close() - -items = locals().items() -items.sort() -for (name, value) in items: - if name[ : 5] == "test_": - confirm(value(), name) -# We delete the items variable so that the assignment to items above -# doesn't pick up the old value of items (which messes with attempts -# to find reference leaks). -del items - -if verbose: - print "%d tests, %d failures" % (tests, len(failures)) -if failures: - raise TestFailed("%d of %d tests failed: %s" - % (len(failures), tests, ", ".join(failures))) diff --git a/sys/lib/python/test/test_scope.py b/sys/lib/python/test/test_scope.py deleted file mode 100644 index 239745c61..000000000 --- a/sys/lib/python/test/test_scope.py +++ /dev/null @@ -1,561 +0,0 @@ -from test.test_support import verify, TestFailed, check_syntax, vereq - -import warnings -warnings.filterwarnings("ignore", r"import \*", SyntaxWarning, "") - -print "1. simple nesting" - -def make_adder(x): - def adder(y): - return x + y - return adder - -inc = make_adder(1) -plus10 = make_adder(10) - -vereq(inc(1), 2) -vereq(plus10(-2), 8) - -print "2. extra nesting" - -def make_adder2(x): - def extra(): # check freevars passing through non-use scopes - def adder(y): - return x + y - return adder - return extra() - -inc = make_adder2(1) -plus10 = make_adder2(10) - -vereq(inc(1), 2) -vereq(plus10(-2), 8) - -print "3. simple nesting + rebinding" - -def make_adder3(x): - def adder(y): - return x + y - x = x + 1 # check tracking of assignment to x in defining scope - return adder - -inc = make_adder3(0) -plus10 = make_adder3(9) - -vereq(inc(1), 2) -vereq(plus10(-2), 8) - -print "4. nesting with global but no free" - -def make_adder4(): # XXX add exta level of indirection - def nest(): - def nest(): - def adder(y): - return global_x + y # check that plain old globals work - return adder - return nest() - return nest() - -global_x = 1 -adder = make_adder4() -vereq(adder(1), 2) - -global_x = 10 -vereq(adder(-2), 8) - -print "5. nesting through class" - -def make_adder5(x): - class Adder: - def __call__(self, y): - return x + y - return Adder() - -inc = make_adder5(1) -plus10 = make_adder5(10) - -vereq(inc(1), 2) -vereq(plus10(-2), 8) - -print "6. nesting plus free ref to global" - -def make_adder6(x): - global global_nest_x - def adder(y): - return global_nest_x + y - global_nest_x = x - return adder - -inc = make_adder6(1) -plus10 = make_adder6(10) - -vereq(inc(1), 11) # there's only one global -vereq(plus10(-2), 8) - -print "7. nearest enclosing scope" - -def f(x): - def g(y): - x = 42 # check that this masks binding in f() - def h(z): - return x + z - return h - return g(2) - -test_func = f(10) -vereq(test_func(5), 47) - -print "8. mixed freevars and cellvars" - -def identity(x): - return x - -def f(x, y, z): - def g(a, b, c): - a = a + x # 3 - def h(): - # z * (4 + 9) - # 3 * 13 - return identity(z * (b + y)) - y = c + z # 9 - return h - return g - -g = f(1, 2, 3) -h = g(2, 4, 6) -vereq(h(), 39) - -print "9. free variable in method" - -def test(): - method_and_var = "var" - class Test: - def method_and_var(self): - return "method" - def test(self): - return method_and_var - def actual_global(self): - return str("global") - def str(self): - return str(self) - return Test() - -t = test() -vereq(t.test(), "var") -vereq(t.method_and_var(), "method") -vereq(t.actual_global(), "global") - -method_and_var = "var" -class Test: - # this class is not nested, so the rules are different - def method_and_var(self): - return "method" - def test(self): - return method_and_var - def actual_global(self): - return str("global") - def str(self): - return str(self) - -t = Test() -vereq(t.test(), "var") -vereq(t.method_and_var(), "method") -vereq(t.actual_global(), "global") - -print "10. recursion" - -def f(x): - def fact(n): - if n == 0: - return 1 - else: - return n * fact(n - 1) - if x >= 0: - return fact(x) - else: - raise ValueError, "x must be >= 0" - -vereq(f(6), 720) - - -print "11. unoptimized namespaces" - -check_syntax("""\ -def unoptimized_clash1(strip): - def f(s): - from string import * - return strip(s) # ambiguity: free or local - return f -""") - -check_syntax("""\ -def unoptimized_clash2(): - from string import * - def f(s): - return strip(s) # ambiguity: global or local - return f -""") - -check_syntax("""\ -def unoptimized_clash2(): - from string import * - def g(): - def f(s): - return strip(s) # ambiguity: global or local - return f -""") - -# XXX could allow this for exec with const argument, but what's the point -check_syntax("""\ -def error(y): - exec "a = 1" - def f(x): - return x + y - return f -""") - -check_syntax("""\ -def f(x): - def g(): - return x - del x # can't del name -""") - -check_syntax("""\ -def f(): - def g(): - from string import * - return strip # global or local? -""") - -# and verify a few cases that should work - -exec """ -def noproblem1(): - from string import * - f = lambda x:x - -def noproblem2(): - from string import * - def f(x): - return x + 1 - -def noproblem3(): - from string import * - def f(x): - global y - y = x -""" - -print "12. lambdas" - -f1 = lambda x: lambda y: x + y -inc = f1(1) -plus10 = f1(10) -vereq(inc(1), 2) -vereq(plus10(5), 15) - -f2 = lambda x: (lambda : lambda y: x + y)() -inc = f2(1) -plus10 = f2(10) -vereq(inc(1), 2) -vereq(plus10(5), 15) - -f3 = lambda x: lambda y: global_x + y -global_x = 1 -inc = f3(None) -vereq(inc(2), 3) - -f8 = lambda x, y, z: lambda a, b, c: lambda : z * (b + y) -g = f8(1, 2, 3) -h = g(2, 4, 6) -vereq(h(), 18) - -print "13. UnboundLocal" - -def errorInOuter(): - print y - def inner(): - return y - y = 1 - -def errorInInner(): - def inner(): - return y - inner() - y = 1 - -try: - errorInOuter() -except UnboundLocalError: - pass -else: - raise TestFailed - -try: - errorInInner() -except NameError: - pass -else: - raise TestFailed - -# test for bug #1501934: incorrect LOAD/STORE_GLOBAL generation -global_x = 1 -def f(): - global_x += 1 -try: - f() -except UnboundLocalError: - pass -else: - raise TestFailed, 'scope of global_x not correctly determined' - -print "14. complex definitions" - -def makeReturner(*lst): - def returner(): - return lst - return returner - -vereq(makeReturner(1,2,3)(), (1,2,3)) - -def makeReturner2(**kwargs): - def returner(): - return kwargs - return returner - -vereq(makeReturner2(a=11)()['a'], 11) - -def makeAddPair((a, b)): - def addPair((c, d)): - return (a + c, b + d) - return addPair - -vereq(makeAddPair((1, 2))((100, 200)), (101,202)) - -print "15. scope of global statements" -# Examples posted by Samuele Pedroni to python-dev on 3/1/2001 - -# I -x = 7 -def f(): - x = 1 - def g(): - global x - def i(): - def h(): - return x - return h() - return i() - return g() -vereq(f(), 7) -vereq(x, 7) - -# II -x = 7 -def f(): - x = 1 - def g(): - x = 2 - def i(): - def h(): - return x - return h() - return i() - return g() -vereq(f(), 2) -vereq(x, 7) - -# III -x = 7 -def f(): - x = 1 - def g(): - global x - x = 2 - def i(): - def h(): - return x - return h() - return i() - return g() -vereq(f(), 2) -vereq(x, 2) - -# IV -x = 7 -def f(): - x = 3 - def g(): - global x - x = 2 - def i(): - def h(): - return x - return h() - return i() - return g() -vereq(f(), 2) -vereq(x, 2) - -# XXX what about global statements in class blocks? -# do they affect methods? - -x = 12 -class Global: - global x - x = 13 - def set(self, val): - x = val - def get(self): - return x - -g = Global() -vereq(g.get(), 13) -g.set(15) -vereq(g.get(), 13) - -print "16. check leaks" - -class Foo: - count = 0 - - def __init__(self): - Foo.count += 1 - - def __del__(self): - Foo.count -= 1 - -def f1(): - x = Foo() - def f2(): - return x - f2() - -for i in range(100): - f1() - -vereq(Foo.count, 0) - -print "17. class and global" - -def test(x): - class Foo: - global x - def __call__(self, y): - return x + y - return Foo() - -x = 0 -vereq(test(6)(2), 8) -x = -1 -vereq(test(3)(2), 5) - -looked_up_by_load_name = False -class X: - # Implicit globals inside classes are be looked up by LOAD_NAME, not - # LOAD_GLOBAL. - locals()['looked_up_by_load_name'] = True - passed = looked_up_by_load_name - -verify(X.passed) - -print "18. verify that locals() works" - -def f(x): - def g(y): - def h(z): - return y + z - w = x + y - y += 3 - return locals() - return g - -d = f(2)(4) -verify(d.has_key('h')) -del d['h'] -vereq(d, {'x': 2, 'y': 7, 'w': 6}) - -print "19. var is bound and free in class" - -def f(x): - class C: - def m(self): - return x - a = x - return C - -inst = f(3)() -vereq(inst.a, inst.m()) - -print "20. interaction with trace function" - -import sys -def tracer(a,b,c): - return tracer - -def adaptgetter(name, klass, getter): - kind, des = getter - if kind == 1: # AV happens when stepping from this line to next - if des == "": - des = "_%s__%s" % (klass.__name__, name) - return lambda obj: getattr(obj, des) - -class TestClass: - pass - -sys.settrace(tracer) -adaptgetter("foo", TestClass, (1, "")) -sys.settrace(None) - -try: sys.settrace() -except TypeError: pass -else: raise TestFailed, 'sys.settrace() did not raise TypeError' - -print "20. eval and exec with free variables" - -def f(x): - return lambda: x + 1 - -g = f(3) -try: - eval(g.func_code) -except TypeError: - pass -else: - print "eval() should have failed, because code contained free vars" - -try: - exec g.func_code -except TypeError: - pass -else: - print "exec should have failed, because code contained free vars" - -print "21. list comprehension with local variables" - -try: - print bad -except NameError: - pass -else: - print "bad should not be defined" - -def x(): - [bad for s in 'a b' for bad in s.split()] - -x() -try: - print bad -except NameError: - pass - -print "22. eval with free variables" - -def f(x): - def g(): - x - eval("x + 1") - return g - -f(4)() diff --git a/sys/lib/python/test/test_scriptpackages.py b/sys/lib/python/test/test_scriptpackages.py deleted file mode 100644 index a2e03f91e..000000000 --- a/sys/lib/python/test/test_scriptpackages.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2003 Python Software Foundation - -import unittest -import os -import sys -import tempfile -from test import test_support -import aetools - -class TestScriptpackages(unittest.TestCase): - - def _test_scriptpackage(self, package, testobject=1): - # Check that we can import the package - mod = __import__(package) - # Test that we can get the main event class - klass = getattr(mod, package) - # Test that we can instantiate that class - talker = klass() - if testobject: - # Test that we can get an application object - obj = mod.application(0) - - def test__builtinSuites(self): - self._test_scriptpackage('_builtinSuites', testobject=0) - - def test_StdSuites(self): - self._test_scriptpackage('StdSuites') - - def test_SystemEvents(self): - self._test_scriptpackage('SystemEvents') - - def test_Finder(self): - self._test_scriptpackage('Finder') - - def test_Terminal(self): - self._test_scriptpackage('Terminal') - - def test_Netscape(self): - self._test_scriptpackage('Netscape') - - def test_Explorer(self): - self._test_scriptpackage('Explorer') - - def test_CodeWarrior(self): - self._test_scriptpackage('CodeWarrior') - -def test_main(): - test_support.run_unittest(TestScriptpackages) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_select.py b/sys/lib/python/test/test_select.py deleted file mode 100644 index d34132409..000000000 --- a/sys/lib/python/test/test_select.py +++ /dev/null @@ -1,70 +0,0 @@ -# Testing select module -from test.test_support import verbose, reap_children -import select -import os - -# test some known error conditions -try: - rfd, wfd, xfd = select.select(1, 2, 3) -except TypeError: - pass -else: - print 'expected TypeError exception not raised' - -class Nope: - pass - -class Almost: - def fileno(self): - return 'fileno' - -try: - rfd, wfd, xfd = select.select([Nope()], [], []) -except TypeError: - pass -else: - print 'expected TypeError exception not raised' - -try: - rfd, wfd, xfd = select.select([Almost()], [], []) -except TypeError: - pass -else: - print 'expected TypeError exception not raised' - -try: - rfd, wfd, xfd = select.select([], [], [], 'not a number') -except TypeError: - pass -else: - print 'expected TypeError exception not raised' - - -def test(): - import sys - if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'): - if verbose: - print "Can't test select easily on", sys.platform - return - cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' - p = os.popen(cmd, 'r') - for tout in (0, 1, 2, 4, 8, 16) + (None,)*10: - if verbose: - print 'timeout =', tout - rfd, wfd, xfd = select.select([p], [], [], tout) - if (rfd, wfd, xfd) == ([], [], []): - continue - if (rfd, wfd, xfd) == ([p], [], []): - line = p.readline() - if verbose: - print repr(line) - if not line: - if verbose: - print 'EOF' - break - continue - print 'Unexpected return values from select():', rfd, wfd, xfd - p.close() - reap_children() - -test() diff --git a/sys/lib/python/test/test_set.py b/sys/lib/python/test/test_set.py deleted file mode 100644 index ef7cea7be..000000000 --- a/sys/lib/python/test/test_set.py +++ /dev/null @@ -1,1535 +0,0 @@ -import unittest -from test import test_support -from weakref import proxy -import operator -import copy -import pickle -import os -from random import randrange, shuffle -import sys - -class PassThru(Exception): - pass - -def check_pass_thru(): - raise PassThru - yield 1 - -class BadCmp: - def __hash__(self): - return 1 - def __cmp__(self, other): - raise RuntimeError - -class ReprWrapper: - 'Used to test self-referential repr() calls' - def __repr__(self): - return repr(self.value) - -class HashCountingInt(int): - 'int-like object that counts the number of times __hash__ is called' - def __init__(self, *args): - self.hash_count = 0 - def __hash__(self): - self.hash_count += 1 - return int.__hash__(self) - -class TestJointOps(unittest.TestCase): - # Tests common to both set and frozenset - - def setUp(self): - self.word = word = 'simsalabim' - self.otherword = 'madagascar' - self.letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' - self.s = self.thetype(word) - self.d = dict.fromkeys(word) - - def test_new_or_init(self): - self.assertRaises(TypeError, self.thetype, [], 2) - - def test_uniquification(self): - actual = sorted(self.s) - expected = sorted(self.d) - self.assertEqual(actual, expected) - self.assertRaises(PassThru, self.thetype, check_pass_thru()) - self.assertRaises(TypeError, self.thetype, [[]]) - - def test_len(self): - self.assertEqual(len(self.s), len(self.d)) - - def test_contains(self): - for c in self.letters: - self.assertEqual(c in self.s, c in self.d) - self.assertRaises(TypeError, self.s.__contains__, [[]]) - s = self.thetype([frozenset(self.letters)]) - self.assert_(self.thetype(self.letters) in s) - - def test_union(self): - u = self.s.union(self.otherword) - for c in self.letters: - self.assertEqual(c in u, c in self.d or c in self.otherword) - self.assertEqual(self.s, self.thetype(self.word)) - self.assertEqual(type(u), self.thetype) - self.assertRaises(PassThru, self.s.union, check_pass_thru()) - self.assertRaises(TypeError, self.s.union, [[]]) - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: - self.assertEqual(self.thetype('abcba').union(C('cdc')), set('abcd')) - self.assertEqual(self.thetype('abcba').union(C('efgfe')), set('abcefg')) - self.assertEqual(self.thetype('abcba').union(C('ccb')), set('abc')) - self.assertEqual(self.thetype('abcba').union(C('ef')), set('abcef')) - - def test_or(self): - i = self.s.union(self.otherword) - self.assertEqual(self.s | set(self.otherword), i) - self.assertEqual(self.s | frozenset(self.otherword), i) - try: - self.s | self.otherword - except TypeError: - pass - else: - self.fail("s|t did not screen-out general iterables") - - def test_intersection(self): - i = self.s.intersection(self.otherword) - for c in self.letters: - self.assertEqual(c in i, c in self.d and c in self.otherword) - self.assertEqual(self.s, self.thetype(self.word)) - self.assertEqual(type(i), self.thetype) - self.assertRaises(PassThru, self.s.intersection, check_pass_thru()) - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: - self.assertEqual(self.thetype('abcba').intersection(C('cdc')), set('cc')) - self.assertEqual(self.thetype('abcba').intersection(C('efgfe')), set('')) - self.assertEqual(self.thetype('abcba').intersection(C('ccb')), set('bc')) - self.assertEqual(self.thetype('abcba').intersection(C('ef')), set('')) - - def test_and(self): - i = self.s.intersection(self.otherword) - self.assertEqual(self.s & set(self.otherword), i) - self.assertEqual(self.s & frozenset(self.otherword), i) - try: - self.s & self.otherword - except TypeError: - pass - else: - self.fail("s&t did not screen-out general iterables") - - def test_difference(self): - i = self.s.difference(self.otherword) - for c in self.letters: - self.assertEqual(c in i, c in self.d and c not in self.otherword) - self.assertEqual(self.s, self.thetype(self.word)) - self.assertEqual(type(i), self.thetype) - self.assertRaises(PassThru, self.s.difference, check_pass_thru()) - self.assertRaises(TypeError, self.s.difference, [[]]) - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: - self.assertEqual(self.thetype('abcba').difference(C('cdc')), set('ab')) - self.assertEqual(self.thetype('abcba').difference(C('efgfe')), set('abc')) - self.assertEqual(self.thetype('abcba').difference(C('ccb')), set('a')) - self.assertEqual(self.thetype('abcba').difference(C('ef')), set('abc')) - - def test_sub(self): - i = self.s.difference(self.otherword) - self.assertEqual(self.s - set(self.otherword), i) - self.assertEqual(self.s - frozenset(self.otherword), i) - try: - self.s - self.otherword - except TypeError: - pass - else: - self.fail("s-t did not screen-out general iterables") - - def test_symmetric_difference(self): - i = self.s.symmetric_difference(self.otherword) - for c in self.letters: - self.assertEqual(c in i, (c in self.d) ^ (c in self.otherword)) - self.assertEqual(self.s, self.thetype(self.word)) - self.assertEqual(type(i), self.thetype) - self.assertRaises(PassThru, self.s.symmetric_difference, check_pass_thru()) - self.assertRaises(TypeError, self.s.symmetric_difference, [[]]) - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: - self.assertEqual(self.thetype('abcba').symmetric_difference(C('cdc')), set('abd')) - self.assertEqual(self.thetype('abcba').symmetric_difference(C('efgfe')), set('abcefg')) - self.assertEqual(self.thetype('abcba').symmetric_difference(C('ccb')), set('a')) - self.assertEqual(self.thetype('abcba').symmetric_difference(C('ef')), set('abcef')) - - def test_xor(self): - i = self.s.symmetric_difference(self.otherword) - self.assertEqual(self.s ^ set(self.otherword), i) - self.assertEqual(self.s ^ frozenset(self.otherword), i) - try: - self.s ^ self.otherword - except TypeError: - pass - else: - self.fail("s^t did not screen-out general iterables") - - def test_equality(self): - self.assertEqual(self.s, set(self.word)) - self.assertEqual(self.s, frozenset(self.word)) - self.assertEqual(self.s == self.word, False) - self.assertNotEqual(self.s, set(self.otherword)) - self.assertNotEqual(self.s, frozenset(self.otherword)) - self.assertEqual(self.s != self.word, True) - - def test_setOfFrozensets(self): - t = map(frozenset, ['abcdef', 'bcd', 'bdcb', 'fed', 'fedccba']) - s = self.thetype(t) - self.assertEqual(len(s), 3) - - def test_compare(self): - self.assertRaises(TypeError, self.s.__cmp__, self.s) - - def test_sub_and_super(self): - p, q, r = map(self.thetype, ['ab', 'abcde', 'def']) - self.assert_(p < q) - self.assert_(p <= q) - self.assert_(q <= q) - self.assert_(q > p) - self.assert_(q >= p) - self.failIf(q < r) - self.failIf(q <= r) - self.failIf(q > r) - self.failIf(q >= r) - self.assert_(set('a').issubset('abc')) - self.assert_(set('abc').issuperset('a')) - self.failIf(set('a').issubset('cbs')) - self.failIf(set('cbs').issuperset('a')) - - def test_pickling(self): - for i in (0, 1, 2): - p = pickle.dumps(self.s, i) - dup = pickle.loads(p) - self.assertEqual(self.s, dup, "%s != %s" % (self.s, dup)) - if type(self.s) not in (set, frozenset): - self.s.x = 10 - p = pickle.dumps(self.s) - dup = pickle.loads(p) - self.assertEqual(self.s.x, dup.x) - - def test_deepcopy(self): - class Tracer: - def __init__(self, value): - self.value = value - def __hash__(self): - return self.value - def __deepcopy__(self, memo=None): - return Tracer(self.value + 1) - t = Tracer(10) - s = self.thetype([t]) - dup = copy.deepcopy(s) - self.assertNotEqual(id(s), id(dup)) - for elem in dup: - newt = elem - self.assertNotEqual(id(t), id(newt)) - self.assertEqual(t.value + 1, newt.value) - - def test_gc(self): - # Create a nest of cycles to exercise overall ref count check - class A: - pass - s = set(A() for i in xrange(1000)) - for elem in s: - elem.cycle = s - elem.sub = elem - elem.set = set([elem]) - - def test_subclass_with_custom_hash(self): - # Bug #1257731 - class H(self.thetype): - def __hash__(self): - return int(id(self) & 0x7fffffff) - s=H() - f=set() - f.add(s) - self.assert_(s in f) - f.remove(s) - f.add(s) - f.discard(s) - - def test_badcmp(self): - s = self.thetype([BadCmp()]) - # Detect comparison errors during insertion and lookup - self.assertRaises(RuntimeError, self.thetype, [BadCmp(), BadCmp()]) - self.assertRaises(RuntimeError, s.__contains__, BadCmp()) - # Detect errors during mutating operations - if hasattr(s, 'add'): - self.assertRaises(RuntimeError, s.add, BadCmp()) - self.assertRaises(RuntimeError, s.discard, BadCmp()) - self.assertRaises(RuntimeError, s.remove, BadCmp()) - - def test_cyclical_repr(self): - w = ReprWrapper() - s = self.thetype([w]) - w.value = s - name = repr(s).partition('(')[0] # strip class name from repr string - self.assertEqual(repr(s), '%s([%s(...)])' % (name, name)) - - def test_cyclical_print(self): - w = ReprWrapper() - s = self.thetype([w]) - w.value = s - try: - fo = open(test_support.TESTFN, "wb") - print >> fo, s, - fo.close() - fo = open(test_support.TESTFN, "rb") - self.assertEqual(fo.read(), repr(s)) - finally: - fo.close() - os.remove(test_support.TESTFN) - - def test_do_not_rehash_dict_keys(self): - n = 10 - d = dict.fromkeys(map(HashCountingInt, xrange(n))) - self.assertEqual(sum(elem.hash_count for elem in d), n) - s = self.thetype(d) - self.assertEqual(sum(elem.hash_count for elem in d), n) - s.difference(d) - self.assertEqual(sum(elem.hash_count for elem in d), n) - if hasattr(s, 'symmetric_difference_update'): - s.symmetric_difference_update(d) - self.assertEqual(sum(elem.hash_count for elem in d), n) - d2 = dict.fromkeys(set(d)) - self.assertEqual(sum(elem.hash_count for elem in d), n) - d3 = dict.fromkeys(frozenset(d)) - self.assertEqual(sum(elem.hash_count for elem in d), n) - d3 = dict.fromkeys(frozenset(d), 123) - self.assertEqual(sum(elem.hash_count for elem in d), n) - self.assertEqual(d3, dict.fromkeys(d, 123)) - -class TestSet(TestJointOps): - thetype = set - - def test_init(self): - s = self.thetype() - s.__init__(self.word) - self.assertEqual(s, set(self.word)) - s.__init__(self.otherword) - self.assertEqual(s, set(self.otherword)) - self.assertRaises(TypeError, s.__init__, s, 2); - self.assertRaises(TypeError, s.__init__, 1); - - def test_constructor_identity(self): - s = self.thetype(range(3)) - t = self.thetype(s) - self.assertNotEqual(id(s), id(t)) - - def test_hash(self): - self.assertRaises(TypeError, hash, self.s) - - def test_clear(self): - self.s.clear() - self.assertEqual(self.s, set()) - self.assertEqual(len(self.s), 0) - - def test_copy(self): - dup = self.s.copy() - self.assertEqual(self.s, dup) - self.assertNotEqual(id(self.s), id(dup)) - - def test_add(self): - self.s.add('Q') - self.assert_('Q' in self.s) - dup = self.s.copy() - self.s.add('Q') - self.assertEqual(self.s, dup) - self.assertRaises(TypeError, self.s.add, []) - - def test_remove(self): - self.s.remove('a') - self.assert_('a' not in self.s) - self.assertRaises(KeyError, self.s.remove, 'Q') - self.assertRaises(TypeError, self.s.remove, []) - s = self.thetype([frozenset(self.word)]) - self.assert_(self.thetype(self.word) in s) - s.remove(self.thetype(self.word)) - self.assert_(self.thetype(self.word) not in s) - self.assertRaises(KeyError, self.s.remove, self.thetype(self.word)) - - def test_remove_keyerror_unpacking(self): - # bug: www.python.org/sf/1576657 - for v1 in ['Q', (1,)]: - try: - self.s.remove(v1) - except KeyError, e: - v2 = e.args[0] - self.assertEqual(v1, v2) - else: - self.fail() - - def test_discard(self): - self.s.discard('a') - self.assert_('a' not in self.s) - self.s.discard('Q') - self.assertRaises(TypeError, self.s.discard, []) - s = self.thetype([frozenset(self.word)]) - self.assert_(self.thetype(self.word) in s) - s.discard(self.thetype(self.word)) - self.assert_(self.thetype(self.word) not in s) - s.discard(self.thetype(self.word)) - - def test_pop(self): - for i in xrange(len(self.s)): - elem = self.s.pop() - self.assert_(elem not in self.s) - self.assertRaises(KeyError, self.s.pop) - - def test_update(self): - retval = self.s.update(self.otherword) - self.assertEqual(retval, None) - for c in (self.word + self.otherword): - self.assert_(c in self.s) - self.assertRaises(PassThru, self.s.update, check_pass_thru()) - self.assertRaises(TypeError, self.s.update, [[]]) - for p, q in (('cdc', 'abcd'), ('efgfe', 'abcefg'), ('ccb', 'abc'), ('ef', 'abcef')): - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: - s = self.thetype('abcba') - self.assertEqual(s.update(C(p)), None) - self.assertEqual(s, set(q)) - - def test_ior(self): - self.s |= set(self.otherword) - for c in (self.word + self.otherword): - self.assert_(c in self.s) - - def test_intersection_update(self): - retval = self.s.intersection_update(self.otherword) - self.assertEqual(retval, None) - for c in (self.word + self.otherword): - if c in self.otherword and c in self.word: - self.assert_(c in self.s) - else: - self.assert_(c not in self.s) - self.assertRaises(PassThru, self.s.intersection_update, check_pass_thru()) - self.assertRaises(TypeError, self.s.intersection_update, [[]]) - for p, q in (('cdc', 'c'), ('efgfe', ''), ('ccb', 'bc'), ('ef', '')): - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: - s = self.thetype('abcba') - self.assertEqual(s.intersection_update(C(p)), None) - self.assertEqual(s, set(q)) - - def test_iand(self): - self.s &= set(self.otherword) - for c in (self.word + self.otherword): - if c in self.otherword and c in self.word: - self.assert_(c in self.s) - else: - self.assert_(c not in self.s) - - def test_difference_update(self): - retval = self.s.difference_update(self.otherword) - self.assertEqual(retval, None) - for c in (self.word + self.otherword): - if c in self.word and c not in self.otherword: - self.assert_(c in self.s) - else: - self.assert_(c not in self.s) - self.assertRaises(PassThru, self.s.difference_update, check_pass_thru()) - self.assertRaises(TypeError, self.s.difference_update, [[]]) - self.assertRaises(TypeError, self.s.symmetric_difference_update, [[]]) - for p, q in (('cdc', 'ab'), ('efgfe', 'abc'), ('ccb', 'a'), ('ef', 'abc')): - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: - s = self.thetype('abcba') - self.assertEqual(s.difference_update(C(p)), None) - self.assertEqual(s, set(q)) - - def test_isub(self): - self.s -= set(self.otherword) - for c in (self.word + self.otherword): - if c in self.word and c not in self.otherword: - self.assert_(c in self.s) - else: - self.assert_(c not in self.s) - - def test_symmetric_difference_update(self): - retval = self.s.symmetric_difference_update(self.otherword) - self.assertEqual(retval, None) - for c in (self.word + self.otherword): - if (c in self.word) ^ (c in self.otherword): - self.assert_(c in self.s) - else: - self.assert_(c not in self.s) - self.assertRaises(PassThru, self.s.symmetric_difference_update, check_pass_thru()) - self.assertRaises(TypeError, self.s.symmetric_difference_update, [[]]) - for p, q in (('cdc', 'abd'), ('efgfe', 'abcefg'), ('ccb', 'a'), ('ef', 'abcef')): - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: - s = self.thetype('abcba') - self.assertEqual(s.symmetric_difference_update(C(p)), None) - self.assertEqual(s, set(q)) - - def test_ixor(self): - self.s ^= set(self.otherword) - for c in (self.word + self.otherword): - if (c in self.word) ^ (c in self.otherword): - self.assert_(c in self.s) - else: - self.assert_(c not in self.s) - - def test_inplace_on_self(self): - t = self.s.copy() - t |= t - self.assertEqual(t, self.s) - t &= t - self.assertEqual(t, self.s) - t -= t - self.assertEqual(t, self.thetype()) - t = self.s.copy() - t ^= t - self.assertEqual(t, self.thetype()) - - def test_weakref(self): - s = self.thetype('gallahad') - p = proxy(s) - self.assertEqual(str(p), str(s)) - s = None - self.assertRaises(ReferenceError, str, p) - - # C API test only available in a debug build - if hasattr(set, "test_c_api"): - def test_c_api(self): - self.assertEqual(set('abc').test_c_api(), True) - -class SetSubclass(set): - pass - -class TestSetSubclass(TestSet): - thetype = SetSubclass - -class SetSubclassWithKeywordArgs(set): - def __init__(self, iterable=[], newarg=None): - set.__init__(self, iterable) - -class TestSetSubclassWithKeywordArgs(TestSet): - - def test_keywords_in_subclass(self): - 'SF bug #1486663 -- this used to erroneously raise a TypeError' - SetSubclassWithKeywordArgs(newarg=1) - -class TestFrozenSet(TestJointOps): - thetype = frozenset - - def test_init(self): - s = self.thetype(self.word) - s.__init__(self.otherword) - self.assertEqual(s, set(self.word)) - - def test_singleton_empty_frozenset(self): - f = frozenset() - efs = [frozenset(), frozenset([]), frozenset(()), frozenset(''), - frozenset(), frozenset([]), frozenset(()), frozenset(''), - frozenset(xrange(0)), frozenset(frozenset()), - frozenset(f), f] - # All of the empty frozensets should have just one id() - self.assertEqual(len(set(map(id, efs))), 1) - - def test_constructor_identity(self): - s = self.thetype(range(3)) - t = self.thetype(s) - self.assertEqual(id(s), id(t)) - - def test_hash(self): - self.assertEqual(hash(self.thetype('abcdeb')), - hash(self.thetype('ebecda'))) - - # make sure that all permutations give the same hash value - n = 100 - seq = [randrange(n) for i in xrange(n)] - results = set() - for i in xrange(200): - shuffle(seq) - results.add(hash(self.thetype(seq))) - self.assertEqual(len(results), 1) - - def test_copy(self): - dup = self.s.copy() - self.assertEqual(id(self.s), id(dup)) - - def test_frozen_as_dictkey(self): - seq = range(10) + list('abcdefg') + ['apple'] - key1 = self.thetype(seq) - key2 = self.thetype(reversed(seq)) - self.assertEqual(key1, key2) - self.assertNotEqual(id(key1), id(key2)) - d = {} - d[key1] = 42 - self.assertEqual(d[key2], 42) - - def test_hash_caching(self): - f = self.thetype('abcdcda') - self.assertEqual(hash(f), hash(f)) - - def test_hash_effectiveness(self): - n = 13 - hashvalues = set() - addhashvalue = hashvalues.add - elemmasks = [(i+1, 1<> fo, self.set, - fo.close() - fo = open(test_support.TESTFN, "rb") - self.assertEqual(fo.read(), repr(self.set)) - finally: - fo.close() - os.remove(test_support.TESTFN) - - def test_length(self): - self.assertEqual(len(self.set), self.length) - - def test_self_equality(self): - self.assertEqual(self.set, self.set) - - def test_equivalent_equality(self): - self.assertEqual(self.set, self.dup) - - def test_copy(self): - self.assertEqual(self.set.copy(), self.dup) - - def test_self_union(self): - result = self.set | self.set - self.assertEqual(result, self.dup) - - def test_empty_union(self): - result = self.set | empty_set - self.assertEqual(result, self.dup) - - def test_union_empty(self): - result = empty_set | self.set - self.assertEqual(result, self.dup) - - def test_self_intersection(self): - result = self.set & self.set - self.assertEqual(result, self.dup) - - def test_empty_intersection(self): - result = self.set & empty_set - self.assertEqual(result, empty_set) - - def test_intersection_empty(self): - result = empty_set & self.set - self.assertEqual(result, empty_set) - - def test_self_symmetric_difference(self): - result = self.set ^ self.set - self.assertEqual(result, empty_set) - - def checkempty_symmetric_difference(self): - result = self.set ^ empty_set - self.assertEqual(result, self.set) - - def test_self_difference(self): - result = self.set - self.set - self.assertEqual(result, empty_set) - - def test_empty_difference(self): - result = self.set - empty_set - self.assertEqual(result, self.dup) - - def test_empty_difference_rev(self): - result = empty_set - self.set - self.assertEqual(result, empty_set) - - def test_iteration(self): - for v in self.set: - self.assert_(v in self.values) - setiter = iter(self.set) - # note: __length_hint__ is an internal undocumented API, - # don't rely on it in your own programs - self.assertEqual(setiter.__length_hint__(), len(self.set)) - - def test_pickling(self): - p = pickle.dumps(self.set) - copy = pickle.loads(p) - self.assertEqual(self.set, copy, - "%s != %s" % (self.set, copy)) - -#------------------------------------------------------------------------------ - -class TestBasicOpsEmpty(TestBasicOps): - def setUp(self): - self.case = "empty set" - self.values = [] - self.set = set(self.values) - self.dup = set(self.values) - self.length = 0 - self.repr = "set([])" - -#------------------------------------------------------------------------------ - -class TestBasicOpsSingleton(TestBasicOps): - def setUp(self): - self.case = "unit set (number)" - self.values = [3] - self.set = set(self.values) - self.dup = set(self.values) - self.length = 1 - self.repr = "set([3])" - - def test_in(self): - self.failUnless(3 in self.set) - - def test_not_in(self): - self.failUnless(2 not in self.set) - -#------------------------------------------------------------------------------ - -class TestBasicOpsTuple(TestBasicOps): - def setUp(self): - self.case = "unit set (tuple)" - self.values = [(0, "zero")] - self.set = set(self.values) - self.dup = set(self.values) - self.length = 1 - self.repr = "set([(0, 'zero')])" - - def test_in(self): - self.failUnless((0, "zero") in self.set) - - def test_not_in(self): - self.failUnless(9 not in self.set) - -#------------------------------------------------------------------------------ - -class TestBasicOpsTriple(TestBasicOps): - def setUp(self): - self.case = "triple set" - self.values = [0, "zero", operator.add] - self.set = set(self.values) - self.dup = set(self.values) - self.length = 3 - self.repr = None - -#============================================================================== - -def baditer(): - raise TypeError - yield True - -def gooditer(): - yield True - -class TestExceptionPropagation(unittest.TestCase): - """SF 628246: Set constructor should not trap iterator TypeErrors""" - - def test_instanceWithException(self): - self.assertRaises(TypeError, set, baditer()) - - def test_instancesWithoutException(self): - # All of these iterables should load without exception. - set([1,2,3]) - set((1,2,3)) - set({'one':1, 'two':2, 'three':3}) - set(xrange(3)) - set('abc') - set(gooditer()) - - def test_changingSizeWhileIterating(self): - s = set([1,2,3]) - try: - for i in s: - s.update([4]) - except RuntimeError: - pass - else: - self.fail("no exception when changing size during iteration") - -#============================================================================== - -class TestSetOfSets(unittest.TestCase): - def test_constructor(self): - inner = frozenset([1]) - outer = set([inner]) - element = outer.pop() - self.assertEqual(type(element), frozenset) - outer.add(inner) # Rebuild set of sets with .add method - outer.remove(inner) - self.assertEqual(outer, set()) # Verify that remove worked - outer.discard(inner) # Absence of KeyError indicates working fine - -#============================================================================== - -class TestBinaryOps(unittest.TestCase): - def setUp(self): - self.set = set((2, 4, 6)) - - def test_eq(self): # SF bug 643115 - self.assertEqual(self.set, set({2:1,4:3,6:5})) - - def test_union_subset(self): - result = self.set | set([2]) - self.assertEqual(result, set((2, 4, 6))) - - def test_union_superset(self): - result = self.set | set([2, 4, 6, 8]) - self.assertEqual(result, set([2, 4, 6, 8])) - - def test_union_overlap(self): - result = self.set | set([3, 4, 5]) - self.assertEqual(result, set([2, 3, 4, 5, 6])) - - def test_union_non_overlap(self): - result = self.set | set([8]) - self.assertEqual(result, set([2, 4, 6, 8])) - - def test_intersection_subset(self): - result = self.set & set((2, 4)) - self.assertEqual(result, set((2, 4))) - - def test_intersection_superset(self): - result = self.set & set([2, 4, 6, 8]) - self.assertEqual(result, set([2, 4, 6])) - - def test_intersection_overlap(self): - result = self.set & set([3, 4, 5]) - self.assertEqual(result, set([4])) - - def test_intersection_non_overlap(self): - result = self.set & set([8]) - self.assertEqual(result, empty_set) - - def test_sym_difference_subset(self): - result = self.set ^ set((2, 4)) - self.assertEqual(result, set([6])) - - def test_sym_difference_superset(self): - result = self.set ^ set((2, 4, 6, 8)) - self.assertEqual(result, set([8])) - - def test_sym_difference_overlap(self): - result = self.set ^ set((3, 4, 5)) - self.assertEqual(result, set([2, 3, 5, 6])) - - def test_sym_difference_non_overlap(self): - result = self.set ^ set([8]) - self.assertEqual(result, set([2, 4, 6, 8])) - - def test_cmp(self): - a, b = set('a'), set('b') - self.assertRaises(TypeError, cmp, a, b) - - # You can view this as a buglet: cmp(a, a) does not raise TypeError, - # because __eq__ is tried before __cmp__, and a.__eq__(a) returns True, - # which Python thinks is good enough to synthesize a cmp() result - # without calling __cmp__. - self.assertEqual(cmp(a, a), 0) - - self.assertRaises(TypeError, cmp, a, 12) - self.assertRaises(TypeError, cmp, "abc", a) - -#============================================================================== - -class TestUpdateOps(unittest.TestCase): - def setUp(self): - self.set = set((2, 4, 6)) - - def test_union_subset(self): - self.set |= set([2]) - self.assertEqual(self.set, set((2, 4, 6))) - - def test_union_superset(self): - self.set |= set([2, 4, 6, 8]) - self.assertEqual(self.set, set([2, 4, 6, 8])) - - def test_union_overlap(self): - self.set |= set([3, 4, 5]) - self.assertEqual(self.set, set([2, 3, 4, 5, 6])) - - def test_union_non_overlap(self): - self.set |= set([8]) - self.assertEqual(self.set, set([2, 4, 6, 8])) - - def test_union_method_call(self): - self.set.update(set([3, 4, 5])) - self.assertEqual(self.set, set([2, 3, 4, 5, 6])) - - def test_intersection_subset(self): - self.set &= set((2, 4)) - self.assertEqual(self.set, set((2, 4))) - - def test_intersection_superset(self): - self.set &= set([2, 4, 6, 8]) - self.assertEqual(self.set, set([2, 4, 6])) - - def test_intersection_overlap(self): - self.set &= set([3, 4, 5]) - self.assertEqual(self.set, set([4])) - - def test_intersection_non_overlap(self): - self.set &= set([8]) - self.assertEqual(self.set, empty_set) - - def test_intersection_method_call(self): - self.set.intersection_update(set([3, 4, 5])) - self.assertEqual(self.set, set([4])) - - def test_sym_difference_subset(self): - self.set ^= set((2, 4)) - self.assertEqual(self.set, set([6])) - - def test_sym_difference_superset(self): - self.set ^= set((2, 4, 6, 8)) - self.assertEqual(self.set, set([8])) - - def test_sym_difference_overlap(self): - self.set ^= set((3, 4, 5)) - self.assertEqual(self.set, set([2, 3, 5, 6])) - - def test_sym_difference_non_overlap(self): - self.set ^= set([8]) - self.assertEqual(self.set, set([2, 4, 6, 8])) - - def test_sym_difference_method_call(self): - self.set.symmetric_difference_update(set([3, 4, 5])) - self.assertEqual(self.set, set([2, 3, 5, 6])) - - def test_difference_subset(self): - self.set -= set((2, 4)) - self.assertEqual(self.set, set([6])) - - def test_difference_superset(self): - self.set -= set((2, 4, 6, 8)) - self.assertEqual(self.set, set([])) - - def test_difference_overlap(self): - self.set -= set((3, 4, 5)) - self.assertEqual(self.set, set([2, 6])) - - def test_difference_non_overlap(self): - self.set -= set([8]) - self.assertEqual(self.set, set([2, 4, 6])) - - def test_difference_method_call(self): - self.set.difference_update(set([3, 4, 5])) - self.assertEqual(self.set, set([2, 6])) - -#============================================================================== - -class TestMutate(unittest.TestCase): - def setUp(self): - self.values = ["a", "b", "c"] - self.set = set(self.values) - - def test_add_present(self): - self.set.add("c") - self.assertEqual(self.set, set("abc")) - - def test_add_absent(self): - self.set.add("d") - self.assertEqual(self.set, set("abcd")) - - def test_add_until_full(self): - tmp = set() - expected_len = 0 - for v in self.values: - tmp.add(v) - expected_len += 1 - self.assertEqual(len(tmp), expected_len) - self.assertEqual(tmp, self.set) - - def test_remove_present(self): - self.set.remove("b") - self.assertEqual(self.set, set("ac")) - - def test_remove_absent(self): - try: - self.set.remove("d") - self.fail("Removing missing element should have raised LookupError") - except LookupError: - pass - - def test_remove_until_empty(self): - expected_len = len(self.set) - for v in self.values: - self.set.remove(v) - expected_len -= 1 - self.assertEqual(len(self.set), expected_len) - - def test_discard_present(self): - self.set.discard("c") - self.assertEqual(self.set, set("ab")) - - def test_discard_absent(self): - self.set.discard("d") - self.assertEqual(self.set, set("abc")) - - def test_clear(self): - self.set.clear() - self.assertEqual(len(self.set), 0) - - def test_pop(self): - popped = {} - while self.set: - popped[self.set.pop()] = None - self.assertEqual(len(popped), len(self.values)) - for v in self.values: - self.failUnless(v in popped) - - def test_update_empty_tuple(self): - self.set.update(()) - self.assertEqual(self.set, set(self.values)) - - def test_update_unit_tuple_overlap(self): - self.set.update(("a",)) - self.assertEqual(self.set, set(self.values)) - - def test_update_unit_tuple_non_overlap(self): - self.set.update(("a", "z")) - self.assertEqual(self.set, set(self.values + ["z"])) - -#============================================================================== - -class TestSubsets(unittest.TestCase): - - case2method = {"<=": "issubset", - ">=": "issuperset", - } - - reverse = {"==": "==", - "!=": "!=", - "<": ">", - ">": "<", - "<=": ">=", - ">=": "<=", - } - - def test_issubset(self): - x = self.left - y = self.right - for case in "!=", "==", "<", "<=", ">", ">=": - expected = case in self.cases - # Test the binary infix spelling. - result = eval("x" + case + "y", locals()) - self.assertEqual(result, expected) - # Test the "friendly" method-name spelling, if one exists. - if case in TestSubsets.case2method: - method = getattr(x, TestSubsets.case2method[case]) - result = method(y) - self.assertEqual(result, expected) - - # Now do the same for the operands reversed. - rcase = TestSubsets.reverse[case] - result = eval("y" + rcase + "x", locals()) - self.assertEqual(result, expected) - if rcase in TestSubsets.case2method: - method = getattr(y, TestSubsets.case2method[rcase]) - result = method(x) - self.assertEqual(result, expected) -#------------------------------------------------------------------------------ - -class TestSubsetEqualEmpty(TestSubsets): - left = set() - right = set() - name = "both empty" - cases = "==", "<=", ">=" - -#------------------------------------------------------------------------------ - -class TestSubsetEqualNonEmpty(TestSubsets): - left = set([1, 2]) - right = set([1, 2]) - name = "equal pair" - cases = "==", "<=", ">=" - -#------------------------------------------------------------------------------ - -class TestSubsetEmptyNonEmpty(TestSubsets): - left = set() - right = set([1, 2]) - name = "one empty, one non-empty" - cases = "!=", "<", "<=" - -#------------------------------------------------------------------------------ - -class TestSubsetPartial(TestSubsets): - left = set([1]) - right = set([1, 2]) - name = "one a non-empty proper subset of other" - cases = "!=", "<", "<=" - -#------------------------------------------------------------------------------ - -class TestSubsetNonOverlap(TestSubsets): - left = set([1]) - right = set([2]) - name = "neither empty, neither contains" - cases = "!=" - -#============================================================================== - -class TestOnlySetsInBinaryOps(unittest.TestCase): - - def test_eq_ne(self): - # Unlike the others, this is testing that == and != *are* allowed. - self.assertEqual(self.other == self.set, False) - self.assertEqual(self.set == self.other, False) - self.assertEqual(self.other != self.set, True) - self.assertEqual(self.set != self.other, True) - - def test_ge_gt_le_lt(self): - self.assertRaises(TypeError, lambda: self.set < self.other) - self.assertRaises(TypeError, lambda: self.set <= self.other) - self.assertRaises(TypeError, lambda: self.set > self.other) - self.assertRaises(TypeError, lambda: self.set >= self.other) - - self.assertRaises(TypeError, lambda: self.other < self.set) - self.assertRaises(TypeError, lambda: self.other <= self.set) - self.assertRaises(TypeError, lambda: self.other > self.set) - self.assertRaises(TypeError, lambda: self.other >= self.set) - - def test_update_operator(self): - try: - self.set |= self.other - except TypeError: - pass - else: - self.fail("expected TypeError") - - def test_update(self): - if self.otherIsIterable: - self.set.update(self.other) - else: - self.assertRaises(TypeError, self.set.update, self.other) - - def test_union(self): - self.assertRaises(TypeError, lambda: self.set | self.other) - self.assertRaises(TypeError, lambda: self.other | self.set) - if self.otherIsIterable: - self.set.union(self.other) - else: - self.assertRaises(TypeError, self.set.union, self.other) - - def test_intersection_update_operator(self): - try: - self.set &= self.other - except TypeError: - pass - else: - self.fail("expected TypeError") - - def test_intersection_update(self): - if self.otherIsIterable: - self.set.intersection_update(self.other) - else: - self.assertRaises(TypeError, - self.set.intersection_update, - self.other) - - def test_intersection(self): - self.assertRaises(TypeError, lambda: self.set & self.other) - self.assertRaises(TypeError, lambda: self.other & self.set) - if self.otherIsIterable: - self.set.intersection(self.other) - else: - self.assertRaises(TypeError, self.set.intersection, self.other) - - def test_sym_difference_update_operator(self): - try: - self.set ^= self.other - except TypeError: - pass - else: - self.fail("expected TypeError") - - def test_sym_difference_update(self): - if self.otherIsIterable: - self.set.symmetric_difference_update(self.other) - else: - self.assertRaises(TypeError, - self.set.symmetric_difference_update, - self.other) - - def test_sym_difference(self): - self.assertRaises(TypeError, lambda: self.set ^ self.other) - self.assertRaises(TypeError, lambda: self.other ^ self.set) - if self.otherIsIterable: - self.set.symmetric_difference(self.other) - else: - self.assertRaises(TypeError, self.set.symmetric_difference, self.other) - - def test_difference_update_operator(self): - try: - self.set -= self.other - except TypeError: - pass - else: - self.fail("expected TypeError") - - def test_difference_update(self): - if self.otherIsIterable: - self.set.difference_update(self.other) - else: - self.assertRaises(TypeError, - self.set.difference_update, - self.other) - - def test_difference(self): - self.assertRaises(TypeError, lambda: self.set - self.other) - self.assertRaises(TypeError, lambda: self.other - self.set) - if self.otherIsIterable: - self.set.difference(self.other) - else: - self.assertRaises(TypeError, self.set.difference, self.other) - -#------------------------------------------------------------------------------ - -class TestOnlySetsNumeric(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = set((1, 2, 3)) - self.other = 19 - self.otherIsIterable = False - -#------------------------------------------------------------------------------ - -class TestOnlySetsDict(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = set((1, 2, 3)) - self.other = {1:2, 3:4} - self.otherIsIterable = True - -#------------------------------------------------------------------------------ - -class TestOnlySetsOperator(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = set((1, 2, 3)) - self.other = operator.add - self.otherIsIterable = False - -#------------------------------------------------------------------------------ - -class TestOnlySetsTuple(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = set((1, 2, 3)) - self.other = (2, 4, 6) - self.otherIsIterable = True - -#------------------------------------------------------------------------------ - -class TestOnlySetsString(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = set((1, 2, 3)) - self.other = 'abc' - self.otherIsIterable = True - -#------------------------------------------------------------------------------ - -class TestOnlySetsGenerator(TestOnlySetsInBinaryOps): - def setUp(self): - def gen(): - for i in xrange(0, 10, 2): - yield i - self.set = set((1, 2, 3)) - self.other = gen() - self.otherIsIterable = True - -#============================================================================== - -class TestCopying(unittest.TestCase): - - def test_copy(self): - dup = self.set.copy() - dup_list = list(dup); dup_list.sort() - set_list = list(self.set); set_list.sort() - self.assertEqual(len(dup_list), len(set_list)) - for i in range(len(dup_list)): - self.failUnless(dup_list[i] is set_list[i]) - - def test_deep_copy(self): - dup = copy.deepcopy(self.set) - ##print type(dup), repr(dup) - dup_list = list(dup); dup_list.sort() - set_list = list(self.set); set_list.sort() - self.assertEqual(len(dup_list), len(set_list)) - for i in range(len(dup_list)): - self.assertEqual(dup_list[i], set_list[i]) - -#------------------------------------------------------------------------------ - -class TestCopyingEmpty(TestCopying): - def setUp(self): - self.set = set() - -#------------------------------------------------------------------------------ - -class TestCopyingSingleton(TestCopying): - def setUp(self): - self.set = set(["hello"]) - -#------------------------------------------------------------------------------ - -class TestCopyingTriple(TestCopying): - def setUp(self): - self.set = set(["zero", 0, None]) - -#------------------------------------------------------------------------------ - -class TestCopyingTuple(TestCopying): - def setUp(self): - self.set = set([(1, 2)]) - -#------------------------------------------------------------------------------ - -class TestCopyingNested(TestCopying): - def setUp(self): - self.set = set([((1, 2), (3, 4))]) - -#============================================================================== - -class TestIdentities(unittest.TestCase): - def setUp(self): - self.a = set('abracadabra') - self.b = set('alacazam') - - def test_binopsVsSubsets(self): - a, b = self.a, self.b - self.assert_(a - b < a) - self.assert_(b - a < b) - self.assert_(a & b < a) - self.assert_(a & b < b) - self.assert_(a | b > a) - self.assert_(a | b > b) - self.assert_(a ^ b < a | b) - - def test_commutativity(self): - a, b = self.a, self.b - self.assertEqual(a&b, b&a) - self.assertEqual(a|b, b|a) - self.assertEqual(a^b, b^a) - if a != b: - self.assertNotEqual(a-b, b-a) - - def test_summations(self): - # check that sums of parts equal the whole - a, b = self.a, self.b - self.assertEqual((a-b)|(a&b)|(b-a), a|b) - self.assertEqual((a&b)|(a^b), a|b) - self.assertEqual(a|(b-a), a|b) - self.assertEqual((a-b)|b, a|b) - self.assertEqual((a-b)|(a&b), a) - self.assertEqual((b-a)|(a&b), b) - self.assertEqual((a-b)|(b-a), a^b) - - def test_exclusion(self): - # check that inverse operations show non-overlap - a, b, zero = self.a, self.b, set() - self.assertEqual((a-b)&b, zero) - self.assertEqual((b-a)&a, zero) - self.assertEqual((a&b)&(a^b), zero) - -# Tests derived from test_itertools.py ======================================= - -def R(seqn): - 'Regular generator' - for i in seqn: - yield i - -class G: - 'Sequence using __getitem__' - def __init__(self, seqn): - self.seqn = seqn - def __getitem__(self, i): - return self.seqn[i] - -class I: - 'Sequence using iterator protocol' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class Ig: - 'Sequence using iterator protocol defined with a generator' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - for val in self.seqn: - yield val - -class X: - 'Missing __getitem__ and __iter__' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class N: - 'Iterator missing next()' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - -class E: - 'Test propagation of exceptions' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - 3 // 0 - -class S: - 'Test immediate stop' - def __init__(self, seqn): - pass - def __iter__(self): - return self - def next(self): - raise StopIteration - -from itertools import chain, imap -def L(seqn): - 'Test multiple tiers of iterators' - return chain(imap(lambda x:x, R(Ig(G(seqn))))) - -class TestVariousIteratorArgs(unittest.TestCase): - - def test_constructor(self): - for cons in (set, frozenset): - for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(sorted(cons(g(s))), sorted(g(s))) - self.assertRaises(TypeError, cons , X(s)) - self.assertRaises(TypeError, cons , N(s)) - self.assertRaises(ZeroDivisionError, cons , E(s)) - - def test_inline_methods(self): - s = set('november') - for data in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5), 'december'): - for meth in (s.union, s.intersection, s.difference, s.symmetric_difference): - for g in (G, I, Ig, L, R): - expected = meth(data) - actual = meth(G(data)) - self.assertEqual(sorted(actual), sorted(expected)) - self.assertRaises(TypeError, meth, X(s)) - self.assertRaises(TypeError, meth, N(s)) - self.assertRaises(ZeroDivisionError, meth, E(s)) - - def test_inplace_methods(self): - for data in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5), 'december'): - for methname in ('update', 'intersection_update', - 'difference_update', 'symmetric_difference_update'): - for g in (G, I, Ig, S, L, R): - s = set('january') - t = s.copy() - getattr(s, methname)(list(g(data))) - getattr(t, methname)(g(data)) - self.assertEqual(sorted(s), sorted(t)) - - self.assertRaises(TypeError, getattr(set('january'), methname), X(data)) - self.assertRaises(TypeError, getattr(set('january'), methname), N(data)) - self.assertRaises(ZeroDivisionError, getattr(set('january'), methname), E(data)) - -#============================================================================== - -def test_main(verbose=None): - from test import test_sets - test_classes = ( - TestSet, - TestSetSubclass, - TestSetSubclassWithKeywordArgs, - TestFrozenSet, - TestFrozenSetSubclass, - TestSetOfSets, - TestExceptionPropagation, - TestBasicOpsEmpty, - TestBasicOpsSingleton, - TestBasicOpsTuple, - TestBasicOpsTriple, - TestBinaryOps, - TestUpdateOps, - TestMutate, - TestSubsetEqualEmpty, - TestSubsetEqualNonEmpty, - TestSubsetEmptyNonEmpty, - TestSubsetPartial, - TestSubsetNonOverlap, - TestOnlySetsNumeric, - TestOnlySetsDict, - TestOnlySetsOperator, - TestOnlySetsTuple, - TestOnlySetsString, - TestOnlySetsGenerator, - TestCopyingEmpty, - TestCopyingSingleton, - TestCopyingTriple, - TestCopyingTuple, - TestCopyingNested, - TestIdentities, - TestVariousIteratorArgs, - ) - - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_sets.py b/sys/lib/python/test/test_sets.py deleted file mode 100644 index 85e4a22e8..000000000 --- a/sys/lib/python/test/test_sets.py +++ /dev/null @@ -1,856 +0,0 @@ -#!/usr/bin/env python - -import unittest, operator, copy, pickle, random -from sets import Set, ImmutableSet -from test import test_support - -empty_set = Set() - -#============================================================================== - -class TestBasicOps(unittest.TestCase): - - def test_repr(self): - if self.repr is not None: - self.assertEqual(repr(self.set), self.repr) - - def test_length(self): - self.assertEqual(len(self.set), self.length) - - def test_self_equality(self): - self.assertEqual(self.set, self.set) - - def test_equivalent_equality(self): - self.assertEqual(self.set, self.dup) - - def test_copy(self): - self.assertEqual(self.set.copy(), self.dup) - - def test_self_union(self): - result = self.set | self.set - self.assertEqual(result, self.dup) - - def test_empty_union(self): - result = self.set | empty_set - self.assertEqual(result, self.dup) - - def test_union_empty(self): - result = empty_set | self.set - self.assertEqual(result, self.dup) - - def test_self_intersection(self): - result = self.set & self.set - self.assertEqual(result, self.dup) - - def test_empty_intersection(self): - result = self.set & empty_set - self.assertEqual(result, empty_set) - - def test_intersection_empty(self): - result = empty_set & self.set - self.assertEqual(result, empty_set) - - def test_self_symmetric_difference(self): - result = self.set ^ self.set - self.assertEqual(result, empty_set) - - def checkempty_symmetric_difference(self): - result = self.set ^ empty_set - self.assertEqual(result, self.set) - - def test_self_difference(self): - result = self.set - self.set - self.assertEqual(result, empty_set) - - def test_empty_difference(self): - result = self.set - empty_set - self.assertEqual(result, self.dup) - - def test_empty_difference_rev(self): - result = empty_set - self.set - self.assertEqual(result, empty_set) - - def test_iteration(self): - for v in self.set: - self.assert_(v in self.values) - - def test_pickling(self): - p = pickle.dumps(self.set) - copy = pickle.loads(p) - self.assertEqual(self.set, copy, - "%s != %s" % (self.set, copy)) - -#------------------------------------------------------------------------------ - -class TestBasicOpsEmpty(TestBasicOps): - def setUp(self): - self.case = "empty set" - self.values = [] - self.set = Set(self.values) - self.dup = Set(self.values) - self.length = 0 - self.repr = "Set([])" - -#------------------------------------------------------------------------------ - -class TestBasicOpsSingleton(TestBasicOps): - def setUp(self): - self.case = "unit set (number)" - self.values = [3] - self.set = Set(self.values) - self.dup = Set(self.values) - self.length = 1 - self.repr = "Set([3])" - - def test_in(self): - self.failUnless(3 in self.set) - - def test_not_in(self): - self.failUnless(2 not in self.set) - -#------------------------------------------------------------------------------ - -class TestBasicOpsTuple(TestBasicOps): - def setUp(self): - self.case = "unit set (tuple)" - self.values = [(0, "zero")] - self.set = Set(self.values) - self.dup = Set(self.values) - self.length = 1 - self.repr = "Set([(0, 'zero')])" - - def test_in(self): - self.failUnless((0, "zero") in self.set) - - def test_not_in(self): - self.failUnless(9 not in self.set) - -#------------------------------------------------------------------------------ - -class TestBasicOpsTriple(TestBasicOps): - def setUp(self): - self.case = "triple set" - self.values = [0, "zero", operator.add] - self.set = Set(self.values) - self.dup = Set(self.values) - self.length = 3 - self.repr = None - -#============================================================================== - -def baditer(): - raise TypeError - yield True - -def gooditer(): - yield True - -class TestExceptionPropagation(unittest.TestCase): - """SF 628246: Set constructor should not trap iterator TypeErrors""" - - def test_instanceWithException(self): - self.assertRaises(TypeError, Set, baditer()) - - def test_instancesWithoutException(self): - # All of these iterables should load without exception. - Set([1,2,3]) - Set((1,2,3)) - Set({'one':1, 'two':2, 'three':3}) - Set(xrange(3)) - Set('abc') - Set(gooditer()) - -#============================================================================== - -class TestSetOfSets(unittest.TestCase): - def test_constructor(self): - inner = Set([1]) - outer = Set([inner]) - element = outer.pop() - self.assertEqual(type(element), ImmutableSet) - outer.add(inner) # Rebuild set of sets with .add method - outer.remove(inner) - self.assertEqual(outer, Set()) # Verify that remove worked - outer.discard(inner) # Absence of KeyError indicates working fine - -#============================================================================== - -class TestBinaryOps(unittest.TestCase): - def setUp(self): - self.set = Set((2, 4, 6)) - - def test_eq(self): # SF bug 643115 - self.assertEqual(self.set, Set({2:1,4:3,6:5})) - - def test_union_subset(self): - result = self.set | Set([2]) - self.assertEqual(result, Set((2, 4, 6))) - - def test_union_superset(self): - result = self.set | Set([2, 4, 6, 8]) - self.assertEqual(result, Set([2, 4, 6, 8])) - - def test_union_overlap(self): - result = self.set | Set([3, 4, 5]) - self.assertEqual(result, Set([2, 3, 4, 5, 6])) - - def test_union_non_overlap(self): - result = self.set | Set([8]) - self.assertEqual(result, Set([2, 4, 6, 8])) - - def test_intersection_subset(self): - result = self.set & Set((2, 4)) - self.assertEqual(result, Set((2, 4))) - - def test_intersection_superset(self): - result = self.set & Set([2, 4, 6, 8]) - self.assertEqual(result, Set([2, 4, 6])) - - def test_intersection_overlap(self): - result = self.set & Set([3, 4, 5]) - self.assertEqual(result, Set([4])) - - def test_intersection_non_overlap(self): - result = self.set & Set([8]) - self.assertEqual(result, empty_set) - - def test_sym_difference_subset(self): - result = self.set ^ Set((2, 4)) - self.assertEqual(result, Set([6])) - - def test_sym_difference_superset(self): - result = self.set ^ Set((2, 4, 6, 8)) - self.assertEqual(result, Set([8])) - - def test_sym_difference_overlap(self): - result = self.set ^ Set((3, 4, 5)) - self.assertEqual(result, Set([2, 3, 5, 6])) - - def test_sym_difference_non_overlap(self): - result = self.set ^ Set([8]) - self.assertEqual(result, Set([2, 4, 6, 8])) - - def test_cmp(self): - a, b = Set('a'), Set('b') - self.assertRaises(TypeError, cmp, a, b) - - # You can view this as a buglet: cmp(a, a) does not raise TypeError, - # because __eq__ is tried before __cmp__, and a.__eq__(a) returns True, - # which Python thinks is good enough to synthesize a cmp() result - # without calling __cmp__. - self.assertEqual(cmp(a, a), 0) - - self.assertRaises(TypeError, cmp, a, 12) - self.assertRaises(TypeError, cmp, "abc", a) - - def test_inplace_on_self(self): - t = self.set.copy() - t |= t - self.assertEqual(t, self.set) - t &= t - self.assertEqual(t, self.set) - t -= t - self.assertEqual(len(t), 0) - t = self.set.copy() - t ^= t - self.assertEqual(len(t), 0) - - -#============================================================================== - -class TestUpdateOps(unittest.TestCase): - def setUp(self): - self.set = Set((2, 4, 6)) - - def test_union_subset(self): - self.set |= Set([2]) - self.assertEqual(self.set, Set((2, 4, 6))) - - def test_union_superset(self): - self.set |= Set([2, 4, 6, 8]) - self.assertEqual(self.set, Set([2, 4, 6, 8])) - - def test_union_overlap(self): - self.set |= Set([3, 4, 5]) - self.assertEqual(self.set, Set([2, 3, 4, 5, 6])) - - def test_union_non_overlap(self): - self.set |= Set([8]) - self.assertEqual(self.set, Set([2, 4, 6, 8])) - - def test_union_method_call(self): - self.set.union_update(Set([3, 4, 5])) - self.assertEqual(self.set, Set([2, 3, 4, 5, 6])) - - def test_intersection_subset(self): - self.set &= Set((2, 4)) - self.assertEqual(self.set, Set((2, 4))) - - def test_intersection_superset(self): - self.set &= Set([2, 4, 6, 8]) - self.assertEqual(self.set, Set([2, 4, 6])) - - def test_intersection_overlap(self): - self.set &= Set([3, 4, 5]) - self.assertEqual(self.set, Set([4])) - - def test_intersection_non_overlap(self): - self.set &= Set([8]) - self.assertEqual(self.set, empty_set) - - def test_intersection_method_call(self): - self.set.intersection_update(Set([3, 4, 5])) - self.assertEqual(self.set, Set([4])) - - def test_sym_difference_subset(self): - self.set ^= Set((2, 4)) - self.assertEqual(self.set, Set([6])) - - def test_sym_difference_superset(self): - self.set ^= Set((2, 4, 6, 8)) - self.assertEqual(self.set, Set([8])) - - def test_sym_difference_overlap(self): - self.set ^= Set((3, 4, 5)) - self.assertEqual(self.set, Set([2, 3, 5, 6])) - - def test_sym_difference_non_overlap(self): - self.set ^= Set([8]) - self.assertEqual(self.set, Set([2, 4, 6, 8])) - - def test_sym_difference_method_call(self): - self.set.symmetric_difference_update(Set([3, 4, 5])) - self.assertEqual(self.set, Set([2, 3, 5, 6])) - - def test_difference_subset(self): - self.set -= Set((2, 4)) - self.assertEqual(self.set, Set([6])) - - def test_difference_superset(self): - self.set -= Set((2, 4, 6, 8)) - self.assertEqual(self.set, Set([])) - - def test_difference_overlap(self): - self.set -= Set((3, 4, 5)) - self.assertEqual(self.set, Set([2, 6])) - - def test_difference_non_overlap(self): - self.set -= Set([8]) - self.assertEqual(self.set, Set([2, 4, 6])) - - def test_difference_method_call(self): - self.set.difference_update(Set([3, 4, 5])) - self.assertEqual(self.set, Set([2, 6])) - -#============================================================================== - -class TestMutate(unittest.TestCase): - def setUp(self): - self.values = ["a", "b", "c"] - self.set = Set(self.values) - - def test_add_present(self): - self.set.add("c") - self.assertEqual(self.set, Set("abc")) - - def test_add_absent(self): - self.set.add("d") - self.assertEqual(self.set, Set("abcd")) - - def test_add_until_full(self): - tmp = Set() - expected_len = 0 - for v in self.values: - tmp.add(v) - expected_len += 1 - self.assertEqual(len(tmp), expected_len) - self.assertEqual(tmp, self.set) - - def test_remove_present(self): - self.set.remove("b") - self.assertEqual(self.set, Set("ac")) - - def test_remove_absent(self): - try: - self.set.remove("d") - self.fail("Removing missing element should have raised LookupError") - except LookupError: - pass - - def test_remove_until_empty(self): - expected_len = len(self.set) - for v in self.values: - self.set.remove(v) - expected_len -= 1 - self.assertEqual(len(self.set), expected_len) - - def test_discard_present(self): - self.set.discard("c") - self.assertEqual(self.set, Set("ab")) - - def test_discard_absent(self): - self.set.discard("d") - self.assertEqual(self.set, Set("abc")) - - def test_clear(self): - self.set.clear() - self.assertEqual(len(self.set), 0) - - def test_pop(self): - popped = {} - while self.set: - popped[self.set.pop()] = None - self.assertEqual(len(popped), len(self.values)) - for v in self.values: - self.failUnless(v in popped) - - def test_update_empty_tuple(self): - self.set.union_update(()) - self.assertEqual(self.set, Set(self.values)) - - def test_update_unit_tuple_overlap(self): - self.set.union_update(("a",)) - self.assertEqual(self.set, Set(self.values)) - - def test_update_unit_tuple_non_overlap(self): - self.set.union_update(("a", "z")) - self.assertEqual(self.set, Set(self.values + ["z"])) - -#============================================================================== - -class TestSubsets(unittest.TestCase): - - case2method = {"<=": "issubset", - ">=": "issuperset", - } - - reverse = {"==": "==", - "!=": "!=", - "<": ">", - ">": "<", - "<=": ">=", - ">=": "<=", - } - - def test_issubset(self): - x = self.left - y = self.right - for case in "!=", "==", "<", "<=", ">", ">=": - expected = case in self.cases - # Test the binary infix spelling. - result = eval("x" + case + "y", locals()) - self.assertEqual(result, expected) - # Test the "friendly" method-name spelling, if one exists. - if case in TestSubsets.case2method: - method = getattr(x, TestSubsets.case2method[case]) - result = method(y) - self.assertEqual(result, expected) - - # Now do the same for the operands reversed. - rcase = TestSubsets.reverse[case] - result = eval("y" + rcase + "x", locals()) - self.assertEqual(result, expected) - if rcase in TestSubsets.case2method: - method = getattr(y, TestSubsets.case2method[rcase]) - result = method(x) - self.assertEqual(result, expected) -#------------------------------------------------------------------------------ - -class TestSubsetEqualEmpty(TestSubsets): - left = Set() - right = Set() - name = "both empty" - cases = "==", "<=", ">=" - -#------------------------------------------------------------------------------ - -class TestSubsetEqualNonEmpty(TestSubsets): - left = Set([1, 2]) - right = Set([1, 2]) - name = "equal pair" - cases = "==", "<=", ">=" - -#------------------------------------------------------------------------------ - -class TestSubsetEmptyNonEmpty(TestSubsets): - left = Set() - right = Set([1, 2]) - name = "one empty, one non-empty" - cases = "!=", "<", "<=" - -#------------------------------------------------------------------------------ - -class TestSubsetPartial(TestSubsets): - left = Set([1]) - right = Set([1, 2]) - name = "one a non-empty proper subset of other" - cases = "!=", "<", "<=" - -#------------------------------------------------------------------------------ - -class TestSubsetNonOverlap(TestSubsets): - left = Set([1]) - right = Set([2]) - name = "neither empty, neither contains" - cases = "!=" - -#============================================================================== - -class TestOnlySetsInBinaryOps(unittest.TestCase): - - def test_eq_ne(self): - # Unlike the others, this is testing that == and != *are* allowed. - self.assertEqual(self.other == self.set, False) - self.assertEqual(self.set == self.other, False) - self.assertEqual(self.other != self.set, True) - self.assertEqual(self.set != self.other, True) - - def test_ge_gt_le_lt(self): - self.assertRaises(TypeError, lambda: self.set < self.other) - self.assertRaises(TypeError, lambda: self.set <= self.other) - self.assertRaises(TypeError, lambda: self.set > self.other) - self.assertRaises(TypeError, lambda: self.set >= self.other) - - self.assertRaises(TypeError, lambda: self.other < self.set) - self.assertRaises(TypeError, lambda: self.other <= self.set) - self.assertRaises(TypeError, lambda: self.other > self.set) - self.assertRaises(TypeError, lambda: self.other >= self.set) - - def test_union_update_operator(self): - try: - self.set |= self.other - except TypeError: - pass - else: - self.fail("expected TypeError") - - def test_union_update(self): - if self.otherIsIterable: - self.set.union_update(self.other) - else: - self.assertRaises(TypeError, self.set.union_update, self.other) - - def test_union(self): - self.assertRaises(TypeError, lambda: self.set | self.other) - self.assertRaises(TypeError, lambda: self.other | self.set) - if self.otherIsIterable: - self.set.union(self.other) - else: - self.assertRaises(TypeError, self.set.union, self.other) - - def test_intersection_update_operator(self): - try: - self.set &= self.other - except TypeError: - pass - else: - self.fail("expected TypeError") - - def test_intersection_update(self): - if self.otherIsIterable: - self.set.intersection_update(self.other) - else: - self.assertRaises(TypeError, - self.set.intersection_update, - self.other) - - def test_intersection(self): - self.assertRaises(TypeError, lambda: self.set & self.other) - self.assertRaises(TypeError, lambda: self.other & self.set) - if self.otherIsIterable: - self.set.intersection(self.other) - else: - self.assertRaises(TypeError, self.set.intersection, self.other) - - def test_sym_difference_update_operator(self): - try: - self.set ^= self.other - except TypeError: - pass - else: - self.fail("expected TypeError") - - def test_sym_difference_update(self): - if self.otherIsIterable: - self.set.symmetric_difference_update(self.other) - else: - self.assertRaises(TypeError, - self.set.symmetric_difference_update, - self.other) - - def test_sym_difference(self): - self.assertRaises(TypeError, lambda: self.set ^ self.other) - self.assertRaises(TypeError, lambda: self.other ^ self.set) - if self.otherIsIterable: - self.set.symmetric_difference(self.other) - else: - self.assertRaises(TypeError, self.set.symmetric_difference, self.other) - - def test_difference_update_operator(self): - try: - self.set -= self.other - except TypeError: - pass - else: - self.fail("expected TypeError") - - def test_difference_update(self): - if self.otherIsIterable: - self.set.difference_update(self.other) - else: - self.assertRaises(TypeError, - self.set.difference_update, - self.other) - - def test_difference(self): - self.assertRaises(TypeError, lambda: self.set - self.other) - self.assertRaises(TypeError, lambda: self.other - self.set) - if self.otherIsIterable: - self.set.difference(self.other) - else: - self.assertRaises(TypeError, self.set.difference, self.other) - -#------------------------------------------------------------------------------ - -class TestOnlySetsNumeric(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = Set((1, 2, 3)) - self.other = 19 - self.otherIsIterable = False - -#------------------------------------------------------------------------------ - -class TestOnlySetsDict(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = Set((1, 2, 3)) - self.other = {1:2, 3:4} - self.otherIsIterable = True - -#------------------------------------------------------------------------------ - -class TestOnlySetsOperator(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = Set((1, 2, 3)) - self.other = operator.add - self.otherIsIterable = False - -#------------------------------------------------------------------------------ - -class TestOnlySetsTuple(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = Set((1, 2, 3)) - self.other = (2, 4, 6) - self.otherIsIterable = True - -#------------------------------------------------------------------------------ - -class TestOnlySetsString(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = Set((1, 2, 3)) - self.other = 'abc' - self.otherIsIterable = True - -#------------------------------------------------------------------------------ - -class TestOnlySetsGenerator(TestOnlySetsInBinaryOps): - def setUp(self): - def gen(): - for i in xrange(0, 10, 2): - yield i - self.set = Set((1, 2, 3)) - self.other = gen() - self.otherIsIterable = True - -#------------------------------------------------------------------------------ - -class TestOnlySetsofSets(TestOnlySetsInBinaryOps): - def setUp(self): - self.set = Set((1, 2, 3)) - self.other = [Set('ab'), ImmutableSet('cd')] - self.otherIsIterable = True - -#============================================================================== - -class TestCopying(unittest.TestCase): - - def test_copy(self): - dup = self.set.copy() - dup_list = list(dup); dup_list.sort() - set_list = list(self.set); set_list.sort() - self.assertEqual(len(dup_list), len(set_list)) - for i in range(len(dup_list)): - self.failUnless(dup_list[i] is set_list[i]) - - def test_deep_copy(self): - dup = copy.deepcopy(self.set) - ##print type(dup), repr(dup) - dup_list = list(dup); dup_list.sort() - set_list = list(self.set); set_list.sort() - self.assertEqual(len(dup_list), len(set_list)) - for i in range(len(dup_list)): - self.assertEqual(dup_list[i], set_list[i]) - -#------------------------------------------------------------------------------ - -class TestCopyingEmpty(TestCopying): - def setUp(self): - self.set = Set() - -#------------------------------------------------------------------------------ - -class TestCopyingSingleton(TestCopying): - def setUp(self): - self.set = Set(["hello"]) - -#------------------------------------------------------------------------------ - -class TestCopyingTriple(TestCopying): - def setUp(self): - self.set = Set(["zero", 0, None]) - -#------------------------------------------------------------------------------ - -class TestCopyingTuple(TestCopying): - def setUp(self): - self.set = Set([(1, 2)]) - -#------------------------------------------------------------------------------ - -class TestCopyingNested(TestCopying): - def setUp(self): - self.set = Set([((1, 2), (3, 4))]) - -#============================================================================== - -class TestIdentities(unittest.TestCase): - def setUp(self): - self.a = Set([random.randrange(100) for i in xrange(50)]) - self.b = Set([random.randrange(100) for i in xrange(50)]) - - def test_binopsVsSubsets(self): - a, b = self.a, self.b - self.assert_(a - b <= a) - self.assert_(b - a <= b) - self.assert_(a & b <= a) - self.assert_(a & b <= b) - self.assert_(a | b >= a) - self.assert_(a | b >= b) - self.assert_(a ^ b <= a | b) - - def test_commutativity(self): - a, b = self.a, self.b - self.assertEqual(a&b, b&a) - self.assertEqual(a|b, b|a) - self.assertEqual(a^b, b^a) - if a != b: - self.assertNotEqual(a-b, b-a) - - def test_reflexsive_relations(self): - a, zero = self.a, Set() - self.assertEqual(a ^ a, zero) - self.assertEqual(a - a, zero) - self.assertEqual(a | a, a) - self.assertEqual(a & a, a) - self.assert_(a <= a) - self.assert_(a >= a) - self.assert_(a == a) - - def test_summations(self): - # check that sums of parts equal the whole - a, b = self.a, self.b - self.assertEqual((a-b)|(a&b)|(b-a), a|b) - self.assertEqual((a&b)|(a^b), a|b) - self.assertEqual(a|(b-a), a|b) - self.assertEqual((a-b)|b, a|b) - self.assertEqual((a-b)|(a&b), a) - self.assertEqual((b-a)|(a&b), b) - self.assertEqual((a-b)|(b-a), a^b) - - def test_exclusion(self): - # check that inverse operations do not overlap - a, b, zero = self.a, self.b, Set() - self.assertEqual((a-b)&b, zero) - self.assertEqual((b-a)&a, zero) - self.assertEqual((a&b)&(a^b), zero) - - def test_cardinality_relations(self): - a, b = self.a, self.b - self.assertEqual(len(a), len(a-b) + len(a&b)) - self.assertEqual(len(b), len(b-a) + len(a&b)) - self.assertEqual(len(a^b), len(a-b) + len(b-a)) - self.assertEqual(len(a|b), len(a-b) + len(a&b) + len(b-a)) - self.assertEqual(len(a^b) + len(a&b), len(a|b)) - -#============================================================================== - -libreftest = """ -Example from the Library Reference: Doc/lib/libsets.tex - ->>> from sets import Set as Base # override _repr to get sorted output ->>> class Set(Base): -... def _repr(self): -... return Base._repr(self, sorted=True) ->>> engineers = Set(['John', 'Jane', 'Jack', 'Janice']) ->>> programmers = Set(['Jack', 'Sam', 'Susan', 'Janice']) ->>> managers = Set(['Jane', 'Jack', 'Susan', 'Zack']) ->>> employees = engineers | programmers | managers # union ->>> engineering_management = engineers & managers # intersection ->>> fulltime_management = managers - engineers - programmers # difference ->>> engineers.add('Marvin') ->>> print engineers -Set(['Jack', 'Jane', 'Janice', 'John', 'Marvin']) ->>> employees.issuperset(engineers) # superset test -False ->>> employees.union_update(engineers) # update from another set ->>> employees.issuperset(engineers) -True ->>> for group in [engineers, programmers, managers, employees]: -... group.discard('Susan') # unconditionally remove element -... print group -... -Set(['Jack', 'Jane', 'Janice', 'John', 'Marvin']) -Set(['Jack', 'Janice', 'Sam']) -Set(['Jack', 'Jane', 'Zack']) -Set(['Jack', 'Jane', 'Janice', 'John', 'Marvin', 'Sam', 'Zack']) -""" - -#============================================================================== - -__test__ = {'libreftest' : libreftest} - -def test_main(verbose=None): - import doctest - from test import test_sets - test_support.run_unittest( - TestSetOfSets, - TestExceptionPropagation, - TestBasicOpsEmpty, - TestBasicOpsSingleton, - TestBasicOpsTuple, - TestBasicOpsTriple, - TestBinaryOps, - TestUpdateOps, - TestMutate, - TestSubsetEqualEmpty, - TestSubsetEqualNonEmpty, - TestSubsetEmptyNonEmpty, - TestSubsetPartial, - TestSubsetNonOverlap, - TestOnlySetsNumeric, - TestOnlySetsDict, - TestOnlySetsOperator, - TestOnlySetsTuple, - TestOnlySetsString, - TestOnlySetsGenerator, - TestOnlySetsofSets, - TestCopyingEmpty, - TestCopyingSingleton, - TestCopyingTriple, - TestCopyingTuple, - TestCopyingNested, - TestIdentities, - doctest.DocTestSuite(test_sets), - ) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_sgmllib.py b/sys/lib/python/test/test_sgmllib.py deleted file mode 100644 index b6986360a..000000000 --- a/sys/lib/python/test/test_sgmllib.py +++ /dev/null @@ -1,439 +0,0 @@ -import htmlentitydefs -import pprint -import re -import sgmllib -import unittest -from test import test_support - - -class EventCollector(sgmllib.SGMLParser): - - def __init__(self): - self.events = [] - self.append = self.events.append - sgmllib.SGMLParser.__init__(self) - - def get_events(self): - # Normalize the list of events so that buffer artefacts don't - # separate runs of contiguous characters. - L = [] - prevtype = None - for event in self.events: - type = event[0] - if type == prevtype == "data": - L[-1] = ("data", L[-1][1] + event[1]) - else: - L.append(event) - prevtype = type - self.events = L - return L - - # structure markup - - def unknown_starttag(self, tag, attrs): - self.append(("starttag", tag, attrs)) - - def unknown_endtag(self, tag): - self.append(("endtag", tag)) - - # all other markup - - def handle_comment(self, data): - self.append(("comment", data)) - - def handle_charref(self, data): - self.append(("charref", data)) - - def handle_data(self, data): - self.append(("data", data)) - - def handle_decl(self, decl): - self.append(("decl", decl)) - - def handle_entityref(self, data): - self.append(("entityref", data)) - - def handle_pi(self, data): - self.append(("pi", data)) - - def unknown_decl(self, decl): - self.append(("unknown decl", decl)) - - -class CDATAEventCollector(EventCollector): - def start_cdata(self, attrs): - self.append(("starttag", "cdata", attrs)) - self.setliteral() - - -class HTMLEntityCollector(EventCollector): - - entity_or_charref = re.compile('(?:&([a-zA-Z][-.a-zA-Z0-9]*)' - '|&#(x[0-9a-zA-Z]+|[0-9]+))(;?)') - - def convert_charref(self, name): - self.append(("charref", "convert", name)) - if name[0] != "x": - return EventCollector.convert_charref(self, name) - - def convert_codepoint(self, codepoint): - self.append(("codepoint", "convert", codepoint)) - EventCollector.convert_codepoint(self, codepoint) - - def convert_entityref(self, name): - self.append(("entityref", "convert", name)) - return EventCollector.convert_entityref(self, name) - - # These to record that they were called, then pass the call along - # to the default implementation so that it's actions can be - # recorded. - - def handle_charref(self, data): - self.append(("charref", data)) - sgmllib.SGMLParser.handle_charref(self, data) - - def handle_entityref(self, data): - self.append(("entityref", data)) - sgmllib.SGMLParser.handle_entityref(self, data) - - -class SGMLParserTestCase(unittest.TestCase): - - collector = EventCollector - - def get_events(self, source): - parser = self.collector() - try: - for s in source: - parser.feed(s) - parser.close() - except: - #self.events = parser.events - raise - return parser.get_events() - - def check_events(self, source, expected_events): - try: - events = self.get_events(source) - except: - import sys - #print >>sys.stderr, pprint.pformat(self.events) - raise - if events != expected_events: - self.fail("received events did not match expected events\n" - "Expected:\n" + pprint.pformat(expected_events) + - "\nReceived:\n" + pprint.pformat(events)) - - def check_parse_error(self, source): - parser = EventCollector() - try: - parser.feed(source) - parser.close() - except sgmllib.SGMLParseError: - pass - else: - self.fail("expected SGMLParseError for %r\nReceived:\n%s" - % (source, pprint.pformat(parser.get_events()))) - - def test_doctype_decl_internal(self): - inside = """\ -DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN' - SYSTEM 'http://www.w3.org/TR/html401/strict.dtd' [ - - - - - - - %paramEntity; - -]""" - self.check_events(["" % inside], [ - ("decl", inside), - ]) - - def test_doctype_decl_external(self): - inside = "DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'" - self.check_events("" % inside, [ - ("decl", inside), - ]) - - def test_underscore_in_attrname(self): - # SF bug #436621 - """Make sure attribute names with underscores are accepted""" - self.check_events("", [ - ("starttag", "a", [("has_under", "has_under"), - ("_under", "_under")]), - ]) - - def test_underscore_in_tagname(self): - # SF bug #436621 - """Make sure tag names with underscores are accepted""" - self.check_events("", [ - ("starttag", "has_under", []), - ("endtag", "has_under"), - ]) - - def test_quotes_in_unquoted_attrs(self): - # SF bug #436621 - """Be sure quotes in unquoted attributes are made part of the value""" - self.check_events("", [ - ("starttag", "a", [("href", "foo'bar\"baz")]), - ]) - - def test_xhtml_empty_tag(self): - """Handling of XHTML-style empty start tags""" - self.check_events("
text", [ - ("starttag", "br", []), - ("data", "text"), - ("starttag", "i", []), - ("endtag", "i"), - ]) - - def test_processing_instruction_only(self): - self.check_events("", [ - ("pi", "processing instruction"), - ]) - - def test_bad_nesting(self): - self.check_events("
", [ - ("starttag", "a", []), - ("starttag", "b", []), - ("endtag", "a"), - ("endtag", "b"), - ]) - - def test_bare_ampersands(self): - self.check_events("this text & contains & ampersands &", [ - ("data", "this text & contains & ampersands &"), - ]) - - def test_bare_pointy_brackets(self): - self.check_events("this < text > contains < bare>pointy< brackets", [ - ("data", "this < text > contains < bare>pointy< brackets"), - ]) - - def test_attr_syntax(self): - output = [ - ("starttag", "a", [("b", "v"), ("c", "v"), ("d", "v"), ("e", "e")]) - ] - self.check_events("""""", output) - self.check_events("""""", output) - self.check_events("""""", output) - self.check_events("""""", output) - - def test_attr_values(self): - self.check_events("""""", - [("starttag", "a", [("b", "xxx\n\txxx"), - ("c", "yyy\t\nyyy"), - ("d", "\txyz\n")]) - ]) - self.check_events("""""", [ - ("starttag", "a", [("b", ""), ("c", "")]), - ]) - # URL construction stuff from RFC 1808: - safe = "$-_.+" - extra = "!*'()," - reserved = ";/?:@&=" - url = "http://example.com:8080/path/to/file?%s%s%s" % ( - safe, extra, reserved) - self.check_events("""""" % url, [ - ("starttag", "e", [("a", url)]), - ]) - # Regression test for SF patch #669683. - self.check_events("", [ - ("starttag", "e", [("a", "rgb(1,2,3)")]), - ]) - - def test_attr_values_entities(self): - """Substitution of entities and charrefs in attribute values""" - # SF bug #1452246 - self.check_events("""""", - [("starttag", "a", [("b", "<"), - ("c", "<>"), - ("d", "<->"), - ("e", "< "), - ("f", "&xxx;"), - ("g", " !"), - ("h", "Ǵ"), - ("i", "x?a=b&c=d;"), - ("j", "*"), - ("k", "*"), - ])]) - - def test_convert_overrides(self): - # This checks that the character and entity reference - # conversion helpers are called at the documented times. No - # attempt is made to really change what the parser accepts. - # - self.collector = HTMLEntityCollector - self.check_events(('foo' - '&foobar;*'), [ - ('entityref', 'convert', 'ldquo'), - ('charref', 'convert', 'x201d'), - ('starttag', 'a', [('title', '“test”')]), - ('data', 'foo'), - ('endtag', 'a'), - ('entityref', 'foobar'), - ('entityref', 'convert', 'foobar'), - ('charref', '42'), - ('charref', 'convert', '42'), - ('codepoint', 'convert', 42), - ]) - - def test_attr_funky_names(self): - self.check_events("""""", [ - ("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]), - ]) - - def test_attr_value_ip6_url(self): - # http://www.python.org/sf/853506 - self.check_events(("" - ""), [ - ("starttag", "a", [("href", "http://[1080::8:800:200C:417A]/")]), - ("starttag", "a", [("href", "http://[1080::8:800:200C:417A]/")]), - ]) - - def test_illegal_declarations(self): - s = 'abcdef' - self.check_events(s, [ - ("data", "abc"), - ("unknown decl", 'spacer type="block" height="25"'), - ("data", "def"), - ]) - - def test_weird_starttags(self): - self.check_events("", [ - ("starttag", "a", []), - ("starttag", "a", []), - ]) - self.check_events("", [ - ("endtag", "a"), - ("starttag", "a", []), - ]) - - def test_declaration_junk_chars(self): - self.check_parse_error("") - - def test_get_starttag_text(self): - s = """""" - self.check_events(s, [ - ("starttag", "foobar", [("one", "1"), ("two", "2")]), - ]) - - def test_cdata_content(self): - s = (" ¬-an-entity-ref; " - " ") - self.collector = CDATAEventCollector - self.check_events(s, [ - ("starttag", "cdata", []), - ("data", " ¬-an-entity-ref; "), - ("endtag", "cdata"), - ("starttag", "notcdata", []), - ("data", " "), - ("comment", " comment "), - ("data", " "), - ("endtag", "notcdata"), - ]) - s = """ """ - self.check_events(s, [ - ("starttag", "cdata", []), - ("data", " "), - ("endtag", "cdata"), - ]) - - def test_illegal_declarations(self): - s = 'abcdef' - self.check_events(s, [ - ("data", "abc"), - ("unknown decl", 'spacer type="block" height="25"'), - ("data", "def"), - ]) - - def test_enumerated_attr_type(self): - s = "]>" - self.check_events(s, [ - ('decl', 'DOCTYPE doc []'), - ]) - - def test_read_chunks(self): - # SF bug #1541697, this caused sgml parser to hang - # Just verify this code doesn't cause a hang. - CHUNK = 1024 # increasing this to 8212 makes the problem go away - - f = open(test_support.findfile('sgml_input.html')) - fp = sgmllib.SGMLParser() - while 1: - data = f.read(CHUNK) - fp.feed(data) - if len(data) != CHUNK: - break - - # XXX These tests have been disabled by prefixing their names with - # an underscore. The first two exercise outstanding bugs in the - # sgmllib module, and the third exhibits questionable behavior - # that needs to be carefully considered before changing it. - - def _test_starttag_end_boundary(self): - self.check_events("", [("starttag", "a", [("b", "<")])]) - self.check_events("", [("starttag", "a", [("b", ">")])]) - - def _test_buffer_artefacts(self): - output = [("starttag", "a", [("b", "<")])] - self.check_events([""], output) - self.check_events([""], output) - self.check_events([""], output) - self.check_events([""], output) - self.check_events([""], output) - self.check_events([""], output) - - output = [("starttag", "a", [("b", ">")])] - self.check_events([""], output) - self.check_events([""], output) - self.check_events([""], output) - self.check_events(["'>"], output) - self.check_events([""], output) - self.check_events([""], output) - - output = [("comment", "abc")] - self.check_events(["", ""], output) - self.check_events(["<", "!--abc-->"], output) - self.check_events([""], output) - self.check_events([""], output) - self.check_events([""], output) - self.check_events([""], output) - self.check_events([""], output) - self.check_events([""], output) - self.check_events(["", ""], output) - - def _test_starttag_junk_chars(self): - self.check_parse_error("<") - self.check_parse_error("<>") - self.check_parse_error("") - self.check_parse_error("") - self.check_parse_error("") - self.check_parse_error("'") - self.check_parse_error("> sys.__stdout__, ' child should not have to kill parent' - for signame in "SIGHUP", "SIGUSR1", "SIGUSR2", "SIGALRM": - os.kill(pid, getattr(signal, signame)) - print >> sys.__stdout__, " child sent", signame, "to", pid - time.sleep(1) - finally: - os._exit(0) - -# Install handlers. -hup = signal.signal(signal.SIGHUP, handlerA) -usr1 = signal.signal(signal.SIGUSR1, handlerB) -usr2 = signal.signal(signal.SIGUSR2, signal.SIG_IGN) -alrm = signal.signal(signal.SIGALRM, signal.default_int_handler) - -try: - - signal.alarm(MAX_DURATION) - vereq(signal.getsignal(signal.SIGHUP), handlerA) - vereq(signal.getsignal(signal.SIGUSR1), handlerB) - vereq(signal.getsignal(signal.SIGUSR2), signal.SIG_IGN) - vereq(signal.getsignal(signal.SIGALRM), signal.default_int_handler) - - # Try to ensure this test exits even if there is some problem with alarm. - # Tru64/Alpha often hangs and is ultimately killed by the buildbot. - fork_pid = force_test_exit() - - try: - signal.getsignal(4242) - raise TestFailed('expected ValueError for invalid signal # to ' - 'getsignal()') - except ValueError: - pass - - try: - signal.signal(4242, handlerB) - raise TestFailed('expected ValueError for invalid signal # to ' - 'signal()') - except ValueError: - pass - - try: - signal.signal(signal.SIGUSR1, None) - raise TestFailed('expected TypeError for non-callable') - except TypeError: - pass - - # Launch an external script to send us signals. - # We expect the external script to: - # send HUP, which invokes handlerA to set a_called - # send USR1, which invokes handlerB to set b_called and raise - # HandlerBCalled - # send USR2, which is ignored - # - # Then we expect the alarm to go off, and its handler raises - # KeyboardInterrupt, finally getting us out of the loop. - os.system(script) - try: - print "starting pause() loop..." - while 1: - try: - if verbose: - print "call pause()..." - signal.pause() - if verbose: - print "pause() returned" - except HandlerBCalled: - if verbose: - print "HandlerBCalled exception caught" - - except KeyboardInterrupt: - if verbose: - print "KeyboardInterrupt (the alarm() went off)" - - if not a_called: - print 'HandlerA not called' - - if not b_called: - print 'HandlerB not called' - -finally: - # Forcibly kill the child we created to ping us if there was a test error. - try: - # Make sure we don't kill ourself if there was a fork error. - if fork_pid > 0: - os.kill(fork_pid, signal.SIGKILL) - except: - # If the child killed us, it has probably exited. Killing a - # non-existent process will raise an error which we don't care about. - pass - - # Restore handlers. - signal.alarm(0) # cancel alarm in case we died early - signal.signal(signal.SIGHUP, hup) - signal.signal(signal.SIGUSR1, usr1) - signal.signal(signal.SIGUSR2, usr2) - signal.signal(signal.SIGALRM, alrm) diff --git a/sys/lib/python/test/test_site.py b/sys/lib/python/test/test_site.py deleted file mode 100644 index 3a8b9d314..000000000 --- a/sys/lib/python/test/test_site.py +++ /dev/null @@ -1,236 +0,0 @@ -"""Tests for 'site'. - -Tests assume the initial paths in sys.path once the interpreter has begun -executing have not been removed. - -""" -import unittest -from test.test_support import TestSkipped, TestFailed, run_unittest, TESTFN -import __builtin__ -import os -import sys -import encodings -import tempfile -# Need to make sure to not import 'site' if someone specified ``-S`` at the -# command-line. Detect this by just making sure 'site' has not been imported -# already. -if "site" in sys.modules: - import site -else: - raise TestSkipped("importation of site.py suppressed") - -class HelperFunctionsTests(unittest.TestCase): - """Tests for helper functions. - - The setting of the encoding (set using sys.setdefaultencoding) used by - the Unicode implementation is not tested. - - """ - - def setUp(self): - """Save a copy of sys.path""" - self.sys_path = sys.path[:] - - def tearDown(self): - """Restore sys.path""" - sys.path = self.sys_path - - def test_makepath(self): - # Test makepath() have an absolute path for its first return value - # and a case-normalized version of the absolute path for its - # second value. - path_parts = ("Beginning", "End") - original_dir = os.path.join(*path_parts) - abs_dir, norm_dir = site.makepath(*path_parts) - self.failUnlessEqual(os.path.abspath(original_dir), abs_dir) - if original_dir == os.path.normcase(original_dir): - self.failUnlessEqual(abs_dir, norm_dir) - else: - self.failUnlessEqual(os.path.normcase(abs_dir), norm_dir) - - def test_init_pathinfo(self): - dir_set = site._init_pathinfo() - for entry in [site.makepath(path)[1] for path in sys.path - if path and os.path.isdir(path)]: - self.failUnless(entry in dir_set, - "%s from sys.path not found in set returned " - "by _init_pathinfo(): %s" % (entry, dir_set)) - - def pth_file_tests(self, pth_file): - """Contain common code for testing results of reading a .pth file""" - self.failUnless(pth_file.imported in sys.modules, - "%s not in sys.path" % pth_file.imported) - self.failUnless(site.makepath(pth_file.good_dir_path)[0] in sys.path) - self.failUnless(not os.path.exists(pth_file.bad_dir_path)) - - def test_addpackage(self): - # Make sure addpackage() imports if the line starts with 'import', - # adds directories to sys.path for any line in the file that is not a - # comment or import that is a valid directory name for where the .pth - # file resides; invalid directories are not added - pth_file = PthFile() - pth_file.cleanup(prep=True) # to make sure that nothing is - # pre-existing that shouldn't be - try: - pth_file.create() - site.addpackage(pth_file.base_dir, pth_file.filename, set()) - self.pth_file_tests(pth_file) - finally: - pth_file.cleanup() - - def test_addsitedir(self): - # Same tests for test_addpackage since addsitedir() essentially just - # calls addpackage() for every .pth file in the directory - pth_file = PthFile() - pth_file.cleanup(prep=True) # Make sure that nothing is pre-existing - # that is tested for - try: - pth_file.create() - site.addsitedir(pth_file.base_dir, set()) - self.pth_file_tests(pth_file) - finally: - pth_file.cleanup() - -class PthFile(object): - """Helper class for handling testing of .pth files""" - - def __init__(self, filename_base=TESTFN, imported="time", - good_dirname="__testdir__", bad_dirname="__bad"): - """Initialize instance variables""" - self.filename = filename_base + ".pth" - self.base_dir = os.path.abspath('') - self.file_path = os.path.join(self.base_dir, self.filename) - self.imported = imported - self.good_dirname = good_dirname - self.bad_dirname = bad_dirname - self.good_dir_path = os.path.join(self.base_dir, self.good_dirname) - self.bad_dir_path = os.path.join(self.base_dir, self.bad_dirname) - - def create(self): - """Create a .pth file with a comment, blank lines, an ``import - ``, a line with self.good_dirname, and a line with - self.bad_dirname. - - Creation of the directory for self.good_dir_path (based off of - self.good_dirname) is also performed. - - Make sure to call self.cleanup() to undo anything done by this method. - - """ - FILE = open(self.file_path, 'w') - try: - print>>FILE, "#import @bad module name" - print>>FILE, "\n" - print>>FILE, "import %s" % self.imported - print>>FILE, self.good_dirname - print>>FILE, self.bad_dirname - finally: - FILE.close() - os.mkdir(self.good_dir_path) - - def cleanup(self, prep=False): - """Make sure that the .pth file is deleted, self.imported is not in - sys.modules, and that both self.good_dirname and self.bad_dirname are - not existing directories.""" - if os.path.exists(self.file_path): - os.remove(self.file_path) - if prep: - self.imported_module = sys.modules.get(self.imported) - if self.imported_module: - del sys.modules[self.imported] - else: - if self.imported_module: - sys.modules[self.imported] = self.imported_module - if os.path.exists(self.good_dir_path): - os.rmdir(self.good_dir_path) - if os.path.exists(self.bad_dir_path): - os.rmdir(self.bad_dir_path) - -class ImportSideEffectTests(unittest.TestCase): - """Test side-effects from importing 'site'.""" - - def setUp(self): - """Make a copy of sys.path""" - self.sys_path = sys.path[:] - - def tearDown(self): - """Restore sys.path""" - sys.path = self.sys_path - - def test_abs__file__(self): - # Make sure all imported modules have their __file__ attribute - # as an absolute path. - # Handled by abs__file__() - site.abs__file__() - for module in (sys, os, __builtin__): - try: - self.failUnless(os.path.isabs(module.__file__), `module`) - except AttributeError: - continue - # We could try everything in sys.modules; however, when regrtest.py - # runs something like test_frozen before test_site, then we will - # be testing things loaded *after* test_site did path normalization - - def test_no_duplicate_paths(self): - # No duplicate paths should exist in sys.path - # Handled by removeduppaths() - site.removeduppaths() - seen_paths = set() - for path in sys.path: - self.failUnless(path not in seen_paths) - seen_paths.add(path) - - def test_add_build_dir(self): - # Test that the build directory's Modules directory is used when it - # should be. - # XXX: implement - pass - - def test_setting_quit(self): - # 'quit' and 'exit' should be injected into __builtin__ - self.failUnless(hasattr(__builtin__, "quit")) - self.failUnless(hasattr(__builtin__, "exit")) - - def test_setting_copyright(self): - # 'copyright' and 'credits' should be in __builtin__ - self.failUnless(hasattr(__builtin__, "copyright")) - self.failUnless(hasattr(__builtin__, "credits")) - - def test_setting_help(self): - # 'help' should be set in __builtin__ - self.failUnless(hasattr(__builtin__, "help")) - - def test_aliasing_mbcs(self): - if sys.platform == "win32": - import locale - if locale.getdefaultlocale()[1].startswith('cp'): - for value in encodings.aliases.aliases.itervalues(): - if value == "mbcs": - break - else: - self.fail("did not alias mbcs") - - def test_setdefaultencoding_removed(self): - # Make sure sys.setdefaultencoding is gone - self.failUnless(not hasattr(sys, "setdefaultencoding")) - - def test_sitecustomize_executed(self): - # If sitecustomize is available, it should have been imported. - if not sys.modules.has_key("sitecustomize"): - try: - import sitecustomize - except ImportError: - pass - else: - self.fail("sitecustomize not imported automatically") - - - - -def test_main(): - run_unittest(HelperFunctionsTests, ImportSideEffectTests) - - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_slice.py b/sys/lib/python/test/test_slice.py deleted file mode 100644 index c34d9ea4a..000000000 --- a/sys/lib/python/test/test_slice.py +++ /dev/null @@ -1,110 +0,0 @@ -# tests for slice objects; in particular the indices method. - -import unittest -from test import test_support - -import sys - -class SliceTest(unittest.TestCase): - - def test_constructor(self): - self.assertRaises(TypeError, slice) - self.assertRaises(TypeError, slice, 1, 2, 3, 4) - - def test_repr(self): - self.assertEqual(repr(slice(1, 2, 3)), "slice(1, 2, 3)") - - def test_hash(self): - # Verify clearing of SF bug #800796 - self.assertRaises(TypeError, hash, slice(5)) - self.assertRaises(TypeError, slice(5).__hash__) - - def test_cmp(self): - s1 = slice(1, 2, 3) - s2 = slice(1, 2, 3) - s3 = slice(1, 2, 4) - self.assertEqual(s1, s2) - self.assertNotEqual(s1, s3) - - class Exc(Exception): - pass - - class BadCmp(object): - def __eq__(self, other): - raise Exc - - s1 = slice(BadCmp()) - s2 = slice(BadCmp()) - self.assertRaises(Exc, cmp, s1, s2) - self.assertEqual(s1, s1) - - s1 = slice(1, BadCmp()) - s2 = slice(1, BadCmp()) - self.assertEqual(s1, s1) - self.assertRaises(Exc, cmp, s1, s2) - - s1 = slice(1, 2, BadCmp()) - s2 = slice(1, 2, BadCmp()) - self.assertEqual(s1, s1) - self.assertRaises(Exc, cmp, s1, s2) - - def test_members(self): - s = slice(1) - self.assertEqual(s.start, None) - self.assertEqual(s.stop, 1) - self.assertEqual(s.step, None) - - s = slice(1, 2) - self.assertEqual(s.start, 1) - self.assertEqual(s.stop, 2) - self.assertEqual(s.step, None) - - s = slice(1, 2, 3) - self.assertEqual(s.start, 1) - self.assertEqual(s.stop, 2) - self.assertEqual(s.step, 3) - - class AnyClass: - pass - - obj = AnyClass() - s = slice(obj) - self.assert_(s.stop is obj) - - def test_indices(self): - self.assertEqual(slice(None ).indices(10), (0, 10, 1)) - self.assertEqual(slice(None, None, 2).indices(10), (0, 10, 2)) - self.assertEqual(slice(1, None, 2).indices(10), (1, 10, 2)) - self.assertEqual(slice(None, None, -1).indices(10), (9, -1, -1)) - self.assertEqual(slice(None, None, -2).indices(10), (9, -1, -2)) - self.assertEqual(slice(3, None, -2).indices(10), (3, -1, -2)) - self.assertEqual( - slice(-100, 100 ).indices(10), - slice(None).indices(10) - ) - self.assertEqual( - slice(100, -100, -1).indices(10), - slice(None, None, -1).indices(10) - ) - self.assertEqual(slice(-100L, 100L, 2L).indices(10), (0, 10, 2)) - - self.assertEqual(range(10)[::sys.maxint - 1], [0]) - - self.assertRaises(OverflowError, slice(None).indices, 1L<<100) - - def test_setslice_without_getslice(self): - tmp = [] - class X(object): - def __setslice__(self, i, j, k): - tmp.append((i, j, k)) - - x = X() - x[1:2] = 42 - self.assertEquals(tmp, [(1, 2, 42)]) - - -def test_main(): - test_support.run_unittest(SliceTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_socket.py b/sys/lib/python/test/test_socket.py deleted file mode 100644 index b5215214d..000000000 --- a/sys/lib/python/test/test_socket.py +++ /dev/null @@ -1,995 +0,0 @@ -#!/usr/bin/env python - -import unittest -from test import test_support - -import socket -import select -import time -import thread, threading -import Queue -import sys -import array -from weakref import proxy -import signal - -PORT = 50007 -HOST = 'localhost' -MSG = 'Michael Gilfix was here\n' - -class SocketTCPTest(unittest.TestCase): - - def setUp(self): - self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - global PORT - PORT = test_support.bind_port(self.serv, HOST, PORT) - self.serv.listen(1) - - def tearDown(self): - self.serv.close() - self.serv = None - -class SocketUDPTest(unittest.TestCase): - - def setUp(self): - self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - global PORT - PORT = test_support.bind_port(self.serv, HOST, PORT) - - def tearDown(self): - self.serv.close() - self.serv = None - -class ThreadableTest: - """Threadable Test class - - The ThreadableTest class makes it easy to create a threaded - client/server pair from an existing unit test. To create a - new threaded class from an existing unit test, use multiple - inheritance: - - class NewClass (OldClass, ThreadableTest): - pass - - This class defines two new fixture functions with obvious - purposes for overriding: - - clientSetUp () - clientTearDown () - - Any new test functions within the class must then define - tests in pairs, where the test name is preceeded with a - '_' to indicate the client portion of the test. Ex: - - def testFoo(self): - # Server portion - - def _testFoo(self): - # Client portion - - Any exceptions raised by the clients during their tests - are caught and transferred to the main thread to alert - the testing framework. - - Note, the server setup function cannot call any blocking - functions that rely on the client thread during setup, - unless serverExplicityReady() is called just before - the blocking call (such as in setting up a client/server - connection and performing the accept() in setUp(). - """ - - def __init__(self): - # Swap the true setup function - self.__setUp = self.setUp - self.__tearDown = self.tearDown - self.setUp = self._setUp - self.tearDown = self._tearDown - - def serverExplicitReady(self): - """This method allows the server to explicitly indicate that - it wants the client thread to proceed. This is useful if the - server is about to execute a blocking routine that is - dependent upon the client thread during its setup routine.""" - self.server_ready.set() - - def _setUp(self): - self.server_ready = threading.Event() - self.client_ready = threading.Event() - self.done = threading.Event() - self.queue = Queue.Queue(1) - - # Do some munging to start the client test. - methodname = self.id() - i = methodname.rfind('.') - methodname = methodname[i+1:] - test_method = getattr(self, '_' + methodname) - self.client_thread = thread.start_new_thread( - self.clientRun, (test_method,)) - - self.__setUp() - if not self.server_ready.isSet(): - self.server_ready.set() - self.client_ready.wait() - - def _tearDown(self): - self.__tearDown() - self.done.wait() - - if not self.queue.empty(): - msg = self.queue.get() - self.fail(msg) - - def clientRun(self, test_func): - self.server_ready.wait() - self.client_ready.set() - self.clientSetUp() - if not callable(test_func): - raise TypeError, "test_func must be a callable function" - try: - test_func() - except Exception, strerror: - self.queue.put(strerror) - self.clientTearDown() - - def clientSetUp(self): - raise NotImplementedError, "clientSetUp must be implemented." - - def clientTearDown(self): - self.done.set() - thread.exit() - -class ThreadedTCPSocketTest(SocketTCPTest, ThreadableTest): - - def __init__(self, methodName='runTest'): - SocketTCPTest.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) - - def clientSetUp(self): - self.cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - - def clientTearDown(self): - self.cli.close() - self.cli = None - ThreadableTest.clientTearDown(self) - -class ThreadedUDPSocketTest(SocketUDPTest, ThreadableTest): - - def __init__(self, methodName='runTest'): - SocketUDPTest.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) - - def clientSetUp(self): - self.cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - -class SocketConnectedTest(ThreadedTCPSocketTest): - - def __init__(self, methodName='runTest'): - ThreadedTCPSocketTest.__init__(self, methodName=methodName) - - def setUp(self): - ThreadedTCPSocketTest.setUp(self) - # Indicate explicitly we're ready for the client thread to - # proceed and then perform the blocking call to accept - self.serverExplicitReady() - conn, addr = self.serv.accept() - self.cli_conn = conn - - def tearDown(self): - self.cli_conn.close() - self.cli_conn = None - ThreadedTCPSocketTest.tearDown(self) - - def clientSetUp(self): - ThreadedTCPSocketTest.clientSetUp(self) - self.cli.connect((HOST, PORT)) - self.serv_conn = self.cli - - def clientTearDown(self): - self.serv_conn.close() - self.serv_conn = None - ThreadedTCPSocketTest.clientTearDown(self) - -class SocketPairTest(unittest.TestCase, ThreadableTest): - - def __init__(self, methodName='runTest'): - unittest.TestCase.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) - - def setUp(self): - self.serv, self.cli = socket.socketpair() - - def tearDown(self): - self.serv.close() - self.serv = None - - def clientSetUp(self): - pass - - def clientTearDown(self): - self.cli.close() - self.cli = None - ThreadableTest.clientTearDown(self) - - -####################################################################### -## Begin Tests - -class GeneralModuleTests(unittest.TestCase): - - def test_weakref(self): - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - p = proxy(s) - self.assertEqual(p.fileno(), s.fileno()) - s.close() - s = None - try: - p.fileno() - except ReferenceError: - pass - else: - self.fail('Socket proxy still exists') - - def testSocketError(self): - # Testing socket module exceptions - def raise_error(*args, **kwargs): - raise socket.error - def raise_herror(*args, **kwargs): - raise socket.herror - def raise_gaierror(*args, **kwargs): - raise socket.gaierror - self.failUnlessRaises(socket.error, raise_error, - "Error raising socket exception.") - self.failUnlessRaises(socket.error, raise_herror, - "Error raising socket exception.") - self.failUnlessRaises(socket.error, raise_gaierror, - "Error raising socket exception.") - - def testCrucialConstants(self): - # Testing for mission critical constants - socket.AF_INET - socket.SOCK_STREAM - socket.SOCK_DGRAM - socket.SOCK_RAW - socket.SOCK_RDM - socket.SOCK_SEQPACKET - socket.SOL_SOCKET - socket.SO_REUSEADDR - - def testHostnameRes(self): - # Testing hostname resolution mechanisms - hostname = socket.gethostname() - try: - ip = socket.gethostbyname(hostname) - except socket.error: - # Probably name lookup wasn't set up right; skip this test - return - self.assert_(ip.find('.') >= 0, "Error resolving host to ip.") - try: - hname, aliases, ipaddrs = socket.gethostbyaddr(ip) - except socket.error: - # Probably a similar problem as above; skip this test - return - all_host_names = [hostname, hname] + aliases - fqhn = socket.getfqdn(ip) - if not fqhn in all_host_names: - self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names))) - - def testRefCountGetNameInfo(self): - # Testing reference count for getnameinfo - import sys - if hasattr(sys, "getrefcount"): - try: - # On some versions, this loses a reference - orig = sys.getrefcount(__name__) - socket.getnameinfo(__name__,0) - except SystemError: - if sys.getrefcount(__name__) <> orig: - self.fail("socket.getnameinfo loses a reference") - - def testInterpreterCrash(self): - # Making sure getnameinfo doesn't crash the interpreter - try: - # On some versions, this crashes the interpreter. - socket.getnameinfo(('x', 0, 0, 0), 0) - except socket.error: - pass - - def testNtoH(self): - # This just checks that htons etc. are their own inverse, - # when looking at the lower 16 or 32 bits. - sizes = {socket.htonl: 32, socket.ntohl: 32, - socket.htons: 16, socket.ntohs: 16} - for func, size in sizes.items(): - mask = (1L<> sys.stderr, """\ - WARNING: an attempt to connect to %r %s, in - test_timeout. That may be legitimate, but is not the outcome we hoped - for. If this message is seen often, test_timeout should be changed to - use a more reliable address.""" % (ADDR, extra_msg) - - if test_support.verbose: - print "test_timeout ..." - - # A service which issues a welcome banner (without need to write - # anything). - # XXX ("gmail.org", 995) has been unreliable so far, from time to time - # XXX non-responsive for hours on end (& across all buildbot slaves, - # XXX so that's not just a local thing). - ADDR = "gmail.org", 995 - - s = socket.socket() - s.settimeout(30.0) - try: - s.connect(ADDR) - except socket.timeout: - error_msg('timed out') - return - except socket.error, exc: # In case connection is refused. - if exc.args[0] == errno.ECONNREFUSED: - error_msg('was refused') - return - else: - raise - - ss = socket.ssl(s) - # Read part of return welcome banner twice. - ss.read(1) - ss.read(1) - s.close() - -def test_rude_shutdown(): - if test_support.verbose: - print "test_rude_shutdown ..." - - try: - import threading - except ImportError: - return - - # Some random port to connect to. - PORT = [9934] - - listener_ready = threading.Event() - listener_gone = threading.Event() - - # `listener` runs in a thread. It opens a socket listening on PORT, and - # sits in an accept() until the main thread connects. Then it rudely - # closes the socket, and sets Event `listener_gone` to let the main thread - # know the socket is gone. - def listener(): - s = socket.socket() - PORT[0] = test_support.bind_port(s, '', PORT[0]) - s.listen(5) - listener_ready.set() - s.accept() - s = None # reclaim the socket object, which also closes it - listener_gone.set() - - def connector(): - listener_ready.wait() - s = socket.socket() - s.connect(('localhost', PORT[0])) - listener_gone.wait() - try: - ssl_sock = socket.ssl(s) - except socket.sslerror: - pass - else: - raise test_support.TestFailed( - 'connecting to closed SSL socket should have failed') - - t = threading.Thread(target=listener) - t.start() - connector() - t.join() - -def test_main(): - if not hasattr(socket, "ssl"): - raise test_support.TestSkipped("socket module has no ssl support") - test_rude_shutdown() - test_basic() - test_timeout() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_socketserver.py b/sys/lib/python/test/test_socketserver.py deleted file mode 100644 index 9a67a358b..000000000 --- a/sys/lib/python/test/test_socketserver.py +++ /dev/null @@ -1,218 +0,0 @@ -# Test suite for SocketServer.py - -from test import test_support -from test.test_support import (verbose, verify, TESTFN, TestSkipped, - reap_children) -test_support.requires('network') - -from SocketServer import * -import socket -import errno -import select -import time -import threading -import os - -NREQ = 3 -DELAY = 0.5 - -class MyMixinHandler: - def handle(self): - time.sleep(DELAY) - line = self.rfile.readline() - time.sleep(DELAY) - self.wfile.write(line) - -class MyStreamHandler(MyMixinHandler, StreamRequestHandler): - pass - -class MyDatagramHandler(MyMixinHandler, DatagramRequestHandler): - pass - -class MyMixinServer: - def serve_a_few(self): - for i in range(NREQ): - self.handle_request() - def handle_error(self, request, client_address): - self.close_request(request) - self.server_close() - raise - -teststring = "hello world\n" - -def receive(sock, n, timeout=20): - r, w, x = select.select([sock], [], [], timeout) - if sock in r: - return sock.recv(n) - else: - raise RuntimeError, "timed out on %r" % (sock,) - -def testdgram(proto, addr): - s = socket.socket(proto, socket.SOCK_DGRAM) - s.sendto(teststring, addr) - buf = data = receive(s, 100) - while data and '\n' not in buf: - data = receive(s, 100) - buf += data - verify(buf == teststring) - s.close() - -def teststream(proto, addr): - s = socket.socket(proto, socket.SOCK_STREAM) - s.connect(addr) - s.sendall(teststring) - buf = data = receive(s, 100) - while data and '\n' not in buf: - data = receive(s, 100) - buf += data - verify(buf == teststring) - s.close() - -class ServerThread(threading.Thread): - def __init__(self, addr, svrcls, hdlrcls): - threading.Thread.__init__(self) - self.__addr = addr - self.__svrcls = svrcls - self.__hdlrcls = hdlrcls - def run(self): - class svrcls(MyMixinServer, self.__svrcls): - pass - if verbose: print "thread: creating server" - svr = svrcls(self.__addr, self.__hdlrcls) - # pull the address out of the server in case it changed - # this can happen if another process is using the port - addr = svr.server_address - if addr: - self.__addr = addr - if self.__addr != svr.socket.getsockname(): - raise RuntimeError('server_address was %s, expected %s' % - (self.__addr, svr.socket.getsockname())) - if verbose: print "thread: serving three times" - svr.serve_a_few() - if verbose: print "thread: done" - -seed = 0 -def pickport(): - global seed - seed += 1 - return 10000 + (os.getpid() % 1000)*10 + seed - -host = "localhost" -testfiles = [] -def pickaddr(proto): - if proto == socket.AF_INET: - return (host, pickport()) - else: - fn = TESTFN + str(pickport()) - if os.name == 'os2': - # AF_UNIX socket names on OS/2 require a specific prefix - # which can't include a drive letter and must also use - # backslashes as directory separators - if fn[1] == ':': - fn = fn[2:] - if fn[0] in (os.sep, os.altsep): - fn = fn[1:] - fn = os.path.join('\socket', fn) - if os.sep == '/': - fn = fn.replace(os.sep, os.altsep) - else: - fn = fn.replace(os.altsep, os.sep) - testfiles.append(fn) - return fn - -def cleanup(): - for fn in testfiles: - try: - os.remove(fn) - except os.error: - pass - testfiles[:] = [] - -def testloop(proto, servers, hdlrcls, testfunc): - for svrcls in servers: - addr = pickaddr(proto) - if verbose: - print "ADDR =", addr - print "CLASS =", svrcls - t = ServerThread(addr, svrcls, hdlrcls) - if verbose: print "server created" - t.start() - if verbose: print "server running" - for i in range(NREQ): - time.sleep(DELAY) - if verbose: print "test client", i - testfunc(proto, addr) - if verbose: print "waiting for server" - t.join() - if verbose: print "done" - -class ForgivingTCPServer(TCPServer): - # prevent errors if another process is using the port we want - def server_bind(self): - host, default_port = self.server_address - # this code shamelessly stolen from test.test_support - # the ports were changed to protect the innocent - import sys - for port in [default_port, 3434, 8798, 23833]: - try: - self.server_address = host, port - TCPServer.server_bind(self) - break - except socket.error, (err, msg): - if err != errno.EADDRINUSE: - raise - print >>sys.__stderr__, \ - ' WARNING: failed to listen on port %d, trying another' % port - -tcpservers = [ForgivingTCPServer, ThreadingTCPServer] -if hasattr(os, 'fork') and os.name not in ('os2',): - tcpservers.append(ForkingTCPServer) -udpservers = [UDPServer, ThreadingUDPServer] -if hasattr(os, 'fork') and os.name not in ('os2',): - udpservers.append(ForkingUDPServer) - -if not hasattr(socket, 'AF_UNIX'): - streamservers = [] - dgramservers = [] -else: - class ForkingUnixStreamServer(ForkingMixIn, UnixStreamServer): pass - streamservers = [UnixStreamServer, ThreadingUnixStreamServer] - if hasattr(os, 'fork') and os.name not in ('os2',): - streamservers.append(ForkingUnixStreamServer) - class ForkingUnixDatagramServer(ForkingMixIn, UnixDatagramServer): pass - dgramservers = [UnixDatagramServer, ThreadingUnixDatagramServer] - if hasattr(os, 'fork') and os.name not in ('os2',): - dgramservers.append(ForkingUnixDatagramServer) - -def sloppy_cleanup(): - # See http://python.org/sf/1540386 - # We need to reap children here otherwise a child from one server - # can be left running for the next server and cause a test failure. - time.sleep(DELAY) - reap_children() - -def testall(): - testloop(socket.AF_INET, tcpservers, MyStreamHandler, teststream) - sloppy_cleanup() - testloop(socket.AF_INET, udpservers, MyDatagramHandler, testdgram) - if hasattr(socket, 'AF_UNIX'): - sloppy_cleanup() - testloop(socket.AF_UNIX, streamservers, MyStreamHandler, teststream) - # Alas, on Linux (at least) recvfrom() doesn't return a meaningful - # client address so this cannot work: - ##testloop(socket.AF_UNIX, dgramservers, MyDatagramHandler, testdgram) - -def test_main(): - import imp - if imp.lock_held(): - # If the import lock is held, the threads will hang. - raise TestSkipped("can't run when import lock is held") - - try: - testall() - finally: - cleanup() - reap_children() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_softspace.py b/sys/lib/python/test/test_softspace.py deleted file mode 100644 index 5405ba3fe..000000000 --- a/sys/lib/python/test/test_softspace.py +++ /dev/null @@ -1,14 +0,0 @@ -from test import test_support -import StringIO - -# SF bug 480215: softspace confused in nested print -f = StringIO.StringIO() -class C: - def __str__(self): - print >> f, 'a' - return 'b' - -print >> f, C(), 'c ', 'd\t', 'e' -print >> f, 'f', 'g' -# In 2.2 & earlier, this printed ' a\nbc d\te\nf g\n' -test_support.vereq(f.getvalue(), 'a\nb c d\te\nf g\n') diff --git a/sys/lib/python/test/test_sort.py b/sys/lib/python/test/test_sort.py deleted file mode 100644 index 84c92cc97..000000000 --- a/sys/lib/python/test/test_sort.py +++ /dev/null @@ -1,289 +0,0 @@ -from test import test_support -import random -import sys -import unittest - -verbose = test_support.verbose -nerrors = 0 - -def check(tag, expected, raw, compare=None): - global nerrors - - if verbose: - print " checking", tag - - orig = raw[:] # save input in case of error - if compare: - raw.sort(compare) - else: - raw.sort() - - if len(expected) != len(raw): - print "error in", tag - print "length mismatch;", len(expected), len(raw) - print expected - print orig - print raw - nerrors += 1 - return - - for i, good in enumerate(expected): - maybe = raw[i] - if good is not maybe: - print "error in", tag - print "out of order at index", i, good, maybe - print expected - print orig - print raw - nerrors += 1 - return - -class TestBase(unittest.TestCase): - def testStressfully(self): - # Try a variety of sizes at and around powers of 2, and at powers of 10. - sizes = [0] - for power in range(1, 10): - n = 2 ** power - sizes.extend(range(n-1, n+2)) - sizes.extend([10, 100, 1000]) - - class Complains(object): - maybe_complain = True - - def __init__(self, i): - self.i = i - - def __lt__(self, other): - if Complains.maybe_complain and random.random() < 0.001: - if verbose: - print " complaining at", self, other - raise RuntimeError - return self.i < other.i - - def __repr__(self): - return "Complains(%d)" % self.i - - class Stable(object): - def __init__(self, key, i): - self.key = key - self.index = i - - def __cmp__(self, other): - return cmp(self.key, other.key) - - def __repr__(self): - return "Stable(%d, %d)" % (self.key, self.index) - - for n in sizes: - x = range(n) - if verbose: - print "Testing size", n - - s = x[:] - check("identity", x, s) - - s = x[:] - s.reverse() - check("reversed", x, s) - - s = x[:] - random.shuffle(s) - check("random permutation", x, s) - - y = x[:] - y.reverse() - s = x[:] - check("reversed via function", y, s, lambda a, b: cmp(b, a)) - - if verbose: - print " Checking against an insane comparison function." - print " If the implementation isn't careful, this may segfault." - s = x[:] - s.sort(lambda a, b: int(random.random() * 3) - 1) - check("an insane function left some permutation", x, s) - - x = [Complains(i) for i in x] - s = x[:] - random.shuffle(s) - Complains.maybe_complain = True - it_complained = False - try: - s.sort() - except RuntimeError: - it_complained = True - if it_complained: - Complains.maybe_complain = False - check("exception during sort left some permutation", x, s) - - s = [Stable(random.randrange(10), i) for i in xrange(n)] - augmented = [(e, e.index) for e in s] - augmented.sort() # forced stable because ties broken by index - x = [e for e, i in augmented] # a stable sort of s - check("stability", x, s) - -#============================================================================== - -class TestBugs(unittest.TestCase): - - def test_bug453523(self): - # bug 453523 -- list.sort() crasher. - # If this fails, the most likely outcome is a core dump. - # Mutations during a list sort should raise a ValueError. - - class C: - def __lt__(self, other): - if L and random.random() < 0.75: - L.pop() - else: - L.append(3) - return random.random() < 0.5 - - L = [C() for i in range(50)] - self.assertRaises(ValueError, L.sort) - - def test_cmpNone(self): - # Testing None as a comparison function. - - L = range(50) - random.shuffle(L) - L.sort(None) - self.assertEqual(L, range(50)) - - def test_undetected_mutation(self): - # Python 2.4a1 did not always detect mutation - memorywaster = [] - for i in range(20): - def mutating_cmp(x, y): - L.append(3) - L.pop() - return cmp(x, y) - L = [1,2] - self.assertRaises(ValueError, L.sort, mutating_cmp) - def mutating_cmp(x, y): - L.append(3) - del L[:] - return cmp(x, y) - self.assertRaises(ValueError, L.sort, mutating_cmp) - memorywaster = [memorywaster] - -#============================================================================== - -class TestDecorateSortUndecorate(unittest.TestCase): - - def test_decorated(self): - data = 'The quick Brown fox Jumped over The lazy Dog'.split() - copy = data[:] - random.shuffle(data) - data.sort(key=str.lower) - copy.sort(cmp=lambda x,y: cmp(x.lower(), y.lower())) - - def test_baddecorator(self): - data = 'The quick Brown fox Jumped over The lazy Dog'.split() - self.assertRaises(TypeError, data.sort, None, lambda x,y: 0) - - def test_stability(self): - data = [(random.randrange(100), i) for i in xrange(200)] - copy = data[:] - data.sort(key=lambda (x,y): x) # sort on the random first field - copy.sort() # sort using both fields - self.assertEqual(data, copy) # should get the same result - - def test_cmp_and_key_combination(self): - # Verify that the wrapper has been removed - def compare(x, y): - self.assertEqual(type(x), str) - self.assertEqual(type(x), str) - return cmp(x, y) - data = 'The quick Brown fox Jumped over The lazy Dog'.split() - data.sort(cmp=compare, key=str.lower) - - def test_badcmp_with_key(self): - # Verify that the wrapper has been removed - data = 'The quick Brown fox Jumped over The lazy Dog'.split() - self.assertRaises(TypeError, data.sort, "bad", str.lower) - - def test_key_with_exception(self): - # Verify that the wrapper has been removed - data = range(-2,2) - dup = data[:] - self.assertRaises(ZeroDivisionError, data.sort, None, lambda x: 1/x) - self.assertEqual(data, dup) - - def test_key_with_mutation(self): - data = range(10) - def k(x): - del data[:] - data[:] = range(20) - return x - self.assertRaises(ValueError, data.sort, key=k) - - def test_key_with_mutating_del(self): - data = range(10) - class SortKiller(object): - def __init__(self, x): - pass - def __del__(self): - del data[:] - data[:] = range(20) - self.assertRaises(ValueError, data.sort, key=SortKiller) - - def test_key_with_mutating_del_and_exception(self): - data = range(10) - ## dup = data[:] - class SortKiller(object): - def __init__(self, x): - if x > 2: - raise RuntimeError - def __del__(self): - del data[:] - data[:] = range(20) - self.assertRaises(RuntimeError, data.sort, key=SortKiller) - ## major honking subtlety: we *can't* do: - ## - ## self.assertEqual(data, dup) - ## - ## because there is a reference to a SortKiller in the - ## traceback and by the time it dies we're outside the call to - ## .sort() and so the list protection gimmicks are out of - ## date (this cost some brain cells to figure out...). - - def test_reverse(self): - data = range(100) - random.shuffle(data) - data.sort(reverse=True) - self.assertEqual(data, range(99,-1,-1)) - self.assertRaises(TypeError, data.sort, "wrong type") - - def test_reverse_stability(self): - data = [(random.randrange(100), i) for i in xrange(200)] - copy1 = data[:] - copy2 = data[:] - data.sort(cmp=lambda x,y: cmp(x[0],y[0]), reverse=True) - copy1.sort(cmp=lambda x,y: cmp(y[0],x[0])) - self.assertEqual(data, copy1) - copy2.sort(key=lambda x: x[0], reverse=True) - self.assertEqual(data, copy2) - -#============================================================================== - -def test_main(verbose=None): - test_classes = ( - TestBase, - TestDecorateSortUndecorate, - TestBugs, - ) - - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_sqlite.py b/sys/lib/python/test/test_sqlite.py deleted file mode 100644 index f033772df..000000000 --- a/sys/lib/python/test/test_sqlite.py +++ /dev/null @@ -1,17 +0,0 @@ -from test.test_support import run_unittest, TestSkipped -import unittest - -try: - import _sqlite3 -except ImportError: - raise TestSkipped('no sqlite available') -from sqlite3.test import (dbapi, types, userfunctions, - factory, transactions, hooks, regression) - -def test_main(): - run_unittest(dbapi.suite(), types.suite(), userfunctions.suite(), - factory.suite(), transactions.suite(), hooks.suite(), - regression.suite()) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_startfile.py b/sys/lib/python/test/test_startfile.py deleted file mode 100644 index c4d12d708..000000000 --- a/sys/lib/python/test/test_startfile.py +++ /dev/null @@ -1,37 +0,0 @@ -# Ridiculously simple test of the os.startfile function for Windows. -# -# empty.vbs is an empty file (except for a comment), which does -# nothing when run with cscript or wscript. -# -# A possible improvement would be to have empty.vbs do something that -# we can detect here, to make sure that not only the os.startfile() -# call succeeded, but also the the script actually has run. - -import unittest -from test import test_support - -# use this form so that the test is skipped when startfile is not available: -from os import startfile, path - -class TestCase(unittest.TestCase): - def test_nonexisting(self): - self.assertRaises(OSError, startfile, "nonexisting.vbs") - - def test_nonexisting_u(self): - self.assertRaises(OSError, startfile, u"nonexisting.vbs") - - def test_empty(self): - empty = path.join(path.dirname(__file__), "empty.vbs") - startfile(empty) - startfile(empty, "open") - - def test_empty_u(self): - empty = path.join(path.dirname(__file__), "empty.vbs") - startfile(unicode(empty, "mbcs")) - startfile(unicode(empty, "mbcs"), "open") - -def test_main(): - test_support.run_unittest(TestCase) - -if __name__=="__main__": - test_main() diff --git a/sys/lib/python/test/test_str.py b/sys/lib/python/test/test_str.py deleted file mode 100644 index 45942a66e..000000000 --- a/sys/lib/python/test/test_str.py +++ /dev/null @@ -1,89 +0,0 @@ -import unittest -from test import test_support, string_tests - - -class StrTest( - string_tests.CommonTest, - string_tests.MixinStrUnicodeUserStringTest, - string_tests.MixinStrUserStringTest, - string_tests.MixinStrUnicodeTest, - ): - - type2test = str - - # We don't need to propagate to str - def fixtype(self, obj): - return obj - - def test_formatting(self): - string_tests.MixinStrUnicodeUserStringTest.test_formatting(self) - self.assertRaises(OverflowError, '%c'.__mod__, 0x1234) - - def test_conversion(self): - # Make sure __str__() behaves properly - class Foo0: - def __unicode__(self): - return u"foo" - - class Foo1: - def __str__(self): - return "foo" - - class Foo2(object): - def __str__(self): - return "foo" - - class Foo3(object): - def __str__(self): - return u"foo" - - class Foo4(unicode): - def __str__(self): - return u"foo" - - class Foo5(str): - def __str__(self): - return u"foo" - - class Foo6(str): - def __str__(self): - return "foos" - - def __unicode__(self): - return u"foou" - - class Foo7(unicode): - def __str__(self): - return "foos" - def __unicode__(self): - return u"foou" - - class Foo8(str): - def __new__(cls, content=""): - return str.__new__(cls, 2*content) - def __str__(self): - return self - - class Foo9(str): - def __str__(self): - return "string" - def __unicode__(self): - return "not unicode" - - self.assert_(str(Foo0()).startswith("<")) # this is different from __unicode__ - self.assertEqual(str(Foo1()), "foo") - self.assertEqual(str(Foo2()), "foo") - self.assertEqual(str(Foo3()), "foo") - self.assertEqual(str(Foo4("bar")), "foo") - self.assertEqual(str(Foo5("bar")), "foo") - self.assertEqual(str(Foo6("bar")), "foos") - self.assertEqual(str(Foo7("bar")), "foos") - self.assertEqual(str(Foo8("foo")), "foofoo") - self.assertEqual(str(Foo9("foo")), "string") - self.assertEqual(unicode(Foo9("foo")), u"not unicode") - -def test_main(): - test_support.run_unittest(StrTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_strftime.py b/sys/lib/python/test/test_strftime.py deleted file mode 100755 index e9d3826f4..000000000 --- a/sys/lib/python/test/test_strftime.py +++ /dev/null @@ -1,158 +0,0 @@ -#! /usr/bin/env python - -# Sanity checker for time.strftime - -import time, calendar, sys, os, re -from test.test_support import verbose - -def main(): - global verbose - # For C Python, these tests expect C locale, so we try to set that - # explicitly. For Jython, Finn says we need to be in the US locale; my - # understanding is that this is the closest Java gets to C's "C" locale. - # Jython ought to supply an _locale module which Does The Right Thing, but - # this is the best we can do given today's state of affairs. - try: - import java - java.util.Locale.setDefault(java.util.Locale.US) - except ImportError: - # Can't do this first because it will succeed, even in Jython - import locale - locale.setlocale(locale.LC_TIME, 'C') - now = time.time() - strftest(now) - verbose = 0 - # Try a bunch of dates and times, chosen to vary through time of - # day and daylight saving time - for j in range(-5, 5): - for i in range(25): - strftest(now + (i + j*100)*23*3603) - -def escapestr(text, ampm): - """Escape text to deal with possible locale values that have regex - syntax while allowing regex syntax used for the comparison.""" - new_text = re.escape(text) - new_text = new_text.replace(re.escape(ampm), ampm) - new_text = new_text.replace("\%", "%") - new_text = new_text.replace("\:", ":") - new_text = new_text.replace("\?", "?") - return new_text - -def strftest(now): - if verbose: - print "strftime test for", time.ctime(now) - nowsecs = str(long(now))[:-1] - gmt = time.gmtime(now) - now = time.localtime(now) - - if now[3] < 12: ampm='(AM|am)' - else: ampm='(PM|pm)' - - jan1 = time.localtime(time.mktime((now[0], 1, 1, 0, 0, 0, 0, 1, 0))) - - try: - if now[8]: tz = time.tzname[1] - else: tz = time.tzname[0] - except AttributeError: - tz = '' - - if now[3] > 12: clock12 = now[3] - 12 - elif now[3] > 0: clock12 = now[3] - else: clock12 = 12 - - # Make sure any characters that could be taken as regex syntax is - # escaped in escapestr() - expectations = ( - ('%a', calendar.day_abbr[now[6]], 'abbreviated weekday name'), - ('%A', calendar.day_name[now[6]], 'full weekday name'), - ('%b', calendar.month_abbr[now[1]], 'abbreviated month name'), - ('%B', calendar.month_name[now[1]], 'full month name'), - # %c see below - ('%d', '%02d' % now[2], 'day of month as number (00-31)'), - ('%H', '%02d' % now[3], 'hour (00-23)'), - ('%I', '%02d' % clock12, 'hour (01-12)'), - ('%j', '%03d' % now[7], 'julian day (001-366)'), - ('%m', '%02d' % now[1], 'month as number (01-12)'), - ('%M', '%02d' % now[4], 'minute, (00-59)'), - ('%p', ampm, 'AM or PM as appropriate'), - ('%S', '%02d' % now[5], 'seconds of current time (00-60)'), - ('%U', '%02d' % ((now[7] + jan1[6])//7), - 'week number of the year (Sun 1st)'), - ('%w', '0?%d' % ((1+now[6]) % 7), 'weekday as a number (Sun 1st)'), - ('%W', '%02d' % ((now[7] + (jan1[6] - 1)%7)//7), - 'week number of the year (Mon 1st)'), - # %x see below - ('%X', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'), - ('%y', '%02d' % (now[0]%100), 'year without century'), - ('%Y', '%d' % now[0], 'year with century'), - # %Z see below - ('%%', '%', 'single percent sign'), - ) - - nonstandard_expectations = ( - # These are standard but don't have predictable output - ('%c', fixasctime(time.asctime(now)), 'near-asctime() format'), - ('%x', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), - '%m/%d/%y %H:%M:%S'), - ('%Z', '%s' % tz, 'time zone name'), - - # These are some platform specific extensions - ('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'), - ('%e', '%2d' % now[2], 'day of month as number, blank padded ( 0-31)'), - ('%h', calendar.month_abbr[now[1]], 'abbreviated month name'), - ('%k', '%2d' % now[3], 'hour, blank padded ( 0-23)'), - ('%n', '\n', 'newline character'), - ('%r', '%02d:%02d:%02d %s' % (clock12, now[4], now[5], ampm), - '%I:%M:%S %p'), - ('%R', '%02d:%02d' % (now[3], now[4]), '%H:%M'), - ('%s', nowsecs, 'seconds since the Epoch in UCT'), - ('%t', '\t', 'tab character'), - ('%T', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'), - ('%3y', '%03d' % (now[0]%100), - 'year without century rendered using fieldwidth'), - ) - - if verbose: - print "Strftime test, platform: %s, Python version: %s" % \ - (sys.platform, sys.version.split()[0]) - - for e in expectations: - try: - result = time.strftime(e[0], now) - except ValueError, error: - print "Standard '%s' format gave error:" % e[0], error - continue - if re.match(escapestr(e[1], ampm), result): continue - if not result or result[0] == '%': - print "Does not support standard '%s' format (%s)" % (e[0], e[2]) - else: - print "Conflict for %s (%s):" % (e[0], e[2]) - print " Expected %s, but got %s" % (e[1], result) - - for e in nonstandard_expectations: - try: - result = time.strftime(e[0], now) - except ValueError, result: - if verbose: - print "Error for nonstandard '%s' format (%s): %s" % \ - (e[0], e[2], str(result)) - continue - if re.match(escapestr(e[1], ampm), result): - if verbose: - print "Supports nonstandard '%s' format (%s)" % (e[0], e[2]) - elif not result or result[0] == '%': - if verbose: - print "Does not appear to support '%s' format (%s)" % (e[0], - e[2]) - else: - if verbose: - print "Conflict for nonstandard '%s' format (%s):" % (e[0], - e[2]) - print " Expected %s, but got %s" % (e[1], result) - -def fixasctime(s): - if s[8] == ' ': - s = s[:8] + '0' + s[9:] - return s - -main() diff --git a/sys/lib/python/test/test_string.py b/sys/lib/python/test/test_string.py deleted file mode 100644 index fdd431d24..000000000 --- a/sys/lib/python/test/test_string.py +++ /dev/null @@ -1,113 +0,0 @@ -import unittest, string -from test import test_support, string_tests -from UserList import UserList - -class StringTest( - string_tests.CommonTest, - string_tests.MixinStrStringUserStringTest - ): - - type2test = str - - def checkequal(self, result, object, methodname, *args): - realresult = getattr(string, methodname)(object, *args) - self.assertEqual( - result, - realresult - ) - - def checkraises(self, exc, object, methodname, *args): - self.assertRaises( - exc, - getattr(string, methodname), - object, - *args - ) - - def checkcall(self, object, methodname, *args): - getattr(string, methodname)(object, *args) - - def test_join(self): - # These are the same checks as in string_test.ObjectTest.test_join - # but the argument order ist different - self.checkequal('a b c d', ['a', 'b', 'c', 'd'], 'join', ' ') - self.checkequal('abcd', ('a', 'b', 'c', 'd'), 'join', '') - self.checkequal('w x y z', string_tests.Sequence(), 'join', ' ') - self.checkequal('abc', ('abc',), 'join', 'a') - self.checkequal('z', UserList(['z']), 'join', 'a') - if test_support.have_unicode: - self.checkequal(unicode('a.b.c'), ['a', 'b', 'c'], 'join', unicode('.')) - self.checkequal(unicode('a.b.c'), [unicode('a'), 'b', 'c'], 'join', '.') - self.checkequal(unicode('a.b.c'), ['a', unicode('b'), 'c'], 'join', '.') - self.checkequal(unicode('a.b.c'), ['a', 'b', unicode('c')], 'join', '.') - self.checkraises(TypeError, ['a', unicode('b'), 3], 'join', '.') - for i in [5, 25, 125]: - self.checkequal( - ((('a' * i) + '-') * i)[:-1], - ['a' * i] * i, 'join', '-') - self.checkequal( - ((('a' * i) + '-') * i)[:-1], - ('a' * i,) * i, 'join', '-') - - self.checkraises(TypeError, string_tests.BadSeq1(), 'join', ' ') - self.checkequal('a b c', string_tests.BadSeq2(), 'join', ' ') - try: - def f(): - yield 4 + "" - self.fixtype(' ').join(f()) - except TypeError, e: - if '+' not in str(e): - self.fail('join() ate exception message') - else: - self.fail('exception not raised') - - - - -class ModuleTest(unittest.TestCase): - - def test_attrs(self): - string.whitespace - string.lowercase - string.uppercase - string.letters - string.digits - string.hexdigits - string.octdigits - string.punctuation - string.printable - - def test_atoi(self): - self.assertEqual(string.atoi(" 1 "), 1) - self.assertRaises(ValueError, string.atoi, " 1x") - self.assertRaises(ValueError, string.atoi, " x1 ") - - def test_atol(self): - self.assertEqual(string.atol(" 1 "), 1L) - self.assertRaises(ValueError, string.atol, " 1x ") - self.assertRaises(ValueError, string.atol, " x1 ") - - def test_atof(self): - self.assertAlmostEqual(string.atof(" 1 "), 1.0) - self.assertRaises(ValueError, string.atof, " 1x ") - self.assertRaises(ValueError, string.atof, " x1 ") - - def test_maketrans(self): - transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377' - - self.assertEqual(string.maketrans('abc', 'xyz'), transtable) - self.assertRaises(ValueError, string.maketrans, 'abc', 'xyzq') - - def test_capwords(self): - self.assertEqual(string.capwords('abc def ghi'), 'Abc Def Ghi') - self.assertEqual(string.capwords('abc\tdef\nghi'), 'Abc Def Ghi') - self.assertEqual(string.capwords('abc\t def \nghi'), 'Abc Def Ghi') - self.assertEqual(string.capwords('ABC DEF GHI'), 'Abc Def Ghi') - self.assertEqual(string.capwords('ABC-DEF-GHI', '-'), 'Abc-Def-Ghi') - self.assertEqual(string.capwords('ABC-def DEF-ghi GHI'), 'Abc-def Def-ghi Ghi') - -def test_main(): - test_support.run_unittest(StringTest, ModuleTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_stringprep.py b/sys/lib/python/test/test_stringprep.py deleted file mode 100644 index 2baf4a5f2..000000000 --- a/sys/lib/python/test/test_stringprep.py +++ /dev/null @@ -1,88 +0,0 @@ -# To fully test this module, we would need a copy of the stringprep tables. -# Since we don't have them, this test checks only a few codepoints. - -from test.test_support import verify, vereq - -import stringprep -from stringprep import * - -verify(in_table_a1(u"\u0221")) -verify(not in_table_a1(u"\u0222")) - -verify(in_table_b1(u"\u00ad")) -verify(not in_table_b1(u"\u00ae")) - -verify(map_table_b2(u"\u0041"), u"\u0061") -verify(map_table_b2(u"\u0061"), u"\u0061") - -verify(map_table_b3(u"\u0041"), u"\u0061") -verify(map_table_b3(u"\u0061"), u"\u0061") - -verify(in_table_c11(u"\u0020")) -verify(not in_table_c11(u"\u0021")) - -verify(in_table_c12(u"\u00a0")) -verify(not in_table_c12(u"\u00a1")) - -verify(in_table_c12(u"\u00a0")) -verify(not in_table_c12(u"\u00a1")) - -verify(in_table_c11_c12(u"\u00a0")) -verify(not in_table_c11_c12(u"\u00a1")) - -verify(in_table_c21(u"\u001f")) -verify(not in_table_c21(u"\u0020")) - -verify(in_table_c22(u"\u009f")) -verify(not in_table_c22(u"\u00a0")) - -verify(in_table_c21_c22(u"\u009f")) -verify(not in_table_c21_c22(u"\u00a0")) - -verify(in_table_c3(u"\ue000")) -verify(not in_table_c3(u"\uf900")) - -verify(in_table_c4(u"\uffff")) -verify(not in_table_c4(u"\u0000")) - -verify(in_table_c5(u"\ud800")) -verify(not in_table_c5(u"\ud7ff")) - -verify(in_table_c6(u"\ufff9")) -verify(not in_table_c6(u"\ufffe")) - -verify(in_table_c7(u"\u2ff0")) -verify(not in_table_c7(u"\u2ffc")) - -verify(in_table_c8(u"\u0340")) -verify(not in_table_c8(u"\u0342")) - -# C.9 is not in the bmp -# verify(in_table_c9(u"\U000E0001")) -# verify(not in_table_c8(u"\U000E0002")) - -verify(in_table_d1(u"\u05be")) -verify(not in_table_d1(u"\u05bf")) - -verify(in_table_d2(u"\u0041")) -verify(not in_table_d2(u"\u0040")) - -# This would generate a hash of all predicates. However, running -# it is quite expensive, and only serves to detect changes in the -# unicode database. Instead, stringprep.py asserts the version of -# the database. - -# import hashlib -# predicates = [k for k in dir(stringprep) if k.startswith("in_table")] -# predicates.sort() -# for p in predicates: -# f = getattr(stringprep, p) -# # Collect all BMP code points -# data = ["0"] * 0x10000 -# for i in range(0x10000): -# if f(unichr(i)): -# data[i] = "1" -# data = "".join(data) -# h = hashlib.sha1() -# h.update(data) -# print p, h.hexdigest() diff --git a/sys/lib/python/test/test_strop.py b/sys/lib/python/test/test_strop.py deleted file mode 100644 index 2ac798669..000000000 --- a/sys/lib/python/test/test_strop.py +++ /dev/null @@ -1,134 +0,0 @@ -import warnings -warnings.filterwarnings("ignore", "strop functions are obsolete;", - DeprecationWarning, - r'test.test_strop|unittest') -import strop -import unittest -from test import test_support - - -class StropFunctionTestCase(unittest.TestCase): - - def test_atoi(self): - self.assert_(strop.atoi(" 1 ") == 1) - self.assertRaises(ValueError, strop.atoi, " 1x") - self.assertRaises(ValueError, strop.atoi, " x1 ") - - def test_atol(self): - self.assert_(strop.atol(" 1 ") == 1L) - self.assertRaises(ValueError, strop.atol, " 1x") - self.assertRaises(ValueError, strop.atol, " x1 ") - - def test_atof(self): - self.assert_(strop.atof(" 1 ") == 1.0) - self.assertRaises(ValueError, strop.atof, " 1x") - self.assertRaises(ValueError, strop.atof, " x1 ") - - def test_capitalize(self): - self.assert_(strop.capitalize(" hello ") == " hello ") - self.assert_(strop.capitalize("hello ") == "Hello ") - - def test_find(self): - self.assert_(strop.find("abcdefghiabc", "abc") == 0) - self.assert_(strop.find("abcdefghiabc", "abc", 1) == 9) - self.assert_(strop.find("abcdefghiabc", "def", 4) == -1) - - def test_rfind(self): - self.assert_(strop.rfind("abcdefghiabc", "abc") == 9) - - def test_lower(self): - self.assert_(strop.lower("HeLLo") == "hello") - - def test_upper(self): - self.assert_(strop.upper("HeLLo") == "HELLO") - - def test_swapcase(self): - self.assert_(strop.swapcase("HeLLo cOmpUteRs") == "hEllO CoMPuTErS") - - def test_strip(self): - self.assert_(strop.strip(" \t\n hello \t\n ") == "hello") - - def test_lstrip(self): - self.assert_(strop.lstrip(" \t\n hello \t\n ") == "hello \t\n ") - - def test_rstrip(self): - self.assert_(strop.rstrip(" \t\n hello \t\n ") == " \t\n hello") - - def test_replace(self): - replace = strop.replace - self.assert_(replace("one!two!three!", '!', '@', 1) - == "one@two!three!") - self.assert_(replace("one!two!three!", '!', '@', 2) - == "one@two@three!") - self.assert_(replace("one!two!three!", '!', '@', 3) - == "one@two@three@") - self.assert_(replace("one!two!three!", '!', '@', 4) - == "one@two@three@") - - # CAUTION: a replace count of 0 means infinity only to strop, - # not to the string .replace() method or to the - # string.replace() function. - - self.assert_(replace("one!two!three!", '!', '@', 0) - == "one@two@three@") - self.assert_(replace("one!two!three!", '!', '@') - == "one@two@three@") - self.assert_(replace("one!two!three!", 'x', '@') - == "one!two!three!") - self.assert_(replace("one!two!three!", 'x', '@', 2) - == "one!two!three!") - - def test_split(self): - split = strop.split - self.assert_(split("this is the split function") - == ['this', 'is', 'the', 'split', 'function']) - self.assert_(split("a|b|c|d", '|') == ['a', 'b', 'c', 'd']) - self.assert_(split("a|b|c|d", '|', 2) == ['a', 'b', 'c|d']) - self.assert_(split("a b c d", None, 1) == ['a', 'b c d']) - self.assert_(split("a b c d", None, 2) == ['a', 'b', 'c d']) - self.assert_(split("a b c d", None, 3) == ['a', 'b', 'c', 'd']) - self.assert_(split("a b c d", None, 4) == ['a', 'b', 'c', 'd']) - self.assert_(split("a b c d", None, 0) == ['a', 'b', 'c', 'd']) - self.assert_(split("a b c d", None, 2) == ['a', 'b', 'c d']) - - def test_join(self): - self.assert_(strop.join(['a', 'b', 'c', 'd']) == 'a b c d') - self.assert_(strop.join(('a', 'b', 'c', 'd'), '') == 'abcd') - self.assert_(strop.join(Sequence()) == 'w x y z') - - # try a few long ones - self.assert_(strop.join(['x' * 100] * 100, ':') - == (('x' * 100) + ":") * 99 + "x" * 100) - self.assert_(strop.join(('x' * 100,) * 100, ':') - == (('x' * 100) + ":") * 99 + "x" * 100) - - def test_maketrans(self): - self.assert_(strop.maketrans("abc", "xyz") == transtable) - self.assertRaises(ValueError, strop.maketrans, "abc", "xyzq") - - def test_translate(self): - self.assert_(strop.translate("xyzabcdef", transtable, "def") - == "xyzxyz") - - def test_data_attributes(self): - strop.lowercase - strop.uppercase - strop.whitespace - - -transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377' - - -# join() now works with any sequence type. -class Sequence: - def __init__(self): self.seq = 'wxyz' - def __len__(self): return len(self.seq) - def __getitem__(self, i): return self.seq[i] - - -def test_main(): - test_support.run_unittest(StropFunctionTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_strptime.py b/sys/lib/python/test/test_strptime.py deleted file mode 100644 index 56e1ab87a..000000000 --- a/sys/lib/python/test/test_strptime.py +++ /dev/null @@ -1,523 +0,0 @@ -"""PyUnit testing against strptime""" - -import unittest -import time -import locale -import re -import sys -from test import test_support -from datetime import date as datetime_date - -import _strptime - -class getlang_Tests(unittest.TestCase): - """Test _getlang""" - def test_basic(self): - self.failUnlessEqual(_strptime._getlang(), locale.getlocale(locale.LC_TIME)) - -class LocaleTime_Tests(unittest.TestCase): - """Tests for _strptime.LocaleTime. - - All values are lower-cased when stored in LocaleTime, so make sure to - compare values after running ``lower`` on them. - - """ - - def setUp(self): - """Create time tuple based on current time.""" - self.time_tuple = time.localtime() - self.LT_ins = _strptime.LocaleTime() - - def compare_against_time(self, testing, directive, tuple_position, - error_msg): - """Helper method that tests testing against directive based on the - tuple_position of time_tuple. Uses error_msg as error message. - - """ - strftime_output = time.strftime(directive, self.time_tuple).lower() - comparison = testing[self.time_tuple[tuple_position]] - self.failUnless(strftime_output in testing, "%s: not found in tuple" % - error_msg) - self.failUnless(comparison == strftime_output, - "%s: position within tuple incorrect; %s != %s" % - (error_msg, comparison, strftime_output)) - - def test_weekday(self): - # Make sure that full and abbreviated weekday names are correct in - # both string and position with tuple - self.compare_against_time(self.LT_ins.f_weekday, '%A', 6, - "Testing of full weekday name failed") - self.compare_against_time(self.LT_ins.a_weekday, '%a', 6, - "Testing of abbreviated weekday name failed") - - def test_month(self): - # Test full and abbreviated month names; both string and position - # within the tuple - self.compare_against_time(self.LT_ins.f_month, '%B', 1, - "Testing against full month name failed") - self.compare_against_time(self.LT_ins.a_month, '%b', 1, - "Testing against abbreviated month name failed") - - def test_am_pm(self): - # Make sure AM/PM representation done properly - strftime_output = time.strftime("%p", self.time_tuple).lower() - self.failUnless(strftime_output in self.LT_ins.am_pm, - "AM/PM representation not in tuple") - if self.time_tuple[3] < 12: position = 0 - else: position = 1 - self.failUnless(strftime_output == self.LT_ins.am_pm[position], - "AM/PM representation in the wrong position within the tuple") - - def test_timezone(self): - # Make sure timezone is correct - timezone = time.strftime("%Z", self.time_tuple).lower() - if timezone: - self.failUnless(timezone in self.LT_ins.timezone[0] or \ - timezone in self.LT_ins.timezone[1], - "timezone %s not found in %s" % - (timezone, self.LT_ins.timezone)) - - def test_date_time(self): - # Check that LC_date_time, LC_date, and LC_time are correct - # the magic date is used so as to not have issues with %c when day of - # the month is a single digit and has a leading space. This is not an - # issue since strptime still parses it correctly. The problem is - # testing these directives for correctness by comparing strftime - # output. - magic_date = (1999, 3, 17, 22, 44, 55, 2, 76, 0) - strftime_output = time.strftime("%c", magic_date) - self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date_time, - magic_date), - "LC_date_time incorrect") - strftime_output = time.strftime("%x", magic_date) - self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date, - magic_date), - "LC_date incorrect") - strftime_output = time.strftime("%X", magic_date) - self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_time, - magic_date), - "LC_time incorrect") - LT = _strptime.LocaleTime() - LT.am_pm = ('', '') - self.failUnless(LT.LC_time, "LocaleTime's LC directives cannot handle " - "empty strings") - - def test_lang(self): - # Make sure lang is set to what _getlang() returns - # Assuming locale has not changed between now and when self.LT_ins was created - self.failUnlessEqual(self.LT_ins.lang, _strptime._getlang()) - - -class TimeRETests(unittest.TestCase): - """Tests for TimeRE.""" - - def setUp(self): - """Construct generic TimeRE object.""" - self.time_re = _strptime.TimeRE() - self.locale_time = _strptime.LocaleTime() - - def test_pattern(self): - # Test TimeRE.pattern - pattern_string = self.time_re.pattern(r"%a %A %d") - self.failUnless(pattern_string.find(self.locale_time.a_weekday[2]) != -1, - "did not find abbreviated weekday in pattern string '%s'" % - pattern_string) - self.failUnless(pattern_string.find(self.locale_time.f_weekday[4]) != -1, - "did not find full weekday in pattern string '%s'" % - pattern_string) - self.failUnless(pattern_string.find(self.time_re['d']) != -1, - "did not find 'd' directive pattern string '%s'" % - pattern_string) - - def test_pattern_escaping(self): - # Make sure any characters in the format string that might be taken as - # regex syntax is escaped. - pattern_string = self.time_re.pattern("\d+") - self.failUnless(r"\\d\+" in pattern_string, - "%s does not have re characters escaped properly" % - pattern_string) - - def test_compile(self): - # Check that compiled regex is correct - found = self.time_re.compile(r"%A").match(self.locale_time.f_weekday[6]) - self.failUnless(found and found.group('A') == self.locale_time.f_weekday[6], - "re object for '%A' failed") - compiled = self.time_re.compile(r"%a %b") - found = compiled.match("%s %s" % (self.locale_time.a_weekday[4], - self.locale_time.a_month[4])) - self.failUnless(found, - "Match failed with '%s' regex and '%s' string" % - (compiled.pattern, "%s %s" % (self.locale_time.a_weekday[4], - self.locale_time.a_month[4]))) - self.failUnless(found.group('a') == self.locale_time.a_weekday[4] and - found.group('b') == self.locale_time.a_month[4], - "re object couldn't find the abbreviated weekday month in " - "'%s' using '%s'; group 'a' = '%s', group 'b' = %s'" % - (found.string, found.re.pattern, found.group('a'), - found.group('b'))) - for directive in ('a','A','b','B','c','d','H','I','j','m','M','p','S', - 'U','w','W','x','X','y','Y','Z','%'): - compiled = self.time_re.compile("%" + directive) - found = compiled.match(time.strftime("%" + directive)) - self.failUnless(found, "Matching failed on '%s' using '%s' regex" % - (time.strftime("%" + directive), - compiled.pattern)) - - def test_blankpattern(self): - # Make sure when tuple or something has no values no regex is generated. - # Fixes bug #661354 - test_locale = _strptime.LocaleTime() - test_locale.timezone = (frozenset(), frozenset()) - self.failUnless(_strptime.TimeRE(test_locale).pattern("%Z") == '', - "with timezone == ('',''), TimeRE().pattern('%Z') != ''") - - def test_matching_with_escapes(self): - # Make sure a format that requires escaping of characters works - compiled_re = self.time_re.compile("\w+ %m") - found = compiled_re.match("\w+ 10") - self.failUnless(found, "Escaping failed of format '\w+ 10'") - - def test_locale_data_w_regex_metacharacters(self): - # Check that if locale data contains regex metacharacters they are - # escaped properly. - # Discovered by bug #1039270 . - locale_time = _strptime.LocaleTime() - locale_time.timezone = (frozenset(("utc", "gmt", - "Tokyo (standard time)")), - frozenset("Tokyo (daylight time)")) - time_re = _strptime.TimeRE(locale_time) - self.failUnless(time_re.compile("%Z").match("Tokyo (standard time)"), - "locale data that contains regex metacharacters is not" - " properly escaped") - -class StrptimeTests(unittest.TestCase): - """Tests for _strptime.strptime.""" - - def setUp(self): - """Create testing time tuple.""" - self.time_tuple = time.gmtime() - - def test_ValueError(self): - # Make sure ValueError is raised when match fails or format is bad - self.assertRaises(ValueError, _strptime.strptime, data_string="%d", - format="%A") - for bad_format in ("%", "% ", "%e"): - try: - _strptime.strptime("2005", bad_format) - except ValueError: - continue - except Exception, err: - self.fail("'%s' raised %s, not ValueError" % - (bad_format, err.__class__.__name__)) - else: - self.fail("'%s' did not raise ValueError" % bad_format) - - def test_unconverteddata(self): - # Check ValueError is raised when there is unconverted data - self.assertRaises(ValueError, _strptime.strptime, "10 12", "%m") - - def helper(self, directive, position): - """Helper fxn in testing.""" - strf_output = time.strftime("%" + directive, self.time_tuple) - strp_output = _strptime.strptime(strf_output, "%" + directive) - self.failUnless(strp_output[position] == self.time_tuple[position], - "testing of '%s' directive failed; '%s' -> %s != %s" % - (directive, strf_output, strp_output[position], - self.time_tuple[position])) - - def test_year(self): - # Test that the year is handled properly - for directive in ('y', 'Y'): - self.helper(directive, 0) - # Must also make sure %y values are correct for bounds set by Open Group - for century, bounds in ((1900, ('69', '99')), (2000, ('00', '68'))): - for bound in bounds: - strp_output = _strptime.strptime(bound, '%y') - expected_result = century + int(bound) - self.failUnless(strp_output[0] == expected_result, - "'y' test failed; passed in '%s' " - "and returned '%s'" % (bound, strp_output[0])) - - def test_month(self): - # Test for month directives - for directive in ('B', 'b', 'm'): - self.helper(directive, 1) - - def test_day(self): - # Test for day directives - self.helper('d', 2) - - def test_hour(self): - # Test hour directives - self.helper('H', 3) - strf_output = time.strftime("%I %p", self.time_tuple) - strp_output = _strptime.strptime(strf_output, "%I %p") - self.failUnless(strp_output[3] == self.time_tuple[3], - "testing of '%%I %%p' directive failed; '%s' -> %s != %s" % - (strf_output, strp_output[3], self.time_tuple[3])) - - def test_minute(self): - # Test minute directives - self.helper('M', 4) - - def test_second(self): - # Test second directives - self.helper('S', 5) - - def test_weekday(self): - # Test weekday directives - for directive in ('A', 'a', 'w'): - self.helper(directive,6) - - def test_julian(self): - # Test julian directives - self.helper('j', 7) - - def test_timezone(self): - # Test timezone directives. - # When gmtime() is used with %Z, entire result of strftime() is empty. - # Check for equal timezone names deals with bad locale info when this - # occurs; first found in FreeBSD 4.4. - strp_output = _strptime.strptime("UTC", "%Z") - self.failUnlessEqual(strp_output.tm_isdst, 0) - strp_output = _strptime.strptime("GMT", "%Z") - self.failUnlessEqual(strp_output.tm_isdst, 0) - if sys.platform == "mac": - # Timezones don't really work on MacOS9 - return - time_tuple = time.localtime() - strf_output = time.strftime("%Z") #UTC does not have a timezone - strp_output = _strptime.strptime(strf_output, "%Z") - locale_time = _strptime.LocaleTime() - if time.tzname[0] != time.tzname[1] or not time.daylight: - self.failUnless(strp_output[8] == time_tuple[8], - "timezone check failed; '%s' -> %s != %s" % - (strf_output, strp_output[8], time_tuple[8])) - else: - self.failUnless(strp_output[8] == -1, - "LocaleTime().timezone has duplicate values and " - "time.daylight but timezone value not set to -1") - - def test_bad_timezone(self): - # Explicitly test possibility of bad timezone; - # when time.tzname[0] == time.tzname[1] and time.daylight - if sys.platform == "mac": - return #MacOS9 has severely broken timezone support. - tz_name = time.tzname[0] - if tz_name.upper() in ("UTC", "GMT"): - return - try: - original_tzname = time.tzname - original_daylight = time.daylight - time.tzname = (tz_name, tz_name) - time.daylight = 1 - tz_value = _strptime.strptime(tz_name, "%Z")[8] - self.failUnlessEqual(tz_value, -1, - "%s lead to a timezone value of %s instead of -1 when " - "time.daylight set to %s and passing in %s" % - (time.tzname, tz_value, time.daylight, tz_name)) - finally: - time.tzname = original_tzname - time.daylight = original_daylight - - def test_date_time(self): - # Test %c directive - for position in range(6): - self.helper('c', position) - - def test_date(self): - # Test %x directive - for position in range(0,3): - self.helper('x', position) - - def test_time(self): - # Test %X directive - for position in range(3,6): - self.helper('X', position) - - def test_percent(self): - # Make sure % signs are handled properly - strf_output = time.strftime("%m %% %Y", self.time_tuple) - strp_output = _strptime.strptime(strf_output, "%m %% %Y") - self.failUnless(strp_output[0] == self.time_tuple[0] and - strp_output[1] == self.time_tuple[1], - "handling of percent sign failed") - - def test_caseinsensitive(self): - # Should handle names case-insensitively. - strf_output = time.strftime("%B", self.time_tuple) - self.failUnless(_strptime.strptime(strf_output.upper(), "%B"), - "strptime does not handle ALL-CAPS names properly") - self.failUnless(_strptime.strptime(strf_output.lower(), "%B"), - "strptime does not handle lowercase names properly") - self.failUnless(_strptime.strptime(strf_output.capitalize(), "%B"), - "strptime does not handle capword names properly") - - def test_defaults(self): - # Default return value should be (1900, 1, 1, 0, 0, 0, 0, 1, 0) - defaults = (1900, 1, 1, 0, 0, 0, 0, 1, -1) - strp_output = _strptime.strptime('1', '%m') - self.failUnless(strp_output == defaults, - "Default values for strptime() are incorrect;" - " %s != %s" % (strp_output, defaults)) - - def test_escaping(self): - # Make sure all characters that have regex significance are escaped. - # Parentheses are in a purposeful order; will cause an error of - # unbalanced parentheses when the regex is compiled if they are not - # escaped. - # Test instigated by bug #796149 . - need_escaping = ".^$*+?{}\[]|)(" - self.failUnless(_strptime.strptime(need_escaping, need_escaping)) - -class Strptime12AMPMTests(unittest.TestCase): - """Test a _strptime regression in '%I %p' at 12 noon (12 PM)""" - - def test_twelve_noon_midnight(self): - eq = self.assertEqual - eq(time.strptime('12 PM', '%I %p')[3], 12) - eq(time.strptime('12 AM', '%I %p')[3], 0) - eq(_strptime.strptime('12 PM', '%I %p')[3], 12) - eq(_strptime.strptime('12 AM', '%I %p')[3], 0) - - -class JulianTests(unittest.TestCase): - """Test a _strptime regression that all julian (1-366) are accepted""" - - def test_all_julian_days(self): - eq = self.assertEqual - for i in range(1, 367): - # use 2004, since it is a leap year, we have 366 days - eq(_strptime.strptime('%d 2004' % i, '%j %Y')[7], i) - -class CalculationTests(unittest.TestCase): - """Test that strptime() fills in missing info correctly""" - - def setUp(self): - self.time_tuple = time.gmtime() - - def test_julian_calculation(self): - # Make sure that when Julian is missing that it is calculated - format_string = "%Y %m %d %H %M %S %w %Z" - result = _strptime.strptime(time.strftime(format_string, self.time_tuple), - format_string) - self.failUnless(result.tm_yday == self.time_tuple.tm_yday, - "Calculation of tm_yday failed; %s != %s" % - (result.tm_yday, self.time_tuple.tm_yday)) - - def test_gregorian_calculation(self): - # Test that Gregorian date can be calculated from Julian day - format_string = "%Y %H %M %S %w %j %Z" - result = _strptime.strptime(time.strftime(format_string, self.time_tuple), - format_string) - self.failUnless(result.tm_year == self.time_tuple.tm_year and - result.tm_mon == self.time_tuple.tm_mon and - result.tm_mday == self.time_tuple.tm_mday, - "Calculation of Gregorian date failed;" - "%s-%s-%s != %s-%s-%s" % - (result.tm_year, result.tm_mon, result.tm_mday, - self.time_tuple.tm_year, self.time_tuple.tm_mon, - self.time_tuple.tm_mday)) - - def test_day_of_week_calculation(self): - # Test that the day of the week is calculated as needed - format_string = "%Y %m %d %H %S %j %Z" - result = _strptime.strptime(time.strftime(format_string, self.time_tuple), - format_string) - self.failUnless(result.tm_wday == self.time_tuple.tm_wday, - "Calculation of day of the week failed;" - "%s != %s" % (result.tm_wday, self.time_tuple.tm_wday)) - - def test_week_of_year_and_day_of_week_calculation(self): - # Should be able to infer date if given year, week of year (%U or %W) - # and day of the week - def test_helper(ymd_tuple, test_reason): - for directive in ('W', 'U'): - format_string = "%%Y %%%s %%w" % directive - dt_date = datetime_date(*ymd_tuple) - strp_input = dt_date.strftime(format_string) - strp_output = _strptime.strptime(strp_input, format_string) - self.failUnless(strp_output[:3] == ymd_tuple, - "%s(%s) test failed w/ '%s': %s != %s (%s != %s)" % - (test_reason, directive, strp_input, - strp_output[:3], ymd_tuple, - strp_output[7], dt_date.timetuple()[7])) - test_helper((1901, 1, 3), "week 0") - test_helper((1901, 1, 8), "common case") - test_helper((1901, 1, 13), "day on Sunday") - test_helper((1901, 1, 14), "day on Monday") - test_helper((1905, 1, 1), "Jan 1 on Sunday") - test_helper((1906, 1, 1), "Jan 1 on Monday") - test_helper((1906, 1, 7), "first Sunday in a year starting on Monday") - test_helper((1905, 12, 31), "Dec 31 on Sunday") - test_helper((1906, 12, 31), "Dec 31 on Monday") - test_helper((2008, 12, 29), "Monday in the last week of the year") - test_helper((2008, 12, 22), "Monday in the second-to-last week of the " - "year") - test_helper((1978, 10, 23), "randomly chosen date") - test_helper((2004, 12, 18), "randomly chosen date") - test_helper((1978, 10, 23), "year starting and ending on Monday while " - "date not on Sunday or Monday") - test_helper((1917, 12, 17), "year starting and ending on Monday with " - "a Monday not at the beginning or end " - "of the year") - test_helper((1917, 12, 31), "Dec 31 on Monday with year starting and " - "ending on Monday") - test_helper((2007, 01, 07), "First Sunday of 2007") - test_helper((2007, 01, 14), "Second Sunday of 2007") - test_helper((2006, 12, 31), "Last Sunday of 2006") - test_helper((2006, 12, 24), "Second to last Sunday of 2006") - - -class CacheTests(unittest.TestCase): - """Test that caching works properly.""" - - def test_time_re_recreation(self): - # Make sure cache is recreated when current locale does not match what - # cached object was created with. - _strptime.strptime("10", "%d") - _strptime.strptime("2005", "%Y") - _strptime._TimeRE_cache.locale_time.lang = "Ni" - original_time_re = id(_strptime._TimeRE_cache) - _strptime.strptime("10", "%d") - self.failIfEqual(original_time_re, id(_strptime._TimeRE_cache)) - self.failUnlessEqual(len(_strptime._regex_cache), 1) - - def test_regex_cleanup(self): - # Make sure cached regexes are discarded when cache becomes "full". - try: - del _strptime._regex_cache['%d'] - except KeyError: - pass - bogus_key = 0 - while len(_strptime._regex_cache) <= _strptime._CACHE_MAX_SIZE: - _strptime._regex_cache[bogus_key] = None - bogus_key += 1 - _strptime.strptime("10", "%d") - self.failUnlessEqual(len(_strptime._regex_cache), 1) - - def test_new_localetime(self): - # A new LocaleTime instance should be created when a new TimeRE object - # is created. - locale_time_id = id(_strptime._TimeRE_cache.locale_time) - _strptime._TimeRE_cache.locale_time.lang = "Ni" - _strptime.strptime("10", "%d") - self.failIfEqual(locale_time_id, - id(_strptime._TimeRE_cache.locale_time)) - - -def test_main(): - test_support.run_unittest( - getlang_Tests, - LocaleTime_Tests, - TimeRETests, - StrptimeTests, - Strptime12AMPMTests, - JulianTests, - CalculationTests, - CacheTests - ) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_struct.py b/sys/lib/python/test/test_struct.py deleted file mode 100644 index 7ecb6ac9a..000000000 --- a/sys/lib/python/test/test_struct.py +++ /dev/null @@ -1,625 +0,0 @@ -from test.test_support import TestFailed, verbose, verify, vereq -import test.test_support -import struct -import array -import warnings - -import sys -ISBIGENDIAN = sys.byteorder == "big" -del sys -verify((struct.pack('=i', 1)[0] == chr(0)) == ISBIGENDIAN, - "bigendian determination appears wrong") - -try: - import _struct -except ImportError: - PY_STRUCT_RANGE_CHECKING = 0 - PY_STRUCT_OVERFLOW_MASKING = 1 - PY_STRUCT_FLOAT_COERCE = 2 -else: - PY_STRUCT_RANGE_CHECKING = getattr(_struct, '_PY_STRUCT_RANGE_CHECKING', 0) - PY_STRUCT_OVERFLOW_MASKING = getattr(_struct, '_PY_STRUCT_OVERFLOW_MASKING', 0) - PY_STRUCT_FLOAT_COERCE = getattr(_struct, '_PY_STRUCT_FLOAT_COERCE', 0) - -def string_reverse(s): - return "".join(reversed(s)) - -def bigendian_to_native(value): - if ISBIGENDIAN: - return value - else: - return string_reverse(value) - -def simple_err(func, *args): - try: - func(*args) - except struct.error: - pass - else: - raise TestFailed, "%s%s did not raise struct.error" % ( - func.__name__, args) - -def any_err(func, *args): - try: - func(*args) - except (struct.error, TypeError): - pass - else: - raise TestFailed, "%s%s did not raise error" % ( - func.__name__, args) - -def with_warning_restore(func): - def _with_warning_restore(*args, **kw): - # The `warnings` module doesn't have an advertised way to restore - # its filter list. Cheat. - save_warnings_filters = warnings.filters[:] - # Grrr, we need this function to warn every time. Without removing - # the warningregistry, running test_tarfile then test_struct would fail - # on 64-bit platforms. - globals = func.func_globals - if '__warningregistry__' in globals: - del globals['__warningregistry__'] - warnings.filterwarnings("error", r"""^struct.*""", DeprecationWarning) - warnings.filterwarnings("error", r""".*format requires.*""", - DeprecationWarning) - try: - return func(*args, **kw) - finally: - warnings.filters[:] = save_warnings_filters[:] - return _with_warning_restore - -def deprecated_err(func, *args): - try: - func(*args) - except (struct.error, TypeError): - pass - except DeprecationWarning: - if not PY_STRUCT_OVERFLOW_MASKING: - raise TestFailed, "%s%s expected to raise struct.error" % ( - func.__name__, args) - else: - raise TestFailed, "%s%s did not raise error" % ( - func.__name__, args) -deprecated_err = with_warning_restore(deprecated_err) - - -simple_err(struct.calcsize, 'Z') - -sz = struct.calcsize('i') -if sz * 3 != struct.calcsize('iii'): - raise TestFailed, 'inconsistent sizes' - -fmt = 'cbxxxxxxhhhhiillffd' -fmt3 = '3c3b18x12h6i6l6f3d' -sz = struct.calcsize(fmt) -sz3 = struct.calcsize(fmt3) -if sz * 3 != sz3: - raise TestFailed, 'inconsistent sizes (3*%r -> 3*%d = %d, %r -> %d)' % ( - fmt, sz, 3*sz, fmt3, sz3) - -simple_err(struct.pack, 'iii', 3) -simple_err(struct.pack, 'i', 3, 3, 3) -simple_err(struct.pack, 'i', 'foo') -simple_err(struct.pack, 'P', 'foo') -simple_err(struct.unpack, 'd', 'flap') -s = struct.pack('ii', 1, 2) -simple_err(struct.unpack, 'iii', s) -simple_err(struct.unpack, 'i', s) - -c = 'a' -b = 1 -h = 255 -i = 65535 -l = 65536 -f = 3.1415 -d = 3.1415 - -for prefix in ('', '@', '<', '>', '=', '!'): - for format in ('xcbhilfd', 'xcBHILfd'): - format = prefix + format - if verbose: - print "trying:", format - s = struct.pack(format, c, b, h, i, l, f, d) - cp, bp, hp, ip, lp, fp, dp = struct.unpack(format, s) - if (cp != c or bp != b or hp != h or ip != i or lp != l or - int(100 * fp) != int(100 * f) or int(100 * dp) != int(100 * d)): - # ^^^ calculate only to two decimal places - raise TestFailed, "unpack/pack not transitive (%s, %s)" % ( - str(format), str((cp, bp, hp, ip, lp, fp, dp))) - -# Test some of the new features in detail - -# (format, argument, big-endian result, little-endian result, asymmetric) -tests = [ - ('c', 'a', 'a', 'a', 0), - ('xc', 'a', '\0a', '\0a', 0), - ('cx', 'a', 'a\0', 'a\0', 0), - ('s', 'a', 'a', 'a', 0), - ('0s', 'helloworld', '', '', 1), - ('1s', 'helloworld', 'h', 'h', 1), - ('9s', 'helloworld', 'helloworl', 'helloworl', 1), - ('10s', 'helloworld', 'helloworld', 'helloworld', 0), - ('11s', 'helloworld', 'helloworld\0', 'helloworld\0', 1), - ('20s', 'helloworld', 'helloworld'+10*'\0', 'helloworld'+10*'\0', 1), - ('b', 7, '\7', '\7', 0), - ('b', -7, '\371', '\371', 0), - ('B', 7, '\7', '\7', 0), - ('B', 249, '\371', '\371', 0), - ('h', 700, '\002\274', '\274\002', 0), - ('h', -700, '\375D', 'D\375', 0), - ('H', 700, '\002\274', '\274\002', 0), - ('H', 0x10000-700, '\375D', 'D\375', 0), - ('i', 70000000, '\004,\035\200', '\200\035,\004', 0), - ('i', -70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('I', 70000000L, '\004,\035\200', '\200\035,\004', 0), - ('I', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('l', 70000000, '\004,\035\200', '\200\035,\004', 0), - ('l', -70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('L', 70000000L, '\004,\035\200', '\200\035,\004', 0), - ('L', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('f', 2.0, '@\000\000\000', '\000\000\000@', 0), - ('d', 2.0, '@\000\000\000\000\000\000\000', - '\000\000\000\000\000\000\000@', 0), - ('f', -2.0, '\300\000\000\000', '\000\000\000\300', 0), - ('d', -2.0, '\300\000\000\000\000\000\000\000', - '\000\000\000\000\000\000\000\300', 0), -] - -for fmt, arg, big, lil, asy in tests: - if verbose: - print "%r %r %r %r" % (fmt, arg, big, lil) - for (xfmt, exp) in [('>'+fmt, big), ('!'+fmt, big), ('<'+fmt, lil), - ('='+fmt, ISBIGENDIAN and big or lil)]: - res = struct.pack(xfmt, arg) - if res != exp: - raise TestFailed, "pack(%r, %r) -> %r # expected %r" % ( - fmt, arg, res, exp) - n = struct.calcsize(xfmt) - if n != len(res): - raise TestFailed, "calcsize(%r) -> %d # expected %d" % ( - xfmt, n, len(res)) - rev = struct.unpack(xfmt, res)[0] - if rev != arg and not asy: - raise TestFailed, "unpack(%r, %r) -> (%r,) # expected (%r,)" % ( - fmt, res, rev, arg) - -########################################################################### -# Simple native q/Q tests. - -has_native_qQ = 1 -try: - struct.pack("q", 5) -except struct.error: - has_native_qQ = 0 - -if verbose: - print "Platform has native q/Q?", has_native_qQ and "Yes." or "No." - -any_err(struct.pack, "Q", -1) # can't pack -1 as unsigned regardless -simple_err(struct.pack, "q", "a") # can't pack string as 'q' regardless -simple_err(struct.pack, "Q", "a") # ditto, but 'Q' - -def test_native_qQ(): - bytes = struct.calcsize('q') - # The expected values here are in big-endian format, primarily because - # I'm on a little-endian machine and so this is the clearest way (for - # me) to force the code to get exercised. - for format, input, expected in ( - ('q', -1, '\xff' * bytes), - ('q', 0, '\x00' * bytes), - ('Q', 0, '\x00' * bytes), - ('q', 1L, '\x00' * (bytes-1) + '\x01'), - ('Q', (1L << (8*bytes))-1, '\xff' * bytes), - ('q', (1L << (8*bytes-1))-1, '\x7f' + '\xff' * (bytes - 1))): - got = struct.pack(format, input) - native_expected = bigendian_to_native(expected) - verify(got == native_expected, - "%r-pack of %r gave %r, not %r" % - (format, input, got, native_expected)) - retrieved = struct.unpack(format, got)[0] - verify(retrieved == input, - "%r-unpack of %r gave %r, not %r" % - (format, got, retrieved, input)) - -if has_native_qQ: - test_native_qQ() - -########################################################################### -# Standard integer tests (bBhHiIlLqQ). - -import binascii - -class IntTester: - - # XXX Most std integer modes fail to test for out-of-range. - # The "i" and "l" codes appear to range-check OK on 32-bit boxes, but - # fail to check correctly on some 64-bit ones (Tru64 Unix + Compaq C - # reported by Mark Favas). - BUGGY_RANGE_CHECK = "bBhHiIlL" - - def __init__(self, formatpair, bytesize): - assert len(formatpair) == 2 - self.formatpair = formatpair - for direction in "<>!=": - for code in formatpair: - format = direction + code - verify(struct.calcsize(format) == bytesize) - self.bytesize = bytesize - self.bitsize = bytesize * 8 - self.signed_code, self.unsigned_code = formatpair - self.unsigned_min = 0 - self.unsigned_max = 2L**self.bitsize - 1 - self.signed_min = -(2L**(self.bitsize-1)) - self.signed_max = 2L**(self.bitsize-1) - 1 - - def test_one(self, x, pack=struct.pack, - unpack=struct.unpack, - unhexlify=binascii.unhexlify): - if verbose: - print "trying std", self.formatpair, "on", x, "==", hex(x) - - # Try signed. - code = self.signed_code - if self.signed_min <= x <= self.signed_max: - # Try big-endian. - expected = long(x) - if x < 0: - expected += 1L << self.bitsize - assert expected > 0 - expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' - if len(expected) & 1: - expected = "0" + expected - expected = unhexlify(expected) - expected = "\x00" * (self.bytesize - len(expected)) + expected - - # Pack work? - format = ">" + code - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - # Try little-endian. - format = "<" + code - expected = string_reverse(expected) - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - else: - # x is out of range -- verify pack realizes that. - if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: - if verbose: - print "Skipping buggy range check for code", code - else: - deprecated_err(pack, ">" + code, x) - deprecated_err(pack, "<" + code, x) - - # Much the same for unsigned. - code = self.unsigned_code - if self.unsigned_min <= x <= self.unsigned_max: - # Try big-endian. - format = ">" + code - expected = long(x) - expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' - if len(expected) & 1: - expected = "0" + expected - expected = unhexlify(expected) - expected = "\x00" * (self.bytesize - len(expected)) + expected - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - # Try little-endian. - format = "<" + code - expected = string_reverse(expected) - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - else: - # x is out of range -- verify pack realizes that. - if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: - if verbose: - print "Skipping buggy range check for code", code - else: - deprecated_err(pack, ">" + code, x) - deprecated_err(pack, "<" + code, x) - - def run(self): - from random import randrange - - # Create all interesting powers of 2. - values = [] - for exp in range(self.bitsize + 3): - values.append(1L << exp) - - # Add some random values. - for i in range(self.bitsize): - val = 0L - for j in range(self.bytesize): - val = (val << 8) | randrange(256) - values.append(val) - - # Try all those, and their negations, and +-1 from them. Note - # that this tests all power-of-2 boundaries in range, and a few out - # of range, plus +-(2**n +- 1). - for base in values: - for val in -base, base: - for incr in -1, 0, 1: - x = val + incr - try: - x = int(x) - except OverflowError: - pass - self.test_one(x) - - # Some error cases. - for direction in "<>": - for code in self.formatpair: - for badobject in "a string", 3+42j, randrange: - any_err(struct.pack, direction + code, badobject) - -for args in [("bB", 1), - ("hH", 2), - ("iI", 4), - ("lL", 4), - ("qQ", 8)]: - t = IntTester(*args) - t.run() - - -########################################################################### -# The p ("Pascal string") code. - -def test_p_code(): - for code, input, expected, expectedback in [ - ('p','abc', '\x00', ''), - ('1p', 'abc', '\x00', ''), - ('2p', 'abc', '\x01a', 'a'), - ('3p', 'abc', '\x02ab', 'ab'), - ('4p', 'abc', '\x03abc', 'abc'), - ('5p', 'abc', '\x03abc\x00', 'abc'), - ('6p', 'abc', '\x03abc\x00\x00', 'abc'), - ('1000p', 'x'*1000, '\xff' + 'x'*999, 'x'*255)]: - got = struct.pack(code, input) - if got != expected: - raise TestFailed("pack(%r, %r) == %r but expected %r" % - (code, input, got, expected)) - (got,) = struct.unpack(code, got) - if got != expectedback: - raise TestFailed("unpack(%r, %r) == %r but expected %r" % - (code, input, got, expectedback)) - -test_p_code() - - -########################################################################### -# SF bug 705836. "f" had a severe rounding bug, where a carry -# from the low-order discarded bits could propagate into the exponent -# field, causing the result to be wrong by a factor of 2. - -def test_705836(): - import math - - for base in range(1, 33): - # smaller <- largest representable float less than base. - delta = 0.5 - while base - delta / 2.0 != base: - delta /= 2.0 - smaller = base - delta - # Packing this rounds away a solid string of trailing 1 bits. - packed = struct.pack("f", smaller) - verify(bigpacked == string_reverse(packed), - ">f pack should be byte-reversal of f", bigpacked)[0] - verify(base == unpacked) - - # Largest finite IEEE single. - big = (1 << 24) - 1 - big = math.ldexp(big, 127 - 23) - packed = struct.pack(">f", big) - unpacked = struct.unpack(">f", packed)[0] - verify(big == unpacked) - - # The same, but tack on a 1 bit so it rounds up to infinity. - big = (1 << 25) - 1 - big = math.ldexp(big, 127 - 24) - try: - packed = struct.pack(">f", big) - except OverflowError: - pass - else: - TestFailed("expected OverflowError") - -test_705836() - -########################################################################### -# SF bug 1229380. No struct.pack exception for some out of range integers - -def test_1229380(): - import sys - for endian in ('', '>', '<'): - for cls in (int, long): - for fmt in ('B', 'H', 'I', 'L'): - deprecated_err(struct.pack, endian + fmt, cls(-1)) - - deprecated_err(struct.pack, endian + 'B', cls(300)) - deprecated_err(struct.pack, endian + 'H', cls(70000)) - - deprecated_err(struct.pack, endian + 'I', sys.maxint * 4L) - deprecated_err(struct.pack, endian + 'L', sys.maxint * 4L) - -if PY_STRUCT_RANGE_CHECKING: - test_1229380() - -########################################################################### -# SF bug 1530559. struct.pack raises TypeError where it used to convert. - -def check_float_coerce(format, number): - if PY_STRUCT_FLOAT_COERCE == 2: - # Test for pre-2.5 struct module - packed = struct.pack(format, number) - floored = struct.unpack(format, packed)[0] - if floored != int(number): - raise TestFailed("did not correcly coerce float to int") - return - try: - func(*args) - except (struct.error, TypeError): - if PY_STRUCT_FLOAT_COERCE: - raise TestFailed("expected DeprecationWarning for float coerce") - except DeprecationWarning: - if not PY_STRUCT_FLOAT_COERCE: - raise TestFailed("expected to raise struct.error for float coerce") - else: - raise TestFailed("did not raise error for float coerce") - -check_float_coerce = with_warning_restore(deprecated_err) - -def test_1530559(): - for endian in ('', '>', '<'): - for fmt in ('B', 'H', 'I', 'L', 'b', 'h', 'i', 'l'): - check_float_coerce(endian + fmt, 1.0) - check_float_coerce(endian + fmt, 1.5) - -test_1530559() - -########################################################################### -# Packing and unpacking to/from buffers. - -# Copied and modified from unittest. -def assertRaises(excClass, callableObj, *args, **kwargs): - try: - callableObj(*args, **kwargs) - except excClass: - return - else: - raise TestFailed("%s not raised." % excClass) - -def test_unpack_from(): - test_string = 'abcd01234' - fmt = '4s' - s = struct.Struct(fmt) - for cls in (str, buffer): - data = cls(test_string) - vereq(s.unpack_from(data), ('abcd',)) - vereq(s.unpack_from(data, 2), ('cd01',)) - vereq(s.unpack_from(data, 4), ('0123',)) - for i in xrange(6): - vereq(s.unpack_from(data, i), (data[i:i+4],)) - for i in xrange(6, len(test_string) + 1): - simple_err(s.unpack_from, data, i) - for cls in (str, buffer): - data = cls(test_string) - vereq(struct.unpack_from(fmt, data), ('abcd',)) - vereq(struct.unpack_from(fmt, data, 2), ('cd01',)) - vereq(struct.unpack_from(fmt, data, 4), ('0123',)) - for i in xrange(6): - vereq(struct.unpack_from(fmt, data, i), (data[i:i+4],)) - for i in xrange(6, len(test_string) + 1): - simple_err(struct.unpack_from, fmt, data, i) - -def test_pack_into(): - test_string = 'Reykjavik rocks, eow!' - writable_buf = array.array('c', ' '*100) - fmt = '21s' - s = struct.Struct(fmt) - - # Test without offset - s.pack_into(writable_buf, 0, test_string) - from_buf = writable_buf.tostring()[:len(test_string)] - vereq(from_buf, test_string) - - # Test with offset. - s.pack_into(writable_buf, 10, test_string) - from_buf = writable_buf.tostring()[:len(test_string)+10] - vereq(from_buf, test_string[:10] + test_string) - - # Go beyond boundaries. - small_buf = array.array('c', ' '*10) - assertRaises(struct.error, s.pack_into, small_buf, 0, test_string) - assertRaises(struct.error, s.pack_into, small_buf, 2, test_string) - -def test_pack_into_fn(): - test_string = 'Reykjavik rocks, eow!' - writable_buf = array.array('c', ' '*100) - fmt = '21s' - pack_into = lambda *args: struct.pack_into(fmt, *args) - - # Test without offset. - pack_into(writable_buf, 0, test_string) - from_buf = writable_buf.tostring()[:len(test_string)] - vereq(from_buf, test_string) - - # Test with offset. - pack_into(writable_buf, 10, test_string) - from_buf = writable_buf.tostring()[:len(test_string)+10] - vereq(from_buf, test_string[:10] + test_string) - - # Go beyond boundaries. - small_buf = array.array('c', ' '*10) - assertRaises(struct.error, pack_into, small_buf, 0, test_string) - assertRaises(struct.error, pack_into, small_buf, 2, test_string) - -def test_unpack_with_buffer(): - # SF bug 1563759: struct.unpack doens't support buffer protocol objects - data = array.array('B', '\x12\x34\x56\x78') - value, = struct.unpack('>I', data) - vereq(value, 0x12345678) - -# Test methods to pack and unpack from buffers rather than strings. -test_unpack_from() -test_pack_into() -test_pack_into_fn() -test_unpack_with_buffer() diff --git a/sys/lib/python/test/test_structmembers.py b/sys/lib/python/test/test_structmembers.py deleted file mode 100644 index 7fcf785eb..000000000 --- a/sys/lib/python/test/test_structmembers.py +++ /dev/null @@ -1,48 +0,0 @@ -from _testcapi import test_structmembersType, \ - CHAR_MAX, CHAR_MIN, UCHAR_MAX, \ - SHRT_MAX, SHRT_MIN, USHRT_MAX, \ - INT_MAX, INT_MIN, UINT_MAX, \ - LONG_MAX, LONG_MIN, ULONG_MAX - -import warnings, exceptions, unittest, test.test_warnings -from test import test_support - -ts=test_structmembersType(1,2,3,4,5,6,7,8,9.99999,10.1010101010) - -class ReadWriteTests(unittest.TestCase): - def test_types(self): - ts.T_BYTE=CHAR_MAX - self.assertEquals(ts.T_BYTE, CHAR_MAX) - ts.T_BYTE=CHAR_MIN - self.assertEquals(ts.T_BYTE, CHAR_MIN) - ts.T_UBYTE=UCHAR_MAX - self.assertEquals(ts.T_UBYTE, UCHAR_MAX) - - ts.T_SHORT=SHRT_MAX - self.assertEquals(ts.T_SHORT, SHRT_MAX) - ts.T_SHORT=SHRT_MIN - self.assertEquals(ts.T_SHORT, SHRT_MIN) - ts.T_USHORT=USHRT_MAX - self.assertEquals(ts.T_USHORT, USHRT_MAX) - - ts.T_INT=INT_MAX - self.assertEquals(ts.T_INT, INT_MAX) - ts.T_INT=INT_MIN - self.assertEquals(ts.T_INT, INT_MIN) - ts.T_UINT=UINT_MAX - self.assertEquals(ts.T_UINT, UINT_MAX) - - ts.T_LONG=LONG_MAX - self.assertEquals(ts.T_LONG, LONG_MAX) - ts.T_LONG=LONG_MIN - self.assertEquals(ts.T_LONG, LONG_MIN) - ts.T_ULONG=ULONG_MAX - self.assertEquals(ts.T_ULONG, ULONG_MAX) - -def test_main(verbose=None): - test_support.run_unittest( - ReadWriteTests - ) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_structseq.py b/sys/lib/python/test/test_structseq.py deleted file mode 100644 index eb6d58104..000000000 --- a/sys/lib/python/test/test_structseq.py +++ /dev/null @@ -1,104 +0,0 @@ -import unittest -from test import test_support - -import time - -class StructSeqTest(unittest.TestCase): - - def test_tuple(self): - t = time.gmtime() - astuple = tuple(t) - self.assertEqual(len(t), len(astuple)) - self.assertEqual(t, astuple) - - # Check that slicing works the same way; at one point, slicing t[i:j] with - # 0 < i < j could produce NULLs in the result. - for i in xrange(-len(t), len(t)): - self.assertEqual(t[i:], astuple[i:]) - for j in xrange(-len(t), len(t)): - self.assertEqual(t[i:j], astuple[i:j]) - - for j in xrange(-len(t), len(t)): - self.assertEqual(t[:j], astuple[:j]) - - self.assertRaises(IndexError, t.__getitem__, -len(t)-1) - self.assertRaises(IndexError, t.__getitem__, len(t)) - for i in xrange(-len(t), len(t)-1): - self.assertEqual(t[i], astuple[i]) - - def test_repr(self): - t = time.gmtime() - repr(t) - - def test_concat(self): - t1 = time.gmtime() - t2 = t1 + tuple(t1) - for i in xrange(len(t1)): - self.assertEqual(t2[i], t2[i+len(t1)]) - - def test_repeat(self): - t1 = time.gmtime() - t2 = 3 * t1 - for i in xrange(len(t1)): - self.assertEqual(t2[i], t2[i+len(t1)]) - self.assertEqual(t2[i], t2[i+2*len(t1)]) - - def test_contains(self): - t1 = time.gmtime() - for item in t1: - self.assert_(item in t1) - self.assert_(-42 not in t1) - - def test_hash(self): - t1 = time.gmtime() - self.assertEqual(hash(t1), hash(tuple(t1))) - - def test_cmp(self): - t1 = time.gmtime() - t2 = type(t1)(t1) - self.assertEqual(t1, t2) - self.assert_(not (t1 < t2)) - self.assert_(t1 <= t2) - self.assert_(not (t1 > t2)) - self.assert_(t1 >= t2) - self.assert_(not (t1 != t2)) - - def test_fields(self): - t = time.gmtime() - self.assertEqual(len(t), t.n_fields) - self.assertEqual(t.n_fields, t.n_sequence_fields+t.n_unnamed_fields) - - def test_constructor(self): - t = time.struct_time - - self.assertRaises(TypeError, t) - self.assertRaises(TypeError, t, None) - self.assertRaises(TypeError, t, "123") - self.assertRaises(TypeError, t, "123", dict={}) - self.assertRaises(TypeError, t, "123456789", dict=None) - - s = "123456789" - self.assertEqual("".join(t(s)), s) - - def test_eviltuple(self): - class Exc(Exception): - pass - - # Devious code could crash structseqs' contructors - class C: - def __getitem__(self, i): - raise Exc - def __len__(self): - return 9 - - self.assertRaises(Exc, time.struct_time, C()) - - def test_reduce(self): - t = time.gmtime() - x = t.__reduce__() - -def test_main(): - test_support.run_unittest(StructSeqTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_subprocess.py b/sys/lib/python/test/test_subprocess.py deleted file mode 100644 index c2db6fab2..000000000 --- a/sys/lib/python/test/test_subprocess.py +++ /dev/null @@ -1,653 +0,0 @@ -import unittest -from test import test_support -import subprocess -import sys -import signal -import os -import tempfile -import time -import re - -mswindows = (sys.platform == "win32") - -# -# Depends on the following external programs: Python -# - -if mswindows: - SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), ' - 'os.O_BINARY);') -else: - SETBINARY = '' - -# In a debug build, stuff like "[6580 refs]" is printed to stderr at -# shutdown time. That frustrates tests trying to check stderr produced -# from a spawned Python process. -def remove_stderr_debug_decorations(stderr): - return re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr) - -class ProcessTestCase(unittest.TestCase): - def setUp(self): - # Try to minimize the number of children we have so this test - # doesn't crash on some buildbots (Alphas in particular). - if hasattr(test_support, "reap_children"): - test_support.reap_children() - - def tearDown(self): - # Try to minimize the number of children we have so this test - # doesn't crash on some buildbots (Alphas in particular). - if hasattr(test_support, "reap_children"): - test_support.reap_children() - - def mkstemp(self): - """wrapper for mkstemp, calling mktemp if mkstemp is not available""" - if hasattr(tempfile, "mkstemp"): - return tempfile.mkstemp() - else: - fname = tempfile.mktemp() - return os.open(fname, os.O_RDWR|os.O_CREAT), fname - - # - # Generic tests - # - def test_call_seq(self): - # call() function with sequence argument - rc = subprocess.call([sys.executable, "-c", - "import sys; sys.exit(47)"]) - self.assertEqual(rc, 47) - - def test_check_call_zero(self): - # check_call() function with zero return code - rc = subprocess.check_call([sys.executable, "-c", - "import sys; sys.exit(0)"]) - self.assertEqual(rc, 0) - - def test_check_call_nonzero(self): - # check_call() function with non-zero return code - try: - subprocess.check_call([sys.executable, "-c", - "import sys; sys.exit(47)"]) - except subprocess.CalledProcessError, e: - self.assertEqual(e.returncode, 47) - else: - self.fail("Expected CalledProcessError") - - def test_call_kwargs(self): - # call() function with keyword args - newenv = os.environ.copy() - newenv["FRUIT"] = "banana" - rc = subprocess.call([sys.executable, "-c", - 'import sys, os;' \ - 'sys.exit(os.getenv("FRUIT")=="banana")'], - env=newenv) - self.assertEqual(rc, 1) - - def test_stdin_none(self): - # .stdin is None when not redirected - p = subprocess.Popen([sys.executable, "-c", 'print "banana"'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - p.wait() - self.assertEqual(p.stdin, None) - - def test_stdout_none(self): - # .stdout is None when not redirected - p = subprocess.Popen([sys.executable, "-c", - 'print " this bit of output is from a ' - 'test of stdout in a different ' - 'process ..."'], - stdin=subprocess.PIPE, stderr=subprocess.PIPE) - p.wait() - self.assertEqual(p.stdout, None) - - def test_stderr_none(self): - # .stderr is None when not redirected - p = subprocess.Popen([sys.executable, "-c", 'print "banana"'], - stdin=subprocess.PIPE, stdout=subprocess.PIPE) - p.wait() - self.assertEqual(p.stderr, None) - - def test_executable(self): - p = subprocess.Popen(["somethingyoudonthave", - "-c", "import sys; sys.exit(47)"], - executable=sys.executable) - p.wait() - self.assertEqual(p.returncode, 47) - - def test_stdin_pipe(self): - # stdin redirection - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.exit(sys.stdin.read() == "pear")'], - stdin=subprocess.PIPE) - p.stdin.write("pear") - p.stdin.close() - p.wait() - self.assertEqual(p.returncode, 1) - - def test_stdin_filedes(self): - # stdin is set to open file descriptor - tf = tempfile.TemporaryFile() - d = tf.fileno() - os.write(d, "pear") - os.lseek(d, 0, 0) - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.exit(sys.stdin.read() == "pear")'], - stdin=d) - p.wait() - self.assertEqual(p.returncode, 1) - - def test_stdin_fileobj(self): - # stdin is set to open file object - tf = tempfile.TemporaryFile() - tf.write("pear") - tf.seek(0) - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.exit(sys.stdin.read() == "pear")'], - stdin=tf) - p.wait() - self.assertEqual(p.returncode, 1) - - def test_stdout_pipe(self): - # stdout redirection - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.stdout.write("orange")'], - stdout=subprocess.PIPE) - self.assertEqual(p.stdout.read(), "orange") - - def test_stdout_filedes(self): - # stdout is set to open file descriptor - tf = tempfile.TemporaryFile() - d = tf.fileno() - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.stdout.write("orange")'], - stdout=d) - p.wait() - os.lseek(d, 0, 0) - self.assertEqual(os.read(d, 1024), "orange") - - def test_stdout_fileobj(self): - # stdout is set to open file object - tf = tempfile.TemporaryFile() - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.stdout.write("orange")'], - stdout=tf) - p.wait() - tf.seek(0) - self.assertEqual(tf.read(), "orange") - - def test_stderr_pipe(self): - # stderr redirection - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.stderr.write("strawberry")'], - stderr=subprocess.PIPE) - self.assertEqual(remove_stderr_debug_decorations(p.stderr.read()), - "strawberry") - - def test_stderr_filedes(self): - # stderr is set to open file descriptor - tf = tempfile.TemporaryFile() - d = tf.fileno() - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.stderr.write("strawberry")'], - stderr=d) - p.wait() - os.lseek(d, 0, 0) - self.assertEqual(remove_stderr_debug_decorations(os.read(d, 1024)), - "strawberry") - - def test_stderr_fileobj(self): - # stderr is set to open file object - tf = tempfile.TemporaryFile() - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.stderr.write("strawberry")'], - stderr=tf) - p.wait() - tf.seek(0) - self.assertEqual(remove_stderr_debug_decorations(tf.read()), - "strawberry") - - def test_stdout_stderr_pipe(self): - # capture stdout and stderr to the same pipe - p = subprocess.Popen([sys.executable, "-c", - 'import sys;' \ - 'sys.stdout.write("apple");' \ - 'sys.stdout.flush();' \ - 'sys.stderr.write("orange")'], - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - output = p.stdout.read() - stripped = remove_stderr_debug_decorations(output) - self.assertEqual(stripped, "appleorange") - - def test_stdout_stderr_file(self): - # capture stdout and stderr to the same open file - tf = tempfile.TemporaryFile() - p = subprocess.Popen([sys.executable, "-c", - 'import sys;' \ - 'sys.stdout.write("apple");' \ - 'sys.stdout.flush();' \ - 'sys.stderr.write("orange")'], - stdout=tf, - stderr=tf) - p.wait() - tf.seek(0) - output = tf.read() - stripped = remove_stderr_debug_decorations(output) - self.assertEqual(stripped, "appleorange") - - def test_stdout_filedes_of_stdout(self): - # stdout is set to 1 (#1531862). - cmd = r"import sys, os; sys.exit(os.write(sys.stdout.fileno(), '.\n'))" - rc = subprocess.call([sys.executable, "-c", cmd], stdout=1) - self.assertEquals(rc, 2) - - def test_cwd(self): - tmpdir = os.getenv("TEMP", "/tmp") - # We cannot use os.path.realpath to canonicalize the path, - # since it doesn't expand Tru64 {memb} strings. See bug 1063571. - cwd = os.getcwd() - os.chdir(tmpdir) - tmpdir = os.getcwd() - os.chdir(cwd) - p = subprocess.Popen([sys.executable, "-c", - 'import sys,os;' \ - 'sys.stdout.write(os.getcwd())'], - stdout=subprocess.PIPE, - cwd=tmpdir) - normcase = os.path.normcase - self.assertEqual(normcase(p.stdout.read()), normcase(tmpdir)) - - def test_env(self): - newenv = os.environ.copy() - newenv["FRUIT"] = "orange" - p = subprocess.Popen([sys.executable, "-c", - 'import sys,os;' \ - 'sys.stdout.write(os.getenv("FRUIT"))'], - stdout=subprocess.PIPE, - env=newenv) - self.assertEqual(p.stdout.read(), "orange") - - def test_communicate_stdin(self): - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.exit(sys.stdin.read() == "pear")'], - stdin=subprocess.PIPE) - p.communicate("pear") - self.assertEqual(p.returncode, 1) - - def test_communicate_stdout(self): - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.stdout.write("pineapple")'], - stdout=subprocess.PIPE) - (stdout, stderr) = p.communicate() - self.assertEqual(stdout, "pineapple") - self.assertEqual(stderr, None) - - def test_communicate_stderr(self): - p = subprocess.Popen([sys.executable, "-c", - 'import sys; sys.stderr.write("pineapple")'], - stderr=subprocess.PIPE) - (stdout, stderr) = p.communicate() - self.assertEqual(stdout, None) - # When running with a pydebug build, the # of references is outputted - # to stderr, so just check if stderr at least started with "pinapple" - self.assert_(stderr.startswith("pineapple")) - - def test_communicate(self): - p = subprocess.Popen([sys.executable, "-c", - 'import sys,os;' \ - 'sys.stderr.write("pineapple");' \ - 'sys.stdout.write(sys.stdin.read())'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - (stdout, stderr) = p.communicate("banana") - self.assertEqual(stdout, "banana") - self.assertEqual(remove_stderr_debug_decorations(stderr), - "pineapple") - - def test_communicate_returns(self): - # communicate() should return None if no redirection is active - p = subprocess.Popen([sys.executable, "-c", - "import sys; sys.exit(47)"]) - (stdout, stderr) = p.communicate() - self.assertEqual(stdout, None) - self.assertEqual(stderr, None) - - def test_communicate_pipe_buf(self): - # communicate() with writes larger than pipe_buf - # This test will probably deadlock rather than fail, if - # communicate() does not work properly. - x, y = os.pipe() - if mswindows: - pipe_buf = 512 - else: - pipe_buf = os.fpathconf(x, "PC_PIPE_BUF") - os.close(x) - os.close(y) - p = subprocess.Popen([sys.executable, "-c", - 'import sys,os;' - 'sys.stdout.write(sys.stdin.read(47));' \ - 'sys.stderr.write("xyz"*%d);' \ - 'sys.stdout.write(sys.stdin.read())' % pipe_buf], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - string_to_write = "abc"*pipe_buf - (stdout, stderr) = p.communicate(string_to_write) - self.assertEqual(stdout, string_to_write) - - def test_writes_before_communicate(self): - # stdin.write before communicate() - p = subprocess.Popen([sys.executable, "-c", - 'import sys,os;' \ - 'sys.stdout.write(sys.stdin.read())'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - p.stdin.write("banana") - (stdout, stderr) = p.communicate("split") - self.assertEqual(stdout, "bananasplit") - self.assertEqual(remove_stderr_debug_decorations(stderr), "") - - def test_universal_newlines(self): - p = subprocess.Popen([sys.executable, "-c", - 'import sys,os;' + SETBINARY + - 'sys.stdout.write("line1\\n");' - 'sys.stdout.flush();' - 'sys.stdout.write("line2\\r");' - 'sys.stdout.flush();' - 'sys.stdout.write("line3\\r\\n");' - 'sys.stdout.flush();' - 'sys.stdout.write("line4\\r");' - 'sys.stdout.flush();' - 'sys.stdout.write("\\nline5");' - 'sys.stdout.flush();' - 'sys.stdout.write("\\nline6");'], - stdout=subprocess.PIPE, - universal_newlines=1) - stdout = p.stdout.read() - if hasattr(file, 'newlines'): - # Interpreter with universal newline support - self.assertEqual(stdout, - "line1\nline2\nline3\nline4\nline5\nline6") - else: - # Interpreter without universal newline support - self.assertEqual(stdout, - "line1\nline2\rline3\r\nline4\r\nline5\nline6") - - def test_universal_newlines_communicate(self): - # universal newlines through communicate() - p = subprocess.Popen([sys.executable, "-c", - 'import sys,os;' + SETBINARY + - 'sys.stdout.write("line1\\n");' - 'sys.stdout.flush();' - 'sys.stdout.write("line2\\r");' - 'sys.stdout.flush();' - 'sys.stdout.write("line3\\r\\n");' - 'sys.stdout.flush();' - 'sys.stdout.write("line4\\r");' - 'sys.stdout.flush();' - 'sys.stdout.write("\\nline5");' - 'sys.stdout.flush();' - 'sys.stdout.write("\\nline6");'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE, - universal_newlines=1) - (stdout, stderr) = p.communicate() - if hasattr(file, 'newlines'): - # Interpreter with universal newline support - self.assertEqual(stdout, - "line1\nline2\nline3\nline4\nline5\nline6") - else: - # Interpreter without universal newline support - self.assertEqual(stdout, "line1\nline2\rline3\r\nline4\r\nline5\nline6") - - def test_no_leaking(self): - # Make sure we leak no resources - if not hasattr(test_support, "is_resource_enabled") \ - or test_support.is_resource_enabled("subprocess") and not mswindows: - max_handles = 1026 # too much for most UNIX systems - else: - max_handles = 65 - for i in range(max_handles): - p = subprocess.Popen([sys.executable, "-c", - "import sys;sys.stdout.write(sys.stdin.read())"], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - data = p.communicate("lime")[0] - self.assertEqual(data, "lime") - - - def test_list2cmdline(self): - self.assertEqual(subprocess.list2cmdline(['a b c', 'd', 'e']), - '"a b c" d e') - self.assertEqual(subprocess.list2cmdline(['ab"c', '\\', 'd']), - 'ab\\"c \\ d') - self.assertEqual(subprocess.list2cmdline(['a\\\\\\b', 'de fg', 'h']), - 'a\\\\\\b "de fg" h') - self.assertEqual(subprocess.list2cmdline(['a\\"b', 'c', 'd']), - 'a\\\\\\"b c d') - self.assertEqual(subprocess.list2cmdline(['a\\\\b c', 'd', 'e']), - '"a\\\\b c" d e') - self.assertEqual(subprocess.list2cmdline(['a\\\\b\\ c', 'd', 'e']), - '"a\\\\b\\ c" d e') - self.assertEqual(subprocess.list2cmdline(['ab', '']), - 'ab ""') - - - def test_poll(self): - p = subprocess.Popen([sys.executable, - "-c", "import time; time.sleep(1)"]) - count = 0 - while p.poll() is None: - time.sleep(0.1) - count += 1 - # We expect that the poll loop probably went around about 10 times, - # but, based on system scheduling we can't control, it's possible - # poll() never returned None. It "should be" very rare that it - # didn't go around at least twice. - self.assert_(count >= 2) - # Subsequent invocations should just return the returncode - self.assertEqual(p.poll(), 0) - - - def test_wait(self): - p = subprocess.Popen([sys.executable, - "-c", "import time; time.sleep(2)"]) - self.assertEqual(p.wait(), 0) - # Subsequent invocations should just return the returncode - self.assertEqual(p.wait(), 0) - - - def test_invalid_bufsize(self): - # an invalid type of the bufsize argument should raise - # TypeError. - try: - subprocess.Popen([sys.executable, "-c", "pass"], "orange") - except TypeError: - pass - else: - self.fail("Expected TypeError") - - # - # POSIX tests - # - if not mswindows: - def test_exceptions(self): - # catched & re-raised exceptions - try: - p = subprocess.Popen([sys.executable, "-c", ""], - cwd="/this/path/does/not/exist") - except OSError, e: - # The attribute child_traceback should contain "os.chdir" - # somewhere. - self.assertNotEqual(e.child_traceback.find("os.chdir"), -1) - else: - self.fail("Expected OSError") - - def _suppress_core_files(self): - """Try to prevent core files from being created. - Returns previous ulimit if successful, else None. - """ - try: - import resource - old_limit = resource.getrlimit(resource.RLIMIT_CORE) - resource.setrlimit(resource.RLIMIT_CORE, (0,0)) - return old_limit - except (ImportError, ValueError, resource.error): - return None - - def _unsuppress_core_files(self, old_limit): - """Return core file behavior to default.""" - if old_limit is None: - return - try: - import resource - resource.setrlimit(resource.RLIMIT_CORE, old_limit) - except (ImportError, ValueError, resource.error): - return - - def test_run_abort(self): - # returncode handles signal termination - old_limit = self._suppress_core_files() - try: - p = subprocess.Popen([sys.executable, - "-c", "import os; os.abort()"]) - finally: - self._unsuppress_core_files(old_limit) - p.wait() - self.assertEqual(-p.returncode, signal.SIGABRT) - - def test_preexec(self): - # preexec function - p = subprocess.Popen([sys.executable, "-c", - 'import sys,os;' \ - 'sys.stdout.write(os.getenv("FRUIT"))'], - stdout=subprocess.PIPE, - preexec_fn=lambda: os.putenv("FRUIT", "apple")) - self.assertEqual(p.stdout.read(), "apple") - - def test_args_string(self): - # args is a string - f, fname = self.mkstemp() - os.write(f, "#!/bin/sh\n") - os.write(f, "exec %s -c 'import sys; sys.exit(47)'\n" % - sys.executable) - os.close(f) - os.chmod(fname, 0700) - p = subprocess.Popen(fname) - p.wait() - os.remove(fname) - self.assertEqual(p.returncode, 47) - - def test_invalid_args(self): - # invalid arguments should raise ValueError - self.assertRaises(ValueError, subprocess.call, - [sys.executable, - "-c", "import sys; sys.exit(47)"], - startupinfo=47) - self.assertRaises(ValueError, subprocess.call, - [sys.executable, - "-c", "import sys; sys.exit(47)"], - creationflags=47) - - def test_shell_sequence(self): - # Run command through the shell (sequence) - newenv = os.environ.copy() - newenv["FRUIT"] = "apple" - p = subprocess.Popen(["echo $FRUIT"], shell=1, - stdout=subprocess.PIPE, - env=newenv) - self.assertEqual(p.stdout.read().strip(), "apple") - - def test_shell_string(self): - # Run command through the shell (string) - newenv = os.environ.copy() - newenv["FRUIT"] = "apple" - p = subprocess.Popen("echo $FRUIT", shell=1, - stdout=subprocess.PIPE, - env=newenv) - self.assertEqual(p.stdout.read().strip(), "apple") - - def test_call_string(self): - # call() function with string argument on UNIX - f, fname = self.mkstemp() - os.write(f, "#!/bin/sh\n") - os.write(f, "exec %s -c 'import sys; sys.exit(47)'\n" % - sys.executable) - os.close(f) - os.chmod(fname, 0700) - rc = subprocess.call(fname) - os.remove(fname) - self.assertEqual(rc, 47) - - - # - # Windows tests - # - if mswindows: - def test_startupinfo(self): - # startupinfo argument - # We uses hardcoded constants, because we do not want to - # depend on win32all. - STARTF_USESHOWWINDOW = 1 - SW_MAXIMIZE = 3 - startupinfo = subprocess.STARTUPINFO() - startupinfo.dwFlags = STARTF_USESHOWWINDOW - startupinfo.wShowWindow = SW_MAXIMIZE - # Since Python is a console process, it won't be affected - # by wShowWindow, but the argument should be silently - # ignored - subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"], - startupinfo=startupinfo) - - def test_creationflags(self): - # creationflags argument - CREATE_NEW_CONSOLE = 16 - sys.stderr.write(" a DOS box should flash briefly ...\n") - subprocess.call(sys.executable + - ' -c "import time; time.sleep(0.25)"', - creationflags=CREATE_NEW_CONSOLE) - - def test_invalid_args(self): - # invalid arguments should raise ValueError - self.assertRaises(ValueError, subprocess.call, - [sys.executable, - "-c", "import sys; sys.exit(47)"], - preexec_fn=lambda: 1) - self.assertRaises(ValueError, subprocess.call, - [sys.executable, - "-c", "import sys; sys.exit(47)"], - close_fds=True) - - def test_shell_sequence(self): - # Run command through the shell (sequence) - newenv = os.environ.copy() - newenv["FRUIT"] = "physalis" - p = subprocess.Popen(["set"], shell=1, - stdout=subprocess.PIPE, - env=newenv) - self.assertNotEqual(p.stdout.read().find("physalis"), -1) - - def test_shell_string(self): - # Run command through the shell (string) - newenv = os.environ.copy() - newenv["FRUIT"] = "physalis" - p = subprocess.Popen("set", shell=1, - stdout=subprocess.PIPE, - env=newenv) - self.assertNotEqual(p.stdout.read().find("physalis"), -1) - - def test_call_string(self): - # call() function with string argument on Windows - rc = subprocess.call(sys.executable + - ' -c "import sys; sys.exit(47)"') - self.assertEqual(rc, 47) - - -def test_main(): - test_support.run_unittest(ProcessTestCase) - if hasattr(test_support, "reap_children"): - test_support.reap_children() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_sunaudiodev.py b/sys/lib/python/test/test_sunaudiodev.py deleted file mode 100644 index f203d9a30..000000000 --- a/sys/lib/python/test/test_sunaudiodev.py +++ /dev/null @@ -1,28 +0,0 @@ -from test.test_support import verbose, findfile, TestFailed, TestSkipped -import sunaudiodev -import os - -try: - audiodev = os.environ["AUDIODEV"] -except KeyError: - audiodev = "/dev/audio" - -if not os.path.exists(audiodev): - raise TestSkipped("no audio device found!") - -def play_sound_file(path): - fp = open(path, 'r') - data = fp.read() - fp.close() - try: - a = sunaudiodev.open('w') - except sunaudiodev.error, msg: - raise TestFailed, msg - else: - a.write(data) - a.close() - -def test(): - play_sound_file(findfile('audiotest.au')) - -test() diff --git a/sys/lib/python/test/test_sundry.py b/sys/lib/python/test/test_sundry.py deleted file mode 100644 index f19467c76..000000000 --- a/sys/lib/python/test/test_sundry.py +++ /dev/null @@ -1,77 +0,0 @@ -"""Do a minimal test of all the modules that aren't otherwise tested.""" - -import warnings -warnings.filterwarnings('ignore', r".*posixfile module", - DeprecationWarning, 'posixfile$') - -warnings.filterwarnings("ignore", - "the gopherlib module is deprecated", - DeprecationWarning, - ".*test_sundry") - -from test.test_support import verbose - -import BaseHTTPServer -import DocXMLRPCServer -import CGIHTTPServer -import SimpleHTTPServer -import SimpleXMLRPCServer -import aifc -import audiodev -import bdb -import cgitb -import cmd -import code -import compileall -import encodings -import formatter -import ftplib -import getpass -import gopherlib -import htmlentitydefs -import ihooks -import imghdr -import imputil -import keyword -import linecache -import macurl2path -import mailcap -import mimify -import mutex -import nntplib -import nturl2path -import opcode -import os2emxpath -import pdb -import pipes -#import poplib -import posixfile -import pstats -import py_compile -import pydoc -import rexec -import rlcompleter -import sched -import smtplib -import sndhdr -import statvfs -import stringold -import sunau -import sunaudio -import symbol -import tabnanny -import telnetlib -import timeit -import toaiff -import token -try: - import tty # not available on Windows -except ImportError: - if verbose: - print "skipping tty" - -# Can't test the "user" module -- if the user has a ~/.pythonrc.py, it -# can screw up all sorts of things (esp. if it prints!). -#import user -import webbrowser -import xml diff --git a/sys/lib/python/test/test_support.py b/sys/lib/python/test/test_support.py deleted file mode 100644 index a9d5dabcc..000000000 --- a/sys/lib/python/test/test_support.py +++ /dev/null @@ -1,517 +0,0 @@ -"""Supporting definitions for the Python regression tests.""" - -if __name__ != 'test.test_support': - raise ImportError, 'test_support must be imported from the test package' - -import sys - -class Error(Exception): - """Base class for regression test exceptions.""" - -class TestFailed(Error): - """Test failed.""" - -class TestSkipped(Error): - """Test skipped. - - This can be raised to indicate that a test was deliberatly - skipped, but not because a feature wasn't available. For - example, if some resource can't be used, such as the network - appears to be unavailable, this should be raised instead of - TestFailed. - """ - -class ResourceDenied(TestSkipped): - """Test skipped because it requested a disallowed resource. - - This is raised when a test calls requires() for a resource that - has not be enabled. It is used to distinguish between expected - and unexpected skips. - """ - -verbose = 1 # Flag set to 0 by regrtest.py -use_resources = None # Flag set to [] by regrtest.py -max_memuse = 0 # Disable bigmem tests (they will still be run with - # small sizes, to make sure they work.) - -# _original_stdout is meant to hold stdout at the time regrtest began. -# This may be "the real" stdout, or IDLE's emulation of stdout, or whatever. -# The point is to have some flavor of stdout the user can actually see. -_original_stdout = None -def record_original_stdout(stdout): - global _original_stdout - _original_stdout = stdout - -def get_original_stdout(): - return _original_stdout or sys.stdout - -def unload(name): - try: - del sys.modules[name] - except KeyError: - pass - -def unlink(filename): - import os - try: - os.unlink(filename) - except OSError: - pass - -def forget(modname): - '''"Forget" a module was ever imported by removing it from sys.modules and - deleting any .pyc and .pyo files.''' - unload(modname) - import os - for dirname in sys.path: - unlink(os.path.join(dirname, modname + os.extsep + 'pyc')) - # Deleting the .pyo file cannot be within the 'try' for the .pyc since - # the chance exists that there is no .pyc (and thus the 'try' statement - # is exited) but there is a .pyo file. - unlink(os.path.join(dirname, modname + os.extsep + 'pyo')) - -def is_resource_enabled(resource): - """Test whether a resource is enabled. Known resources are set by - regrtest.py.""" - return use_resources is not None and resource in use_resources - -def requires(resource, msg=None): - """Raise ResourceDenied if the specified resource is not available. - - If the caller's module is __main__ then automatically return True. The - possibility of False being returned occurs when regrtest.py is executing.""" - # see if the caller's module is __main__ - if so, treat as if - # the resource was set - if sys._getframe().f_back.f_globals.get("__name__") == "__main__": - return - if not is_resource_enabled(resource): - if msg is None: - msg = "Use of the `%s' resource not enabled" % resource - raise ResourceDenied(msg) - -def bind_port(sock, host='', preferred_port=54321): - """Try to bind the sock to a port. If we are running multiple - tests and we don't try multiple ports, the test can fails. This - makes the test more robust.""" - - import socket, errno - # some random ports that hopefully no one is listening on. - for port in [preferred_port, 9907, 10243, 32999]: - try: - sock.bind((host, port)) - return port - except socket.error, (err, msg): - if err != errno.EADDRINUSE: - raise - print >>sys.__stderr__, \ - ' WARNING: failed to listen on port %d, trying another' % port - raise TestFailed, 'unable to find port to listen on' - -FUZZ = 1e-6 - -def fcmp(x, y): # fuzzy comparison function - if type(x) == type(0.0) or type(y) == type(0.0): - try: - x, y = coerce(x, y) - fuzz = (abs(x) + abs(y)) * FUZZ - if abs(x-y) <= fuzz: - return 0 - except: - pass - elif type(x) == type(y) and type(x) in (type(()), type([])): - for i in range(min(len(x), len(y))): - outcome = fcmp(x[i], y[i]) - if outcome != 0: - return outcome - return cmp(len(x), len(y)) - return cmp(x, y) - -try: - unicode - have_unicode = 1 -except NameError: - have_unicode = 0 - -is_jython = sys.platform.startswith('java') - -import os -# Filename used for testing -if os.name == 'java': - # Jython disallows @ in module names - TESTFN = '$test' -elif os.name == 'riscos': - TESTFN = 'testfile' -else: - TESTFN = '@test' - # Unicode name only used if TEST_FN_ENCODING exists for the platform. - if have_unicode: - # Assuming sys.getfilesystemencoding()!=sys.getdefaultencoding() - # TESTFN_UNICODE is a filename that can be encoded using the - # file system encoding, but *not* with the default (ascii) encoding - if isinstance('', unicode): - # python -U - # XXX perhaps unicode() should accept Unicode strings? - TESTFN_UNICODE = "@test-\xe0\xf2" - else: - # 2 latin characters. - TESTFN_UNICODE = unicode("@test-\xe0\xf2", "latin-1") - TESTFN_ENCODING = sys.getfilesystemencoding() - # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be - # able to be encoded by *either* the default or filesystem encoding. - # This test really only makes sense on Windows NT platforms - # which have special Unicode support in posixmodule. - if (not hasattr(sys, "getwindowsversion") or - sys.getwindowsversion()[3] < 2): # 0=win32s or 1=9x/ME - TESTFN_UNICODE_UNENCODEABLE = None - else: - # Japanese characters (I think - from bug 846133) - TESTFN_UNICODE_UNENCODEABLE = eval('u"@test-\u5171\u6709\u3055\u308c\u308b"') - try: - # XXX - Note - should be using TESTFN_ENCODING here - but for - # Windows, "mbcs" currently always operates as if in - # errors=ignore' mode - hence we get '?' characters rather than - # the exception. 'Latin1' operates as we expect - ie, fails. - # See [ 850997 ] mbcs encoding ignores errors - TESTFN_UNICODE_UNENCODEABLE.encode("Latin1") - except UnicodeEncodeError: - pass - else: - print \ - 'WARNING: The filename %r CAN be encoded by the filesystem. ' \ - 'Unicode filename tests may not be effective' \ - % TESTFN_UNICODE_UNENCODEABLE - -# Make sure we can write to TESTFN, try in /tmp if we can't -fp = None -try: - fp = open(TESTFN, 'w+') -except IOError: - TMP_TESTFN = os.path.join('/tmp', TESTFN) - try: - fp = open(TMP_TESTFN, 'w+') - TESTFN = TMP_TESTFN - del TMP_TESTFN - except IOError: - print ('WARNING: tests will fail, unable to write to: %s or %s' % - (TESTFN, TMP_TESTFN)) -if fp is not None: - fp.close() - unlink(TESTFN) -del os, fp - -def findfile(file, here=__file__): - """Try to find a file on sys.path and the working directory. If it is not - found the argument passed to the function is returned (this does not - necessarily signal failure; could still be the legitimate path).""" - import os - if os.path.isabs(file): - return file - path = sys.path - path = [os.path.dirname(here)] + path - for dn in path: - fn = os.path.join(dn, file) - if os.path.exists(fn): return fn - return file - -def verify(condition, reason='test failed'): - """Verify that condition is true. If not, raise TestFailed. - - The optional argument reason can be given to provide - a better error text. - """ - - if not condition: - raise TestFailed(reason) - -def vereq(a, b): - """Raise TestFailed if a == b is false. - - This is better than verify(a == b) because, in case of failure, the - error message incorporates repr(a) and repr(b) so you can see the - inputs. - - Note that "not (a == b)" isn't necessarily the same as "a != b"; the - former is tested. - """ - - if not (a == b): - raise TestFailed, "%r == %r" % (a, b) - -def sortdict(dict): - "Like repr(dict), but in sorted order." - items = dict.items() - items.sort() - reprpairs = ["%r: %r" % pair for pair in items] - withcommas = ", ".join(reprpairs) - return "{%s}" % withcommas - -def check_syntax(statement): - try: - compile(statement, '', 'exec') - except SyntaxError: - pass - else: - print 'Missing SyntaxError: "%s"' % statement - -def open_urlresource(url): - import urllib, urlparse - import os.path - - filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL! - - for path in [os.path.curdir, os.path.pardir]: - fn = os.path.join(path, filename) - if os.path.exists(fn): - return open(fn) - - requires('urlfetch') - print >> get_original_stdout(), '\tfetching %s ...' % url - fn, _ = urllib.urlretrieve(url, filename) - return open(fn) - -#======================================================================= -# Decorator for running a function in a different locale, correctly resetting -# it afterwards. - -def run_with_locale(catstr, *locales): - def decorator(func): - def inner(*args, **kwds): - try: - import locale - category = getattr(locale, catstr) - orig_locale = locale.setlocale(category) - except AttributeError: - # if the test author gives us an invalid category string - raise - except: - # cannot retrieve original locale, so do nothing - locale = orig_locale = None - else: - for loc in locales: - try: - locale.setlocale(category, loc) - break - except: - pass - - # now run the function, resetting the locale on exceptions - try: - return func(*args, **kwds) - finally: - if locale and orig_locale: - locale.setlocale(category, orig_locale) - inner.func_name = func.func_name - inner.__doc__ = func.__doc__ - return inner - return decorator - -#======================================================================= -# Big-memory-test support. Separate from 'resources' because memory use should be configurable. - -# Some handy shorthands. Note that these are used for byte-limits as well -# as size-limits, in the various bigmem tests -_1M = 1024*1024 -_1G = 1024 * _1M -_2G = 2 * _1G - -# Hack to get at the maximum value an internal index can take. -class _Dummy: - def __getslice__(self, i, j): - return j -MAX_Py_ssize_t = _Dummy()[:] - -def set_memlimit(limit): - import re - global max_memuse - sizes = { - 'k': 1024, - 'm': _1M, - 'g': _1G, - 't': 1024*_1G, - } - m = re.match(r'(\d+(\.\d+)?) (K|M|G|T)b?$', limit, - re.IGNORECASE | re.VERBOSE) - if m is None: - raise ValueError('Invalid memory limit %r' % (limit,)) - memlimit = int(float(m.group(1)) * sizes[m.group(3).lower()]) - if memlimit > MAX_Py_ssize_t: - memlimit = MAX_Py_ssize_t - if memlimit < _2G - 1: - raise ValueError('Memory limit %r too low to be useful' % (limit,)) - max_memuse = memlimit - -def bigmemtest(minsize, memuse, overhead=5*_1M): - """Decorator for bigmem tests. - - 'minsize' is the minimum useful size for the test (in arbitrary, - test-interpreted units.) 'memuse' is the number of 'bytes per size' for - the test, or a good estimate of it. 'overhead' specifies fixed overhead, - independant of the testsize, and defaults to 5Mb. - - The decorator tries to guess a good value for 'size' and passes it to - the decorated test function. If minsize * memuse is more than the - allowed memory use (as defined by max_memuse), the test is skipped. - Otherwise, minsize is adjusted upward to use up to max_memuse. - """ - def decorator(f): - def wrapper(self): - if not max_memuse: - # If max_memuse is 0 (the default), - # we still want to run the tests with size set to a few kb, - # to make sure they work. We still want to avoid using - # too much memory, though, but we do that noisily. - maxsize = 5147 - self.failIf(maxsize * memuse + overhead > 20 * _1M) - else: - maxsize = int((max_memuse - overhead) / memuse) - if maxsize < minsize: - # Really ought to print 'test skipped' or something - if verbose: - sys.stderr.write("Skipping %s because of memory " - "constraint\n" % (f.__name__,)) - return - # Try to keep some breathing room in memory use - maxsize = max(maxsize - 50 * _1M, minsize) - return f(self, maxsize) - wrapper.minsize = minsize - wrapper.memuse = memuse - wrapper.overhead = overhead - return wrapper - return decorator - -def bigaddrspacetest(f): - """Decorator for tests that fill the address space.""" - def wrapper(self): - if max_memuse < MAX_Py_ssize_t: - if verbose: - sys.stderr.write("Skipping %s because of memory " - "constraint\n" % (f.__name__,)) - else: - return f(self) - return wrapper - -#======================================================================= -# Preliminary PyUNIT integration. - -import unittest - - -class BasicTestRunner: - def run(self, test): - result = unittest.TestResult() - test(result) - return result - - -def run_suite(suite, testclass=None): - """Run tests from a unittest.TestSuite-derived class.""" - if verbose: - runner = unittest.TextTestRunner(sys.stdout, verbosity=2) - else: - runner = BasicTestRunner() - - result = runner.run(suite) - if not result.wasSuccessful(): - if len(result.errors) == 1 and not result.failures: - err = result.errors[0][1] - elif len(result.failures) == 1 and not result.errors: - err = result.failures[0][1] - else: - if testclass is None: - msg = "errors occurred; run in verbose mode for details" - else: - msg = "errors occurred in %s.%s" \ - % (testclass.__module__, testclass.__name__) - raise TestFailed(msg) - raise TestFailed(err) - - -def run_unittest(*classes): - """Run tests from unittest.TestCase-derived classes.""" - suite = unittest.TestSuite() - for cls in classes: - if isinstance(cls, (unittest.TestSuite, unittest.TestCase)): - suite.addTest(cls) - else: - suite.addTest(unittest.makeSuite(cls)) - if len(classes)==1: - testclass = classes[0] - else: - testclass = None - run_suite(suite, testclass) - - -#======================================================================= -# doctest driver. - -def run_doctest(module, verbosity=None): - """Run doctest on the given module. Return (#failures, #tests). - - If optional argument verbosity is not specified (or is None), pass - test_support's belief about verbosity on to doctest. Else doctest's - usual behavior is used (it searches sys.argv for -v). - """ - - import doctest - - if verbosity is None: - verbosity = verbose - else: - verbosity = None - - # Direct doctest output (normally just errors) to real stdout; doctest - # output shouldn't be compared by regrtest. - save_stdout = sys.stdout - sys.stdout = get_original_stdout() - try: - f, t = doctest.testmod(module, verbose=verbosity) - if f: - raise TestFailed("%d of %d doctests failed" % (f, t)) - finally: - sys.stdout = save_stdout - if verbose: - print 'doctest (%s) ... %d tests with zero failures' % (module.__name__, t) - return f, t - -#======================================================================= -# Threading support to prevent reporting refleaks when running regrtest.py -R - -def threading_setup(): - import threading - return len(threading._active), len(threading._limbo) - -def threading_cleanup(num_active, num_limbo): - import threading - import time - - _MAX_COUNT = 10 - count = 0 - while len(threading._active) != num_active and count < _MAX_COUNT: - count += 1 - time.sleep(0.1) - - count = 0 - while len(threading._limbo) != num_limbo and count < _MAX_COUNT: - count += 1 - time.sleep(0.1) - -def reap_children(): - """Use this function at the end of test_main() whenever sub-processes - are started. This will help ensure that no extra children (zombies) - stick around to hog resources and create problems when looking - for refleaks. - """ - - # Reap all our dead child processes so we don't leave zombies around. - # These hog resources and might be causing some of the buildbots to die. - import os - if hasattr(os, 'waitpid'): - any_process = -1 - while True: - try: - # This will raise an exception on Windows. That's ok. - pid, status = os.waitpid(any_process, os.WNOHANG) - if pid == 0: - break - except: - break diff --git a/sys/lib/python/test/test_symtable.py b/sys/lib/python/test/test_symtable.py deleted file mode 100644 index 74a7c8559..000000000 --- a/sys/lib/python/test/test_symtable.py +++ /dev/null @@ -1,44 +0,0 @@ -from test import test_support - -import symtable -import unittest - - -## XXX -## Test disabled because symtable module needs to be rewritten for new compiler - -##vereq(symbols[0].name, "global") -##vereq(len([ste for ste in symbols.values() if ste.name == "f"]), 1) - -### Bug tickler: SyntaxError file name correct whether error raised -### while parsing or building symbol table. -##def checkfilename(brokencode): -## try: -## _symtable.symtable(brokencode, "spam", "exec") -## except SyntaxError, e: -## vereq(e.filename, "spam") -## else: -## raise TestFailed("no SyntaxError for %r" % (brokencode,)) -##checkfilename("def f(x): foo)(") # parse-time -##checkfilename("def f(x): global x") # symtable-build-time - -class SymtableTest(unittest.TestCase): - def test_invalid_args(self): - self.assertRaises(TypeError, symtable.symtable, "42") - self.assertRaises(ValueError, symtable.symtable, "42", "?", "") - - def test_eval(self): - symbols = symtable.symtable("42", "?", "eval") - - def test_single(self): - symbols = symtable.symtable("42", "?", "single") - - def test_exec(self): - symbols = symtable.symtable("def f(x): return x", "?", "exec") - - -def test_main(): - test_support.run_unittest(SymtableTest) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_syntax.py b/sys/lib/python/test/test_syntax.py deleted file mode 100644 index ef8e9a24c..000000000 --- a/sys/lib/python/test/test_syntax.py +++ /dev/null @@ -1,500 +0,0 @@ -"""This module tests SyntaxErrors. - -Here's an example of the sort of thing that is tested. - ->>> def f(x): -... global x -Traceback (most recent call last): -SyntaxError: name 'x' is local and global - -The tests are all raise SyntaxErrors. They were created by checking -each C call that raises SyntaxError. There are several modules that -raise these exceptions-- ast.c, compile.c, future.c, pythonrun.c, and -symtable.c. - -The parser itself outlaws a lot of invalid syntax. None of these -errors are tested here at the moment. We should add some tests; since -there are infinitely many programs with invalid syntax, we would need -to be judicious in selecting some. - -The compiler generates a synthetic module name for code executed by -doctest. Since all the code comes from the same module, a suffix like -[1] is appended to the module name, As a consequence, changing the -order of tests in this module means renumbering all the errors after -it. (Maybe we should enable the ellipsis option for these tests.) - -In ast.c, syntax errors are raised by calling ast_error(). - -Errors from set_context(): - -TODO(jhylton): "assignment to None" is inconsistent with other messages - ->>> obj.None = 1 -Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) - ->>> None = 1 -Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) - -It's a syntax error to assign to the empty tuple. Why isn't it an -error to assign to the empty list? It will always raise some error at -runtime. - ->>> () = 1 -Traceback (most recent call last): -SyntaxError: can't assign to () (, line 1) - ->>> f() = 1 -Traceback (most recent call last): -SyntaxError: can't assign to function call (, line 1) - ->>> del f() -Traceback (most recent call last): -SyntaxError: can't delete function call (, line 1) - ->>> a + 1 = 2 -Traceback (most recent call last): -SyntaxError: can't assign to operator (, line 1) - ->>> (x for x in x) = 1 -Traceback (most recent call last): -SyntaxError: can't assign to generator expression (, line 1) - ->>> 1 = 1 -Traceback (most recent call last): -SyntaxError: can't assign to literal (, line 1) - ->>> "abc" = 1 -Traceback (most recent call last): -SyntaxError: can't assign to literal (, line 1) - ->>> `1` = 1 -Traceback (most recent call last): -SyntaxError: can't assign to repr (, line 1) - -If the left-hand side of an assignment is a list or tuple, an illegal -expression inside that contain should still cause a syntax error. -This test just checks a couple of cases rather than enumerating all of -them. - ->>> (a, "b", c) = (1, 2, 3) -Traceback (most recent call last): -SyntaxError: can't assign to literal (, line 1) - ->>> [a, b, c + 1] = [1, 2, 3] -Traceback (most recent call last): -SyntaxError: can't assign to operator (, line 1) - ->>> a if 1 else b = 1 -Traceback (most recent call last): -SyntaxError: can't assign to conditional expression (, line 1) - -From compiler_complex_args(): - ->>> def f(None=1): -... pass -Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) - - -From ast_for_arguments(): - ->>> def f(x, y=1, z): -... pass -Traceback (most recent call last): -SyntaxError: non-default argument follows default argument (, line 1) - ->>> def f(x, None): -... pass -Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) - ->>> def f(*None): -... pass -Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) - ->>> def f(**None): -... pass -Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) - - -From ast_for_funcdef(): - ->>> def None(x): -... pass -Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) - - -From ast_for_call(): - ->>> def f(it, *varargs): -... return list(it) ->>> L = range(10) ->>> f(x for x in L) -[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ->>> f(x for x in L, 1) -Traceback (most recent call last): -SyntaxError: Generator expression must be parenthesized if not sole argument (, line 1) ->>> f((x for x in L), 1) -[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - ->>> f(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, -... i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, -... i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, -... i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, -... i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, -... i56, i57, i58, i59, i60, i61, i62, i63, i64, i65, i66, -... i67, i68, i69, i70, i71, i72, i73, i74, i75, i76, i77, -... i78, i79, i80, i81, i82, i83, i84, i85, i86, i87, i88, -... i89, i90, i91, i92, i93, i94, i95, i96, i97, i98, i99, -... i100, i101, i102, i103, i104, i105, i106, i107, i108, -... i109, i110, i111, i112, i113, i114, i115, i116, i117, -... i118, i119, i120, i121, i122, i123, i124, i125, i126, -... i127, i128, i129, i130, i131, i132, i133, i134, i135, -... i136, i137, i138, i139, i140, i141, i142, i143, i144, -... i145, i146, i147, i148, i149, i150, i151, i152, i153, -... i154, i155, i156, i157, i158, i159, i160, i161, i162, -... i163, i164, i165, i166, i167, i168, i169, i170, i171, -... i172, i173, i174, i175, i176, i177, i178, i179, i180, -... i181, i182, i183, i184, i185, i186, i187, i188, i189, -... i190, i191, i192, i193, i194, i195, i196, i197, i198, -... i199, i200, i201, i202, i203, i204, i205, i206, i207, -... i208, i209, i210, i211, i212, i213, i214, i215, i216, -... i217, i218, i219, i220, i221, i222, i223, i224, i225, -... i226, i227, i228, i229, i230, i231, i232, i233, i234, -... i235, i236, i237, i238, i239, i240, i241, i242, i243, -... i244, i245, i246, i247, i248, i249, i250, i251, i252, -... i253, i254, i255) -Traceback (most recent call last): -SyntaxError: more than 255 arguments (, line 1) - -The actual error cases counts positional arguments, keyword arguments, -and generator expression arguments separately. This test combines the -three. - ->>> f(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, -... i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, -... i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, -... i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, -... i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, -... i56, i57, i58, i59, i60, i61, i62, i63, i64, i65, i66, -... i67, i68, i69, i70, i71, i72, i73, i74, i75, i76, i77, -... i78, i79, i80, i81, i82, i83, i84, i85, i86, i87, i88, -... i89, i90, i91, i92, i93, i94, i95, i96, i97, i98, i99, -... i100, i101, i102, i103, i104, i105, i106, i107, i108, -... i109, i110, i111, i112, i113, i114, i115, i116, i117, -... i118, i119, i120, i121, i122, i123, i124, i125, i126, -... i127, i128, i129, i130, i131, i132, i133, i134, i135, -... i136, i137, i138, i139, i140, i141, i142, i143, i144, -... i145, i146, i147, i148, i149, i150, i151, i152, i153, -... i154, i155, i156, i157, i158, i159, i160, i161, i162, -... i163, i164, i165, i166, i167, i168, i169, i170, i171, -... i172, i173, i174, i175, i176, i177, i178, i179, i180, -... i181, i182, i183, i184, i185, i186, i187, i188, i189, -... i190, i191, i192, i193, i194, i195, i196, i197, i198, -... i199, i200, i201, i202, i203, i204, i205, i206, i207, -... i208, i209, i210, i211, i212, i213, i214, i215, i216, -... i217, i218, i219, i220, i221, i222, i223, i224, i225, -... i226, i227, i228, i229, i230, i231, i232, i233, i234, -... i235, i236, i237, i238, i239, i240, i241, i242, i243, -... (x for x in i244), i245, i246, i247, i248, i249, i250, i251, -... i252=1, i253=1, i254=1, i255=1) -Traceback (most recent call last): -SyntaxError: more than 255 arguments (, line 1) - ->>> f(lambda x: x[0] = 3) -Traceback (most recent call last): -SyntaxError: lambda cannot contain assignment (, line 1) - -The grammar accepts any test (basically, any expression) in the -keyword slot of a call site. Test a few different options. - ->>> f(x()=2) -Traceback (most recent call last): -SyntaxError: keyword can't be an expression (, line 1) ->>> f(a or b=1) -Traceback (most recent call last): -SyntaxError: keyword can't be an expression (, line 1) ->>> f(x.y=1) -Traceback (most recent call last): -SyntaxError: keyword can't be an expression (, line 1) - - -From ast_for_expr_stmt(): - ->>> (x for x in x) += 1 -Traceback (most recent call last): -SyntaxError: augmented assignment to generator expression not possible (, line 1) ->>> None += 1 -Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) ->>> f() += 1 -Traceback (most recent call last): -SyntaxError: illegal expression for augmented assignment (, line 1) - - -Test continue in finally in weird combinations. - -continue in for loop under finally shouuld be ok. - - >>> def test(): - ... try: - ... pass - ... finally: - ... for abc in range(10): - ... continue - ... print abc - >>> test() - 9 - -Start simple, a continue in a finally should not be allowed. - - >>> def test(): - ... for abc in range(10): - ... try: - ... pass - ... finally: - ... continue - ... - Traceback (most recent call last): - ... - SyntaxError: 'continue' not supported inside 'finally' clause (, line 6) - -This is essentially a continue in a finally which should not be allowed. - - >>> def test(): - ... for abc in range(10): - ... try: - ... pass - ... finally: - ... try: - ... continue - ... except: - ... pass - Traceback (most recent call last): - ... - SyntaxError: 'continue' not supported inside 'finally' clause (, line 7) - - >>> def foo(): - ... try: - ... pass - ... finally: - ... continue - Traceback (most recent call last): - ... - SyntaxError: 'continue' not supported inside 'finally' clause (, line 5) - - >>> def foo(): - ... for a in (): - ... try: pass - ... finally: continue - Traceback (most recent call last): - ... - SyntaxError: 'continue' not supported inside 'finally' clause (, line 4) - - >>> def foo(): - ... for a in (): - ... try: pass - ... finally: - ... try: - ... continue - ... finally: pass - Traceback (most recent call last): - ... - SyntaxError: 'continue' not supported inside 'finally' clause (, line 6) - - >>> def foo(): - ... for a in (): - ... try: pass - ... finally: - ... try: - ... pass - ... except: - ... continue - Traceback (most recent call last): - ... - SyntaxError: 'continue' not supported inside 'finally' clause (, line 8) - -There is one test for a break that is not in a loop. The compiler -uses a single data structure to keep track of try-finally and loops, -so we need to be sure that a break is actually inside a loop. If it -isn't, there should be a syntax error. - - >>> try: - ... print 1 - ... break - ... print 2 - ... finally: - ... print 3 - Traceback (most recent call last): - ... - SyntaxError: 'break' outside loop (, line 3) - -This should probably raise a better error than a SystemError (or none at all). -In 2.5 there was a missing exception and an assert was triggered in a debug -build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514 - - >>> while 1: - ... while 2: - ... while 3: - ... while 4: - ... while 5: - ... while 6: - ... while 8: - ... while 9: - ... while 10: - ... while 11: - ... while 12: - ... while 13: - ... while 14: - ... while 15: - ... while 16: - ... while 17: - ... while 18: - ... while 19: - ... while 20: - ... while 21: - ... while 22: - ... break - Traceback (most recent call last): - ... - SystemError: too many statically nested blocks - -This tests assignment-context; there was a bug in Python 2.5 where compiling -a complex 'if' (one with 'elif') would fail to notice an invalid suite, -leading to spurious errors. - - >>> if 1: - ... x() = 1 - ... elif 1: - ... pass - Traceback (most recent call last): - ... - SyntaxError: can't assign to function call (, line 2) - - >>> if 1: - ... pass - ... elif 1: - ... x() = 1 - Traceback (most recent call last): - ... - SyntaxError: can't assign to function call (, line 4) - - >>> if 1: - ... x() = 1 - ... elif 1: - ... pass - ... else: - ... pass - Traceback (most recent call last): - ... - SyntaxError: can't assign to function call (, line 2) - - >>> if 1: - ... pass - ... elif 1: - ... x() = 1 - ... else: - ... pass - Traceback (most recent call last): - ... - SyntaxError: can't assign to function call (, line 4) - - >>> if 1: - ... pass - ... elif 1: - ... pass - ... else: - ... x() = 1 - Traceback (most recent call last): - ... - SyntaxError: can't assign to function call (, line 6) - -""" - -import re -import unittest -import warnings - -from test import test_support - -class SyntaxTestCase(unittest.TestCase): - - def _check_error(self, code, errtext, - filename="", mode="exec", subclass=None): - """Check that compiling code raises SyntaxError with errtext. - - errtest is a regular expression that must be present in the - test of the exception raised. If subclass is specified it - is the expected subclass of SyntaxError (e.g. IndentationError). - """ - try: - compile(code, filename, mode) - except SyntaxError, err: - if subclass and not isinstance(err, subclass): - self.fail("SyntaxError is not a %s" % subclass.__name__) - mo = re.search(errtext, str(err)) - if mo is None: - self.fail("SyntaxError did not contain '%r'" % (errtext,)) - else: - self.fail("compile() did not raise SyntaxError") - - def test_assign_call(self): - self._check_error("f() = 1", "assign") - - def test_assign_del(self): - self._check_error("del f()", "delete") - - def test_global_err_then_warn(self): - # Bug tickler: The SyntaxError raised for one global statement - # shouldn't be clobbered by a SyntaxWarning issued for a later one. - source = re.sub('(?m)^ *:', '', """\ - :def error(a): - : global a # SyntaxError - :def warning(): - : b = 1 - : global b # SyntaxWarning - :""") - warnings.filterwarnings(action='ignore', category=SyntaxWarning) - self._check_error(source, "global") - warnings.filters.pop(0) - - def test_break_outside_loop(self): - self._check_error("break", "outside loop") - - def test_delete_deref(self): - source = re.sub('(?m)^ *:', '', """\ - :def foo(x): - : def bar(): - : print x - : del x - :""") - self._check_error(source, "nested scope") - - def test_unexpected_indent(self): - self._check_error("foo()\n bar()\n", "unexpected indent", - subclass=IndentationError) - - def test_no_indent(self): - self._check_error("if 1:\nfoo()", "expected an indented block", - subclass=IndentationError) - - def test_bad_outdent(self): - self._check_error("if 1:\n foo()\n bar()", - "unindent does not match .* level", - subclass=IndentationError) - - def test_kwargs_last(self): - self._check_error("int(base=10, '2')", "non-keyword arg") - -def test_main(): - test_support.run_unittest(SyntaxTestCase) - from test import test_syntax - test_support.run_doctest(test_syntax, verbosity=True) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_sys.py b/sys/lib/python/test/test_sys.py deleted file mode 100644 index f1f1524c0..000000000 --- a/sys/lib/python/test/test_sys.py +++ /dev/null @@ -1,357 +0,0 @@ -# -*- coding: iso-8859-1 -*- -import unittest, test.test_support -import sys, cStringIO - -class SysModuleTest(unittest.TestCase): - - def test_original_displayhook(self): - import __builtin__ - savestdout = sys.stdout - out = cStringIO.StringIO() - sys.stdout = out - - dh = sys.__displayhook__ - - self.assertRaises(TypeError, dh) - if hasattr(__builtin__, "_"): - del __builtin__._ - - dh(None) - self.assertEqual(out.getvalue(), "") - self.assert_(not hasattr(__builtin__, "_")) - dh(42) - self.assertEqual(out.getvalue(), "42\n") - self.assertEqual(__builtin__._, 42) - - del sys.stdout - self.assertRaises(RuntimeError, dh, 42) - - sys.stdout = savestdout - - def test_lost_displayhook(self): - olddisplayhook = sys.displayhook - del sys.displayhook - code = compile("42", "", "single") - self.assertRaises(RuntimeError, eval, code) - sys.displayhook = olddisplayhook - - def test_custom_displayhook(self): - olddisplayhook = sys.displayhook - def baddisplayhook(obj): - raise ValueError - sys.displayhook = baddisplayhook - code = compile("42", "", "single") - self.assertRaises(ValueError, eval, code) - sys.displayhook = olddisplayhook - - def test_original_excepthook(self): - savestderr = sys.stderr - err = cStringIO.StringIO() - sys.stderr = err - - eh = sys.__excepthook__ - - self.assertRaises(TypeError, eh) - try: - raise ValueError(42) - except ValueError, exc: - eh(*sys.exc_info()) - - sys.stderr = savestderr - self.assert_(err.getvalue().endswith("ValueError: 42\n")) - - # FIXME: testing the code for a lost or replaced excepthook in - # Python/pythonrun.c::PyErr_PrintEx() is tricky. - - def test_exc_clear(self): - self.assertRaises(TypeError, sys.exc_clear, 42) - - # Verify that exc_info is present and matches exc, then clear it, and - # check that it worked. - def clear_check(exc): - typ, value, traceback = sys.exc_info() - self.assert_(typ is not None) - self.assert_(value is exc) - self.assert_(traceback is not None) - - sys.exc_clear() - - typ, value, traceback = sys.exc_info() - self.assert_(typ is None) - self.assert_(value is None) - self.assert_(traceback is None) - - def clear(): - try: - raise ValueError, 42 - except ValueError, exc: - clear_check(exc) - - # Raise an exception and check that it can be cleared - clear() - - # Verify that a frame currently handling an exception is - # unaffected by calling exc_clear in a nested frame. - try: - raise ValueError, 13 - except ValueError, exc: - typ1, value1, traceback1 = sys.exc_info() - clear() - typ2, value2, traceback2 = sys.exc_info() - - self.assert_(typ1 is typ2) - self.assert_(value1 is exc) - self.assert_(value1 is value2) - self.assert_(traceback1 is traceback2) - - # Check that an exception can be cleared outside of an except block - clear_check(exc) - - def test_exit(self): - self.assertRaises(TypeError, sys.exit, 42, 42) - - # call without argument - try: - sys.exit(0) - except SystemExit, exc: - self.assertEquals(exc.code, 0) - except: - self.fail("wrong exception") - else: - self.fail("no exception") - - # call with tuple argument with one entry - # entry will be unpacked - try: - sys.exit(42) - except SystemExit, exc: - self.assertEquals(exc.code, 42) - except: - self.fail("wrong exception") - else: - self.fail("no exception") - - # call with integer argument - try: - sys.exit((42,)) - except SystemExit, exc: - self.assertEquals(exc.code, 42) - except: - self.fail("wrong exception") - else: - self.fail("no exception") - - # call with string argument - try: - sys.exit("exit") - except SystemExit, exc: - self.assertEquals(exc.code, "exit") - except: - self.fail("wrong exception") - else: - self.fail("no exception") - - # call with tuple argument with two entries - try: - sys.exit((17, 23)) - except SystemExit, exc: - self.assertEquals(exc.code, (17, 23)) - except: - self.fail("wrong exception") - else: - self.fail("no exception") - - # test that the exit machinery handles SystemExits properly - import subprocess - # both unnormalized... - rc = subprocess.call([sys.executable, "-c", - "raise SystemExit, 46"]) - self.assertEqual(rc, 46) - # ... and normalized - rc = subprocess.call([sys.executable, "-c", - "raise SystemExit(47)"]) - self.assertEqual(rc, 47) - - - def test_getdefaultencoding(self): - if test.test_support.have_unicode: - self.assertRaises(TypeError, sys.getdefaultencoding, 42) - # can't check more than the type, as the user might have changed it - self.assert_(isinstance(sys.getdefaultencoding(), str)) - - # testing sys.settrace() is done in test_trace.py - # testing sys.setprofile() is done in test_profile.py - - def test_setcheckinterval(self): - self.assertRaises(TypeError, sys.setcheckinterval) - orig = sys.getcheckinterval() - for n in 0, 100, 120, orig: # orig last to restore starting state - sys.setcheckinterval(n) - self.assertEquals(sys.getcheckinterval(), n) - - def test_recursionlimit(self): - self.assertRaises(TypeError, sys.getrecursionlimit, 42) - oldlimit = sys.getrecursionlimit() - self.assertRaises(TypeError, sys.setrecursionlimit) - self.assertRaises(ValueError, sys.setrecursionlimit, -42) - sys.setrecursionlimit(10000) - self.assertEqual(sys.getrecursionlimit(), 10000) - sys.setrecursionlimit(oldlimit) - - def test_getwindowsversion(self): - if hasattr(sys, "getwindowsversion"): - v = sys.getwindowsversion() - self.assert_(isinstance(v, tuple)) - self.assertEqual(len(v), 5) - self.assert_(isinstance(v[0], int)) - self.assert_(isinstance(v[1], int)) - self.assert_(isinstance(v[2], int)) - self.assert_(isinstance(v[3], int)) - self.assert_(isinstance(v[4], str)) - - def test_dlopenflags(self): - if hasattr(sys, "setdlopenflags"): - self.assert_(hasattr(sys, "getdlopenflags")) - self.assertRaises(TypeError, sys.getdlopenflags, 42) - oldflags = sys.getdlopenflags() - self.assertRaises(TypeError, sys.setdlopenflags) - sys.setdlopenflags(oldflags+1) - self.assertEqual(sys.getdlopenflags(), oldflags+1) - sys.setdlopenflags(oldflags) - - def test_refcount(self): - self.assertRaises(TypeError, sys.getrefcount) - c = sys.getrefcount(None) - n = None - self.assertEqual(sys.getrefcount(None), c+1) - del n - self.assertEqual(sys.getrefcount(None), c) - if hasattr(sys, "gettotalrefcount"): - self.assert_(isinstance(sys.gettotalrefcount(), int)) - - def test_getframe(self): - self.assertRaises(TypeError, sys._getframe, 42, 42) - self.assertRaises(ValueError, sys._getframe, 2000000000) - self.assert_( - SysModuleTest.test_getframe.im_func.func_code \ - is sys._getframe().f_code - ) - - # sys._current_frames() is a CPython-only gimmick. - def test_current_frames(self): - have_threads = True - try: - import thread - except ImportError: - have_threads = False - - if have_threads: - self.current_frames_with_threads() - else: - self.current_frames_without_threads() - - # Test sys._current_frames() in a WITH_THREADS build. - def current_frames_with_threads(self): - import threading, thread - import traceback - - # Spawn a thread that blocks at a known place. Then the main - # thread does sys._current_frames(), and verifies that the frames - # returned make sense. - entered_g = threading.Event() - leave_g = threading.Event() - thread_info = [] # the thread's id - - def f123(): - g456() - - def g456(): - thread_info.append(thread.get_ident()) - entered_g.set() - leave_g.wait() - - t = threading.Thread(target=f123) - t.start() - entered_g.wait() - - # At this point, t has finished its entered_g.set(), although it's - # impossible to guess whether it's still on that line or has moved on - # to its leave_g.wait(). - self.assertEqual(len(thread_info), 1) - thread_id = thread_info[0] - - d = sys._current_frames() - - main_id = thread.get_ident() - self.assert_(main_id in d) - self.assert_(thread_id in d) - - # Verify that the captured main-thread frame is _this_ frame. - frame = d.pop(main_id) - self.assert_(frame is sys._getframe()) - - # Verify that the captured thread frame is blocked in g456, called - # from f123. This is a litte tricky, since various bits of - # threading.py are also in the thread's call stack. - frame = d.pop(thread_id) - stack = traceback.extract_stack(frame) - for i, (filename, lineno, funcname, sourceline) in enumerate(stack): - if funcname == "f123": - break - else: - self.fail("didn't find f123() on thread's call stack") - - self.assertEqual(sourceline, "g456()") - - # And the next record must be for g456(). - filename, lineno, funcname, sourceline = stack[i+1] - self.assertEqual(funcname, "g456") - self.assert_(sourceline in ["leave_g.wait()", "entered_g.set()"]) - - # Reap the spawned thread. - leave_g.set() - t.join() - - # Test sys._current_frames() when thread support doesn't exist. - def current_frames_without_threads(self): - # Not much happens here: there is only one thread, with artificial - # "thread id" 0. - d = sys._current_frames() - self.assertEqual(len(d), 1) - self.assert_(0 in d) - self.assert_(d[0] is sys._getframe()) - - def test_attributes(self): - self.assert_(isinstance(sys.api_version, int)) - self.assert_(isinstance(sys.argv, list)) - self.assert_(sys.byteorder in ("little", "big")) - self.assert_(isinstance(sys.builtin_module_names, tuple)) - self.assert_(isinstance(sys.copyright, basestring)) - self.assert_(isinstance(sys.exec_prefix, basestring)) - self.assert_(isinstance(sys.executable, basestring)) - self.assert_(isinstance(sys.hexversion, int)) - self.assert_(isinstance(sys.maxint, int)) - if test.test_support.have_unicode: - self.assert_(isinstance(sys.maxunicode, int)) - self.assert_(isinstance(sys.platform, basestring)) - self.assert_(isinstance(sys.prefix, basestring)) - self.assert_(isinstance(sys.version, basestring)) - vi = sys.version_info - self.assert_(isinstance(vi, tuple)) - self.assertEqual(len(vi), 5) - self.assert_(isinstance(vi[0], int)) - self.assert_(isinstance(vi[1], int)) - self.assert_(isinstance(vi[2], int)) - self.assert_(vi[3] in ("alpha", "beta", "candidate", "final")) - self.assert_(isinstance(vi[4], int)) - - def test_43581(self): - # Can't use sys.stdout, as this is a cStringIO object when - # the test runs under regrtest. - self.assert_(sys.__stdout__.encoding == sys.__stderr__.encoding) - -def test_main(): - test.test_support.run_unittest(SysModuleTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_tarfile.py b/sys/lib/python/test/test_tarfile.py deleted file mode 100644 index 692d72a17..000000000 --- a/sys/lib/python/test/test_tarfile.py +++ /dev/null @@ -1,729 +0,0 @@ -import sys -import os -import shutil -import tempfile -import StringIO - -import unittest -import tarfile - -from test import test_support - -# Check for our compression modules. -try: - import gzip - gzip.GzipFile -except (ImportError, AttributeError): - gzip = None -try: - import bz2 -except ImportError: - bz2 = None - -def path(path): - return test_support.findfile(path) - -testtar = path("testtar.tar") -tempdir = os.path.join(tempfile.gettempdir(), "testtar" + os.extsep + "dir") -tempname = test_support.TESTFN -membercount = 12 - -def tarname(comp=""): - if not comp: - return testtar - return os.path.join(tempdir, "%s%s%s" % (testtar, os.extsep, comp)) - -def dirname(): - if not os.path.exists(tempdir): - os.mkdir(tempdir) - return tempdir - -def tmpname(): - return tempname - - -class BaseTest(unittest.TestCase): - comp = '' - mode = 'r' - sep = ':' - - def setUp(self): - mode = self.mode + self.sep + self.comp - self.tar = tarfile.open(tarname(self.comp), mode) - - def tearDown(self): - self.tar.close() - -class ReadTest(BaseTest): - - def test(self): - """Test member extraction. - """ - members = 0 - for tarinfo in self.tar: - members += 1 - if not tarinfo.isreg(): - continue - f = self.tar.extractfile(tarinfo) - self.assert_(len(f.read()) == tarinfo.size, - "size read does not match expected size") - f.close() - - self.assert_(members == membercount, - "could not find all members") - - def test_sparse(self): - """Test sparse member extraction. - """ - if self.sep != "|": - f1 = self.tar.extractfile("S-SPARSE") - f2 = self.tar.extractfile("S-SPARSE-WITH-NULLS") - self.assert_(f1.read() == f2.read(), - "_FileObject failed on sparse file member") - - def test_readlines(self): - """Test readlines() method of _FileObject. - """ - if self.sep != "|": - filename = "0-REGTYPE-TEXT" - self.tar.extract(filename, dirname()) - f = open(os.path.join(dirname(), filename), "rU") - lines1 = f.readlines() - f.close() - lines2 = self.tar.extractfile(filename).readlines() - self.assert_(lines1 == lines2, - "_FileObject.readline() does not work correctly") - - def test_iter(self): - # Test iteration over ExFileObject. - if self.sep != "|": - filename = "0-REGTYPE-TEXT" - self.tar.extract(filename, dirname()) - f = open(os.path.join(dirname(), filename), "rU") - lines1 = f.readlines() - f.close() - lines2 = [line for line in self.tar.extractfile(filename)] - self.assert_(lines1 == lines2, - "ExFileObject iteration does not work correctly") - - def test_seek(self): - """Test seek() method of _FileObject, incl. random reading. - """ - if self.sep != "|": - filename = "0-REGTYPE-TEXT" - self.tar.extract(filename, dirname()) - f = open(os.path.join(dirname(), filename), "rb") - data = f.read() - f.close() - - tarinfo = self.tar.getmember(filename) - fobj = self.tar.extractfile(tarinfo) - - text = fobj.read() - fobj.seek(0) - self.assert_(0 == fobj.tell(), - "seek() to file's start failed") - fobj.seek(2048, 0) - self.assert_(2048 == fobj.tell(), - "seek() to absolute position failed") - fobj.seek(-1024, 1) - self.assert_(1024 == fobj.tell(), - "seek() to negative relative position failed") - fobj.seek(1024, 1) - self.assert_(2048 == fobj.tell(), - "seek() to positive relative position failed") - s = fobj.read(10) - self.assert_(s == data[2048:2058], - "read() after seek failed") - fobj.seek(0, 2) - self.assert_(tarinfo.size == fobj.tell(), - "seek() to file's end failed") - self.assert_(fobj.read() == "", - "read() at file's end did not return empty string") - fobj.seek(-tarinfo.size, 2) - self.assert_(0 == fobj.tell(), - "relative seek() to file's start failed") - fobj.seek(512) - s1 = fobj.readlines() - fobj.seek(512) - s2 = fobj.readlines() - self.assert_(s1 == s2, - "readlines() after seek failed") - fobj.seek(0) - self.assert_(len(fobj.readline()) == fobj.tell(), - "tell() after readline() failed") - fobj.seek(512) - self.assert_(len(fobj.readline()) + 512 == fobj.tell(), - "tell() after seek() and readline() failed") - fobj.seek(0) - line = fobj.readline() - self.assert_(fobj.read() == data[len(line):], - "read() after readline() failed") - fobj.close() - - def test_old_dirtype(self): - """Test old style dirtype member (bug #1336623). - """ - # Old tars create directory members using a REGTYPE - # header with a "/" appended to the filename field. - - # Create an old tar style directory entry. - filename = tmpname() - tarinfo = tarfile.TarInfo("directory/") - tarinfo.type = tarfile.REGTYPE - - fobj = open(filename, "w") - fobj.write(tarinfo.tobuf()) - fobj.close() - - try: - # Test if it is still a directory entry when - # read back. - tar = tarfile.open(filename) - tarinfo = tar.getmembers()[0] - tar.close() - - self.assert_(tarinfo.type == tarfile.DIRTYPE) - self.assert_(tarinfo.name.endswith("/")) - finally: - try: - os.unlink(filename) - except: - pass - -class ReadStreamTest(ReadTest): - sep = "|" - - def test(self): - """Test member extraction, and for StreamError when - seeking backwards. - """ - ReadTest.test(self) - tarinfo = self.tar.getmembers()[0] - f = self.tar.extractfile(tarinfo) - self.assertRaises(tarfile.StreamError, f.read) - - def test_stream(self): - """Compare the normal tar and the stream tar. - """ - stream = self.tar - tar = tarfile.open(tarname(), 'r') - - while 1: - t1 = tar.next() - t2 = stream.next() - if t1 is None: - break - self.assert_(t2 is not None, "stream.next() failed.") - - if t2.islnk() or t2.issym(): - self.assertRaises(tarfile.StreamError, stream.extractfile, t2) - continue - v1 = tar.extractfile(t1) - v2 = stream.extractfile(t2) - if v1 is None: - continue - self.assert_(v2 is not None, "stream.extractfile() failed") - self.assert_(v1.read() == v2.read(), "stream extraction failed") - - tar.close() - stream.close() - -class ReadDetectTest(ReadTest): - - def setUp(self): - self.tar = tarfile.open(tarname(self.comp), self.mode) - -class ReadDetectFileobjTest(ReadTest): - - def setUp(self): - name = tarname(self.comp) - self.tar = tarfile.open(name, mode=self.mode, - fileobj=open(name, "rb")) - -class ReadAsteriskTest(ReadTest): - - def setUp(self): - mode = self.mode + self.sep + "*" - self.tar = tarfile.open(tarname(self.comp), mode) - -class ReadStreamAsteriskTest(ReadStreamTest): - - def setUp(self): - mode = self.mode + self.sep + "*" - self.tar = tarfile.open(tarname(self.comp), mode) - -class WriteTest(BaseTest): - mode = 'w' - - def setUp(self): - mode = self.mode + self.sep + self.comp - self.src = tarfile.open(tarname(self.comp), 'r') - self.dstname = tmpname() - self.dst = tarfile.open(self.dstname, mode) - - def tearDown(self): - self.src.close() - self.dst.close() - - def test_posix(self): - self.dst.posix = 1 - self._test() - - def test_nonposix(self): - self.dst.posix = 0 - self._test() - - def test_small(self): - self.dst.add(os.path.join(os.path.dirname(__file__),"cfgparser.1")) - self.dst.close() - self.assertNotEqual(os.stat(self.dstname).st_size, 0) - - def _test(self): - for tarinfo in self.src: - if not tarinfo.isreg(): - continue - f = self.src.extractfile(tarinfo) - if self.dst.posix and len(tarinfo.name) > tarfile.LENGTH_NAME and "/" not in tarinfo.name: - self.assertRaises(ValueError, self.dst.addfile, - tarinfo, f) - else: - self.dst.addfile(tarinfo, f) - - def test_add_self(self): - dstname = os.path.abspath(self.dstname) - - self.assertEqual(self.dst.name, dstname, "archive name must be absolute") - - self.dst.add(dstname) - self.assertEqual(self.dst.getnames(), [], "added the archive to itself") - - cwd = os.getcwd() - os.chdir(dirname()) - self.dst.add(dstname) - os.chdir(cwd) - self.assertEqual(self.dst.getnames(), [], "added the archive to itself") - - -class Write100Test(BaseTest): - # The name field in a tar header stores strings of at most 100 chars. - # If a string is shorter than 100 chars it has to be padded with '\0', - # which implies that a string of exactly 100 chars is stored without - # a trailing '\0'. - - def setUp(self): - self.name = "01234567890123456789012345678901234567890123456789" - self.name += "01234567890123456789012345678901234567890123456789" - - self.tar = tarfile.open(tmpname(), "w") - t = tarfile.TarInfo(self.name) - self.tar.addfile(t) - self.tar.close() - - self.tar = tarfile.open(tmpname()) - - def tearDown(self): - self.tar.close() - - def test(self): - self.assertEqual(self.tar.getnames()[0], self.name, - "failed to store 100 char filename") - - -class WriteSize0Test(BaseTest): - mode = 'w' - - def setUp(self): - self.tmpdir = dirname() - self.dstname = tmpname() - self.dst = tarfile.open(self.dstname, "w") - - def tearDown(self): - self.dst.close() - - def test_file(self): - path = os.path.join(self.tmpdir, "file") - f = open(path, "w") - f.close() - tarinfo = self.dst.gettarinfo(path) - self.assertEqual(tarinfo.size, 0) - f = open(path, "w") - f.write("aaa") - f.close() - tarinfo = self.dst.gettarinfo(path) - self.assertEqual(tarinfo.size, 3) - - def test_directory(self): - path = os.path.join(self.tmpdir, "directory") - if os.path.exists(path): - # This shouldn't be necessary, but is if a previous - # run was killed in mid-stream. - shutil.rmtree(path) - os.mkdir(path) - tarinfo = self.dst.gettarinfo(path) - self.assertEqual(tarinfo.size, 0) - - def test_symlink(self): - if hasattr(os, "symlink"): - path = os.path.join(self.tmpdir, "symlink") - os.symlink("link_target", path) - tarinfo = self.dst.gettarinfo(path) - self.assertEqual(tarinfo.size, 0) - - -class WriteStreamTest(WriteTest): - sep = '|' - - def test_padding(self): - self.dst.close() - - if self.comp == "gz": - f = gzip.GzipFile(self.dstname) - s = f.read() - f.close() - elif self.comp == "bz2": - f = bz2.BZ2Decompressor() - s = file(self.dstname).read() - s = f.decompress(s) - self.assertEqual(len(f.unused_data), 0, "trailing data") - else: - f = file(self.dstname) - s = f.read() - f.close() - - self.assertEqual(s.count("\0"), tarfile.RECORDSIZE, - "incorrect zero padding") - - -class WriteGNULongTest(unittest.TestCase): - """This testcase checks for correct creation of GNU Longname - and Longlink extensions. - - It creates a tarfile and adds empty members with either - long names, long linknames or both and compares the size - of the tarfile with the expected size. - - It checks for SF bug #812325 in TarFile._create_gnulong(). - - While I was writing this testcase, I noticed a second bug - in the same method: - Long{names,links} weren't null-terminated which lead to - bad tarfiles when their length was a multiple of 512. This - is tested as well. - """ - - def _length(self, s): - blocks, remainder = divmod(len(s) + 1, 512) - if remainder: - blocks += 1 - return blocks * 512 - - def _calc_size(self, name, link=None): - # initial tar header - count = 512 - - if len(name) > tarfile.LENGTH_NAME: - # gnu longname extended header + longname - count += 512 - count += self._length(name) - - if link is not None and len(link) > tarfile.LENGTH_LINK: - # gnu longlink extended header + longlink - count += 512 - count += self._length(link) - - return count - - def _test(self, name, link=None): - tarinfo = tarfile.TarInfo(name) - if link: - tarinfo.linkname = link - tarinfo.type = tarfile.LNKTYPE - - tar = tarfile.open(tmpname(), "w") - tar.posix = False - tar.addfile(tarinfo) - - v1 = self._calc_size(name, link) - v2 = tar.offset - self.assertEqual(v1, v2, "GNU longname/longlink creation failed") - - tar.close() - - tar = tarfile.open(tmpname()) - member = tar.next() - self.failIf(member is None, "unable to read longname member") - self.assert_(tarinfo.name == member.name and \ - tarinfo.linkname == member.linkname, \ - "unable to read longname member") - - def test_longname_1023(self): - self._test(("longnam/" * 127) + "longnam") - - def test_longname_1024(self): - self._test(("longnam/" * 127) + "longname") - - def test_longname_1025(self): - self._test(("longnam/" * 127) + "longname_") - - def test_longlink_1023(self): - self._test("name", ("longlnk/" * 127) + "longlnk") - - def test_longlink_1024(self): - self._test("name", ("longlnk/" * 127) + "longlink") - - def test_longlink_1025(self): - self._test("name", ("longlnk/" * 127) + "longlink_") - - def test_longnamelink_1023(self): - self._test(("longnam/" * 127) + "longnam", - ("longlnk/" * 127) + "longlnk") - - def test_longnamelink_1024(self): - self._test(("longnam/" * 127) + "longname", - ("longlnk/" * 127) + "longlink") - - def test_longnamelink_1025(self): - self._test(("longnam/" * 127) + "longname_", - ("longlnk/" * 127) + "longlink_") - -class ReadGNULongTest(unittest.TestCase): - - def setUp(self): - self.tar = tarfile.open(tarname()) - - def tearDown(self): - self.tar.close() - - def test_1471427(self): - """Test reading of longname (bug #1471427). - """ - name = "test/" * 20 + "0-REGTYPE" - try: - tarinfo = self.tar.getmember(name) - except KeyError: - tarinfo = None - self.assert_(tarinfo is not None, "longname not found") - self.assert_(tarinfo.type != tarfile.DIRTYPE, "read longname as dirtype") - - def test_read_name(self): - name = ("0-LONGNAME-" * 10)[:101] - try: - tarinfo = self.tar.getmember(name) - except KeyError: - tarinfo = None - self.assert_(tarinfo is not None, "longname not found") - - def test_read_link(self): - link = ("1-LONGLINK-" * 10)[:101] - name = ("0-LONGNAME-" * 10)[:101] - try: - tarinfo = self.tar.getmember(link) - except KeyError: - tarinfo = None - self.assert_(tarinfo is not None, "longlink not found") - self.assert_(tarinfo.linkname == name, "linkname wrong") - - def test_truncated_longname(self): - f = open(tarname()) - fobj = StringIO.StringIO(f.read(1024)) - f.close() - tar = tarfile.open(name="foo.tar", fileobj=fobj) - self.assert_(len(tar.getmembers()) == 0, "") - tar.close() - - -class ExtractHardlinkTest(BaseTest): - - def test_hardlink(self): - """Test hardlink extraction (bug #857297) - """ - # Prevent errors from being caught - self.tar.errorlevel = 1 - - self.tar.extract("0-REGTYPE", dirname()) - try: - # Extract 1-LNKTYPE which is a hardlink to 0-REGTYPE - self.tar.extract("1-LNKTYPE", dirname()) - except EnvironmentError, e: - import errno - if e.errno == errno.ENOENT: - self.fail("hardlink not extracted properly") - -class CreateHardlinkTest(BaseTest): - """Test the creation of LNKTYPE (hardlink) members in an archive. - In this respect tarfile.py mimics the behaviour of GNU tar: If - a file has a st_nlink > 1, it will be added a REGTYPE member - only the first time. - """ - - def setUp(self): - self.tar = tarfile.open(tmpname(), "w") - - self.foo = os.path.join(dirname(), "foo") - self.bar = os.path.join(dirname(), "bar") - - if os.path.exists(self.foo): - os.remove(self.foo) - if os.path.exists(self.bar): - os.remove(self.bar) - - f = open(self.foo, "w") - f.write("foo") - f.close() - self.tar.add(self.foo) - - def test_add_twice(self): - # If st_nlink == 1 then the same file will be added as - # REGTYPE every time. - tarinfo = self.tar.gettarinfo(self.foo) - self.assertEqual(tarinfo.type, tarfile.REGTYPE, - "add file as regular failed") - - def test_add_hardlink(self): - # If st_nlink > 1 then the same file will be added as - # LNKTYPE. - os.link(self.foo, self.bar) - tarinfo = self.tar.gettarinfo(self.foo) - self.assertEqual(tarinfo.type, tarfile.LNKTYPE, - "add file as hardlink failed") - - tarinfo = self.tar.gettarinfo(self.bar) - self.assertEqual(tarinfo.type, tarfile.LNKTYPE, - "add file as hardlink failed") - - def test_dereference_hardlink(self): - self.tar.dereference = True - os.link(self.foo, self.bar) - tarinfo = self.tar.gettarinfo(self.bar) - self.assertEqual(tarinfo.type, tarfile.REGTYPE, - "dereferencing hardlink failed") - - -# Gzip TestCases -class ReadTestGzip(ReadTest): - comp = "gz" -class ReadStreamTestGzip(ReadStreamTest): - comp = "gz" -class WriteTestGzip(WriteTest): - comp = "gz" -class WriteStreamTestGzip(WriteStreamTest): - comp = "gz" -class ReadDetectTestGzip(ReadDetectTest): - comp = "gz" -class ReadDetectFileobjTestGzip(ReadDetectFileobjTest): - comp = "gz" -class ReadAsteriskTestGzip(ReadAsteriskTest): - comp = "gz" -class ReadStreamAsteriskTestGzip(ReadStreamAsteriskTest): - comp = "gz" - -# Filemode test cases - -class FileModeTest(unittest.TestCase): - def test_modes(self): - self.assertEqual(tarfile.filemode(0755), '-rwxr-xr-x') - self.assertEqual(tarfile.filemode(07111), '---s--s--t') - -class OpenFileobjTest(BaseTest): - # Test for SF bug #1496501. - - def test_opener(self): - fobj = StringIO.StringIO("foo\n") - try: - tarfile.open("", "r", fileobj=fobj) - except tarfile.ReadError: - self.assertEqual(fobj.tell(), 0, "fileobj's position has moved") - -if bz2: - # Bzip2 TestCases - class ReadTestBzip2(ReadTestGzip): - comp = "bz2" - class ReadStreamTestBzip2(ReadStreamTestGzip): - comp = "bz2" - class WriteTestBzip2(WriteTest): - comp = "bz2" - class WriteStreamTestBzip2(WriteStreamTestGzip): - comp = "bz2" - class ReadDetectTestBzip2(ReadDetectTest): - comp = "bz2" - class ReadDetectFileobjTestBzip2(ReadDetectFileobjTest): - comp = "bz2" - class ReadAsteriskTestBzip2(ReadAsteriskTest): - comp = "bz2" - class ReadStreamAsteriskTestBzip2(ReadStreamAsteriskTest): - comp = "bz2" - -# If importing gzip failed, discard the Gzip TestCases. -if not gzip: - del ReadTestGzip - del ReadStreamTestGzip - del WriteTestGzip - del WriteStreamTestGzip - -def test_main(): - # Create archive. - f = open(tarname(), "rb") - fguts = f.read() - f.close() - if gzip: - # create testtar.tar.gz - tar = gzip.open(tarname("gz"), "wb") - tar.write(fguts) - tar.close() - if bz2: - # create testtar.tar.bz2 - tar = bz2.BZ2File(tarname("bz2"), "wb") - tar.write(fguts) - tar.close() - - tests = [ - FileModeTest, - OpenFileobjTest, - ReadTest, - ReadStreamTest, - ReadDetectTest, - ReadDetectFileobjTest, - ReadAsteriskTest, - ReadStreamAsteriskTest, - WriteTest, - Write100Test, - WriteSize0Test, - WriteStreamTest, - WriteGNULongTest, - ReadGNULongTest, - ] - - if hasattr(os, "link"): - tests.append(ExtractHardlinkTest) - tests.append(CreateHardlinkTest) - - if gzip: - tests.extend([ - ReadTestGzip, ReadStreamTestGzip, - WriteTestGzip, WriteStreamTestGzip, - ReadDetectTestGzip, ReadDetectFileobjTestGzip, - ReadAsteriskTestGzip, ReadStreamAsteriskTestGzip - ]) - - if bz2: - tests.extend([ - ReadTestBzip2, ReadStreamTestBzip2, - WriteTestBzip2, WriteStreamTestBzip2, - ReadDetectTestBzip2, ReadDetectFileobjTestBzip2, - ReadAsteriskTestBzip2, ReadStreamAsteriskTestBzip2 - ]) - try: - test_support.run_unittest(*tests) - finally: - if gzip: - os.remove(tarname("gz")) - if bz2: - os.remove(tarname("bz2")) - if os.path.exists(dirname()): - shutil.rmtree(dirname()) - if os.path.exists(tmpname()): - os.remove(tmpname()) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_tcl.py b/sys/lib/python/test/test_tcl.py deleted file mode 100644 index fa170ef58..000000000 --- a/sys/lib/python/test/test_tcl.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env python - -import unittest -import os -from test import test_support -from Tkinter import Tcl -from _tkinter import TclError - -class TclTest(unittest.TestCase): - - def setUp(self): - self.interp = Tcl() - - def testEval(self): - tcl = self.interp - tcl.eval('set a 1') - self.assertEqual(tcl.eval('set a'),'1') - - def testEvalException(self): - tcl = self.interp - self.assertRaises(TclError,tcl.eval,'set a') - - def testEvalException2(self): - tcl = self.interp - self.assertRaises(TclError,tcl.eval,'this is wrong') - - def testCall(self): - tcl = self.interp - tcl.call('set','a','1') - self.assertEqual(tcl.call('set','a'),'1') - - def testCallException(self): - tcl = self.interp - self.assertRaises(TclError,tcl.call,'set','a') - - def testCallException2(self): - tcl = self.interp - self.assertRaises(TclError,tcl.call,'this','is','wrong') - - def testSetVar(self): - tcl = self.interp - tcl.setvar('a','1') - self.assertEqual(tcl.eval('set a'),'1') - - def testSetVarArray(self): - tcl = self.interp - tcl.setvar('a(1)','1') - self.assertEqual(tcl.eval('set a(1)'),'1') - - def testGetVar(self): - tcl = self.interp - tcl.eval('set a 1') - self.assertEqual(tcl.getvar('a'),'1') - - def testGetVarArray(self): - tcl = self.interp - tcl.eval('set a(1) 1') - self.assertEqual(tcl.getvar('a(1)'),'1') - - def testGetVarException(self): - tcl = self.interp - self.assertRaises(TclError,tcl.getvar,'a') - - def testGetVarArrayException(self): - tcl = self.interp - self.assertRaises(TclError,tcl.getvar,'a(1)') - - def testUnsetVar(self): - tcl = self.interp - tcl.setvar('a',1) - self.assertEqual(tcl.eval('info exists a'),'1') - tcl.unsetvar('a') - self.assertEqual(tcl.eval('info exists a'),'0') - - def testUnsetVarArray(self): - tcl = self.interp - tcl.setvar('a(1)',1) - tcl.setvar('a(2)',2) - self.assertEqual(tcl.eval('info exists a(1)'),'1') - self.assertEqual(tcl.eval('info exists a(2)'),'1') - tcl.unsetvar('a(1)') - self.assertEqual(tcl.eval('info exists a(1)'),'0') - self.assertEqual(tcl.eval('info exists a(2)'),'1') - - def testUnsetVarException(self): - tcl = self.interp - self.assertRaises(TclError,tcl.unsetvar,'a') - - def testEvalFile(self): - tcl = self.interp - filename = "testEvalFile.tcl" - fd = open(filename,'w') - script = """set a 1 - set b 2 - set c [ expr $a + $b ] - """ - fd.write(script) - fd.close() - tcl.evalfile(filename) - os.remove(filename) - self.assertEqual(tcl.eval('set a'),'1') - self.assertEqual(tcl.eval('set b'),'2') - self.assertEqual(tcl.eval('set c'),'3') - - def testEvalFileException(self): - tcl = self.interp - filename = "doesnotexists" - try: - os.remove(filename) - except Exception,e: - pass - self.assertRaises(TclError,tcl.evalfile,filename) - - def testPackageRequireException(self): - tcl = self.interp - self.assertRaises(TclError,tcl.eval,'package require DNE') - - def testLoadTk(self): - import os - if 'DISPLAY' not in os.environ: - # skipping test of clean upgradeability - return - tcl = Tcl() - self.assertRaises(TclError,tcl.winfo_geometry) - tcl.loadtk() - self.assertEqual('1x1+0+0', tcl.winfo_geometry()) - tcl.destroy() - - def testLoadTkFailure(self): - import os - old_display = None - import sys - if sys.platform.startswith(('win', 'darwin', 'cygwin')): - return # no failure possible on windows? - if 'DISPLAY' in os.environ: - old_display = os.environ['DISPLAY'] - del os.environ['DISPLAY'] - # on some platforms, deleting environment variables - # doesn't actually carry through to the process level - # because they don't support unsetenv - # If that's the case, abort. - display = os.popen('echo $DISPLAY').read().strip() - if display: - return - try: - tcl = Tcl() - self.assertRaises(TclError, tcl.winfo_geometry) - self.assertRaises(TclError, tcl.loadtk) - finally: - if old_display is not None: - os.environ['DISPLAY'] = old_display - -def test_main(): - test_support.run_unittest(TclTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_tempfile.py b/sys/lib/python/test/test_tempfile.py deleted file mode 100644 index 2047a6364..000000000 --- a/sys/lib/python/test/test_tempfile.py +++ /dev/null @@ -1,668 +0,0 @@ -# tempfile.py unit tests. - -import tempfile -import os -import sys -import re -import errno -import warnings - -import unittest -from test import test_support - -warnings.filterwarnings("ignore", - category=RuntimeWarning, - message="mktemp", module=__name__) - -if hasattr(os, 'stat'): - import stat - has_stat = 1 -else: - has_stat = 0 - -has_textmode = (tempfile._text_openflags != tempfile._bin_openflags) -has_spawnl = hasattr(os, 'spawnl') - -# TEST_FILES may need to be tweaked for systems depending on the maximum -# number of files that can be opened at one time (see ulimit -n) -if sys.platform == 'mac': - TEST_FILES = 32 -elif sys.platform in ('openbsd3', 'openbsd4'): - TEST_FILES = 48 -else: - TEST_FILES = 100 - -# This is organized as one test for each chunk of code in tempfile.py, -# in order of their appearance in the file. Testing which requires -# threads is not done here. - -# Common functionality. -class TC(unittest.TestCase): - - str_check = re.compile(r"[a-zA-Z0-9_-]{6}$") - - def failOnException(self, what, ei=None): - if ei is None: - ei = sys.exc_info() - self.fail("%s raised %s: %s" % (what, ei[0], ei[1])) - - def nameCheck(self, name, dir, pre, suf): - (ndir, nbase) = os.path.split(name) - npre = nbase[:len(pre)] - nsuf = nbase[len(nbase)-len(suf):] - - # check for equality of the absolute paths! - self.assertEqual(os.path.abspath(ndir), os.path.abspath(dir), - "file '%s' not in directory '%s'" % (name, dir)) - self.assertEqual(npre, pre, - "file '%s' does not begin with '%s'" % (nbase, pre)) - self.assertEqual(nsuf, suf, - "file '%s' does not end with '%s'" % (nbase, suf)) - - nbase = nbase[len(pre):len(nbase)-len(suf)] - self.assert_(self.str_check.match(nbase), - "random string '%s' does not match /^[a-zA-Z0-9_-]{6}$/" - % nbase) - -test_classes = [] - -class test_exports(TC): - def test_exports(self): - # There are no surprising symbols in the tempfile module - dict = tempfile.__dict__ - - expected = { - "NamedTemporaryFile" : 1, - "TemporaryFile" : 1, - "mkstemp" : 1, - "mkdtemp" : 1, - "mktemp" : 1, - "TMP_MAX" : 1, - "gettempprefix" : 1, - "gettempdir" : 1, - "tempdir" : 1, - "template" : 1 - } - - unexp = [] - for key in dict: - if key[0] != '_' and key not in expected: - unexp.append(key) - self.failUnless(len(unexp) == 0, - "unexpected keys: %s" % unexp) - -test_classes.append(test_exports) - - -class test__RandomNameSequence(TC): - """Test the internal iterator object _RandomNameSequence.""" - - def setUp(self): - self.r = tempfile._RandomNameSequence() - - def test_get_six_char_str(self): - # _RandomNameSequence returns a six-character string - s = self.r.next() - self.nameCheck(s, '', '', '') - - def test_many(self): - # _RandomNameSequence returns no duplicate strings (stochastic) - - dict = {} - r = self.r - for i in xrange(TEST_FILES): - s = r.next() - self.nameCheck(s, '', '', '') - self.failIf(s in dict) - dict[s] = 1 - - def test_supports_iter(self): - # _RandomNameSequence supports the iterator protocol - - i = 0 - r = self.r - try: - for s in r: - i += 1 - if i == 20: - break - except: - failOnException("iteration") - -test_classes.append(test__RandomNameSequence) - - -class test__candidate_tempdir_list(TC): - """Test the internal function _candidate_tempdir_list.""" - - def test_nonempty_list(self): - # _candidate_tempdir_list returns a nonempty list of strings - - cand = tempfile._candidate_tempdir_list() - - self.failIf(len(cand) == 0) - for c in cand: - self.assert_(isinstance(c, basestring), - "%s is not a string" % c) - - def test_wanted_dirs(self): - # _candidate_tempdir_list contains the expected directories - - # Make sure the interesting environment variables are all set. - added = [] - try: - for envname in 'TMPDIR', 'TEMP', 'TMP': - dirname = os.getenv(envname) - if not dirname: - os.environ[envname] = os.path.abspath(envname) - added.append(envname) - - cand = tempfile._candidate_tempdir_list() - - for envname in 'TMPDIR', 'TEMP', 'TMP': - dirname = os.getenv(envname) - if not dirname: raise ValueError - self.assert_(dirname in cand) - - try: - dirname = os.getcwd() - except (AttributeError, os.error): - dirname = os.curdir - - self.assert_(dirname in cand) - - # Not practical to try to verify the presence of OS-specific - # paths in this list. - finally: - for p in added: - del os.environ[p] - -test_classes.append(test__candidate_tempdir_list) - - -# We test _get_default_tempdir by testing gettempdir. - - -class test__get_candidate_names(TC): - """Test the internal function _get_candidate_names.""" - - def test_retval(self): - # _get_candidate_names returns a _RandomNameSequence object - obj = tempfile._get_candidate_names() - self.assert_(isinstance(obj, tempfile._RandomNameSequence)) - - def test_same_thing(self): - # _get_candidate_names always returns the same object - a = tempfile._get_candidate_names() - b = tempfile._get_candidate_names() - - self.assert_(a is b) - -test_classes.append(test__get_candidate_names) - - -class test__mkstemp_inner(TC): - """Test the internal function _mkstemp_inner.""" - - class mkstemped: - _bflags = tempfile._bin_openflags - _tflags = tempfile._text_openflags - _close = os.close - _unlink = os.unlink - - def __init__(self, dir, pre, suf, bin): - if bin: flags = self._bflags - else: flags = self._tflags - - (self.fd, self.name) = tempfile._mkstemp_inner(dir, pre, suf, flags) - - def write(self, str): - os.write(self.fd, str) - - def __del__(self): - self._close(self.fd) - self._unlink(self.name) - - def do_create(self, dir=None, pre="", suf="", bin=1): - if dir is None: - dir = tempfile.gettempdir() - try: - file = self.mkstemped(dir, pre, suf, bin) - except: - self.failOnException("_mkstemp_inner") - - self.nameCheck(file.name, dir, pre, suf) - return file - - def test_basic(self): - # _mkstemp_inner can create files - self.do_create().write("blat") - self.do_create(pre="a").write("blat") - self.do_create(suf="b").write("blat") - self.do_create(pre="a", suf="b").write("blat") - self.do_create(pre="aa", suf=".txt").write("blat") - - def test_basic_many(self): - # _mkstemp_inner can create many files (stochastic) - extant = range(TEST_FILES) - for i in extant: - extant[i] = self.do_create(pre="aa") - - def test_choose_directory(self): - # _mkstemp_inner can create files in a user-selected directory - dir = tempfile.mkdtemp() - try: - self.do_create(dir=dir).write("blat") - finally: - os.rmdir(dir) - - def test_file_mode(self): - # _mkstemp_inner creates files with the proper mode - if not has_stat: - return # ugh, can't use TestSkipped. - - file = self.do_create() - mode = stat.S_IMODE(os.stat(file.name).st_mode) - expected = 0600 - if sys.platform in ('win32', 'os2emx', 'mac'): - # There's no distinction among 'user', 'group' and 'world'; - # replicate the 'user' bits. - user = expected >> 6 - expected = user * (1 + 8 + 64) - self.assertEqual(mode, expected) - - def test_noinherit(self): - # _mkstemp_inner file handles are not inherited by child processes - if not has_spawnl: - return # ugh, can't use TestSkipped. - - if test_support.verbose: - v="v" - else: - v="q" - - file = self.do_create() - fd = "%d" % file.fd - - try: - me = __file__ - except NameError: - me = sys.argv[0] - - # We have to exec something, so that FD_CLOEXEC will take - # effect. The core of this test is therefore in - # tf_inherit_check.py, which see. - tester = os.path.join(os.path.dirname(os.path.abspath(me)), - "tf_inherit_check.py") - - # On Windows a spawn* /path/ with embedded spaces shouldn't be quoted, - # but an arg with embedded spaces should be decorated with double - # quotes on each end - if sys.platform in ('win32'): - decorated = '"%s"' % sys.executable - tester = '"%s"' % tester - else: - decorated = sys.executable - - retval = os.spawnl(os.P_WAIT, sys.executable, decorated, tester, v, fd) - self.failIf(retval < 0, - "child process caught fatal signal %d" % -retval) - self.failIf(retval > 0, "child process reports failure %d"%retval) - - def test_textmode(self): - # _mkstemp_inner can create files in text mode - if not has_textmode: - return # ugh, can't use TestSkipped. - - self.do_create(bin=0).write("blat\n") - # XXX should test that the file really is a text file - -test_classes.append(test__mkstemp_inner) - - -class test_gettempprefix(TC): - """Test gettempprefix().""" - - def test_sane_template(self): - # gettempprefix returns a nonempty prefix string - p = tempfile.gettempprefix() - - self.assert_(isinstance(p, basestring)) - self.assert_(len(p) > 0) - - def test_usable_template(self): - # gettempprefix returns a usable prefix string - - # Create a temp directory, avoiding use of the prefix. - # Then attempt to create a file whose name is - # prefix + 'xxxxxx.xxx' in that directory. - p = tempfile.gettempprefix() + "xxxxxx.xxx" - d = tempfile.mkdtemp(prefix="") - try: - p = os.path.join(d, p) - try: - fd = os.open(p, os.O_RDWR | os.O_CREAT) - except: - self.failOnException("os.open") - os.close(fd) - os.unlink(p) - finally: - os.rmdir(d) - -test_classes.append(test_gettempprefix) - - -class test_gettempdir(TC): - """Test gettempdir().""" - - def test_directory_exists(self): - # gettempdir returns a directory which exists - - dir = tempfile.gettempdir() - self.assert_(os.path.isabs(dir) or dir == os.curdir, - "%s is not an absolute path" % dir) - self.assert_(os.path.isdir(dir), - "%s is not a directory" % dir) - - def test_directory_writable(self): - # gettempdir returns a directory writable by the user - - # sneaky: just instantiate a NamedTemporaryFile, which - # defaults to writing into the directory returned by - # gettempdir. - try: - file = tempfile.NamedTemporaryFile() - file.write("blat") - file.close() - except: - self.failOnException("create file in %s" % tempfile.gettempdir()) - - def test_same_thing(self): - # gettempdir always returns the same object - a = tempfile.gettempdir() - b = tempfile.gettempdir() - - self.assert_(a is b) - -test_classes.append(test_gettempdir) - - -class test_mkstemp(TC): - """Test mkstemp().""" - - def do_create(self, dir=None, pre="", suf=""): - if dir is None: - dir = tempfile.gettempdir() - try: - (fd, name) = tempfile.mkstemp(dir=dir, prefix=pre, suffix=suf) - (ndir, nbase) = os.path.split(name) - adir = os.path.abspath(dir) - self.assertEqual(adir, ndir, - "Directory '%s' incorrectly returned as '%s'" % (adir, ndir)) - except: - self.failOnException("mkstemp") - - try: - self.nameCheck(name, dir, pre, suf) - finally: - os.close(fd) - os.unlink(name) - - def test_basic(self): - # mkstemp can create files - self.do_create() - self.do_create(pre="a") - self.do_create(suf="b") - self.do_create(pre="a", suf="b") - self.do_create(pre="aa", suf=".txt") - self.do_create(dir=".") - - def test_choose_directory(self): - # mkstemp can create directories in a user-selected directory - dir = tempfile.mkdtemp() - try: - self.do_create(dir=dir) - finally: - os.rmdir(dir) - -test_classes.append(test_mkstemp) - - -class test_mkdtemp(TC): - """Test mkdtemp().""" - - def do_create(self, dir=None, pre="", suf=""): - if dir is None: - dir = tempfile.gettempdir() - try: - name = tempfile.mkdtemp(dir=dir, prefix=pre, suffix=suf) - except: - self.failOnException("mkdtemp") - - try: - self.nameCheck(name, dir, pre, suf) - return name - except: - os.rmdir(name) - raise - - def test_basic(self): - # mkdtemp can create directories - os.rmdir(self.do_create()) - os.rmdir(self.do_create(pre="a")) - os.rmdir(self.do_create(suf="b")) - os.rmdir(self.do_create(pre="a", suf="b")) - os.rmdir(self.do_create(pre="aa", suf=".txt")) - - def test_basic_many(self): - # mkdtemp can create many directories (stochastic) - extant = range(TEST_FILES) - try: - for i in extant: - extant[i] = self.do_create(pre="aa") - finally: - for i in extant: - if(isinstance(i, basestring)): - os.rmdir(i) - - def test_choose_directory(self): - # mkdtemp can create directories in a user-selected directory - dir = tempfile.mkdtemp() - try: - os.rmdir(self.do_create(dir=dir)) - finally: - os.rmdir(dir) - - def test_mode(self): - # mkdtemp creates directories with the proper mode - if not has_stat: - return # ugh, can't use TestSkipped. - - dir = self.do_create() - try: - mode = stat.S_IMODE(os.stat(dir).st_mode) - mode &= 0777 # Mask off sticky bits inherited from /tmp - expected = 0700 - if sys.platform in ('win32', 'os2emx', 'mac'): - # There's no distinction among 'user', 'group' and 'world'; - # replicate the 'user' bits. - user = expected >> 6 - expected = user * (1 + 8 + 64) - self.assertEqual(mode, expected) - finally: - os.rmdir(dir) - -test_classes.append(test_mkdtemp) - - -class test_mktemp(TC): - """Test mktemp().""" - - # For safety, all use of mktemp must occur in a private directory. - # We must also suppress the RuntimeWarning it generates. - def setUp(self): - self.dir = tempfile.mkdtemp() - - def tearDown(self): - if self.dir: - os.rmdir(self.dir) - self.dir = None - - class mktemped: - _unlink = os.unlink - _bflags = tempfile._bin_openflags - - def __init__(self, dir, pre, suf): - self.name = tempfile.mktemp(dir=dir, prefix=pre, suffix=suf) - # Create the file. This will raise an exception if it's - # mysteriously appeared in the meanwhile. - os.close(os.open(self.name, self._bflags, 0600)) - - def __del__(self): - self._unlink(self.name) - - def do_create(self, pre="", suf=""): - try: - file = self.mktemped(self.dir, pre, suf) - except: - self.failOnException("mktemp") - - self.nameCheck(file.name, self.dir, pre, suf) - return file - - def test_basic(self): - # mktemp can choose usable file names - self.do_create() - self.do_create(pre="a") - self.do_create(suf="b") - self.do_create(pre="a", suf="b") - self.do_create(pre="aa", suf=".txt") - - def test_many(self): - # mktemp can choose many usable file names (stochastic) - extant = range(TEST_FILES) - for i in extant: - extant[i] = self.do_create(pre="aa") - -## def test_warning(self): -## # mktemp issues a warning when used -## warnings.filterwarnings("error", -## category=RuntimeWarning, -## message="mktemp") -## self.assertRaises(RuntimeWarning, -## tempfile.mktemp, dir=self.dir) - -test_classes.append(test_mktemp) - - -# We test _TemporaryFileWrapper by testing NamedTemporaryFile. - - -class test_NamedTemporaryFile(TC): - """Test NamedTemporaryFile().""" - - def do_create(self, dir=None, pre="", suf=""): - if dir is None: - dir = tempfile.gettempdir() - try: - file = tempfile.NamedTemporaryFile(dir=dir, prefix=pre, suffix=suf) - except: - self.failOnException("NamedTemporaryFile") - - self.nameCheck(file.name, dir, pre, suf) - return file - - - def test_basic(self): - # NamedTemporaryFile can create files - self.do_create() - self.do_create(pre="a") - self.do_create(suf="b") - self.do_create(pre="a", suf="b") - self.do_create(pre="aa", suf=".txt") - - def test_creates_named(self): - # NamedTemporaryFile creates files with names - f = tempfile.NamedTemporaryFile() - self.failUnless(os.path.exists(f.name), - "NamedTemporaryFile %s does not exist" % f.name) - - def test_del_on_close(self): - # A NamedTemporaryFile is deleted when closed - dir = tempfile.mkdtemp() - try: - f = tempfile.NamedTemporaryFile(dir=dir) - f.write('blat') - f.close() - self.failIf(os.path.exists(f.name), - "NamedTemporaryFile %s exists after close" % f.name) - finally: - os.rmdir(dir) - - def test_multiple_close(self): - # A NamedTemporaryFile can be closed many times without error - - f = tempfile.NamedTemporaryFile() - f.write('abc\n') - f.close() - try: - f.close() - f.close() - except: - self.failOnException("close") - - # How to test the mode and bufsize parameters? - -test_classes.append(test_NamedTemporaryFile) - - -class test_TemporaryFile(TC): - """Test TemporaryFile().""" - - def test_basic(self): - # TemporaryFile can create files - # No point in testing the name params - the file has no name. - try: - tempfile.TemporaryFile() - except: - self.failOnException("TemporaryFile") - - def test_has_no_name(self): - # TemporaryFile creates files with no names (on this system) - dir = tempfile.mkdtemp() - f = tempfile.TemporaryFile(dir=dir) - f.write('blat') - - # Sneaky: because this file has no name, it should not prevent - # us from removing the directory it was created in. - try: - os.rmdir(dir) - except: - ei = sys.exc_info() - # cleanup - f.close() - os.rmdir(dir) - self.failOnException("rmdir", ei) - - def test_multiple_close(self): - # A TemporaryFile can be closed many times without error - f = tempfile.TemporaryFile() - f.write('abc\n') - f.close() - try: - f.close() - f.close() - except: - self.failOnException("close") - - # How to test the mode and bufsize parameters? - - -if tempfile.NamedTemporaryFile is not tempfile.TemporaryFile: - test_classes.append(test_TemporaryFile) - -def test_main(): - test_support.run_unittest(*test_classes) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_textwrap.py b/sys/lib/python/test/test_textwrap.py deleted file mode 100644 index 20c059025..000000000 --- a/sys/lib/python/test/test_textwrap.py +++ /dev/null @@ -1,568 +0,0 @@ -# -# Test suite for the textwrap module. -# -# Original tests written by Greg Ward . -# Converted to PyUnit by Peter Hansen . -# Currently maintained by Greg Ward. -# -# $Id: test_textwrap.py 46863 2006-06-11 19:42:51Z tim.peters $ -# - -import unittest -from test import test_support - -from textwrap import TextWrapper, wrap, fill, dedent - - -class BaseTestCase(unittest.TestCase): - '''Parent class with utility methods for textwrap tests.''' - - def show(self, textin): - if isinstance(textin, list): - result = [] - for i in range(len(textin)): - result.append(" %d: %r" % (i, textin[i])) - result = '\n'.join(result) - elif isinstance(textin, basestring): - result = " %s\n" % repr(textin) - return result - - - def check(self, result, expect): - self.assertEquals(result, expect, - 'expected:\n%s\nbut got:\n%s' % ( - self.show(expect), self.show(result))) - - def check_wrap(self, text, width, expect, **kwargs): - result = wrap(text, width, **kwargs) - self.check(result, expect) - - def check_split(self, text, expect): - result = self.wrapper._split(text) - self.assertEquals(result, expect, - "\nexpected %r\n" - "but got %r" % (expect, result)) - - -class WrapTestCase(BaseTestCase): - - def setUp(self): - self.wrapper = TextWrapper(width=45) - - def test_simple(self): - # Simple case: just words, spaces, and a bit of punctuation - - text = "Hello there, how are you this fine day? I'm glad to hear it!" - - self.check_wrap(text, 12, - ["Hello there,", - "how are you", - "this fine", - "day? I'm", - "glad to hear", - "it!"]) - self.check_wrap(text, 42, - ["Hello there, how are you this fine day?", - "I'm glad to hear it!"]) - self.check_wrap(text, 80, [text]) - - - def test_whitespace(self): - # Whitespace munging and end-of-sentence detection - - text = """\ -This is a paragraph that already has -line breaks. But some of its lines are much longer than the others, -so it needs to be wrapped. -Some lines are \ttabbed too. -What a mess! -""" - - expect = ["This is a paragraph that already has line", - "breaks. But some of its lines are much", - "longer than the others, so it needs to be", - "wrapped. Some lines are tabbed too. What a", - "mess!"] - - wrapper = TextWrapper(45, fix_sentence_endings=True) - result = wrapper.wrap(text) - self.check(result, expect) - - result = wrapper.fill(text) - self.check(result, '\n'.join(expect)) - - def test_fix_sentence_endings(self): - wrapper = TextWrapper(60, fix_sentence_endings=True) - - # SF #847346: ensure that fix_sentence_endings=True does the - # right thing even on input short enough that it doesn't need to - # be wrapped. - text = "A short line. Note the single space." - expect = ["A short line. Note the single space."] - self.check(wrapper.wrap(text), expect) - - # Test some of the hairy end cases that _fix_sentence_endings() - # is supposed to handle (the easy stuff is tested in - # test_whitespace() above). - text = "Well, Doctor? What do you think?" - expect = ["Well, Doctor? What do you think?"] - self.check(wrapper.wrap(text), expect) - - text = "Well, Doctor?\nWhat do you think?" - self.check(wrapper.wrap(text), expect) - - text = 'I say, chaps! Anyone for "tennis?"\nHmmph!' - expect = ['I say, chaps! Anyone for "tennis?" Hmmph!'] - self.check(wrapper.wrap(text), expect) - - wrapper.width = 20 - expect = ['I say, chaps!', 'Anyone for "tennis?"', 'Hmmph!'] - self.check(wrapper.wrap(text), expect) - - text = 'And she said, "Go to hell!"\nCan you believe that?' - expect = ['And she said, "Go to', - 'hell!" Can you', - 'believe that?'] - self.check(wrapper.wrap(text), expect) - - wrapper.width = 60 - expect = ['And she said, "Go to hell!" Can you believe that?'] - self.check(wrapper.wrap(text), expect) - - def test_wrap_short(self): - # Wrapping to make short lines longer - - text = "This is a\nshort paragraph." - - self.check_wrap(text, 20, ["This is a short", - "paragraph."]) - self.check_wrap(text, 40, ["This is a short paragraph."]) - - - def test_wrap_short_1line(self): - # Test endcases - - text = "This is a short line." - - self.check_wrap(text, 30, ["This is a short line."]) - self.check_wrap(text, 30, ["(1) This is a short line."], - initial_indent="(1) ") - - - def test_hyphenated(self): - # Test breaking hyphenated words - - text = ("this-is-a-useful-feature-for-" - "reformatting-posts-from-tim-peters'ly") - - self.check_wrap(text, 40, - ["this-is-a-useful-feature-for-", - "reformatting-posts-from-tim-peters'ly"]) - self.check_wrap(text, 41, - ["this-is-a-useful-feature-for-", - "reformatting-posts-from-tim-peters'ly"]) - self.check_wrap(text, 42, - ["this-is-a-useful-feature-for-reformatting-", - "posts-from-tim-peters'ly"]) - - def test_hyphenated_numbers(self): - # Test that hyphenated numbers (eg. dates) are not broken like words. - text = ("Python 1.0.0 was released on 1994-01-26. Python 1.0.1 was\n" - "released on 1994-02-15.") - - self.check_wrap(text, 30, ['Python 1.0.0 was released on', - '1994-01-26. Python 1.0.1 was', - 'released on 1994-02-15.']) - self.check_wrap(text, 40, ['Python 1.0.0 was released on 1994-01-26.', - 'Python 1.0.1 was released on 1994-02-15.']) - - text = "I do all my shopping at 7-11." - self.check_wrap(text, 25, ["I do all my shopping at", - "7-11."]) - self.check_wrap(text, 27, ["I do all my shopping at", - "7-11."]) - self.check_wrap(text, 29, ["I do all my shopping at 7-11."]) - - def test_em_dash(self): - # Test text with em-dashes - text = "Em-dashes should be written -- thus." - self.check_wrap(text, 25, - ["Em-dashes should be", - "written -- thus."]) - - # Probe the boundaries of the properly written em-dash, - # ie. " -- ". - self.check_wrap(text, 29, - ["Em-dashes should be written", - "-- thus."]) - expect = ["Em-dashes should be written --", - "thus."] - self.check_wrap(text, 30, expect) - self.check_wrap(text, 35, expect) - self.check_wrap(text, 36, - ["Em-dashes should be written -- thus."]) - - # The improperly written em-dash is handled too, because - # it's adjacent to non-whitespace on both sides. - text = "You can also do--this or even---this." - expect = ["You can also do", - "--this or even", - "---this."] - self.check_wrap(text, 15, expect) - self.check_wrap(text, 16, expect) - expect = ["You can also do--", - "this or even---", - "this."] - self.check_wrap(text, 17, expect) - self.check_wrap(text, 19, expect) - expect = ["You can also do--this or even", - "---this."] - self.check_wrap(text, 29, expect) - self.check_wrap(text, 31, expect) - expect = ["You can also do--this or even---", - "this."] - self.check_wrap(text, 32, expect) - self.check_wrap(text, 35, expect) - - # All of the above behaviour could be deduced by probing the - # _split() method. - text = "Here's an -- em-dash and--here's another---and another!" - expect = ["Here's", " ", "an", " ", "--", " ", "em-", "dash", " ", - "and", "--", "here's", " ", "another", "---", - "and", " ", "another!"] - self.check_split(text, expect) - - text = "and then--bam!--he was gone" - expect = ["and", " ", "then", "--", "bam!", "--", - "he", " ", "was", " ", "gone"] - self.check_split(text, expect) - - - def test_unix_options (self): - # Test that Unix-style command-line options are wrapped correctly. - # Both Optik (OptionParser) and Docutils rely on this behaviour! - - text = "You should use the -n option, or --dry-run in its long form." - self.check_wrap(text, 20, - ["You should use the", - "-n option, or --dry-", - "run in its long", - "form."]) - self.check_wrap(text, 21, - ["You should use the -n", - "option, or --dry-run", - "in its long form."]) - expect = ["You should use the -n option, or", - "--dry-run in its long form."] - self.check_wrap(text, 32, expect) - self.check_wrap(text, 34, expect) - self.check_wrap(text, 35, expect) - self.check_wrap(text, 38, expect) - expect = ["You should use the -n option, or --dry-", - "run in its long form."] - self.check_wrap(text, 39, expect) - self.check_wrap(text, 41, expect) - expect = ["You should use the -n option, or --dry-run", - "in its long form."] - self.check_wrap(text, 42, expect) - - # Again, all of the above can be deduced from _split(). - text = "the -n option, or --dry-run or --dryrun" - expect = ["the", " ", "-n", " ", "option,", " ", "or", " ", - "--dry-", "run", " ", "or", " ", "--dryrun"] - self.check_split(text, expect) - - def test_funky_hyphens (self): - # Screwy edge cases cooked up by David Goodger. All reported - # in SF bug #596434. - self.check_split("what the--hey!", ["what", " ", "the", "--", "hey!"]) - self.check_split("what the--", ["what", " ", "the--"]) - self.check_split("what the--.", ["what", " ", "the--."]) - self.check_split("--text--.", ["--text--."]) - - # When I first read bug #596434, this is what I thought David - # was talking about. I was wrong; these have always worked - # fine. The real problem is tested in test_funky_parens() - # below... - self.check_split("--option", ["--option"]) - self.check_split("--option-opt", ["--option-", "opt"]) - self.check_split("foo --option-opt bar", - ["foo", " ", "--option-", "opt", " ", "bar"]) - - def test_punct_hyphens(self): - # Oh bother, SF #965425 found another problem with hyphens -- - # hyphenated words in single quotes weren't handled correctly. - # In fact, the bug is that *any* punctuation around a hyphenated - # word was handled incorrectly, except for a leading "--", which - # was special-cased for Optik and Docutils. So test a variety - # of styles of punctuation around a hyphenated word. - # (Actually this is based on an Optik bug report, #813077). - self.check_split("the 'wibble-wobble' widget", - ['the', ' ', "'wibble-", "wobble'", ' ', 'widget']) - self.check_split('the "wibble-wobble" widget', - ['the', ' ', '"wibble-', 'wobble"', ' ', 'widget']) - self.check_split("the (wibble-wobble) widget", - ['the', ' ', "(wibble-", "wobble)", ' ', 'widget']) - self.check_split("the ['wibble-wobble'] widget", - ['the', ' ', "['wibble-", "wobble']", ' ', 'widget']) - - def test_funky_parens (self): - # Second part of SF bug #596434: long option strings inside - # parentheses. - self.check_split("foo (--option) bar", - ["foo", " ", "(--option)", " ", "bar"]) - - # Related stuff -- make sure parens work in simpler contexts. - self.check_split("foo (bar) baz", - ["foo", " ", "(bar)", " ", "baz"]) - self.check_split("blah (ding dong), wubba", - ["blah", " ", "(ding", " ", "dong),", - " ", "wubba"]) - - def test_initial_whitespace(self): - # SF bug #622849 reported inconsistent handling of leading - # whitespace; let's test that a bit, shall we? - text = " This is a sentence with leading whitespace." - self.check_wrap(text, 50, - [" This is a sentence with leading whitespace."]) - self.check_wrap(text, 30, - [" This is a sentence with", "leading whitespace."]) - - if test_support.have_unicode: - def test_unicode(self): - # *Very* simple test of wrapping Unicode strings. I'm sure - # there's more to it than this, but let's at least make - # sure textwrap doesn't crash on Unicode input! - text = u"Hello there, how are you today?" - self.check_wrap(text, 50, [u"Hello there, how are you today?"]) - self.check_wrap(text, 20, [u"Hello there, how are", "you today?"]) - olines = self.wrapper.wrap(text) - assert isinstance(olines, list) and isinstance(olines[0], unicode) - otext = self.wrapper.fill(text) - assert isinstance(otext, unicode) - - def test_split(self): - # Ensure that the standard _split() method works as advertised - # in the comments - - text = "Hello there -- you goof-ball, use the -b option!" - - result = self.wrapper._split(text) - self.check(result, - ["Hello", " ", "there", " ", "--", " ", "you", " ", "goof-", - "ball,", " ", "use", " ", "the", " ", "-b", " ", "option!"]) - - def test_bad_width(self): - # Ensure that width <= 0 is caught. - text = "Whatever, it doesn't matter." - self.assertRaises(ValueError, wrap, text, 0) - self.assertRaises(ValueError, wrap, text, -1) - - -class LongWordTestCase (BaseTestCase): - def setUp(self): - self.wrapper = TextWrapper() - self.text = '''\ -Did you say "supercalifragilisticexpialidocious?" -How *do* you spell that odd word, anyways? -''' - - def test_break_long(self): - # Wrap text with long words and lots of punctuation - - self.check_wrap(self.text, 30, - ['Did you say "supercalifragilis', - 'ticexpialidocious?" How *do*', - 'you spell that odd word,', - 'anyways?']) - self.check_wrap(self.text, 50, - ['Did you say "supercalifragilisticexpialidocious?"', - 'How *do* you spell that odd word, anyways?']) - - # SF bug 797650. Prevent an infinite loop by making sure that at - # least one character gets split off on every pass. - self.check_wrap('-'*10+'hello', 10, - ['----------', - ' h', - ' e', - ' l', - ' l', - ' o'], - subsequent_indent = ' '*15) - - def test_nobreak_long(self): - # Test with break_long_words disabled - self.wrapper.break_long_words = 0 - self.wrapper.width = 30 - expect = ['Did you say', - '"supercalifragilisticexpialidocious?"', - 'How *do* you spell that odd', - 'word, anyways?' - ] - result = self.wrapper.wrap(self.text) - self.check(result, expect) - - # Same thing with kwargs passed to standalone wrap() function. - result = wrap(self.text, width=30, break_long_words=0) - self.check(result, expect) - - -class IndentTestCases(BaseTestCase): - - # called before each test method - def setUp(self): - self.text = '''\ -This paragraph will be filled, first without any indentation, -and then with some (including a hanging indent).''' - - - def test_fill(self): - # Test the fill() method - - expect = '''\ -This paragraph will be filled, first -without any indentation, and then with -some (including a hanging indent).''' - - result = fill(self.text, 40) - self.check(result, expect) - - - def test_initial_indent(self): - # Test initial_indent parameter - - expect = [" This paragraph will be filled,", - "first without any indentation, and then", - "with some (including a hanging indent)."] - result = wrap(self.text, 40, initial_indent=" ") - self.check(result, expect) - - expect = "\n".join(expect) - result = fill(self.text, 40, initial_indent=" ") - self.check(result, expect) - - - def test_subsequent_indent(self): - # Test subsequent_indent parameter - - expect = '''\ - * This paragraph will be filled, first - without any indentation, and then - with some (including a hanging - indent).''' - - result = fill(self.text, 40, - initial_indent=" * ", subsequent_indent=" ") - self.check(result, expect) - - -# Despite the similar names, DedentTestCase is *not* the inverse -# of IndentTestCase! -class DedentTestCase(unittest.TestCase): - - def assertUnchanged(self, text): - """assert that dedent() has no effect on 'text'""" - self.assertEquals(text, dedent(text)) - - def test_dedent_nomargin(self): - # No lines indented. - text = "Hello there.\nHow are you?\nOh good, I'm glad." - self.assertUnchanged(text) - - # Similar, with a blank line. - text = "Hello there.\n\nBoo!" - self.assertUnchanged(text) - - # Some lines indented, but overall margin is still zero. - text = "Hello there.\n This is indented." - self.assertUnchanged(text) - - # Again, add a blank line. - text = "Hello there.\n\n Boo!\n" - self.assertUnchanged(text) - - def test_dedent_even(self): - # All lines indented by two spaces. - text = " Hello there.\n How are ya?\n Oh good." - expect = "Hello there.\nHow are ya?\nOh good." - self.assertEquals(expect, dedent(text)) - - # Same, with blank lines. - text = " Hello there.\n\n How are ya?\n Oh good.\n" - expect = "Hello there.\n\nHow are ya?\nOh good.\n" - self.assertEquals(expect, dedent(text)) - - # Now indent one of the blank lines. - text = " Hello there.\n \n How are ya?\n Oh good.\n" - expect = "Hello there.\n\nHow are ya?\nOh good.\n" - self.assertEquals(expect, dedent(text)) - - def test_dedent_uneven(self): - # Lines indented unevenly. - text = '''\ - def foo(): - while 1: - return foo - ''' - expect = '''\ -def foo(): - while 1: - return foo -''' - self.assertEquals(expect, dedent(text)) - - # Uneven indentation with a blank line. - text = " Foo\n Bar\n\n Baz\n" - expect = "Foo\n Bar\n\n Baz\n" - self.assertEquals(expect, dedent(text)) - - # Uneven indentation with a whitespace-only line. - text = " Foo\n Bar\n \n Baz\n" - expect = "Foo\n Bar\n\n Baz\n" - self.assertEquals(expect, dedent(text)) - - # dedent() should not mangle internal tabs - def test_dedent_preserve_internal_tabs(self): - text = " hello\tthere\n how are\tyou?" - expect = "hello\tthere\nhow are\tyou?" - self.assertEquals(expect, dedent(text)) - - # make sure that it preserves tabs when it's not making any - # changes at all - self.assertEquals(expect, dedent(expect)) - - # dedent() should not mangle tabs in the margin (i.e. - # tabs and spaces both count as margin, but are *not* - # considered equivalent) - def test_dedent_preserve_margin_tabs(self): - text = " hello there\n\thow are you?" - self.assertUnchanged(text) - - # same effect even if we have 8 spaces - text = " hello there\n\thow are you?" - self.assertUnchanged(text) - - # dedent() only removes whitespace that can be uniformly removed! - text = "\thello there\n\thow are you?" - expect = "hello there\nhow are you?" - self.assertEquals(expect, dedent(text)) - - text = " \thello there\n \thow are you?" - self.assertEquals(expect, dedent(text)) - - text = " \t hello there\n \t how are you?" - self.assertEquals(expect, dedent(text)) - - text = " \thello there\n \t how are you?" - expect = "hello there\n how are you?" - self.assertEquals(expect, dedent(text)) - - -def test_main(): - test_support.run_unittest(WrapTestCase, - LongWordTestCase, - IndentTestCases, - DedentTestCase) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_thread.py b/sys/lib/python/test/test_thread.py deleted file mode 100644 index c4c21fed0..000000000 --- a/sys/lib/python/test/test_thread.py +++ /dev/null @@ -1,160 +0,0 @@ -# Very rudimentary test of thread module - -# Create a bunch of threads, let each do some work, wait until all are done - -from test.test_support import verbose -import random -import thread -import time - -mutex = thread.allocate_lock() -rmutex = thread.allocate_lock() # for calls to random -running = 0 -done = thread.allocate_lock() -done.acquire() - -numtasks = 10 - -def task(ident): - global running - rmutex.acquire() - delay = random.random() * numtasks - rmutex.release() - if verbose: - print 'task', ident, 'will run for', round(delay, 1), 'sec' - time.sleep(delay) - if verbose: - print 'task', ident, 'done' - mutex.acquire() - running = running - 1 - if running == 0: - done.release() - mutex.release() - -next_ident = 0 -def newtask(): - global next_ident, running - mutex.acquire() - next_ident = next_ident + 1 - if verbose: - print 'creating task', next_ident - thread.start_new_thread(task, (next_ident,)) - running = running + 1 - mutex.release() - -for i in range(numtasks): - newtask() - -print 'waiting for all tasks to complete' -done.acquire() -print 'all tasks done' - -class barrier: - def __init__(self, n): - self.n = n - self.waiting = 0 - self.checkin = thread.allocate_lock() - self.checkout = thread.allocate_lock() - self.checkout.acquire() - - def enter(self): - checkin, checkout = self.checkin, self.checkout - - checkin.acquire() - self.waiting = self.waiting + 1 - if self.waiting == self.n: - self.waiting = self.n - 1 - checkout.release() - return - checkin.release() - - checkout.acquire() - self.waiting = self.waiting - 1 - if self.waiting == 0: - checkin.release() - return - checkout.release() - -numtrips = 3 -def task2(ident): - global running - for i in range(numtrips): - if ident == 0: - # give it a good chance to enter the next - # barrier before the others are all out - # of the current one - delay = 0.001 - else: - rmutex.acquire() - delay = random.random() * numtasks - rmutex.release() - if verbose: - print 'task', ident, 'will run for', round(delay, 1), 'sec' - time.sleep(delay) - if verbose: - print 'task', ident, 'entering barrier', i - bar.enter() - if verbose: - print 'task', ident, 'leaving barrier', i - mutex.acquire() - running -= 1 - # Must release mutex before releasing done, else the main thread can - # exit and set mutex to None as part of global teardown; then - # mutex.release() raises AttributeError. - finished = running == 0 - mutex.release() - if finished: - done.release() - -print '\n*** Barrier Test ***' -if done.acquire(0): - raise ValueError, "'done' should have remained acquired" -bar = barrier(numtasks) -running = numtasks -for i in range(numtasks): - thread.start_new_thread(task2, (i,)) -done.acquire() -print 'all tasks done' - -# not all platforms support changing thread stack size -print '\n*** Changing thread stack size ***' -if thread.stack_size() != 0: - raise ValueError, "initial stack_size not 0" - -thread.stack_size(0) -if thread.stack_size() != 0: - raise ValueError, "stack_size not reset to default" - -from os import name as os_name -if os_name in ("nt", "os2", "posix"): - - tss_supported = 1 - try: - thread.stack_size(4096) - except ValueError: - print 'caught expected ValueError setting stack_size(4096)' - except thread.error: - tss_supported = 0 - print 'platform does not support changing thread stack size' - - if tss_supported: - failed = lambda s, e: s != e - fail_msg = "stack_size(%d) failed - should succeed" - for tss in (262144, 0x100000, 0): - thread.stack_size(tss) - if failed(thread.stack_size(), tss): - raise ValueError, fail_msg % tss - print 'successfully set stack_size(%d)' % tss - - for tss in (262144, 0x100000): - print 'trying stack_size = %d' % tss - next_ident = 0 - for i in range(numtasks): - newtask() - - print 'waiting for all tasks to complete' - done.acquire() - print 'all tasks done' - - # reset stack size to default - thread.stack_size(0) diff --git a/sys/lib/python/test/test_threaded_import.py b/sys/lib/python/test/test_threaded_import.py deleted file mode 100644 index 602ad2af9..000000000 --- a/sys/lib/python/test/test_threaded_import.py +++ /dev/null @@ -1,75 +0,0 @@ -# This is a variant of the very old (early 90's) file -# Demo/threads/bug.py. It simply provokes a number of threads into -# trying to import the same module "at the same time". -# There are no pleasant failure modes -- most likely is that Python -# complains several times about module random having no attribute -# randrange, and then Python hangs. - -import thread -from test.test_support import verbose, TestSkipped, TestFailed - -critical_section = thread.allocate_lock() -done = thread.allocate_lock() - -def task(): - global N, critical_section, done - import random - x = random.randrange(1, 3) - critical_section.acquire() - N -= 1 - # Must release critical_section before releasing done, else the main - # thread can exit and set critical_section to None as part of global - # teardown; then critical_section.release() raises AttributeError. - finished = N == 0 - critical_section.release() - if finished: - done.release() - -def test_import_hangers(): - import sys - if verbose: - print "testing import hangers ...", - - import test.threaded_import_hangers - try: - if test.threaded_import_hangers.errors: - raise TestFailed(test.threaded_import_hangers.errors) - elif verbose: - print "OK." - finally: - # In case this test is run again, make sure the helper module - # gets loaded from scratch again. - del sys.modules['test.threaded_import_hangers'] - -# Tricky: When regrtest imports this module, the thread running regrtest -# grabs the import lock and won't let go of it until this module returns. -# All other threads attempting an import hang for the duration. Since -# this test spawns threads that do little *but* import, we can't do that -# successfully until after this module finishes importing and regrtest -# regains control. To make this work, a special case was added to -# regrtest to invoke a module's "test_main" function (if any) after -# importing it. - -def test_main(): # magic name! see above - global N, done - - import imp - if imp.lock_held(): - # This triggers on, e.g., from test import autotest. - raise TestSkipped("can't run when import lock is held") - - done.acquire() - for N in (20, 50) * 3: - if verbose: - print "Trying", N, "threads ...", - for i in range(N): - thread.start_new_thread(task, ()) - done.acquire() - if verbose: - print "OK." - done.release() - - test_import_hangers() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_threadedtempfile.py b/sys/lib/python/test/test_threadedtempfile.py deleted file mode 100644 index 974333b48..000000000 --- a/sys/lib/python/test/test_threadedtempfile.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Create and delete FILES_PER_THREAD temp files (via tempfile.TemporaryFile) -in each of NUM_THREADS threads, recording the number of successes and -failures. A failure is a bug in tempfile, and may be due to: - -+ Trying to create more than one tempfile with the same name. -+ Trying to delete a tempfile that doesn't still exist. -+ Something we've never seen before. - -By default, NUM_THREADS == 20 and FILES_PER_THREAD == 50. This is enough to -create about 150 failures per run under Win98SE in 2.0, and runs pretty -quickly. Guido reports needing to boost FILES_PER_THREAD to 500 before -provoking a 2.0 failure under Linux. Run the test alone to boost either -via cmdline switches: - --f FILES_PER_THREAD (int) --t NUM_THREADS (int) -""" - -NUM_THREADS = 20 # change w/ -t option -FILES_PER_THREAD = 50 # change w/ -f option - -import thread # If this fails, we can't test this module -import threading -from test.test_support import TestFailed, threading_setup, threading_cleanup -import StringIO -from traceback import print_exc -import tempfile - -startEvent = threading.Event() - -class TempFileGreedy(threading.Thread): - error_count = 0 - ok_count = 0 - - def run(self): - self.errors = StringIO.StringIO() - startEvent.wait() - for i in range(FILES_PER_THREAD): - try: - f = tempfile.TemporaryFile("w+b") - f.close() - except: - self.error_count += 1 - print_exc(file=self.errors) - else: - self.ok_count += 1 - -def test_main(): - threads = [] - thread_info = threading_setup() - - print "Creating" - for i in range(NUM_THREADS): - t = TempFileGreedy() - threads.append(t) - t.start() - - print "Starting" - startEvent.set() - - print "Reaping" - ok = errors = 0 - for t in threads: - t.join() - ok += t.ok_count - errors += t.error_count - if t.error_count: - print '%s errors:\n%s' % (t.getName(), t.errors.getvalue()) - - msg = "Done: errors %d ok %d" % (errors, ok) - print msg - if errors: - raise TestFailed(msg) - - threading_cleanup(*thread_info) - -if __name__ == "__main__": - import sys, getopt - opts, args = getopt.getopt(sys.argv[1:], "t:f:") - for o, v in opts: - if o == "-f": - FILES_PER_THREAD = int(v) - elif o == "-t": - NUM_THREADS = int(v) - test_main() diff --git a/sys/lib/python/test/test_threading.py b/sys/lib/python/test/test_threading.py deleted file mode 100644 index 8614ecb49..000000000 --- a/sys/lib/python/test/test_threading.py +++ /dev/null @@ -1,208 +0,0 @@ -# Very rudimentary test of threading module - -import test.test_support -from test.test_support import verbose -import random -import threading -import thread -import time -import unittest - -# A trivial mutable counter. -class Counter(object): - def __init__(self): - self.value = 0 - def inc(self): - self.value += 1 - def dec(self): - self.value -= 1 - def get(self): - return self.value - -class TestThread(threading.Thread): - def __init__(self, name, testcase, sema, mutex, nrunning): - threading.Thread.__init__(self, name=name) - self.testcase = testcase - self.sema = sema - self.mutex = mutex - self.nrunning = nrunning - - def run(self): - delay = random.random() * 2 - if verbose: - print 'task', self.getName(), 'will run for', delay, 'sec' - - self.sema.acquire() - - self.mutex.acquire() - self.nrunning.inc() - if verbose: - print self.nrunning.get(), 'tasks are running' - self.testcase.assert_(self.nrunning.get() <= 3) - self.mutex.release() - - time.sleep(delay) - if verbose: - print 'task', self.getName(), 'done' - - self.mutex.acquire() - self.nrunning.dec() - self.testcase.assert_(self.nrunning.get() >= 0) - if verbose: - print self.getName(), 'is finished.', self.nrunning.get(), \ - 'tasks are running' - self.mutex.release() - - self.sema.release() - -class ThreadTests(unittest.TestCase): - - # Create a bunch of threads, let each do some work, wait until all are - # done. - def test_various_ops(self): - # This takes about n/3 seconds to run (about n/3 clumps of tasks, - # times about 1 second per clump). - NUMTASKS = 10 - - # no more than 3 of the 10 can run at once - sema = threading.BoundedSemaphore(value=3) - mutex = threading.RLock() - numrunning = Counter() - - threads = [] - - for i in range(NUMTASKS): - t = TestThread(""%i, self, sema, mutex, numrunning) - threads.append(t) - t.start() - - if verbose: - print 'waiting for all tasks to complete' - for t in threads: - t.join(NUMTASKS) - self.assert_(not t.isAlive()) - if verbose: - print 'all tasks done' - self.assertEqual(numrunning.get(), 0) - - # run with a small(ish) thread stack size (256kB) - def test_various_ops_small_stack(self): - if verbose: - print 'with 256kB thread stack size...' - try: - threading.stack_size(262144) - except thread.error: - if verbose: - print 'platform does not support changing thread stack size' - return - self.test_various_ops() - threading.stack_size(0) - - # run with a large thread stack size (1MB) - def test_various_ops_large_stack(self): - if verbose: - print 'with 1MB thread stack size...' - try: - threading.stack_size(0x100000) - except thread.error: - if verbose: - print 'platform does not support changing thread stack size' - return - self.test_various_ops() - threading.stack_size(0) - - def test_foreign_thread(self): - # Check that a "foreign" thread can use the threading module. - def f(mutex): - # Acquiring an RLock forces an entry for the foreign - # thread to get made in the threading._active map. - r = threading.RLock() - r.acquire() - r.release() - mutex.release() - - mutex = threading.Lock() - mutex.acquire() - tid = thread.start_new_thread(f, (mutex,)) - # Wait for the thread to finish. - mutex.acquire() - self.assert_(tid in threading._active) - self.assert_(isinstance(threading._active[tid], - threading._DummyThread)) - del threading._active[tid] - - # PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently) - # exposed at the Python level. This test relies on ctypes to get at it. - def test_PyThreadState_SetAsyncExc(self): - try: - import ctypes - except ImportError: - if verbose: - print "test_PyThreadState_SetAsyncExc can't import ctypes" - return # can't do anything - - set_async_exc = ctypes.pythonapi.PyThreadState_SetAsyncExc - - class AsyncExc(Exception): - pass - - exception = ctypes.py_object(AsyncExc) - - # `worker_started` is set by the thread when it's inside a try/except - # block waiting to catch the asynchronously set AsyncExc exception. - # `worker_saw_exception` is set by the thread upon catching that - # exception. - worker_started = threading.Event() - worker_saw_exception = threading.Event() - - class Worker(threading.Thread): - def run(self): - self.id = thread.get_ident() - self.finished = False - - try: - while True: - worker_started.set() - time.sleep(0.1) - except AsyncExc: - self.finished = True - worker_saw_exception.set() - - t = Worker() - t.setDaemon(True) # so if this fails, we don't hang Python at shutdown - t.start() - if verbose: - print " started worker thread" - - # Try a thread id that doesn't make sense. - if verbose: - print " trying nonsensical thread id" - result = set_async_exc(ctypes.c_long(-1), exception) - self.assertEqual(result, 0) # no thread states modified - - # Now raise an exception in the worker thread. - if verbose: - print " waiting for worker thread to get started" - worker_started.wait() - if verbose: - print " verifying worker hasn't exited" - self.assert_(not t.finished) - if verbose: - print " attempting to raise asynch exception in worker" - result = set_async_exc(ctypes.c_long(t.id), exception) - self.assertEqual(result, 1) # one thread state modified - if verbose: - print " waiting for worker to say it caught the exception" - worker_saw_exception.wait(timeout=10) - self.assert_(t.finished) - if verbose: - print " all OK -- joining worker" - if t.finished: - t.join() - # else the thread is still running, and we have no way to kill it - -def test_main(): - test.test_support.run_unittest(ThreadTests) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_threading_local.py b/sys/lib/python/test/test_threading_local.py deleted file mode 100644 index 56fbeddcc..000000000 --- a/sys/lib/python/test/test_threading_local.py +++ /dev/null @@ -1,26 +0,0 @@ -import unittest -from doctest import DocTestSuite -from test import test_support - -def test_main(): - suite = DocTestSuite('_threading_local') - - try: - from thread import _local - except ImportError: - pass - else: - import _threading_local - local_orig = _threading_local.local - def setUp(test): - _threading_local.local = _local - def tearDown(test): - _threading_local.local = local_orig - suite.addTest(DocTestSuite('_threading_local', - setUp=setUp, tearDown=tearDown) - ) - - test_support.run_suite(suite) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_threadsignals.py b/sys/lib/python/test/test_threadsignals.py deleted file mode 100644 index 1f10fe722..000000000 --- a/sys/lib/python/test/test_threadsignals.py +++ /dev/null @@ -1,84 +0,0 @@ -"""PyUnit testing that threads honor our signal semantics""" - -import unittest -import thread -import signal -import os -import sys -from test.test_support import run_unittest, TestSkipped - -if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos': - raise TestSkipped, "Can't test signal on %s" % sys.platform - -process_pid = os.getpid() -signalled_all=thread.allocate_lock() - - -def registerSignals((for_usr1, for_usr2, for_alrm)): - usr1 = signal.signal(signal.SIGUSR1, for_usr1) - usr2 = signal.signal(signal.SIGUSR2, for_usr2) - alrm = signal.signal(signal.SIGALRM, for_alrm) - return usr1, usr2, alrm - - -# The signal handler. Just note that the signal occurred and -# from who. -def handle_signals(sig,frame): - signal_blackboard[sig]['tripped'] += 1 - signal_blackboard[sig]['tripped_by'] = thread.get_ident() - -# a function that will be spawned as a separate thread. -def send_signals(): - os.kill(process_pid, signal.SIGUSR1) - os.kill(process_pid, signal.SIGUSR2) - signalled_all.release() - -class ThreadSignals(unittest.TestCase): - """Test signal handling semantics of threads. - We spawn a thread, have the thread send two signals, and - wait for it to finish. Check that we got both signals - and that they were run by the main thread. - """ - def test_signals(self): - signalled_all.acquire() - self.spawnSignallingThread() - signalled_all.acquire() - # the signals that we asked the kernel to send - # will come back, but we don't know when. - # (it might even be after the thread exits - # and might be out of order.) If we haven't seen - # the signals yet, send yet another signal and - # wait for it return. - if signal_blackboard[signal.SIGUSR1]['tripped'] == 0 \ - or signal_blackboard[signal.SIGUSR2]['tripped'] == 0: - signal.alarm(1) - signal.pause() - signal.alarm(0) - - self.assertEqual( signal_blackboard[signal.SIGUSR1]['tripped'], 1) - self.assertEqual( signal_blackboard[signal.SIGUSR1]['tripped_by'], - thread.get_ident()) - self.assertEqual( signal_blackboard[signal.SIGUSR2]['tripped'], 1) - self.assertEqual( signal_blackboard[signal.SIGUSR2]['tripped_by'], - thread.get_ident()) - signalled_all.release() - - def spawnSignallingThread(self): - thread.start_new_thread(send_signals, ()) - - -def test_main(): - global signal_blackboard - - signal_blackboard = { signal.SIGUSR1 : {'tripped': 0, 'tripped_by': 0 }, - signal.SIGUSR2 : {'tripped': 0, 'tripped_by': 0 }, - signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } } - - oldsigs = registerSignals((handle_signals, handle_signals, handle_signals)) - try: - run_unittest(ThreadSignals) - finally: - registerSignals(oldsigs) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_time.py b/sys/lib/python/test/test_time.py deleted file mode 100644 index f4be7590f..000000000 --- a/sys/lib/python/test/test_time.py +++ /dev/null @@ -1,222 +0,0 @@ -from test import test_support -import time -import unittest - - -class TimeTestCase(unittest.TestCase): - - def setUp(self): - self.t = time.time() - - def test_data_attributes(self): - time.altzone - time.daylight - time.timezone - time.tzname - - def test_clock(self): - time.clock() - - def test_conversions(self): - self.assert_(time.ctime(self.t) - == time.asctime(time.localtime(self.t))) - self.assert_(long(time.mktime(time.localtime(self.t))) - == long(self.t)) - - def test_sleep(self): - time.sleep(1.2) - - def test_strftime(self): - tt = time.gmtime(self.t) - for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', - 'j', 'm', 'M', 'p', 'S', - 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): - format = ' %' + directive - try: - time.strftime(format, tt) - except ValueError: - self.fail('conversion specifier: %r failed.' % format) - - def test_strftime_bounds_checking(self): - # Make sure that strftime() checks the bounds of the various parts - #of the time tuple (0 is valid for *all* values). - - # Check year [1900, max(int)] - self.assertRaises(ValueError, time.strftime, '', - (1899, 1, 1, 0, 0, 0, 0, 1, -1)) - if time.accept2dyear: - self.assertRaises(ValueError, time.strftime, '', - (-1, 1, 1, 0, 0, 0, 0, 1, -1)) - self.assertRaises(ValueError, time.strftime, '', - (100, 1, 1, 0, 0, 0, 0, 1, -1)) - # Check month [1, 12] + zero support - self.assertRaises(ValueError, time.strftime, '', - (1900, -1, 1, 0, 0, 0, 0, 1, -1)) - self.assertRaises(ValueError, time.strftime, '', - (1900, 13, 1, 0, 0, 0, 0, 1, -1)) - # Check day of month [1, 31] + zero support - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, -1, 0, 0, 0, 0, 1, -1)) - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 32, 0, 0, 0, 0, 1, -1)) - # Check hour [0, 23] - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, -1, 0, 0, 0, 1, -1)) - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 24, 0, 0, 0, 1, -1)) - # Check minute [0, 59] - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 0, -1, 0, 0, 1, -1)) - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 0, 60, 0, 0, 1, -1)) - # Check second [0, 61] - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 0, 0, -1, 0, 1, -1)) - # C99 only requires allowing for one leap second, but Python's docs say - # allow two leap seconds (0..61) - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 0, 0, 62, 0, 1, -1)) - # No check for upper-bound day of week; - # value forced into range by a ``% 7`` calculation. - # Start check at -2 since gettmarg() increments value before taking - # modulo. - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 0, 0, 0, -2, 1, -1)) - # Check day of the year [1, 366] + zero support - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 0, 0, 0, 0, -1, -1)) - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 0, 0, 0, 0, 367, -1)) - # Check daylight savings flag [-1, 1] - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 0, 0, 0, 0, 1, -2)) - self.assertRaises(ValueError, time.strftime, '', - (1900, 1, 1, 0, 0, 0, 0, 1, 2)) - - def test_default_values_for_zero(self): - # Make sure that using all zeros uses the proper default values. - # No test for daylight savings since strftime() does not change output - # based on its value. - expected = "2000 01 01 00 00 00 1 001" - result = time.strftime("%Y %m %d %H %M %S %w %j", (0,)*9) - self.assertEquals(expected, result) - - def test_strptime(self): - tt = time.gmtime(self.t) - for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', - 'j', 'm', 'M', 'p', 'S', - 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): - format = ' %' + directive - try: - time.strptime(time.strftime(format, tt), format) - except ValueError: - self.fail('conversion specifier: %r failed.' % format) - - def test_asctime(self): - time.asctime(time.gmtime(self.t)) - self.assertRaises(TypeError, time.asctime, 0) - - def test_tzset(self): - if not hasattr(time, "tzset"): - return # Can't test this; don't want the test suite to fail - - from os import environ - - # Epoch time of midnight Dec 25th 2002. Never DST in northern - # hemisphere. - xmas2002 = 1040774400.0 - - # These formats are correct for 2002, and possibly future years - # This format is the 'standard' as documented at: - # http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html - # They are also documented in the tzset(3) man page on most Unix - # systems. - eastern = 'EST+05EDT,M4.1.0,M10.5.0' - victoria = 'AEST-10AEDT-11,M10.5.0,M3.5.0' - utc='UTC+0' - - org_TZ = environ.get('TZ',None) - try: - # Make sure we can switch to UTC time and results are correct - # Note that unknown timezones default to UTC. - # Note that altzone is undefined in UTC, as there is no DST - environ['TZ'] = eastern - time.tzset() - environ['TZ'] = utc - time.tzset() - self.failUnlessEqual( - time.gmtime(xmas2002), time.localtime(xmas2002) - ) - self.failUnlessEqual(time.daylight, 0) - self.failUnlessEqual(time.timezone, 0) - self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 0) - - # Make sure we can switch to US/Eastern - environ['TZ'] = eastern - time.tzset() - self.failIfEqual(time.gmtime(xmas2002), time.localtime(xmas2002)) - self.failUnlessEqual(time.tzname, ('EST', 'EDT')) - self.failUnlessEqual(len(time.tzname), 2) - self.failUnlessEqual(time.daylight, 1) - self.failUnlessEqual(time.timezone, 18000) - self.failUnlessEqual(time.altzone, 14400) - self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 0) - self.failUnlessEqual(len(time.tzname), 2) - - # Now go to the southern hemisphere. - environ['TZ'] = victoria - time.tzset() - self.failIfEqual(time.gmtime(xmas2002), time.localtime(xmas2002)) - self.failUnless(time.tzname[0] == 'AEST', str(time.tzname[0])) - self.failUnless(time.tzname[1] == 'AEDT', str(time.tzname[1])) - self.failUnlessEqual(len(time.tzname), 2) - self.failUnlessEqual(time.daylight, 1) - self.failUnlessEqual(time.timezone, -36000) - self.failUnlessEqual(time.altzone, -39600) - self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 1) - - finally: - # Repair TZ environment variable in case any other tests - # rely on it. - if org_TZ is not None: - environ['TZ'] = org_TZ - elif environ.has_key('TZ'): - del environ['TZ'] - time.tzset() - - def test_insane_timestamps(self): - # It's possible that some platform maps time_t to double, - # and that this test will fail there. This test should - # exempt such platforms (provided they return reasonable - # results!). - for func in time.ctime, time.gmtime, time.localtime: - for unreasonable in -1e200, 1e200: - self.assertRaises(ValueError, func, unreasonable) - - def test_ctime_without_arg(self): - # Not sure how to check the values, since the clock could tick - # at any time. Make sure these are at least accepted and - # don't raise errors. - time.ctime() - time.ctime(None) - - def test_gmtime_without_arg(self): - gt0 = time.gmtime() - gt1 = time.gmtime(None) - t0 = time.mktime(gt0) - t1 = time.mktime(gt1) - self.assert_(0 <= (t1-t0) < 0.2) - - def test_localtime_without_arg(self): - lt0 = time.localtime() - lt1 = time.localtime(None) - t0 = time.mktime(lt0) - t1 = time.mktime(lt1) - self.assert_(0 <= (t1-t0) < 0.2) - -def test_main(): - test_support.run_unittest(TimeTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_timeout.py b/sys/lib/python/test/test_timeout.py deleted file mode 100644 index 2b32b92d3..000000000 --- a/sys/lib/python/test/test_timeout.py +++ /dev/null @@ -1,198 +0,0 @@ -"""Unit tests for socket timeout feature.""" - -import unittest -from test import test_support - -# This requires the 'network' resource as given on the regrtest command line. -skip_expected = not test_support.is_resource_enabled('network') - -import time -import socket - - -class CreationTestCase(unittest.TestCase): - """Test case for socket.gettimeout() and socket.settimeout()""" - - def setUp(self): - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - - def tearDown(self): - self.sock.close() - - def testObjectCreation(self): - # Test Socket creation - self.assertEqual(self.sock.gettimeout(), None, - "timeout not disabled by default") - - def testFloatReturnValue(self): - # Test return value of gettimeout() - self.sock.settimeout(7.345) - self.assertEqual(self.sock.gettimeout(), 7.345) - - self.sock.settimeout(3) - self.assertEqual(self.sock.gettimeout(), 3) - - self.sock.settimeout(None) - self.assertEqual(self.sock.gettimeout(), None) - - def testReturnType(self): - # Test return type of gettimeout() - self.sock.settimeout(1) - self.assertEqual(type(self.sock.gettimeout()), type(1.0)) - - self.sock.settimeout(3.9) - self.assertEqual(type(self.sock.gettimeout()), type(1.0)) - - def testTypeCheck(self): - # Test type checking by settimeout() - self.sock.settimeout(0) - self.sock.settimeout(0L) - self.sock.settimeout(0.0) - self.sock.settimeout(None) - self.assertRaises(TypeError, self.sock.settimeout, "") - self.assertRaises(TypeError, self.sock.settimeout, u"") - self.assertRaises(TypeError, self.sock.settimeout, ()) - self.assertRaises(TypeError, self.sock.settimeout, []) - self.assertRaises(TypeError, self.sock.settimeout, {}) - self.assertRaises(TypeError, self.sock.settimeout, 0j) - - def testRangeCheck(self): - # Test range checking by settimeout() - self.assertRaises(ValueError, self.sock.settimeout, -1) - self.assertRaises(ValueError, self.sock.settimeout, -1L) - self.assertRaises(ValueError, self.sock.settimeout, -1.0) - - def testTimeoutThenBlocking(self): - # Test settimeout() followed by setblocking() - self.sock.settimeout(10) - self.sock.setblocking(1) - self.assertEqual(self.sock.gettimeout(), None) - self.sock.setblocking(0) - self.assertEqual(self.sock.gettimeout(), 0.0) - - self.sock.settimeout(10) - self.sock.setblocking(0) - self.assertEqual(self.sock.gettimeout(), 0.0) - self.sock.setblocking(1) - self.assertEqual(self.sock.gettimeout(), None) - - def testBlockingThenTimeout(self): - # Test setblocking() followed by settimeout() - self.sock.setblocking(0) - self.sock.settimeout(1) - self.assertEqual(self.sock.gettimeout(), 1) - - self.sock.setblocking(1) - self.sock.settimeout(1) - self.assertEqual(self.sock.gettimeout(), 1) - - -class TimeoutTestCase(unittest.TestCase): - """Test case for socket.socket() timeout functions""" - - # There are a number of tests here trying to make sure that an operation - # doesn't take too much longer than expected. But competing machine - # activity makes it inevitable that such tests will fail at times. - # When fuzz was at 1.0, I (tim) routinely saw bogus failures on Win2K - # and Win98SE. Boosting it to 2.0 helped a lot, but isn't a real - # solution. - fuzz = 2.0 - - def setUp(self): - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.addr_remote = ('www.python.org.', 80) - self.addr_local = ('127.0.0.1', 25339) - - def tearDown(self): - self.sock.close() - - def testConnectTimeout(self): - # Test connect() timeout - _timeout = 0.001 - self.sock.settimeout(_timeout) - - # If we are too close to www.python.org, this test will fail. - # Pick a host that should be farther away. - if (socket.getfqdn().split('.')[-2:] == ['python', 'org'] or - socket.getfqdn().split('.')[-2:-1] == ['xs4all']): - self.addr_remote = ('tut.fi', 80) - - _t1 = time.time() - self.failUnlessRaises(socket.error, self.sock.connect, - self.addr_remote) - _t2 = time.time() - - _delta = abs(_t1 - _t2) - self.assert_(_delta < _timeout + self.fuzz, - "timeout (%g) is more than %g seconds more than expected (%g)" - %(_delta, self.fuzz, _timeout)) - - def testRecvTimeout(self): - # Test recv() timeout - _timeout = 0.02 - self.sock.connect(self.addr_remote) - self.sock.settimeout(_timeout) - - _t1 = time.time() - self.failUnlessRaises(socket.error, self.sock.recv, 1024) - _t2 = time.time() - - _delta = abs(_t1 - _t2) - self.assert_(_delta < _timeout + self.fuzz, - "timeout (%g) is %g seconds more than expected (%g)" - %(_delta, self.fuzz, _timeout)) - - def testAcceptTimeout(self): - # Test accept() timeout - _timeout = 2 - self.sock.settimeout(_timeout) - self.sock.bind(self.addr_local) - self.sock.listen(5) - - _t1 = time.time() - self.failUnlessRaises(socket.error, self.sock.accept) - _t2 = time.time() - - _delta = abs(_t1 - _t2) - self.assert_(_delta < _timeout + self.fuzz, - "timeout (%g) is %g seconds more than expected (%g)" - %(_delta, self.fuzz, _timeout)) - - def testRecvfromTimeout(self): - # Test recvfrom() timeout - _timeout = 2 - self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - self.sock.settimeout(_timeout) - self.sock.bind(self.addr_local) - - _t1 = time.time() - self.failUnlessRaises(socket.error, self.sock.recvfrom, 8192) - _t2 = time.time() - - _delta = abs(_t1 - _t2) - self.assert_(_delta < _timeout + self.fuzz, - "timeout (%g) is %g seconds more than expected (%g)" - %(_delta, self.fuzz, _timeout)) - - def testSend(self): - # Test send() timeout - # couldn't figure out how to test it - pass - - def testSendto(self): - # Test sendto() timeout - # couldn't figure out how to test it - pass - - def testSendall(self): - # Test sendall() timeout - # couldn't figure out how to test it - pass - - -def test_main(): - test_support.requires('network') - test_support.run_unittest(CreationTestCase, TimeoutTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_tokenize.py b/sys/lib/python/test/test_tokenize.py deleted file mode 100644 index b064967bf..000000000 --- a/sys/lib/python/test/test_tokenize.py +++ /dev/null @@ -1,114 +0,0 @@ -import os, glob, random -from cStringIO import StringIO -from test.test_support import (verbose, findfile, is_resource_enabled, - TestFailed) -from tokenize import (tokenize, generate_tokens, untokenize, - NUMBER, NAME, OP, STRING) - -# Test roundtrip for `untokenize`. `f` is a file path. The source code in f -# is tokenized, converted back to source code via tokenize.untokenize(), -# and tokenized again from the latter. The test fails if the second -# tokenization doesn't match the first. -def test_roundtrip(f): - ## print 'Testing:', f - fobj = open(f) - try: - fulltok = list(generate_tokens(fobj.readline)) - finally: - fobj.close() - - t1 = [tok[:2] for tok in fulltok] - newtext = untokenize(t1) - readline = iter(newtext.splitlines(1)).next - t2 = [tok[:2] for tok in generate_tokens(readline)] - if t1 != t2: - raise TestFailed("untokenize() roundtrip failed for %r" % f) - -# This is an example from the docs, set up as a doctest. -def decistmt(s): - """Substitute Decimals for floats in a string of statements. - - >>> from decimal import Decimal - >>> s = 'print +21.3e-5*-.1234/81.7' - >>> decistmt(s) - "print +Decimal ('21.3e-5')*-Decimal ('.1234')/Decimal ('81.7')" - - The format of the exponent is inherited from the platform C library. - Known cases are "e-007" (Windows) and "e-07" (not Windows). Since - we're only showing 12 digits, and the 13th isn't close to 5, the - rest of the output should be platform-independent. - - >>> exec(s) #doctest: +ELLIPSIS - -3.21716034272e-0...7 - - Output from calculations with Decimal should be identical across all - platforms. - - >>> exec(decistmt(s)) - -3.217160342717258261933904529E-7 - """ - - result = [] - g = generate_tokens(StringIO(s).readline) # tokenize the string - for toknum, tokval, _, _, _ in g: - if toknum == NUMBER and '.' in tokval: # replace NUMBER tokens - result.extend([ - (NAME, 'Decimal'), - (OP, '('), - (STRING, repr(tokval)), - (OP, ')') - ]) - else: - result.append((toknum, tokval)) - return untokenize(result) - -def test_main(): - if verbose: - print 'starting...' - - # This displays the tokenization of tokenize_tests.py to stdout, and - # regrtest.py checks that this equals the expected output (in the - # test/output/ directory). - f = open(findfile('tokenize_tests' + os.extsep + 'txt')) - tokenize(f.readline) - f.close() - - # Now run test_roundtrip() over tokenize_test.py too, and over all - # (if the "compiler" resource is enabled) or a small random sample (if - # "compiler" is not enabled) of the test*.py files. - f = findfile('tokenize_tests' + os.extsep + 'txt') - test_roundtrip(f) - - testdir = os.path.dirname(f) or os.curdir - testfiles = glob.glob(testdir + os.sep + 'test*.py') - if not is_resource_enabled('compiler'): - testfiles = random.sample(testfiles, 10) - - for f in testfiles: - test_roundtrip(f) - - # Test detecton of IndentationError. - sampleBadText = """\ -def foo(): - bar - baz -""" - - try: - for tok in generate_tokens(StringIO(sampleBadText).readline): - pass - except IndentationError: - pass - else: - raise TestFailed("Did not detect IndentationError:") - - # Run the doctests in this module. - from test import test_tokenize # i.e., this module - from test.test_support import run_doctest - run_doctest(test_tokenize) - - if verbose: - print 'finished' - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_trace.py b/sys/lib/python/test/test_trace.py deleted file mode 100644 index 08aec8e83..000000000 --- a/sys/lib/python/test/test_trace.py +++ /dev/null @@ -1,626 +0,0 @@ -# Testing the line trace facility. - -from test import test_support -import unittest -import sys -import difflib - -# A very basic example. If this fails, we're in deep trouble. -def basic(): - return 1 - -basic.events = [(0, 'call'), - (1, 'line'), - (1, 'return')] - -# Many of the tests below are tricky because they involve pass statements. -# If there is implicit control flow around a pass statement (in an except -# clause or else caluse) under what conditions do you set a line number -# following that clause? - - -# The entire "while 0:" statement is optimized away. No code -# exists for it, so the line numbers skip directly from "del x" -# to "x = 1". -def arigo_example(): - x = 1 - del x - while 0: - pass - x = 1 - -arigo_example.events = [(0, 'call'), - (1, 'line'), - (2, 'line'), - (5, 'line'), - (5, 'return')] - -# check that lines consisting of just one instruction get traced: -def one_instr_line(): - x = 1 - del x - x = 1 - -one_instr_line.events = [(0, 'call'), - (1, 'line'), - (2, 'line'), - (3, 'line'), - (3, 'return')] - -def no_pop_tops(): # 0 - x = 1 # 1 - for a in range(2): # 2 - if a: # 3 - x = 1 # 4 - else: # 5 - x = 1 # 6 - -no_pop_tops.events = [(0, 'call'), - (1, 'line'), - (2, 'line'), - (3, 'line'), - (6, 'line'), - (2, 'line'), - (3, 'line'), - (4, 'line'), - (2, 'line'), - (2, 'return')] - -def no_pop_blocks(): - y = 1 - while not y: - bla - x = 1 - -no_pop_blocks.events = [(0, 'call'), - (1, 'line'), - (2, 'line'), - (4, 'line'), - (4, 'return')] - -def called(): # line -3 - x = 1 - -def call(): # line 0 - called() - -call.events = [(0, 'call'), - (1, 'line'), - (-3, 'call'), - (-2, 'line'), - (-2, 'return'), - (1, 'return')] - -def raises(): - raise Exception - -def test_raise(): - try: - raises() - except Exception, exc: - x = 1 - -test_raise.events = [(0, 'call'), - (1, 'line'), - (2, 'line'), - (-3, 'call'), - (-2, 'line'), - (-2, 'exception'), - (-2, 'return'), - (2, 'exception'), - (3, 'line'), - (4, 'line'), - (4, 'return')] - -def _settrace_and_return(tracefunc): - sys.settrace(tracefunc) - sys._getframe().f_back.f_trace = tracefunc -def settrace_and_return(tracefunc): - _settrace_and_return(tracefunc) - -settrace_and_return.events = [(1, 'return')] - -def _settrace_and_raise(tracefunc): - sys.settrace(tracefunc) - sys._getframe().f_back.f_trace = tracefunc - raise RuntimeError -def settrace_and_raise(tracefunc): - try: - _settrace_and_raise(tracefunc) - except RuntimeError, exc: - pass - -settrace_and_raise.events = [(2, 'exception'), - (3, 'line'), - (4, 'line'), - (4, 'return')] - -# implicit return example -# This test is interesting because of the else: pass -# part of the code. The code generate for the true -# part of the if contains a jump past the else branch. -# The compiler then generates an implicit "return None" -# Internally, the compiler visits the pass statement -# and stores its line number for use on the next instruction. -# The next instruction is the implicit return None. -def ireturn_example(): - a = 5 - b = 5 - if a == b: - b = a+1 - else: - pass - -ireturn_example.events = [(0, 'call'), - (1, 'line'), - (2, 'line'), - (3, 'line'), - (4, 'line'), - (6, 'line'), - (6, 'return')] - -# Tight loop with while(1) example (SF #765624) -def tightloop_example(): - items = range(0, 3) - try: - i = 0 - while 1: - b = items[i]; i+=1 - except IndexError: - pass - -tightloop_example.events = [(0, 'call'), - (1, 'line'), - (2, 'line'), - (3, 'line'), - (4, 'line'), - (5, 'line'), - (5, 'line'), - (5, 'line'), - (5, 'line'), - (5, 'exception'), - (6, 'line'), - (7, 'line'), - (7, 'return')] - -def tighterloop_example(): - items = range(1, 4) - try: - i = 0 - while 1: i = items[i] - except IndexError: - pass - -tighterloop_example.events = [(0, 'call'), - (1, 'line'), - (2, 'line'), - (3, 'line'), - (4, 'line'), - (4, 'line'), - (4, 'line'), - (4, 'line'), - (4, 'exception'), - (5, 'line'), - (6, 'line'), - (6, 'return')] - -class Tracer: - def __init__(self): - self.events = [] - def trace(self, frame, event, arg): - self.events.append((frame.f_lineno, event)) - return self.trace - -class TraceTestCase(unittest.TestCase): - def compare_events(self, line_offset, events, expected_events): - events = [(l - line_offset, e) for (l, e) in events] - if events != expected_events: - self.fail( - "events did not match expectation:\n" + - "\n".join(difflib.ndiff(map(str, expected_events), - map(str, events)))) - - - def run_test(self, func): - tracer = Tracer() - sys.settrace(tracer.trace) - func() - sys.settrace(None) - self.compare_events(func.func_code.co_firstlineno, - tracer.events, func.events) - - def run_test2(self, func): - tracer = Tracer() - func(tracer.trace) - sys.settrace(None) - self.compare_events(func.func_code.co_firstlineno, - tracer.events, func.events) - - def test_01_basic(self): - self.run_test(basic) - def test_02_arigo(self): - self.run_test(arigo_example) - def test_03_one_instr(self): - self.run_test(one_instr_line) - def test_04_no_pop_blocks(self): - self.run_test(no_pop_blocks) - def test_05_no_pop_tops(self): - self.run_test(no_pop_tops) - def test_06_call(self): - self.run_test(call) - def test_07_raise(self): - self.run_test(test_raise) - - def test_08_settrace_and_return(self): - self.run_test2(settrace_and_return) - def test_09_settrace_and_raise(self): - self.run_test2(settrace_and_raise) - def test_10_ireturn(self): - self.run_test(ireturn_example) - def test_11_tightloop(self): - self.run_test(tightloop_example) - def test_12_tighterloop(self): - self.run_test(tighterloop_example) - -class RaisingTraceFuncTestCase(unittest.TestCase): - def trace(self, frame, event, arg): - """A trace function that raises an exception in response to a - specific trace event.""" - if event == self.raiseOnEvent: - raise ValueError # just something that isn't RuntimeError - else: - return self.trace - - def f(self): - """The function to trace; raises an exception if that's the case - we're testing, so that the 'exception' trace event fires.""" - if self.raiseOnEvent == 'exception': - x = 0 - y = 1/x - else: - return 1 - - def run_test_for_event(self, event): - """Tests that an exception raised in response to the given event is - handled OK.""" - self.raiseOnEvent = event - try: - for i in xrange(sys.getrecursionlimit() + 1): - sys.settrace(self.trace) - try: - self.f() - except ValueError: - pass - else: - self.fail("exception not thrown!") - except RuntimeError: - self.fail("recursion counter not reset") - - # Test the handling of exceptions raised by each kind of trace event. - def test_call(self): - self.run_test_for_event('call') - def test_line(self): - self.run_test_for_event('line') - def test_return(self): - self.run_test_for_event('return') - def test_exception(self): - self.run_test_for_event('exception') - - def test_trash_stack(self): - def f(): - for i in range(5): - print i # line tracing will raise an exception at this line - - def g(frame, why, extra): - if (why == 'line' and - frame.f_lineno == f.func_code.co_firstlineno + 2): - raise RuntimeError, "i am crashing" - return g - - sys.settrace(g) - try: - f() - except RuntimeError: - # the test is really that this doesn't segfault: - import gc - gc.collect() - else: - self.fail("exception not propagated") - - -# 'Jump' tests: assigning to frame.f_lineno within a trace function -# moves the execution position - it's how debuggers implement a Jump -# command (aka. "Set next statement"). - -class JumpTracer: - """Defines a trace function that jumps from one place to another, - with the source and destination lines of the jump being defined by - the 'jump' property of the function under test.""" - - def __init__(self, function): - self.function = function - self.jumpFrom = function.jump[0] - self.jumpTo = function.jump[1] - self.done = False - - def trace(self, frame, event, arg): - if not self.done and frame.f_code == self.function.func_code: - firstLine = frame.f_code.co_firstlineno - if frame.f_lineno == firstLine + self.jumpFrom: - # Cope with non-integer self.jumpTo (because of - # no_jump_to_non_integers below). - try: - frame.f_lineno = firstLine + self.jumpTo - except TypeError: - frame.f_lineno = self.jumpTo - self.done = True - return self.trace - -# The first set of 'jump' tests are for things that are allowed: - -def jump_simple_forwards(output): - output.append(1) - output.append(2) - output.append(3) - -jump_simple_forwards.jump = (1, 3) -jump_simple_forwards.output = [3] - -def jump_simple_backwards(output): - output.append(1) - output.append(2) - -jump_simple_backwards.jump = (2, 1) -jump_simple_backwards.output = [1, 1, 2] - -def jump_out_of_block_forwards(output): - for i in 1, 2: - output.append(2) - for j in [3]: # Also tests jumping over a block - output.append(4) - output.append(5) - -jump_out_of_block_forwards.jump = (3, 5) -jump_out_of_block_forwards.output = [2, 5] - -def jump_out_of_block_backwards(output): - output.append(1) - for i in [1]: - output.append(3) - for j in [2]: # Also tests jumping over a block - output.append(5) - output.append(6) - output.append(7) - -jump_out_of_block_backwards.jump = (6, 1) -jump_out_of_block_backwards.output = [1, 3, 5, 1, 3, 5, 6, 7] - -def jump_to_codeless_line(output): - output.append(1) - # Jumping to this line should skip to the next one. - output.append(3) - -jump_to_codeless_line.jump = (1, 2) -jump_to_codeless_line.output = [3] - -def jump_to_same_line(output): - output.append(1) - output.append(2) - output.append(3) - -jump_to_same_line.jump = (2, 2) -jump_to_same_line.output = [1, 2, 3] - -# Tests jumping within a finally block, and over one. -def jump_in_nested_finally(output): - try: - output.append(2) - finally: - output.append(4) - try: - output.append(6) - finally: - output.append(8) - output.append(9) - -jump_in_nested_finally.jump = (4, 9) -jump_in_nested_finally.output = [2, 9] - -# The second set of 'jump' tests are for things that are not allowed: - -def no_jump_too_far_forwards(output): - try: - output.append(2) - output.append(3) - except ValueError, e: - output.append('after' in str(e)) - -no_jump_too_far_forwards.jump = (3, 6) -no_jump_too_far_forwards.output = [2, True] - -def no_jump_too_far_backwards(output): - try: - output.append(2) - output.append(3) - except ValueError, e: - output.append('before' in str(e)) - -no_jump_too_far_backwards.jump = (3, -1) -no_jump_too_far_backwards.output = [2, True] - -# Test each kind of 'except' line. -def no_jump_to_except_1(output): - try: - output.append(2) - except: - e = sys.exc_info()[1] - output.append('except' in str(e)) - -no_jump_to_except_1.jump = (2, 3) -no_jump_to_except_1.output = [True] - -def no_jump_to_except_2(output): - try: - output.append(2) - except ValueError: - e = sys.exc_info()[1] - output.append('except' in str(e)) - -no_jump_to_except_2.jump = (2, 3) -no_jump_to_except_2.output = [True] - -def no_jump_to_except_3(output): - try: - output.append(2) - except ValueError, e: - output.append('except' in str(e)) - -no_jump_to_except_3.jump = (2, 3) -no_jump_to_except_3.output = [True] - -def no_jump_to_except_4(output): - try: - output.append(2) - except (ValueError, RuntimeError), e: - output.append('except' in str(e)) - -no_jump_to_except_4.jump = (2, 3) -no_jump_to_except_4.output = [True] - -def no_jump_forwards_into_block(output): - try: - output.append(2) - for i in 1, 2: - output.append(4) - except ValueError, e: - output.append('into' in str(e)) - -no_jump_forwards_into_block.jump = (2, 4) -no_jump_forwards_into_block.output = [True] - -def no_jump_backwards_into_block(output): - try: - for i in 1, 2: - output.append(3) - output.append(4) - except ValueError, e: - output.append('into' in str(e)) - -no_jump_backwards_into_block.jump = (4, 3) -no_jump_backwards_into_block.output = [3, 3, True] - -def no_jump_into_finally_block(output): - try: - try: - output.append(3) - x = 1 - finally: - output.append(6) - except ValueError, e: - output.append('finally' in str(e)) - -no_jump_into_finally_block.jump = (4, 6) -no_jump_into_finally_block.output = [3, 6, True] # The 'finally' still runs - -def no_jump_out_of_finally_block(output): - try: - try: - output.append(3) - finally: - output.append(5) - output.append(6) - except ValueError, e: - output.append('finally' in str(e)) - -no_jump_out_of_finally_block.jump = (5, 1) -no_jump_out_of_finally_block.output = [3, True] - -# This verifies the line-numbers-must-be-integers rule. -def no_jump_to_non_integers(output): - try: - output.append(2) - except ValueError, e: - output.append('integer' in str(e)) - -no_jump_to_non_integers.jump = (2, "Spam") -no_jump_to_non_integers.output = [True] - -# This verifies that you can't set f_lineno via _getframe or similar -# trickery. -def no_jump_without_trace_function(): - try: - previous_frame = sys._getframe().f_back - previous_frame.f_lineno = previous_frame.f_lineno - except ValueError, e: - # This is the exception we wanted; make sure the error message - # talks about trace functions. - if 'trace' not in str(e): - raise - else: - # Something's wrong - the expected exception wasn't raised. - raise RuntimeError, "Trace-function-less jump failed to fail" - - -class JumpTestCase(unittest.TestCase): - def compare_jump_output(self, expected, received): - if received != expected: - self.fail( "Outputs don't match:\n" + - "Expected: " + repr(expected) + "\n" + - "Received: " + repr(received)) - - def run_test(self, func): - tracer = JumpTracer(func) - sys.settrace(tracer.trace) - output = [] - func(output) - sys.settrace(None) - self.compare_jump_output(func.output, output) - - def test_01_jump_simple_forwards(self): - self.run_test(jump_simple_forwards) - def test_02_jump_simple_backwards(self): - self.run_test(jump_simple_backwards) - def test_03_jump_out_of_block_forwards(self): - self.run_test(jump_out_of_block_forwards) - def test_04_jump_out_of_block_backwards(self): - self.run_test(jump_out_of_block_backwards) - def test_05_jump_to_codeless_line(self): - self.run_test(jump_to_codeless_line) - def test_06_jump_to_same_line(self): - self.run_test(jump_to_same_line) - def test_07_jump_in_nested_finally(self): - self.run_test(jump_in_nested_finally) - def test_08_no_jump_too_far_forwards(self): - self.run_test(no_jump_too_far_forwards) - def test_09_no_jump_too_far_backwards(self): - self.run_test(no_jump_too_far_backwards) - def test_10_no_jump_to_except_1(self): - self.run_test(no_jump_to_except_1) - def test_11_no_jump_to_except_2(self): - self.run_test(no_jump_to_except_2) - def test_12_no_jump_to_except_3(self): - self.run_test(no_jump_to_except_3) - def test_13_no_jump_to_except_4(self): - self.run_test(no_jump_to_except_4) - def test_14_no_jump_forwards_into_block(self): - self.run_test(no_jump_forwards_into_block) - def test_15_no_jump_backwards_into_block(self): - self.run_test(no_jump_backwards_into_block) - def test_16_no_jump_into_finally_block(self): - self.run_test(no_jump_into_finally_block) - def test_17_no_jump_out_of_finally_block(self): - self.run_test(no_jump_out_of_finally_block) - def test_18_no_jump_to_non_integers(self): - self.run_test(no_jump_to_non_integers) - def test_19_no_jump_without_trace_function(self): - no_jump_without_trace_function() - -def test_main(): - test_support.run_unittest( - TraceTestCase, - RaisingTraceFuncTestCase, - JumpTestCase - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_traceback.py b/sys/lib/python/test/test_traceback.py deleted file mode 100644 index b42dbc4df..000000000 --- a/sys/lib/python/test/test_traceback.py +++ /dev/null @@ -1,162 +0,0 @@ -"""Test cases for traceback module""" - -import unittest -from test.test_support import run_unittest, is_jython - -import traceback - -class TracebackCases(unittest.TestCase): - # For now, a very minimal set of tests. I want to be sure that - # formatting of SyntaxErrors works based on changes for 2.1. - - def get_exception_format(self, func, exc): - try: - func() - except exc, value: - return traceback.format_exception_only(exc, value) - else: - raise ValueError, "call did not raise exception" - - def syntax_error_with_caret(self): - compile("def fact(x):\n\treturn x!\n", "?", "exec") - - def syntax_error_without_caret(self): - # XXX why doesn't compile raise the same traceback? - import test.badsyntax_nocaret - - def syntax_error_bad_indentation(self): - compile("def spam():\n print 1\n print 2", "?", "exec") - - def test_caret(self): - err = self.get_exception_format(self.syntax_error_with_caret, - SyntaxError) - self.assert_(len(err) == 4) - self.assert_(err[1].strip() == "return x!") - self.assert_("^" in err[2]) # third line has caret - self.assert_(err[1].find("!") == err[2].find("^")) # in the right place - - def test_nocaret(self): - if is_jython: - # jython adds a caret in this case (why shouldn't it?) - return - err = self.get_exception_format(self.syntax_error_without_caret, - SyntaxError) - self.assert_(len(err) == 3) - self.assert_(err[1].strip() == "[x for x in x] = x") - - def test_bad_indentation(self): - err = self.get_exception_format(self.syntax_error_bad_indentation, - IndentationError) - self.assert_(len(err) == 4) - self.assert_(err[1].strip() == "print 2") - self.assert_("^" in err[2]) - self.assert_(err[1].find("2") == err[2].find("^")) - - def test_bug737473(self): - import sys, os, tempfile, time - - savedpath = sys.path[:] - testdir = tempfile.mkdtemp() - try: - sys.path.insert(0, testdir) - testfile = os.path.join(testdir, 'test_bug737473.py') - print >> open(testfile, 'w'), """ -def test(): - raise ValueError""" - - if 'test_bug737473' in sys.modules: - del sys.modules['test_bug737473'] - import test_bug737473 - - try: - test_bug737473.test() - except ValueError: - # this loads source code to linecache - traceback.extract_tb(sys.exc_traceback) - - # If this test runs too quickly, test_bug737473.py's mtime - # attribute will remain unchanged even if the file is rewritten. - # Consequently, the file would not reload. So, added a sleep() - # delay to assure that a new, distinct timestamp is written. - # Since WinME with FAT32 has multisecond resolution, more than - # three seconds are needed for this test to pass reliably :-( - time.sleep(4) - - print >> open(testfile, 'w'), """ -def test(): - raise NotImplementedError""" - reload(test_bug737473) - try: - test_bug737473.test() - except NotImplementedError: - src = traceback.extract_tb(sys.exc_traceback)[-1][-1] - self.failUnlessEqual(src, 'raise NotImplementedError') - finally: - sys.path[:] = savedpath - for f in os.listdir(testdir): - os.unlink(os.path.join(testdir, f)) - os.rmdir(testdir) - - def test_members(self): - # Covers Python/structmember.c::listmembers() - try: - 1/0 - except: - import sys - sys.exc_traceback.__members__ - - def test_base_exception(self): - # Test that exceptions derived from BaseException are formatted right - e = KeyboardInterrupt() - lst = traceback.format_exception_only(e.__class__, e) - self.assertEqual(lst, ['KeyboardInterrupt\n']) - - # String exceptions are deprecated, but legal. The quirky form with - # separate "type" and "value" tends to break things, because - # not isinstance(value, type) - # and a string cannot be the first argument to issubclass. - # - # Note that sys.last_type and sys.last_value do not get set if an - # exception is caught, so we sort of cheat and just emulate them. - # - # test_string_exception1 is equivalent to - # - # >>> raise "String Exception" - # - # test_string_exception2 is equivalent to - # - # >>> raise "String Exception", "String Value" - # - def test_string_exception1(self): - str_type = "String Exception" - err = traceback.format_exception_only(str_type, None) - self.assertEqual(len(err), 1) - self.assertEqual(err[0], str_type + '\n') - - def test_string_exception2(self): - str_type = "String Exception" - str_value = "String Value" - err = traceback.format_exception_only(str_type, str_value) - self.assertEqual(len(err), 1) - self.assertEqual(err[0], str_type + ': ' + str_value + '\n') - - def test_format_exception_only_bad__str__(self): - class X(Exception): - def __str__(self): - 1/0 - err = traceback.format_exception_only(X, X()) - self.assertEqual(len(err), 1) - str_value = '' % X.__name__ - self.assertEqual(err[0], X.__name__ + ': ' + str_value + '\n') - - def test_without_exception(self): - err = traceback.format_exception_only(None, None) - self.assertEqual(err, ['None\n']) - - -def test_main(): - run_unittest(TracebackCases) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_transformer.py b/sys/lib/python/test/test_transformer.py deleted file mode 100644 index 909cda518..000000000 --- a/sys/lib/python/test/test_transformer.py +++ /dev/null @@ -1,35 +0,0 @@ -import unittest -from test import test_support -from compiler import transformer, ast -from compiler import compile - -class Tests(unittest.TestCase): - - def testMultipleLHS(self): - """ Test multiple targets on the left hand side. """ - - snippets = ['a, b = 1, 2', - '(a, b) = 1, 2', - '((a, b), c) = (1, 2), 3'] - - for s in snippets: - a = transformer.parse(s) - assert isinstance(a, ast.Module) - child1 = a.getChildNodes()[0] - assert isinstance(child1, ast.Stmt) - child2 = child1.getChildNodes()[0] - assert isinstance(child2, ast.Assign) - - # This actually tests the compiler, but it's a way to assure the ast - # is correct - c = compile(s, '', 'single') - vals = {} - exec c in vals - assert vals['a'] == 1 - assert vals['b'] == 2 - -def test_main(): - test_support.run_unittest(Tests) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_tuple.py b/sys/lib/python/test/test_tuple.py deleted file mode 100644 index dddb03ecc..000000000 --- a/sys/lib/python/test/test_tuple.py +++ /dev/null @@ -1,83 +0,0 @@ -import unittest -from test import test_support, seq_tests - -class TupleTest(seq_tests.CommonTest): - type2test = tuple - - def test_constructors(self): - super(TupleTest, self).test_len() - # calling built-in types without argument must return empty - self.assertEqual(tuple(), ()) - - def test_truth(self): - super(TupleTest, self).test_truth() - self.assert_(not ()) - self.assert_((42, )) - - def test_len(self): - super(TupleTest, self).test_len() - self.assertEqual(len(()), 0) - self.assertEqual(len((0,)), 1) - self.assertEqual(len((0, 1, 2)), 3) - - def test_iadd(self): - super(TupleTest, self).test_iadd() - u = (0, 1) - u2 = u - u += (2, 3) - self.assert_(u is not u2) - - def test_imul(self): - super(TupleTest, self).test_imul() - u = (0, 1) - u2 = u - u *= 3 - self.assert_(u is not u2) - - def test_tupleresizebug(self): - # Check that a specific bug in _PyTuple_Resize() is squashed. - def f(): - for i in range(1000): - yield i - self.assertEqual(list(tuple(f())), range(1000)) - - def test_hash(self): - # See SF bug 942952: Weakness in tuple hash - # The hash should: - # be non-commutative - # should spread-out closely spaced values - # should not exhibit cancellation in tuples like (x,(x,y)) - # should be distinct from element hashes: hash(x)!=hash((x,)) - # This test exercises those cases. - # For a pure random hash and N=50, the expected number of occupied - # buckets when tossing 252,600 balls into 2**32 buckets - # is 252,592.6, or about 7.4 expected collisions. The - # standard deviation is 2.73. On a box with 64-bit hash - # codes, no collisions are expected. Here we accept no - # more than 15 collisions. Any worse and the hash function - # is sorely suspect. - - N=50 - base = range(N) - xp = [(i, j) for i in base for j in base] - inps = base + [(i, j) for i in base for j in xp] + \ - [(i, j) for i in xp for j in base] + xp + zip(base) - collisions = len(inps) - len(set(map(hash, inps))) - self.assert_(collisions <= 15) - - def test_repr(self): - l0 = tuple() - l2 = (0, 1, 2) - a0 = self.type2test(l0) - a2 = self.type2test(l2) - - self.assertEqual(str(a0), repr(l0)) - self.assertEqual(str(a2), repr(l2)) - self.assertEqual(repr(a0), "()") - self.assertEqual(repr(a2), "(0, 1, 2)") - -def test_main(): - test_support.run_unittest(TupleTest) - -if __name__=="__main__": - test_main() diff --git a/sys/lib/python/test/test_types.py b/sys/lib/python/test/test_types.py deleted file mode 100644 index 2d299c36f..000000000 --- a/sys/lib/python/test/test_types.py +++ /dev/null @@ -1,286 +0,0 @@ -# Python test set -- part 6, built-in types - -from test.test_support import * - -print '6. Built-in types' - -print '6.1 Truth value testing' -if None: raise TestFailed, 'None is true instead of false' -if 0: raise TestFailed, '0 is true instead of false' -if 0L: raise TestFailed, '0L is true instead of false' -if 0.0: raise TestFailed, '0.0 is true instead of false' -if '': raise TestFailed, '\'\' is true instead of false' -if not 1: raise TestFailed, '1 is false instead of true' -if not 1L: raise TestFailed, '1L is false instead of true' -if not 1.0: raise TestFailed, '1.0 is false instead of true' -if not 'x': raise TestFailed, '\'x\' is false instead of true' -if not {'x': 1}: raise TestFailed, '{\'x\': 1} is false instead of true' -def f(): pass -class C: pass -import sys -x = C() -if not f: raise TestFailed, 'f is false instead of true' -if not C: raise TestFailed, 'C is false instead of true' -if not sys: raise TestFailed, 'sys is false instead of true' -if not x: raise TestFailed, 'x is false instead of true' - -print '6.2 Boolean operations' -if 0 or 0: raise TestFailed, '0 or 0 is true instead of false' -if 1 and 1: pass -else: raise TestFailed, '1 and 1 is false instead of true' -if not 1: raise TestFailed, 'not 1 is true instead of false' - -print '6.3 Comparisons' -if 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass -else: raise TestFailed, 'int comparisons failed' -if 0L < 1L <= 1L == 1L >= 1L > 0L != 1L: pass -else: raise TestFailed, 'long int comparisons failed' -if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0: pass -else: raise TestFailed, 'float comparisons failed' -if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass -else: raise TestFailed, 'string comparisons failed' -if None is None: pass -else: raise TestFailed, 'identity test failed' - -try: float('') -except ValueError: pass -else: raise TestFailed, "float('') didn't raise ValueError" - -try: float('5\0') -except ValueError: pass -else: raise TestFailed, "float('5\0') didn't raise ValueError" - -try: 5.0 / 0.0 -except ZeroDivisionError: pass -else: raise TestFailed, "5.0 / 0.0 didn't raise ZeroDivisionError" - -try: 5.0 // 0.0 -except ZeroDivisionError: pass -else: raise TestFailed, "5.0 // 0.0 didn't raise ZeroDivisionError" - -try: 5.0 % 0.0 -except ZeroDivisionError: pass -else: raise TestFailed, "5.0 % 0.0 didn't raise ZeroDivisionError" - -try: 5 / 0L -except ZeroDivisionError: pass -else: raise TestFailed, "5 / 0L didn't raise ZeroDivisionError" - -try: 5 // 0L -except ZeroDivisionError: pass -else: raise TestFailed, "5 // 0L didn't raise ZeroDivisionError" - -try: 5 % 0L -except ZeroDivisionError: pass -else: raise TestFailed, "5 % 0L didn't raise ZeroDivisionError" - -print '6.4 Numeric types (mostly conversions)' -if 0 != 0L or 0 != 0.0 or 0L != 0.0: raise TestFailed, 'mixed comparisons' -if 1 != 1L or 1 != 1.0 or 1L != 1.0: raise TestFailed, 'mixed comparisons' -if -1 != -1L or -1 != -1.0 or -1L != -1.0: - raise TestFailed, 'int/long/float value not equal' -# calling built-in types without argument must return 0 -if int() != 0: raise TestFailed, 'int() does not return 0' -if long() != 0L: raise TestFailed, 'long() does not return 0L' -if float() != 0.0: raise TestFailed, 'float() does not return 0.0' -if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass -else: raise TestFailed, 'int() does not round properly' -if long(1.9) == 1L == long(1.1) and long(-1.1) == -1L == long(-1.9): pass -else: raise TestFailed, 'long() does not round properly' -if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass -else: raise TestFailed, 'float() does not work properly' -print '6.4.1 32-bit integers' -# Ensure the first 256 integers are shared -a = 256 -b = 128*2 -if a is not b: raise TestFailed, '256 is not shared' -if 12 + 24 != 36: raise TestFailed, 'int op' -if 12 + (-24) != -12: raise TestFailed, 'int op' -if (-12) + 24 != 12: raise TestFailed, 'int op' -if (-12) + (-24) != -36: raise TestFailed, 'int op' -if not 12 < 24: raise TestFailed, 'int op' -if not -24 < -12: raise TestFailed, 'int op' -# Test for a particular bug in integer multiply -xsize, ysize, zsize = 238, 356, 4 -if not (xsize*ysize*zsize == zsize*xsize*ysize == 338912): - raise TestFailed, 'int mul commutativity' -# And another. -m = -sys.maxint - 1 -for divisor in 1, 2, 4, 8, 16, 32: - j = m // divisor - prod = divisor * j - if prod != m: - raise TestFailed, "%r * %r == %r != %r" % (divisor, j, prod, m) - if type(prod) is not int: - raise TestFailed, ("expected type(prod) to be int, not %r" % - type(prod)) -# Check for expected * overflow to long. -for divisor in 1, 2, 4, 8, 16, 32: - j = m // divisor - 1 - prod = divisor * j - if type(prod) is not long: - raise TestFailed, ("expected type(%r) to be long, not %r" % - (prod, type(prod))) -# Check for expected * overflow to long. -m = sys.maxint -for divisor in 1, 2, 4, 8, 16, 32: - j = m // divisor + 1 - prod = divisor * j - if type(prod) is not long: - raise TestFailed, ("expected type(%r) to be long, not %r" % - (prod, type(prod))) - -print '6.4.2 Long integers' -if 12L + 24L != 36L: raise TestFailed, 'long op' -if 12L + (-24L) != -12L: raise TestFailed, 'long op' -if (-12L) + 24L != 12L: raise TestFailed, 'long op' -if (-12L) + (-24L) != -36L: raise TestFailed, 'long op' -if not 12L < 24L: raise TestFailed, 'long op' -if not -24L < -12L: raise TestFailed, 'long op' -x = sys.maxint -if int(long(x)) != x: raise TestFailed, 'long op' -try: y = int(long(x)+1L) -except OverflowError: raise TestFailed, 'long op' -if not isinstance(y, long): raise TestFailed, 'long op' -x = -x -if int(long(x)) != x: raise TestFailed, 'long op' -x = x-1 -if int(long(x)) != x: raise TestFailed, 'long op' -try: y = int(long(x)-1L) -except OverflowError: raise TestFailed, 'long op' -if not isinstance(y, long): raise TestFailed, 'long op' - -try: 5 << -5 -except ValueError: pass -else: raise TestFailed, 'int negative shift <<' - -try: 5L << -5L -except ValueError: pass -else: raise TestFailed, 'long negative shift <<' - -try: 5 >> -5 -except ValueError: pass -else: raise TestFailed, 'int negative shift >>' - -try: 5L >> -5L -except ValueError: pass -else: raise TestFailed, 'long negative shift >>' - -print '6.4.3 Floating point numbers' -if 12.0 + 24.0 != 36.0: raise TestFailed, 'float op' -if 12.0 + (-24.0) != -12.0: raise TestFailed, 'float op' -if (-12.0) + 24.0 != 12.0: raise TestFailed, 'float op' -if (-12.0) + (-24.0) != -36.0: raise TestFailed, 'float op' -if not 12.0 < 24.0: raise TestFailed, 'float op' -if not -24.0 < -12.0: raise TestFailed, 'float op' - -print '6.5 Sequence types' - -print '6.5.1 Strings' -if len('') != 0: raise TestFailed, 'len(\'\')' -if len('a') != 1: raise TestFailed, 'len(\'a\')' -if len('abcdef') != 6: raise TestFailed, 'len(\'abcdef\')' -if 'xyz' + 'abcde' != 'xyzabcde': raise TestFailed, 'string concatenation' -if 'xyz'*3 != 'xyzxyzxyz': raise TestFailed, 'string repetition *3' -if 0*'abcde' != '': raise TestFailed, 'string repetition 0*' -if min('abc') != 'a' or max('abc') != 'c': raise TestFailed, 'min/max string' -if 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': pass -else: raise TestFailed, 'in/not in string' -x = 'x'*103 -if '%s!'%x != x+'!': raise TestFailed, 'nasty string formatting bug' - -#extended slices for strings -a = '0123456789' -vereq(a[::], a) -vereq(a[::2], '02468') -vereq(a[1::2], '13579') -vereq(a[::-1],'9876543210') -vereq(a[::-2], '97531') -vereq(a[3::-2], '31') -vereq(a[-100:100:], a) -vereq(a[100:-100:-1], a[::-1]) -vereq(a[-100L:100L:2L], '02468') - -if have_unicode: - a = unicode('0123456789', 'ascii') - vereq(a[::], a) - vereq(a[::2], unicode('02468', 'ascii')) - vereq(a[1::2], unicode('13579', 'ascii')) - vereq(a[::-1], unicode('9876543210', 'ascii')) - vereq(a[::-2], unicode('97531', 'ascii')) - vereq(a[3::-2], unicode('31', 'ascii')) - vereq(a[-100:100:], a) - vereq(a[100:-100:-1], a[::-1]) - vereq(a[-100L:100L:2L], unicode('02468', 'ascii')) - - -print '6.5.2 Tuples [see test_tuple.py]' - -print '6.5.3 Lists [see test_list.py]' - -print '6.6 Mappings == Dictionaries [see test_dict.py]' - - -try: type(1, 2) -except TypeError: pass -else: raise TestFailed, 'type(), w/2 args expected TypeError' - -try: type(1, 2, 3, 4) -except TypeError: pass -else: raise TestFailed, 'type(), w/4 args expected TypeError' - -print 'Buffers' -try: buffer('asdf', -1) -except ValueError: pass -else: raise TestFailed, "buffer('asdf', -1) should raise ValueError" -cmp(buffer("abc"), buffer("def")) # used to raise a warning: tp_compare didn't return -1, 0, or 1 - -try: buffer(None) -except TypeError: pass -else: raise TestFailed, "buffer(None) should raise TypeError" - -a = buffer('asdf') -hash(a) -b = a * 5 -if a == b: - raise TestFailed, 'buffers should not be equal' -if str(b) != ('asdf' * 5): - raise TestFailed, 'repeated buffer has wrong content' -if str(a * 0) != '': - raise TestFailed, 'repeated buffer zero times has wrong content' -if str(a + buffer('def')) != 'asdfdef': - raise TestFailed, 'concatenation of buffers yields wrong content' -if str(buffer(a)) != 'asdf': - raise TestFailed, 'composing buffers failed' -if str(buffer(a, 2)) != 'df': - raise TestFailed, 'specifying buffer offset failed' -if str(buffer(a, 0, 2)) != 'as': - raise TestFailed, 'specifying buffer size failed' -if str(buffer(a, 1, 2)) != 'sd': - raise TestFailed, 'specifying buffer offset and size failed' -try: buffer(buffer('asdf', 1), -1) -except ValueError: pass -else: raise TestFailed, "buffer(buffer('asdf', 1), -1) should raise ValueError" -if str(buffer(buffer('asdf', 0, 2), 0)) != 'as': - raise TestFailed, 'composing length-specified buffer failed' -if str(buffer(buffer('asdf', 0, 2), 0, 5000)) != 'as': - raise TestFailed, 'composing length-specified buffer failed' -if str(buffer(buffer('asdf', 0, 2), 0, -1)) != 'as': - raise TestFailed, 'composing length-specified buffer failed' -if str(buffer(buffer('asdf', 0, 2), 1, 2)) != 's': - raise TestFailed, 'composing length-specified buffer failed' - -try: a[1] = 'g' -except TypeError: pass -else: raise TestFailed, "buffer assignment should raise TypeError" - -try: a[0:1] = 'g' -except TypeError: pass -else: raise TestFailed, "buffer slice assignment should raise TypeError" - -# array.array() returns an object that does not implement a char buffer, -# something which int() uses for conversion. -import array -try: int(buffer(array.array('c'))) -except TypeError :pass -else: raise TestFailed, "char buffer (at C level) not working" diff --git a/sys/lib/python/test/test_ucn.py b/sys/lib/python/test/test_ucn.py deleted file mode 100644 index 775044b99..000000000 --- a/sys/lib/python/test/test_ucn.py +++ /dev/null @@ -1,144 +0,0 @@ -""" Test script for the Unicode implementation. - -Written by Bill Tutt. -Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -"""#" - -import unittest - -from test import test_support - -class UnicodeNamesTest(unittest.TestCase): - - def checkletter(self, name, code): - # Helper that put all \N escapes inside eval'd raw strings, - # to make sure this script runs even if the compiler - # chokes on \N escapes - res = eval(ur'u"\N{%s}"' % name) - self.assertEqual(res, code) - return res - - def test_general(self): - # General and case insensitivity test: - chars = [ - "LATIN CAPITAL LETTER T", - "LATIN SMALL LETTER H", - "LATIN SMALL LETTER E", - "SPACE", - "LATIN SMALL LETTER R", - "LATIN CAPITAL LETTER E", - "LATIN SMALL LETTER D", - "SPACE", - "LATIN SMALL LETTER f", - "LATIN CAPITAL LeTtEr o", - "LATIN SMaLl LETTER x", - "SPACE", - "LATIN SMALL LETTER A", - "LATIN SMALL LETTER T", - "LATIN SMALL LETTER E", - "SPACE", - "LATIN SMALL LETTER T", - "LATIN SMALL LETTER H", - "LATIN SMALL LETTER E", - "SpAcE", - "LATIN SMALL LETTER S", - "LATIN SMALL LETTER H", - "LATIN small LETTER e", - "LATIN small LETTER e", - "LATIN SMALL LETTER P", - "FULL STOP" - ] - string = u"The rEd fOx ate the sheep." - - self.assertEqual( - u"".join([self.checkletter(*args) for args in zip(chars, string)]), - string - ) - - def test_ascii_letters(self): - import unicodedata - - for char in "".join(map(chr, xrange(ord("a"), ord("z")))): - name = "LATIN SMALL LETTER %s" % char.upper() - code = unicodedata.lookup(name) - self.assertEqual(unicodedata.name(code), name) - - def test_hangul_syllables(self): - self.checkletter("HANGUL SYLLABLE GA", u"\uac00") - self.checkletter("HANGUL SYLLABLE GGWEOSS", u"\uafe8") - self.checkletter("HANGUL SYLLABLE DOLS", u"\ub3d0") - self.checkletter("HANGUL SYLLABLE RYAN", u"\ub7b8") - self.checkletter("HANGUL SYLLABLE MWIK", u"\ubba0") - self.checkletter("HANGUL SYLLABLE BBWAEM", u"\ubf88") - self.checkletter("HANGUL SYLLABLE SSEOL", u"\uc370") - self.checkletter("HANGUL SYLLABLE YI", u"\uc758") - self.checkletter("HANGUL SYLLABLE JJYOSS", u"\ucb40") - self.checkletter("HANGUL SYLLABLE KYEOLS", u"\ucf28") - self.checkletter("HANGUL SYLLABLE PAN", u"\ud310") - self.checkletter("HANGUL SYLLABLE HWEOK", u"\ud6f8") - self.checkletter("HANGUL SYLLABLE HIH", u"\ud7a3") - - import unicodedata - self.assertRaises(ValueError, unicodedata.name, u"\ud7a4") - - def test_cjk_unified_ideographs(self): - self.checkletter("CJK UNIFIED IDEOGRAPH-3400", u"\u3400") - self.checkletter("CJK UNIFIED IDEOGRAPH-4DB5", u"\u4db5") - self.checkletter("CJK UNIFIED IDEOGRAPH-4E00", u"\u4e00") - self.checkletter("CJK UNIFIED IDEOGRAPH-9FA5", u"\u9fa5") - self.checkletter("CJK UNIFIED IDEOGRAPH-20000", u"\U00020000") - self.checkletter("CJK UNIFIED IDEOGRAPH-2A6D6", u"\U0002a6d6") - - def test_bmp_characters(self): - import unicodedata - count = 0 - for code in xrange(0x10000): - char = unichr(code) - name = unicodedata.name(char, None) - if name is not None: - self.assertEqual(unicodedata.lookup(name), char) - count += 1 - - def test_misc_symbols(self): - self.checkletter("PILCROW SIGN", u"\u00b6") - self.checkletter("REPLACEMENT CHARACTER", u"\uFFFD") - self.checkletter("HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK", u"\uFF9F") - self.checkletter("FULLWIDTH LATIN SMALL LETTER A", u"\uFF41") - - def test_errors(self): - import unicodedata - self.assertRaises(TypeError, unicodedata.name) - self.assertRaises(TypeError, unicodedata.name, u'xx') - self.assertRaises(TypeError, unicodedata.lookup) - self.assertRaises(KeyError, unicodedata.lookup, u'unknown') - - def test_strict_eror_handling(self): - # bogus character name - self.assertRaises( - UnicodeError, - unicode, "\\N{blah}", 'unicode-escape', 'strict' - ) - # long bogus character name - self.assertRaises( - UnicodeError, - unicode, "\\N{%s}" % ("x" * 100000), 'unicode-escape', 'strict' - ) - # missing closing brace - self.assertRaises( - UnicodeError, - unicode, "\\N{SPACE", 'unicode-escape', 'strict' - ) - # missing opening brace - self.assertRaises( - UnicodeError, - unicode, "\\NSPACE", 'unicode-escape', 'strict' - ) - -def test_main(): - test_support.run_unittest(UnicodeNamesTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_unary.py b/sys/lib/python/test/test_unary.py deleted file mode 100644 index 9854f64d0..000000000 --- a/sys/lib/python/test/test_unary.py +++ /dev/null @@ -1,59 +0,0 @@ -"""Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2""" - -import unittest -from test.test_support import run_unittest, have_unicode - -class UnaryOpTestCase(unittest.TestCase): - - def test_negative(self): - self.assert_(-2 == 0 - 2) - self.assert_(-0 == 0) - self.assert_(--2 == 2) - self.assert_(-2L == 0 - 2L) - self.assert_(-2.0 == 0 - 2.0) - self.assert_(-2j == 0 - 2j) - - def test_positive(self): - self.assert_(+2 == 2) - self.assert_(+0 == 0) - self.assert_(++2 == 2) - self.assert_(+2L == 2L) - self.assert_(+2.0 == 2.0) - self.assert_(+2j == 2j) - - def test_invert(self): - self.assert_(-2 == 0 - 2) - self.assert_(-0 == 0) - self.assert_(--2 == 2) - self.assert_(-2L == 0 - 2L) - - def test_no_overflow(self): - nines = "9" * 32 - self.assert_(eval("+" + nines) == eval("+" + nines + "L")) - self.assert_(eval("-" + nines) == eval("-" + nines + "L")) - self.assert_(eval("~" + nines) == eval("~" + nines + "L")) - - def test_negation_of_exponentiation(self): - # Make sure '**' does the right thing; these form a - # regression test for SourceForge bug #456756. - self.assertEqual(-2 ** 3, -8) - self.assertEqual((-2) ** 3, -8) - self.assertEqual(-2 ** 4, -16) - self.assertEqual((-2) ** 4, 16) - - def test_bad_types(self): - for op in '+', '-', '~': - self.assertRaises(TypeError, eval, op + "'a'") - if have_unicode: - self.assertRaises(TypeError, eval, op + "u'a'") - - self.assertRaises(TypeError, eval, "~2j") - self.assertRaises(TypeError, eval, "~2.0") - - -def test_main(): - run_unittest(UnaryOpTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_unicode.py b/sys/lib/python/test/test_unicode.py deleted file mode 100644 index 1bc15ae3b..000000000 --- a/sys/lib/python/test/test_unicode.py +++ /dev/null @@ -1,828 +0,0 @@ -# -*- coding: iso-8859-1 -*- -""" Test script for the Unicode implementation. - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -"""#" -import unittest, sys, string, codecs, new -from test import test_support, string_tests - -# Error handling (bad decoder return) -def search_function(encoding): - def decode1(input, errors="strict"): - return 42 # not a tuple - def encode1(input, errors="strict"): - return 42 # not a tuple - def encode2(input, errors="strict"): - return (42, 42) # no unicode - def decode2(input, errors="strict"): - return (42, 42) # no unicode - if encoding=="test.unicode1": - return (encode1, decode1, None, None) - elif encoding=="test.unicode2": - return (encode2, decode2, None, None) - else: - return None -codecs.register(search_function) - -class UnicodeTest( - string_tests.CommonTest, - string_tests.MixinStrUnicodeUserStringTest, - string_tests.MixinStrUnicodeTest, - ): - type2test = unicode - - def checkequalnofix(self, result, object, methodname, *args): - method = getattr(object, methodname) - realresult = method(*args) - self.assertEqual(realresult, result) - self.assert_(type(realresult) is type(result)) - - # if the original is returned make sure that - # this doesn't happen with subclasses - if realresult is object: - class usub(unicode): - def __repr__(self): - return 'usub(%r)' % unicode.__repr__(self) - object = usub(object) - method = getattr(object, methodname) - realresult = method(*args) - self.assertEqual(realresult, result) - self.assert_(object is not realresult) - - def test_literals(self): - self.assertEqual(u'\xff', u'\u00ff') - self.assertEqual(u'\uffff', u'\U0000ffff') - self.assertRaises(UnicodeError, eval, 'u\'\\Ufffffffe\'') - self.assertRaises(UnicodeError, eval, 'u\'\\Uffffffff\'') - self.assertRaises(UnicodeError, eval, 'u\'\\U%08x\'' % 0x110000) - - def test_repr(self): - if not sys.platform.startswith('java'): - # Test basic sanity of repr() - self.assertEqual(repr(u'abc'), "u'abc'") - self.assertEqual(repr(u'ab\\c'), "u'ab\\\\c'") - self.assertEqual(repr(u'ab\\'), "u'ab\\\\'") - self.assertEqual(repr(u'\\c'), "u'\\\\c'") - self.assertEqual(repr(u'\\'), "u'\\\\'") - self.assertEqual(repr(u'\n'), "u'\\n'") - self.assertEqual(repr(u'\r'), "u'\\r'") - self.assertEqual(repr(u'\t'), "u'\\t'") - self.assertEqual(repr(u'\b'), "u'\\x08'") - self.assertEqual(repr(u"'\""), """u'\\'"'""") - self.assertEqual(repr(u"'\""), """u'\\'"'""") - self.assertEqual(repr(u"'"), '''u"'"''') - self.assertEqual(repr(u'"'), """u'"'""") - latin1repr = ( - "u'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r" - "\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a" - "\\x1b\\x1c\\x1d\\x1e\\x1f !\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHI" - "JKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\x7f" - "\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\\x88\\x89\\x8a\\x8b\\x8c\\x8d" - "\\x8e\\x8f\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\\x98\\x99\\x9a\\x9b" - "\\x9c\\x9d\\x9e\\x9f\\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\\xa8\\xa9" - "\\xaa\\xab\\xac\\xad\\xae\\xaf\\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7" - "\\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5" - "\\xc6\\xc7\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\\xd0\\xd1\\xd2\\xd3" - "\\xd4\\xd5\\xd6\\xd7\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\\xe0\\xe1" - "\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef" - "\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd" - "\\xfe\\xff'") - testrepr = repr(u''.join(map(unichr, xrange(256)))) - self.assertEqual(testrepr, latin1repr) - # Test repr works on wide unicode escapes without overflow. - self.assertEqual(repr(u"\U00010000" * 39 + u"\uffff" * 4096), - repr(u"\U00010000" * 39 + u"\uffff" * 4096)) - - - def test_count(self): - string_tests.CommonTest.test_count(self) - # check mixed argument types - self.checkequalnofix(3, 'aaa', 'count', u'a') - self.checkequalnofix(0, 'aaa', 'count', u'b') - self.checkequalnofix(3, u'aaa', 'count', 'a') - self.checkequalnofix(0, u'aaa', 'count', 'b') - self.checkequalnofix(0, u'aaa', 'count', 'b') - self.checkequalnofix(1, u'aaa', 'count', 'a', -1) - self.checkequalnofix(3, u'aaa', 'count', 'a', -10) - self.checkequalnofix(2, u'aaa', 'count', 'a', 0, -1) - self.checkequalnofix(0, u'aaa', 'count', 'a', 0, -10) - - def test_find(self): - self.checkequalnofix(0, u'abcdefghiabc', 'find', u'abc') - self.checkequalnofix(9, u'abcdefghiabc', 'find', u'abc', 1) - self.checkequalnofix(-1, u'abcdefghiabc', 'find', u'def', 4) - - self.assertRaises(TypeError, u'hello'.find) - self.assertRaises(TypeError, u'hello'.find, 42) - - def test_rfind(self): - string_tests.CommonTest.test_rfind(self) - # check mixed argument types - self.checkequalnofix(9, 'abcdefghiabc', 'rfind', u'abc') - self.checkequalnofix(12, 'abcdefghiabc', 'rfind', u'') - self.checkequalnofix(12, u'abcdefghiabc', 'rfind', '') - - def test_index(self): - string_tests.CommonTest.test_index(self) - # check mixed argument types - for (t1, t2) in ((str, unicode), (unicode, str)): - self.checkequalnofix(0, t1('abcdefghiabc'), 'index', t2('')) - self.checkequalnofix(3, t1('abcdefghiabc'), 'index', t2('def')) - self.checkequalnofix(0, t1('abcdefghiabc'), 'index', t2('abc')) - self.checkequalnofix(9, t1('abcdefghiabc'), 'index', t2('abc'), 1) - self.assertRaises(ValueError, t1('abcdefghiabc').index, t2('hib')) - self.assertRaises(ValueError, t1('abcdefghiab').index, t2('abc'), 1) - self.assertRaises(ValueError, t1('abcdefghi').index, t2('ghi'), 8) - self.assertRaises(ValueError, t1('abcdefghi').index, t2('ghi'), -1) - - def test_rindex(self): - string_tests.CommonTest.test_rindex(self) - # check mixed argument types - for (t1, t2) in ((str, unicode), (unicode, str)): - self.checkequalnofix(12, t1('abcdefghiabc'), 'rindex', t2('')) - self.checkequalnofix(3, t1('abcdefghiabc'), 'rindex', t2('def')) - self.checkequalnofix(9, t1('abcdefghiabc'), 'rindex', t2('abc')) - self.checkequalnofix(0, t1('abcdefghiabc'), 'rindex', t2('abc'), 0, -1) - - self.assertRaises(ValueError, t1('abcdefghiabc').rindex, t2('hib')) - self.assertRaises(ValueError, t1('defghiabc').rindex, t2('def'), 1) - self.assertRaises(ValueError, t1('defghiabc').rindex, t2('abc'), 0, -1) - self.assertRaises(ValueError, t1('abcdefghi').rindex, t2('ghi'), 0, 8) - self.assertRaises(ValueError, t1('abcdefghi').rindex, t2('ghi'), 0, -1) - - def test_translate(self): - self.checkequalnofix(u'bbbc', u'abababc', 'translate', {ord('a'):None}) - self.checkequalnofix(u'iiic', u'abababc', 'translate', {ord('a'):None, ord('b'):ord('i')}) - self.checkequalnofix(u'iiix', u'abababc', 'translate', {ord('a'):None, ord('b'):ord('i'), ord('c'):u'x'}) - self.checkequalnofix(u'c', u'abababc', 'translate', {ord('a'):None, ord('b'):u''}) - self.checkequalnofix(u'c', u'abababc', 'translate', {ord('a'):None, ord('b'):u''}) - self.checkequalnofix(u'xyyx', u'xzx', 'translate', {ord('z'):u'yy'}) - - self.assertRaises(TypeError, u'hello'.translate) - self.assertRaises(TypeError, u'abababc'.translate, {ord('a'):''}) - - def test_split(self): - string_tests.CommonTest.test_split(self) - - # Mixed arguments - self.checkequalnofix([u'a', u'b', u'c', u'd'], u'a//b//c//d', 'split', '//') - self.checkequalnofix([u'a', u'b', u'c', u'd'], 'a//b//c//d', 'split', u'//') - self.checkequalnofix([u'endcase ', u''], u'endcase test', 'split', 'test') - - def test_join(self): - string_tests.MixinStrUnicodeUserStringTest.test_join(self) - - # mixed arguments - self.checkequalnofix(u'a b c d', u' ', 'join', ['a', 'b', u'c', u'd']) - self.checkequalnofix(u'abcd', u'', 'join', (u'a', u'b', u'c', u'd')) - self.checkequalnofix(u'w x y z', u' ', 'join', string_tests.Sequence('wxyz')) - self.checkequalnofix(u'a b c d', ' ', 'join', [u'a', u'b', u'c', u'd']) - self.checkequalnofix(u'a b c d', ' ', 'join', ['a', 'b', u'c', u'd']) - self.checkequalnofix(u'abcd', '', 'join', (u'a', u'b', u'c', u'd')) - self.checkequalnofix(u'w x y z', ' ', 'join', string_tests.Sequence(u'wxyz')) - - def test_strip(self): - string_tests.CommonTest.test_strip(self) - self.assertRaises(UnicodeError, u"hello".strip, "\xff") - - def test_replace(self): - string_tests.CommonTest.test_replace(self) - - # method call forwarded from str implementation because of unicode argument - self.checkequalnofix(u'one@two!three!', 'one!two!three!', 'replace', u'!', u'@', 1) - self.assertRaises(TypeError, 'replace'.replace, u"r", 42) - - def test_comparison(self): - # Comparisons: - self.assertEqual(u'abc', 'abc') - self.assertEqual('abc', u'abc') - self.assertEqual(u'abc', u'abc') - self.assert_(u'abcd' > 'abc') - self.assert_('abcd' > u'abc') - self.assert_(u'abcd' > u'abc') - self.assert_(u'abc' < 'abcd') - self.assert_('abc' < u'abcd') - self.assert_(u'abc' < u'abcd') - - if 0: - # Move these tests to a Unicode collation module test... - # Testing UTF-16 code point order comparisons... - - # No surrogates, no fixup required. - self.assert_(u'\u0061' < u'\u20ac') - # Non surrogate below surrogate value, no fixup required - self.assert_(u'\u0061' < u'\ud800\udc02') - - # Non surrogate above surrogate value, fixup required - def test_lecmp(s, s2): - self.assert_(s < s2) - - def test_fixup(s): - s2 = u'\ud800\udc01' - test_lecmp(s, s2) - s2 = u'\ud900\udc01' - test_lecmp(s, s2) - s2 = u'\uda00\udc01' - test_lecmp(s, s2) - s2 = u'\udb00\udc01' - test_lecmp(s, s2) - s2 = u'\ud800\udd01' - test_lecmp(s, s2) - s2 = u'\ud900\udd01' - test_lecmp(s, s2) - s2 = u'\uda00\udd01' - test_lecmp(s, s2) - s2 = u'\udb00\udd01' - test_lecmp(s, s2) - s2 = u'\ud800\ude01' - test_lecmp(s, s2) - s2 = u'\ud900\ude01' - test_lecmp(s, s2) - s2 = u'\uda00\ude01' - test_lecmp(s, s2) - s2 = u'\udb00\ude01' - test_lecmp(s, s2) - s2 = u'\ud800\udfff' - test_lecmp(s, s2) - s2 = u'\ud900\udfff' - test_lecmp(s, s2) - s2 = u'\uda00\udfff' - test_lecmp(s, s2) - s2 = u'\udb00\udfff' - test_lecmp(s, s2) - - test_fixup(u'\ue000') - test_fixup(u'\uff61') - - # Surrogates on both sides, no fixup required - self.assert_(u'\ud800\udc02' < u'\ud84d\udc56') - - def test_islower(self): - string_tests.MixinStrUnicodeUserStringTest.test_islower(self) - self.checkequalnofix(False, u'\u1FFc', 'islower') - - def test_isupper(self): - string_tests.MixinStrUnicodeUserStringTest.test_isupper(self) - if not sys.platform.startswith('java'): - self.checkequalnofix(False, u'\u1FFc', 'isupper') - - def test_istitle(self): - string_tests.MixinStrUnicodeUserStringTest.test_title(self) - self.checkequalnofix(True, u'\u1FFc', 'istitle') - self.checkequalnofix(True, u'Greek \u1FFcitlecases ...', 'istitle') - - def test_isspace(self): - string_tests.MixinStrUnicodeUserStringTest.test_isspace(self) - self.checkequalnofix(True, u'\u2000', 'isspace') - self.checkequalnofix(True, u'\u200a', 'isspace') - self.checkequalnofix(False, u'\u2014', 'isspace') - - def test_isalpha(self): - string_tests.MixinStrUnicodeUserStringTest.test_isalpha(self) - self.checkequalnofix(True, u'\u1FFc', 'isalpha') - - def test_isdecimal(self): - self.checkequalnofix(False, u'', 'isdecimal') - self.checkequalnofix(False, u'a', 'isdecimal') - self.checkequalnofix(True, u'0', 'isdecimal') - self.checkequalnofix(False, u'\u2460', 'isdecimal') # CIRCLED DIGIT ONE - self.checkequalnofix(False, u'\xbc', 'isdecimal') # VULGAR FRACTION ONE QUARTER - self.checkequalnofix(True, u'\u0660', 'isdecimal') # ARABIC-INDIC DIGIT ZERO - self.checkequalnofix(True, u'0123456789', 'isdecimal') - self.checkequalnofix(False, u'0123456789a', 'isdecimal') - - self.checkraises(TypeError, 'abc', 'isdecimal', 42) - - def test_isdigit(self): - string_tests.MixinStrUnicodeUserStringTest.test_isdigit(self) - self.checkequalnofix(True, u'\u2460', 'isdigit') - self.checkequalnofix(False, u'\xbc', 'isdigit') - self.checkequalnofix(True, u'\u0660', 'isdigit') - - def test_isnumeric(self): - self.checkequalnofix(False, u'', 'isnumeric') - self.checkequalnofix(False, u'a', 'isnumeric') - self.checkequalnofix(True, u'0', 'isnumeric') - self.checkequalnofix(True, u'\u2460', 'isnumeric') - self.checkequalnofix(True, u'\xbc', 'isnumeric') - self.checkequalnofix(True, u'\u0660', 'isnumeric') - self.checkequalnofix(True, u'0123456789', 'isnumeric') - self.checkequalnofix(False, u'0123456789a', 'isnumeric') - - self.assertRaises(TypeError, u"abc".isnumeric, 42) - - def test_contains(self): - # Testing Unicode contains method - self.assert_('a' in u'abdb') - self.assert_('a' in u'bdab') - self.assert_('a' in u'bdaba') - self.assert_('a' in u'bdba') - self.assert_('a' in u'bdba') - self.assert_(u'a' in u'bdba') - self.assert_(u'a' not in u'bdb') - self.assert_(u'a' not in 'bdb') - self.assert_(u'a' in 'bdba') - self.assert_(u'a' in ('a',1,None)) - self.assert_(u'a' in (1,None,'a')) - self.assert_(u'a' in (1,None,u'a')) - self.assert_('a' in ('a',1,None)) - self.assert_('a' in (1,None,'a')) - self.assert_('a' in (1,None,u'a')) - self.assert_('a' not in ('x',1,u'y')) - self.assert_('a' not in ('x',1,None)) - self.assert_(u'abcd' not in u'abcxxxx') - self.assert_(u'ab' in u'abcd') - self.assert_('ab' in u'abc') - self.assert_(u'ab' in 'abc') - self.assert_(u'ab' in (1,None,u'ab')) - self.assert_(u'' in u'abc') - self.assert_('' in u'abc') - - # If the following fails either - # the contains operator does not propagate UnicodeErrors or - # someone has changed the default encoding - self.assertRaises(UnicodeError, 'g\xe2teau'.__contains__, u'\xe2') - - self.assert_(u'' in '') - self.assert_('' in u'') - self.assert_(u'' in u'') - self.assert_(u'' in 'abc') - self.assert_('' in u'abc') - self.assert_(u'' in u'abc') - self.assert_(u'\0' not in 'abc') - self.assert_('\0' not in u'abc') - self.assert_(u'\0' not in u'abc') - self.assert_(u'\0' in '\0abc') - self.assert_('\0' in u'\0abc') - self.assert_(u'\0' in u'\0abc') - self.assert_(u'\0' in 'abc\0') - self.assert_('\0' in u'abc\0') - self.assert_(u'\0' in u'abc\0') - self.assert_(u'a' in '\0abc') - self.assert_('a' in u'\0abc') - self.assert_(u'a' in u'\0abc') - self.assert_(u'asdf' in 'asdf') - self.assert_('asdf' in u'asdf') - self.assert_(u'asdf' in u'asdf') - self.assert_(u'asdf' not in 'asd') - self.assert_('asdf' not in u'asd') - self.assert_(u'asdf' not in u'asd') - self.assert_(u'asdf' not in '') - self.assert_('asdf' not in u'') - self.assert_(u'asdf' not in u'') - - self.assertRaises(TypeError, u"abc".__contains__) - - def test_formatting(self): - string_tests.MixinStrUnicodeUserStringTest.test_formatting(self) - # Testing Unicode formatting strings... - self.assertEqual(u"%s, %s" % (u"abc", "abc"), u'abc, abc') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, 2, 3), u'abc, abc, 1, 2.000000, 3.00') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, -2, 3), u'abc, abc, 1, -2.000000, 3.00') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.5), u'abc, abc, -1, -2.000000, 3.50') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.57), u'abc, abc, -1, -2.000000, 3.57') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 1003.57), u'abc, abc, -1, -2.000000, 1003.57') - if not sys.platform.startswith('java'): - self.assertEqual(u"%r, %r" % (u"abc", "abc"), u"u'abc', 'abc'") - self.assertEqual(u"%(x)s, %(y)s" % {'x':u"abc", 'y':"def"}, u'abc, def') - self.assertEqual(u"%(x)s, %(\xfc)s" % {'x':u"abc", u'\xfc':"def"}, u'abc, def') - - self.assertEqual(u'%c' % 0x1234, u'\u1234') - self.assertRaises(OverflowError, u"%c".__mod__, (sys.maxunicode+1,)) - - # formatting jobs delegated from the string implementation: - self.assertEqual('...%(foo)s...' % {'foo':u"abc"}, u'...abc...') - self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...') - self.assertEqual('...%(foo)s...' % {u'foo':"abc"}, '...abc...') - self.assertEqual('...%(foo)s...' % {u'foo':u"abc"}, u'...abc...') - self.assertEqual('...%(foo)s...' % {u'foo':u"abc",'def':123}, u'...abc...') - self.assertEqual('...%(foo)s...' % {u'foo':u"abc",u'def':123}, u'...abc...') - self.assertEqual('...%s...%s...%s...%s...' % (1,2,3,u"abc"), u'...1...2...3...abc...') - self.assertEqual('...%%...%%s...%s...%s...%s...%s...' % (1,2,3,u"abc"), u'...%...%s...1...2...3...abc...') - self.assertEqual('...%s...' % u"abc", u'...abc...') - self.assertEqual('%*s' % (5,u'abc',), u' abc') - self.assertEqual('%*s' % (-5,u'abc',), u'abc ') - self.assertEqual('%*.*s' % (5,2,u'abc',), u' ab') - self.assertEqual('%*.*s' % (5,3,u'abc',), u' abc') - self.assertEqual('%i %*.*s' % (10, 5,3,u'abc',), u'10 abc') - self.assertEqual('%i%s %*.*s' % (10, 3, 5, 3, u'abc',), u'103 abc') - self.assertEqual('%c' % u'a', u'a') - class Wrapper: - def __str__(self): - return u'\u1234' - self.assertEqual('%s' % Wrapper(), u'\u1234') - - @test_support.run_with_locale('LC_ALL', 'de_DE', 'fr_FR') - def test_format_float(self): - # should not format with a comma, but always with C locale - self.assertEqual(u'1.0', u'%.1f' % 1.0) - - def test_constructor(self): - # unicode(obj) tests (this maps to PyObject_Unicode() at C level) - - self.assertEqual( - unicode(u'unicode remains unicode'), - u'unicode remains unicode' - ) - - class UnicodeSubclass(unicode): - pass - - self.assertEqual( - unicode(UnicodeSubclass('unicode subclass becomes unicode')), - u'unicode subclass becomes unicode' - ) - - self.assertEqual( - unicode('strings are converted to unicode'), - u'strings are converted to unicode' - ) - - class UnicodeCompat: - def __init__(self, x): - self.x = x - def __unicode__(self): - return self.x - - self.assertEqual( - unicode(UnicodeCompat('__unicode__ compatible objects are recognized')), - u'__unicode__ compatible objects are recognized') - - class StringCompat: - def __init__(self, x): - self.x = x - def __str__(self): - return self.x - - self.assertEqual( - unicode(StringCompat('__str__ compatible objects are recognized')), - u'__str__ compatible objects are recognized' - ) - - # unicode(obj) is compatible to str(): - - o = StringCompat('unicode(obj) is compatible to str()') - self.assertEqual(unicode(o), u'unicode(obj) is compatible to str()') - self.assertEqual(str(o), 'unicode(obj) is compatible to str()') - - # %-formatting and .__unicode__() - self.assertEqual(u'%s' % - UnicodeCompat(u"u'%s' % obj uses obj.__unicode__()"), - u"u'%s' % obj uses obj.__unicode__()") - self.assertEqual(u'%s' % - UnicodeCompat(u"u'%s' % obj falls back to obj.__str__()"), - u"u'%s' % obj falls back to obj.__str__()") - - for obj in (123, 123.45, 123L): - self.assertEqual(unicode(obj), unicode(str(obj))) - - # unicode(obj, encoding, error) tests (this maps to - # PyUnicode_FromEncodedObject() at C level) - - if not sys.platform.startswith('java'): - self.assertRaises( - TypeError, - unicode, - u'decoding unicode is not supported', - 'utf-8', - 'strict' - ) - - self.assertEqual( - unicode('strings are decoded to unicode', 'utf-8', 'strict'), - u'strings are decoded to unicode' - ) - - if not sys.platform.startswith('java'): - self.assertEqual( - unicode( - buffer('character buffers are decoded to unicode'), - 'utf-8', - 'strict' - ), - u'character buffers are decoded to unicode' - ) - - self.assertRaises(TypeError, unicode, 42, 42, 42) - - def test_codecs_utf7(self): - utfTests = [ - (u'A\u2262\u0391.', 'A+ImIDkQ.'), # RFC2152 example - (u'Hi Mom -\u263a-!', 'Hi Mom -+Jjo--!'), # RFC2152 example - (u'\u65E5\u672C\u8A9E', '+ZeVnLIqe-'), # RFC2152 example - (u'Item 3 is \u00a31.', 'Item 3 is +AKM-1.'), # RFC2152 example - (u'+', '+-'), - (u'+-', '+--'), - (u'+?', '+-?'), - (u'\?', '+AFw?'), - (u'+?', '+-?'), - (ur'\\?', '+AFwAXA?'), - (ur'\\\?', '+AFwAXABc?'), - (ur'++--', '+-+---') - ] - - for (x, y) in utfTests: - self.assertEqual(x.encode('utf-7'), y) - - # surrogates not supported - self.assertRaises(UnicodeError, unicode, '+3ADYAA-', 'utf-7') - - self.assertEqual(unicode('+3ADYAA-', 'utf-7', 'replace'), u'\ufffd') - - def test_codecs_utf8(self): - self.assertEqual(u''.encode('utf-8'), '') - self.assertEqual(u'\u20ac'.encode('utf-8'), '\xe2\x82\xac') - self.assertEqual(u'\ud800\udc02'.encode('utf-8'), '\xf0\x90\x80\x82') - self.assertEqual(u'\ud84d\udc56'.encode('utf-8'), '\xf0\xa3\x91\x96') - self.assertEqual(u'\ud800'.encode('utf-8'), '\xed\xa0\x80') - self.assertEqual(u'\udc00'.encode('utf-8'), '\xed\xb0\x80') - self.assertEqual( - (u'\ud800\udc02'*1000).encode('utf-8'), - '\xf0\x90\x80\x82'*1000 - ) - self.assertEqual( - u'\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f' - u'\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00' - u'\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c' - u'\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067' - u'\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das' - u' Nunstuck git und'.encode('utf-8'), - '\xe6\xad\xa3\xe7\xa2\xba\xe3\x81\xab\xe8\xa8\x80\xe3\x81' - '\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3\xe3\x81\xaf\xe3' - '\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe' - '\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82\xe4\xb8\x80\xe9\x83' - '\xa8\xe3\x81\xaf\xe3\x83\x89\xe3\x82\xa4\xe3\x83\x84\xe8' - '\xaa\x9e\xe3\x81\xa7\xe3\x81\x99\xe3\x81\x8c\xe3\x80\x81' - '\xe3\x81\x82\xe3\x81\xa8\xe3\x81\xaf\xe3\x81\xa7\xe3\x81' - '\x9f\xe3\x82\x89\xe3\x82\x81\xe3\x81\xa7\xe3\x81\x99\xe3' - '\x80\x82\xe5\xae\x9f\xe9\x9a\x9b\xe3\x81\xab\xe3\x81\xaf' - '\xe3\x80\x8cWenn ist das Nunstuck git und' - ) - - # UTF-8 specific decoding tests - self.assertEqual(unicode('\xf0\xa3\x91\x96', 'utf-8'), u'\U00023456' ) - self.assertEqual(unicode('\xf0\x90\x80\x82', 'utf-8'), u'\U00010002' ) - self.assertEqual(unicode('\xe2\x82\xac', 'utf-8'), u'\u20ac' ) - - # Other possible utf-8 test cases: - # * strict decoding testing for all of the - # UTF8_ERROR cases in PyUnicode_DecodeUTF8 - - def test_codecs_idna(self): - # Test whether trailing dot is preserved - self.assertEqual(u"www.python.org.".encode("idna"), "www.python.org.") - - def test_codecs_errors(self): - # Error handling (encoding) - self.assertRaises(UnicodeError, u'Andr\202 x'.encode, 'ascii') - self.assertRaises(UnicodeError, u'Andr\202 x'.encode, 'ascii','strict') - self.assertEqual(u'Andr\202 x'.encode('ascii','ignore'), "Andr x") - self.assertEqual(u'Andr\202 x'.encode('ascii','replace'), "Andr? x") - - # Error handling (decoding) - self.assertRaises(UnicodeError, unicode, 'Andr\202 x', 'ascii') - self.assertRaises(UnicodeError, unicode, 'Andr\202 x', 'ascii','strict') - self.assertEqual(unicode('Andr\202 x','ascii','ignore'), u"Andr x") - self.assertEqual(unicode('Andr\202 x','ascii','replace'), u'Andr\uFFFD x') - - # Error handling (unknown character names) - self.assertEqual("\\N{foo}xx".decode("unicode-escape", "ignore"), u"xx") - - # Error handling (truncated escape sequence) - self.assertRaises(UnicodeError, "\\".decode, "unicode-escape") - - self.assertRaises(TypeError, "hello".decode, "test.unicode1") - self.assertRaises(TypeError, unicode, "hello", "test.unicode2") - self.assertRaises(TypeError, u"hello".encode, "test.unicode1") - self.assertRaises(TypeError, u"hello".encode, "test.unicode2") - # executes PyUnicode_Encode() - import imp - self.assertRaises( - ImportError, - imp.find_module, - "non-existing module", - [u"non-existing dir"] - ) - - # Error handling (wrong arguments) - self.assertRaises(TypeError, u"hello".encode, 42, 42, 42) - - # Error handling (PyUnicode_EncodeDecimal()) - self.assertRaises(UnicodeError, int, u"\u0200") - - def test_codecs(self): - # Encoding - self.assertEqual(u'hello'.encode('ascii'), 'hello') - self.assertEqual(u'hello'.encode('utf-7'), 'hello') - self.assertEqual(u'hello'.encode('utf-8'), 'hello') - self.assertEqual(u'hello'.encode('utf8'), 'hello') - self.assertEqual(u'hello'.encode('utf-16-le'), 'h\000e\000l\000l\000o\000') - self.assertEqual(u'hello'.encode('utf-16-be'), '\000h\000e\000l\000l\000o') - self.assertEqual(u'hello'.encode('latin-1'), 'hello') - - # Roundtrip safety for BMP (just the first 1024 chars) - for c in xrange(1024): - u = unichr(c) - for encoding in ('utf-7', 'utf-8', 'utf-16', 'utf-16-le', - 'utf-16-be', 'raw_unicode_escape', - 'unicode_escape', 'unicode_internal'): - self.assertEqual(unicode(u.encode(encoding),encoding), u) - - # Roundtrip safety for BMP (just the first 256 chars) - for c in xrange(256): - u = unichr(c) - for encoding in ('latin-1',): - self.assertEqual(unicode(u.encode(encoding),encoding), u) - - # Roundtrip safety for BMP (just the first 128 chars) - for c in xrange(128): - u = unichr(c) - for encoding in ('ascii',): - self.assertEqual(unicode(u.encode(encoding),encoding), u) - - # Roundtrip safety for non-BMP (just a few chars) - u = u'\U00010001\U00020002\U00030003\U00040004\U00050005' - for encoding in ('utf-8', 'utf-16', 'utf-16-le', 'utf-16-be', - #'raw_unicode_escape', - 'unicode_escape', 'unicode_internal'): - self.assertEqual(unicode(u.encode(encoding),encoding), u) - - # UTF-8 must be roundtrip safe for all UCS-2 code points - # This excludes surrogates: in the full range, there would be - # a surrogate pair (\udbff\udc00), which gets converted back - # to a non-BMP character (\U0010fc00) - u = u''.join(map(unichr, range(0,0xd800)+range(0xe000,0x10000))) - for encoding in ('utf-8',): - self.assertEqual(unicode(u.encode(encoding),encoding), u) - - def test_codecs_charmap(self): - # 0-127 - s = ''.join(map(chr, xrange(128))) - for encoding in ( - 'cp037', 'cp1026', - 'cp437', 'cp500', 'cp737', 'cp775', 'cp850', - 'cp852', 'cp855', 'cp860', 'cp861', 'cp862', - 'cp863', 'cp865', 'cp866', - 'iso8859_10', 'iso8859_13', 'iso8859_14', 'iso8859_15', - 'iso8859_2', 'iso8859_3', 'iso8859_4', 'iso8859_5', 'iso8859_6', - 'iso8859_7', 'iso8859_9', 'koi8_r', 'latin_1', - 'mac_cyrillic', 'mac_latin2', - - 'cp1250', 'cp1251', 'cp1252', 'cp1253', 'cp1254', 'cp1255', - 'cp1256', 'cp1257', 'cp1258', - 'cp856', 'cp857', 'cp864', 'cp869', 'cp874', - - 'mac_greek', 'mac_iceland','mac_roman', 'mac_turkish', - 'cp1006', 'iso8859_8', - - ### These have undefined mappings: - #'cp424', - - ### These fail the round-trip: - #'cp875' - - ): - self.assertEqual(unicode(s, encoding).encode(encoding), s) - - # 128-255 - s = ''.join(map(chr, xrange(128, 256))) - for encoding in ( - 'cp037', 'cp1026', - 'cp437', 'cp500', 'cp737', 'cp775', 'cp850', - 'cp852', 'cp855', 'cp860', 'cp861', 'cp862', - 'cp863', 'cp865', 'cp866', - 'iso8859_10', 'iso8859_13', 'iso8859_14', 'iso8859_15', - 'iso8859_2', 'iso8859_4', 'iso8859_5', - 'iso8859_9', 'koi8_r', 'latin_1', - 'mac_cyrillic', 'mac_latin2', - - ### These have undefined mappings: - #'cp1250', 'cp1251', 'cp1252', 'cp1253', 'cp1254', 'cp1255', - #'cp1256', 'cp1257', 'cp1258', - #'cp424', 'cp856', 'cp857', 'cp864', 'cp869', 'cp874', - #'iso8859_3', 'iso8859_6', 'iso8859_7', - #'mac_greek', 'mac_iceland','mac_roman', 'mac_turkish', - - ### These fail the round-trip: - #'cp1006', 'cp875', 'iso8859_8', - - ): - self.assertEqual(unicode(s, encoding).encode(encoding), s) - - def test_concatenation(self): - self.assertEqual((u"abc" u"def"), u"abcdef") - self.assertEqual(("abc" u"def"), u"abcdef") - self.assertEqual((u"abc" "def"), u"abcdef") - self.assertEqual((u"abc" u"def" "ghi"), u"abcdefghi") - self.assertEqual(("abc" "def" u"ghi"), u"abcdefghi") - - def test_printing(self): - class BitBucket: - def write(self, text): - pass - - out = BitBucket() - print >>out, u'abc' - print >>out, u'abc', u'def' - print >>out, u'abc', 'def' - print >>out, 'abc', u'def' - print >>out, u'abc\n' - print >>out, u'abc\n', - print >>out, u'abc\n', - print >>out, u'def\n' - print >>out, u'def\n' - - def test_ucs4(self): - if sys.maxunicode == 0xFFFF: - return - x = u'\U00100000' - y = x.encode("raw-unicode-escape").decode("raw-unicode-escape") - self.assertEqual(x, y) - - def test_conversion(self): - # Make sure __unicode__() works properly - class Foo0: - def __str__(self): - return "foo" - - class Foo1: - def __unicode__(self): - return u"foo" - - class Foo2(object): - def __unicode__(self): - return u"foo" - - class Foo3(object): - def __unicode__(self): - return "foo" - - class Foo4(str): - def __unicode__(self): - return "foo" - - class Foo5(unicode): - def __unicode__(self): - return "foo" - - class Foo6(str): - def __str__(self): - return "foos" - - def __unicode__(self): - return u"foou" - - class Foo7(unicode): - def __str__(self): - return "foos" - def __unicode__(self): - return u"foou" - - class Foo8(unicode): - def __new__(cls, content=""): - return unicode.__new__(cls, 2*content) - def __unicode__(self): - return self - - class Foo9(unicode): - def __str__(self): - return "string" - def __unicode__(self): - return "not unicode" - - self.assertEqual(unicode(Foo0()), u"foo") - self.assertEqual(unicode(Foo1()), u"foo") - self.assertEqual(unicode(Foo2()), u"foo") - self.assertEqual(unicode(Foo3()), u"foo") - self.assertEqual(unicode(Foo4("bar")), u"foo") - self.assertEqual(unicode(Foo5("bar")), u"foo") - self.assertEqual(unicode(Foo6("bar")), u"foou") - self.assertEqual(unicode(Foo7("bar")), u"foou") - self.assertEqual(unicode(Foo8("foo")), u"foofoo") - self.assertEqual(str(Foo9("foo")), "string") - self.assertEqual(unicode(Foo9("foo")), u"not unicode") - - def test_unicode_repr(self): - class s1: - def __repr__(self): - return '\\n' - - class s2: - def __repr__(self): - return u'\\n' - - self.assertEqual(repr(s1()), '\\n') - self.assertEqual(repr(s2()), '\\n') - - - - - -def test_main(): - test_support.run_unittest(UnicodeTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_unicode_file.py b/sys/lib/python/test/test_unicode_file.py deleted file mode 100644 index 6443efd79..000000000 --- a/sys/lib/python/test/test_unicode_file.py +++ /dev/null @@ -1,213 +0,0 @@ -# Test some Unicode file name semantics -# We dont test many operations on files other than -# that their names can be used with Unicode characters. -import os, glob, time, shutil -import unicodedata - -import unittest -from test.test_support import run_suite, TestSkipped, TESTFN_UNICODE -from test.test_support import TESTFN_ENCODING, TESTFN_UNICODE_UNENCODEABLE -try: - TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) -except (UnicodeError, TypeError): - # Either the file system encoding is None, or the file name - # cannot be encoded in the file system encoding. - raise TestSkipped("No Unicode filesystem semantics on this platform.") - -if TESTFN_ENCODED.decode(TESTFN_ENCODING) != TESTFN_UNICODE: - # The file system encoding does not support Latin-1 - # (which test_support assumes), so try the file system - # encoding instead. - import sys - try: - TESTFN_UNICODE = unicode("@test-\xe0\xf2", sys.getfilesystemencoding()) - TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) - if '?' in TESTFN_ENCODED: - # MBCS will not report the error properly - raise UnicodeError, "mbcs encoding problem" - except (UnicodeError, TypeError): - raise TestSkipped("Cannot find a suiteable filename.") - -if TESTFN_ENCODED.decode(TESTFN_ENCODING) != TESTFN_UNICODE: - raise TestSkipped("Cannot find a suitable filename.") - -def remove_if_exists(filename): - if os.path.exists(filename): - os.unlink(filename) - -class TestUnicodeFiles(unittest.TestCase): - # The 'do_' functions are the actual tests. They generally assume the - # file already exists etc. - - # Do all the tests we can given only a single filename. The file should - # exist. - def _do_single(self, filename): - self.failUnless(os.path.exists(filename)) - self.failUnless(os.path.isfile(filename)) - self.failUnless(os.access(filename, os.R_OK)) - self.failUnless(os.path.exists(os.path.abspath(filename))) - self.failUnless(os.path.isfile(os.path.abspath(filename))) - self.failUnless(os.access(os.path.abspath(filename), os.R_OK)) - os.chmod(filename, 0777) - os.utime(filename, None) - os.utime(filename, (time.time(), time.time())) - # Copy/rename etc tests using the same filename - self._do_copyish(filename, filename) - # Filename should appear in glob output - self.failUnless( - os.path.abspath(filename)==os.path.abspath(glob.glob(filename)[0])) - # basename should appear in listdir. - path, base = os.path.split(os.path.abspath(filename)) - if isinstance(base, str): - base = base.decode(TESTFN_ENCODING) - file_list = os.listdir(path) - # listdir() with a unicode arg may or may not return Unicode - # objects, depending on the platform. - if file_list and isinstance(file_list[0], str): - file_list = [f.decode(TESTFN_ENCODING) for f in file_list] - - # Normalize the unicode strings, as round-tripping the name via the OS - # may return a different (but equivalent) value. - base = unicodedata.normalize("NFD", base) - file_list = [unicodedata.normalize("NFD", f) for f in file_list] - - self.failUnless(base in file_list) - - # Do as many "equivalancy' tests as we can - ie, check that although we - # have different types for the filename, they refer to the same file. - def _do_equivilent(self, filename1, filename2): - # Note we only check "filename1 against filename2" - we don't bother - # checking "filename2 against 1", as we assume we are called again with - # the args reversed. - self.failUnless(type(filename1)!=type(filename2), - "No point checking equivalent filenames of the same type") - # stat and lstat should return the same results. - self.failUnlessEqual(os.stat(filename1), - os.stat(filename2)) - self.failUnlessEqual(os.lstat(filename1), - os.lstat(filename2)) - # Copy/rename etc tests using equivalent filename - self._do_copyish(filename1, filename2) - - # Tests that copy, move, etc one file to another. - def _do_copyish(self, filename1, filename2): - # Should be able to rename the file using either name. - self.failUnless(os.path.isfile(filename1)) # must exist. - os.rename(filename1, filename2 + ".new") - self.failUnless(os.path.isfile(filename1+".new")) - os.rename(filename1 + ".new", filename2) - self.failUnless(os.path.isfile(filename2)) - - # Try using shutil on the filenames. - try: - filename1==filename2 - except UnicodeDecodeError: - # these filenames can't be compared - shutil.copy tries to do - # just that. This is really a bug in 'shutil' - if one of shutil's - # 2 params are Unicode and the other isn't, it should coerce the - # string to Unicode with the filesystem encoding before comparison. - pass - else: - # filenames can be compared. - shutil.copy(filename1, filename2 + ".new") - os.unlink(filename1 + ".new") # remove using equiv name. - # And a couple of moves, one using each name. - shutil.move(filename1, filename2 + ".new") - self.failUnless(not os.path.exists(filename2)) - shutil.move(filename1 + ".new", filename2) - self.failUnless(os.path.exists(filename1)) - # Note - due to the implementation of shutil.move, - # it tries a rename first. This only fails on Windows when on - # different file systems - and this test can't ensure that. - # So we test the shutil.copy2 function, which is the thing most - # likely to fail. - shutil.copy2(filename1, filename2 + ".new") - os.unlink(filename1 + ".new") - - def _do_directory(self, make_name, chdir_name, encoded): - cwd = os.getcwd() - if os.path.isdir(make_name): - os.rmdir(make_name) - os.mkdir(make_name) - try: - os.chdir(chdir_name) - try: - if not encoded: - cwd_result = os.getcwdu() - name_result = make_name - else: - cwd_result = os.getcwd().decode(TESTFN_ENCODING) - name_result = make_name.decode(TESTFN_ENCODING) - - cwd_result = unicodedata.normalize("NFD", cwd_result) - name_result = unicodedata.normalize("NFD", name_result) - - self.failUnlessEqual(os.path.basename(cwd_result),name_result) - finally: - os.chdir(cwd) - finally: - os.rmdir(make_name) - - # The '_test' functions 'entry points with params' - ie, what the - # top-level 'test' functions would be if they could take params - def _test_single(self, filename): - remove_if_exists(filename) - f = file(filename, "w") - f.close() - try: - self._do_single(filename) - finally: - os.unlink(filename) - self.failUnless(not os.path.exists(filename)) - # and again with os.open. - f = os.open(filename, os.O_CREAT) - os.close(f) - try: - self._do_single(filename) - finally: - os.unlink(filename) - - def _test_equivalent(self, filename1, filename2): - remove_if_exists(filename1) - self.failUnless(not os.path.exists(filename2)) - f = file(filename1, "w") - f.close() - try: - self._do_equivilent(filename1, filename2) - finally: - os.unlink(filename1) - - # The 'test' functions are unittest entry points, and simply call our - # _test functions with each of the filename combinations we wish to test - def test_single_files(self): - self._test_single(TESTFN_ENCODED) - self._test_single(TESTFN_UNICODE) - if TESTFN_UNICODE_UNENCODEABLE is not None: - self._test_single(TESTFN_UNICODE_UNENCODEABLE) - - def test_equivalent_files(self): - self._test_equivalent(TESTFN_ENCODED, TESTFN_UNICODE) - self._test_equivalent(TESTFN_UNICODE, TESTFN_ENCODED) - - def test_directories(self): - # For all 'equivilent' combinations: - # Make dir with encoded, chdir with unicode, checkdir with encoded - # (or unicode/encoded/unicode, etc - ext = ".dir" - self._do_directory(TESTFN_ENCODED+ext, TESTFN_ENCODED+ext, True) - self._do_directory(TESTFN_ENCODED+ext, TESTFN_UNICODE+ext, True) - self._do_directory(TESTFN_UNICODE+ext, TESTFN_ENCODED+ext, False) - self._do_directory(TESTFN_UNICODE+ext, TESTFN_UNICODE+ext, False) - # Our directory name that can't use a non-unicode name. - if TESTFN_UNICODE_UNENCODEABLE is not None: - self._do_directory(TESTFN_UNICODE_UNENCODEABLE+ext, - TESTFN_UNICODE_UNENCODEABLE+ext, - False) - -def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestUnicodeFiles)) - run_suite(suite) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_unicodedata.py b/sys/lib/python/test/test_unicodedata.py deleted file mode 100644 index 0023bf440..000000000 --- a/sys/lib/python/test/test_unicodedata.py +++ /dev/null @@ -1,225 +0,0 @@ -""" Test script for the unicodedata module. - - Written by Marc-Andre Lemburg (mal@lemburg.com). - - (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -"""#" -import unittest, test.test_support -import hashlib - -encoding = 'utf-8' - - -### Run tests - -class UnicodeMethodsTest(unittest.TestCase): - - # update this, if the database changes - expectedchecksum = 'c198ed264497f108434b3f576d4107237221cc8a' - - def test_method_checksum(self): - h = hashlib.sha1() - for i in range(65536): - char = unichr(i) - data = [ - # Predicates (single char) - u"01"[char.isalnum()], - u"01"[char.isalpha()], - u"01"[char.isdecimal()], - u"01"[char.isdigit()], - u"01"[char.islower()], - u"01"[char.isnumeric()], - u"01"[char.isspace()], - u"01"[char.istitle()], - u"01"[char.isupper()], - - # Predicates (multiple chars) - u"01"[(char + u'abc').isalnum()], - u"01"[(char + u'abc').isalpha()], - u"01"[(char + u'123').isdecimal()], - u"01"[(char + u'123').isdigit()], - u"01"[(char + u'abc').islower()], - u"01"[(char + u'123').isnumeric()], - u"01"[(char + u' \t').isspace()], - u"01"[(char + u'abc').istitle()], - u"01"[(char + u'ABC').isupper()], - - # Mappings (single char) - char.lower(), - char.upper(), - char.title(), - - # Mappings (multiple chars) - (char + u'abc').lower(), - (char + u'ABC').upper(), - (char + u'abc').title(), - (char + u'ABC').title(), - - ] - h.update(u''.join(data).encode(encoding)) - result = h.hexdigest() - self.assertEqual(result, self.expectedchecksum) - -class UnicodeDatabaseTest(unittest.TestCase): - - def setUp(self): - # In case unicodedata is not available, this will raise an ImportError, - # but the other test cases will still be run - import unicodedata - self.db = unicodedata - - def tearDown(self): - del self.db - -class UnicodeFunctionsTest(UnicodeDatabaseTest): - - # update this, if the database changes - expectedchecksum = '4e389f97e9f88b8b7ab743121fd643089116f9f2' - - def test_function_checksum(self): - data = [] - h = hashlib.sha1() - - for i in range(0x10000): - char = unichr(i) - data = [ - # Properties - str(self.db.digit(char, -1)), - str(self.db.numeric(char, -1)), - str(self.db.decimal(char, -1)), - self.db.category(char), - self.db.bidirectional(char), - self.db.decomposition(char), - str(self.db.mirrored(char)), - str(self.db.combining(char)), - ] - h.update(''.join(data)) - result = h.hexdigest() - self.assertEqual(result, self.expectedchecksum) - - def test_digit(self): - self.assertEqual(self.db.digit(u'A', None), None) - self.assertEqual(self.db.digit(u'9'), 9) - self.assertEqual(self.db.digit(u'\u215b', None), None) - self.assertEqual(self.db.digit(u'\u2468'), 9) - - self.assertRaises(TypeError, self.db.digit) - self.assertRaises(TypeError, self.db.digit, u'xx') - self.assertRaises(ValueError, self.db.digit, u'x') - - def test_numeric(self): - self.assertEqual(self.db.numeric(u'A',None), None) - self.assertEqual(self.db.numeric(u'9'), 9) - self.assertEqual(self.db.numeric(u'\u215b'), 0.125) - self.assertEqual(self.db.numeric(u'\u2468'), 9.0) - - self.assertRaises(TypeError, self.db.numeric) - self.assertRaises(TypeError, self.db.numeric, u'xx') - self.assertRaises(ValueError, self.db.numeric, u'x') - - def test_decimal(self): - self.assertEqual(self.db.decimal(u'A',None), None) - self.assertEqual(self.db.decimal(u'9'), 9) - self.assertEqual(self.db.decimal(u'\u215b', None), None) - self.assertEqual(self.db.decimal(u'\u2468', None), None) - - self.assertRaises(TypeError, self.db.decimal) - self.assertRaises(TypeError, self.db.decimal, u'xx') - self.assertRaises(ValueError, self.db.decimal, u'x') - - def test_category(self): - self.assertEqual(self.db.category(u'\uFFFE'), 'Cn') - self.assertEqual(self.db.category(u'a'), 'Ll') - self.assertEqual(self.db.category(u'A'), 'Lu') - - self.assertRaises(TypeError, self.db.category) - self.assertRaises(TypeError, self.db.category, u'xx') - - def test_bidirectional(self): - self.assertEqual(self.db.bidirectional(u'\uFFFE'), '') - self.assertEqual(self.db.bidirectional(u' '), 'WS') - self.assertEqual(self.db.bidirectional(u'A'), 'L') - - self.assertRaises(TypeError, self.db.bidirectional) - self.assertRaises(TypeError, self.db.bidirectional, u'xx') - - def test_decomposition(self): - self.assertEqual(self.db.decomposition(u'\uFFFE'),'') - self.assertEqual(self.db.decomposition(u'\u00bc'), ' 0031 2044 0034') - - self.assertRaises(TypeError, self.db.decomposition) - self.assertRaises(TypeError, self.db.decomposition, u'xx') - - def test_mirrored(self): - self.assertEqual(self.db.mirrored(u'\uFFFE'), 0) - self.assertEqual(self.db.mirrored(u'a'), 0) - self.assertEqual(self.db.mirrored(u'\u2201'), 1) - - self.assertRaises(TypeError, self.db.mirrored) - self.assertRaises(TypeError, self.db.mirrored, u'xx') - - def test_combining(self): - self.assertEqual(self.db.combining(u'\uFFFE'), 0) - self.assertEqual(self.db.combining(u'a'), 0) - self.assertEqual(self.db.combining(u'\u20e1'), 230) - - self.assertRaises(TypeError, self.db.combining) - self.assertRaises(TypeError, self.db.combining, u'xx') - - def test_normalize(self): - self.assertRaises(TypeError, self.db.normalize) - self.assertRaises(ValueError, self.db.normalize, 'unknown', u'xx') - self.assertEqual(self.db.normalize('NFKC', u''), u'') - # The rest can be found in test_normalization.py - # which requires an external file. - - def test_east_asian_width(self): - eaw = self.db.east_asian_width - self.assertRaises(TypeError, eaw, 'a') - self.assertRaises(TypeError, eaw, u'') - self.assertRaises(TypeError, eaw, u'ra') - self.assertEqual(eaw(u'\x1e'), 'N') - self.assertEqual(eaw(u'\x20'), 'Na') - self.assertEqual(eaw(u'\uC894'), 'W') - self.assertEqual(eaw(u'\uFF66'), 'H') - self.assertEqual(eaw(u'\uFF1F'), 'F') - self.assertEqual(eaw(u'\u2010'), 'A') - -class UnicodeMiscTest(UnicodeDatabaseTest): - - def test_decimal_numeric_consistent(self): - # Test that decimal and numeric are consistent, - # i.e. if a character has a decimal value, - # its numeric value should be the same. - count = 0 - for i in xrange(0x10000): - c = unichr(i) - dec = self.db.decimal(c, -1) - if dec != -1: - self.assertEqual(dec, self.db.numeric(c)) - count += 1 - self.assert_(count >= 10) # should have tested at least the ASCII digits - - def test_digit_numeric_consistent(self): - # Test that digit and numeric are consistent, - # i.e. if a character has a digit value, - # its numeric value should be the same. - count = 0 - for i in xrange(0x10000): - c = unichr(i) - dec = self.db.digit(c, -1) - if dec != -1: - self.assertEqual(dec, self.db.numeric(c)) - count += 1 - self.assert_(count >= 10) # should have tested at least the ASCII digits - -def test_main(): - test.test_support.run_unittest( - UnicodeMiscTest, - UnicodeMethodsTest, - UnicodeFunctionsTest - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_unittest.py b/sys/lib/python/test/test_unittest.py deleted file mode 100644 index 91511667a..000000000 --- a/sys/lib/python/test/test_unittest.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Test script for unittest. - -This just includes tests for new features. We really need a -full set of tests. -""" - -import unittest - -def test_TestSuite_iter(): - """ - >>> test1 = unittest.FunctionTestCase(lambda: None) - >>> test2 = unittest.FunctionTestCase(lambda: None) - >>> suite = unittest.TestSuite((test1, test2)) - >>> tests = [] - >>> for test in suite: - ... tests.append(test) - >>> tests == [test1, test2] - True - """ - - -###################################################################### -## Main -###################################################################### - -def test_main(): - from test import test_support, test_unittest - test_support.run_doctest(test_unittest, verbosity=True) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_univnewlines.py b/sys/lib/python/test/test_univnewlines.py deleted file mode 100644 index e91bde72c..000000000 --- a/sys/lib/python/test/test_univnewlines.py +++ /dev/null @@ -1,123 +0,0 @@ -# Tests universal newline support for both reading and parsing files. -import unittest -import os -import sys -from test import test_support - -if not hasattr(sys.stdin, 'newlines'): - raise test_support.TestSkipped, \ - "This Python does not have universal newline support" - -FATX = 'x' * (2**14) - -DATA_TEMPLATE = [ - "line1=1", - "line2='this is a very long line designed to go past the magic " + - "hundred character limit that is inside fileobject.c and which " + - "is meant to speed up the common case, but we also want to test " + - "the uncommon case, naturally.'", - "def line3():pass", - "line4 = '%s'" % FATX, - ] - -DATA_LF = "\n".join(DATA_TEMPLATE) + "\n" -DATA_CR = "\r".join(DATA_TEMPLATE) + "\r" -DATA_CRLF = "\r\n".join(DATA_TEMPLATE) + "\r\n" - -# Note that DATA_MIXED also tests the ability to recognize a lone \r -# before end-of-file. -DATA_MIXED = "\n".join(DATA_TEMPLATE) + "\r" -DATA_SPLIT = [x + "\n" for x in DATA_TEMPLATE] -del x - -class TestGenericUnivNewlines(unittest.TestCase): - # use a class variable DATA to define the data to write to the file - # and a class variable NEWLINE to set the expected newlines value - READMODE = 'U' - WRITEMODE = 'wb' - - def setUp(self): - fp = open(test_support.TESTFN, self.WRITEMODE) - fp.write(self.DATA) - fp.close() - - def tearDown(self): - try: - os.unlink(test_support.TESTFN) - except: - pass - - def test_read(self): - fp = open(test_support.TESTFN, self.READMODE) - data = fp.read() - self.assertEqual(data, DATA_LF) - self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) - - def test_readlines(self): - fp = open(test_support.TESTFN, self.READMODE) - data = fp.readlines() - self.assertEqual(data, DATA_SPLIT) - self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) - - def test_readline(self): - fp = open(test_support.TESTFN, self.READMODE) - data = [] - d = fp.readline() - while d: - data.append(d) - d = fp.readline() - self.assertEqual(data, DATA_SPLIT) - self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) - - def test_seek(self): - fp = open(test_support.TESTFN, self.READMODE) - fp.readline() - pos = fp.tell() - data = fp.readlines() - self.assertEqual(data, DATA_SPLIT[1:]) - fp.seek(pos) - data = fp.readlines() - self.assertEqual(data, DATA_SPLIT[1:]) - - def test_execfile(self): - namespace = {} - execfile(test_support.TESTFN, namespace) - func = namespace['line3'] - self.assertEqual(func.func_code.co_firstlineno, 3) - self.assertEqual(namespace['line4'], FATX) - - -class TestNativeNewlines(TestGenericUnivNewlines): - NEWLINE = None - DATA = DATA_LF - READMODE = 'r' - WRITEMODE = 'w' - -class TestCRNewlines(TestGenericUnivNewlines): - NEWLINE = '\r' - DATA = DATA_CR - -class TestLFNewlines(TestGenericUnivNewlines): - NEWLINE = '\n' - DATA = DATA_LF - -class TestCRLFNewlines(TestGenericUnivNewlines): - NEWLINE = '\r\n' - DATA = DATA_CRLF - -class TestMixedNewlines(TestGenericUnivNewlines): - NEWLINE = ('\r', '\n') - DATA = DATA_MIXED - - -def test_main(): - test_support.run_unittest( - TestNativeNewlines, - TestCRNewlines, - TestLFNewlines, - TestCRLFNewlines, - TestMixedNewlines - ) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_unpack.py b/sys/lib/python/test/test_unpack.py deleted file mode 100644 index 76a482280..000000000 --- a/sys/lib/python/test/test_unpack.py +++ /dev/null @@ -1,131 +0,0 @@ -doctests = """ - -Unpack tuple - - >>> t = (1, 2, 3) - >>> a, b, c = t - >>> a == 1 and b == 2 and c == 3 - True - -Unpack list - - >>> l = [4, 5, 6] - >>> a, b, c = l - >>> a == 4 and b == 5 and c == 6 - True - -Unpack implied tuple - - >>> a, b, c = 7, 8, 9 - >>> a == 7 and b == 8 and c == 9 - True - -Unpack string... fun! - - >>> a, b, c = 'one' - >>> a == 'o' and b == 'n' and c == 'e' - True - -Unpack generic sequence - - >>> class Seq: - ... def __getitem__(self, i): - ... if i >= 0 and i < 3: return i - ... raise IndexError - ... - >>> a, b, c = Seq() - >>> a == 0 and b == 1 and c == 2 - True - -Single element unpacking, with extra syntax - - >>> st = (99,) - >>> sl = [100] - >>> a, = st - >>> a - 99 - >>> b, = sl - >>> b - 100 - -Now for some failures - -Unpacking non-sequence - - >>> a, b, c = 7 - Traceback (most recent call last): - ... - TypeError: 'int' object is not iterable - -Unpacking tuple of wrong size - - >>> a, b = t - Traceback (most recent call last): - ... - ValueError: too many values to unpack - -Unpacking tuple of wrong size - - >>> a, b = l - Traceback (most recent call last): - ... - ValueError: too many values to unpack - -Unpacking sequence too short - - >>> a, b, c, d = Seq() - Traceback (most recent call last): - ... - ValueError: need more than 3 values to unpack - -Unpacking sequence too long - - >>> a, b = Seq() - Traceback (most recent call last): - ... - ValueError: too many values to unpack - -Unpacking a sequence where the test for too long raises a different kind of -error - - >>> class BozoError(Exception): - ... pass - ... - >>> class BadSeq: - ... def __getitem__(self, i): - ... if i >= 0 and i < 3: - ... return i - ... elif i == 3: - ... raise BozoError - ... else: - ... raise IndexError - ... - -Trigger code while not expecting an IndexError (unpack sequence too long, wrong -error) - - >>> a, b, c, d, e = BadSeq() - Traceback (most recent call last): - ... - BozoError - -Trigger code while expecting an IndexError (unpack sequence too short, wrong -error) - - >>> a, b, c = BadSeq() - Traceback (most recent call last): - ... - BozoError - -""" - -__test__ = {'doctests' : doctests} - -def test_main(verbose=False): - import sys - from test import test_support - from test import test_unpack - test_support.run_doctest(test_unpack, verbose) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_urllib.py b/sys/lib/python/test/test_urllib.py deleted file mode 100644 index 294ed5e06..000000000 --- a/sys/lib/python/test/test_urllib.py +++ /dev/null @@ -1,560 +0,0 @@ -"""Regresssion tests for urllib""" - -import urllib -import httplib -import unittest -from test import test_support -import os -import mimetools -import tempfile -import StringIO - -def hexescape(char): - """Escape char as RFC 2396 specifies""" - hex_repr = hex(ord(char))[2:].upper() - if len(hex_repr) == 1: - hex_repr = "0%s" % hex_repr - return "%" + hex_repr - -class urlopen_FileTests(unittest.TestCase): - """Test urlopen() opening a temporary file. - - Try to test as much functionality as possible so as to cut down on reliance - on connecting to the Net for testing. - - """ - - def setUp(self): - """Setup of a temp file to use for testing""" - self.text = "test_urllib: %s\n" % self.__class__.__name__ - FILE = file(test_support.TESTFN, 'wb') - try: - FILE.write(self.text) - finally: - FILE.close() - self.pathname = test_support.TESTFN - self.returned_obj = urllib.urlopen("file:%s" % self.pathname) - - def tearDown(self): - """Shut down the open object""" - self.returned_obj.close() - os.remove(test_support.TESTFN) - - def test_interface(self): - # Make sure object returned by urlopen() has the specified methods - for attr in ("read", "readline", "readlines", "fileno", - "close", "info", "geturl", "__iter__"): - self.assert_(hasattr(self.returned_obj, attr), - "object returned by urlopen() lacks %s attribute" % - attr) - - def test_read(self): - self.assertEqual(self.text, self.returned_obj.read()) - - def test_readline(self): - self.assertEqual(self.text, self.returned_obj.readline()) - self.assertEqual('', self.returned_obj.readline(), - "calling readline() after exhausting the file did not" - " return an empty string") - - def test_readlines(self): - lines_list = self.returned_obj.readlines() - self.assertEqual(len(lines_list), 1, - "readlines() returned the wrong number of lines") - self.assertEqual(lines_list[0], self.text, - "readlines() returned improper text") - - def test_fileno(self): - file_num = self.returned_obj.fileno() - self.assert_(isinstance(file_num, int), - "fileno() did not return an int") - self.assertEqual(os.read(file_num, len(self.text)), self.text, - "Reading on the file descriptor returned by fileno() " - "did not return the expected text") - - def test_close(self): - # Test close() by calling it hear and then having it be called again - # by the tearDown() method for the test - self.returned_obj.close() - - def test_info(self): - self.assert_(isinstance(self.returned_obj.info(), mimetools.Message)) - - def test_geturl(self): - self.assertEqual(self.returned_obj.geturl(), self.pathname) - - def test_iter(self): - # Test iterator - # Don't need to count number of iterations since test would fail the - # instant it returned anything beyond the first line from the - # comparison - for line in self.returned_obj.__iter__(): - self.assertEqual(line, self.text) - -class urlopen_HttpTests(unittest.TestCase): - """Test urlopen() opening a fake http connection.""" - - def fakehttp(self, fakedata): - class FakeSocket(StringIO.StringIO): - def sendall(self, str): pass - def makefile(self, mode, name): return self - def read(self, amt=None): - if self.closed: return '' - return StringIO.StringIO.read(self, amt) - def readline(self, length=None): - if self.closed: return '' - return StringIO.StringIO.readline(self, length) - class FakeHTTPConnection(httplib.HTTPConnection): - def connect(self): - self.sock = FakeSocket(fakedata) - assert httplib.HTTP._connection_class == httplib.HTTPConnection - httplib.HTTP._connection_class = FakeHTTPConnection - - def unfakehttp(self): - httplib.HTTP._connection_class = httplib.HTTPConnection - - def test_read(self): - self.fakehttp('Hello!') - try: - fp = urllib.urlopen("http://python.org/") - self.assertEqual(fp.readline(), 'Hello!') - self.assertEqual(fp.readline(), '') - finally: - self.unfakehttp() - - def test_empty_socket(self): - """urlopen() raises IOError if the underlying socket does not send any - data. (#1680230) """ - self.fakehttp('') - try: - self.assertRaises(IOError, urllib.urlopen, 'http://something') - finally: - self.unfakehttp() - -class urlretrieve_FileTests(unittest.TestCase): - """Test urllib.urlretrieve() on local files""" - - def setUp(self): - # Create a list of temporary files. Each item in the list is a file - # name (absolute path or relative to the current working directory). - # All files in this list will be deleted in the tearDown method. Note, - # this only helps to makes sure temporary files get deleted, but it - # does nothing about trying to close files that may still be open. It - # is the responsibility of the developer to properly close files even - # when exceptional conditions occur. - self.tempFiles = [] - - # Create a temporary file. - self.registerFileForCleanUp(test_support.TESTFN) - self.text = 'testing urllib.urlretrieve' - try: - FILE = file(test_support.TESTFN, 'wb') - FILE.write(self.text) - FILE.close() - finally: - try: FILE.close() - except: pass - - def tearDown(self): - # Delete the temporary files. - for each in self.tempFiles: - try: os.remove(each) - except: pass - - def constructLocalFileUrl(self, filePath): - return "file://%s" % urllib.pathname2url(os.path.abspath(filePath)) - - def createNewTempFile(self, data=""): - """Creates a new temporary file containing the specified data, - registers the file for deletion during the test fixture tear down, and - returns the absolute path of the file.""" - - newFd, newFilePath = tempfile.mkstemp() - try: - self.registerFileForCleanUp(newFilePath) - newFile = os.fdopen(newFd, "wb") - newFile.write(data) - newFile.close() - finally: - try: newFile.close() - except: pass - return newFilePath - - def registerFileForCleanUp(self, fileName): - self.tempFiles.append(fileName) - - def test_basic(self): - # Make sure that a local file just gets its own location returned and - # a headers value is returned. - result = urllib.urlretrieve("file:%s" % test_support.TESTFN) - self.assertEqual(result[0], test_support.TESTFN) - self.assert_(isinstance(result[1], mimetools.Message), - "did not get a mimetools.Message instance as second " - "returned value") - - def test_copy(self): - # Test that setting the filename argument works. - second_temp = "%s.2" % test_support.TESTFN - self.registerFileForCleanUp(second_temp) - result = urllib.urlretrieve(self.constructLocalFileUrl( - test_support.TESTFN), second_temp) - self.assertEqual(second_temp, result[0]) - self.assert_(os.path.exists(second_temp), "copy of the file was not " - "made") - FILE = file(second_temp, 'rb') - try: - text = FILE.read() - FILE.close() - finally: - try: FILE.close() - except: pass - self.assertEqual(self.text, text) - - def test_reporthook(self): - # Make sure that the reporthook works. - def hooktester(count, block_size, total_size, count_holder=[0]): - self.assert_(isinstance(count, int)) - self.assert_(isinstance(block_size, int)) - self.assert_(isinstance(total_size, int)) - self.assertEqual(count, count_holder[0]) - count_holder[0] = count_holder[0] + 1 - second_temp = "%s.2" % test_support.TESTFN - self.registerFileForCleanUp(second_temp) - urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN), - second_temp, hooktester) - - def test_reporthook_0_bytes(self): - # Test on zero length file. Should call reporthook only 1 time. - report = [] - def hooktester(count, block_size, total_size, _report=report): - _report.append((count, block_size, total_size)) - srcFileName = self.createNewTempFile() - urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), - test_support.TESTFN, hooktester) - self.assertEqual(len(report), 1) - self.assertEqual(report[0][2], 0) - - def test_reporthook_5_bytes(self): - # Test on 5 byte file. Should call reporthook only 2 times (once when - # the "network connection" is established and once when the block is - # read). Since the block size is 8192 bytes, only one block read is - # required to read the entire file. - report = [] - def hooktester(count, block_size, total_size, _report=report): - _report.append((count, block_size, total_size)) - srcFileName = self.createNewTempFile("x" * 5) - urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), - test_support.TESTFN, hooktester) - self.assertEqual(len(report), 2) - self.assertEqual(report[0][1], 8192) - self.assertEqual(report[0][2], 5) - - def test_reporthook_8193_bytes(self): - # Test on 8193 byte file. Should call reporthook only 3 times (once - # when the "network connection" is established, once for the next 8192 - # bytes, and once for the last byte). - report = [] - def hooktester(count, block_size, total_size, _report=report): - _report.append((count, block_size, total_size)) - srcFileName = self.createNewTempFile("x" * 8193) - urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), - test_support.TESTFN, hooktester) - self.assertEqual(len(report), 3) - self.assertEqual(report[0][1], 8192) - self.assertEqual(report[0][2], 8193) - -class QuotingTests(unittest.TestCase): - """Tests for urllib.quote() and urllib.quote_plus() - - According to RFC 2396 ("Uniform Resource Identifiers), to escape a - character you write it as '%' + <2 character US-ASCII hex value>. The Python - code of ``'%' + hex(ord())[2:]`` escapes a character properly. - Case does not matter on the hex letters. - - The various character sets specified are: - - Reserved characters : ";/?:@&=+$," - Have special meaning in URIs and must be escaped if not being used for - their special meaning - Data characters : letters, digits, and "-_.!~*'()" - Unreserved and do not need to be escaped; can be, though, if desired - Control characters : 0x00 - 0x1F, 0x7F - Have no use in URIs so must be escaped - space : 0x20 - Must be escaped - Delimiters : '<>#%"' - Must be escaped - Unwise : "{}|\^[]`" - Must be escaped - - """ - - def test_never_quote(self): - # Make sure quote() does not quote letters, digits, and "_,.-" - do_not_quote = '' .join(["ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - "0123456789", - "_.-"]) - result = urllib.quote(do_not_quote) - self.assertEqual(do_not_quote, result, - "using quote(): %s != %s" % (do_not_quote, result)) - result = urllib.quote_plus(do_not_quote) - self.assertEqual(do_not_quote, result, - "using quote_plus(): %s != %s" % (do_not_quote, result)) - - def test_default_safe(self): - # Test '/' is default value for 'safe' parameter - self.assertEqual(urllib.quote.func_defaults[0], '/') - - def test_safe(self): - # Test setting 'safe' parameter does what it should do - quote_by_default = "<>" - result = urllib.quote(quote_by_default, safe=quote_by_default) - self.assertEqual(quote_by_default, result, - "using quote(): %s != %s" % (quote_by_default, result)) - result = urllib.quote_plus(quote_by_default, safe=quote_by_default) - self.assertEqual(quote_by_default, result, - "using quote_plus(): %s != %s" % - (quote_by_default, result)) - - def test_default_quoting(self): - # Make sure all characters that should be quoted are by default sans - # space (separate test for that). - should_quote = [chr(num) for num in range(32)] # For 0x00 - 0x1F - should_quote.append('<>#%"{}|\^[]`') - should_quote.append(chr(127)) # For 0x7F - should_quote = ''.join(should_quote) - for char in should_quote: - result = urllib.quote(char) - self.assertEqual(hexescape(char), result, - "using quote(): %s should be escaped to %s, not %s" % - (char, hexescape(char), result)) - result = urllib.quote_plus(char) - self.assertEqual(hexescape(char), result, - "using quote_plus(): " - "%s should be escapes to %s, not %s" % - (char, hexescape(char), result)) - del should_quote - partial_quote = "ab[]cd" - expected = "ab%5B%5Dcd" - result = urllib.quote(partial_quote) - self.assertEqual(expected, result, - "using quote(): %s != %s" % (expected, result)) - self.assertEqual(expected, result, - "using quote_plus(): %s != %s" % (expected, result)) - - def test_quoting_space(self): - # Make sure quote() and quote_plus() handle spaces as specified in - # their unique way - result = urllib.quote(' ') - self.assertEqual(result, hexescape(' '), - "using quote(): %s != %s" % (result, hexescape(' '))) - result = urllib.quote_plus(' ') - self.assertEqual(result, '+', - "using quote_plus(): %s != +" % result) - given = "a b cd e f" - expect = given.replace(' ', hexescape(' ')) - result = urllib.quote(given) - self.assertEqual(expect, result, - "using quote(): %s != %s" % (expect, result)) - expect = given.replace(' ', '+') - result = urllib.quote_plus(given) - self.assertEqual(expect, result, - "using quote_plus(): %s != %s" % (expect, result)) - - def test_quoting_plus(self): - self.assertEqual(urllib.quote_plus('alpha+beta gamma'), - 'alpha%2Bbeta+gamma') - self.assertEqual(urllib.quote_plus('alpha+beta gamma', '+'), - 'alpha+beta+gamma') - -class UnquotingTests(unittest.TestCase): - """Tests for unquote() and unquote_plus() - - See the doc string for quoting_Tests for details on quoting and such. - - """ - - def test_unquoting(self): - # Make sure unquoting of all ASCII values works - escape_list = [] - for num in range(128): - given = hexescape(chr(num)) - expect = chr(num) - result = urllib.unquote(given) - self.assertEqual(expect, result, - "using unquote(): %s != %s" % (expect, result)) - result = urllib.unquote_plus(given) - self.assertEqual(expect, result, - "using unquote_plus(): %s != %s" % - (expect, result)) - escape_list.append(given) - escape_string = ''.join(escape_list) - del escape_list - result = urllib.unquote(escape_string) - self.assertEqual(result.count('%'), 1, - "using quote(): not all characters escaped; %s" % - result) - result = urllib.unquote(escape_string) - self.assertEqual(result.count('%'), 1, - "using unquote(): not all characters escaped: " - "%s" % result) - - def test_unquoting_parts(self): - # Make sure unquoting works when have non-quoted characters - # interspersed - given = 'ab%sd' % hexescape('c') - expect = "abcd" - result = urllib.unquote(given) - self.assertEqual(expect, result, - "using quote(): %s != %s" % (expect, result)) - result = urllib.unquote_plus(given) - self.assertEqual(expect, result, - "using unquote_plus(): %s != %s" % (expect, result)) - - def test_unquoting_plus(self): - # Test difference between unquote() and unquote_plus() - given = "are+there+spaces..." - expect = given - result = urllib.unquote(given) - self.assertEqual(expect, result, - "using unquote(): %s != %s" % (expect, result)) - expect = given.replace('+', ' ') - result = urllib.unquote_plus(given) - self.assertEqual(expect, result, - "using unquote_plus(): %s != %s" % (expect, result)) - - def test_unquote_with_unicode(self): - r = urllib.unquote(u'br%C3%BCckner_sapporo_20050930.doc') - self.assertEqual(r, u'br\xc3\xbcckner_sapporo_20050930.doc') - -class urlencode_Tests(unittest.TestCase): - """Tests for urlencode()""" - - def help_inputtype(self, given, test_type): - """Helper method for testing different input types. - - 'given' must lead to only the pairs: - * 1st, 1 - * 2nd, 2 - * 3rd, 3 - - Test cannot assume anything about order. Docs make no guarantee and - have possible dictionary input. - - """ - expect_somewhere = ["1st=1", "2nd=2", "3rd=3"] - result = urllib.urlencode(given) - for expected in expect_somewhere: - self.assert_(expected in result, - "testing %s: %s not found in %s" % - (test_type, expected, result)) - self.assertEqual(result.count('&'), 2, - "testing %s: expected 2 '&'s; got %s" % - (test_type, result.count('&'))) - amp_location = result.index('&') - on_amp_left = result[amp_location - 1] - on_amp_right = result[amp_location + 1] - self.assert_(on_amp_left.isdigit() and on_amp_right.isdigit(), - "testing %s: '&' not located in proper place in %s" % - (test_type, result)) - self.assertEqual(len(result), (5 * 3) + 2, #5 chars per thing and amps - "testing %s: " - "unexpected number of characters: %s != %s" % - (test_type, len(result), (5 * 3) + 2)) - - def test_using_mapping(self): - # Test passing in a mapping object as an argument. - self.help_inputtype({"1st":'1', "2nd":'2', "3rd":'3'}, - "using dict as input type") - - def test_using_sequence(self): - # Test passing in a sequence of two-item sequences as an argument. - self.help_inputtype([('1st', '1'), ('2nd', '2'), ('3rd', '3')], - "using sequence of two-item tuples as input") - - def test_quoting(self): - # Make sure keys and values are quoted using quote_plus() - given = {"&":"="} - expect = "%s=%s" % (hexescape('&'), hexescape('=')) - result = urllib.urlencode(given) - self.assertEqual(expect, result) - given = {"key name":"A bunch of pluses"} - expect = "key+name=A+bunch+of+pluses" - result = urllib.urlencode(given) - self.assertEqual(expect, result) - - def test_doseq(self): - # Test that passing True for 'doseq' parameter works correctly - given = {'sequence':['1', '2', '3']} - expect = "sequence=%s" % urllib.quote_plus(str(['1', '2', '3'])) - result = urllib.urlencode(given) - self.assertEqual(expect, result) - result = urllib.urlencode(given, True) - for value in given["sequence"]: - expect = "sequence=%s" % value - self.assert_(expect in result, - "%s not found in %s" % (expect, result)) - self.assertEqual(result.count('&'), 2, - "Expected 2 '&'s, got %s" % result.count('&')) - -class Pathname_Tests(unittest.TestCase): - """Test pathname2url() and url2pathname()""" - - def test_basic(self): - # Make sure simple tests pass - expected_path = os.path.join("parts", "of", "a", "path") - expected_url = "parts/of/a/path" - result = urllib.pathname2url(expected_path) - self.assertEqual(expected_url, result, - "pathname2url() failed; %s != %s" % - (result, expected_url)) - result = urllib.url2pathname(expected_url) - self.assertEqual(expected_path, result, - "url2pathame() failed; %s != %s" % - (result, expected_path)) - - def test_quoting(self): - # Test automatic quoting and unquoting works for pathnam2url() and - # url2pathname() respectively - given = os.path.join("needs", "quot=ing", "here") - expect = "needs/%s/here" % urllib.quote("quot=ing") - result = urllib.pathname2url(given) - self.assertEqual(expect, result, - "pathname2url() failed; %s != %s" % - (expect, result)) - expect = given - result = urllib.url2pathname(result) - self.assertEqual(expect, result, - "url2pathname() failed; %s != %s" % - (expect, result)) - given = os.path.join("make sure", "using_quote") - expect = "%s/using_quote" % urllib.quote("make sure") - result = urllib.pathname2url(given) - self.assertEqual(expect, result, - "pathname2url() failed; %s != %s" % - (expect, result)) - given = "make+sure/using_unquote" - expect = os.path.join("make+sure", "using_unquote") - result = urllib.url2pathname(given) - self.assertEqual(expect, result, - "url2pathname() failed; %s != %s" % - (expect, result)) - - - -def test_main(): - test_support.run_unittest( - urlopen_FileTests, - urlopen_HttpTests, - urlretrieve_FileTests, - QuotingTests, - UnquotingTests, - urlencode_Tests, - Pathname_Tests - ) - - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_urllib2.py b/sys/lib/python/test/test_urllib2.py deleted file mode 100644 index 5ca760ef4..000000000 --- a/sys/lib/python/test/test_urllib2.py +++ /dev/null @@ -1,1054 +0,0 @@ -import unittest -from test import test_support - -import os, socket -import StringIO - -import urllib2 -from urllib2 import Request, OpenerDirector - -# XXX -# Request -# CacheFTPHandler (hard to write) -# parse_keqv_list, parse_http_list, HTTPDigestAuthHandler - -class TrivialTests(unittest.TestCase): - def test_trivial(self): - # A couple trivial tests - - self.assertRaises(ValueError, urllib2.urlopen, 'bogus url') - - # XXX Name hacking to get this to work on Windows. - fname = os.path.abspath(urllib2.__file__).replace('\\', '/') - if fname[1:2] == ":": - fname = fname[2:] - # And more hacking to get it to work on MacOS. This assumes - # urllib.pathname2url works, unfortunately... - if os.name == 'mac': - fname = '/' + fname.replace(':', '/') - elif os.name == 'riscos': - import string - fname = os.expand(fname) - fname = fname.translate(string.maketrans("/.", "./")) - - file_url = "file://%s" % fname - f = urllib2.urlopen(file_url) - - buf = f.read() - f.close() - - def test_parse_http_list(self): - tests = [('a,b,c', ['a', 'b', 'c']), - ('path"o,l"og"i"cal, example', ['path"o,l"og"i"cal', 'example']), - ('a, b, "c", "d", "e,f", g, h', ['a', 'b', '"c"', '"d"', '"e,f"', 'g', 'h']), - ('a="b\\"c", d="e\\,f", g="h\\\\i"', ['a="b"c"', 'd="e,f"', 'g="h\\i"'])] - for string, list in tests: - self.assertEquals(urllib2.parse_http_list(string), list) - - -def test_request_headers_dict(): - """ - The Request.headers dictionary is not a documented interface. It should - stay that way, because the complete set of headers are only accessible - through the .get_header(), .has_header(), .header_items() interface. - However, .headers pre-dates those methods, and so real code will be using - the dictionary. - - The introduction in 2.4 of those methods was a mistake for the same reason: - code that previously saw all (urllib2 user)-provided headers in .headers - now sees only a subset (and the function interface is ugly and incomplete). - A better change would have been to replace .headers dict with a dict - subclass (or UserDict.DictMixin instance?) that preserved the .headers - interface and also provided access to the "unredirected" headers. It's - probably too late to fix that, though. - - - Check .capitalize() case normalization: - - >>> url = "http://example.com" - >>> Request(url, headers={"Spam-eggs": "blah"}).headers["Spam-eggs"] - 'blah' - >>> Request(url, headers={"spam-EggS": "blah"}).headers["Spam-eggs"] - 'blah' - - Currently, Request(url, "Spam-eggs").headers["Spam-Eggs"] raises KeyError, - but that could be changed in future. - - """ - -def test_request_headers_methods(): - """ - Note the case normalization of header names here, to .capitalize()-case. - This should be preserved for backwards-compatibility. (In the HTTP case, - normalization to .title()-case is done by urllib2 before sending headers to - httplib). - - >>> url = "http://example.com" - >>> r = Request(url, headers={"Spam-eggs": "blah"}) - >>> r.has_header("Spam-eggs") - True - >>> r.header_items() - [('Spam-eggs', 'blah')] - >>> r.add_header("Foo-Bar", "baz") - >>> items = r.header_items() - >>> items.sort() - >>> items - [('Foo-bar', 'baz'), ('Spam-eggs', 'blah')] - - Note that e.g. r.has_header("spam-EggS") is currently False, and - r.get_header("spam-EggS") returns None, but that could be changed in - future. - - >>> r.has_header("Not-there") - False - >>> print r.get_header("Not-there") - None - >>> r.get_header("Not-there", "default") - 'default' - - """ - - -def test_password_manager(self): - """ - >>> mgr = urllib2.HTTPPasswordMgr() - >>> add = mgr.add_password - >>> add("Some Realm", "http://example.com/", "joe", "password") - >>> add("Some Realm", "http://example.com/ni", "ni", "ni") - >>> add("c", "http://example.com/foo", "foo", "ni") - >>> add("c", "http://example.com/bar", "bar", "nini") - >>> add("b", "http://example.com/", "first", "blah") - >>> add("b", "http://example.com/", "second", "spam") - >>> add("a", "http://example.com", "1", "a") - >>> add("Some Realm", "http://c.example.com:3128", "3", "c") - >>> add("Some Realm", "d.example.com", "4", "d") - >>> add("Some Realm", "e.example.com:3128", "5", "e") - - >>> mgr.find_user_password("Some Realm", "example.com") - ('joe', 'password') - >>> mgr.find_user_password("Some Realm", "http://example.com") - ('joe', 'password') - >>> mgr.find_user_password("Some Realm", "http://example.com/") - ('joe', 'password') - >>> mgr.find_user_password("Some Realm", "http://example.com/spam") - ('joe', 'password') - >>> mgr.find_user_password("Some Realm", "http://example.com/spam/spam") - ('joe', 'password') - >>> mgr.find_user_password("c", "http://example.com/foo") - ('foo', 'ni') - >>> mgr.find_user_password("c", "http://example.com/bar") - ('bar', 'nini') - - Actually, this is really undefined ATM -## Currently, we use the highest-level path where more than one match: - -## >>> mgr.find_user_password("Some Realm", "http://example.com/ni") -## ('joe', 'password') - - Use latest add_password() in case of conflict: - - >>> mgr.find_user_password("b", "http://example.com/") - ('second', 'spam') - - No special relationship between a.example.com and example.com: - - >>> mgr.find_user_password("a", "http://example.com/") - ('1', 'a') - >>> mgr.find_user_password("a", "http://a.example.com/") - (None, None) - - Ports: - - >>> mgr.find_user_password("Some Realm", "c.example.com") - (None, None) - >>> mgr.find_user_password("Some Realm", "c.example.com:3128") - ('3', 'c') - >>> mgr.find_user_password("Some Realm", "http://c.example.com:3128") - ('3', 'c') - >>> mgr.find_user_password("Some Realm", "d.example.com") - ('4', 'd') - >>> mgr.find_user_password("Some Realm", "e.example.com:3128") - ('5', 'e') - - """ - pass - - -def test_password_manager_default_port(self): - """ - >>> mgr = urllib2.HTTPPasswordMgr() - >>> add = mgr.add_password - - The point to note here is that we can't guess the default port if there's - no scheme. This applies to both add_password and find_user_password. - - >>> add("f", "http://g.example.com:80", "10", "j") - >>> add("g", "http://h.example.com", "11", "k") - >>> add("h", "i.example.com:80", "12", "l") - >>> add("i", "j.example.com", "13", "m") - >>> mgr.find_user_password("f", "g.example.com:100") - (None, None) - >>> mgr.find_user_password("f", "g.example.com:80") - ('10', 'j') - >>> mgr.find_user_password("f", "g.example.com") - (None, None) - >>> mgr.find_user_password("f", "http://g.example.com:100") - (None, None) - >>> mgr.find_user_password("f", "http://g.example.com:80") - ('10', 'j') - >>> mgr.find_user_password("f", "http://g.example.com") - ('10', 'j') - >>> mgr.find_user_password("g", "h.example.com") - ('11', 'k') - >>> mgr.find_user_password("g", "h.example.com:80") - ('11', 'k') - >>> mgr.find_user_password("g", "http://h.example.com:80") - ('11', 'k') - >>> mgr.find_user_password("h", "i.example.com") - (None, None) - >>> mgr.find_user_password("h", "i.example.com:80") - ('12', 'l') - >>> mgr.find_user_password("h", "http://i.example.com:80") - ('12', 'l') - >>> mgr.find_user_password("i", "j.example.com") - ('13', 'm') - >>> mgr.find_user_password("i", "j.example.com:80") - (None, None) - >>> mgr.find_user_password("i", "http://j.example.com") - ('13', 'm') - >>> mgr.find_user_password("i", "http://j.example.com:80") - (None, None) - - """ - -class MockOpener: - addheaders = [] - def open(self, req, data=None): - self.req, self.data = req, data - def error(self, proto, *args): - self.proto, self.args = proto, args - -class MockFile: - def read(self, count=None): pass - def readline(self, count=None): pass - def close(self): pass - -class MockHeaders(dict): - def getheaders(self, name): - return self.values() - -class MockResponse(StringIO.StringIO): - def __init__(self, code, msg, headers, data, url=None): - StringIO.StringIO.__init__(self, data) - self.code, self.msg, self.headers, self.url = code, msg, headers, url - def info(self): - return self.headers - def geturl(self): - return self.url - -class MockCookieJar: - def add_cookie_header(self, request): - self.ach_req = request - def extract_cookies(self, response, request): - self.ec_req, self.ec_r = request, response - -class FakeMethod: - def __init__(self, meth_name, action, handle): - self.meth_name = meth_name - self.handle = handle - self.action = action - def __call__(self, *args): - return self.handle(self.meth_name, self.action, *args) - -class MockHandler: - # useful for testing handler machinery - # see add_ordered_mock_handlers() docstring - handler_order = 500 - def __init__(self, methods): - self._define_methods(methods) - def _define_methods(self, methods): - for spec in methods: - if len(spec) == 2: name, action = spec - else: name, action = spec, None - meth = FakeMethod(name, action, self.handle) - setattr(self.__class__, name, meth) - def handle(self, fn_name, action, *args, **kwds): - self.parent.calls.append((self, fn_name, args, kwds)) - if action is None: - return None - elif action == "return self": - return self - elif action == "return response": - res = MockResponse(200, "OK", {}, "") - return res - elif action == "return request": - return Request("http://blah/") - elif action.startswith("error"): - code = action[action.rfind(" ")+1:] - try: - code = int(code) - except ValueError: - pass - res = MockResponse(200, "OK", {}, "") - return self.parent.error("http", args[0], res, code, "", {}) - elif action == "raise": - raise urllib2.URLError("blah") - assert False - def close(self): pass - def add_parent(self, parent): - self.parent = parent - self.parent.calls = [] - def __lt__(self, other): - if not hasattr(other, "handler_order"): - # No handler_order, leave in original order. Yuck. - return True - return self.handler_order < other.handler_order - -def add_ordered_mock_handlers(opener, meth_spec): - """Create MockHandlers and add them to an OpenerDirector. - - meth_spec: list of lists of tuples and strings defining methods to define - on handlers. eg: - - [["http_error", "ftp_open"], ["http_open"]] - - defines methods .http_error() and .ftp_open() on one handler, and - .http_open() on another. These methods just record their arguments and - return None. Using a tuple instead of a string causes the method to - perform some action (see MockHandler.handle()), eg: - - [["http_error"], [("http_open", "return request")]] - - defines .http_error() on one handler (which simply returns None), and - .http_open() on another handler, which returns a Request object. - - """ - handlers = [] - count = 0 - for meths in meth_spec: - class MockHandlerSubclass(MockHandler): pass - h = MockHandlerSubclass(meths) - h.handler_order += count - h.add_parent(opener) - count = count + 1 - handlers.append(h) - opener.add_handler(h) - return handlers - -def build_test_opener(*handler_instances): - opener = OpenerDirector() - for h in handler_instances: - opener.add_handler(h) - return opener - -class MockHTTPHandler(urllib2.BaseHandler): - # useful for testing redirections and auth - # sends supplied headers and code as first response - # sends 200 OK as second response - def __init__(self, code, headers): - self.code = code - self.headers = headers - self.reset() - def reset(self): - self._count = 0 - self.requests = [] - def http_open(self, req): - import mimetools, httplib, copy - from StringIO import StringIO - self.requests.append(copy.deepcopy(req)) - if self._count == 0: - self._count = self._count + 1 - name = httplib.responses[self.code] - msg = mimetools.Message(StringIO(self.headers)) - return self.parent.error( - "http", req, MockFile(), self.code, name, msg) - else: - self.req = req - msg = mimetools.Message(StringIO("\r\n\r\n")) - return MockResponse(200, "OK", msg, "", req.get_full_url()) - -class MockPasswordManager: - def add_password(self, realm, uri, user, password): - self.realm = realm - self.url = uri - self.user = user - self.password = password - def find_user_password(self, realm, authuri): - self.target_realm = realm - self.target_url = authuri - return self.user, self.password - - -class OpenerDirectorTests(unittest.TestCase): - - def test_badly_named_methods(self): - # test work-around for three methods that accidentally follow the - # naming conventions for handler methods - # (*_open() / *_request() / *_response()) - - # These used to call the accidentally-named methods, causing a - # TypeError in real code; here, returning self from these mock - # methods would either cause no exception, or AttributeError. - - from urllib2 import URLError - - o = OpenerDirector() - meth_spec = [ - [("do_open", "return self"), ("proxy_open", "return self")], - [("redirect_request", "return self")], - ] - handlers = add_ordered_mock_handlers(o, meth_spec) - o.add_handler(urllib2.UnknownHandler()) - for scheme in "do", "proxy", "redirect": - self.assertRaises(URLError, o.open, scheme+"://example.com/") - - def test_handled(self): - # handler returning non-None means no more handlers will be called - o = OpenerDirector() - meth_spec = [ - ["http_open", "ftp_open", "http_error_302"], - ["ftp_open"], - [("http_open", "return self")], - [("http_open", "return self")], - ] - handlers = add_ordered_mock_handlers(o, meth_spec) - - req = Request("http://example.com/") - r = o.open(req) - # Second .http_open() gets called, third doesn't, since second returned - # non-None. Handlers without .http_open() never get any methods called - # on them. - # In fact, second mock handler defining .http_open() returns self - # (instead of response), which becomes the OpenerDirector's return - # value. - self.assertEqual(r, handlers[2]) - calls = [(handlers[0], "http_open"), (handlers[2], "http_open")] - for expected, got in zip(calls, o.calls): - handler, name, args, kwds = got - self.assertEqual((handler, name), expected) - self.assertEqual(args, (req,)) - - def test_handler_order(self): - o = OpenerDirector() - handlers = [] - for meths, handler_order in [ - ([("http_open", "return self")], 500), - (["http_open"], 0), - ]: - class MockHandlerSubclass(MockHandler): pass - h = MockHandlerSubclass(meths) - h.handler_order = handler_order - handlers.append(h) - o.add_handler(h) - - r = o.open("http://example.com/") - # handlers called in reverse order, thanks to their sort order - self.assertEqual(o.calls[0][0], handlers[1]) - self.assertEqual(o.calls[1][0], handlers[0]) - - def test_raise(self): - # raising URLError stops processing of request - o = OpenerDirector() - meth_spec = [ - [("http_open", "raise")], - [("http_open", "return self")], - ] - handlers = add_ordered_mock_handlers(o, meth_spec) - - req = Request("http://example.com/") - self.assertRaises(urllib2.URLError, o.open, req) - self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})]) - -## def test_error(self): -## # XXX this doesn't actually seem to be used in standard library, -## # but should really be tested anyway... - - def test_http_error(self): - # XXX http_error_default - # http errors are a special case - o = OpenerDirector() - meth_spec = [ - [("http_open", "error 302")], - [("http_error_400", "raise"), "http_open"], - [("http_error_302", "return response"), "http_error_303", - "http_error"], - [("http_error_302")], - ] - handlers = add_ordered_mock_handlers(o, meth_spec) - - class Unknown: - def __eq__(self, other): return True - - req = Request("http://example.com/") - r = o.open(req) - assert len(o.calls) == 2 - calls = [(handlers[0], "http_open", (req,)), - (handlers[2], "http_error_302", - (req, Unknown(), 302, "", {}))] - for expected, got in zip(calls, o.calls): - handler, method_name, args = expected - self.assertEqual((handler, method_name), got[:2]) - self.assertEqual(args, got[2]) - - def test_processors(self): - # *_request / *_response methods get called appropriately - o = OpenerDirector() - meth_spec = [ - [("http_request", "return request"), - ("http_response", "return response")], - [("http_request", "return request"), - ("http_response", "return response")], - ] - handlers = add_ordered_mock_handlers(o, meth_spec) - - req = Request("http://example.com/") - r = o.open(req) - # processor methods are called on *all* handlers that define them, - # not just the first handler that handles the request - calls = [ - (handlers[0], "http_request"), (handlers[1], "http_request"), - (handlers[0], "http_response"), (handlers[1], "http_response")] - - for i, (handler, name, args, kwds) in enumerate(o.calls): - if i < 2: - # *_request - self.assertEqual((handler, name), calls[i]) - self.assertEqual(len(args), 1) - self.assert_(isinstance(args[0], Request)) - else: - # *_response - self.assertEqual((handler, name), calls[i]) - self.assertEqual(len(args), 2) - self.assert_(isinstance(args[0], Request)) - # response from opener.open is None, because there's no - # handler that defines http_open to handle it - self.assert_(args[1] is None or - isinstance(args[1], MockResponse)) - - -def sanepathname2url(path): - import urllib - urlpath = urllib.pathname2url(path) - if os.name == "nt" and urlpath.startswith("///"): - urlpath = urlpath[2:] - # XXX don't ask me about the mac... - return urlpath - -class HandlerTests(unittest.TestCase): - - def test_ftp(self): - class MockFTPWrapper: - def __init__(self, data): self.data = data - def retrfile(self, filename, filetype): - self.filename, self.filetype = filename, filetype - return StringIO.StringIO(self.data), len(self.data) - - class NullFTPHandler(urllib2.FTPHandler): - def __init__(self, data): self.data = data - def connect_ftp(self, user, passwd, host, port, dirs): - self.user, self.passwd = user, passwd - self.host, self.port = host, port - self.dirs = dirs - self.ftpwrapper = MockFTPWrapper(self.data) - return self.ftpwrapper - - import ftplib, socket - data = "rheum rhaponicum" - h = NullFTPHandler(data) - o = h.parent = MockOpener() - - for url, host, port, type_, dirs, filename, mimetype in [ - ("ftp://localhost/foo/bar/baz.html", - "localhost", ftplib.FTP_PORT, "I", - ["foo", "bar"], "baz.html", "text/html"), - ("ftp://localhost:80/foo/bar/", - "localhost", 80, "D", - ["foo", "bar"], "", None), - ("ftp://localhost/baz.gif;type=a", - "localhost", ftplib.FTP_PORT, "A", - [], "baz.gif", None), # XXX really this should guess image/gif - ]: - r = h.ftp_open(Request(url)) - # ftp authentication not yet implemented by FTPHandler - self.assert_(h.user == h.passwd == "") - self.assertEqual(h.host, socket.gethostbyname(host)) - self.assertEqual(h.port, port) - self.assertEqual(h.dirs, dirs) - self.assertEqual(h.ftpwrapper.filename, filename) - self.assertEqual(h.ftpwrapper.filetype, type_) - headers = r.info() - self.assertEqual(headers.get("Content-type"), mimetype) - self.assertEqual(int(headers["Content-length"]), len(data)) - - def test_file(self): - import time, rfc822, socket - h = urllib2.FileHandler() - o = h.parent = MockOpener() - - TESTFN = test_support.TESTFN - urlpath = sanepathname2url(os.path.abspath(TESTFN)) - towrite = "hello, world\n" - urls = [ - "file://localhost%s" % urlpath, - "file://%s" % urlpath, - "file://%s%s" % (socket.gethostbyname('localhost'), urlpath), - ] - try: - localaddr = socket.gethostbyname(socket.gethostname()) - except socket.gaierror: - localaddr = '' - if localaddr: - urls.append("file://%s%s" % (localaddr, urlpath)) - - for url in urls: - f = open(TESTFN, "wb") - try: - try: - f.write(towrite) - finally: - f.close() - - r = h.file_open(Request(url)) - try: - data = r.read() - headers = r.info() - newurl = r.geturl() - finally: - r.close() - stats = os.stat(TESTFN) - modified = rfc822.formatdate(stats.st_mtime) - finally: - os.remove(TESTFN) - self.assertEqual(data, towrite) - self.assertEqual(headers["Content-type"], "text/plain") - self.assertEqual(headers["Content-length"], "13") - self.assertEqual(headers["Last-modified"], modified) - - for url in [ - "file://localhost:80%s" % urlpath, -# XXXX bug: these fail with socket.gaierror, should be URLError -## "file://%s:80%s/%s" % (socket.gethostbyname('localhost'), -## os.getcwd(), TESTFN), -## "file://somerandomhost.ontheinternet.com%s/%s" % -## (os.getcwd(), TESTFN), - ]: - try: - f = open(TESTFN, "wb") - try: - f.write(towrite) - finally: - f.close() - - self.assertRaises(urllib2.URLError, - h.file_open, Request(url)) - finally: - os.remove(TESTFN) - - h = urllib2.FileHandler() - o = h.parent = MockOpener() - # XXXX why does // mean ftp (and /// mean not ftp!), and where - # is file: scheme specified? I think this is really a bug, and - # what was intended was to distinguish between URLs like: - # file:/blah.txt (a file) - # file://localhost/blah.txt (a file) - # file:///blah.txt (a file) - # file://ftp.example.com/blah.txt (an ftp URL) - for url, ftp in [ - ("file://ftp.example.com//foo.txt", True), - ("file://ftp.example.com///foo.txt", False), -# XXXX bug: fails with OSError, should be URLError - ("file://ftp.example.com/foo.txt", False), - ]: - req = Request(url) - try: - h.file_open(req) - # XXXX remove OSError when bug fixed - except (urllib2.URLError, OSError): - self.assert_(not ftp) - else: - self.assert_(o.req is req) - self.assertEqual(req.type, "ftp") - - def test_http(self): - class MockHTTPResponse: - def __init__(self, fp, msg, status, reason): - self.fp = fp - self.msg = msg - self.status = status - self.reason = reason - def read(self): - return '' - class MockHTTPClass: - def __init__(self): - self.req_headers = [] - self.data = None - self.raise_on_endheaders = False - def __call__(self, host): - self.host = host - return self - def set_debuglevel(self, level): - self.level = level - def request(self, method, url, body=None, headers={}): - self.method = method - self.selector = url - self.req_headers += headers.items() - self.req_headers.sort() - if body: - self.data = body - if self.raise_on_endheaders: - import socket - raise socket.error() - def getresponse(self): - return MockHTTPResponse(MockFile(), {}, 200, "OK") - - h = urllib2.AbstractHTTPHandler() - o = h.parent = MockOpener() - - url = "http://example.com/" - for method, data in [("GET", None), ("POST", "blah")]: - req = Request(url, data, {"Foo": "bar"}) - req.add_unredirected_header("Spam", "eggs") - http = MockHTTPClass() - r = h.do_open(http, req) - - # result attributes - r.read; r.readline # wrapped MockFile methods - r.info; r.geturl # addinfourl methods - r.code, r.msg == 200, "OK" # added from MockHTTPClass.getreply() - hdrs = r.info() - hdrs.get; hdrs.has_key # r.info() gives dict from .getreply() - self.assertEqual(r.geturl(), url) - - self.assertEqual(http.host, "example.com") - self.assertEqual(http.level, 0) - self.assertEqual(http.method, method) - self.assertEqual(http.selector, "/") - self.assertEqual(http.req_headers, - [("Connection", "close"), - ("Foo", "bar"), ("Spam", "eggs")]) - self.assertEqual(http.data, data) - - # check socket.error converted to URLError - http.raise_on_endheaders = True - self.assertRaises(urllib2.URLError, h.do_open, http, req) - - # check adding of standard headers - o.addheaders = [("Spam", "eggs")] - for data in "", None: # POST, GET - req = Request("http://example.com/", data) - r = MockResponse(200, "OK", {}, "") - newreq = h.do_request_(req) - if data is None: # GET - self.assert_("Content-length" not in req.unredirected_hdrs) - self.assert_("Content-type" not in req.unredirected_hdrs) - else: # POST - self.assertEqual(req.unredirected_hdrs["Content-length"], "0") - self.assertEqual(req.unredirected_hdrs["Content-type"], - "application/x-www-form-urlencoded") - # XXX the details of Host could be better tested - self.assertEqual(req.unredirected_hdrs["Host"], "example.com") - self.assertEqual(req.unredirected_hdrs["Spam"], "eggs") - - # don't clobber existing headers - req.add_unredirected_header("Content-length", "foo") - req.add_unredirected_header("Content-type", "bar") - req.add_unredirected_header("Host", "baz") - req.add_unredirected_header("Spam", "foo") - newreq = h.do_request_(req) - self.assertEqual(req.unredirected_hdrs["Content-length"], "foo") - self.assertEqual(req.unredirected_hdrs["Content-type"], "bar") - self.assertEqual(req.unredirected_hdrs["Host"], "baz") - self.assertEqual(req.unredirected_hdrs["Spam"], "foo") - - def test_errors(self): - h = urllib2.HTTPErrorProcessor() - o = h.parent = MockOpener() - - url = "http://example.com/" - req = Request(url) - # 200 OK is passed through - r = MockResponse(200, "OK", {}, "", url) - newr = h.http_response(req, r) - self.assert_(r is newr) - self.assert_(not hasattr(o, "proto")) # o.error not called - # anything else calls o.error (and MockOpener returns None, here) - r = MockResponse(201, "Created", {}, "", url) - self.assert_(h.http_response(req, r) is None) - self.assertEqual(o.proto, "http") # o.error called - self.assertEqual(o.args, (req, r, 201, "Created", {})) - - def test_cookies(self): - cj = MockCookieJar() - h = urllib2.HTTPCookieProcessor(cj) - o = h.parent = MockOpener() - - req = Request("http://example.com/") - r = MockResponse(200, "OK", {}, "") - newreq = h.http_request(req) - self.assert_(cj.ach_req is req is newreq) - self.assertEquals(req.get_origin_req_host(), "example.com") - self.assert_(not req.is_unverifiable()) - newr = h.http_response(req, r) - self.assert_(cj.ec_req is req) - self.assert_(cj.ec_r is r is newr) - - def test_redirect(self): - from_url = "http://example.com/a.html" - to_url = "http://example.com/b.html" - h = urllib2.HTTPRedirectHandler() - o = h.parent = MockOpener() - - # ordinary redirect behaviour - for code in 301, 302, 303, 307: - for data in None, "blah\nblah\n": - method = getattr(h, "http_error_%s" % code) - req = Request(from_url, data) - req.add_header("Nonsense", "viking=withhold") - req.add_unredirected_header("Spam", "spam") - try: - method(req, MockFile(), code, "Blah", - MockHeaders({"location": to_url})) - except urllib2.HTTPError: - # 307 in response to POST requires user OK - self.assert_(code == 307 and data is not None) - self.assertEqual(o.req.get_full_url(), to_url) - try: - self.assertEqual(o.req.get_method(), "GET") - except AttributeError: - self.assert_(not o.req.has_data()) - self.assertEqual(o.req.headers["Nonsense"], - "viking=withhold") - self.assert_("Spam" not in o.req.headers) - self.assert_("Spam" not in o.req.unredirected_hdrs) - - # loop detection - req = Request(from_url) - def redirect(h, req, url=to_url): - h.http_error_302(req, MockFile(), 302, "Blah", - MockHeaders({"location": url})) - # Note that the *original* request shares the same record of - # redirections with the sub-requests caused by the redirections. - - # detect infinite loop redirect of a URL to itself - req = Request(from_url, origin_req_host="example.com") - count = 0 - try: - while 1: - redirect(h, req, "http://example.com/") - count = count + 1 - except urllib2.HTTPError: - # don't stop until max_repeats, because cookies may introduce state - self.assertEqual(count, urllib2.HTTPRedirectHandler.max_repeats) - - # detect endless non-repeating chain of redirects - req = Request(from_url, origin_req_host="example.com") - count = 0 - try: - while 1: - redirect(h, req, "http://example.com/%d" % count) - count = count + 1 - except urllib2.HTTPError: - self.assertEqual(count, - urllib2.HTTPRedirectHandler.max_redirections) - - def test_cookie_redirect(self): - # cookies shouldn't leak into redirected requests - from cookielib import CookieJar - - from test.test_cookielib import interact_netscape - - cj = CookieJar() - interact_netscape(cj, "http://www.example.com/", "spam=eggs") - hh = MockHTTPHandler(302, "Location: http://www.cracker.com/\r\n\r\n") - hdeh = urllib2.HTTPDefaultErrorHandler() - hrh = urllib2.HTTPRedirectHandler() - cp = urllib2.HTTPCookieProcessor(cj) - o = build_test_opener(hh, hdeh, hrh, cp) - o.open("http://www.example.com/") - self.assert_(not hh.req.has_header("Cookie")) - - def test_proxy(self): - o = OpenerDirector() - ph = urllib2.ProxyHandler(dict(http="proxy.example.com:3128")) - o.add_handler(ph) - meth_spec = [ - [("http_open", "return response")] - ] - handlers = add_ordered_mock_handlers(o, meth_spec) - - req = Request("http://acme.example.com/") - self.assertEqual(req.get_host(), "acme.example.com") - r = o.open(req) - self.assertEqual(req.get_host(), "proxy.example.com:3128") - - self.assertEqual([(handlers[0], "http_open")], - [tup[0:2] for tup in o.calls]) - - def test_basic_auth(self): - opener = OpenerDirector() - password_manager = MockPasswordManager() - auth_handler = urllib2.HTTPBasicAuthHandler(password_manager) - realm = "ACME Widget Store" - http_handler = MockHTTPHandler( - 401, 'WWW-Authenticate: Basic realm="%s"\r\n\r\n' % realm) - opener.add_handler(auth_handler) - opener.add_handler(http_handler) - self._test_basic_auth(opener, auth_handler, "Authorization", - realm, http_handler, password_manager, - "http://acme.example.com/protected", - "http://acme.example.com/protected", - ) - - def test_proxy_basic_auth(self): - opener = OpenerDirector() - ph = urllib2.ProxyHandler(dict(http="proxy.example.com:3128")) - opener.add_handler(ph) - password_manager = MockPasswordManager() - auth_handler = urllib2.ProxyBasicAuthHandler(password_manager) - realm = "ACME Networks" - http_handler = MockHTTPHandler( - 407, 'Proxy-Authenticate: Basic realm="%s"\r\n\r\n' % realm) - opener.add_handler(auth_handler) - opener.add_handler(http_handler) - self._test_basic_auth(opener, auth_handler, "Proxy-authorization", - realm, http_handler, password_manager, - "http://acme.example.com:3128/protected", - "proxy.example.com:3128", - ) - - def test_basic_and_digest_auth_handlers(self): - # HTTPDigestAuthHandler threw an exception if it couldn't handle a 40* - # response (http://python.org/sf/1479302), where it should instead - # return None to allow another handler (especially - # HTTPBasicAuthHandler) to handle the response. - - # Also (http://python.org/sf/14797027, RFC 2617 section 1.2), we must - # try digest first (since it's the strongest auth scheme), so we record - # order of calls here to check digest comes first: - class RecordingOpenerDirector(OpenerDirector): - def __init__(self): - OpenerDirector.__init__(self) - self.recorded = [] - def record(self, info): - self.recorded.append(info) - class TestDigestAuthHandler(urllib2.HTTPDigestAuthHandler): - def http_error_401(self, *args, **kwds): - self.parent.record("digest") - urllib2.HTTPDigestAuthHandler.http_error_401(self, - *args, **kwds) - class TestBasicAuthHandler(urllib2.HTTPBasicAuthHandler): - def http_error_401(self, *args, **kwds): - self.parent.record("basic") - urllib2.HTTPBasicAuthHandler.http_error_401(self, - *args, **kwds) - - opener = RecordingOpenerDirector() - password_manager = MockPasswordManager() - digest_handler = TestDigestAuthHandler(password_manager) - basic_handler = TestBasicAuthHandler(password_manager) - realm = "ACME Networks" - http_handler = MockHTTPHandler( - 401, 'WWW-Authenticate: Basic realm="%s"\r\n\r\n' % realm) - opener.add_handler(basic_handler) - opener.add_handler(digest_handler) - opener.add_handler(http_handler) - - # check basic auth isn't blocked by digest handler failing - self._test_basic_auth(opener, basic_handler, "Authorization", - realm, http_handler, password_manager, - "http://acme.example.com/protected", - "http://acme.example.com/protected", - ) - # check digest was tried before basic (twice, because - # _test_basic_auth called .open() twice) - self.assertEqual(opener.recorded, ["digest", "basic"]*2) - - def _test_basic_auth(self, opener, auth_handler, auth_header, - realm, http_handler, password_manager, - request_url, protected_url): - import base64, httplib - user, password = "wile", "coyote" - - # .add_password() fed through to password manager - auth_handler.add_password(realm, request_url, user, password) - self.assertEqual(realm, password_manager.realm) - self.assertEqual(request_url, password_manager.url) - self.assertEqual(user, password_manager.user) - self.assertEqual(password, password_manager.password) - - r = opener.open(request_url) - - # should have asked the password manager for the username/password - self.assertEqual(password_manager.target_realm, realm) - self.assertEqual(password_manager.target_url, protected_url) - - # expect one request without authorization, then one with - self.assertEqual(len(http_handler.requests), 2) - self.assertFalse(http_handler.requests[0].has_header(auth_header)) - userpass = '%s:%s' % (user, password) - auth_hdr_value = 'Basic '+base64.encodestring(userpass).strip() - self.assertEqual(http_handler.requests[1].get_header(auth_header), - auth_hdr_value) - - # if the password manager can't find a password, the handler won't - # handle the HTTP auth error - password_manager.user = password_manager.password = None - http_handler.reset() - r = opener.open(request_url) - self.assertEqual(len(http_handler.requests), 1) - self.assertFalse(http_handler.requests[0].has_header(auth_header)) - - -class MiscTests(unittest.TestCase): - - def test_build_opener(self): - class MyHTTPHandler(urllib2.HTTPHandler): pass - class FooHandler(urllib2.BaseHandler): - def foo_open(self): pass - class BarHandler(urllib2.BaseHandler): - def bar_open(self): pass - - build_opener = urllib2.build_opener - - o = build_opener(FooHandler, BarHandler) - self.opener_has_handler(o, FooHandler) - self.opener_has_handler(o, BarHandler) - - # can take a mix of classes and instances - o = build_opener(FooHandler, BarHandler()) - self.opener_has_handler(o, FooHandler) - self.opener_has_handler(o, BarHandler) - - # subclasses of default handlers override default handlers - o = build_opener(MyHTTPHandler) - self.opener_has_handler(o, MyHTTPHandler) - - # a particular case of overriding: default handlers can be passed - # in explicitly - o = build_opener() - self.opener_has_handler(o, urllib2.HTTPHandler) - o = build_opener(urllib2.HTTPHandler) - self.opener_has_handler(o, urllib2.HTTPHandler) - o = build_opener(urllib2.HTTPHandler()) - self.opener_has_handler(o, urllib2.HTTPHandler) - - def opener_has_handler(self, opener, handler_class): - for h in opener.handlers: - if h.__class__ == handler_class: - break - else: - self.assert_(False) - - -def test_main(verbose=None): - from test import test_urllib2 - test_support.run_doctest(test_urllib2, verbose) - test_support.run_doctest(urllib2, verbose) - tests = (TrivialTests, - OpenerDirectorTests, - HandlerTests, - MiscTests) - test_support.run_unittest(*tests) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_urllib2net.py b/sys/lib/python/test/test_urllib2net.py deleted file mode 100644 index b27162644..000000000 --- a/sys/lib/python/test/test_urllib2net.py +++ /dev/null @@ -1,295 +0,0 @@ -#!/usr/bin/env python - -import unittest -from test import test_support -from test.test_urllib2 import sanepathname2url - -import socket -import urllib2 -import sys -import os -import mimetools - -class URLTimeoutTest(unittest.TestCase): - - TIMEOUT = 10.0 - - def setUp(self): - socket.setdefaulttimeout(self.TIMEOUT) - - def tearDown(self): - socket.setdefaulttimeout(None) - - def testURLread(self): - f = urllib2.urlopen("http://www.python.org/") - x = f.read() - - -class AuthTests(unittest.TestCase): - """Tests urllib2 authentication features.""" - -## Disabled at the moment since there is no page under python.org which -## could be used to HTTP authentication. -# -# def test_basic_auth(self): -# import httplib -# -# test_url = "http://www.python.org/test/test_urllib2/basic_auth" -# test_hostport = "www.python.org" -# test_realm = 'Test Realm' -# test_user = 'test.test_urllib2net' -# test_password = 'blah' -# -# # failure -# try: -# urllib2.urlopen(test_url) -# except urllib2.HTTPError, exc: -# self.assertEqual(exc.code, 401) -# else: -# self.fail("urlopen() should have failed with 401") -# -# # success -# auth_handler = urllib2.HTTPBasicAuthHandler() -# auth_handler.add_password(test_realm, test_hostport, -# test_user, test_password) -# opener = urllib2.build_opener(auth_handler) -# f = opener.open('http://localhost/') -# response = urllib2.urlopen("http://www.python.org/") -# -# # The 'userinfo' URL component is deprecated by RFC 3986 for security -# # reasons, let's not implement it! (it's already implemented for proxy -# # specification strings (that is, URLs or authorities specifying a -# # proxy), so we must keep that) -# self.assertRaises(httplib.InvalidURL, -# urllib2.urlopen, "http://evil:thing@example.com") - - -class CloseSocketTest(unittest.TestCase): - - def test_close(self): - import socket, httplib, gc - - # calling .close() on urllib2's response objects should close the - # underlying socket - - # delve deep into response to fetch socket._socketobject - response = urllib2.urlopen("http://www.python.org/") - abused_fileobject = response.fp - self.assert_(abused_fileobject.__class__ is socket._fileobject) - httpresponse = abused_fileobject._sock - self.assert_(httpresponse.__class__ is httplib.HTTPResponse) - fileobject = httpresponse.fp - self.assert_(fileobject.__class__ is socket._fileobject) - - self.assert_(not fileobject.closed) - response.close() - self.assert_(fileobject.closed) - -class urlopenNetworkTests(unittest.TestCase): - """Tests urllib2.urlopen using the network. - - These tests are not exhaustive. Assuming that testing using files does a - good job overall of some of the basic interface features. There are no - tests exercising the optional 'data' and 'proxies' arguments. No tests - for transparent redirection have been written. - - setUp is not used for always constructing a connection to - http://www.python.org/ since there a few tests that don't use that address - and making a connection is expensive enough to warrant minimizing unneeded - connections. - - """ - - def test_basic(self): - # Simple test expected to pass. - open_url = urllib2.urlopen("http://www.python.org/") - for attr in ("read", "close", "info", "geturl"): - self.assert_(hasattr(open_url, attr), "object returned from " - "urlopen lacks the %s attribute" % attr) - try: - self.assert_(open_url.read(), "calling 'read' failed") - finally: - open_url.close() - - def test_info(self): - # Test 'info'. - open_url = urllib2.urlopen("http://www.python.org/") - try: - info_obj = open_url.info() - finally: - open_url.close() - self.assert_(isinstance(info_obj, mimetools.Message), - "object returned by 'info' is not an instance of " - "mimetools.Message") - self.assertEqual(info_obj.getsubtype(), "html") - - def test_geturl(self): - # Make sure same URL as opened is returned by geturl. - URL = "http://www.python.org/" - open_url = urllib2.urlopen(URL) - try: - gotten_url = open_url.geturl() - finally: - open_url.close() - self.assertEqual(gotten_url, URL) - - def test_bad_address(self): - # Make sure proper exception is raised when connecting to a bogus - # address. - self.assertRaises(IOError, - # SF patch 809915: In Sep 2003, VeriSign started - # highjacking invalid .com and .net addresses to - # boost traffic to their own site. This test - # started failing then. One hopes the .invalid - # domain will be spared to serve its defined - # purpose. - # urllib2.urlopen, "http://www.sadflkjsasadf.com/") - urllib2.urlopen, "http://www.python.invalid./") - - -class OtherNetworkTests(unittest.TestCase): - def setUp(self): - if 0: # for debugging - import logging - logger = logging.getLogger("test_urllib2net") - logger.addHandler(logging.StreamHandler()) - - def test_range (self): - req = urllib2.Request("http://www.python.org", - headers={'Range': 'bytes=20-39'}) - result = urllib2.urlopen(req) - data = result.read() - self.assertEqual(len(data), 20) - - # XXX The rest of these tests aren't very good -- they don't check much. - # They do sometimes catch some major disasters, though. - - def test_ftp(self): - urls = [ - 'ftp://www.python.org/pub/python/misc/sousa.au', - 'ftp://www.python.org/pub/tmp/blat', - 'ftp://gatekeeper.research.compaq.com/pub/DEC/SRC' - '/research-reports/00README-Legal-Rules-Regs', - ] - self._test_urls(urls, self._extra_handlers()) - - def test_gopher(self): - import warnings - warnings.filterwarnings("ignore", - "the gopherlib module is deprecated", - DeprecationWarning, - "urllib2$") - urls = [ - # Thanks to Fred for finding these! - 'gopher://gopher.lib.ncsu.edu./11/library/stacks/Alex', - 'gopher://gopher.vt.edu.:10010/10/33', - ] - self._test_urls(urls, self._extra_handlers()) - - def test_file(self): - TESTFN = test_support.TESTFN - f = open(TESTFN, 'w') - try: - f.write('hi there\n') - f.close() - urls = [ - 'file:'+sanepathname2url(os.path.abspath(TESTFN)), - - # XXX bug, should raise URLError - #('file://nonsensename/etc/passwd', None, urllib2.URLError) - ('file://nonsensename/etc/passwd', None, (EnvironmentError, socket.error)) - ] - self._test_urls(urls, self._extra_handlers()) - finally: - os.remove(TESTFN) - - def test_http(self): - urls = [ - 'http://www.espn.com/', # redirect - 'http://www.python.org/Spanish/Inquistion/', - ('http://www.python.org/cgi-bin/faqw.py', - 'query=pythonistas&querytype=simple&casefold=yes&req=search', None), - 'http://www.python.org/', - ] - self._test_urls(urls, self._extra_handlers()) - - # XXX Following test depends on machine configurations that are internal - # to CNRI. Need to set up a public server with the right authentication - # configuration for test purposes. - -## def test_cnri(self): -## if socket.gethostname() == 'bitdiddle': -## localhost = 'bitdiddle.cnri.reston.va.us' -## elif socket.gethostname() == 'bitdiddle.concentric.net': -## localhost = 'localhost' -## else: -## localhost = None -## if localhost is not None: -## urls = [ -## 'file://%s/etc/passwd' % localhost, -## 'http://%s/simple/' % localhost, -## 'http://%s/digest/' % localhost, -## 'http://%s/not/found.h' % localhost, -## ] - -## bauth = HTTPBasicAuthHandler() -## bauth.add_password('basic_test_realm', localhost, 'jhylton', -## 'password') -## dauth = HTTPDigestAuthHandler() -## dauth.add_password('digest_test_realm', localhost, 'jhylton', -## 'password') - -## self._test_urls(urls, self._extra_handlers()+[bauth, dauth]) - - def _test_urls(self, urls, handlers): - import socket - import time - import logging - debug = logging.getLogger("test_urllib2").debug - - urllib2.install_opener(urllib2.build_opener(*handlers)) - - for url in urls: - if isinstance(url, tuple): - url, req, expected_err = url - else: - req = expected_err = None - debug(url) - try: - f = urllib2.urlopen(url, req) - except (IOError, socket.error, OSError), err: - debug(err) - if expected_err: - msg = ("Didn't get expected error(s) %s for %s %s, got %s" % - (expected_err, url, req, err)) - self.assert_(isinstance(err, expected_err), msg) - else: - buf = f.read() - f.close() - debug("read %d bytes" % len(buf)) - debug("******** next url coming up...") - time.sleep(0.1) - - def _extra_handlers(self): - handlers = [] - - handlers.append(urllib2.GopherHandler) - - cfh = urllib2.CacheFTPHandler() - cfh.setTimeout(1) - handlers.append(cfh) - - return handlers - - -def test_main(): - test_support.requires("network") - test_support.run_unittest(URLTimeoutTest, - urlopenNetworkTests, - AuthTests, - OtherNetworkTests, - CloseSocketTest, - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_urllibnet.py b/sys/lib/python/test/test_urllibnet.py deleted file mode 100644 index 9105afe42..000000000 --- a/sys/lib/python/test/test_urllibnet.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python - -import unittest -from test import test_support - -import socket -import urllib -import sys -import os -import mimetools - -class URLTimeoutTest(unittest.TestCase): - - TIMEOUT = 10.0 - - def setUp(self): - socket.setdefaulttimeout(self.TIMEOUT) - - def tearDown(self): - socket.setdefaulttimeout(None) - - def testURLread(self): - f = urllib.urlopen("http://www.python.org/") - x = f.read() - -class urlopenNetworkTests(unittest.TestCase): - """Tests urllib.urlopen using the network. - - These tests are not exhaustive. Assuming that testing using files does a - good job overall of some of the basic interface features. There are no - tests exercising the optional 'data' and 'proxies' arguments. No tests - for transparent redirection have been written. - - setUp is not used for always constructing a connection to - http://www.python.org/ since there a few tests that don't use that address - and making a connection is expensive enough to warrant minimizing unneeded - connections. - - """ - - def test_basic(self): - # Simple test expected to pass. - open_url = urllib.urlopen("http://www.python.org/") - for attr in ("read", "readline", "readlines", "fileno", "close", - "info", "geturl"): - self.assert_(hasattr(open_url, attr), "object returned from " - "urlopen lacks the %s attribute" % attr) - try: - self.assert_(open_url.read(), "calling 'read' failed") - finally: - open_url.close() - - def test_readlines(self): - # Test both readline and readlines. - open_url = urllib.urlopen("http://www.python.org/") - try: - self.assert_(isinstance(open_url.readline(), basestring), - "readline did not return a string") - self.assert_(isinstance(open_url.readlines(), list), - "readlines did not return a list") - finally: - open_url.close() - - def test_info(self): - # Test 'info'. - open_url = urllib.urlopen("http://www.python.org/") - try: - info_obj = open_url.info() - finally: - open_url.close() - self.assert_(isinstance(info_obj, mimetools.Message), - "object returned by 'info' is not an instance of " - "mimetools.Message") - self.assertEqual(info_obj.getsubtype(), "html") - - def test_geturl(self): - # Make sure same URL as opened is returned by geturl. - URL = "http://www.python.org/" - open_url = urllib.urlopen(URL) - try: - gotten_url = open_url.geturl() - finally: - open_url.close() - self.assertEqual(gotten_url, URL) - - def test_fileno(self): - if (sys.platform in ('win32',) or - not hasattr(os, 'fdopen')): - # On Windows, socket handles are not file descriptors; this - # test can't pass on Windows. - return - # Make sure fd returned by fileno is valid. - open_url = urllib.urlopen("http://www.python.org/") - fd = open_url.fileno() - FILE = os.fdopen(fd) - try: - self.assert_(FILE.read(), "reading from file created using fd " - "returned by fileno failed") - finally: - FILE.close() - - def test_bad_address(self): - # Make sure proper exception is raised when connecting to a bogus - # address. - self.assertRaises(IOError, - # SF patch 809915: In Sep 2003, VeriSign started - # highjacking invalid .com and .net addresses to - # boost traffic to their own site. This test - # started failing then. One hopes the .invalid - # domain will be spared to serve its defined - # purpose. - # urllib.urlopen, "http://www.sadflkjsasadf.com/") - urllib.urlopen, "http://www.python.invalid./") - -class urlretrieveNetworkTests(unittest.TestCase): - """Tests urllib.urlretrieve using the network.""" - - def test_basic(self): - # Test basic functionality. - file_location,info = urllib.urlretrieve("http://www.python.org/") - self.assert_(os.path.exists(file_location), "file location returned by" - " urlretrieve is not a valid path") - FILE = file(file_location) - try: - self.assert_(FILE.read(), "reading from the file location returned" - " by urlretrieve failed") - finally: - FILE.close() - os.unlink(file_location) - - def test_specified_path(self): - # Make sure that specifying the location of the file to write to works. - file_location,info = urllib.urlretrieve("http://www.python.org/", - test_support.TESTFN) - self.assertEqual(file_location, test_support.TESTFN) - self.assert_(os.path.exists(file_location)) - FILE = file(file_location) - try: - self.assert_(FILE.read(), "reading from temporary file failed") - finally: - FILE.close() - os.unlink(file_location) - - def test_header(self): - # Make sure header returned as 2nd value from urlretrieve is good. - file_location, header = urllib.urlretrieve("http://www.python.org/") - os.unlink(file_location) - self.assert_(isinstance(header, mimetools.Message), - "header is not an instance of mimetools.Message") - - - -def test_main(): - test_support.requires('network') - test_support.run_unittest(URLTimeoutTest, - urlopenNetworkTests, - urlretrieveNetworkTests) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_urlparse.py b/sys/lib/python/test/test_urlparse.py deleted file mode 100644 index 5cee4584c..000000000 --- a/sys/lib/python/test/test_urlparse.py +++ /dev/null @@ -1,295 +0,0 @@ -#! /usr/bin/env python - -from test import test_support -import unittest -import urlparse - -RFC1808_BASE = "http://a/b/c/d;p?q#f" -RFC2396_BASE = "http://a/b/c/d;p?q" - -class UrlParseTestCase(unittest.TestCase): - - def checkRoundtrips(self, url, parsed, split): - result = urlparse.urlparse(url) - self.assertEqual(result, parsed) - t = (result.scheme, result.netloc, result.path, - result.params, result.query, result.fragment) - self.assertEqual(t, parsed) - # put it back together and it should be the same - result2 = urlparse.urlunparse(result) - self.assertEqual(result2, url) - self.assertEqual(result2, result.geturl()) - - # the result of geturl() is a fixpoint; we can always parse it - # again to get the same result: - result3 = urlparse.urlparse(result.geturl()) - self.assertEqual(result3.geturl(), result.geturl()) - self.assertEqual(result3, result) - self.assertEqual(result3.scheme, result.scheme) - self.assertEqual(result3.netloc, result.netloc) - self.assertEqual(result3.path, result.path) - self.assertEqual(result3.params, result.params) - self.assertEqual(result3.query, result.query) - self.assertEqual(result3.fragment, result.fragment) - self.assertEqual(result3.username, result.username) - self.assertEqual(result3.password, result.password) - self.assertEqual(result3.hostname, result.hostname) - self.assertEqual(result3.port, result.port) - - # check the roundtrip using urlsplit() as well - result = urlparse.urlsplit(url) - self.assertEqual(result, split) - t = (result.scheme, result.netloc, result.path, - result.query, result.fragment) - self.assertEqual(t, split) - result2 = urlparse.urlunsplit(result) - self.assertEqual(result2, url) - self.assertEqual(result2, result.geturl()) - - # check the fixpoint property of re-parsing the result of geturl() - result3 = urlparse.urlsplit(result.geturl()) - self.assertEqual(result3.geturl(), result.geturl()) - self.assertEqual(result3, result) - self.assertEqual(result3.scheme, result.scheme) - self.assertEqual(result3.netloc, result.netloc) - self.assertEqual(result3.path, result.path) - self.assertEqual(result3.query, result.query) - self.assertEqual(result3.fragment, result.fragment) - self.assertEqual(result3.username, result.username) - self.assertEqual(result3.password, result.password) - self.assertEqual(result3.hostname, result.hostname) - self.assertEqual(result3.port, result.port) - - def test_roundtrips(self): - testcases = [ - ('file:///tmp/junk.txt', - ('file', '', '/tmp/junk.txt', '', '', ''), - ('file', '', '/tmp/junk.txt', '', '')), - ('imap://mail.python.org/mbox1', - ('imap', 'mail.python.org', '/mbox1', '', '', ''), - ('imap', 'mail.python.org', '/mbox1', '', '')), - ('mms://wms.sys.hinet.net/cts/Drama/09006251100.asf', - ('mms', 'wms.sys.hinet.net', '/cts/Drama/09006251100.asf', - '', '', ''), - ('mms', 'wms.sys.hinet.net', '/cts/Drama/09006251100.asf', - '', '')), - ('svn+ssh://svn.zope.org/repos/main/ZConfig/trunk/', - ('svn+ssh', 'svn.zope.org', '/repos/main/ZConfig/trunk/', - '', '', ''), - ('svn+ssh', 'svn.zope.org', '/repos/main/ZConfig/trunk/', - '', '')) - ] - for url, parsed, split in testcases: - self.checkRoundtrips(url, parsed, split) - - def test_http_roundtrips(self): - # urlparse.urlsplit treats 'http:' as an optimized special case, - # so we test both 'http:' and 'https:' in all the following. - # Three cheers for white box knowledge! - testcases = [ - ('://www.python.org', - ('www.python.org', '', '', '', ''), - ('www.python.org', '', '', '')), - ('://www.python.org#abc', - ('www.python.org', '', '', '', 'abc'), - ('www.python.org', '', '', 'abc')), - ('://www.python.org?q=abc', - ('www.python.org', '', '', 'q=abc', ''), - ('www.python.org', '', 'q=abc', '')), - ('://www.python.org/#abc', - ('www.python.org', '/', '', '', 'abc'), - ('www.python.org', '/', '', 'abc')), - ('://a/b/c/d;p?q#f', - ('a', '/b/c/d', 'p', 'q', 'f'), - ('a', '/b/c/d;p', 'q', 'f')), - ] - for scheme in ('http', 'https'): - for url, parsed, split in testcases: - url = scheme + url - parsed = (scheme,) + parsed - split = (scheme,) + split - self.checkRoundtrips(url, parsed, split) - - def checkJoin(self, base, relurl, expected): - self.assertEqual(urlparse.urljoin(base, relurl), expected, - (base, relurl, expected)) - - def test_unparse_parse(self): - for u in ['Python', './Python']: - self.assertEqual(urlparse.urlunsplit(urlparse.urlsplit(u)), u) - self.assertEqual(urlparse.urlunparse(urlparse.urlparse(u)), u) - - def test_RFC1808(self): - # "normal" cases from RFC 1808: - self.checkJoin(RFC1808_BASE, 'g:h', 'g:h') - self.checkJoin(RFC1808_BASE, 'g', 'http://a/b/c/g') - self.checkJoin(RFC1808_BASE, './g', 'http://a/b/c/g') - self.checkJoin(RFC1808_BASE, 'g/', 'http://a/b/c/g/') - self.checkJoin(RFC1808_BASE, '/g', 'http://a/g') - self.checkJoin(RFC1808_BASE, '//g', 'http://g') - self.checkJoin(RFC1808_BASE, 'g?y', 'http://a/b/c/g?y') - self.checkJoin(RFC1808_BASE, 'g?y/./x', 'http://a/b/c/g?y/./x') - self.checkJoin(RFC1808_BASE, '#s', 'http://a/b/c/d;p?q#s') - self.checkJoin(RFC1808_BASE, 'g#s', 'http://a/b/c/g#s') - self.checkJoin(RFC1808_BASE, 'g#s/./x', 'http://a/b/c/g#s/./x') - self.checkJoin(RFC1808_BASE, 'g?y#s', 'http://a/b/c/g?y#s') - self.checkJoin(RFC1808_BASE, 'g;x', 'http://a/b/c/g;x') - self.checkJoin(RFC1808_BASE, 'g;x?y#s', 'http://a/b/c/g;x?y#s') - self.checkJoin(RFC1808_BASE, '.', 'http://a/b/c/') - self.checkJoin(RFC1808_BASE, './', 'http://a/b/c/') - self.checkJoin(RFC1808_BASE, '..', 'http://a/b/') - self.checkJoin(RFC1808_BASE, '../', 'http://a/b/') - self.checkJoin(RFC1808_BASE, '../g', 'http://a/b/g') - self.checkJoin(RFC1808_BASE, '../..', 'http://a/') - self.checkJoin(RFC1808_BASE, '../../', 'http://a/') - self.checkJoin(RFC1808_BASE, '../../g', 'http://a/g') - - # "abnormal" cases from RFC 1808: - self.checkJoin(RFC1808_BASE, '', 'http://a/b/c/d;p?q#f') - self.checkJoin(RFC1808_BASE, '../../../g', 'http://a/../g') - self.checkJoin(RFC1808_BASE, '../../../../g', 'http://a/../../g') - self.checkJoin(RFC1808_BASE, '/./g', 'http://a/./g') - self.checkJoin(RFC1808_BASE, '/../g', 'http://a/../g') - self.checkJoin(RFC1808_BASE, 'g.', 'http://a/b/c/g.') - self.checkJoin(RFC1808_BASE, '.g', 'http://a/b/c/.g') - self.checkJoin(RFC1808_BASE, 'g..', 'http://a/b/c/g..') - self.checkJoin(RFC1808_BASE, '..g', 'http://a/b/c/..g') - self.checkJoin(RFC1808_BASE, './../g', 'http://a/b/g') - self.checkJoin(RFC1808_BASE, './g/.', 'http://a/b/c/g/') - self.checkJoin(RFC1808_BASE, 'g/./h', 'http://a/b/c/g/h') - self.checkJoin(RFC1808_BASE, 'g/../h', 'http://a/b/c/h') - - # RFC 1808 and RFC 1630 disagree on these (according to RFC 1808), - # so we'll not actually run these tests (which expect 1808 behavior). - #self.checkJoin(RFC1808_BASE, 'http:g', 'http:g') - #self.checkJoin(RFC1808_BASE, 'http:', 'http:') - - def test_RFC2396(self): - # cases from RFC 2396 - - self.checkJoin(RFC2396_BASE, '?y', 'http://a/b/c/?y') - self.checkJoin(RFC2396_BASE, ';x', 'http://a/b/c/;x') - - self.checkJoin(RFC2396_BASE, 'g:h', 'g:h') - self.checkJoin(RFC2396_BASE, 'g', 'http://a/b/c/g') - self.checkJoin(RFC2396_BASE, './g', 'http://a/b/c/g') - self.checkJoin(RFC2396_BASE, 'g/', 'http://a/b/c/g/') - self.checkJoin(RFC2396_BASE, '/g', 'http://a/g') - self.checkJoin(RFC2396_BASE, '//g', 'http://g') - self.checkJoin(RFC2396_BASE, 'g?y', 'http://a/b/c/g?y') - self.checkJoin(RFC2396_BASE, '#s', 'http://a/b/c/d;p?q#s') - self.checkJoin(RFC2396_BASE, 'g#s', 'http://a/b/c/g#s') - self.checkJoin(RFC2396_BASE, 'g?y#s', 'http://a/b/c/g?y#s') - self.checkJoin(RFC2396_BASE, 'g;x', 'http://a/b/c/g;x') - self.checkJoin(RFC2396_BASE, 'g;x?y#s', 'http://a/b/c/g;x?y#s') - self.checkJoin(RFC2396_BASE, '.', 'http://a/b/c/') - self.checkJoin(RFC2396_BASE, './', 'http://a/b/c/') - self.checkJoin(RFC2396_BASE, '..', 'http://a/b/') - self.checkJoin(RFC2396_BASE, '../', 'http://a/b/') - self.checkJoin(RFC2396_BASE, '../g', 'http://a/b/g') - self.checkJoin(RFC2396_BASE, '../..', 'http://a/') - self.checkJoin(RFC2396_BASE, '../../', 'http://a/') - self.checkJoin(RFC2396_BASE, '../../g', 'http://a/g') - self.checkJoin(RFC2396_BASE, '', RFC2396_BASE) - self.checkJoin(RFC2396_BASE, '../../../g', 'http://a/../g') - self.checkJoin(RFC2396_BASE, '../../../../g', 'http://a/../../g') - self.checkJoin(RFC2396_BASE, '/./g', 'http://a/./g') - self.checkJoin(RFC2396_BASE, '/../g', 'http://a/../g') - self.checkJoin(RFC2396_BASE, 'g.', 'http://a/b/c/g.') - self.checkJoin(RFC2396_BASE, '.g', 'http://a/b/c/.g') - self.checkJoin(RFC2396_BASE, 'g..', 'http://a/b/c/g..') - self.checkJoin(RFC2396_BASE, '..g', 'http://a/b/c/..g') - self.checkJoin(RFC2396_BASE, './../g', 'http://a/b/g') - self.checkJoin(RFC2396_BASE, './g/.', 'http://a/b/c/g/') - self.checkJoin(RFC2396_BASE, 'g/./h', 'http://a/b/c/g/h') - self.checkJoin(RFC2396_BASE, 'g/../h', 'http://a/b/c/h') - self.checkJoin(RFC2396_BASE, 'g;x=1/./y', 'http://a/b/c/g;x=1/y') - self.checkJoin(RFC2396_BASE, 'g;x=1/../y', 'http://a/b/c/y') - self.checkJoin(RFC2396_BASE, 'g?y/./x', 'http://a/b/c/g?y/./x') - self.checkJoin(RFC2396_BASE, 'g?y/../x', 'http://a/b/c/g?y/../x') - self.checkJoin(RFC2396_BASE, 'g#s/./x', 'http://a/b/c/g#s/./x') - self.checkJoin(RFC2396_BASE, 'g#s/../x', 'http://a/b/c/g#s/../x') - - def test_urldefrag(self): - for url, defrag, frag in [ - ('http://python.org#frag', 'http://python.org', 'frag'), - ('http://python.org', 'http://python.org', ''), - ('http://python.org/#frag', 'http://python.org/', 'frag'), - ('http://python.org/', 'http://python.org/', ''), - ('http://python.org/?q#frag', 'http://python.org/?q', 'frag'), - ('http://python.org/?q', 'http://python.org/?q', ''), - ('http://python.org/p#frag', 'http://python.org/p', 'frag'), - ('http://python.org/p?q', 'http://python.org/p?q', ''), - (RFC1808_BASE, 'http://a/b/c/d;p?q', 'f'), - (RFC2396_BASE, 'http://a/b/c/d;p?q', ''), - ]: - self.assertEqual(urlparse.urldefrag(url), (defrag, frag)) - - def test_urlsplit_attributes(self): - url = "HTTP://WWW.PYTHON.ORG/doc/#frag" - p = urlparse.urlsplit(url) - self.assertEqual(p.scheme, "http") - self.assertEqual(p.netloc, "WWW.PYTHON.ORG") - self.assertEqual(p.path, "/doc/") - self.assertEqual(p.query, "") - self.assertEqual(p.fragment, "frag") - self.assertEqual(p.username, None) - self.assertEqual(p.password, None) - self.assertEqual(p.hostname, "www.python.org") - self.assertEqual(p.port, None) - # geturl() won't return exactly the original URL in this case - # since the scheme is always case-normalized - #self.assertEqual(p.geturl(), url) - - url = "http://User:Pass@www.python.org:080/doc/?query=yes#frag" - p = urlparse.urlsplit(url) - self.assertEqual(p.scheme, "http") - self.assertEqual(p.netloc, "User:Pass@www.python.org:080") - self.assertEqual(p.path, "/doc/") - self.assertEqual(p.query, "query=yes") - self.assertEqual(p.fragment, "frag") - self.assertEqual(p.username, "User") - self.assertEqual(p.password, "Pass") - self.assertEqual(p.hostname, "www.python.org") - self.assertEqual(p.port, 80) - self.assertEqual(p.geturl(), url) - - def test_attributes_bad_port(self): - """Check handling of non-integer ports.""" - p = urlparse.urlsplit("http://www.example.net:foo") - self.assertEqual(p.netloc, "www.example.net:foo") - self.assertRaises(ValueError, lambda: p.port) - - p = urlparse.urlparse("http://www.example.net:foo") - self.assertEqual(p.netloc, "www.example.net:foo") - self.assertRaises(ValueError, lambda: p.port) - - def test_attributes_without_netloc(self): - # This example is straight from RFC 3261. It looks like it - # should allow the username, hostname, and port to be filled - # in, but doesn't. Since it's a URI and doesn't use the - # scheme://netloc syntax, the netloc and related attributes - # should be left empty. - uri = "sip:alice@atlanta.com;maddr=239.255.255.1;ttl=15" - p = urlparse.urlsplit(uri) - self.assertEqual(p.netloc, "") - self.assertEqual(p.username, None) - self.assertEqual(p.password, None) - self.assertEqual(p.hostname, None) - self.assertEqual(p.port, None) - self.assertEqual(p.geturl(), uri) - - p = urlparse.urlparse(uri) - self.assertEqual(p.netloc, "") - self.assertEqual(p.username, None) - self.assertEqual(p.password, None) - self.assertEqual(p.hostname, None) - self.assertEqual(p.port, None) - self.assertEqual(p.geturl(), uri) - - -def test_main(): - test_support.run_unittest(UrlParseTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_userdict.py b/sys/lib/python/test/test_userdict.py deleted file mode 100644 index 357c0f04a..000000000 --- a/sys/lib/python/test/test_userdict.py +++ /dev/null @@ -1,350 +0,0 @@ -# Check every path through every method of UserDict - -import unittest -from test import test_support, mapping_tests -import UserDict - -d0 = {} -d1 = {"one": 1} -d2 = {"one": 1, "two": 2} -d3 = {"one": 1, "two": 3, "three": 5} -d4 = {"one": None, "two": None} -d5 = {"one": 1, "two": 1} - -class UserDictTest(mapping_tests.TestHashMappingProtocol): - type2test = UserDict.IterableUserDict - - def test_all(self): - # Test constructors - u = UserDict.UserDict() - u0 = UserDict.UserDict(d0) - u1 = UserDict.UserDict(d1) - u2 = UserDict.IterableUserDict(d2) - - uu = UserDict.UserDict(u) - uu0 = UserDict.UserDict(u0) - uu1 = UserDict.UserDict(u1) - uu2 = UserDict.UserDict(u2) - - # keyword arg constructor - self.assertEqual(UserDict.UserDict(one=1, two=2), d2) - # item sequence constructor - self.assertEqual(UserDict.UserDict([('one',1), ('two',2)]), d2) - self.assertEqual(UserDict.UserDict(dict=[('one',1), ('two',2)]), d2) - # both together - self.assertEqual(UserDict.UserDict([('one',1), ('two',2)], two=3, three=5), d3) - - # alternate constructor - self.assertEqual(UserDict.UserDict.fromkeys('one two'.split()), d4) - self.assertEqual(UserDict.UserDict().fromkeys('one two'.split()), d4) - self.assertEqual(UserDict.UserDict.fromkeys('one two'.split(), 1), d5) - self.assertEqual(UserDict.UserDict().fromkeys('one two'.split(), 1), d5) - self.assert_(u1.fromkeys('one two'.split()) is not u1) - self.assert_(isinstance(u1.fromkeys('one two'.split()), UserDict.UserDict)) - self.assert_(isinstance(u2.fromkeys('one two'.split()), UserDict.IterableUserDict)) - - # Test __repr__ - self.assertEqual(str(u0), str(d0)) - self.assertEqual(repr(u1), repr(d1)) - self.assertEqual(`u2`, `d2`) - - # Test __cmp__ and __len__ - all = [d0, d1, d2, u, u0, u1, u2, uu, uu0, uu1, uu2] - for a in all: - for b in all: - self.assertEqual(cmp(a, b), cmp(len(a), len(b))) - - # Test __getitem__ - self.assertEqual(u2["one"], 1) - self.assertRaises(KeyError, u1.__getitem__, "two") - - # Test __setitem__ - u3 = UserDict.UserDict(u2) - u3["two"] = 2 - u3["three"] = 3 - - # Test __delitem__ - del u3["three"] - self.assertRaises(KeyError, u3.__delitem__, "three") - - # Test clear - u3.clear() - self.assertEqual(u3, {}) - - # Test copy() - u2a = u2.copy() - self.assertEqual(u2a, u2) - u2b = UserDict.UserDict(x=42, y=23) - u2c = u2b.copy() # making a copy of a UserDict is special cased - self.assertEqual(u2b, u2c) - - class MyUserDict(UserDict.UserDict): - def display(self): print self - - m2 = MyUserDict(u2) - m2a = m2.copy() - self.assertEqual(m2a, m2) - - # SF bug #476616 -- copy() of UserDict subclass shared data - m2['foo'] = 'bar' - self.assertNotEqual(m2a, m2) - - # Test keys, items, values - self.assertEqual(u2.keys(), d2.keys()) - self.assertEqual(u2.items(), d2.items()) - self.assertEqual(u2.values(), d2.values()) - - # Test has_key and "in". - for i in u2.keys(): - self.assert_(u2.has_key(i)) - self.assert_(i in u2) - self.assertEqual(u1.has_key(i), d1.has_key(i)) - self.assertEqual(i in u1, i in d1) - self.assertEqual(u0.has_key(i), d0.has_key(i)) - self.assertEqual(i in u0, i in d0) - - # Test update - t = UserDict.UserDict() - t.update(u2) - self.assertEqual(t, u2) - class Items: - def items(self): - return (("x", 42), ("y", 23)) - t = UserDict.UserDict() - t.update(Items()) - self.assertEqual(t, {"x": 42, "y": 23}) - - # Test get - for i in u2.keys(): - self.assertEqual(u2.get(i), u2[i]) - self.assertEqual(u1.get(i), d1.get(i)) - self.assertEqual(u0.get(i), d0.get(i)) - - # Test "in" iteration. - for i in xrange(20): - u2[i] = str(i) - ikeys = [] - for k in u2: - ikeys.append(k) - keys = u2.keys() - self.assertEqual(set(ikeys), set(keys)) - - # Test setdefault - t = UserDict.UserDict() - self.assertEqual(t.setdefault("x", 42), 42) - self.assert_(t.has_key("x")) - self.assertEqual(t.setdefault("x", 23), 42) - - # Test pop - t = UserDict.UserDict(x=42) - self.assertEqual(t.pop("x"), 42) - self.assertRaises(KeyError, t.pop, "x") - self.assertEqual(t.pop("x", 1), 1) - t["x"] = 42 - self.assertEqual(t.pop("x", 1), 42) - - # Test popitem - t = UserDict.UserDict(x=42) - self.assertEqual(t.popitem(), ("x", 42)) - self.assertRaises(KeyError, t.popitem) - - def test_missing(self): - # Make sure UserDict doesn't have a __missing__ method - self.assertEqual(hasattr(UserDict, "__missing__"), False) - # Test several cases: - # (D) subclass defines __missing__ method returning a value - # (E) subclass defines __missing__ method raising RuntimeError - # (F) subclass sets __missing__ instance variable (no effect) - # (G) subclass doesn't define __missing__ at a all - class D(UserDict.UserDict): - def __missing__(self, key): - return 42 - d = D({1: 2, 3: 4}) - self.assertEqual(d[1], 2) - self.assertEqual(d[3], 4) - self.assert_(2 not in d) - self.assert_(2 not in d.keys()) - self.assertEqual(d[2], 42) - class E(UserDict.UserDict): - def __missing__(self, key): - raise RuntimeError(key) - e = E() - try: - e[42] - except RuntimeError, err: - self.assertEqual(err.args, (42,)) - else: - self.fail("e[42] didn't raise RuntimeError") - class F(UserDict.UserDict): - def __init__(self): - # An instance variable __missing__ should have no effect - self.__missing__ = lambda key: None - UserDict.UserDict.__init__(self) - f = F() - try: - f[42] - except KeyError, err: - self.assertEqual(err.args, (42,)) - else: - self.fail("f[42] didn't raise KeyError") - class G(UserDict.UserDict): - pass - g = G() - try: - g[42] - except KeyError, err: - self.assertEqual(err.args, (42,)) - else: - self.fail("g[42] didn't raise KeyError") - -########################## -# Test Dict Mixin - -class SeqDict(UserDict.DictMixin): - """Dictionary lookalike implemented with lists. - - Used to test and demonstrate DictMixin - """ - def __init__(self, other=None, **kwargs): - self.keylist = [] - self.valuelist = [] - if other is not None: - for (key, value) in other: - self[key] = value - for (key, value) in kwargs.iteritems(): - self[key] = value - def __getitem__(self, key): - try: - i = self.keylist.index(key) - except ValueError: - raise KeyError - return self.valuelist[i] - def __setitem__(self, key, value): - try: - i = self.keylist.index(key) - self.valuelist[i] = value - except ValueError: - self.keylist.append(key) - self.valuelist.append(value) - def __delitem__(self, key): - try: - i = self.keylist.index(key) - except ValueError: - raise KeyError - self.keylist.pop(i) - self.valuelist.pop(i) - def keys(self): - return list(self.keylist) - def copy(self): - d = self.__class__() - for key, value in self.iteritems(): - d[key] = value - return d - @classmethod - def fromkeys(cls, keys, value=None): - d = cls() - for key in keys: - d[key] = value - return d - -class UserDictMixinTest(mapping_tests.TestMappingProtocol): - type2test = SeqDict - - def test_all(self): - ## Setup test and verify working of the test class - - # check init - s = SeqDict() - - # exercise setitem - s[10] = 'ten' - s[20] = 'twenty' - s[30] = 'thirty' - - # exercise delitem - del s[20] - # check getitem and setitem - self.assertEqual(s[10], 'ten') - # check keys() and delitem - self.assertEqual(s.keys(), [10, 30]) - - ## Now, test the DictMixin methods one by one - # has_key - self.assert_(s.has_key(10)) - self.assert_(not s.has_key(20)) - - # __contains__ - self.assert_(10 in s) - self.assert_(20 not in s) - - # __iter__ - self.assertEqual([k for k in s], [10, 30]) - - # __len__ - self.assertEqual(len(s), 2) - - # iteritems - self.assertEqual(list(s.iteritems()), [(10,'ten'), (30, 'thirty')]) - - # iterkeys - self.assertEqual(list(s.iterkeys()), [10, 30]) - - # itervalues - self.assertEqual(list(s.itervalues()), ['ten', 'thirty']) - - # values - self.assertEqual(s.values(), ['ten', 'thirty']) - - # items - self.assertEqual(s.items(), [(10,'ten'), (30, 'thirty')]) - - # get - self.assertEqual(s.get(10), 'ten') - self.assertEqual(s.get(15,'fifteen'), 'fifteen') - self.assertEqual(s.get(15), None) - - # setdefault - self.assertEqual(s.setdefault(40, 'forty'), 'forty') - self.assertEqual(s.setdefault(10, 'null'), 'ten') - del s[40] - - # pop - self.assertEqual(s.pop(10), 'ten') - self.assert_(10 not in s) - s[10] = 'ten' - self.assertEqual(s.pop("x", 1), 1) - s["x"] = 42 - self.assertEqual(s.pop("x", 1), 42) - - # popitem - k, v = s.popitem() - self.assert_(k not in s) - s[k] = v - - # clear - s.clear() - self.assertEqual(len(s), 0) - - # empty popitem - self.assertRaises(KeyError, s.popitem) - - # update - s.update({10: 'ten', 20:'twenty'}) - self.assertEqual(s[10], 'ten') - self.assertEqual(s[20], 'twenty') - - # cmp - self.assertEqual(s, {10: 'ten', 20:'twenty'}) - t = SeqDict() - t[20] = 'twenty' - t[10] = 'ten' - self.assertEqual(s, t) - -def test_main(): - test_support.run_unittest( - UserDictTest, - UserDictMixinTest - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_userlist.py b/sys/lib/python/test/test_userlist.py deleted file mode 100644 index 8c7ef2efe..000000000 --- a/sys/lib/python/test/test_userlist.py +++ /dev/null @@ -1,60 +0,0 @@ -# Check every path through every method of UserList - -from UserList import UserList -import unittest -from test import test_support, list_tests - -class UserListTest(list_tests.CommonTest): - type2test = UserList - - def test_getslice(self): - super(UserListTest, self).test_getslice() - l = [0, 1, 2, 3, 4] - u = self.type2test(l) - for i in range(-3, 6): - self.assertEqual(u[:i], l[:i]) - self.assertEqual(u[i:], l[i:]) - for j in xrange(-3, 6): - self.assertEqual(u[i:j], l[i:j]) - - def test_add_specials(self): - u = UserList("spam") - u2 = u + "eggs" - self.assertEqual(u2, list("spameggs")) - - def test_radd_specials(self): - u = UserList("eggs") - u2 = "spam" + u - self.assertEqual(u2, list("spameggs")) - u2 = u.__radd__(UserList("spam")) - self.assertEqual(u2, list("spameggs")) - - def test_iadd(self): - super(UserListTest, self).test_iadd() - u = [0, 1] - u += UserList([0, 1]) - self.assertEqual(u, [0, 1, 0, 1]) - - def test_mixedcmp(self): - u = self.type2test([0, 1]) - self.assertEqual(u, [0, 1]) - self.assertNotEqual(u, [0]) - self.assertNotEqual(u, [0, 2]) - - def test_mixedadd(self): - u = self.type2test([0, 1]) - self.assertEqual(u + [], u) - self.assertEqual(u + [2], [0, 1, 2]) - - def test_getitemoverwriteiter(self): - # Verify that __getitem__ overrides *are* recognized by __iter__ - class T(self.type2test): - def __getitem__(self, key): - return str(key) + '!!!' - self.assertEqual(iter(T((1,2))).next(), "0!!!") - -def test_main(): - test_support.run_unittest(UserListTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_userstring.py b/sys/lib/python/test/test_userstring.py deleted file mode 100755 index 53114db28..000000000 --- a/sys/lib/python/test/test_userstring.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python -# UserString is a wrapper around the native builtin string type. -# UserString instances should behave similar to builtin string objects. - -import unittest -from test import test_support, string_tests - -from UserString import UserString, MutableString - -class UserStringTest( - string_tests.CommonTest, - string_tests.MixinStrUnicodeUserStringTest, - string_tests.MixinStrStringUserStringTest, - string_tests.MixinStrUserStringTest - ): - - type2test = UserString - - # Overwrite the three testing methods, because UserString - # can't cope with arguments propagated to UserString - # (and we don't test with subclasses) - def checkequal(self, result, object, methodname, *args): - result = self.fixtype(result) - object = self.fixtype(object) - # we don't fix the arguments, because UserString can't cope with it - realresult = getattr(object, methodname)(*args) - self.assertEqual( - result, - realresult - ) - - def checkraises(self, exc, object, methodname, *args): - object = self.fixtype(object) - # we don't fix the arguments, because UserString can't cope with it - self.assertRaises( - exc, - getattr(object, methodname), - *args - ) - - def checkcall(self, object, methodname, *args): - object = self.fixtype(object) - # we don't fix the arguments, because UserString can't cope with it - getattr(object, methodname)(*args) - -class MutableStringTest(UserStringTest): - type2test = MutableString - - # MutableStrings can be hashed => deactivate test - def test_hash(self): - pass - - def test_setitem(self): - s = self.type2test("foo") - self.assertRaises(IndexError, s.__setitem__, -4, "bar") - self.assertRaises(IndexError, s.__setitem__, 3, "bar") - s[-1] = "bar" - self.assertEqual(s, "fobar") - s[0] = "bar" - self.assertEqual(s, "barobar") - - def test_delitem(self): - s = self.type2test("foo") - self.assertRaises(IndexError, s.__delitem__, -4) - self.assertRaises(IndexError, s.__delitem__, 3) - del s[-1] - self.assertEqual(s, "fo") - del s[0] - self.assertEqual(s, "o") - del s[0] - self.assertEqual(s, "") - - def test_setslice(self): - s = self.type2test("foo") - s[:] = "bar" - self.assertEqual(s, "bar") - s[1:2] = "foo" - self.assertEqual(s, "bfoor") - s[1:-1] = UserString("a") - self.assertEqual(s, "bar") - s[0:10] = 42 - self.assertEqual(s, "42") - - def test_delslice(self): - s = self.type2test("foobar") - del s[3:10] - self.assertEqual(s, "foo") - del s[-1:10] - self.assertEqual(s, "fo") - - def test_immutable(self): - s = self.type2test("foobar") - s2 = s.immutable() - self.assertEqual(s, s2) - self.assert_(isinstance(s2, UserString)) - - def test_iadd(self): - s = self.type2test("foo") - s += "bar" - self.assertEqual(s, "foobar") - s += UserString("baz") - self.assertEqual(s, "foobarbaz") - s += 42 - self.assertEqual(s, "foobarbaz42") - - def test_imul(self): - s = self.type2test("foo") - s *= 1 - self.assertEqual(s, "foo") - s *= 2 - self.assertEqual(s, "foofoo") - s *= -1 - self.assertEqual(s, "") - -def test_main(): - test_support.run_unittest(UserStringTest, MutableStringTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_uu.py b/sys/lib/python/test/test_uu.py deleted file mode 100644 index 7786316e9..000000000 --- a/sys/lib/python/test/test_uu.py +++ /dev/null @@ -1,180 +0,0 @@ -""" -Tests for uu module. -Nick Mathewson -""" - -import unittest -from test import test_support - -import sys, os, uu, cStringIO -import uu -from StringIO import StringIO - -plaintext = "The smooth-scaled python crept over the sleeping dog\n" - -encodedtext = """\ -M5&AE('-M;V]T:\"US8V%L960@<'ET:&]N(&-R97!T(&]V97(@=&AE('-L965P -(:6YG(&1O9PH """ - -encodedtextwrapped = "begin %03o %s\n" + encodedtext.replace("%", "%%") + "\n \nend\n" - -class UUTest(unittest.TestCase): - - def test_encode(self): - inp = cStringIO.StringIO(plaintext) - out = cStringIO.StringIO() - uu.encode(inp, out, "t1") - self.assertEqual(out.getvalue(), encodedtextwrapped % (0666, "t1")) - inp = cStringIO.StringIO(plaintext) - out = cStringIO.StringIO() - uu.encode(inp, out, "t1", 0644) - self.assertEqual(out.getvalue(), encodedtextwrapped % (0644, "t1")) - - def test_decode(self): - inp = cStringIO.StringIO(encodedtextwrapped % (0666, "t1")) - out = cStringIO.StringIO() - uu.decode(inp, out) - self.assertEqual(out.getvalue(), plaintext) - inp = cStringIO.StringIO( - "UUencoded files may contain many lines,\n" + - "even some that have 'begin' in them.\n" + - encodedtextwrapped % (0666, "t1") - ) - out = cStringIO.StringIO() - uu.decode(inp, out) - self.assertEqual(out.getvalue(), plaintext) - - def test_truncatedinput(self): - inp = cStringIO.StringIO("begin 644 t1\n" + encodedtext) - out = cStringIO.StringIO() - try: - uu.decode(inp, out) - self.fail("No exception thrown") - except uu.Error, e: - self.assertEqual(str(e), "Truncated input file") - - def test_missingbegin(self): - inp = cStringIO.StringIO("") - out = cStringIO.StringIO() - try: - uu.decode(inp, out) - self.fail("No exception thrown") - except uu.Error, e: - self.assertEqual(str(e), "No valid begin line found in input file") - -class UUStdIOTest(unittest.TestCase): - - def setUp(self): - self.stdin = sys.stdin - self.stdout = sys.stdout - - def tearDown(self): - sys.stdin = self.stdin - sys.stdout = self.stdout - - def test_encode(self): - sys.stdin = cStringIO.StringIO(plaintext) - sys.stdout = cStringIO.StringIO() - uu.encode("-", "-", "t1", 0666) - self.assertEqual( - sys.stdout.getvalue(), - encodedtextwrapped % (0666, "t1") - ) - - def test_decode(self): - sys.stdin = cStringIO.StringIO(encodedtextwrapped % (0666, "t1")) - sys.stdout = cStringIO.StringIO() - uu.decode("-", "-") - self.assertEqual(sys.stdout.getvalue(), plaintext) - -class UUFileTest(unittest.TestCase): - - def _kill(self, f): - # close and remove file - try: - f.close() - except (SystemExit, KeyboardInterrupt): - raise - except: - pass - try: - os.unlink(f.name) - except (SystemExit, KeyboardInterrupt): - raise - except: - pass - - def setUp(self): - self.tmpin = test_support.TESTFN + "i" - self.tmpout = test_support.TESTFN + "o" - - def tearDown(self): - del self.tmpin - del self.tmpout - - def test_encode(self): - try: - fin = open(self.tmpin, 'wb') - fin.write(plaintext) - fin.close() - - fin = open(self.tmpin, 'rb') - fout = open(self.tmpout, 'w') - uu.encode(fin, fout, self.tmpin, mode=0644) - fin.close() - fout.close() - - fout = open(self.tmpout, 'r') - s = fout.read() - fout.close() - self.assertEqual(s, encodedtextwrapped % (0644, self.tmpin)) - - # in_file and out_file as filenames - uu.encode(self.tmpin, self.tmpout, mode=0644) - fout = open(self.tmpout, 'r') - s = fout.read() - fout.close() - self.assertEqual(s, encodedtextwrapped % (0644, self.tmpin)) - - finally: - self._kill(fin) - self._kill(fout) - - def test_decode(self): - try: - f = open(self.tmpin, 'wb') - f.write(encodedtextwrapped % (0644, self.tmpout)) - f.close() - - f = open(self.tmpin, 'rb') - uu.decode(f) - f.close() - - f = open(self.tmpout, 'r') - s = f.read() - f.close() - self.assertEqual(s, plaintext) - # XXX is there an xp way to verify the mode? - finally: - self._kill(f) - - def test_decodetwice(self): - # Verify that decode() will refuse to overwrite an existing file - try: - f = cStringIO.StringIO(encodedtextwrapped % (0644, self.tmpout)) - - f = open(self.tmpin, 'rb') - uu.decode(f) - f.close() - - f = open(self.tmpin, 'rb') - self.assertRaises(uu.Error, uu.decode, f) - f.close() - finally: - self._kill(f) - -def test_main(): - test_support.run_unittest(UUTest, UUStdIOTest, UUFileTest) - -if __name__=="__main__": - test_main() diff --git a/sys/lib/python/test/test_uuid.py b/sys/lib/python/test/test_uuid.py deleted file mode 100644 index 90671be05..000000000 --- a/sys/lib/python/test/test_uuid.py +++ /dev/null @@ -1,459 +0,0 @@ -from unittest import TestCase -from test import test_support -import uuid - -def importable(name): - try: - __import__(name) - return True - except: - return False - -class TestUUID(TestCase): - last_node = None - source2node = {} - - def test_UUID(self): - equal = self.assertEqual - ascending = [] - for (string, curly, hex, bytes, bytes_le, fields, integer, urn, - time, clock_seq, variant, version) in [ - ('00000000-0000-0000-0000-000000000000', - '{00000000-0000-0000-0000-000000000000}', - '00000000000000000000000000000000', - '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', - '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', - (0, 0, 0, 0, 0, 0), - 0, - 'urn:uuid:00000000-0000-0000-0000-000000000000', - 0, 0, uuid.RESERVED_NCS, None), - ('00010203-0405-0607-0809-0a0b0c0d0e0f', - '{00010203-0405-0607-0809-0a0b0c0d0e0f}', - '000102030405060708090a0b0c0d0e0f', - '\0\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\x0d\x0e\x0f', - '\x03\x02\x01\0\x05\x04\x07\x06\x08\t\n\x0b\x0c\x0d\x0e\x0f', - (0x00010203L, 0x0405, 0x0607, 8, 9, 0x0a0b0c0d0e0fL), - 0x000102030405060708090a0b0c0d0e0fL, - 'urn:uuid:00010203-0405-0607-0809-0a0b0c0d0e0f', - 0x607040500010203L, 0x809, uuid.RESERVED_NCS, None), - ('02d9e6d5-9467-382e-8f9b-9300a64ac3cd', - '{02d9e6d5-9467-382e-8f9b-9300a64ac3cd}', - '02d9e6d59467382e8f9b9300a64ac3cd', - '\x02\xd9\xe6\xd5\x94\x67\x38\x2e\x8f\x9b\x93\x00\xa6\x4a\xc3\xcd', - '\xd5\xe6\xd9\x02\x67\x94\x2e\x38\x8f\x9b\x93\x00\xa6\x4a\xc3\xcd', - (0x02d9e6d5L, 0x9467, 0x382e, 0x8f, 0x9b, 0x9300a64ac3cdL), - 0x02d9e6d59467382e8f9b9300a64ac3cdL, - 'urn:uuid:02d9e6d5-9467-382e-8f9b-9300a64ac3cd', - 0x82e946702d9e6d5L, 0xf9b, uuid.RFC_4122, 3), - ('12345678-1234-5678-1234-567812345678', - '{12345678-1234-5678-1234-567812345678}', - '12345678123456781234567812345678', - '\x12\x34\x56\x78'*4, - '\x78\x56\x34\x12\x34\x12\x78\x56\x12\x34\x56\x78\x12\x34\x56\x78', - (0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678), - 0x12345678123456781234567812345678, - 'urn:uuid:12345678-1234-5678-1234-567812345678', - 0x678123412345678L, 0x1234, uuid.RESERVED_NCS, None), - ('6ba7b810-9dad-11d1-80b4-00c04fd430c8', - '{6ba7b810-9dad-11d1-80b4-00c04fd430c8}', - '6ba7b8109dad11d180b400c04fd430c8', - '\x6b\xa7\xb8\x10\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8', - '\x10\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8', - (0x6ba7b810L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L), - 0x6ba7b8109dad11d180b400c04fd430c8L, - 'urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8', - 0x1d19dad6ba7b810L, 0xb4, uuid.RFC_4122, 1), - ('6ba7b811-9dad-11d1-80b4-00c04fd430c8', - '{6ba7b811-9dad-11d1-80b4-00c04fd430c8}', - '6ba7b8119dad11d180b400c04fd430c8', - '\x6b\xa7\xb8\x11\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8', - '\x11\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8', - (0x6ba7b811L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L), - 0x6ba7b8119dad11d180b400c04fd430c8L, - 'urn:uuid:6ba7b811-9dad-11d1-80b4-00c04fd430c8', - 0x1d19dad6ba7b811L, 0xb4, uuid.RFC_4122, 1), - ('6ba7b812-9dad-11d1-80b4-00c04fd430c8', - '{6ba7b812-9dad-11d1-80b4-00c04fd430c8}', - '6ba7b8129dad11d180b400c04fd430c8', - '\x6b\xa7\xb8\x12\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8', - '\x12\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8', - (0x6ba7b812L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L), - 0x6ba7b8129dad11d180b400c04fd430c8L, - 'urn:uuid:6ba7b812-9dad-11d1-80b4-00c04fd430c8', - 0x1d19dad6ba7b812L, 0xb4, uuid.RFC_4122, 1), - ('6ba7b814-9dad-11d1-80b4-00c04fd430c8', - '{6ba7b814-9dad-11d1-80b4-00c04fd430c8}', - '6ba7b8149dad11d180b400c04fd430c8', - '\x6b\xa7\xb8\x14\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8', - '\x14\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8', - (0x6ba7b814L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L), - 0x6ba7b8149dad11d180b400c04fd430c8L, - 'urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8', - 0x1d19dad6ba7b814L, 0xb4, uuid.RFC_4122, 1), - ('7d444840-9dc0-11d1-b245-5ffdce74fad2', - '{7d444840-9dc0-11d1-b245-5ffdce74fad2}', - '7d4448409dc011d1b2455ffdce74fad2', - '\x7d\x44\x48\x40\x9d\xc0\x11\xd1\xb2\x45\x5f\xfd\xce\x74\xfa\xd2', - '\x40\x48\x44\x7d\xc0\x9d\xd1\x11\xb2\x45\x5f\xfd\xce\x74\xfa\xd2', - (0x7d444840L, 0x9dc0, 0x11d1, 0xb2, 0x45, 0x5ffdce74fad2L), - 0x7d4448409dc011d1b2455ffdce74fad2L, - 'urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2', - 0x1d19dc07d444840L, 0x3245, uuid.RFC_4122, 1), - ('e902893a-9d22-3c7e-a7b8-d6e313b71d9f', - '{e902893a-9d22-3c7e-a7b8-d6e313b71d9f}', - 'e902893a9d223c7ea7b8d6e313b71d9f', - '\xe9\x02\x89\x3a\x9d\x22\x3c\x7e\xa7\xb8\xd6\xe3\x13\xb7\x1d\x9f', - '\x3a\x89\x02\xe9\x22\x9d\x7e\x3c\xa7\xb8\xd6\xe3\x13\xb7\x1d\x9f', - (0xe902893aL, 0x9d22, 0x3c7e, 0xa7, 0xb8, 0xd6e313b71d9fL), - 0xe902893a9d223c7ea7b8d6e313b71d9fL, - 'urn:uuid:e902893a-9d22-3c7e-a7b8-d6e313b71d9f', - 0xc7e9d22e902893aL, 0x27b8, uuid.RFC_4122, 3), - ('eb424026-6f54-4ef8-a4d0-bb658a1fc6cf', - '{eb424026-6f54-4ef8-a4d0-bb658a1fc6cf}', - 'eb4240266f544ef8a4d0bb658a1fc6cf', - '\xeb\x42\x40\x26\x6f\x54\x4e\xf8\xa4\xd0\xbb\x65\x8a\x1f\xc6\xcf', - '\x26\x40\x42\xeb\x54\x6f\xf8\x4e\xa4\xd0\xbb\x65\x8a\x1f\xc6\xcf', - (0xeb424026L, 0x6f54, 0x4ef8, 0xa4, 0xd0, 0xbb658a1fc6cfL), - 0xeb4240266f544ef8a4d0bb658a1fc6cfL, - 'urn:uuid:eb424026-6f54-4ef8-a4d0-bb658a1fc6cf', - 0xef86f54eb424026L, 0x24d0, uuid.RFC_4122, 4), - ('f81d4fae-7dec-11d0-a765-00a0c91e6bf6', - '{f81d4fae-7dec-11d0-a765-00a0c91e6bf6}', - 'f81d4fae7dec11d0a76500a0c91e6bf6', - '\xf8\x1d\x4f\xae\x7d\xec\x11\xd0\xa7\x65\x00\xa0\xc9\x1e\x6b\xf6', - '\xae\x4f\x1d\xf8\xec\x7d\xd0\x11\xa7\x65\x00\xa0\xc9\x1e\x6b\xf6', - (0xf81d4faeL, 0x7dec, 0x11d0, 0xa7, 0x65, 0x00a0c91e6bf6L), - 0xf81d4fae7dec11d0a76500a0c91e6bf6L, - 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', - 0x1d07decf81d4faeL, 0x2765, uuid.RFC_4122, 1), - ('fffefdfc-fffe-fffe-fffe-fffefdfcfbfa', - '{fffefdfc-fffe-fffe-fffe-fffefdfcfbfa}', - 'fffefdfcfffefffefffefffefdfcfbfa', - '\xff\xfe\xfd\xfc\xff\xfe\xff\xfe\xff\xfe\xff\xfe\xfd\xfc\xfb\xfa', - '\xfc\xfd\xfe\xff\xfe\xff\xfe\xff\xff\xfe\xff\xfe\xfd\xfc\xfb\xfa', - (0xfffefdfcL, 0xfffe, 0xfffe, 0xff, 0xfe, 0xfffefdfcfbfaL), - 0xfffefdfcfffefffefffefffefdfcfbfaL, - 'urn:uuid:fffefdfc-fffe-fffe-fffe-fffefdfcfbfa', - 0xffefffefffefdfcL, 0x3ffe, uuid.RESERVED_FUTURE, None), - ('ffffffff-ffff-ffff-ffff-ffffffffffff', - '{ffffffff-ffff-ffff-ffff-ffffffffffff}', - 'ffffffffffffffffffffffffffffffff', - '\xff'*16, - '\xff'*16, - (0xffffffffL, 0xffffL, 0xffffL, 0xff, 0xff, 0xffffffffffffL), - 0xffffffffffffffffffffffffffffffffL, - 'urn:uuid:ffffffff-ffff-ffff-ffff-ffffffffffff', - 0xfffffffffffffffL, 0x3fff, uuid.RESERVED_FUTURE, None), - ]: - equivalents = [] - # Construct each UUID in several different ways. - for u in [uuid.UUID(string), uuid.UUID(curly), uuid.UUID(hex), - uuid.UUID(bytes=bytes), uuid.UUID(bytes_le=bytes_le), - uuid.UUID(fields=fields), uuid.UUID(int=integer), - uuid.UUID(urn)]: - # Test all conversions and properties of the UUID object. - equal(str(u), string) - equal(int(u), integer) - equal(u.bytes, bytes) - equal(u.bytes_le, bytes_le) - equal(u.fields, fields) - equal(u.time_low, fields[0]) - equal(u.time_mid, fields[1]) - equal(u.time_hi_version, fields[2]) - equal(u.clock_seq_hi_variant, fields[3]) - equal(u.clock_seq_low, fields[4]) - equal(u.node, fields[5]) - equal(u.hex, hex) - equal(u.int, integer) - equal(u.urn, urn) - equal(u.time, time) - equal(u.clock_seq, clock_seq) - equal(u.variant, variant) - equal(u.version, version) - equivalents.append(u) - - # Different construction methods should give the same UUID. - for u in equivalents: - for v in equivalents: - equal(u, v) - ascending.append(u) - - # Test comparison of UUIDs. - for i in range(len(ascending)): - for j in range(len(ascending)): - equal(cmp(i, j), cmp(ascending[i], ascending[j])) - - # Test sorting of UUIDs (above list is in ascending order). - resorted = ascending[:] - resorted.reverse() - resorted.sort() - equal(ascending, resorted) - - def test_exceptions(self): - badvalue = lambda f: self.assertRaises(ValueError, f) - badtype = lambda f: self.assertRaises(TypeError, f) - - # Badly formed hex strings. - badvalue(lambda: uuid.UUID('')) - badvalue(lambda: uuid.UUID('abc')) - badvalue(lambda: uuid.UUID('1234567812345678123456781234567')) - badvalue(lambda: uuid.UUID('123456781234567812345678123456789')) - badvalue(lambda: uuid.UUID('123456781234567812345678z2345678')) - - # Badly formed bytes. - badvalue(lambda: uuid.UUID(bytes='abc')) - badvalue(lambda: uuid.UUID(bytes='\0'*15)) - badvalue(lambda: uuid.UUID(bytes='\0'*17)) - - # Badly formed bytes_le. - badvalue(lambda: uuid.UUID(bytes_le='abc')) - badvalue(lambda: uuid.UUID(bytes_le='\0'*15)) - badvalue(lambda: uuid.UUID(bytes_le='\0'*17)) - - # Badly formed fields. - badvalue(lambda: uuid.UUID(fields=(1,))) - badvalue(lambda: uuid.UUID(fields=(1, 2, 3, 4, 5))) - badvalue(lambda: uuid.UUID(fields=(1, 2, 3, 4, 5, 6, 7))) - - # Field values out of range. - badvalue(lambda: uuid.UUID(fields=(-1, 0, 0, 0, 0, 0))) - badvalue(lambda: uuid.UUID(fields=(0x100000000L, 0, 0, 0, 0, 0))) - badvalue(lambda: uuid.UUID(fields=(0, -1, 0, 0, 0, 0))) - badvalue(lambda: uuid.UUID(fields=(0, 0x10000L, 0, 0, 0, 0))) - badvalue(lambda: uuid.UUID(fields=(0, 0, -1, 0, 0, 0))) - badvalue(lambda: uuid.UUID(fields=(0, 0, 0x10000L, 0, 0, 0))) - badvalue(lambda: uuid.UUID(fields=(0, 0, 0, -1, 0, 0))) - badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0x100L, 0, 0))) - badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, -1, 0))) - badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0x100L, 0))) - badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0, -1))) - badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0, 0x1000000000000L))) - - # Version number out of range. - badvalue(lambda: uuid.UUID('00'*16, version=0)) - badvalue(lambda: uuid.UUID('00'*16, version=6)) - - # Integer value out of range. - badvalue(lambda: uuid.UUID(int=-1)) - badvalue(lambda: uuid.UUID(int=1<<128L)) - - # Must supply exactly one of hex, bytes, fields, int. - h, b, f, i = '00'*16, '\0'*16, (0, 0, 0, 0, 0, 0), 0 - uuid.UUID(h) - uuid.UUID(hex=h) - uuid.UUID(bytes=b) - uuid.UUID(bytes_le=b) - uuid.UUID(fields=f) - uuid.UUID(int=i) - - # Wrong number of arguments (positional). - badtype(lambda: uuid.UUID()) - badtype(lambda: uuid.UUID(h, b)) - badtype(lambda: uuid.UUID(h, b, b)) - badtype(lambda: uuid.UUID(h, b, b, f)) - badtype(lambda: uuid.UUID(h, b, b, f, i)) - - # Duplicate arguments. - for hh in [[], [('hex', h)]]: - for bb in [[], [('bytes', b)]]: - for bble in [[], [('bytes_le', b)]]: - for ii in [[], [('int', i)]]: - for ff in [[], [('fields', f)]]: - args = dict(hh + bb + bble + ii + ff) - if len(args) != 0: - badtype(lambda: uuid.UUID(h, **args)) - if len(args) != 1: - badtype(lambda: uuid.UUID(**args)) - - # Immutability. - u = uuid.UUID(h) - badtype(lambda: setattr(u, 'hex', h)) - badtype(lambda: setattr(u, 'bytes', b)) - badtype(lambda: setattr(u, 'bytes_le', b)) - badtype(lambda: setattr(u, 'fields', f)) - badtype(lambda: setattr(u, 'int', i)) - badtype(lambda: setattr(u, 'time_low', 0)) - badtype(lambda: setattr(u, 'time_mid', 0)) - badtype(lambda: setattr(u, 'time_hi_version', 0)) - badtype(lambda: setattr(u, 'time_hi_version', 0)) - badtype(lambda: setattr(u, 'clock_seq_hi_variant', 0)) - badtype(lambda: setattr(u, 'clock_seq_low', 0)) - badtype(lambda: setattr(u, 'node', 0)) - - def check_node(self, node, source): - individual_group_bit = (node >> 40L) & 1 - universal_local_bit = (node >> 40L) & 2 - message = "%012x doesn't look like a real MAC address" % node - self.assertEqual(individual_group_bit, 0, message) - self.assertEqual(universal_local_bit, 0, message) - self.assertNotEqual(node, 0, message) - self.assertNotEqual(node, 0xffffffffffffL, message) - self.assert_(0 <= node, message) - self.assert_(node < (1L << 48), message) - - TestUUID.source2node[source] = node - if TestUUID.last_node: - if TestUUID.last_node != node: - msg = "different sources disagree on node:\n" - for s, n in TestUUID.source2node.iteritems(): - msg += " from source %r, node was %012x\n" % (s, n) - # There's actually no reason to expect the MAC addresses - # to agree across various methods -- e.g., a box may have - # multiple network interfaces, and different ways of getting - # a MAC address may favor different HW. - ##self.fail(msg) - else: - TestUUID.last_node = node - - def test_ifconfig_getnode(self): - import sys - print >>sys.__stdout__, \ -""" WARNING: uuid._ifconfig_getnode is unreliable on many platforms. - It is disabled until the code and/or test can be fixed properly.""" - return - - import os - if os.name == 'posix': - node = uuid._ifconfig_getnode() - if node is not None: - self.check_node(node, 'ifconfig') - - def test_ipconfig_getnode(self): - import os - if os.name == 'nt': - node = uuid._ipconfig_getnode() - if node is not None: - self.check_node(node, 'ipconfig') - - def test_netbios_getnode(self): - if importable('win32wnet') and importable('netbios'): - self.check_node(uuid._netbios_getnode(), 'netbios') - - def test_random_getnode(self): - node = uuid._random_getnode() - self.assert_(0 <= node) - self.assert_(node < (1L <<48)) - - def test_unixdll_getnode(self): - import sys - print >>sys.__stdout__, \ -""" WARNING: uuid._unixdll_getnode is unreliable on many platforms. - It is disabled until the code and/or test can be fixed properly.""" - return - - import os - if importable('ctypes') and os.name == 'posix': - self.check_node(uuid._unixdll_getnode(), 'unixdll') - - def test_windll_getnode(self): - import os - if importable('ctypes') and os.name == 'nt': - self.check_node(uuid._windll_getnode(), 'windll') - - def test_getnode(self): - import sys - print >>sys.__stdout__, \ -""" WARNING: uuid.getnode is unreliable on many platforms. - It is disabled until the code and/or test can be fixed properly.""" - return - - node1 = uuid.getnode() - self.check_node(node1, "getnode1") - - # Test it again to ensure consistency. - node2 = uuid.getnode() - self.check_node(node2, "getnode2") - - self.assertEqual(node1, node2) - - def test_uuid1(self): - equal = self.assertEqual - - # Make sure uuid1() generates UUIDs that are actually version 1. - for u in [uuid.uuid1() for i in range(10)]: - equal(u.variant, uuid.RFC_4122) - equal(u.version, 1) - - # Make sure the generated UUIDs are actually unique. - uuids = {} - for u in [uuid.uuid1() for i in range(1000)]: - uuids[u] = 1 - equal(len(uuids.keys()), 1000) - - # Make sure the supplied node ID appears in the UUID. - u = uuid.uuid1(0) - equal(u.node, 0) - u = uuid.uuid1(0x123456789abc) - equal(u.node, 0x123456789abc) - u = uuid.uuid1(0xffffffffffff) - equal(u.node, 0xffffffffffff) - - # Make sure the supplied clock sequence appears in the UUID. - u = uuid.uuid1(0x123456789abc, 0) - equal(u.node, 0x123456789abc) - equal(((u.clock_seq_hi_variant & 0x3f) << 8) | u.clock_seq_low, 0) - u = uuid.uuid1(0x123456789abc, 0x1234) - equal(u.node, 0x123456789abc) - equal(((u.clock_seq_hi_variant & 0x3f) << 8) | - u.clock_seq_low, 0x1234) - u = uuid.uuid1(0x123456789abc, 0x3fff) - equal(u.node, 0x123456789abc) - equal(((u.clock_seq_hi_variant & 0x3f) << 8) | - u.clock_seq_low, 0x3fff) - - def test_uuid3(self): - equal = self.assertEqual - - # Test some known version-3 UUIDs. - for u, v in [(uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org'), - '6fa459ea-ee8a-3ca4-894e-db77e160355e'), - (uuid.uuid3(uuid.NAMESPACE_URL, 'http://python.org/'), - '9fe8e8c4-aaa8-32a9-a55c-4535a88b748d'), - (uuid.uuid3(uuid.NAMESPACE_OID, '1.3.6.1'), - 'dd1a1cef-13d5-368a-ad82-eca71acd4cd1'), - (uuid.uuid3(uuid.NAMESPACE_X500, 'c=ca'), - '658d3002-db6b-3040-a1d1-8ddd7d189a4d'), - ]: - equal(u.variant, uuid.RFC_4122) - equal(u.version, 3) - equal(u, uuid.UUID(v)) - equal(str(u), v) - - def test_uuid4(self): - equal = self.assertEqual - - # Make sure uuid4() generates UUIDs that are actually version 4. - for u in [uuid.uuid4() for i in range(10)]: - equal(u.variant, uuid.RFC_4122) - equal(u.version, 4) - - # Make sure the generated UUIDs are actually unique. - uuids = {} - for u in [uuid.uuid4() for i in range(1000)]: - uuids[u] = 1 - equal(len(uuids.keys()), 1000) - - def test_uuid5(self): - equal = self.assertEqual - - # Test some known version-5 UUIDs. - for u, v in [(uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org'), - '886313e1-3b8a-5372-9b90-0c9aee199e5d'), - (uuid.uuid5(uuid.NAMESPACE_URL, 'http://python.org/'), - '4c565f0d-3f5a-5890-b41b-20cf47701c5e'), - (uuid.uuid5(uuid.NAMESPACE_OID, '1.3.6.1'), - '1447fa61-5277-5fef-a9b3-fbc6e44f4af3'), - (uuid.uuid5(uuid.NAMESPACE_X500, 'c=ca'), - 'cc957dd1-a972-5349-98cd-874190002798'), - ]: - equal(u.variant, uuid.RFC_4122) - equal(u.version, 5) - equal(u, uuid.UUID(v)) - equal(str(u), v) - - -def test_main(): - test_support.run_unittest(TestUUID) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_wait3.py b/sys/lib/python/test/test_wait3.py deleted file mode 100644 index 9de64b21e..000000000 --- a/sys/lib/python/test/test_wait3.py +++ /dev/null @@ -1,38 +0,0 @@ -"""This test checks for correct wait3() behavior. -""" - -import os -import time -from test.fork_wait import ForkWait -from test.test_support import TestSkipped, run_unittest, reap_children - -try: - os.fork -except AttributeError: - raise TestSkipped, "os.fork not defined -- skipping test_wait3" - -try: - os.wait3 -except AttributeError: - raise TestSkipped, "os.wait3 not defined -- skipping test_wait3" - -class Wait3Test(ForkWait): - def wait_impl(self, cpid): - for i in range(10): - # wait3() shouldn't hang, but some of the buildbots seem to hang - # in the forking tests. This is an attempt to fix the problem. - spid, status, rusage = os.wait3(os.WNOHANG) - if spid == cpid: - break - time.sleep(1.0) - - self.assertEqual(spid, cpid) - self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8)) - self.assertTrue(rusage) - -def test_main(): - run_unittest(Wait3Test) - reap_children() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_wait4.py b/sys/lib/python/test/test_wait4.py deleted file mode 100644 index 9f7fc14a6..000000000 --- a/sys/lib/python/test/test_wait4.py +++ /dev/null @@ -1,37 +0,0 @@ -"""This test checks for correct wait4() behavior. -""" - -import os -import time -from test.fork_wait import ForkWait -from test.test_support import TestSkipped, run_unittest, reap_children - -try: - os.fork -except AttributeError: - raise TestSkipped, "os.fork not defined -- skipping test_wait4" - -try: - os.wait4 -except AttributeError: - raise TestSkipped, "os.wait4 not defined -- skipping test_wait4" - -class Wait4Test(ForkWait): - def wait_impl(self, cpid): - for i in range(10): - # wait4() shouldn't hang, but some of the buildbots seem to hang - # in the forking tests. This is an attempt to fix the problem. - spid, status, rusage = os.wait4(cpid, os.WNOHANG) - if spid == cpid: - break - time.sleep(1.0) - self.assertEqual(spid, cpid) - self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8)) - self.assertTrue(rusage) - -def test_main(): - run_unittest(Wait4Test) - reap_children() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_warnings.py b/sys/lib/python/test/test_warnings.py deleted file mode 100644 index a7ccb6b29..000000000 --- a/sys/lib/python/test/test_warnings.py +++ /dev/null @@ -1,105 +0,0 @@ -import warnings -import os -import unittest -from test import test_support - -# The warnings module isn't easily tested, because it relies on module -# globals to store configuration information. setUp() and tearDown() -# preserve the current settings to avoid bashing them while running tests. - -# To capture the warning messages, a replacement for showwarning() is -# used to save warning information in a global variable. - -class WarningMessage: - "Holds results of latest showwarning() call" - pass - -def showwarning(message, category, filename, lineno, file=None): - msg.message = str(message) - msg.category = category.__name__ - msg.filename = os.path.basename(filename) - msg.lineno = lineno - -class TestModule(unittest.TestCase): - - def setUp(self): - global msg - msg = WarningMessage() - self._filters = warnings.filters[:] - self._showwarning = warnings.showwarning - warnings.showwarning = showwarning - self.ignored = [w[2].__name__ for w in self._filters - if w[0]=='ignore' and w[1] is None and w[3] is None] - - def tearDown(self): - warnings.filters = self._filters[:] - warnings.showwarning = self._showwarning - - def test_warn_default_category(self): - for i in range(4): - text = 'multi %d' %i # Different text on each call - warnings.warn(text) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, 'UserWarning') - - def test_warn_specific_category(self): - text = 'None' - for category in [DeprecationWarning, FutureWarning, - PendingDeprecationWarning, RuntimeWarning, - SyntaxWarning, UserWarning, Warning]: - if category.__name__ in self.ignored: - text = 'filtered out' + category.__name__ - warnings.warn(text, category) - self.assertNotEqual(msg.message, text) - else: - text = 'unfiltered %s' % category.__name__ - warnings.warn(text, category) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, category.__name__) - - def test_filtering(self): - - warnings.filterwarnings("error", "", Warning, "", 0) - self.assertRaises(UserWarning, warnings.warn, 'convert to error') - - warnings.resetwarnings() - text = 'handle normally' - warnings.warn(text) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, 'UserWarning') - - warnings.filterwarnings("ignore", "", Warning, "", 0) - text = 'filtered out' - warnings.warn(text) - self.assertNotEqual(msg.message, text) - - warnings.resetwarnings() - warnings.filterwarnings("error", "hex*", Warning, "", 0) - self.assertRaises(UserWarning, warnings.warn, 'hex/oct') - text = 'nonmatching text' - warnings.warn(text) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, 'UserWarning') - - def test_options(self): - # Uses the private _setoption() function to test the parsing - # of command-line warning arguments - self.assertRaises(warnings._OptionError, - warnings._setoption, '1:2:3:4:5:6') - self.assertRaises(warnings._OptionError, - warnings._setoption, 'bogus::Warning') - self.assertRaises(warnings._OptionError, - warnings._setoption, 'ignore:2::4:-5') - warnings._setoption('error::Warning::0') - self.assertRaises(UserWarning, warnings.warn, 'convert to error') - - -def test_main(verbose=None): - # Obscure hack so that this test passes after reloads or repeated calls - # to test_main (regrtest -R). - if '__warningregistry__' in globals(): - del globals()['__warningregistry__'] - test_support.run_unittest(TestModule) - -if __name__ == "__main__": - test_main(verbose=True) diff --git a/sys/lib/python/test/test_wave.py b/sys/lib/python/test/test_wave.py deleted file mode 100644 index 1a6ff5c4e..000000000 --- a/sys/lib/python/test/test_wave.py +++ /dev/null @@ -1,32 +0,0 @@ -from test.test_support import TestFailed, TESTFN -import os -import wave - -def check(t, msg=None): - if not t: - raise TestFailed, msg - -nchannels = 2 -sampwidth = 2 -framerate = 8000 -nframes = 100 - -f = wave.open(TESTFN, 'wb') -f.setnchannels(nchannels) -f.setsampwidth(sampwidth) -f.setframerate(framerate) -f.setnframes(nframes) -output = '\0' * nframes * nchannels * sampwidth -f.writeframes(output) -f.close() - -f = wave.open(TESTFN, 'rb') -check(nchannels == f.getnchannels(), "nchannels") -check(sampwidth == f.getsampwidth(), "sampwidth") -check(framerate == f.getframerate(), "framerate") -check(nframes == f.getnframes(), "nframes") -input = f.readframes(nframes) -check(input == output, "data") -f.close() - -os.remove(TESTFN) diff --git a/sys/lib/python/test/test_weakref.py b/sys/lib/python/test/test_weakref.py deleted file mode 100644 index c669109f0..000000000 --- a/sys/lib/python/test/test_weakref.py +++ /dev/null @@ -1,1158 +0,0 @@ -import gc -import sys -import unittest -import UserList -import weakref - -from test import test_support - -# Used in ReferencesTestCase.test_ref_created_during_del() . -ref_from_del = None - -class C: - def method(self): - pass - - -class Callable: - bar = None - - def __call__(self, x): - self.bar = x - - -def create_function(): - def f(): pass - return f - -def create_bound_method(): - return C().method - -def create_unbound_method(): - return C.method - - -class TestBase(unittest.TestCase): - - def setUp(self): - self.cbcalled = 0 - - def callback(self, ref): - self.cbcalled += 1 - - -class ReferencesTestCase(TestBase): - - def test_basic_ref(self): - self.check_basic_ref(C) - self.check_basic_ref(create_function) - self.check_basic_ref(create_bound_method) - self.check_basic_ref(create_unbound_method) - - # Just make sure the tp_repr handler doesn't raise an exception. - # Live reference: - o = C() - wr = weakref.ref(o) - `wr` - # Dead reference: - del o - `wr` - - def test_basic_callback(self): - self.check_basic_callback(C) - self.check_basic_callback(create_function) - self.check_basic_callback(create_bound_method) - self.check_basic_callback(create_unbound_method) - - def test_multiple_callbacks(self): - o = C() - ref1 = weakref.ref(o, self.callback) - ref2 = weakref.ref(o, self.callback) - del o - self.assert_(ref1() is None, - "expected reference to be invalidated") - self.assert_(ref2() is None, - "expected reference to be invalidated") - self.assert_(self.cbcalled == 2, - "callback not called the right number of times") - - def test_multiple_selfref_callbacks(self): - # Make sure all references are invalidated before callbacks are called - # - # What's important here is that we're using the first - # reference in the callback invoked on the second reference - # (the most recently created ref is cleaned up first). This - # tests that all references to the object are invalidated - # before any of the callbacks are invoked, so that we only - # have one invocation of _weakref.c:cleanup_helper() active - # for a particular object at a time. - # - def callback(object, self=self): - self.ref() - c = C() - self.ref = weakref.ref(c, callback) - ref1 = weakref.ref(c, callback) - del c - - def test_proxy_ref(self): - o = C() - o.bar = 1 - ref1 = weakref.proxy(o, self.callback) - ref2 = weakref.proxy(o, self.callback) - del o - - def check(proxy): - proxy.bar - - self.assertRaises(weakref.ReferenceError, check, ref1) - self.assertRaises(weakref.ReferenceError, check, ref2) - self.assertRaises(weakref.ReferenceError, bool, weakref.proxy(C())) - self.assert_(self.cbcalled == 2) - - def check_basic_ref(self, factory): - o = factory() - ref = weakref.ref(o) - self.assert_(ref() is not None, - "weak reference to live object should be live") - o2 = ref() - self.assert_(o is o2, - "() should return original object if live") - - def check_basic_callback(self, factory): - self.cbcalled = 0 - o = factory() - ref = weakref.ref(o, self.callback) - del o - self.assert_(self.cbcalled == 1, - "callback did not properly set 'cbcalled'") - self.assert_(ref() is None, - "ref2 should be dead after deleting object reference") - - def test_ref_reuse(self): - o = C() - ref1 = weakref.ref(o) - # create a proxy to make sure that there's an intervening creation - # between these two; it should make no difference - proxy = weakref.proxy(o) - ref2 = weakref.ref(o) - self.assert_(ref1 is ref2, - "reference object w/out callback should be re-used") - - o = C() - proxy = weakref.proxy(o) - ref1 = weakref.ref(o) - ref2 = weakref.ref(o) - self.assert_(ref1 is ref2, - "reference object w/out callback should be re-used") - self.assert_(weakref.getweakrefcount(o) == 2, - "wrong weak ref count for object") - del proxy - self.assert_(weakref.getweakrefcount(o) == 1, - "wrong weak ref count for object after deleting proxy") - - def test_proxy_reuse(self): - o = C() - proxy1 = weakref.proxy(o) - ref = weakref.ref(o) - proxy2 = weakref.proxy(o) - self.assert_(proxy1 is proxy2, - "proxy object w/out callback should have been re-used") - - def test_basic_proxy(self): - o = C() - self.check_proxy(o, weakref.proxy(o)) - - L = UserList.UserList() - p = weakref.proxy(L) - self.failIf(p, "proxy for empty UserList should be false") - p.append(12) - self.assertEqual(len(L), 1) - self.failUnless(p, "proxy for non-empty UserList should be true") - p[:] = [2, 3] - self.assertEqual(len(L), 2) - self.assertEqual(len(p), 2) - self.failUnless(3 in p, - "proxy didn't support __contains__() properly") - p[1] = 5 - self.assertEqual(L[1], 5) - self.assertEqual(p[1], 5) - L2 = UserList.UserList(L) - p2 = weakref.proxy(L2) - self.assertEqual(p, p2) - ## self.assertEqual(repr(L2), repr(p2)) - L3 = UserList.UserList(range(10)) - p3 = weakref.proxy(L3) - self.assertEqual(L3[:], p3[:]) - self.assertEqual(L3[5:], p3[5:]) - self.assertEqual(L3[:5], p3[:5]) - self.assertEqual(L3[2:5], p3[2:5]) - - # The PyWeakref_* C API is documented as allowing either NULL or - # None as the value for the callback, where either means "no - # callback". The "no callback" ref and proxy objects are supposed - # to be shared so long as they exist by all callers so long as - # they are active. In Python 2.3.3 and earlier, this guaranttee - # was not honored, and was broken in different ways for - # PyWeakref_NewRef() and PyWeakref_NewProxy(). (Two tests.) - - def test_shared_ref_without_callback(self): - self.check_shared_without_callback(weakref.ref) - - def test_shared_proxy_without_callback(self): - self.check_shared_without_callback(weakref.proxy) - - def check_shared_without_callback(self, makeref): - o = Object(1) - p1 = makeref(o, None) - p2 = makeref(o, None) - self.assert_(p1 is p2, "both callbacks were None in the C API") - del p1, p2 - p1 = makeref(o) - p2 = makeref(o, None) - self.assert_(p1 is p2, "callbacks were NULL, None in the C API") - del p1, p2 - p1 = makeref(o) - p2 = makeref(o) - self.assert_(p1 is p2, "both callbacks were NULL in the C API") - del p1, p2 - p1 = makeref(o, None) - p2 = makeref(o) - self.assert_(p1 is p2, "callbacks were None, NULL in the C API") - - def test_callable_proxy(self): - o = Callable() - ref1 = weakref.proxy(o) - - self.check_proxy(o, ref1) - - self.assert_(type(ref1) is weakref.CallableProxyType, - "proxy is not of callable type") - ref1('twinkies!') - self.assert_(o.bar == 'twinkies!', - "call through proxy not passed through to original") - ref1(x='Splat.') - self.assert_(o.bar == 'Splat.', - "call through proxy not passed through to original") - - # expect due to too few args - self.assertRaises(TypeError, ref1) - - # expect due to too many args - self.assertRaises(TypeError, ref1, 1, 2, 3) - - def check_proxy(self, o, proxy): - o.foo = 1 - self.assert_(proxy.foo == 1, - "proxy does not reflect attribute addition") - o.foo = 2 - self.assert_(proxy.foo == 2, - "proxy does not reflect attribute modification") - del o.foo - self.assert_(not hasattr(proxy, 'foo'), - "proxy does not reflect attribute removal") - - proxy.foo = 1 - self.assert_(o.foo == 1, - "object does not reflect attribute addition via proxy") - proxy.foo = 2 - self.assert_( - o.foo == 2, - "object does not reflect attribute modification via proxy") - del proxy.foo - self.assert_(not hasattr(o, 'foo'), - "object does not reflect attribute removal via proxy") - - def test_proxy_deletion(self): - # Test clearing of SF bug #762891 - class Foo: - result = None - def __delitem__(self, accessor): - self.result = accessor - g = Foo() - f = weakref.proxy(g) - del f[0] - self.assertEqual(f.result, 0) - - def test_proxy_bool(self): - # Test clearing of SF bug #1170766 - class List(list): pass - lyst = List() - self.assertEqual(bool(weakref.proxy(lyst)), bool(lyst)) - - def test_getweakrefcount(self): - o = C() - ref1 = weakref.ref(o) - ref2 = weakref.ref(o, self.callback) - self.assert_(weakref.getweakrefcount(o) == 2, - "got wrong number of weak reference objects") - - proxy1 = weakref.proxy(o) - proxy2 = weakref.proxy(o, self.callback) - self.assert_(weakref.getweakrefcount(o) == 4, - "got wrong number of weak reference objects") - - del ref1, ref2, proxy1, proxy2 - self.assert_(weakref.getweakrefcount(o) == 0, - "weak reference objects not unlinked from" - " referent when discarded.") - - # assumes ints do not support weakrefs - self.assert_(weakref.getweakrefcount(1) == 0, - "got wrong number of weak reference objects for int") - - def test_getweakrefs(self): - o = C() - ref1 = weakref.ref(o, self.callback) - ref2 = weakref.ref(o, self.callback) - del ref1 - self.assert_(weakref.getweakrefs(o) == [ref2], - "list of refs does not match") - - o = C() - ref1 = weakref.ref(o, self.callback) - ref2 = weakref.ref(o, self.callback) - del ref2 - self.assert_(weakref.getweakrefs(o) == [ref1], - "list of refs does not match") - - del ref1 - self.assert_(weakref.getweakrefs(o) == [], - "list of refs not cleared") - - # assumes ints do not support weakrefs - self.assert_(weakref.getweakrefs(1) == [], - "list of refs does not match for int") - - def test_newstyle_number_ops(self): - class F(float): - pass - f = F(2.0) - p = weakref.proxy(f) - self.assert_(p + 1.0 == 3.0) - self.assert_(1.0 + p == 3.0) # this used to SEGV - - def test_callbacks_protected(self): - # Callbacks protected from already-set exceptions? - # Regression test for SF bug #478534. - class BogusError(Exception): - pass - data = {} - def remove(k): - del data[k] - def encapsulate(): - f = lambda : () - data[weakref.ref(f, remove)] = None - raise BogusError - try: - encapsulate() - except BogusError: - pass - else: - self.fail("exception not properly restored") - try: - encapsulate() - except BogusError: - pass - else: - self.fail("exception not properly restored") - - def test_sf_bug_840829(self): - # "weakref callbacks and gc corrupt memory" - # subtype_dealloc erroneously exposed a new-style instance - # already in the process of getting deallocated to gc, - # causing double-deallocation if the instance had a weakref - # callback that triggered gc. - # If the bug exists, there probably won't be an obvious symptom - # in a release build. In a debug build, a segfault will occur - # when the second attempt to remove the instance from the "list - # of all objects" occurs. - - import gc - - class C(object): - pass - - c = C() - wr = weakref.ref(c, lambda ignore: gc.collect()) - del c - - # There endeth the first part. It gets worse. - del wr - - c1 = C() - c1.i = C() - wr = weakref.ref(c1.i, lambda ignore: gc.collect()) - - c2 = C() - c2.c1 = c1 - del c1 # still alive because c2 points to it - - # Now when subtype_dealloc gets called on c2, it's not enough just - # that c2 is immune from gc while the weakref callbacks associated - # with c2 execute (there are none in this 2nd half of the test, btw). - # subtype_dealloc goes on to call the base classes' deallocs too, - # so any gc triggered by weakref callbacks associated with anything - # torn down by a base class dealloc can also trigger double - # deallocation of c2. - del c2 - - def test_callback_in_cycle_1(self): - import gc - - class J(object): - pass - - class II(object): - def acallback(self, ignore): - self.J - - I = II() - I.J = J - I.wr = weakref.ref(J, I.acallback) - - # Now J and II are each in a self-cycle (as all new-style class - # objects are, since their __mro__ points back to them). I holds - # both a weak reference (I.wr) and a strong reference (I.J) to class - # J. I is also in a cycle (I.wr points to a weakref that references - # I.acallback). When we del these three, they all become trash, but - # the cycles prevent any of them from getting cleaned up immediately. - # Instead they have to wait for cyclic gc to deduce that they're - # trash. - # - # gc used to call tp_clear on all of them, and the order in which - # it does that is pretty accidental. The exact order in which we - # built up these things manages to provoke gc into running tp_clear - # in just the right order (I last). Calling tp_clear on II leaves - # behind an insane class object (its __mro__ becomes NULL). Calling - # tp_clear on J breaks its self-cycle, but J doesn't get deleted - # just then because of the strong reference from I.J. Calling - # tp_clear on I starts to clear I's __dict__, and just happens to - # clear I.J first -- I.wr is still intact. That removes the last - # reference to J, which triggers the weakref callback. The callback - # tries to do "self.J", and instances of new-style classes look up - # attributes ("J") in the class dict first. The class (II) wants to - # search II.__mro__, but that's NULL. The result was a segfault in - # a release build, and an assert failure in a debug build. - del I, J, II - gc.collect() - - def test_callback_in_cycle_2(self): - import gc - - # This is just like test_callback_in_cycle_1, except that II is an - # old-style class. The symptom is different then: an instance of an - # old-style class looks in its own __dict__ first. 'J' happens to - # get cleared from I.__dict__ before 'wr', and 'J' was never in II's - # __dict__, so the attribute isn't found. The difference is that - # the old-style II doesn't have a NULL __mro__ (it doesn't have any - # __mro__), so no segfault occurs. Instead it got: - # test_callback_in_cycle_2 (__main__.ReferencesTestCase) ... - # Exception exceptions.AttributeError: - # "II instance has no attribute 'J'" in > ignored - - class J(object): - pass - - class II: - def acallback(self, ignore): - self.J - - I = II() - I.J = J - I.wr = weakref.ref(J, I.acallback) - - del I, J, II - gc.collect() - - def test_callback_in_cycle_3(self): - import gc - - # This one broke the first patch that fixed the last two. In this - # case, the objects reachable from the callback aren't also reachable - # from the object (c1) *triggering* the callback: you can get to - # c1 from c2, but not vice-versa. The result was that c2's __dict__ - # got tp_clear'ed by the time the c2.cb callback got invoked. - - class C: - def cb(self, ignore): - self.me - self.c1 - self.wr - - c1, c2 = C(), C() - - c2.me = c2 - c2.c1 = c1 - c2.wr = weakref.ref(c1, c2.cb) - - del c1, c2 - gc.collect() - - def test_callback_in_cycle_4(self): - import gc - - # Like test_callback_in_cycle_3, except c2 and c1 have different - # classes. c2's class (C) isn't reachable from c1 then, so protecting - # objects reachable from the dying object (c1) isn't enough to stop - # c2's class (C) from getting tp_clear'ed before c2.cb is invoked. - # The result was a segfault (C.__mro__ was NULL when the callback - # tried to look up self.me). - - class C(object): - def cb(self, ignore): - self.me - self.c1 - self.wr - - class D: - pass - - c1, c2 = D(), C() - - c2.me = c2 - c2.c1 = c1 - c2.wr = weakref.ref(c1, c2.cb) - - del c1, c2, C, D - gc.collect() - - def test_callback_in_cycle_resurrection(self): - import gc - - # Do something nasty in a weakref callback: resurrect objects - # from dead cycles. For this to be attempted, the weakref and - # its callback must also be part of the cyclic trash (else the - # objects reachable via the callback couldn't be in cyclic trash - # to begin with -- the callback would act like an external root). - # But gc clears trash weakrefs with callbacks early now, which - # disables the callbacks, so the callbacks shouldn't get called - # at all (and so nothing actually gets resurrected). - - alist = [] - class C(object): - def __init__(self, value): - self.attribute = value - - def acallback(self, ignore): - alist.append(self.c) - - c1, c2 = C(1), C(2) - c1.c = c2 - c2.c = c1 - c1.wr = weakref.ref(c2, c1.acallback) - c2.wr = weakref.ref(c1, c2.acallback) - - def C_went_away(ignore): - alist.append("C went away") - wr = weakref.ref(C, C_went_away) - - del c1, c2, C # make them all trash - self.assertEqual(alist, []) # del isn't enough to reclaim anything - - gc.collect() - # c1.wr and c2.wr were part of the cyclic trash, so should have - # been cleared without their callbacks executing. OTOH, the weakref - # to C is bound to a function local (wr), and wasn't trash, so that - # callback should have been invoked when C went away. - self.assertEqual(alist, ["C went away"]) - # The remaining weakref should be dead now (its callback ran). - self.assertEqual(wr(), None) - - del alist[:] - gc.collect() - self.assertEqual(alist, []) - - def test_callbacks_on_callback(self): - import gc - - # Set up weakref callbacks *on* weakref callbacks. - alist = [] - def safe_callback(ignore): - alist.append("safe_callback called") - - class C(object): - def cb(self, ignore): - alist.append("cb called") - - c, d = C(), C() - c.other = d - d.other = c - callback = c.cb - c.wr = weakref.ref(d, callback) # this won't trigger - d.wr = weakref.ref(callback, d.cb) # ditto - external_wr = weakref.ref(callback, safe_callback) # but this will - self.assert_(external_wr() is callback) - - # The weakrefs attached to c and d should get cleared, so that - # C.cb is never called. But external_wr isn't part of the cyclic - # trash, and no cyclic trash is reachable from it, so safe_callback - # should get invoked when the bound method object callback (c.cb) - # -- which is itself a callback, and also part of the cyclic trash -- - # gets reclaimed at the end of gc. - - del callback, c, d, C - self.assertEqual(alist, []) # del isn't enough to clean up cycles - gc.collect() - self.assertEqual(alist, ["safe_callback called"]) - self.assertEqual(external_wr(), None) - - del alist[:] - gc.collect() - self.assertEqual(alist, []) - - def test_gc_during_ref_creation(self): - self.check_gc_during_creation(weakref.ref) - - def test_gc_during_proxy_creation(self): - self.check_gc_during_creation(weakref.proxy) - - def check_gc_during_creation(self, makeref): - thresholds = gc.get_threshold() - gc.set_threshold(1, 1, 1) - gc.collect() - class A: - pass - - def callback(*args): - pass - - referenced = A() - - a = A() - a.a = a - a.wr = makeref(referenced) - - try: - # now make sure the object and the ref get labeled as - # cyclic trash: - a = A() - weakref.ref(referenced, callback) - - finally: - gc.set_threshold(*thresholds) - - def test_ref_created_during_del(self): - # Bug #1377858 - # A weakref created in an object's __del__() would crash the - # interpreter when the weakref was cleaned up since it would refer to - # non-existent memory. This test should not segfault the interpreter. - class Target(object): - def __del__(self): - global ref_from_del - ref_from_del = weakref.ref(self) - - w = Target() - - -class SubclassableWeakrefTestCase(unittest.TestCase): - - def test_subclass_refs(self): - class MyRef(weakref.ref): - def __init__(self, ob, callback=None, value=42): - self.value = value - super(MyRef, self).__init__(ob, callback) - def __call__(self): - self.called = True - return super(MyRef, self).__call__() - o = Object("foo") - mr = MyRef(o, value=24) - self.assert_(mr() is o) - self.assert_(mr.called) - self.assertEqual(mr.value, 24) - del o - self.assert_(mr() is None) - self.assert_(mr.called) - - def test_subclass_refs_dont_replace_standard_refs(self): - class MyRef(weakref.ref): - pass - o = Object(42) - r1 = MyRef(o) - r2 = weakref.ref(o) - self.assert_(r1 is not r2) - self.assertEqual(weakref.getweakrefs(o), [r2, r1]) - self.assertEqual(weakref.getweakrefcount(o), 2) - r3 = MyRef(o) - self.assertEqual(weakref.getweakrefcount(o), 3) - refs = weakref.getweakrefs(o) - self.assertEqual(len(refs), 3) - self.assert_(r2 is refs[0]) - self.assert_(r1 in refs[1:]) - self.assert_(r3 in refs[1:]) - - def test_subclass_refs_dont_conflate_callbacks(self): - class MyRef(weakref.ref): - pass - o = Object(42) - r1 = MyRef(o, id) - r2 = MyRef(o, str) - self.assert_(r1 is not r2) - refs = weakref.getweakrefs(o) - self.assert_(r1 in refs) - self.assert_(r2 in refs) - - def test_subclass_refs_with_slots(self): - class MyRef(weakref.ref): - __slots__ = "slot1", "slot2" - def __new__(type, ob, callback, slot1, slot2): - return weakref.ref.__new__(type, ob, callback) - def __init__(self, ob, callback, slot1, slot2): - self.slot1 = slot1 - self.slot2 = slot2 - def meth(self): - return self.slot1 + self.slot2 - o = Object(42) - r = MyRef(o, None, "abc", "def") - self.assertEqual(r.slot1, "abc") - self.assertEqual(r.slot2, "def") - self.assertEqual(r.meth(), "abcdef") - self.failIf(hasattr(r, "__dict__")) - - -class Object: - def __init__(self, arg): - self.arg = arg - def __repr__(self): - return "" % self.arg - - -class MappingTestCase(TestBase): - - COUNT = 10 - - def test_weak_values(self): - # - # This exercises d.copy(), d.items(), d[], del d[], len(d). - # - dict, objects = self.make_weak_valued_dict() - for o in objects: - self.assert_(weakref.getweakrefcount(o) == 1, - "wrong number of weak references to %r!" % o) - self.assert_(o is dict[o.arg], - "wrong object returned by weak dict!") - items1 = dict.items() - items2 = dict.copy().items() - items1.sort() - items2.sort() - self.assert_(items1 == items2, - "cloning of weak-valued dictionary did not work!") - del items1, items2 - self.assert_(len(dict) == self.COUNT) - del objects[0] - self.assert_(len(dict) == (self.COUNT - 1), - "deleting object did not cause dictionary update") - del objects, o - self.assert_(len(dict) == 0, - "deleting the values did not clear the dictionary") - # regression on SF bug #447152: - dict = weakref.WeakValueDictionary() - self.assertRaises(KeyError, dict.__getitem__, 1) - dict[2] = C() - self.assertRaises(KeyError, dict.__getitem__, 2) - - def test_weak_keys(self): - # - # This exercises d.copy(), d.items(), d[] = v, d[], del d[], - # len(d), d.has_key(). - # - dict, objects = self.make_weak_keyed_dict() - for o in objects: - self.assert_(weakref.getweakrefcount(o) == 1, - "wrong number of weak references to %r!" % o) - self.assert_(o.arg is dict[o], - "wrong object returned by weak dict!") - items1 = dict.items() - items2 = dict.copy().items() - self.assert_(set(items1) == set(items2), - "cloning of weak-keyed dictionary did not work!") - del items1, items2 - self.assert_(len(dict) == self.COUNT) - del objects[0] - self.assert_(len(dict) == (self.COUNT - 1), - "deleting object did not cause dictionary update") - del objects, o - self.assert_(len(dict) == 0, - "deleting the keys did not clear the dictionary") - o = Object(42) - dict[o] = "What is the meaning of the universe?" - self.assert_(dict.has_key(o)) - self.assert_(not dict.has_key(34)) - - def test_weak_keyed_iters(self): - dict, objects = self.make_weak_keyed_dict() - self.check_iters(dict) - - # Test keyrefs() - refs = dict.keyrefs() - self.assertEqual(len(refs), len(objects)) - objects2 = list(objects) - for wr in refs: - ob = wr() - self.assert_(dict.has_key(ob)) - self.assert_(ob in dict) - self.assertEqual(ob.arg, dict[ob]) - objects2.remove(ob) - self.assertEqual(len(objects2), 0) - - # Test iterkeyrefs() - objects2 = list(objects) - self.assertEqual(len(list(dict.iterkeyrefs())), len(objects)) - for wr in dict.iterkeyrefs(): - ob = wr() - self.assert_(dict.has_key(ob)) - self.assert_(ob in dict) - self.assertEqual(ob.arg, dict[ob]) - objects2.remove(ob) - self.assertEqual(len(objects2), 0) - - def test_weak_valued_iters(self): - dict, objects = self.make_weak_valued_dict() - self.check_iters(dict) - - # Test valuerefs() - refs = dict.valuerefs() - self.assertEqual(len(refs), len(objects)) - objects2 = list(objects) - for wr in refs: - ob = wr() - self.assertEqual(ob, dict[ob.arg]) - self.assertEqual(ob.arg, dict[ob.arg].arg) - objects2.remove(ob) - self.assertEqual(len(objects2), 0) - - # Test itervaluerefs() - objects2 = list(objects) - self.assertEqual(len(list(dict.itervaluerefs())), len(objects)) - for wr in dict.itervaluerefs(): - ob = wr() - self.assertEqual(ob, dict[ob.arg]) - self.assertEqual(ob.arg, dict[ob.arg].arg) - objects2.remove(ob) - self.assertEqual(len(objects2), 0) - - def check_iters(self, dict): - # item iterator: - items = dict.items() - for item in dict.iteritems(): - items.remove(item) - self.assert_(len(items) == 0, "iteritems() did not touch all items") - - # key iterator, via __iter__(): - keys = dict.keys() - for k in dict: - keys.remove(k) - self.assert_(len(keys) == 0, "__iter__() did not touch all keys") - - # key iterator, via iterkeys(): - keys = dict.keys() - for k in dict.iterkeys(): - keys.remove(k) - self.assert_(len(keys) == 0, "iterkeys() did not touch all keys") - - # value iterator: - values = dict.values() - for v in dict.itervalues(): - values.remove(v) - self.assert_(len(values) == 0, - "itervalues() did not touch all values") - - def test_make_weak_keyed_dict_from_dict(self): - o = Object(3) - dict = weakref.WeakKeyDictionary({o:364}) - self.assert_(dict[o] == 364) - - def test_make_weak_keyed_dict_from_weak_keyed_dict(self): - o = Object(3) - dict = weakref.WeakKeyDictionary({o:364}) - dict2 = weakref.WeakKeyDictionary(dict) - self.assert_(dict[o] == 364) - - def make_weak_keyed_dict(self): - dict = weakref.WeakKeyDictionary() - objects = map(Object, range(self.COUNT)) - for o in objects: - dict[o] = o.arg - return dict, objects - - def make_weak_valued_dict(self): - dict = weakref.WeakValueDictionary() - objects = map(Object, range(self.COUNT)) - for o in objects: - dict[o.arg] = o - return dict, objects - - def check_popitem(self, klass, key1, value1, key2, value2): - weakdict = klass() - weakdict[key1] = value1 - weakdict[key2] = value2 - self.assert_(len(weakdict) == 2) - k, v = weakdict.popitem() - self.assert_(len(weakdict) == 1) - if k is key1: - self.assert_(v is value1) - else: - self.assert_(v is value2) - k, v = weakdict.popitem() - self.assert_(len(weakdict) == 0) - if k is key1: - self.assert_(v is value1) - else: - self.assert_(v is value2) - - def test_weak_valued_dict_popitem(self): - self.check_popitem(weakref.WeakValueDictionary, - "key1", C(), "key2", C()) - - def test_weak_keyed_dict_popitem(self): - self.check_popitem(weakref.WeakKeyDictionary, - C(), "value 1", C(), "value 2") - - def check_setdefault(self, klass, key, value1, value2): - self.assert_(value1 is not value2, - "invalid test" - " -- value parameters must be distinct objects") - weakdict = klass() - o = weakdict.setdefault(key, value1) - self.assert_(o is value1) - self.assert_(weakdict.has_key(key)) - self.assert_(weakdict.get(key) is value1) - self.assert_(weakdict[key] is value1) - - o = weakdict.setdefault(key, value2) - self.assert_(o is value1) - self.assert_(weakdict.has_key(key)) - self.assert_(weakdict.get(key) is value1) - self.assert_(weakdict[key] is value1) - - def test_weak_valued_dict_setdefault(self): - self.check_setdefault(weakref.WeakValueDictionary, - "key", C(), C()) - - def test_weak_keyed_dict_setdefault(self): - self.check_setdefault(weakref.WeakKeyDictionary, - C(), "value 1", "value 2") - - def check_update(self, klass, dict): - # - # This exercises d.update(), len(d), d.keys(), d.has_key(), - # d.get(), d[]. - # - weakdict = klass() - weakdict.update(dict) - self.assert_(len(weakdict) == len(dict)) - for k in weakdict.keys(): - self.assert_(dict.has_key(k), - "mysterious new key appeared in weak dict") - v = dict.get(k) - self.assert_(v is weakdict[k]) - self.assert_(v is weakdict.get(k)) - for k in dict.keys(): - self.assert_(weakdict.has_key(k), - "original key disappeared in weak dict") - v = dict[k] - self.assert_(v is weakdict[k]) - self.assert_(v is weakdict.get(k)) - - def test_weak_valued_dict_update(self): - self.check_update(weakref.WeakValueDictionary, - {1: C(), 'a': C(), C(): C()}) - - def test_weak_keyed_dict_update(self): - self.check_update(weakref.WeakKeyDictionary, - {C(): 1, C(): 2, C(): 3}) - - def test_weak_keyed_delitem(self): - d = weakref.WeakKeyDictionary() - o1 = Object('1') - o2 = Object('2') - d[o1] = 'something' - d[o2] = 'something' - self.assert_(len(d) == 2) - del d[o1] - self.assert_(len(d) == 1) - self.assert_(d.keys() == [o2]) - - def test_weak_valued_delitem(self): - d = weakref.WeakValueDictionary() - o1 = Object('1') - o2 = Object('2') - d['something'] = o1 - d['something else'] = o2 - self.assert_(len(d) == 2) - del d['something'] - self.assert_(len(d) == 1) - self.assert_(d.items() == [('something else', o2)]) - - def test_weak_keyed_bad_delitem(self): - d = weakref.WeakKeyDictionary() - o = Object('1') - # An attempt to delete an object that isn't there should raise - # KeyError. It didn't before 2.3. - self.assertRaises(KeyError, d.__delitem__, o) - self.assertRaises(KeyError, d.__getitem__, o) - - # If a key isn't of a weakly referencable type, __getitem__ and - # __setitem__ raise TypeError. __delitem__ should too. - self.assertRaises(TypeError, d.__delitem__, 13) - self.assertRaises(TypeError, d.__getitem__, 13) - self.assertRaises(TypeError, d.__setitem__, 13, 13) - - def test_weak_keyed_cascading_deletes(self): - # SF bug 742860. For some reason, before 2.3 __delitem__ iterated - # over the keys via self.data.iterkeys(). If things vanished from - # the dict during this (or got added), that caused a RuntimeError. - - d = weakref.WeakKeyDictionary() - mutate = False - - class C(object): - def __init__(self, i): - self.value = i - def __hash__(self): - return hash(self.value) - def __eq__(self, other): - if mutate: - # Side effect that mutates the dict, by removing the - # last strong reference to a key. - del objs[-1] - return self.value == other.value - - objs = [C(i) for i in range(4)] - for o in objs: - d[o] = o.value - del o # now the only strong references to keys are in objs - # Find the order in which iterkeys sees the keys. - objs = d.keys() - # Reverse it, so that the iteration implementation of __delitem__ - # has to keep looping to find the first object we delete. - objs.reverse() - - # Turn on mutation in C.__eq__. The first time thru the loop, - # under the iterkeys() business the first comparison will delete - # the last item iterkeys() would see, and that causes a - # RuntimeError: dictionary changed size during iteration - # when the iterkeys() loop goes around to try comparing the next - # key. After this was fixed, it just deletes the last object *our* - # "for o in obj" loop would have gotten to. - mutate = True - count = 0 - for o in objs: - count += 1 - del d[o] - self.assertEqual(len(d), 0) - self.assertEqual(count, 2) - -from test import mapping_tests - -class WeakValueDictionaryTestCase(mapping_tests.BasicTestMappingProtocol): - """Check that WeakValueDictionary conforms to the mapping protocol""" - __ref = {"key1":Object(1), "key2":Object(2), "key3":Object(3)} - type2test = weakref.WeakValueDictionary - def _reference(self): - return self.__ref.copy() - -class WeakKeyDictionaryTestCase(mapping_tests.BasicTestMappingProtocol): - """Check that WeakKeyDictionary conforms to the mapping protocol""" - __ref = {Object("key1"):1, Object("key2"):2, Object("key3"):3} - type2test = weakref.WeakKeyDictionary - def _reference(self): - return self.__ref.copy() - -libreftest = """ Doctest for examples in the library reference: libweakref.tex - ->>> import weakref ->>> class Dict(dict): -... pass -... ->>> obj = Dict(red=1, green=2, blue=3) # this object is weak referencable ->>> r = weakref.ref(obj) ->>> print r() is obj -True - ->>> import weakref ->>> class Object: -... pass -... ->>> o = Object() ->>> r = weakref.ref(o) ->>> o2 = r() ->>> o is o2 -True ->>> del o, o2 ->>> print r() -None - ->>> import weakref ->>> class ExtendedRef(weakref.ref): -... def __init__(self, ob, callback=None, **annotations): -... super(ExtendedRef, self).__init__(ob, callback) -... self.__counter = 0 -... for k, v in annotations.iteritems(): -... setattr(self, k, v) -... def __call__(self): -... '''Return a pair containing the referent and the number of -... times the reference has been called. -... ''' -... ob = super(ExtendedRef, self).__call__() -... if ob is not None: -... self.__counter += 1 -... ob = (ob, self.__counter) -... return ob -... ->>> class A: # not in docs from here, just testing the ExtendedRef -... pass -... ->>> a = A() ->>> r = ExtendedRef(a, foo=1, bar="baz") ->>> r.foo -1 ->>> r.bar -'baz' ->>> r()[1] -1 ->>> r()[1] -2 ->>> r()[0] is a -True - - ->>> import weakref ->>> _id2obj_dict = weakref.WeakValueDictionary() ->>> def remember(obj): -... oid = id(obj) -... _id2obj_dict[oid] = obj -... return oid -... ->>> def id2obj(oid): -... return _id2obj_dict[oid] -... ->>> a = A() # from here, just testing ->>> a_id = remember(a) ->>> id2obj(a_id) is a -True ->>> del a ->>> try: -... id2obj(a_id) -... except KeyError: -... print 'OK' -... else: -... print 'WeakValueDictionary error' -OK - -""" - -__test__ = {'libreftest' : libreftest} - -def test_main(): - test_support.run_unittest( - ReferencesTestCase, - MappingTestCase, - WeakValueDictionaryTestCase, - WeakKeyDictionaryTestCase, - ) - test_support.run_doctest(sys.modules[__name__]) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_whichdb.py b/sys/lib/python/test/test_whichdb.py deleted file mode 100644 index f2652c167..000000000 --- a/sys/lib/python/test/test_whichdb.py +++ /dev/null @@ -1,66 +0,0 @@ -#! /usr/bin/env python -"""Test script for the whichdb module - based on test_anydbm.py -""" - -import os -import test.test_support -import unittest -import whichdb -import anydbm -import tempfile -import glob - -_fname = test.test_support.TESTFN - -def _delete_files(): - # we don't know the precise name the underlying database uses - # so we use glob to locate all names - for f in glob.glob(_fname + "*"): - try: - os.unlink(f) - except OSError: - pass - -class WhichDBTestCase(unittest.TestCase): - # Actual test methods are added to namespace - # after class definition. - def __init__(self, *args): - unittest.TestCase.__init__(self, *args) - - def tearDown(self): - _delete_files() - - def setUp(self): - _delete_files() - -for name in anydbm._names: - # we define a new test method for each - # candidate database module. - try: - mod = __import__(name) - except ImportError: - continue - - def test_whichdb_name(self, name=name, mod=mod): - # Check whether whichdb correctly guesses module name - # for databases opened with module mod. - # Try with empty files first - f = mod.open(_fname, 'c') - f.close() - self.assertEqual(name, whichdb.whichdb(_fname)) - # Now add a key - f = mod.open(_fname, 'w') - f["1"] = "1" - f.close() - self.assertEqual(name, whichdb.whichdb(_fname)) - setattr(WhichDBTestCase,"test_whichdb_%s" % name, test_whichdb_name) - -def test_main(): - try: - test.test_support.run_unittest(WhichDBTestCase) - finally: - _delete_files() - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_winreg.py b/sys/lib/python/test/test_winreg.py deleted file mode 100644 index 5830fd64f..000000000 --- a/sys/lib/python/test/test_winreg.py +++ /dev/null @@ -1,156 +0,0 @@ -# Test the windows specific win32reg module. -# Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey - -from _winreg import * -import os, sys - -from test.test_support import verify, have_unicode - -test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me" - -test_data = [ - ("Int Value", 45, REG_DWORD), - ("String Val", "A string value", REG_SZ), - ("StringExpand", "The path is %path%", REG_EXPAND_SZ), - ("Multi-string", ["Lots", "of", "string", "values"], REG_MULTI_SZ), - ("Raw Data", ("binary"+chr(0)+"data"), REG_BINARY), - ("Big String", "x"*(2**14-1), REG_SZ), - ("Big Binary", "x"*(2**14), REG_BINARY), -] -if have_unicode: - test_data+=[ - (unicode("Unicode Val"), unicode("A Unicode value"), REG_SZ,), - ("UnicodeExpand", unicode("The path is %path%"), REG_EXPAND_SZ), - ("Multi-unicode", [unicode("Lots"), unicode("of"), unicode("unicode"), unicode("values")], REG_MULTI_SZ), - ("Multi-mixed", [unicode("Unicode"), unicode("and"), "string", "values"],REG_MULTI_SZ), - ] - -def WriteTestData(root_key): - # Set the default value for this key. - SetValue(root_key, test_key_name, REG_SZ, "Default value") - key = CreateKey(root_key, test_key_name) - # Create a sub-key - sub_key = CreateKey(key, "sub_key") - # Give the sub-key some named values - - for value_name, value_data, value_type in test_data: - SetValueEx(sub_key, value_name, 0, value_type, value_data) - - # Check we wrote as many items as we thought. - nkeys, nvalues, since_mod = QueryInfoKey(key) - verify(nkeys==1, "Not the correct number of sub keys") - verify(nvalues==1, "Not the correct number of values") - nkeys, nvalues, since_mod = QueryInfoKey(sub_key) - verify(nkeys==0, "Not the correct number of sub keys") - verify(nvalues==len(test_data), "Not the correct number of values") - # Close this key this way... - # (but before we do, copy the key as an integer - this allows - # us to test that the key really gets closed). - int_sub_key = int(sub_key) - CloseKey(sub_key) - try: - QueryInfoKey(int_sub_key) - raise RuntimeError, "It appears the CloseKey() function does not close the actual key!" - except EnvironmentError: - pass - # ... and close that key that way :-) - int_key = int(key) - key.Close() - try: - QueryInfoKey(int_key) - raise RuntimeError, "It appears the key.Close() function does not close the actual key!" - except EnvironmentError: - pass - -def ReadTestData(root_key): - # Check we can get default value for this key. - val = QueryValue(root_key, test_key_name) - verify(val=="Default value", "Registry didn't give back the correct value") - - key = OpenKey(root_key, test_key_name) - # Read the sub-keys - sub_key = OpenKey(key, "sub_key") - # Check I can enumerate over the values. - index = 0 - while 1: - try: - data = EnumValue(sub_key, index) - except EnvironmentError: - break - verify(data in test_data, "Didn't read back the correct test data") - index = index + 1 - verify(index==len(test_data), "Didn't read the correct number of items") - # Check I can directly access each item - for value_name, value_data, value_type in test_data: - read_val, read_typ = QueryValueEx(sub_key, value_name) - verify(read_val==value_data and read_typ == value_type, \ - "Could not directly read the value" ) - sub_key.Close() - # Enumerate our main key. - read_val = EnumKey(key, 0) - verify(read_val == "sub_key", "Read subkey value wrong") - try: - EnumKey(key, 1) - verify(0, "Was able to get a second key when I only have one!") - except EnvironmentError: - pass - - key.Close() - -def DeleteTestData(root_key): - key = OpenKey(root_key, test_key_name, 0, KEY_ALL_ACCESS) - sub_key = OpenKey(key, "sub_key", 0, KEY_ALL_ACCESS) - # It is not necessary to delete the values before deleting - # the key (although subkeys must not exist). We delete them - # manually just to prove we can :-) - for value_name, value_data, value_type in test_data: - DeleteValue(sub_key, value_name) - - nkeys, nvalues, since_mod = QueryInfoKey(sub_key) - verify(nkeys==0 and nvalues==0, "subkey not empty before delete") - sub_key.Close() - DeleteKey(key, "sub_key") - - try: - # Shouldnt be able to delete it twice! - DeleteKey(key, "sub_key") - verify(0, "Deleting the key twice succeeded") - except EnvironmentError: - pass - key.Close() - DeleteKey(root_key, test_key_name) - # Opening should now fail! - try: - key = OpenKey(root_key, test_key_name) - verify(0, "Could open the non-existent key") - except WindowsError: # Use this error name this time - pass - -def TestAll(root_key): - WriteTestData(root_key) - ReadTestData(root_key) - DeleteTestData(root_key) - -# Test on my local machine. -TestAll(HKEY_CURRENT_USER) -print "Local registry tests worked" -try: - remote_name = sys.argv[sys.argv.index("--remote")+1] -except (IndexError, ValueError): - remote_name = None - -if remote_name is not None: - try: - remote_key = ConnectRegistry(remote_name, HKEY_CURRENT_USER) - except EnvironmentError, exc: - print "Could not connect to the remote machine -", exc.strerror - remote_key = None - if remote_key is not None: - TestAll(remote_key) - print "Remote registry tests worked" -else: - print "Remote registry calls can be tested using", - print "'test_winreg.py --remote \\\\machine_name'" - # perform minimal ConnectRegistry test which just invokes it - h = ConnectRegistry(None, HKEY_LOCAL_MACHINE) - h.Close() diff --git a/sys/lib/python/test/test_winsound.py b/sys/lib/python/test/test_winsound.py deleted file mode 100644 index 19d4459a5..000000000 --- a/sys/lib/python/test/test_winsound.py +++ /dev/null @@ -1,209 +0,0 @@ -# Ridiculously simple test of the winsound module for Windows. - -import unittest -from test import test_support -import winsound, time -import os -import subprocess - - -class BeepTest(unittest.TestCase): - - def test_errors(self): - self.assertRaises(TypeError, winsound.Beep) - self.assertRaises(ValueError, winsound.Beep, 36, 75) - self.assertRaises(ValueError, winsound.Beep, 32768, 75) - - def test_extremes(self): - winsound.Beep(37, 75) - winsound.Beep(32767, 75) - - def test_increasingfrequency(self): - for i in xrange(100, 2000, 100): - winsound.Beep(i, 75) - -class MessageBeepTest(unittest.TestCase): - - def tearDown(self): - time.sleep(0.5) - - def test_default(self): - self.assertRaises(TypeError, winsound.MessageBeep, "bad") - self.assertRaises(TypeError, winsound.MessageBeep, 42, 42) - winsound.MessageBeep() - - def test_ok(self): - winsound.MessageBeep(winsound.MB_OK) - - def test_asterisk(self): - winsound.MessageBeep(winsound.MB_ICONASTERISK) - - def test_exclamation(self): - winsound.MessageBeep(winsound.MB_ICONEXCLAMATION) - - def test_hand(self): - winsound.MessageBeep(winsound.MB_ICONHAND) - - def test_question(self): - winsound.MessageBeep(winsound.MB_ICONQUESTION) - - -class PlaySoundTest(unittest.TestCase): - - def test_errors(self): - self.assertRaises(TypeError, winsound.PlaySound) - self.assertRaises(TypeError, winsound.PlaySound, "bad", "bad") - self.assertRaises( - RuntimeError, - winsound.PlaySound, - "none", winsound.SND_ASYNC | winsound.SND_MEMORY - ) - - def test_alias_asterisk(self): - if _have_soundcard(): - winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS) - else: - self.assertRaises( - RuntimeError, - winsound.PlaySound, - 'SystemAsterisk', winsound.SND_ALIAS - ) - - def test_alias_exclamation(self): - if _have_soundcard(): - winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS) - else: - self.assertRaises( - RuntimeError, - winsound.PlaySound, - 'SystemExclamation', winsound.SND_ALIAS - ) - - def test_alias_exit(self): - if _have_soundcard(): - winsound.PlaySound('SystemExit', winsound.SND_ALIAS) - else: - self.assertRaises( - RuntimeError, - winsound.PlaySound, - 'SystemExit', winsound.SND_ALIAS - ) - - def test_alias_hand(self): - if _have_soundcard(): - winsound.PlaySound('SystemHand', winsound.SND_ALIAS) - else: - self.assertRaises( - RuntimeError, - winsound.PlaySound, - 'SystemHand', winsound.SND_ALIAS - ) - - def test_alias_question(self): - if _have_soundcard(): - winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS) - else: - self.assertRaises( - RuntimeError, - winsound.PlaySound, - 'SystemQuestion', winsound.SND_ALIAS - ) - - def test_alias_fallback(self): - # This test can't be expected to work on all systems. The MS - # PlaySound() docs say: - # - # If it cannot find the specified sound, PlaySound uses the - # default system event sound entry instead. If the function - # can find neither the system default entry nor the default - # sound, it makes no sound and returns FALSE. - # - # It's known to return FALSE on some real systems. - - # winsound.PlaySound('!"$%&/(#+*', winsound.SND_ALIAS) - return - - def test_alias_nofallback(self): - if _have_soundcard(): - # Note that this is not the same as asserting RuntimeError - # will get raised: you cannot convert this to - # self.assertRaises(...) form. The attempt may or may not - # raise RuntimeError, but it shouldn't raise anything other - # than RuntimeError, and that's all we're trying to test - # here. The MS docs aren't clear about whether the SDK - # PlaySound() with SND_ALIAS and SND_NODEFAULT will return - # True or False when the alias is unknown. On Tim's WinXP - # box today, it returns True (no exception is raised). What - # we'd really like to test is that no sound is played, but - # that requires first wiring an eardrum class into unittest - # . - try: - winsound.PlaySound( - '!"$%&/(#+*', - winsound.SND_ALIAS | winsound.SND_NODEFAULT - ) - except RuntimeError: - pass - else: - self.assertRaises( - RuntimeError, - winsound.PlaySound, - '!"$%&/(#+*', winsound.SND_ALIAS | winsound.SND_NODEFAULT - ) - - def test_stopasync(self): - if _have_soundcard(): - winsound.PlaySound( - 'SystemQuestion', - winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP - ) - time.sleep(0.5) - try: - winsound.PlaySound( - 'SystemQuestion', - winsound.SND_ALIAS | winsound.SND_NOSTOP - ) - except RuntimeError: - pass - else: # the first sound might already be finished - pass - winsound.PlaySound(None, winsound.SND_PURGE) - else: - self.assertRaises( - RuntimeError, - winsound.PlaySound, - None, winsound.SND_PURGE - ) - - -def _get_cscript_path(): - """Return the full path to cscript.exe or None.""" - for dir in os.environ.get("PATH", "").split(os.pathsep): - cscript_path = os.path.join(dir, "cscript.exe") - if os.path.exists(cscript_path): - return cscript_path - -__have_soundcard_cache = None -def _have_soundcard(): - """Return True iff this computer has a soundcard.""" - global __have_soundcard_cache - if __have_soundcard_cache is None: - cscript_path = _get_cscript_path() - if cscript_path is None: - # Could not find cscript.exe to run our VBScript helper. Default - # to True: most computers these days *do* have a soundcard. - return True - - check_script = os.path.join(os.path.dirname(__file__), - "check_soundcard.vbs") - p = subprocess.Popen([cscript_path, check_script], - stdout=subprocess.PIPE) - __have_soundcard_cache = not p.wait() - return __have_soundcard_cache - - -def test_main(): - test_support.run_unittest(BeepTest, MessageBeepTest, PlaySoundTest) - -if __name__=="__main__": - test_main() diff --git a/sys/lib/python/test/test_with.py b/sys/lib/python/test/test_with.py deleted file mode 100644 index 57505085d..000000000 --- a/sys/lib/python/test/test_with.py +++ /dev/null @@ -1,620 +0,0 @@ -#!/usr/bin/env python - -"""Unit tests for the with statement specified in PEP 343.""" - -from __future__ import with_statement - -__author__ = "Mike Bland" -__email__ = "mbland at acm dot org" - -import sys -import unittest -from collections import deque -from contextlib import GeneratorContextManager, contextmanager -from test.test_support import run_unittest - - -class MockContextManager(GeneratorContextManager): - def __init__(self, gen): - GeneratorContextManager.__init__(self, gen) - self.enter_called = False - self.exit_called = False - self.exit_args = None - - def __enter__(self): - self.enter_called = True - return GeneratorContextManager.__enter__(self) - - def __exit__(self, type, value, traceback): - self.exit_called = True - self.exit_args = (type, value, traceback) - return GeneratorContextManager.__exit__(self, type, - value, traceback) - - -def mock_contextmanager(func): - def helper(*args, **kwds): - return MockContextManager(func(*args, **kwds)) - return helper - - -class MockResource(object): - def __init__(self): - self.yielded = False - self.stopped = False - - -@mock_contextmanager -def mock_contextmanager_generator(): - mock = MockResource() - try: - mock.yielded = True - yield mock - finally: - mock.stopped = True - - -class Nested(object): - - def __init__(self, *managers): - self.managers = managers - self.entered = None - - def __enter__(self): - if self.entered is not None: - raise RuntimeError("Context is not reentrant") - self.entered = deque() - vars = [] - try: - for mgr in self.managers: - vars.append(mgr.__enter__()) - self.entered.appendleft(mgr) - except: - if not self.__exit__(*sys.exc_info()): - raise - return vars - - def __exit__(self, *exc_info): - # Behave like nested with statements - # first in, last out - # New exceptions override old ones - ex = exc_info - for mgr in self.entered: - try: - if mgr.__exit__(*ex): - ex = (None, None, None) - except: - ex = sys.exc_info() - self.entered = None - if ex is not exc_info: - raise ex[0], ex[1], ex[2] - - -class MockNested(Nested): - def __init__(self, *managers): - Nested.__init__(self, *managers) - self.enter_called = False - self.exit_called = False - self.exit_args = None - - def __enter__(self): - self.enter_called = True - return Nested.__enter__(self) - - def __exit__(self, *exc_info): - self.exit_called = True - self.exit_args = exc_info - return Nested.__exit__(self, *exc_info) - - -class FailureTestCase(unittest.TestCase): - def testNameError(self): - def fooNotDeclared(): - with foo: pass - self.assertRaises(NameError, fooNotDeclared) - - def testEnterAttributeError(self): - class LacksEnter(object): - def __exit__(self, type, value, traceback): - pass - - def fooLacksEnter(): - foo = LacksEnter() - with foo: pass - self.assertRaises(AttributeError, fooLacksEnter) - - def testExitAttributeError(self): - class LacksExit(object): - def __enter__(self): - pass - - def fooLacksExit(): - foo = LacksExit() - with foo: pass - self.assertRaises(AttributeError, fooLacksExit) - - def assertRaisesSyntaxError(self, codestr): - def shouldRaiseSyntaxError(s): - compile(s, '', 'single') - self.assertRaises(SyntaxError, shouldRaiseSyntaxError, codestr) - - def testAssignmentToNoneError(self): - self.assertRaisesSyntaxError('with mock as None:\n pass') - self.assertRaisesSyntaxError( - 'with mock as (None):\n' - ' pass') - - def testAssignmentToEmptyTupleError(self): - self.assertRaisesSyntaxError( - 'with mock as ():\n' - ' pass') - - def testAssignmentToTupleOnlyContainingNoneError(self): - self.assertRaisesSyntaxError('with mock as None,:\n pass') - self.assertRaisesSyntaxError( - 'with mock as (None,):\n' - ' pass') - - def testAssignmentToTupleContainingNoneError(self): - self.assertRaisesSyntaxError( - 'with mock as (foo, None, bar):\n' - ' pass') - - def testEnterThrows(self): - class EnterThrows(object): - def __enter__(self): - raise RuntimeError("Enter threw") - def __exit__(self, *args): - pass - - def shouldThrow(): - ct = EnterThrows() - self.foo = None - with ct as self.foo: - pass - self.assertRaises(RuntimeError, shouldThrow) - self.assertEqual(self.foo, None) - - def testExitThrows(self): - class ExitThrows(object): - def __enter__(self): - return - def __exit__(self, *args): - raise RuntimeError(42) - def shouldThrow(): - with ExitThrows(): - pass - self.assertRaises(RuntimeError, shouldThrow) - -class ContextmanagerAssertionMixin(object): - TEST_EXCEPTION = RuntimeError("test exception") - - def assertInWithManagerInvariants(self, mock_manager): - self.assertTrue(mock_manager.enter_called) - self.assertFalse(mock_manager.exit_called) - self.assertEqual(mock_manager.exit_args, None) - - def assertAfterWithManagerInvariants(self, mock_manager, exit_args): - self.assertTrue(mock_manager.enter_called) - self.assertTrue(mock_manager.exit_called) - self.assertEqual(mock_manager.exit_args, exit_args) - - def assertAfterWithManagerInvariantsNoError(self, mock_manager): - self.assertAfterWithManagerInvariants(mock_manager, - (None, None, None)) - - def assertInWithGeneratorInvariants(self, mock_generator): - self.assertTrue(mock_generator.yielded) - self.assertFalse(mock_generator.stopped) - - def assertAfterWithGeneratorInvariantsNoError(self, mock_generator): - self.assertTrue(mock_generator.yielded) - self.assertTrue(mock_generator.stopped) - - def raiseTestException(self): - raise self.TEST_EXCEPTION - - def assertAfterWithManagerInvariantsWithError(self, mock_manager): - self.assertTrue(mock_manager.enter_called) - self.assertTrue(mock_manager.exit_called) - self.assertEqual(mock_manager.exit_args[0], RuntimeError) - self.assertEqual(mock_manager.exit_args[1], self.TEST_EXCEPTION) - - def assertAfterWithGeneratorInvariantsWithError(self, mock_generator): - self.assertTrue(mock_generator.yielded) - self.assertTrue(mock_generator.stopped) - - -class NonexceptionalTestCase(unittest.TestCase, ContextmanagerAssertionMixin): - def testInlineGeneratorSyntax(self): - with mock_contextmanager_generator(): - pass - - def testUnboundGenerator(self): - mock = mock_contextmanager_generator() - with mock: - pass - self.assertAfterWithManagerInvariantsNoError(mock) - - def testInlineGeneratorBoundSyntax(self): - with mock_contextmanager_generator() as foo: - self.assertInWithGeneratorInvariants(foo) - # FIXME: In the future, we'll try to keep the bound names from leaking - self.assertAfterWithGeneratorInvariantsNoError(foo) - - def testInlineGeneratorBoundToExistingVariable(self): - foo = None - with mock_contextmanager_generator() as foo: - self.assertInWithGeneratorInvariants(foo) - self.assertAfterWithGeneratorInvariantsNoError(foo) - - def testInlineGeneratorBoundToDottedVariable(self): - with mock_contextmanager_generator() as self.foo: - self.assertInWithGeneratorInvariants(self.foo) - self.assertAfterWithGeneratorInvariantsNoError(self.foo) - - def testBoundGenerator(self): - mock = mock_contextmanager_generator() - with mock as foo: - self.assertInWithGeneratorInvariants(foo) - self.assertInWithManagerInvariants(mock) - self.assertAfterWithGeneratorInvariantsNoError(foo) - self.assertAfterWithManagerInvariantsNoError(mock) - - def testNestedSingleStatements(self): - mock_a = mock_contextmanager_generator() - with mock_a as foo: - mock_b = mock_contextmanager_generator() - with mock_b as bar: - self.assertInWithManagerInvariants(mock_a) - self.assertInWithManagerInvariants(mock_b) - self.assertInWithGeneratorInvariants(foo) - self.assertInWithGeneratorInvariants(bar) - self.assertAfterWithManagerInvariantsNoError(mock_b) - self.assertAfterWithGeneratorInvariantsNoError(bar) - self.assertInWithManagerInvariants(mock_a) - self.assertInWithGeneratorInvariants(foo) - self.assertAfterWithManagerInvariantsNoError(mock_a) - self.assertAfterWithGeneratorInvariantsNoError(foo) - - -class NestedNonexceptionalTestCase(unittest.TestCase, - ContextmanagerAssertionMixin): - def testSingleArgInlineGeneratorSyntax(self): - with Nested(mock_contextmanager_generator()): - pass - - def testSingleArgUnbound(self): - mock_contextmanager = mock_contextmanager_generator() - mock_nested = MockNested(mock_contextmanager) - with mock_nested: - self.assertInWithManagerInvariants(mock_contextmanager) - self.assertInWithManagerInvariants(mock_nested) - self.assertAfterWithManagerInvariantsNoError(mock_contextmanager) - self.assertAfterWithManagerInvariantsNoError(mock_nested) - - def testSingleArgBoundToNonTuple(self): - m = mock_contextmanager_generator() - # This will bind all the arguments to nested() into a single list - # assigned to foo. - with Nested(m) as foo: - self.assertInWithManagerInvariants(m) - self.assertAfterWithManagerInvariantsNoError(m) - - def testSingleArgBoundToSingleElementParenthesizedList(self): - m = mock_contextmanager_generator() - # This will bind all the arguments to nested() into a single list - # assigned to foo. - with Nested(m) as (foo): - self.assertInWithManagerInvariants(m) - self.assertAfterWithManagerInvariantsNoError(m) - - def testSingleArgBoundToMultipleElementTupleError(self): - def shouldThrowValueError(): - with Nested(mock_contextmanager_generator()) as (foo, bar): - pass - self.assertRaises(ValueError, shouldThrowValueError) - - def testSingleArgUnbound(self): - mock_contextmanager = mock_contextmanager_generator() - mock_nested = MockNested(mock_contextmanager) - with mock_nested: - self.assertInWithManagerInvariants(mock_contextmanager) - self.assertInWithManagerInvariants(mock_nested) - self.assertAfterWithManagerInvariantsNoError(mock_contextmanager) - self.assertAfterWithManagerInvariantsNoError(mock_nested) - - def testMultipleArgUnbound(self): - m = mock_contextmanager_generator() - n = mock_contextmanager_generator() - o = mock_contextmanager_generator() - mock_nested = MockNested(m, n, o) - with mock_nested: - self.assertInWithManagerInvariants(m) - self.assertInWithManagerInvariants(n) - self.assertInWithManagerInvariants(o) - self.assertInWithManagerInvariants(mock_nested) - self.assertAfterWithManagerInvariantsNoError(m) - self.assertAfterWithManagerInvariantsNoError(n) - self.assertAfterWithManagerInvariantsNoError(o) - self.assertAfterWithManagerInvariantsNoError(mock_nested) - - def testMultipleArgBound(self): - mock_nested = MockNested(mock_contextmanager_generator(), - mock_contextmanager_generator(), mock_contextmanager_generator()) - with mock_nested as (m, n, o): - self.assertInWithGeneratorInvariants(m) - self.assertInWithGeneratorInvariants(n) - self.assertInWithGeneratorInvariants(o) - self.assertInWithManagerInvariants(mock_nested) - self.assertAfterWithGeneratorInvariantsNoError(m) - self.assertAfterWithGeneratorInvariantsNoError(n) - self.assertAfterWithGeneratorInvariantsNoError(o) - self.assertAfterWithManagerInvariantsNoError(mock_nested) - - -class ExceptionalTestCase(unittest.TestCase, ContextmanagerAssertionMixin): - def testSingleResource(self): - cm = mock_contextmanager_generator() - def shouldThrow(): - with cm as self.resource: - self.assertInWithManagerInvariants(cm) - self.assertInWithGeneratorInvariants(self.resource) - self.raiseTestException() - self.assertRaises(RuntimeError, shouldThrow) - self.assertAfterWithManagerInvariantsWithError(cm) - self.assertAfterWithGeneratorInvariantsWithError(self.resource) - - def testNestedSingleStatements(self): - mock_a = mock_contextmanager_generator() - mock_b = mock_contextmanager_generator() - def shouldThrow(): - with mock_a as self.foo: - with mock_b as self.bar: - self.assertInWithManagerInvariants(mock_a) - self.assertInWithManagerInvariants(mock_b) - self.assertInWithGeneratorInvariants(self.foo) - self.assertInWithGeneratorInvariants(self.bar) - self.raiseTestException() - self.assertRaises(RuntimeError, shouldThrow) - self.assertAfterWithManagerInvariantsWithError(mock_a) - self.assertAfterWithManagerInvariantsWithError(mock_b) - self.assertAfterWithGeneratorInvariantsWithError(self.foo) - self.assertAfterWithGeneratorInvariantsWithError(self.bar) - - def testMultipleResourcesInSingleStatement(self): - cm_a = mock_contextmanager_generator() - cm_b = mock_contextmanager_generator() - mock_nested = MockNested(cm_a, cm_b) - def shouldThrow(): - with mock_nested as (self.resource_a, self.resource_b): - self.assertInWithManagerInvariants(cm_a) - self.assertInWithManagerInvariants(cm_b) - self.assertInWithManagerInvariants(mock_nested) - self.assertInWithGeneratorInvariants(self.resource_a) - self.assertInWithGeneratorInvariants(self.resource_b) - self.raiseTestException() - self.assertRaises(RuntimeError, shouldThrow) - self.assertAfterWithManagerInvariantsWithError(cm_a) - self.assertAfterWithManagerInvariantsWithError(cm_b) - self.assertAfterWithManagerInvariantsWithError(mock_nested) - self.assertAfterWithGeneratorInvariantsWithError(self.resource_a) - self.assertAfterWithGeneratorInvariantsWithError(self.resource_b) - - def testNestedExceptionBeforeInnerStatement(self): - mock_a = mock_contextmanager_generator() - mock_b = mock_contextmanager_generator() - self.bar = None - def shouldThrow(): - with mock_a as self.foo: - self.assertInWithManagerInvariants(mock_a) - self.assertInWithGeneratorInvariants(self.foo) - self.raiseTestException() - with mock_b as self.bar: - pass - self.assertRaises(RuntimeError, shouldThrow) - self.assertAfterWithManagerInvariantsWithError(mock_a) - self.assertAfterWithGeneratorInvariantsWithError(self.foo) - - # The inner statement stuff should never have been touched - self.assertEqual(self.bar, None) - self.assertFalse(mock_b.enter_called) - self.assertFalse(mock_b.exit_called) - self.assertEqual(mock_b.exit_args, None) - - def testNestedExceptionAfterInnerStatement(self): - mock_a = mock_contextmanager_generator() - mock_b = mock_contextmanager_generator() - def shouldThrow(): - with mock_a as self.foo: - with mock_b as self.bar: - self.assertInWithManagerInvariants(mock_a) - self.assertInWithManagerInvariants(mock_b) - self.assertInWithGeneratorInvariants(self.foo) - self.assertInWithGeneratorInvariants(self.bar) - self.raiseTestException() - self.assertRaises(RuntimeError, shouldThrow) - self.assertAfterWithManagerInvariantsWithError(mock_a) - self.assertAfterWithManagerInvariantsNoError(mock_b) - self.assertAfterWithGeneratorInvariantsWithError(self.foo) - self.assertAfterWithGeneratorInvariantsNoError(self.bar) - - def testRaisedStopIteration1(self): - @contextmanager - def cm(): - yield - - def shouldThrow(): - with cm(): - raise StopIteration("from with") - - self.assertRaises(StopIteration, shouldThrow) - - def testRaisedStopIteration2(self): - class cm(object): - def __enter__(self): - pass - def __exit__(self, type, value, traceback): - pass - - def shouldThrow(): - with cm(): - raise StopIteration("from with") - - self.assertRaises(StopIteration, shouldThrow) - - def testRaisedGeneratorExit1(self): - @contextmanager - def cm(): - yield - - def shouldThrow(): - with cm(): - raise GeneratorExit("from with") - - self.assertRaises(GeneratorExit, shouldThrow) - - def testRaisedGeneratorExit2(self): - class cm (object): - def __enter__(self): - pass - def __exit__(self, type, value, traceback): - pass - - def shouldThrow(): - with cm(): - raise GeneratorExit("from with") - - self.assertRaises(GeneratorExit, shouldThrow) - - -class NonLocalFlowControlTestCase(unittest.TestCase): - - def testWithBreak(self): - counter = 0 - while True: - counter += 1 - with mock_contextmanager_generator(): - counter += 10 - break - counter += 100 # Not reached - self.assertEqual(counter, 11) - - def testWithContinue(self): - counter = 0 - while True: - counter += 1 - if counter > 2: - break - with mock_contextmanager_generator(): - counter += 10 - continue - counter += 100 # Not reached - self.assertEqual(counter, 12) - - def testWithReturn(self): - def foo(): - counter = 0 - while True: - counter += 1 - with mock_contextmanager_generator(): - counter += 10 - return counter - counter += 100 # Not reached - self.assertEqual(foo(), 11) - - def testWithYield(self): - def gen(): - with mock_contextmanager_generator(): - yield 12 - yield 13 - x = list(gen()) - self.assertEqual(x, [12, 13]) - - def testWithRaise(self): - counter = 0 - try: - counter += 1 - with mock_contextmanager_generator(): - counter += 10 - raise RuntimeError - counter += 100 # Not reached - except RuntimeError: - self.assertEqual(counter, 11) - else: - self.fail("Didn't raise RuntimeError") - - -class AssignmentTargetTestCase(unittest.TestCase): - - def testSingleComplexTarget(self): - targets = {1: [0, 1, 2]} - with mock_contextmanager_generator() as targets[1][0]: - self.assertEqual(targets.keys(), [1]) - self.assertEqual(targets[1][0].__class__, MockResource) - with mock_contextmanager_generator() as targets.values()[0][1]: - self.assertEqual(targets.keys(), [1]) - self.assertEqual(targets[1][1].__class__, MockResource) - with mock_contextmanager_generator() as targets[2]: - keys = targets.keys() - keys.sort() - self.assertEqual(keys, [1, 2]) - class C: pass - blah = C() - with mock_contextmanager_generator() as blah.foo: - self.assertEqual(hasattr(blah, "foo"), True) - - def testMultipleComplexTargets(self): - class C: - def __enter__(self): return 1, 2, 3 - def __exit__(self, t, v, tb): pass - targets = {1: [0, 1, 2]} - with C() as (targets[1][0], targets[1][1], targets[1][2]): - self.assertEqual(targets, {1: [1, 2, 3]}) - with C() as (targets.values()[0][2], targets.values()[0][1], targets.values()[0][0]): - self.assertEqual(targets, {1: [3, 2, 1]}) - with C() as (targets[1], targets[2], targets[3]): - self.assertEqual(targets, {1: 1, 2: 2, 3: 3}) - class B: pass - blah = B() - with C() as (blah.one, blah.two, blah.three): - self.assertEqual(blah.one, 1) - self.assertEqual(blah.two, 2) - self.assertEqual(blah.three, 3) - - -class ExitSwallowsExceptionTestCase(unittest.TestCase): - - def testExitTrueSwallowsException(self): - class AfricanSwallow: - def __enter__(self): pass - def __exit__(self, t, v, tb): return True - try: - with AfricanSwallow(): - 1/0 - except ZeroDivisionError: - self.fail("ZeroDivisionError should have been swallowed") - - def testExitFalseDoesntSwallowException(self): - class EuropeanSwallow: - def __enter__(self): pass - def __exit__(self, t, v, tb): return False - try: - with EuropeanSwallow(): - 1/0 - except ZeroDivisionError: - pass - else: - self.fail("ZeroDivisionError should have been raised") - - -def test_main(): - run_unittest(FailureTestCase, NonexceptionalTestCase, - NestedNonexceptionalTestCase, ExceptionalTestCase, - NonLocalFlowControlTestCase, - AssignmentTargetTestCase, - ExitSwallowsExceptionTestCase) - - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_wsgiref.py b/sys/lib/python/test/test_wsgiref.py deleted file mode 100755 index 1ec271b81..000000000 --- a/sys/lib/python/test/test_wsgiref.py +++ /dev/null @@ -1,615 +0,0 @@ -from __future__ import nested_scopes # Backward compat for 2.1 -from unittest import TestSuite, TestCase, makeSuite -from wsgiref.util import setup_testing_defaults -from wsgiref.headers import Headers -from wsgiref.handlers import BaseHandler, BaseCGIHandler -from wsgiref import util -from wsgiref.validate import validator -from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, demo_app -from wsgiref.simple_server import make_server -from StringIO import StringIO -from SocketServer import BaseServer -import re, sys - - -class MockServer(WSGIServer): - """Non-socket HTTP server""" - - def __init__(self, server_address, RequestHandlerClass): - BaseServer.__init__(self, server_address, RequestHandlerClass) - self.server_bind() - - def server_bind(self): - host, port = self.server_address - self.server_name = host - self.server_port = port - self.setup_environ() - - -class MockHandler(WSGIRequestHandler): - """Non-socket HTTP handler""" - def setup(self): - self.connection = self.request - self.rfile, self.wfile = self.connection - - def finish(self): - pass - - - - - -def hello_app(environ,start_response): - start_response("200 OK", [ - ('Content-Type','text/plain'), - ('Date','Mon, 05 Jun 2006 18:49:54 GMT') - ]) - return ["Hello, world!"] - -def run_amock(app=hello_app, data="GET / HTTP/1.0\n\n"): - server = make_server("", 80, app, MockServer, MockHandler) - inp, out, err, olderr = StringIO(data), StringIO(), StringIO(), sys.stderr - sys.stderr = err - - try: - server.finish_request((inp,out), ("127.0.0.1",8888)) - finally: - sys.stderr = olderr - - return out.getvalue(), err.getvalue() - - - - - - - - - - - - - - - - - - - - - - - -def compare_generic_iter(make_it,match): - """Utility to compare a generic 2.1/2.2+ iterator with an iterable - - If running under Python 2.2+, this tests the iterator using iter()/next(), - as well as __getitem__. 'make_it' must be a function returning a fresh - iterator to be tested (since this may test the iterator twice).""" - - it = make_it() - n = 0 - for item in match: - if not it[n]==item: raise AssertionError - n+=1 - try: - it[n] - except IndexError: - pass - else: - raise AssertionError("Too many items from __getitem__",it) - - try: - iter, StopIteration - except NameError: - pass - else: - # Only test iter mode under 2.2+ - it = make_it() - if not iter(it) is it: raise AssertionError - for item in match: - if not it.next()==item: raise AssertionError - try: - it.next() - except StopIteration: - pass - else: - raise AssertionError("Too many items from .next()",it) - - - - - - -class IntegrationTests(TestCase): - - def check_hello(self, out, has_length=True): - self.assertEqual(out, - "HTTP/1.0 200 OK\r\n" - "Server: WSGIServer/0.1 Python/"+sys.version.split()[0]+"\r\n" - "Content-Type: text/plain\r\n" - "Date: Mon, 05 Jun 2006 18:49:54 GMT\r\n" + - (has_length and "Content-Length: 13\r\n" or "") + - "\r\n" - "Hello, world!" - ) - - def test_plain_hello(self): - out, err = run_amock() - self.check_hello(out) - - def test_validated_hello(self): - out, err = run_amock(validator(hello_app)) - # the middleware doesn't support len(), so content-length isn't there - self.check_hello(out, has_length=False) - - def test_simple_validation_error(self): - def bad_app(environ,start_response): - start_response("200 OK", ('Content-Type','text/plain')) - return ["Hello, world!"] - out, err = run_amock(validator(bad_app)) - self.failUnless(out.endswith( - "A server error occurred. Please contact the administrator." - )) - self.assertEqual( - err.splitlines()[-2], - "AssertionError: Headers (('Content-Type', 'text/plain')) must" - " be of type list: " - ) - - - - - - -class UtilityTests(TestCase): - - def checkShift(self,sn_in,pi_in,part,sn_out,pi_out): - env = {'SCRIPT_NAME':sn_in,'PATH_INFO':pi_in} - util.setup_testing_defaults(env) - self.assertEqual(util.shift_path_info(env),part) - self.assertEqual(env['PATH_INFO'],pi_out) - self.assertEqual(env['SCRIPT_NAME'],sn_out) - return env - - def checkDefault(self, key, value, alt=None): - # Check defaulting when empty - env = {} - util.setup_testing_defaults(env) - if isinstance(value,StringIO): - self.failUnless(isinstance(env[key],StringIO)) - else: - self.assertEqual(env[key],value) - - # Check existing value - env = {key:alt} - util.setup_testing_defaults(env) - self.failUnless(env[key] is alt) - - def checkCrossDefault(self,key,value,**kw): - util.setup_testing_defaults(kw) - self.assertEqual(kw[key],value) - - def checkAppURI(self,uri,**kw): - util.setup_testing_defaults(kw) - self.assertEqual(util.application_uri(kw),uri) - - def checkReqURI(self,uri,query=1,**kw): - util.setup_testing_defaults(kw) - self.assertEqual(util.request_uri(kw,query),uri) - - - - - - - def checkFW(self,text,size,match): - - def make_it(text=text,size=size): - return util.FileWrapper(StringIO(text),size) - - compare_generic_iter(make_it,match) - - it = make_it() - self.failIf(it.filelike.closed) - - for item in it: - pass - - self.failIf(it.filelike.closed) - - it.close() - self.failUnless(it.filelike.closed) - - - def testSimpleShifts(self): - self.checkShift('','/', '', '/', '') - self.checkShift('','/x', 'x', '/x', '') - self.checkShift('/','', None, '/', '') - self.checkShift('/a','/x/y', 'x', '/a/x', '/y') - self.checkShift('/a','/x/', 'x', '/a/x', '/') - - - def testNormalizedShifts(self): - self.checkShift('/a/b', '/../y', '..', '/a', '/y') - self.checkShift('', '/../y', '..', '', '/y') - self.checkShift('/a/b', '//y', 'y', '/a/b/y', '') - self.checkShift('/a/b', '//y/', 'y', '/a/b/y', '/') - self.checkShift('/a/b', '/./y', 'y', '/a/b/y', '') - self.checkShift('/a/b', '/./y/', 'y', '/a/b/y', '/') - self.checkShift('/a/b', '///./..//y/.//', '..', '/a', '/y/') - self.checkShift('/a/b', '///', '', '/a/b/', '') - self.checkShift('/a/b', '/.//', '', '/a/b/', '') - self.checkShift('/a/b', '/x//', 'x', '/a/b/x', '/') - self.checkShift('/a/b', '/.', None, '/a/b', '') - - - def testDefaults(self): - for key, value in [ - ('SERVER_NAME','127.0.0.1'), - ('SERVER_PORT', '80'), - ('SERVER_PROTOCOL','HTTP/1.0'), - ('HTTP_HOST','127.0.0.1'), - ('REQUEST_METHOD','GET'), - ('SCRIPT_NAME',''), - ('PATH_INFO','/'), - ('wsgi.version', (1,0)), - ('wsgi.run_once', 0), - ('wsgi.multithread', 0), - ('wsgi.multiprocess', 0), - ('wsgi.input', StringIO("")), - ('wsgi.errors', StringIO()), - ('wsgi.url_scheme','http'), - ]: - self.checkDefault(key,value) - - - def testCrossDefaults(self): - self.checkCrossDefault('HTTP_HOST',"foo.bar",SERVER_NAME="foo.bar") - self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="on") - self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="1") - self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="yes") - self.checkCrossDefault('wsgi.url_scheme',"http",HTTPS="foo") - self.checkCrossDefault('SERVER_PORT',"80",HTTPS="foo") - self.checkCrossDefault('SERVER_PORT',"443",HTTPS="on") - - - def testGuessScheme(self): - self.assertEqual(util.guess_scheme({}), "http") - self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http") - self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https") - self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https") - self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https") - - - - - - def testAppURIs(self): - self.checkAppURI("http://127.0.0.1/") - self.checkAppURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam") - self.checkAppURI("http://spam.example.com:2071/", - HTTP_HOST="spam.example.com:2071", SERVER_PORT="2071") - self.checkAppURI("http://spam.example.com/", - SERVER_NAME="spam.example.com") - self.checkAppURI("http://127.0.0.1/", - HTTP_HOST="127.0.0.1", SERVER_NAME="spam.example.com") - self.checkAppURI("https://127.0.0.1/", HTTPS="on") - self.checkAppURI("http://127.0.0.1:8000/", SERVER_PORT="8000", - HTTP_HOST=None) - - def testReqURIs(self): - self.checkReqURI("http://127.0.0.1/") - self.checkReqURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam") - self.checkReqURI("http://127.0.0.1/spammity/spam", - SCRIPT_NAME="/spammity", PATH_INFO="/spam") - self.checkReqURI("http://127.0.0.1/spammity/spam?say=ni", - SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni") - self.checkReqURI("http://127.0.0.1/spammity/spam", 0, - SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni") - - def testFileWrapper(self): - self.checkFW("xyz"*50, 120, ["xyz"*40,"xyz"*10]) - - def testHopByHop(self): - for hop in ( - "Connection Keep-Alive Proxy-Authenticate Proxy-Authorization " - "TE Trailers Transfer-Encoding Upgrade" - ).split(): - for alt in hop, hop.title(), hop.upper(), hop.lower(): - self.failUnless(util.is_hop_by_hop(alt)) - - # Not comprehensive, just a few random header names - for hop in ( - "Accept Cache-Control Date Pragma Trailer Via Warning" - ).split(): - for alt in hop, hop.title(), hop.upper(), hop.lower(): - self.failIf(util.is_hop_by_hop(alt)) - -class HeaderTests(TestCase): - - def testMappingInterface(self): - test = [('x','y')] - self.assertEqual(len(Headers([])),0) - self.assertEqual(len(Headers(test[:])),1) - self.assertEqual(Headers(test[:]).keys(), ['x']) - self.assertEqual(Headers(test[:]).values(), ['y']) - self.assertEqual(Headers(test[:]).items(), test) - self.failIf(Headers(test).items() is test) # must be copy! - - h=Headers([]) - del h['foo'] # should not raise an error - - h['Foo'] = 'bar' - for m in h.has_key, h.__contains__, h.get, h.get_all, h.__getitem__: - self.failUnless(m('foo')) - self.failUnless(m('Foo')) - self.failUnless(m('FOO')) - self.failIf(m('bar')) - - self.assertEqual(h['foo'],'bar') - h['foo'] = 'baz' - self.assertEqual(h['FOO'],'baz') - self.assertEqual(h.get_all('foo'),['baz']) - - self.assertEqual(h.get("foo","whee"), "baz") - self.assertEqual(h.get("zoo","whee"), "whee") - self.assertEqual(h.setdefault("foo","whee"), "baz") - self.assertEqual(h.setdefault("zoo","whee"), "whee") - self.assertEqual(h["foo"],"baz") - self.assertEqual(h["zoo"],"whee") - - def testRequireList(self): - self.assertRaises(TypeError, Headers, "foo") - - - def testExtras(self): - h = Headers([]) - self.assertEqual(str(h),'\r\n') - - h.add_header('foo','bar',baz="spam") - self.assertEqual(h['foo'], 'bar; baz="spam"') - self.assertEqual(str(h),'foo: bar; baz="spam"\r\n\r\n') - - h.add_header('Foo','bar',cheese=None) - self.assertEqual(h.get_all('foo'), - ['bar; baz="spam"', 'bar; cheese']) - - self.assertEqual(str(h), - 'foo: bar; baz="spam"\r\n' - 'Foo: bar; cheese\r\n' - '\r\n' - ) - - -class ErrorHandler(BaseCGIHandler): - """Simple handler subclass for testing BaseHandler""" - - def __init__(self,**kw): - setup_testing_defaults(kw) - BaseCGIHandler.__init__( - self, StringIO(''), StringIO(), StringIO(), kw, - multithread=True, multiprocess=True - ) - -class TestHandler(ErrorHandler): - """Simple handler subclass for testing BaseHandler, w/error passthru""" - - def handle_error(self): - raise # for testing, we want to see what's happening - - - - - - - - - - - -class HandlerTests(TestCase): - - def checkEnvironAttrs(self, handler): - env = handler.environ - for attr in [ - 'version','multithread','multiprocess','run_once','file_wrapper' - ]: - if attr=='file_wrapper' and handler.wsgi_file_wrapper is None: - continue - self.assertEqual(getattr(handler,'wsgi_'+attr),env['wsgi.'+attr]) - - def checkOSEnviron(self,handler): - empty = {}; setup_testing_defaults(empty) - env = handler.environ - from os import environ - for k,v in environ.items(): - if not empty.has_key(k): - self.assertEqual(env[k],v) - for k,v in empty.items(): - self.failUnless(env.has_key(k)) - - def testEnviron(self): - h = TestHandler(X="Y") - h.setup_environ() - self.checkEnvironAttrs(h) - self.checkOSEnviron(h) - self.assertEqual(h.environ["X"],"Y") - - def testCGIEnviron(self): - h = BaseCGIHandler(None,None,None,{}) - h.setup_environ() - for key in 'wsgi.url_scheme', 'wsgi.input', 'wsgi.errors': - self.assert_(h.environ.has_key(key)) - - def testScheme(self): - h=TestHandler(HTTPS="on"); h.setup_environ() - self.assertEqual(h.environ['wsgi.url_scheme'],'https') - h=TestHandler(); h.setup_environ() - self.assertEqual(h.environ['wsgi.url_scheme'],'http') - - - def testAbstractMethods(self): - h = BaseHandler() - for name in [ - '_flush','get_stdin','get_stderr','add_cgi_vars' - ]: - self.assertRaises(NotImplementedError, getattr(h,name)) - self.assertRaises(NotImplementedError, h._write, "test") - - - def testContentLength(self): - # Demo one reason iteration is better than write()... ;) - - def trivial_app1(e,s): - s('200 OK',[]) - return [e['wsgi.url_scheme']] - - def trivial_app2(e,s): - s('200 OK',[])(e['wsgi.url_scheme']) - return [] - - h = TestHandler() - h.run(trivial_app1) - self.assertEqual(h.stdout.getvalue(), - "Status: 200 OK\r\n" - "Content-Length: 4\r\n" - "\r\n" - "http") - - h = TestHandler() - h.run(trivial_app2) - self.assertEqual(h.stdout.getvalue(), - "Status: 200 OK\r\n" - "\r\n" - "http") - - - - - - - - def testBasicErrorOutput(self): - - def non_error_app(e,s): - s('200 OK',[]) - return [] - - def error_app(e,s): - raise AssertionError("This should be caught by handler") - - h = ErrorHandler() - h.run(non_error_app) - self.assertEqual(h.stdout.getvalue(), - "Status: 200 OK\r\n" - "Content-Length: 0\r\n" - "\r\n") - self.assertEqual(h.stderr.getvalue(),"") - - h = ErrorHandler() - h.run(error_app) - self.assertEqual(h.stdout.getvalue(), - "Status: %s\r\n" - "Content-Type: text/plain\r\n" - "Content-Length: %d\r\n" - "\r\n%s" % (h.error_status,len(h.error_body),h.error_body)) - - self.failUnless(h.stderr.getvalue().find("AssertionError")<>-1) - - def testErrorAfterOutput(self): - MSG = "Some output has been sent" - def error_app(e,s): - s("200 OK",[])(MSG) - raise AssertionError("This should be caught by handler") - - h = ErrorHandler() - h.run(error_app) - self.assertEqual(h.stdout.getvalue(), - "Status: 200 OK\r\n" - "\r\n"+MSG) - self.failUnless(h.stderr.getvalue().find("AssertionError")<>-1) - - - def testHeaderFormats(self): - - def non_error_app(e,s): - s('200 OK',[]) - return [] - - stdpat = ( - r"HTTP/%s 200 OK\r\n" - r"Date: \w{3}, [ 0123]\d \w{3} \d{4} \d\d:\d\d:\d\d GMT\r\n" - r"%s" r"Content-Length: 0\r\n" r"\r\n" - ) - shortpat = ( - "Status: 200 OK\r\n" "Content-Length: 0\r\n" "\r\n" - ) - - for ssw in "FooBar/1.0", None: - sw = ssw and "Server: %s\r\n" % ssw or "" - - for version in "1.0", "1.1": - for proto in "HTTP/0.9", "HTTP/1.0", "HTTP/1.1": - - h = TestHandler(SERVER_PROTOCOL=proto) - h.origin_server = False - h.http_version = version - h.server_software = ssw - h.run(non_error_app) - self.assertEqual(shortpat,h.stdout.getvalue()) - - h = TestHandler(SERVER_PROTOCOL=proto) - h.origin_server = True - h.http_version = version - h.server_software = ssw - h.run(non_error_app) - if proto=="HTTP/0.9": - self.assertEqual(h.stdout.getvalue(),"") - else: - self.failUnless( - re.match(stdpat%(version,sw), h.stdout.getvalue()), - (stdpat%(version,sw), h.stdout.getvalue()) - ) - -# This epilogue is needed for compatibility with the Python 2.5 regrtest module - -def test_main(): - import unittest - from test.test_support import run_suite - run_suite( - unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) - ) - -if __name__ == "__main__": - test_main() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# the above lines intentionally left blank diff --git a/sys/lib/python/test/test_xdrlib.py b/sys/lib/python/test/test_xdrlib.py deleted file mode 100644 index e9517c508..000000000 --- a/sys/lib/python/test/test_xdrlib.py +++ /dev/null @@ -1,3 +0,0 @@ -import xdrlib - -xdrlib._test() diff --git a/sys/lib/python/test/test_xml_etree.py b/sys/lib/python/test/test_xml_etree.py deleted file mode 100644 index 78adb42e1..000000000 --- a/sys/lib/python/test/test_xml_etree.py +++ /dev/null @@ -1,354 +0,0 @@ -# xml.etree test. This file contains enough tests to make sure that -# all included components work as they should. For a more extensive -# test suite, see the selftest script in the ElementTree distribution. - -import doctest, sys - -from test import test_support - -SAMPLE_XML = """ - - text - -
- subtext -
- -""" - -SAMPLE_XML_NS = """ - - text - -
- subtext -
- -""" - -def sanity(): - """ - Import sanity. - - >>> from xml.etree import ElementTree - >>> from xml.etree import ElementInclude - >>> from xml.etree import ElementPath - """ - -def check_method(method): - if not callable(method): - print method, "not callable" - -def serialize(ET, elem, encoding=None): - import StringIO - file = StringIO.StringIO() - tree = ET.ElementTree(elem) - if encoding: - tree.write(file, encoding) - else: - tree.write(file) - return file.getvalue() - -def summarize(elem): - return elem.tag - -def summarize_list(seq): - return map(summarize, seq) - -def interface(): - """ - Test element tree interface. - - >>> from xml.etree import ElementTree as ET - - >>> element = ET.Element("tag", key="value") - >>> tree = ET.ElementTree(element) - - Make sure all standard element methods exist. - - >>> check_method(element.append) - >>> check_method(element.insert) - >>> check_method(element.remove) - >>> check_method(element.getchildren) - >>> check_method(element.find) - >>> check_method(element.findall) - >>> check_method(element.findtext) - >>> check_method(element.clear) - >>> check_method(element.get) - >>> check_method(element.set) - >>> check_method(element.keys) - >>> check_method(element.items) - >>> check_method(element.getiterator) - - Basic method sanity checks. - - >>> serialize(ET, element) # 1 - '' - >>> subelement = ET.Element("subtag") - >>> element.append(subelement) - >>> serialize(ET, element) # 2 - '' - >>> element.insert(0, subelement) - >>> serialize(ET, element) # 3 - '' - >>> element.remove(subelement) - >>> serialize(ET, element) # 4 - '' - >>> element.remove(subelement) - >>> serialize(ET, element) # 5 - '' - >>> element.remove(subelement) - Traceback (most recent call last): - ValueError: list.remove(x): x not in list - >>> serialize(ET, element) # 6 - '' - """ - -def find(): - """ - Test find methods (including xpath syntax). - - >>> from xml.etree import ElementTree as ET - - >>> elem = ET.XML(SAMPLE_XML) - >>> elem.find("tag").tag - 'tag' - >>> ET.ElementTree(elem).find("tag").tag - 'tag' - >>> elem.find("section/tag").tag - 'tag' - >>> ET.ElementTree(elem).find("section/tag").tag - 'tag' - >>> elem.findtext("tag") - 'text' - >>> elem.findtext("tog") - >>> elem.findtext("tog", "default") - 'default' - >>> ET.ElementTree(elem).findtext("tag") - 'text' - >>> elem.findtext("section/tag") - 'subtext' - >>> ET.ElementTree(elem).findtext("section/tag") - 'subtext' - >>> summarize_list(elem.findall("tag")) - ['tag', 'tag'] - >>> summarize_list(elem.findall("*")) - ['tag', 'tag', 'section'] - >>> summarize_list(elem.findall(".//tag")) - ['tag', 'tag', 'tag'] - >>> summarize_list(elem.findall("section/tag")) - ['tag'] - >>> summarize_list(elem.findall("section//tag")) - ['tag'] - >>> summarize_list(elem.findall("section/*")) - ['tag'] - >>> summarize_list(elem.findall("section//*")) - ['tag'] - >>> summarize_list(elem.findall("section/.//*")) - ['tag'] - >>> summarize_list(elem.findall("*/*")) - ['tag'] - >>> summarize_list(elem.findall("*//*")) - ['tag'] - >>> summarize_list(elem.findall("*/tag")) - ['tag'] - >>> summarize_list(elem.findall("*/./tag")) - ['tag'] - >>> summarize_list(elem.findall("./tag")) - ['tag', 'tag'] - >>> summarize_list(elem.findall(".//tag")) - ['tag', 'tag', 'tag'] - >>> summarize_list(elem.findall("././tag")) - ['tag', 'tag'] - >>> summarize_list(ET.ElementTree(elem).findall("/tag")) - ['tag', 'tag'] - >>> summarize_list(ET.ElementTree(elem).findall("./tag")) - ['tag', 'tag'] - >>> elem = ET.XML(SAMPLE_XML_NS) - >>> summarize_list(elem.findall("tag")) - [] - >>> summarize_list(elem.findall("{http://effbot.org/ns}tag")) - ['{http://effbot.org/ns}tag', '{http://effbot.org/ns}tag'] - >>> summarize_list(elem.findall(".//{http://effbot.org/ns}tag")) - ['{http://effbot.org/ns}tag', '{http://effbot.org/ns}tag', '{http://effbot.org/ns}tag'] - """ - -def parseliteral(): - r""" - - >>> from xml.etree import ElementTree as ET - - >>> element = ET.XML("text") - >>> ET.ElementTree(element).write(sys.stdout) - text - >>> element = ET.fromstring("text") - >>> ET.ElementTree(element).write(sys.stdout) - text - >>> print ET.tostring(element) - text - >>> print ET.tostring(element, "ascii") - - text - >>> _, ids = ET.XMLID("text") - >>> len(ids) - 0 - >>> _, ids = ET.XMLID("text") - >>> len(ids) - 1 - >>> ids["body"].tag - 'body' - """ - - -def check_encoding(ET, encoding): - """ - >>> from xml.etree import ElementTree as ET - - >>> check_encoding(ET, "ascii") - >>> check_encoding(ET, "us-ascii") - >>> check_encoding(ET, "iso-8859-1") - >>> check_encoding(ET, "iso-8859-15") - >>> check_encoding(ET, "cp437") - >>> check_encoding(ET, "mac-roman") - """ - ET.XML("" % encoding) - - -# -# xinclude tests (samples from appendix C of the xinclude specification) - -XINCLUDE = {} - -XINCLUDE["C1.xml"] = """\ - - -

120 Mz is adequate for an average home user.

- -
-""" - -XINCLUDE["disclaimer.xml"] = """\ - - -

The opinions represented herein represent those of the individual - and should not be interpreted as official policy endorsed by this - organization.

-
-""" - -XINCLUDE["C2.xml"] = """\ - - -

This document has been accessed - times.

-
-""" - -XINCLUDE["count.txt"] = "324387" - -XINCLUDE["C3.xml"] = """\ - - -

The following is the source of the "data.xml" resource:

- -
-""" - -XINCLUDE["data.xml"] = """\ - - - - -""" - -XINCLUDE["C5.xml"] = """\ - -
- - - - Report error - - - -
-""" - -XINCLUDE["default.xml"] = """\ - - -

Example.

- -
-""" - -def xinclude_loader(href, parse="xml", encoding=None): - try: - data = XINCLUDE[href] - except KeyError: - raise IOError("resource not found") - if parse == "xml": - from xml.etree.ElementTree import XML - return XML(data) - return data - -def xinclude(): - r""" - Basic inclusion example (XInclude C.1) - - >>> from xml.etree import ElementTree as ET - >>> from xml.etree import ElementInclude - - >>> document = xinclude_loader("C1.xml") - >>> ElementInclude.include(document, xinclude_loader) - >>> print serialize(ET, document) # C1 - -

120 Mz is adequate for an average home user.

- -

The opinions represented herein represent those of the individual - and should not be interpreted as official policy endorsed by this - organization.

-
-
- - Textual inclusion example (XInclude C.2) - - >>> document = xinclude_loader("C2.xml") - >>> ElementInclude.include(document, xinclude_loader) - >>> print serialize(ET, document) # C2 - -

This document has been accessed - 324387 times.

-
- - Textual inclusion of XML example (XInclude C.3) - - >>> document = xinclude_loader("C3.xml") - >>> ElementInclude.include(document, xinclude_loader) - >>> print serialize(ET, document) # C3 - -

The following is the source of the "data.xml" resource:

- <?xml version='1.0'?> - <data> - <item><![CDATA[Brooks & Shields]]></item> - </data> - -
- - Fallback example (XInclude C.5) - Note! Fallback support is not yet implemented - - >>> document = xinclude_loader("C5.xml") - >>> ElementInclude.include(document, xinclude_loader) - Traceback (most recent call last): - IOError: resource not found - >>> # print serialize(ET, document) # C5 - - """ - -def test_main(): - from test import test_xml_etree - test_support.run_doctest(test_xml_etree, verbosity=True) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_xml_etree_c.py b/sys/lib/python/test/test_xml_etree_c.py deleted file mode 100644 index 250f79107..000000000 --- a/sys/lib/python/test/test_xml_etree_c.py +++ /dev/null @@ -1,223 +0,0 @@ -# xml.etree test for cElementTree - -import doctest, sys - -from test import test_support - -from xml.etree import cElementTree as ET - -SAMPLE_XML = """ - - text - -
- subtext -
- -""" - -SAMPLE_XML_NS = """ - - text - -
- subtext -
- -""" - -def sanity(): - """ - Import sanity. - - >>> from xml.etree import cElementTree - """ - -def check_method(method): - if not callable(method): - print method, "not callable" - -def serialize(ET, elem, encoding=None): - import StringIO - file = StringIO.StringIO() - tree = ET.ElementTree(elem) - if encoding: - tree.write(file, encoding) - else: - tree.write(file) - return file.getvalue() - -def summarize(elem): - return elem.tag - -def summarize_list(seq): - return map(summarize, seq) - -def interface(): - """ - Test element tree interface. - - >>> element = ET.Element("tag", key="value") - >>> tree = ET.ElementTree(element) - - Make sure all standard element methods exist. - - >>> check_method(element.append) - >>> check_method(element.insert) - >>> check_method(element.remove) - >>> check_method(element.getchildren) - >>> check_method(element.find) - >>> check_method(element.findall) - >>> check_method(element.findtext) - >>> check_method(element.clear) - >>> check_method(element.get) - >>> check_method(element.set) - >>> check_method(element.keys) - >>> check_method(element.items) - >>> check_method(element.getiterator) - - Basic method sanity checks. - - >>> serialize(ET, element) # 1 - '' - >>> subelement = ET.Element("subtag") - >>> element.append(subelement) - >>> serialize(ET, element) # 2 - '' - >>> element.insert(0, subelement) - >>> serialize(ET, element) # 3 - '' - >>> element.remove(subelement) - >>> serialize(ET, element) # 4 - '' - >>> element.remove(subelement) - >>> serialize(ET, element) # 5 - '' - >>> element.remove(subelement) - Traceback (most recent call last): - ValueError: list.remove(x): x not in list - >>> serialize(ET, element) # 6 - '' - """ - -def find(): - """ - Test find methods (including xpath syntax). - - >>> elem = ET.XML(SAMPLE_XML) - >>> elem.find("tag").tag - 'tag' - >>> ET.ElementTree(elem).find("tag").tag - 'tag' - >>> elem.find("section/tag").tag - 'tag' - >>> ET.ElementTree(elem).find("section/tag").tag - 'tag' - >>> elem.findtext("tag") - 'text' - >>> elem.findtext("tog") - >>> elem.findtext("tog", "default") - 'default' - >>> ET.ElementTree(elem).findtext("tag") - 'text' - >>> elem.findtext("section/tag") - 'subtext' - >>> ET.ElementTree(elem).findtext("section/tag") - 'subtext' - >>> summarize_list(elem.findall("tag")) - ['tag', 'tag'] - >>> summarize_list(elem.findall("*")) - ['tag', 'tag', 'section'] - >>> summarize_list(elem.findall(".//tag")) - ['tag', 'tag', 'tag'] - >>> summarize_list(elem.findall("section/tag")) - ['tag'] - >>> summarize_list(elem.findall("section//tag")) - ['tag'] - >>> summarize_list(elem.findall("section/*")) - ['tag'] - >>> summarize_list(elem.findall("section//*")) - ['tag'] - >>> summarize_list(elem.findall("section/.//*")) - ['tag'] - >>> summarize_list(elem.findall("*/*")) - ['tag'] - >>> summarize_list(elem.findall("*//*")) - ['tag'] - >>> summarize_list(elem.findall("*/tag")) - ['tag'] - >>> summarize_list(elem.findall("*/./tag")) - ['tag'] - >>> summarize_list(elem.findall("./tag")) - ['tag', 'tag'] - >>> summarize_list(elem.findall(".//tag")) - ['tag', 'tag', 'tag'] - >>> summarize_list(elem.findall("././tag")) - ['tag', 'tag'] - >>> summarize_list(ET.ElementTree(elem).findall("/tag")) - ['tag', 'tag'] - >>> summarize_list(ET.ElementTree(elem).findall("./tag")) - ['tag', 'tag'] - >>> elem = ET.XML(SAMPLE_XML_NS) - >>> summarize_list(elem.findall("tag")) - [] - >>> summarize_list(elem.findall("{http://effbot.org/ns}tag")) - ['{http://effbot.org/ns}tag', '{http://effbot.org/ns}tag'] - >>> summarize_list(elem.findall(".//{http://effbot.org/ns}tag")) - ['{http://effbot.org/ns}tag', '{http://effbot.org/ns}tag', '{http://effbot.org/ns}tag'] - """ - -def parseliteral(): - r""" - - >>> element = ET.XML("text") - >>> ET.ElementTree(element).write(sys.stdout) - text - >>> element = ET.fromstring("text") - >>> ET.ElementTree(element).write(sys.stdout) - text - >>> print ET.tostring(element) - text - >>> print ET.tostring(element, "ascii") - - text - >>> _, ids = ET.XMLID("text") - >>> len(ids) - 0 - >>> _, ids = ET.XMLID("text") - >>> len(ids) - 1 - >>> ids["body"].tag - 'body' - """ - -def check_encoding(encoding): - """ - >>> check_encoding("ascii") - >>> check_encoding("us-ascii") - >>> check_encoding("iso-8859-1") - >>> check_encoding("iso-8859-15") - >>> check_encoding("cp437") - >>> check_encoding("mac-roman") - """ - ET.XML( - "" % encoding - ) - -def bug_1534630(): - """ - >>> bob = ET.TreeBuilder() - >>> e = bob.data("data") - >>> e = bob.start("tag", {}) - >>> e = bob.end("tag") - >>> e = bob.close() - >>> serialize(ET, e) - '' - """ - -def test_main(): - from test import test_xml_etree_c - test_support.run_doctest(test_xml_etree_c, verbosity=True) - -if __name__ == '__main__': - test_main() diff --git a/sys/lib/python/test/test_xmllib.py b/sys/lib/python/test/test_xmllib.py deleted file mode 100644 index 0780bc95f..000000000 --- a/sys/lib/python/test/test_xmllib.py +++ /dev/null @@ -1,51 +0,0 @@ -'''Test module to thest the xmllib module. - Sjoerd Mullender -''' - -testdoc = """\ - - - - -]> -Hello, world! -""" - -nsdoc = "" - -import warnings -warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*", - DeprecationWarning, r'xmllib$') - -from test import test_support -import unittest -import xmllib - -class XMLParserTestCase(unittest.TestCase): - - def test_simple(self): - parser = xmllib.XMLParser() - for c in testdoc: - parser.feed(c) - parser.close() - - def test_default_namespace(self): - class H(xmllib.XMLParser): - def unknown_starttag(self, name, attr): - self.name, self.attr = name, attr - h=H() - h.feed(nsdoc) - h.close() - # The default namespace applies to elements... - self.assertEquals(h.name, "URI foo") - # but not to attributes - self.assertEquals(h.attr, {'attr':'val'}) - - -def test_main(): - test_support.run_unittest(XMLParserTestCase) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_xmlrpc.py b/sys/lib/python/test/test_xmlrpc.py deleted file mode 100644 index 64d8fe86b..000000000 --- a/sys/lib/python/test/test_xmlrpc.py +++ /dev/null @@ -1,155 +0,0 @@ -import datetime -import sys -import unittest -import xmlrpclib -from test import test_support - -try: - unicode -except NameError: - have_unicode = False -else: - have_unicode = True - -alist = [{'astring': 'foo@bar.baz.spam', - 'afloat': 7283.43, - 'anint': 2**20, - 'ashortlong': 2L, - 'anotherlist': ['.zyx.41'], - 'abase64': xmlrpclib.Binary("my dog has fleas"), - 'boolean': xmlrpclib.False, - 'unicode': u'\u4000\u6000\u8000', - u'ukey\u4000': 'regular value', - 'datetime1': xmlrpclib.DateTime('20050210T11:41:23'), - 'datetime2': xmlrpclib.DateTime( - (2005, 02, 10, 11, 41, 23, 0, 1, -1)), - 'datetime3': xmlrpclib.DateTime( - datetime.datetime(2005, 02, 10, 11, 41, 23)), - }] - -class XMLRPCTestCase(unittest.TestCase): - - def test_dump_load(self): - self.assertEquals(alist, - xmlrpclib.loads(xmlrpclib.dumps((alist,)))[0][0]) - - def test_dump_bare_datetime(self): - # This checks that an unwrapped datetime.date object can be handled - # by the marshalling code. This can't be done via test_dump_load() - # since with use_datetime set to 1 the unmarshaller would create - # datetime objects for the 'datetime[123]' keys as well - dt = datetime.datetime(2005, 02, 10, 11, 41, 23) - s = xmlrpclib.dumps((dt,)) - (newdt,), m = xmlrpclib.loads(s, use_datetime=1) - self.assertEquals(newdt, dt) - self.assertEquals(m, None) - - (newdt,), m = xmlrpclib.loads(s, use_datetime=0) - self.assertEquals(newdt, xmlrpclib.DateTime('20050210T11:41:23')) - - def test_dump_bare_date(self): - # This checks that an unwrapped datetime.date object can be handled - # by the marshalling code. This can't be done via test_dump_load() - # since the unmarshaller produces a datetime object - d = datetime.datetime(2005, 02, 10, 11, 41, 23).date() - s = xmlrpclib.dumps((d,)) - (newd,), m = xmlrpclib.loads(s, use_datetime=1) - self.assertEquals(newd.date(), d) - self.assertEquals(newd.time(), datetime.time(0, 0, 0)) - self.assertEquals(m, None) - - (newdt,), m = xmlrpclib.loads(s, use_datetime=0) - self.assertEquals(newdt, xmlrpclib.DateTime('20050210T00:00:00')) - - def test_dump_bare_time(self): - # This checks that an unwrapped datetime.time object can be handled - # by the marshalling code. This can't be done via test_dump_load() - # since the unmarshaller produces a datetime object - t = datetime.datetime(2005, 02, 10, 11, 41, 23).time() - s = xmlrpclib.dumps((t,)) - (newt,), m = xmlrpclib.loads(s, use_datetime=1) - today = datetime.datetime.now().date().strftime("%Y%m%d") - self.assertEquals(newt.time(), t) - self.assertEquals(newt.date(), datetime.datetime.now().date()) - self.assertEquals(m, None) - - (newdt,), m = xmlrpclib.loads(s, use_datetime=0) - self.assertEquals(newdt, xmlrpclib.DateTime('%sT11:41:23'%today)) - - def test_bug_1164912 (self): - d = xmlrpclib.DateTime() - ((new_d,), dummy) = xmlrpclib.loads(xmlrpclib.dumps((d,), - methodresponse=True)) - self.assert_(isinstance(new_d.value, str)) - - # Check that the output of dumps() is still an 8-bit string - s = xmlrpclib.dumps((new_d,), methodresponse=True) - self.assert_(isinstance(s, str)) - - def test_dump_big_long(self): - self.assertRaises(OverflowError, xmlrpclib.dumps, (2L**99,)) - - def test_dump_bad_dict(self): - self.assertRaises(TypeError, xmlrpclib.dumps, ({(1,2,3): 1},)) - - def test_dump_big_int(self): - if sys.maxint > 2L**31-1: - self.assertRaises(OverflowError, xmlrpclib.dumps, - (int(2L**34),)) - - def test_dump_none(self): - value = alist + [None] - arg1 = (alist + [None],) - strg = xmlrpclib.dumps(arg1, allow_none=True) - self.assertEquals(value, - xmlrpclib.loads(strg)[0][0]) - self.assertRaises(TypeError, xmlrpclib.dumps, (arg1,)) - - def test_default_encoding_issues(self): - # SF bug #1115989: wrong decoding in '_stringify' - utf8 = """ - - - abc \x95 - - - - - def \x96 - ghi \x97 - - - - - """ - - # sys.setdefaultencoding() normally doesn't exist after site.py is - # loaded. reload(sys) is the way to get it back. - old_encoding = sys.getdefaultencoding() - setdefaultencoding_existed = hasattr(sys, "setdefaultencoding") - reload(sys) # ugh! - sys.setdefaultencoding("iso-8859-1") - try: - (s, d), m = xmlrpclib.loads(utf8) - finally: - sys.setdefaultencoding(old_encoding) - if not setdefaultencoding_existed: - del sys.setdefaultencoding - - items = d.items() - if have_unicode: - self.assertEquals(s, u"abc \x95") - self.assert_(isinstance(s, unicode)) - self.assertEquals(items, [(u"def \x96", u"ghi \x97")]) - self.assert_(isinstance(items[0][0], unicode)) - self.assert_(isinstance(items[0][1], unicode)) - else: - self.assertEquals(s, "abc \xc2\x95") - self.assertEquals(items, [("def \xc2\x96", "ghi \xc2\x97")]) - -def test_main(): - test_support.run_unittest(XMLRPCTestCase) - - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_xpickle.py b/sys/lib/python/test/test_xpickle.py deleted file mode 100644 index 42cd0f468..000000000 --- a/sys/lib/python/test/test_xpickle.py +++ /dev/null @@ -1,44 +0,0 @@ -# test_pickle dumps and loads pickles via pickle.py. -# test_cpickle does the same, but via the cPickle module. -# This test covers the other two cases, making pickles with one module and -# loading them via the other. - -import pickle -import cPickle -import unittest - -from test import test_support -from test.pickletester import AbstractPickleTests - -class DumpCPickle_LoadPickle(AbstractPickleTests): - - error = KeyError - - def dumps(self, arg, proto=0, fast=0): - # Ignore fast - return cPickle.dumps(arg, proto) - - def loads(self, buf): - # Ignore fast - return pickle.loads(buf) - -class DumpPickle_LoadCPickle(AbstractPickleTests): - - error = cPickle.BadPickleGet - - def dumps(self, arg, proto=0, fast=0): - # Ignore fast - return pickle.dumps(arg, proto) - - def loads(self, buf): - # Ignore fast - return cPickle.loads(buf) - -def test_main(): - test_support.run_unittest( - DumpCPickle_LoadPickle, - DumpPickle_LoadCPickle - ) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_xrange.py b/sys/lib/python/test/test_xrange.py deleted file mode 100644 index eafb7fad5..000000000 --- a/sys/lib/python/test/test_xrange.py +++ /dev/null @@ -1,64 +0,0 @@ -# Python test set -- built-in functions - -import test.test_support, unittest -import sys - -import warnings -warnings.filterwarnings("ignore", "integer argument expected", - DeprecationWarning, "unittest") - -class XrangeTest(unittest.TestCase): - def test_xrange(self): - self.assertEqual(list(xrange(3)), [0, 1, 2]) - self.assertEqual(list(xrange(1, 5)), [1, 2, 3, 4]) - self.assertEqual(list(xrange(0)), []) - self.assertEqual(list(xrange(-3)), []) - self.assertEqual(list(xrange(1, 10, 3)), [1, 4, 7]) - self.assertEqual(list(xrange(5, -5, -3)), [5, 2, -1, -4]) - - a = 10 - b = 100 - c = 50 - - self.assertEqual(list(xrange(a, a+2)), [a, a+1]) - self.assertEqual(list(xrange(a+2, a, -1L)), [a+2, a+1]) - self.assertEqual(list(xrange(a+4, a, -2)), [a+4, a+2]) - - seq = list(xrange(a, b, c)) - self.assert_(a in seq) - self.assert_(b not in seq) - self.assertEqual(len(seq), 2) - - seq = list(xrange(b, a, -c)) - self.assert_(b in seq) - self.assert_(a not in seq) - self.assertEqual(len(seq), 2) - - seq = list(xrange(-a, -b, -c)) - self.assert_(-a in seq) - self.assert_(-b not in seq) - self.assertEqual(len(seq), 2) - - self.assertRaises(TypeError, xrange) - self.assertRaises(TypeError, xrange, 1, 2, 3, 4) - self.assertRaises(ValueError, xrange, 1, 2, 0) - - self.assertRaises(OverflowError, xrange, 1e100, 1e101, 1e101) - - self.assertRaises(TypeError, xrange, 0, "spam") - self.assertRaises(TypeError, xrange, 0, 42, "spam") - - self.assertEqual(len(xrange(0, sys.maxint, sys.maxint-1)), 2) - - self.assertRaises(OverflowError, xrange, -sys.maxint, sys.maxint) - self.assertRaises(OverflowError, xrange, 0, 2*sys.maxint) - - r = xrange(-sys.maxint, sys.maxint, 2) - self.assertEqual(len(r), sys.maxint) - self.assertRaises(OverflowError, xrange, -sys.maxint-1, sys.maxint, 2) - -def test_main(): - test.test_support.run_unittest(XrangeTest) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_zipfile.py b/sys/lib/python/test/test_zipfile.py deleted file mode 100644 index 54684f3bb..000000000 --- a/sys/lib/python/test/test_zipfile.py +++ /dev/null @@ -1,357 +0,0 @@ -# We can test part of the module without zlib. -try: - import zlib -except ImportError: - zlib = None - -import zipfile, os, unittest, sys, shutil - -from StringIO import StringIO -from tempfile import TemporaryFile - -from test.test_support import TESTFN, run_unittest - -TESTFN2 = TESTFN + "2" - -class TestsWithSourceFile(unittest.TestCase): - def setUp(self): - line_gen = ("Test of zipfile line %d." % i for i in range(0, 1000)) - self.data = '\n'.join(line_gen) - - # Make a source file with some lines - fp = open(TESTFN, "wb") - fp.write(self.data) - fp.close() - - def zipTest(self, f, compression): - # Create the ZIP archive - zipfp = zipfile.ZipFile(f, "w", compression) - zipfp.write(TESTFN, "another"+os.extsep+"name") - zipfp.write(TESTFN, TESTFN) - zipfp.writestr("strfile", self.data) - zipfp.close() - - # Read the ZIP archive - zipfp = zipfile.ZipFile(f, "r", compression) - self.assertEqual(zipfp.read(TESTFN), self.data) - self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data) - self.assertEqual(zipfp.read("strfile"), self.data) - - # Print the ZIP directory - fp = StringIO() - stdout = sys.stdout - try: - sys.stdout = fp - - zipfp.printdir() - finally: - sys.stdout = stdout - - directory = fp.getvalue() - lines = directory.splitlines() - self.assertEquals(len(lines), 4) # Number of files + header - - self.assert_('File Name' in lines[0]) - self.assert_('Modified' in lines[0]) - self.assert_('Size' in lines[0]) - - fn, date, time, size = lines[1].split() - self.assertEquals(fn, 'another.name') - # XXX: timestamp is not tested - self.assertEquals(size, str(len(self.data))) - - # Check the namelist - names = zipfp.namelist() - self.assertEquals(len(names), 3) - self.assert_(TESTFN in names) - self.assert_("another"+os.extsep+"name" in names) - self.assert_("strfile" in names) - - # Check infolist - infos = zipfp.infolist() - names = [ i.filename for i in infos ] - self.assertEquals(len(names), 3) - self.assert_(TESTFN in names) - self.assert_("another"+os.extsep+"name" in names) - self.assert_("strfile" in names) - for i in infos: - self.assertEquals(i.file_size, len(self.data)) - - # check getinfo - for nm in (TESTFN, "another"+os.extsep+"name", "strfile"): - info = zipfp.getinfo(nm) - self.assertEquals(info.filename, nm) - self.assertEquals(info.file_size, len(self.data)) - - # Check that testzip doesn't raise an exception - zipfp.testzip() - - - zipfp.close() - - - - - def testStored(self): - for f in (TESTFN2, TemporaryFile(), StringIO()): - self.zipTest(f, zipfile.ZIP_STORED) - - if zlib: - def testDeflated(self): - for f in (TESTFN2, TemporaryFile(), StringIO()): - self.zipTest(f, zipfile.ZIP_DEFLATED) - - def testAbsoluteArcnames(self): - zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) - zipfp.write(TESTFN, "/absolute") - zipfp.close() - - zipfp = zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_STORED) - self.assertEqual(zipfp.namelist(), ["absolute"]) - zipfp.close() - - - def tearDown(self): - os.remove(TESTFN) - os.remove(TESTFN2) - -class TestZip64InSmallFiles(unittest.TestCase): - # These tests test the ZIP64 functionality without using large files, - # see test_zipfile64 for proper tests. - - def setUp(self): - self._limit = zipfile.ZIP64_LIMIT - zipfile.ZIP64_LIMIT = 5 - - line_gen = ("Test of zipfile line %d." % i for i in range(0, 1000)) - self.data = '\n'.join(line_gen) - - # Make a source file with some lines - fp = open(TESTFN, "wb") - fp.write(self.data) - fp.close() - - def largeFileExceptionTest(self, f, compression): - zipfp = zipfile.ZipFile(f, "w", compression) - self.assertRaises(zipfile.LargeZipFile, - zipfp.write, TESTFN, "another"+os.extsep+"name") - zipfp.close() - - def largeFileExceptionTest2(self, f, compression): - zipfp = zipfile.ZipFile(f, "w", compression) - self.assertRaises(zipfile.LargeZipFile, - zipfp.writestr, "another"+os.extsep+"name", self.data) - zipfp.close() - - def testLargeFileException(self): - for f in (TESTFN2, TemporaryFile(), StringIO()): - self.largeFileExceptionTest(f, zipfile.ZIP_STORED) - self.largeFileExceptionTest2(f, zipfile.ZIP_STORED) - - def zipTest(self, f, compression): - # Create the ZIP archive - zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True) - zipfp.write(TESTFN, "another"+os.extsep+"name") - zipfp.write(TESTFN, TESTFN) - zipfp.writestr("strfile", self.data) - zipfp.close() - - # Read the ZIP archive - zipfp = zipfile.ZipFile(f, "r", compression) - self.assertEqual(zipfp.read(TESTFN), self.data) - self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data) - self.assertEqual(zipfp.read("strfile"), self.data) - - # Print the ZIP directory - fp = StringIO() - stdout = sys.stdout - try: - sys.stdout = fp - - zipfp.printdir() - finally: - sys.stdout = stdout - - directory = fp.getvalue() - lines = directory.splitlines() - self.assertEquals(len(lines), 4) # Number of files + header - - self.assert_('File Name' in lines[0]) - self.assert_('Modified' in lines[0]) - self.assert_('Size' in lines[0]) - - fn, date, time, size = lines[1].split() - self.assertEquals(fn, 'another.name') - # XXX: timestamp is not tested - self.assertEquals(size, str(len(self.data))) - - # Check the namelist - names = zipfp.namelist() - self.assertEquals(len(names), 3) - self.assert_(TESTFN in names) - self.assert_("another"+os.extsep+"name" in names) - self.assert_("strfile" in names) - - # Check infolist - infos = zipfp.infolist() - names = [ i.filename for i in infos ] - self.assertEquals(len(names), 3) - self.assert_(TESTFN in names) - self.assert_("another"+os.extsep+"name" in names) - self.assert_("strfile" in names) - for i in infos: - self.assertEquals(i.file_size, len(self.data)) - - # check getinfo - for nm in (TESTFN, "another"+os.extsep+"name", "strfile"): - info = zipfp.getinfo(nm) - self.assertEquals(info.filename, nm) - self.assertEquals(info.file_size, len(self.data)) - - # Check that testzip doesn't raise an exception - zipfp.testzip() - - - zipfp.close() - - def testStored(self): - for f in (TESTFN2, TemporaryFile(), StringIO()): - self.zipTest(f, zipfile.ZIP_STORED) - - - if zlib: - def testDeflated(self): - for f in (TESTFN2, TemporaryFile(), StringIO()): - self.zipTest(f, zipfile.ZIP_DEFLATED) - - def testAbsoluteArcnames(self): - zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED, allowZip64=True) - zipfp.write(TESTFN, "/absolute") - zipfp.close() - - zipfp = zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_STORED) - self.assertEqual(zipfp.namelist(), ["absolute"]) - zipfp.close() - - - def tearDown(self): - zipfile.ZIP64_LIMIT = self._limit - os.remove(TESTFN) - os.remove(TESTFN2) - -class PyZipFileTests(unittest.TestCase): - def testWritePyfile(self): - zipfp = zipfile.PyZipFile(TemporaryFile(), "w") - fn = __file__ - if fn.endswith('.pyc') or fn.endswith('.pyo'): - fn = fn[:-1] - - zipfp.writepy(fn) - - bn = os.path.basename(fn) - self.assert_(bn not in zipfp.namelist()) - self.assert_(bn + 'o' in zipfp.namelist() or bn + 'c' in zipfp.namelist()) - zipfp.close() - - - zipfp = zipfile.PyZipFile(TemporaryFile(), "w") - fn = __file__ - if fn.endswith('.pyc') or fn.endswith('.pyo'): - fn = fn[:-1] - - zipfp.writepy(fn, "testpackage") - - bn = "%s/%s"%("testpackage", os.path.basename(fn)) - self.assert_(bn not in zipfp.namelist()) - self.assert_(bn + 'o' in zipfp.namelist() or bn + 'c' in zipfp.namelist()) - zipfp.close() - - def testWritePythonPackage(self): - import email - packagedir = os.path.dirname(email.__file__) - - zipfp = zipfile.PyZipFile(TemporaryFile(), "w") - zipfp.writepy(packagedir) - - # Check for a couple of modules at different levels of the hieararchy - names = zipfp.namelist() - self.assert_('email/__init__.pyo' in names or 'email/__init__.pyc' in names) - self.assert_('email/mime/text.pyo' in names or 'email/mime/text.pyc' in names) - - def testWritePythonDirectory(self): - os.mkdir(TESTFN2) - try: - fp = open(os.path.join(TESTFN2, "mod1.py"), "w") - fp.write("print 42\n") - fp.close() - - fp = open(os.path.join(TESTFN2, "mod2.py"), "w") - fp.write("print 42 * 42\n") - fp.close() - - fp = open(os.path.join(TESTFN2, "mod2.txt"), "w") - fp.write("bla bla bla\n") - fp.close() - - zipfp = zipfile.PyZipFile(TemporaryFile(), "w") - zipfp.writepy(TESTFN2) - - names = zipfp.namelist() - self.assert_('mod1.pyc' in names or 'mod1.pyo' in names) - self.assert_('mod2.pyc' in names or 'mod2.pyo' in names) - self.assert_('mod2.txt' not in names) - - finally: - shutil.rmtree(TESTFN2) - - - -class OtherTests(unittest.TestCase): - def testCloseErroneousFile(self): - # This test checks that the ZipFile constructor closes the file object - # it opens if there's an error in the file. If it doesn't, the traceback - # holds a reference to the ZipFile object and, indirectly, the file object. - # On Windows, this causes the os.unlink() call to fail because the - # underlying file is still open. This is SF bug #412214. - # - fp = open(TESTFN, "w") - fp.write("this is not a legal zip file\n") - fp.close() - try: - zf = zipfile.ZipFile(TESTFN) - except zipfile.BadZipfile: - os.unlink(TESTFN) - - def testNonExistentFileRaisesIOError(self): - # make sure we don't raise an AttributeError when a partially-constructed - # ZipFile instance is finalized; this tests for regression on SF tracker - # bug #403871. - - # The bug we're testing for caused an AttributeError to be raised - # when a ZipFile instance was created for a file that did not - # exist; the .fp member was not initialized but was needed by the - # __del__() method. Since the AttributeError is in the __del__(), - # it is ignored, but the user should be sufficiently annoyed by - # the message on the output that regression will be noticed - # quickly. - self.assertRaises(IOError, zipfile.ZipFile, TESTFN) - - def testClosedZipRaisesRuntimeError(self): - # Verify that testzip() doesn't swallow inappropriate exceptions. - data = StringIO() - zipf = zipfile.ZipFile(data, mode="w") - zipf.writestr("foo.txt", "O, for a Muse of Fire!") - zipf.close() - - # This is correct; calling .read on a closed ZipFile should throw - # a RuntimeError, and so should calling .testzip. An earlier - # version of .testzip would swallow this exception (and any other) - # and report that the first file in the archive was corrupt. - self.assertRaises(RuntimeError, zipf.testzip) - -def test_main(): - run_unittest(TestsWithSourceFile, TestZip64InSmallFiles, OtherTests, PyZipFileTests) - #run_unittest(TestZip64InSmallFiles) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_zipfile64.py b/sys/lib/python/test/test_zipfile64.py deleted file mode 100644 index 449cf39d7..000000000 --- a/sys/lib/python/test/test_zipfile64.py +++ /dev/null @@ -1,101 +0,0 @@ -# Tests of the full ZIP64 functionality of zipfile -# The test_support.requires call is the only reason for keeping this separate -# from test_zipfile -from test import test_support -# XXX(nnorwitz): disable this test by looking for extra largfile resource -# which doesn't exist. This test takes over 30 minutes to run in general -# and requires more disk space than most of the buildbots. -test_support.requires( - 'extralargefile', - 'test requires loads of disk-space bytes and a long time to run' - ) - -# We can test part of the module without zlib. -try: - import zlib -except ImportError: - zlib = None - -import zipfile, os, unittest -import time -import sys - -from StringIO import StringIO -from tempfile import TemporaryFile - -from test.test_support import TESTFN, run_unittest - -TESTFN2 = TESTFN + "2" - -# How much time in seconds can pass before we print a 'Still working' message. -_PRINT_WORKING_MSG_INTERVAL = 5 * 60 - -class TestsWithSourceFile(unittest.TestCase): - def setUp(self): - # Create test data. - # xrange() is important here -- don't want to create immortal space - # for a million ints. - line_gen = ("Test of zipfile line %d." % i for i in xrange(1000000)) - self.data = '\n'.join(line_gen) - - # And write it to a file. - fp = open(TESTFN, "wb") - fp.write(self.data) - fp.close() - - def zipTest(self, f, compression): - # Create the ZIP archive. - zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True) - - # It will contain enough copies of self.data to reach about 6GB of - # raw data to store. - filecount = 6*1024**3 // len(self.data) - - next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL - for num in range(filecount): - zipfp.writestr("testfn%d" % num, self.data) - # Print still working message since this test can be really slow - if next_time <= time.time(): - next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL - print >>sys.__stdout__, ( - ' zipTest still writing %d of %d, be patient...' % - (num, filecount)) - sys.__stdout__.flush() - zipfp.close() - - # Read the ZIP archive - zipfp = zipfile.ZipFile(f, "r", compression) - for num in range(filecount): - self.assertEqual(zipfp.read("testfn%d" % num), self.data) - # Print still working message since this test can be really slow - if next_time <= time.time(): - next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL - print >>sys.__stdout__, ( - ' zipTest still reading %d of %d, be patient...' % - (num, filecount)) - sys.__stdout__.flush() - zipfp.close() - - def testStored(self): - # Try the temp file first. If we do TESTFN2 first, then it hogs - # gigabytes of disk space for the duration of the test. - for f in TemporaryFile(), TESTFN2: - self.zipTest(f, zipfile.ZIP_STORED) - - if zlib: - def testDeflated(self): - # Try the temp file first. If we do TESTFN2 first, then it hogs - # gigabytes of disk space for the duration of the test. - for f in TemporaryFile(), TESTFN2: - self.zipTest(f, zipfile.ZIP_DEFLATED) - - def tearDown(self): - for fname in TESTFN, TESTFN2: - if os.path.exists(fname): - os.remove(fname) - -def test_main(): - run_unittest(TestsWithSourceFile) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_zipimport.py b/sys/lib/python/test/test_zipimport.py deleted file mode 100644 index 4e1a845aa..000000000 --- a/sys/lib/python/test/test_zipimport.py +++ /dev/null @@ -1,429 +0,0 @@ -import sys -import os -import marshal -import imp -import struct -import time -import unittest - -import zlib # implied prerequisite -from zipfile import ZipFile, ZipInfo, ZIP_STORED, ZIP_DEFLATED -from test import test_support -from test.test_importhooks import ImportHooksBaseTestCase, test_src, test_co - -import zipimport -import linecache -import doctest -import inspect -import StringIO -from traceback import extract_tb, extract_stack, print_tb -raise_src = 'def do_raise(): raise TypeError\n' - -# so we only run testAFakeZlib once if this test is run repeatedly -# which happens when we look for ref leaks -test_imported = False - - -def make_pyc(co, mtime): - data = marshal.dumps(co) - if type(mtime) is type(0.0): - # Mac mtimes need a bit of special casing - if mtime < 0x7fffffff: - mtime = int(mtime) - else: - mtime = int(-0x100000000L + long(mtime)) - pyc = imp.get_magic() + struct.pack("", "exec"), NOW) - files = {TESTMOD + pyc_ext: (NOW, pyc), - "some.data": (NOW, "some data")} - self.doTest(pyc_ext, files, TESTMOD) - - def testImport_WithStuff(self): - # try importing from a zipfile which contains additional - # stuff at the beginning of the file - files = {TESTMOD + ".py": (NOW, test_src)} - self.doTest(".py", files, TESTMOD, - stuff="Some Stuff"*31) - - def assertModuleSource(self, module): - self.assertEqual(inspect.getsource(module), test_src) - - def testGetSource(self): - files = {TESTMOD + ".py": (NOW, test_src)} - self.doTest(".py", files, TESTMOD, call=self.assertModuleSource) - - def testGetCompiledSource(self): - pyc = make_pyc(compile(test_src, "", "exec"), NOW) - files = {TESTMOD + ".py": (NOW, test_src), - TESTMOD + pyc_ext: (NOW, pyc)} - self.doTest(pyc_ext, files, TESTMOD, call=self.assertModuleSource) - - def runDoctest(self, callback): - files = {TESTMOD + ".py": (NOW, test_src), - "xyz.txt": (NOW, ">>> log.append(True)\n")} - self.doTest(".py", files, TESTMOD, call=callback) - - def doDoctestFile(self, module): - log = [] - old_master, doctest.master = doctest.master, None - try: - doctest.testfile( - 'xyz.txt', package=module, module_relative=True, - globs=locals() - ) - finally: - doctest.master = old_master - self.assertEqual(log,[True]) - - def testDoctestFile(self): - self.runDoctest(self.doDoctestFile) - - def doDoctestSuite(self, module): - log = [] - doctest.DocFileTest( - 'xyz.txt', package=module, module_relative=True, - globs=locals() - ).run() - self.assertEqual(log,[True]) - - def testDoctestSuite(self): - self.runDoctest(self.doDoctestSuite) - - - def doTraceback(self, module): - try: - module.do_raise() - except: - tb = sys.exc_info()[2].tb_next - - f,lno,n,line = extract_tb(tb, 1)[0] - self.assertEqual(line, raise_src.strip()) - - f,lno,n,line = extract_stack(tb.tb_frame, 1)[0] - self.assertEqual(line, raise_src.strip()) - - s = StringIO.StringIO() - print_tb(tb, 1, s) - self.failUnless(s.getvalue().endswith(raise_src)) - else: - raise AssertionError("This ought to be impossible") - - def testTraceback(self): - files = {TESTMOD + ".py": (NOW, raise_src)} - self.doTest(None, files, TESTMOD, call=self.doTraceback) - - -class CompressedZipImportTestCase(UncompressedZipImportTestCase): - compression = ZIP_DEFLATED - - -class BadFileZipImportTestCase(unittest.TestCase): - def assertZipFailure(self, filename): - self.assertRaises(zipimport.ZipImportError, - zipimport.zipimporter, filename) - - def testNoFile(self): - self.assertZipFailure('AdfjdkFJKDFJjdklfjs') - - def testEmptyFilename(self): - self.assertZipFailure('') - - def testBadArgs(self): - self.assertRaises(TypeError, zipimport.zipimporter, None) - self.assertRaises(TypeError, zipimport.zipimporter, TESTMOD, kwd=None) - - def testFilenameTooLong(self): - self.assertZipFailure('A' * 33000) - - def testEmptyFile(self): - test_support.unlink(TESTMOD) - open(TESTMOD, 'w+').close() - self.assertZipFailure(TESTMOD) - - def testFileUnreadable(self): - test_support.unlink(TESTMOD) - fd = os.open(TESTMOD, os.O_CREAT, 000) - try: - os.close(fd) - self.assertZipFailure(TESTMOD) - finally: - # If we leave "the read-only bit" set on Windows, nothing can - # delete TESTMOD, and later tests suffer bogus failures. - os.chmod(TESTMOD, 0666) - test_support.unlink(TESTMOD) - - def testNotZipFile(self): - test_support.unlink(TESTMOD) - fp = open(TESTMOD, 'w+') - fp.write('a' * 22) - fp.close() - self.assertZipFailure(TESTMOD) - - # XXX: disabled until this works on Big-endian machines - def _testBogusZipFile(self): - test_support.unlink(TESTMOD) - fp = open(TESTMOD, 'w+') - fp.write(struct.pack('=I', 0x06054B50)) - fp.write('a' * 18) - fp.close() - z = zipimport.zipimporter(TESTMOD) - - try: - self.assertRaises(TypeError, z.find_module, None) - self.assertRaises(TypeError, z.load_module, None) - self.assertRaises(TypeError, z.is_package, None) - self.assertRaises(TypeError, z.get_code, None) - self.assertRaises(TypeError, z.get_data, None) - self.assertRaises(TypeError, z.get_source, None) - - error = zipimport.ZipImportError - self.assertEqual(z.find_module('abc'), None) - - self.assertRaises(error, z.load_module, 'abc') - self.assertRaises(error, z.get_code, 'abc') - self.assertRaises(IOError, z.get_data, 'abc') - self.assertRaises(error, z.get_source, 'abc') - self.assertRaises(error, z.is_package, 'abc') - finally: - zipimport._zip_directory_cache.clear() - - -def cleanup(): - # this is necessary if test is run repeated (like when finding leaks) - global test_imported - if test_imported: - zipimport._zip_directory_cache.clear() - if hasattr(UncompressedZipImportTestCase, 'testAFakeZlib'): - delattr(UncompressedZipImportTestCase, 'testAFakeZlib') - if hasattr(CompressedZipImportTestCase, 'testAFakeZlib'): - delattr(CompressedZipImportTestCase, 'testAFakeZlib') - test_imported = True - -def test_main(): - cleanup() - try: - test_support.run_unittest( - UncompressedZipImportTestCase, - CompressedZipImportTestCase, - BadFileZipImportTestCase, - ) - finally: - test_support.unlink(TESTMOD) - -if __name__ == "__main__": - test_main() diff --git a/sys/lib/python/test/test_zlib.py b/sys/lib/python/test/test_zlib.py deleted file mode 100644 index 4440942ac..000000000 --- a/sys/lib/python/test/test_zlib.py +++ /dev/null @@ -1,481 +0,0 @@ -import unittest -from test import test_support -import zlib -import random - -# print test_support.TESTFN - -def getbuf(): - # This was in the original. Avoid non-repeatable sources. - # Left here (unused) in case something wants to be done with it. - import imp - try: - t = imp.find_module('test_zlib') - file = t[0] - except ImportError: - file = open(__file__) - buf = file.read() * 8 - file.close() - return buf - - - -class ChecksumTestCase(unittest.TestCase): - # checksum test cases - def test_crc32start(self): - self.assertEqual(zlib.crc32(""), zlib.crc32("", 0)) - self.assert_(zlib.crc32("abc", 0xffffffff)) - - def test_crc32empty(self): - self.assertEqual(zlib.crc32("", 0), 0) - self.assertEqual(zlib.crc32("", 1), 1) - self.assertEqual(zlib.crc32("", 432), 432) - - def test_adler32start(self): - self.assertEqual(zlib.adler32(""), zlib.adler32("", 1)) - self.assert_(zlib.adler32("abc", 0xffffffff)) - - def test_adler32empty(self): - self.assertEqual(zlib.adler32("", 0), 0) - self.assertEqual(zlib.adler32("", 1), 1) - self.assertEqual(zlib.adler32("", 432), 432) - - def assertEqual32(self, seen, expected): - # 32-bit values masked -- checksums on 32- vs 64- bit machines - # This is important if bit 31 (0x08000000L) is set. - self.assertEqual(seen & 0x0FFFFFFFFL, expected & 0x0FFFFFFFFL) - - def test_penguins(self): - self.assertEqual32(zlib.crc32("penguin", 0), 0x0e5c1a120L) - self.assertEqual32(zlib.crc32("penguin", 1), 0x43b6aa94) - self.assertEqual32(zlib.adler32("penguin", 0), 0x0bcf02f6) - self.assertEqual32(zlib.adler32("penguin", 1), 0x0bd602f7) - - self.assertEqual(zlib.crc32("penguin"), zlib.crc32("penguin", 0)) - self.assertEqual(zlib.adler32("penguin"),zlib.adler32("penguin",1)) - - - -class ExceptionTestCase(unittest.TestCase): - # make sure we generate some expected errors - def test_bigbits(self): - # specifying total bits too large causes an error - self.assertRaises(zlib.error, - zlib.compress, 'ERROR', zlib.MAX_WBITS + 1) - - def test_badcompressobj(self): - # verify failure on building compress object with bad params - self.assertRaises(ValueError, zlib.compressobj, 1, zlib.DEFLATED, 0) - - def test_baddecompressobj(self): - # verify failure on building decompress object with bad params - self.assertRaises(ValueError, zlib.decompressobj, 0) - - - -class CompressTestCase(unittest.TestCase): - # Test compression in one go (whole message compression) - def test_speech(self): - x = zlib.compress(HAMLET_SCENE) - self.assertEqual(zlib.decompress(x), HAMLET_SCENE) - - def test_speech128(self): - # compress more data - data = HAMLET_SCENE * 128 - x = zlib.compress(data) - self.assertEqual(zlib.decompress(x), data) - - - - -class CompressObjectTestCase(unittest.TestCase): - # Test compression object - def test_pair(self): - # straightforward compress/decompress objects - data = HAMLET_SCENE * 128 - co = zlib.compressobj() - x1 = co.compress(data) - x2 = co.flush() - self.assertRaises(zlib.error, co.flush) # second flush should not work - dco = zlib.decompressobj() - y1 = dco.decompress(x1 + x2) - y2 = dco.flush() - self.assertEqual(data, y1 + y2) - - def test_compressoptions(self): - # specify lots of options to compressobj() - level = 2 - method = zlib.DEFLATED - wbits = -12 - memlevel = 9 - strategy = zlib.Z_FILTERED - co = zlib.compressobj(level, method, wbits, memlevel, strategy) - x1 = co.compress(HAMLET_SCENE) - x2 = co.flush() - dco = zlib.decompressobj(wbits) - y1 = dco.decompress(x1 + x2) - y2 = dco.flush() - self.assertEqual(HAMLET_SCENE, y1 + y2) - - def test_compressincremental(self): - # compress object in steps, decompress object as one-shot - data = HAMLET_SCENE * 128 - co = zlib.compressobj() - bufs = [] - for i in range(0, len(data), 256): - bufs.append(co.compress(data[i:i+256])) - bufs.append(co.flush()) - combuf = ''.join(bufs) - - dco = zlib.decompressobj() - y1 = dco.decompress(''.join(bufs)) - y2 = dco.flush() - self.assertEqual(data, y1 + y2) - - def test_decompinc(self, flush=False, source=None, cx=256, dcx=64): - # compress object in steps, decompress object in steps - source = source or HAMLET_SCENE - data = source * 128 - co = zlib.compressobj() - bufs = [] - for i in range(0, len(data), cx): - bufs.append(co.compress(data[i:i+cx])) - bufs.append(co.flush()) - combuf = ''.join(bufs) - - self.assertEqual(data, zlib.decompress(combuf)) - - dco = zlib.decompressobj() - bufs = [] - for i in range(0, len(combuf), dcx): - bufs.append(dco.decompress(combuf[i:i+dcx])) - self.assertEqual('', dco.unconsumed_tail, ######## - "(A) uct should be '': not %d long" % - len(dco.unconsumed_tail)) - if flush: - bufs.append(dco.flush()) - else: - while True: - chunk = dco.decompress('') - if chunk: - bufs.append(chunk) - else: - break - self.assertEqual('', dco.unconsumed_tail, ######## - "(B) uct should be '': not %d long" % - len(dco.unconsumed_tail)) - self.assertEqual(data, ''.join(bufs)) - # Failure means: "decompressobj with init options failed" - - def test_decompincflush(self): - self.test_decompinc(flush=True) - - def test_decompimax(self, source=None, cx=256, dcx=64): - # compress in steps, decompress in length-restricted steps - source = source or HAMLET_SCENE - # Check a decompression object with max_length specified - data = source * 128 - co = zlib.compressobj() - bufs = [] - for i in range(0, len(data), cx): - bufs.append(co.compress(data[i:i+cx])) - bufs.append(co.flush()) - combuf = ''.join(bufs) - self.assertEqual(data, zlib.decompress(combuf), - 'compressed data failure') - - dco = zlib.decompressobj() - bufs = [] - cb = combuf - while cb: - #max_length = 1 + len(cb)//10 - chunk = dco.decompress(cb, dcx) - self.failIf(len(chunk) > dcx, - 'chunk too big (%d>%d)' % (len(chunk), dcx)) - bufs.append(chunk) - cb = dco.unconsumed_tail - bufs.append(dco.flush()) - self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved') - - def test_decompressmaxlen(self, flush=False): - # Check a decompression object with max_length specified - data = HAMLET_SCENE * 128 - co = zlib.compressobj() - bufs = [] - for i in range(0, len(data), 256): - bufs.append(co.compress(data[i:i+256])) - bufs.append(co.flush()) - combuf = ''.join(bufs) - self.assertEqual(data, zlib.decompress(combuf), - 'compressed data failure') - - dco = zlib.decompressobj() - bufs = [] - cb = combuf - while cb: - max_length = 1 + len(cb)//10 - chunk = dco.decompress(cb, max_length) - self.failIf(len(chunk) > max_length, - 'chunk too big (%d>%d)' % (len(chunk),max_length)) - bufs.append(chunk) - cb = dco.unconsumed_tail - if flush: - bufs.append(dco.flush()) - else: - while chunk: - chunk = dco.decompress('', max_length) - self.failIf(len(chunk) > max_length, - 'chunk too big (%d>%d)' % (len(chunk),max_length)) - bufs.append(chunk) - self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved') - - def test_decompressmaxlenflush(self): - self.test_decompressmaxlen(flush=True) - - def test_maxlenmisc(self): - # Misc tests of max_length - dco = zlib.decompressobj() - self.assertRaises(ValueError, dco.decompress, "", -1) - self.assertEqual('', dco.unconsumed_tail) - - def test_flushes(self): - # Test flush() with the various options, using all the - # different levels in order to provide more variations. - sync_opt = ['Z_NO_FLUSH', 'Z_SYNC_FLUSH', 'Z_FULL_FLUSH'] - sync_opt = [getattr(zlib, opt) for opt in sync_opt - if hasattr(zlib, opt)] - data = HAMLET_SCENE * 8 - - for sync in sync_opt: - for level in range(10): - obj = zlib.compressobj( level ) - a = obj.compress( data[:3000] ) - b = obj.flush( sync ) - c = obj.compress( data[3000:] ) - d = obj.flush() - self.assertEqual(zlib.decompress(''.join([a,b,c,d])), - data, ("Decompress failed: flush " - "mode=%i, level=%i") % (sync, level)) - del obj - - def test_odd_flush(self): - # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 - import random - - if hasattr(zlib, 'Z_SYNC_FLUSH'): - # Testing on 17K of "random" data - - # Create compressor and decompressor objects - co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) - dco = zlib.decompressobj() - - # Try 17K of data - # generate random data stream - try: - # In 2.3 and later, WichmannHill is the RNG of the bug report - gen = random.WichmannHill() - except AttributeError: - try: - # 2.2 called it Random - gen = random.Random() - except AttributeError: - # others might simply have a single RNG - gen = random - gen.seed(1) - data = genblock(1, 17 * 1024, generator=gen) - - # compress, sync-flush, and decompress - first = co.compress(data) - second = co.flush(zlib.Z_SYNC_FLUSH) - expanded = dco.decompress(first + second) - - # if decompressed data is different from the input data, choke. - self.assertEqual(expanded, data, "17K random source doesn't match") - - def test_empty_flush(self): - # Test that calling .flush() on unused objects works. - # (Bug #1083110 -- calling .flush() on decompress objects - # caused a core dump.) - - co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) - self.failUnless(co.flush()) # Returns a zlib header - dco = zlib.decompressobj() - self.assertEqual(dco.flush(), "") # Returns nothing - - if hasattr(zlib.compressobj(), "copy"): - def test_compresscopy(self): - # Test copying a compression object - data0 = HAMLET_SCENE - data1 = HAMLET_SCENE.swapcase() - c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION) - bufs0 = [] - bufs0.append(c0.compress(data0)) - - c1 = c0.copy() - bufs1 = bufs0[:] - - bufs0.append(c0.compress(data0)) - bufs0.append(c0.flush()) - s0 = ''.join(bufs0) - - bufs1.append(c1.compress(data1)) - bufs1.append(c1.flush()) - s1 = ''.join(bufs1) - - self.assertEqual(zlib.decompress(s0),data0+data0) - self.assertEqual(zlib.decompress(s1),data0+data1) - - def test_badcompresscopy(self): - # Test copying a compression object in an inconsistent state - c = zlib.compressobj() - c.compress(HAMLET_SCENE) - c.flush() - self.assertRaises(ValueError, c.copy) - - if hasattr(zlib.decompressobj(), "copy"): - def test_decompresscopy(self): - # Test copying a decompression object - data = HAMLET_SCENE - comp = zlib.compress(data) - - d0 = zlib.decompressobj() - bufs0 = [] - bufs0.append(d0.decompress(comp[:32])) - - d1 = d0.copy() - bufs1 = bufs0[:] - - bufs0.append(d0.decompress(comp[32:])) - s0 = ''.join(bufs0) - - bufs1.append(d1.decompress(comp[32:])) - s1 = ''.join(bufs1) - - self.assertEqual(s0,s1) - self.assertEqual(s0,data) - - def test_baddecompresscopy(self): - # Test copying a compression object in an inconsistent state - data = zlib.compress(HAMLET_SCENE) - d = zlib.decompressobj() - d.decompress(data) - d.flush() - self.assertRaises(ValueError, d.copy) - -def genblock(seed, length, step=1024, generator=random): - """length-byte stream of random data from a seed (in step-byte blocks).""" - if seed is not None: - generator.seed(seed) - randint = generator.randint - if length < step or step < 2: - step = length - blocks = [] - for i in range(0, length, step): - blocks.append(''.join([chr(randint(0,255)) - for x in range(step)])) - return ''.join(blocks)[:length] - - - -def choose_lines(source, number, seed=None, generator=random): - """Return a list of number lines randomly chosen from the source""" - if seed is not None: - generator.seed(seed) - sources = source.split('\n') - return [generator.choice(sources) for n in range(number)] - - - -HAMLET_SCENE = """ -LAERTES - - O, fear me not. - I stay too long: but here my father comes. - - Enter POLONIUS - - A double blessing is a double grace, - Occasion smiles upon a second leave. - -LORD POLONIUS - - Yet here, Laertes! aboard, aboard, for shame! - The wind sits in the shoulder of your sail, - And you are stay'd for. There; my blessing with thee! - And these few precepts in thy memory - See thou character. Give thy thoughts no tongue, - Nor any unproportioned thought his act. - Be thou familiar, but by no means vulgar. - Those friends thou hast, and their adoption tried, - Grapple them to thy soul with hoops of steel; - But do not dull thy palm with entertainment - Of each new-hatch'd, unfledged comrade. Beware - Of entrance to a quarrel, but being in, - Bear't that the opposed may beware of thee. - Give every man thy ear, but few thy voice; - Take each man's censure, but reserve thy judgment. - Costly thy habit as thy purse can buy, - But not express'd in fancy; rich, not gaudy; - For the apparel oft proclaims the man, - And they in France of the best rank and station - Are of a most select and generous chief in that. - Neither a borrower nor a lender be; - For loan oft loses both itself and friend, - And borrowing dulls the edge of husbandry. - This above all: to thine ownself be true, - And it must follow, as the night the day, - Thou canst not then be false to any man. - Farewell: my blessing season this in thee! - -LAERTES - - Most humbly do I take my leave, my lord. - -LORD POLONIUS - - The time invites you; go; your servants tend. - -LAERTES - - Farewell, Ophelia; and remember well - What I have said to you. - -OPHELIA - - 'Tis in my memory lock'd, - And you yourself shall keep the key of it. - -LAERTES - - Farewell. -""" - - -def test_main(): - test_support.run_unittest( - ChecksumTestCase, - ExceptionTestCase, - CompressTestCase, - CompressObjectTestCase - ) - -if __name__ == "__main__": - test_main() - -def test(tests=''): - if not tests: tests = 'o' - testcases = [] - if 'k' in tests: testcases.append(ChecksumTestCase) - if 'x' in tests: testcases.append(ExceptionTestCase) - if 'c' in tests: testcases.append(CompressTestCase) - if 'o' in tests: testcases.append(CompressObjectTestCase) - test_support.run_unittest(*testcases) - -if False: - import sys - sys.path.insert(1, '/Py23Src/python/dist/src/Lib/test') - import test_zlib as tz - ts, ut = tz.test_support, tz.unittest - su = ut.TestSuite() - su.addTest(ut.makeSuite(tz.CompressTestCase)) - ts.run_suite(su) diff --git a/sys/lib/python/test/testall.py b/sys/lib/python/test/testall.py deleted file mode 100644 index 23493940c..000000000 --- a/sys/lib/python/test/testall.py +++ /dev/null @@ -1,4 +0,0 @@ -# Backward compatibility -- you should use regrtest instead of this module. -import sys, regrtest -sys.argv[1:] = ["-vv"] -regrtest.main() diff --git a/sys/lib/python/test/testcodec.py b/sys/lib/python/test/testcodec.py deleted file mode 100644 index 5da754dc8..000000000 --- a/sys/lib/python/test/testcodec.py +++ /dev/null @@ -1,48 +0,0 @@ -""" Test Codecs (used by test_charmapcodec) - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright 2000 Guido van Rossum. - -"""#" -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - - return codecs.charmap_decode(input,errors,decoding_map) - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - - return (Codec().encode,Codec().decode,StreamReader,StreamWriter) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x78: u"abc", # 1-n decoding mapping - "abc": 0x0078,# 1-n encoding mapping - 0x01: None, # decoding mapping to - 0x79: u"", # decoding mapping to -}) - -### Encoding Map - -encoding_map = {} -for k,v in decoding_map.items(): - encoding_map[v] = k diff --git a/sys/lib/python/test/testimg.uue b/sys/lib/python/test/testimg.uue deleted file mode 100644 index c9b713e52..000000000 --- a/sys/lib/python/test/testimg.uue +++ /dev/null @@ -1,1170 +0,0 @@ -begin 755 test.rawimg -M___Y^/\A$Q3_*1LC_QL4'/\;%AS_%Q(6_QP7&?\B&AW_'A<7_QT5&/\7$A3_ -M&108_Q84%O\7%1?_$Q 6_Q<3'/\:$Q__'1<;_R$:&O\5$Q7_'!D8_SHW-O\\ -M.CW_141*_TE)3/]/3U+_'1DA_R,<)O\B'"3_249,_T=$2O]$0D7_.38_]<7F/_%1$9 -M_QH6'O\B(2C_65A>_U587?]87%[_65M>_Q@5&_\@'"3_%Q8<_U%34?]<6E7_ -M5U9/_U-14_\:%A__'AHB_TA&2/\]/CC_24I$_RDG*O\B'B;_)",I_UI;7/]; -M65;_7EA6_X%\?/^!?GW_7E]@_U!45O]45US_4U5:_U)46_].4%?_2TU4_T9( -M3_]#14S_1$E/_TA)4/](1T[_1D=._TI/5?])2E'_2$=._T-%3/])2U+_2$E0 -M_T9'3O]#1$O_0D1,_T!"2O]#14S_1DE._T5(3?]$1TS_0$-(_T1'3/]!0TC_ -M0T)(_S\^1/]#0DC_04-(_SD\0?\[0$7_0#]%_SY 1?\Z/$'_.CQ!_SH\0?\[ -M.S[_/SU _Q43%O\E(R;_%Q48_S0R-?\7%1C_)R4H_Q02%?\2$!/_%!(5_Q,1 -M%/\5$Q;_^>[U_SXT/O\F'"O_'QDA_QD4&/\6$17_%1 4_Q<2%O\:%1G_&!,7 -M_Q40%/\8$Q?_%Q03_Q<3%?\:%1O_'17YX_Y&1CO]O:FS_5U=:_U)45_]1 -M4U;_4%)7_TY/5O])4%;_2$]5_T1(4/]%1E'_1DA0_T=)4/]&2$__1$9-_T%# -M2O]$1DW_04-*_T!"2?] 0DG_04-*_T1&3?]!0TK_/D%&_T)%2O]!1$G_1$=, -M_T%#2O]!0TK_/3]&_T!"2?] 0D?_/D!%_S]!1O\^0$7_.3M _ST_1/\\/D/_ -M.CQ!_ST[/O\W-3?_,C R_S N,/\M*2O_)B(D_Q82%/\7$Q7_%1 4_Q(-$?\7 -M$A;_%1 4_Q81%?__]?K_+R4N_T<^2_\A'"+_&A49_Q81%?\5$!3_&!,7_Q81 -M%?\6$17_%1 4_Q@3%_\7$1G_%Q(8_PT(#/]VGUW_V!C7?]765?_5E=8_TQ15O]+3U?_2E!:_T=*5O].4%C_2DQ3_T=)4/]' -M25#_14=._T9(3_]'25#_1$9-_SY 1_] 0DG_.SU$_T-%3/] 0TC_041)_TI- -M4O\^04;_/T%(_S]!2/\^0$?_0D1+_SY 1?\^0$7_/T%&_SY 1?\Z.CW_,C(U -M_RTM,/\G)RK_*RDK_R@F*/\J*"K_(R$C_R4A(_\I)2?_(AX@_RXJ+/\9%!C_ -M% \3_Q@3%_\3#A+_&!,7__KQ\?\@%Q[_&Q0<_QL6&O\8$Q?_%1 4_Q40%/\5 -M$!3_%1 4_Q40%/\4#Q/_%Q(6_Q<3%?\7$A;_$PX2_Q@3&?\<%1__&!,7_Q42 -M$?\4$!+_$0\2_Q(0$_\3$13_$Q$4_Q,1%/\4$A7_%A(:_QP8(?\;%AK_'!@: -M_Q\;'?\;%QG_%Q(6_Q40%/\5$!3_% \3_Q,/%_\7$QO_'AD?_Q\9'?\=&1O_ -M(R ?_R -M%R'_&Q@>_U964_]:6E?_7%E4_UE55_\8%!W_&AD@_V!?9?]=7E__86)C_ST\ -M0_\6%Q[_&QTB_V%B:?]B8FO_86%L_Q<7(/\B(RK_3E!5_U-56O]74EC_)Q\C -M_R4D(_];6UC_75Y8_VMJ:?^5DY7_A(""_UE65?]86%O_4U5:_U!26?].4%?_ -M2TU4_TE+4O]+353_1TE0_T)$2_]$1DW_1$9-_T-%3/]!0TK_04-*_SY!1O] -M0TC_0$-(_T%$2?\\/D7_/3]&_ST_1O\^0$?_/3]$_SP^0_\]/T3_.#H__S(P -M,_\J*"K_*RDK_R@F*/\H)BC_*2 -M(/\E(2/_)B$E_R,>(O\W,C;_)!\C_Q81%?_\\//_'A07_S$I+/\L)RG_'!<; -M_Q0/$_\5$!3_% \3_Q40%/\5$!3_% \3_Q<2%O\3#QC_%Q(8_Q@3%_\8$1G_ -M$PP3_Q<1%?\5$!3_$1$4_Q(0$_\2$!/_$0\2_Q$/$O\0$!/_#0\2_Q43%O\@ -M&Q__%1,6_Q(0$_\1#Q+_$0\2_Q$/$O\0#A'_$0\2_Q .$?\1$A/_&!<>_Q@4 -M'/\A'1__$0\1_TI&1/]54$K_(R(A_Q,1&O\5$QS_+2PR_U-45?]-4%7_5EE> -M_UY=8_\P+3/_'!@@_Q<8'_]>8VG_8F%H_V)A9_]C8FG_&!8?_Q<4(/]>7V;_ -M8&%H_V!A:/]45EO_&QHA_Q@7'O]E9&K_961J_U]>9/\9%R#_'!HC_TU-4/\Q -M,S#_)R("7_'B C_R@L+O\;'R'_$1$4_Q$1%/\0$!/_$! 3_Q(0$_\3#A+_ -M&A08_W!H;/\7$A;_$A 3_Q$/$O\1#Q+_$0\2_Q .$?\1#Q+_$ X1_QD9'/]/ -M2U/_-S(X_R,@&_\].S/_5U!$_UI00?]>5TO_&A4;_Q@4'/\X-CG_/#LZ_SY! -M0O]14UC_45)9_RPM-/\?&R/_%Q@?_V%F;/]H9V[_;6QR_V]N=?\6%!W_&Q@D -M_UU;9/]F9FG_9VAI_UM:8/\8%A__&AD@_V-C9O]H:FC_969G_Q85'/\4$QK_ -M5E=8_U]A7O]65EG_%A4<_QD8'O] /S[_)R4H_QH6'O\B'R7_9V-A_V%<8/\< -M&"#_(2 F_T=%1_\>'![_*"8H_UY<7O]Z=7#_J:&=_W=R=/];6%[_5%5<_TY. -M5_]$1D[_/4-+_S@[0/\Y/$'_+S(W_RDL,?\K*2S_+RHN_RTH+/\M*"S_*RDL -M_R@H*_\F)BG_)B8I_R8F*?\E)2C_*"@K_R_\6$17_&A49_QD4&/\8$Q?_&!,7_Q\:'O\F(27_2T5#_Y"+ -MA?^+B83_'Q\B_V)G;/]26%K_2DY0_S4D/_;%E'_W5@5/\I(27_,BTS_T1 0O]" -M0#W_55!*_U%,1O]'0D+_.C4Y_Q\;(_\7&!__4UA>_U-26?]/3E3_5U9=_Q@6 -M'_\[.$3_,R\X_UM96_];7%;_6%99_QH7(_\9&!__6UQ=_U]C6_]@8F#_&!<= -M_QH9'_]?85__8&)?_UY>8?\8%Q[_%Q8<_T5$0_\V-#?_&!0<_QT:(/]K9F;_ -M;6AN_QD5'O\<&R+_;VQR_QT:(/\C(23_5U57_R8@)/\L)"C_4DU-_UM65O^ -M>WO_A8""_T1 0O\T,C3_)"0G_Q\>)/\;&B#_$A$7_R(B)?\H)BG_*RDL_S(P -M,_\R-#?_-SD\_SD[/O\Z/#__.3M _S@Z/_\V.#W_-3<\_S(T-_\L+C'_*"HM -M_R5TO_:V%6_UU/0/]\9%7_?F19_RT>(O\H(RG_ -M-S,U_SX[-O]E6D__85=)_U=,1?\\-C3_&A8>_Q<8'_\\/T3_/3Q"_QX;(?\< -M&R'_#PT6_R8B*_\M(B?_)2(=_UI<4_]3453_&Q@D_QD9(O]97%W_5UQ6_UI< -M6?\9&1S_&1@>_UYB8/]O<6__9&1G_Q@7'O\<&R'_/T$__RDI+/\9%1W_'1DA -M_S\]/_\=&B#_&14>_Q<6'?\Q,#;_&Q@>_QP:'?]J:6C_(A\K_R =*?]02T__ -M3$9$_RHB'O\H(!S_3TI%_VAE8/^)A8?_6%99_TE'2O\5%!K_24Q1_T9)3O\\ -M/T3_0$-(_SY!1O]"14K_14A-_T!#2/]!1$G_/T!'_SH[0O\\/43_.3M _SL] -M0/\]/T+_+S$T_RLL+?\L*BS_*2'1S_ -M&A45_QD6'/\8%Q[_'QD=_T@N(?]*."K_4E-,_T9%2_\@&R?_%QDA_UYG;?]B -M9VS_:&=F_QT:(/\;&R;_0D1,_S@Z/?\M+#/_&!8?_Q85&_\\03W_#0\2_Q01 -M'?\8%A__$1D=_T5'3/\8%1O_%!8;_TQ.3/\:&!O_(R F_V9D9O\L*#'_'QLC -M_VAF:/]=6F#_(R F_T9$1_\A'R+_)"(E_U!*2/]%/SW_1D1'_Q45'O]B9&G_ -M4$]5_TQ+4?])2$[_24M0_T9(3?\_04;_0$)'_TU,4O\U-#K_,"\U_RTL,O\K -M*C#_*RHP_RHI+_\I*"[_)RDI/_ -M% \1_QD:&_\;%QG_&!,3_QD4%/\>&1G_%A$1_R4F(/\R-2__0$,]_T)%/_\R -M,B__+BXK_R$@'_\1#Q'_(!L;_T1"._]$03;_7%)$_WIK7O]31#?_0C,F_U-" -M-?]:2TO_'AD?_R,E*/]234?_;6)7_V582_]K7E'_95Q5_U)-4?].2TK_:FAC -M_Q41$_\6$A3_&A<=_Q83&?\J'A__6#TL_TTX)O]H7UC_;FIL_QX7(?\@'R;_ -M4UM?_V%E9_^)B(?_%!$7_Q<3'/^"@(/_?X%^_V-C9O\8%A__%!,9_TY,1_\6 -M$Q+_&14>_Q@7'O\8("3_5%9;_Q,0%O\@(B?_65I;_Q,2&/\H)R[_9&1G_S0P -M.?\?&R/_9V5G_V%>9/\3$!;_5U58_QX<'_\C(23_96-F_QP;(?\6%A__1TI5 -M_R <'O]D7U__@GU]_UU86/].3$__2DI-_T]/4O]&1DG_0$)'_T)$2?\^0$7_ -M/3]$_SY 1?\Y.T#_/D!%_ST_1/\]/4#_/S]"_SX^0?\_/T+_/CY!_SP\/_\S -M,S;_(" C_QH6&/_\^O?_*R@G_Q@6&/\;&1S_+2TP_Q@8&_\6%AG_%!07_QX= -M)/\4%AO_%1@9_RDF(?\>'R#_CXZ-_YZ8D/_3SLG_T\O)_]7+Q__3RL3_R\6] -M_Z.7F/\8$A;_&1D<_Q@3%_\<&!K_&A88_QP8&O\7$Q7_$1(3_QT>'_\;'1K_ -M)"&AC_24= _U932/]I7U'_>&9<_UA(/O]% -M."W_4D<\_V)34_\:$A;_&!H8_W)L9/]E6U'_;6!3_VI:2O]S9EO_55!+_VEG -M8/]:6%'_$PX0_Q40%/\5$AC_'QH<_T4V,?];/BS_2C =_Y:&??^&?W__)!TD -M_RDF+/]B:&K_?'^ _XF*B_\7%!K_&Q8<_WMW=?]O<6C_8F1A_QH9(/\7%AS_ -M14 [_T])1_\;%1W_%1<<_QHB)O\Y.T#_&18<_Q06&_]'24S_#Q 7_QP<)?]0 -M4E?_-C$]_Q\;(_]A7V'_6%5;_Q,0%O]85EG_'AP?_Q\=(/\[.D#_&!<=_Q01 -M%_\6$QG_&108_Q(,$/\J)"C_2D1(_U)04O]T(![_*"TG_SQ!._\K,"S_*S L_R\K*?]!/#;_5U%'_VA>4/]B4$;_ -M4$ V_T4Z+_]=4TC_7U)-_Q40$O\0$!/_;FEC_VQB6/][;F'_>6M<_X1W:O]C -M7%;_8%Q4_W%L9O\>%AG_%1 6_Q(0$_\@&1G_5$$Y_V%#+?]4-R7_D'UU_X^' -MA?\K)"O_8%]E_U!45O]04U3_3$U._P<&#/\C(23_14$__U)63?\F*"7_'ATC -M_Q@7'?]-1D#_6%!._QL6'/\7%AS_*# T_U987?\;&![_%!8;_T1&2?\4%AO_ -M'1TH_T1&2_\M*S3_'QPB_TY,3O]/3%+_%!$7_UA66?\>'!__%A07_Q$,$/\: -M%AC_&!,5_R$:&O\;%AS_$P\7_QL7'_\=&2'_'!H=_R >(?\?'2#_4E!3_V]Q -M=/]565O_35%3_TI.4/]#2$W_/T1)_SY#2/\_1$G_0$%(_T-"2?]"04C_0D%( -M_ST_1/\]04/_.CY _S8Z//\5$Q7_^O+U_S0O-?\D(RG_;VIJ_Y:2D/\>&1W_ -M+2@L_Z"5E/^+?WO_'1<;_QH9'_\=&QW_'1X?_Y60D/^>E8[_S\K%_];/S__8 -MS\__U,K&_]C,Q_^=E)3_&A47_QT9&_\5$Q7_%Q47_Q@6&/\:&!K_$Q$3_Q,1 -M$_\;&1O_'!H<_QP:'/\G+";_.3X\_RHO+_\F+"C_-30M_R\J)/]+13W_6U-) -M_W]S:O]-03C_13LQ_TU%._]P8U;_(1D5_R\K+?]/1#W_&?\5$Q;_&AD?_Q\7&O\N+"[_C8B(_YZ5CO_/RL7_ -MTLO+_]?.SO_7%G_V9C6/]L:V#_-3,P_R >(?\B("+_*"0B_RT>&/]&*QK_ -M."$5_]3&P_^4C(K_'AH8_UU?7/]A;&?_6F!<_U]E8?]I;VO_76-?_SU#/_]* -M3T__$1,6_P\/$O\6%!?_-S0O_TQ'1_\@&B+_&!4;_S0Y/O]<7F/_659<_S R -M-_]045+_$@\5_R <)/\7%1C_%A07_QL9'/\6%!?_(!XA_Q42&/\D(2?_%!$7 -M_QX;(?\:%1G_&A49_Q81%?\4#Q/_%Q0:_Q83&?\8%1O_%1(8_Q83&?\4$1?_ -M%A,9_QD6'/\4$!C_(!PD_Q41&?\C'R?_-38W_U-54_]E9V7_2DQ*_TI,3_]$ -M1DG_04-&_SY 0_]"1$?_/T%$_SL]0/\^0$/_.3D\__OS]O\G(BC_(2 F_XZ) -MB?]U;VW_*B4I_Q@6&?^]M[7_O;6Q_QP7&_\8%QW_&147_Q43%?^2C8W_GI6. -M_\K%P/_6S\__W=34_]S2SO_2QL'_H)>7_Q\:'/\7$Q7_%1,5_Q84%O\9%QG_ -M'!H<_Q,1$_\3$1/_&A@:_QL9&_\;&1O_)"DC_S4Z./\N,S/_)BPH_S0U+_\L -M*23_2T9 _TE#._]C657_65%-_TI%0/\Y-C'_,"PN_R0B)?\8%AG_&!89_QL7 -M&?\?&QG_+"4?_X!V;/]G6US_8EQ:_VEF8?] /3S_'AH<_QD7&?\T,B__)QP; -M_THS)_\Y)1W_RKV\_X-Y=?\@&1G_+"HL_S,Z.O](2TS_*2HK_V%B8_]]?G__ -M$1(3_[.UN/\;'2#_%A89_QP:'?\I)B'_O;BX_V!:8O\;&![_,C<\_S@Z/_\? -M'"+_*"HO_T!!0O\7%!K_)R,K_Q,1%/\,"@W_,C S_Q84%_\2$!/_'QPB_Q@5 -M&_\3$!;_$0X4_Q@3%_\9%!C_%A$5_Q40%/\2#Q7_&A<=_Q,0%O\2#Q7_&18< -M_Q$.%/\:%QW_$Q 6_Q82&O\7$QO_%1$9_Q82&O\?'2#_+"HM_RTK+O]24%/_ -M24I+_T5(2?]$1TC_0T9'_S]!1/\^0$/_04-&_T)$1_] 0D7___C[_R(?)?\5 -M%AW_'QP;_SPV-/\@&Q__(QTA_RX?'_\G%Q3_(AH>_Q,5&O\1%!7_0$%"_XB& -M@_^;E8W_Q\*]_];/S__=U-3_V]'-_]'%P?^>EY?_'!<9_Q82%/\4$A3_$ X0 -M_Q43%?\=&QW_$Q$3_Q<5%_\9%QG_,"XP_QH8&O\E*B;_,C8?]%.C__'QH:_RXJ+/\;%1G_%Q,5_R0C -M(O\?&AS_-"4?_R<9%O]74E3_>W-Q_R4=(/\E)"K_)BHL_R @(_\H)BG_&18< -M_VAG;?\@'R7_G)ZA_Q<9'/\:&AW_'1L>_R,>&?_$P<#_:&=M_R,@)O\7&A__ -M%QD>_Q(/%?\8%QW_*RPM_QT;'O\@'"3_$Q$4_Q84%_\U,S;_#0L._Q84%_\Q -M+C3_.#0\_QH6'O\;%Q__%Q(6_QH5&?\6$17_%1 4_Q83&?\7%!K_%!$7_Q83 -M&?\1#A3_$0X4_Q83&?\5$AC_%A,9_QL9'/\9%QK_&1<9_Q$-%?\3#Q?_.#0\ -M_RLH+O\G*2S__QP:'/\I -M)B7_CXZ'_Y65C/_$PKW_UL[,_]7*R?_:S\[_S<+!_Z&=F_\G)"/_%A(4_Q<2 -M%O\3$13_%Q47_Q84%O\5$Q7_%1,5_Q@6&/\C(2/_&QD;_R0H)O\Y/CS_+S0R -M_R0I)_\[.SC_&R,M_S9&8/]#3VK_-3I3_S Z3O\]3UW_+#Q,_RF___Y^7E?]/34__24=$_Q\;'?\< -M&!K_(R4H_SY*4_\6+3+_3V)N_XZHM?\<)27_)2 @_SP_0/](34O_5E93_TU, -M2_],34[_LK2W_Q@;(/^TK[/_'AP>_Q\B(_\>&AS_(1\<_[FUL_]84U?_%A4< -M_Q(/%?\2$!/_$ X1_Q84%_\?'2#_%1,6_Q43%O\4$A7_$Q$4_Q$/$O\3$13_ -M$A 3_S(?\7 -M%1C_$ X1_QH8&_\4$A7_%!(5_Q02%?\3$AG_$Q(8_Q04%_\3%!7_%!4<_Q . -M%_]13U+_'QP;_VYO_Y>-@O]W:V+_.#(P_S] 0?](2$7_ -M:FYE_VIN9O]U@X;_.UUQ_WVOQ/^@Q^#_>**R_W6$A/^$>WO_0S]!_QLC(/\M -M,R__0TA&_W5Z>O^XP,+_%1\C_[V[OO\<&AS_&AT>_QX:'/\5&!+_MZFF_YN -MAO\4#Q7_$1$4_Q02%?\4$A7_$ X1_Q02%?\3$13_$Q$4_Q$/$O\2$!/_%1,6 -M_Q,1%/\4$A7_'ALA_Q,/%_\1#17_$ P4_Q$/$O\:&!O_&1<:_Q@6&?\2$!/_ -M'1L>_Q02%?\:&!O_$@\5_Q(/%?\5$AC_%1(8_Q,2&/\1$QC_$Q4:_Q<9'O\1 -M$AG_$Q(8_S(P,O\?'1K_H9R<_X^$@_]H7%?_9EU=_V!<7O]>6ES_2D9(_U%- -M3_]24%/___3T_RPG*?\>("7_(1X=_RXF)/],1DK_(R F_R8>(?\J(B#_'1@< -M_Q@:'_\<&AS_=G-R_X.">_^8F(__O+JU_]C0SO_>T]+_V<[-_\6ZN?^JIJ3_ -M1T1#_Q82%/\7$A;_%Q48_QH8&O\7%1?_&!88_Q<5%_\7%1?_&QD;_QT;'?\? -M(R'_,38T_S,X-O\=(B#_.#8Q_R0B'_\?'"+_%A,?_Q01*/\P-U7_'S%5_R V -M7/\O5'?_.VJ-_RU:@O\>16__+%5Y_RY(;_]\@XG_GI"!_VQ@5_]%03__+C$R -M_RHO*_]?8UK_@7]Z_UUF;?]9?)/_;YZV_Y_!V_^#I;G_H::K_S,L+/\T-3;_ -M55I8_WZ ??]L:VK_*2PM_Z"DIO]>8VC_PL##_Q,1$_\0$Q3_'AH<_R,A&O^X -MKZG_BWQ\_Q<1%?\6%!?_%!(5_Q02%?\3$13_$Q$4_Q,1%/\2$!/_$A 3_Q,1 -M%/\2$!/_$Q$4_QH8&_])1TK_%1,6_Q .$?\2$!/_$A 3_R >(?\B("/_(R$D -M_Q<5&/]$0D7_%!(5_Q .$?\4$!C_$@X6_QH6'O\G(RO_,2XT_S@S.?].2%#_ -M85ID_Q$.&_\4$1W_'!@@_T(]0?^MJ*K_LJJH_WMO:O]L967_BX*"_W!G9_]L -M967_7%=7_T,^0O__^?K_)R8M_RHO._\U-#K_*"(@_U=15?\>&R'_EI&3_[2L -MJO\^.3W_#A 5_QH8&O\>&QK_@'YW_Y63B_^\NK7_U]'/_]O0S__7S,O_PK>V -M_ZVII_\D(2#_&A88_Q40%/\3$13_&1<9_Q<5%_\8%AC_%Q47_Q<5%_\;&1O_ -M'QT?_Q\C(?\O-S3_.#T[_QPA'_\T.#K_'R$F_QH='O\1%AS_%QHL_Q8^7_Y:QO/]\F*#_7GB#_T-79?](97'_,D=D_WE[>?^6A';_<&5:_TM' -M1?]"14;_,38R_XZ/B/]Z=W;_'!DF_T%:H/^=EY7_2D="_U535?_6RLO_ -M6U-1_TI#0_\:%17_'!8:___X\_]!/4;_4UAJ_Q02%?\D)"'_;V1I_Q<4&O\3 -M%!7_*!T<_Q80%/\7%AS_&A88_X^*BO]_>'+_G9>/_ZVKIO_2T,W_V-#,_]?+ -MQ_^MJ*/_JZFF_QD6%?\;%QG_&A49_Q,1%/\7%1C_$0\2_Q02%?\5$AC_%A07 -M_Q84%O\Y.#?_)",B_RDX-/\U.3?_&1T;_R\T,/\E(BC_'1\<_Q0:(O\7&SO_ -M'!XA_UM95O^+F)W_B:.F_X69G?]E;6__6&)?_U=O;/\E0G+_>'U[_XMU<_]O -M95K_3TE'_R0E)O\C)2+_G92-_UUL_["PL_]"1$G_LK"S_QH: -M'?]S=7C_%1(8_QXB)/\E*2O_%!07_Q,.$O\6%!?_&A@;_Q<5&/\2$!/_%1,6 -M_Q,1%/\0#A'_$0\2_Q$/$?\1#Q'_#PT0_QL8'O\?)CS_%!8E_QT8&O\E("3_ -M$A 3_QD7&O\L*BW_'1L>_Q<5%_\5$Q7_34E+_RDD)O\:$A;_%A(4_Q(1$/\A -M'R+_$18<_Q@>(/\L*2C_'Q,6_V1:;?\;$BK_C("5_X%V??]%/#S_(1X=_SQ -M/O\P,C#_S\3#_S U,_]'2$G_(!L?_QH8&___\_+_*" C_R0A)_\A'!S_/T$^ -M_W1I;O\0#1/_)28G_S4J*?\G(27_%!,9_QL7&?];5E;_9V!:_Z":DO^EHY[_ -M@(6!_YR=E_^2D(O_=GES_WAX=?\7%!/_&!06_Q<2%O\1#Q+_%A07_Q02%?\7 -M%1C_%1(8_Q84%_\C(2/_&QH9_QP;&O\G-C+_.#PZ_Q@<&O\O.SC_)2(A_S8P -M)O\F+#S_'B=0_Q4;(_\B'AS_5%M;_U1G9_]TBHG_>XZ(_V!J8?]9<&O_+DM[ -M_W=\>O^9@X'_=6M@_W9P;O\J*RS_,#(O_X^.@_]J8F#_#")CK_.3U%_R&_\F-#/_AIN=_W.)B_]A=W7_6V1=_UYU -M'Q^_YR'@O]G6DW_BH)^_Q\@(?\O,2__AXZ"_ZF5C?]06&+_9)2I -M_WFHP/^;S>C_6WR3_[RWO?^"=G?_'R A_SL^/__/R_WEW=/^FEYC_%1,5_RDM+_^[M;/_G)>9_Q@3&?\=&Q[_%Q(2_T5) -M0?^HG9;_A8-^_V5O9O^%C8/_;'1J_V=O9?]I;67_%Q47_QH7'?\:&!O_&!88 -M_QL9&_\>'![_'!H<_Q@6&/\:&!K_&A@:_Q@6&/\7&!G_*"\O_S([._\4&1G_ -M-3 \_R(F'?\@%A__'2DP_R$V;/\6%"3_(A\>_R$M-/^*I*?_@IVD_UUT>?]& -M4D__46IO_RU5?/]T>8O_D8!R_W-@5O^>DHW_(2(C_Q\;'?^2BH;_IYV2_YFJ -MM_]VHKS_F,38_ZG-XO\J.TC_B(.#_YV8D_\>'B'_2TI0_\7 PO^NIJG_.C@Z -M_S@[//]+3D__/D-#_QH='O^"?H#_&!D:_QD9'/\<'!__$Q,6_Q04%_\6%AG_ -M%A89_QH:'?\]/4#_'Q\B_QD9'/\?'R+_#@X1_Q0.%O\4#Q/_$0\2_Q(0&?\8 -M(CW_(BI6_Q8<-O\8&"'_5$QG_T ^1_\K)R__&QHA_X.!?O]23T[_&A88_RE -M_RLH+O\?&R/_%!(4_V)C7?\;&QC_,S$L_QL8%_\5$Q;_*2TK_Q@6&/__^/?_ -M0SL__Q\>)/\5%A?_)24B_[&EIO\;&1O_&1L>_QD3$?\6$1/_'!<=_QL9'/^2 -MC8W_14E!_Z*7D/]_?7C_7&5>_V9M9?]@9U__86A@_V1H8/\8%AC_&18<_Q84 -M%_\6%!;_&A@:_QT;'?\6%!;_%1,5_Q(0$O\9%QG_%Q47_Q<8&?\F+2W_-#T] -M_Q09&?\S,#S_(2@>_QH0&?\)$AG_&REA_QL7)_\G(1__&!H=_S1+2O^%H:3_ -M9'A\_TU65O]2:6C_,UAW_W%R??^7@&W_A7=N_ZB@GO\A'R+_'QT?_XV*A?^H -MH97_D:*O_R5/:?^SS^3_M'B'_'AXA_T-#1O\J*BW_(" C_RHJ+?\2$A7_% X6_Q0/$_\.# __ -M$Q$:_Q4A//\:)53_'"=*_S(U3O]B5'K_@'Z'_PT0%?\5$A[_$ T,_U!-3/\9 -M%1?_(!L?_T-"2/]65%;_8UQ<_Z:BJO]N;W;_%A07_QD2$O\Q)2'_'QH:_QL4 -M%/^IHZ'_%!$7_Q,/%_\/#0__8F-=_YN;F/\]/3K_'1L=_QL9'/\M+BC_&A88 -M___X]_],1$C_)20J_QX?(/\O-##_O[:V_QD7&?\D)"?_LZNI_[JUM_\;%AS_ -M$0\2_QX9&?\?(QO_H9:/_X!^>?\T/#C_.3\[_RTS+_\U.S?_76!:_Q@6&/\4 -M$1?_%!(5_Q,1$_\5$Q7_%1,5_Q43%?\3$1/_%!(4_QD7&?\9%QG_%A<8_R$H -M*/\Q.CK_$A<7_RTM./\C*R'_(QDB_Q\E+?\?+67_-C5&_S'![_ -MC8Z(_YV8C/](66;_1VV(_Z_/Y?]TCJ/_1%1>_X2$@?^9FI3_)RTO_S U.O^P -MKK#_P[_!_V1I:?]<:&?_='M[_X2)B?^1CY'_J*"C_Q@3%?\5$Q;_&AH=_Q 0 -M$_\7%QK_#@X1_Q86&?\='2#_'AXA_Q\?(O\9&1S_&1D<_P\/$O\3#17_$PX2 -M_Q .$?\4$AO_%1XV_QDC4/\;)4K_%!DW_V5/?/]^>87_$!@:_QH:)_\=&1O_ -M55)1_R@D)O\P*R__)R,E_R(8&_\R)2K_>7!W_T$V-?]@5EG_$0X4_Q00$O\6 -M$A3_&1(2_Y6/C?\5$AC_%! 8_Q<5%_]=7EC_GIZ;_S$R,_\<'!__'1L=_TM* -M0_^'A(/___7R_T Z/O\;'"/_&!D:_WAZ=_^\M;7_&A@:_Q43%O\F'Q__&A88 -M_Q83&?\='"+_BX:&_RHK)/^=E(W_@X%\_R\W-/\H+2O_&1\;_RTS+_]365'_ -M&!88_Q01%_\4$A7_%1,5_Q02%/\3$1/_%!(4_Q43%?\4$A3_&1<9_QD7&?\7 -M&!G_(B&O\=%1G_&1\G_R0V;O\9'R__)BHB_RTP -M*O\V+2;_.S8V_VUP_[[#P_\^04+_S?]'1$/_&!06_RTH+/]'0DC_13M$_T,T/_^$?(;_85-4_Z&9G?\4$AO_ -M$Q48_Q,1$_\<%Q?_EY&/_PT+#O\5$AC_&!<6_V5F8/]K:6;_-38W_QH<(?\4 -M$A3_5%)*_[VZN?__]O#_54]3_S4Z1O\H)2O_)" >_[&NK?\9%1?_&A49_V%6 -M5?]C657_&Q<5_QT<&_\J'!W_*"DB_Y64B?^'B(+_)2PL_Q\F)O\>)B/_*C(N -M_TI63?\8&1K_%A$7_Q,1%/\6%!?_%A07_Q84%_\3$13_%!(4_Q02%/\6%!;_ -M&1<9_Q<5%_\?(B/_)S,R_PL2$O\M-3+_#Q$@_QL8$_\7(2S_&3!E_QXA,_\A -M'QC_+"HE_SPZ*_\G(AW_2D<\_X*(A/\C0F3_+%>%_QQ B_\M3I;_26=]_\"N -MLO\:'R3_(QD<_Y"0@?^>G)7_C(Z3_YFDJ_^7H[+_1UAE_SI&2O^.AH+_J*6D -M_]W5V/^3F)C_J:JK_\&_O/^ZN;C_V-/7_[JVM/_)PL+_ -M7O]K;6K_E9.._U%-2_\7$A;_+"@P_QX=(_\R*S+_.C$X_WYY?_]42TO_J:"@ -M_QP7&?\8%AG_$Q(8_QD4%O^EGYW_&!,7_Q43%O\:&1C_@8%X_YF6D?\\.#;_ -M)B(D_QD8%_]334/_P+V\___T\/]]=G;_&1HA_Q .$?^(A(+_JJ>F_QX:'/\= -M&!S_=&EH_VYF9/\:%17_'1L=_R\G*O\7(!G_-CTS_SI"/O\F+2W_(R8G_QD= -M&_\I+BK_1E!'_QL<'?\9%!K_%1,6_Q@6&?\8%AG_&!89_Q02%?\6%!;_%1,5 -M_Q84%O\9%QG_%1,5_QXA(O\C+R[_$!<7_RLS,/\4%B7_&Q@3_Q0>*?\9,6C_ -M+S-(_TA&0_\D)"'_+2LC_SHP,_\Y,RO_/STZ_R1 8O\L5X7_'D:1_RI+D_]$ -M7W?_MZ6I_Q,:&O\B%QS_C9!^_Z.@E/]X<&[_P;6X_]++U?\<'B;_.#L\_[6H -MH_^II*3_V<_2_WV"@O^;GI__RL7 _[JTLO_7G_B8:% -M_Q\>'?\7&1S_%1<:_Q$1%/\7%1C_%!46_PX/$/\_0$'_'A\@_R-_V-: -M6O^BF9G_'QH<_Q84%_\3$AC_'!<9_ZJDHO\T+S/_&A@;_R&1__%1(8_Q<9(/\4&B+_=W!W_QPD(/^*CXG_>7Y\_S5!0/\Y -M0D+_.4- _SM&0?]"3D7_$A,4_QD4&O\5$Q;_%1,6_Q84%_\7%1C_%!(5_Q84 -M%O\7%1?_%A06_QD7&?\8%AC_'2 A_R(N+?\@)R?_+#0Q_Q,5)/\<&13_"Q4@ -M_QHR:_\9'S7_0#\^_T!"0/\K,"K_'QPB_S8T+?\W.3;_'S99_RE7A/\:1I#_ -M*TJ2_SE2;_^QGZ'_%AX:_R8;(/^*BW[_I9^7_VA:6__JV=G_Z-C<_SDT-O]Y -M>7;_UGO_8S,__C9*2_WR#@__(QK__O;BS_^#7U__*P;O_O[>U_XJ% -MA?]Q;FW_+BTL_QH<'_\6&!O_%!07_Q@6&?\/#0__$Q$3_Q,1$_\D(B3_'AP? -M_QP:'?\9%QK_%!(5_Q4/$_\4#Q/_$ X1_Q,3%O\8'RO_'R5%_Q$7,?\:%RW_ -M6$EB_V1I=?]D:6G_5EA5_X6#?O]134O_&A49_U).5O]_?H3_?WA__X!W?O^V -ML;?_A7Q\_Z:=G?\<%QG_'!H=_QP;(?\<%QG_K:>E_X:!A?\[.3S_+RXM_X:& -M??^=FI7_244]_QH8$_\:&!7_-"TG_[ZXO/__^OK_O+&P_R'B'_&AH=_Q04%_\1$13_% \3_Q0/$_\3$13_$A(5_Q<:&_\:'2[_#1$@ -M_Q@1(O\E&BW_)RTU_S8[.?]45E/_55)-_U103O\9%!C_44Y4_RXK,?\B'2/_ -M+B4L_VYI;_]-1$3_KJ6E_Q@3%?\5$Q;_#@T4_Q0/$_^LIZ?_?'AZ_S@V./\P -M,"W_EI:-_Z& -M_SH]/O\N/S__,4)"_S1&1/\Z3$C_2E-,_Q05%O\6$QG_'!8:_QD7&O\>'!__ -M%1,6_Q,1%/\6%!?_%!(5_QP:'?\:&!O_%148_QH>(/\B+S#_&B(D_R(J+O\3 -M'2?_(AX@_QH=*?\A.G7_)"9!_RHE(/]144;_.SLN_UA93/\Q-"C_'B =_Q@O -M3/\?2G3_"39]_RI+E/\B/V__Q*^K_Q08(/\F(1O_='1Q_ZBCG?])/SO_ZMO; -M__+5_];'Q_^YN;;_V\_0_YB9FO]67%[_S\C(_[JRL/_:TM#_ -MPKJX_[NSK_^EFZ3_4DU-_R(@'?\>'23_%!8;_Q<5&/\<&!K_$ T3_Q,0%O\3 -M$13_*RDK_RLK+O\9&R#_%!8;_Q$3&/\D)2;_-38W_SX_0/]+3$W_*"8I_Q88 -M&_\L,3'_9FAF_U!44O\\/CO_5U)-_VQ@6_]__R(?*_\6#QG_ -M%10:_Q<8&?^BG9W_IIZ<_TI(0?]&1#W_3DE#_U),1/]_=W/___#L_[&EJ/\> -M&R'_&QL>_R4@(/]U<'#_&147_Q$/$O^JHZ/_LJNK_Q<3%?\3%1C_'AH<_R$I -M)O^QKJW_P;R\_W=\@?])457_0TM-_T)+2_]*3TG_%Q47_Q,0%O\2$!/_&A@; -M_Q02%?\5$Q;_$Q$4_Q04%_\2$A7_&1D<_QH:'?\8&!O_&Q\A_R M+O\B*BS_ -M(RDK_QHE+/\C)2/_)28Q_R9">_\?)#[_)R,A_S4V,/]'13W_5E9+_TU/1O\A -M(R'_%2Q)_R!+=?\)-GW_)D>0_QPY:?^QG)C_%1DA_R8A&_]34U#_G)>1_T V -M,O_NW]__[]G:_S N*__9T<__W]#0_WMY=O_;S<[_GYV?_T5)2__3T,__K:NH -M_]73T/^\NK?_HYZ9_ZF?J/\T+R__'!H7_S4X/?\>(R/_%AH8_S@Z-_\S+S'_ -M&A88_W!M;/]&1$'_*"'%[_WYW@?^NI['_J)^?_Z^FIO\:%1?_%Q48_Q<9(/\4%2#_(R(S -M_QH7+O\:%RW_$Q B_QD5)?\4#!K_$ P4_S0Q,/\_/C/_2T@\_S@V+___\^__ -MMZNN_Q42&/\7%QK_=7!P_STX./\6$A3_&!89_R8?'_\;%!3_&Q<9_Q47&O]* -M24C_-#PX_\.[N?_JV]O_X-'2_^+0U/_9R,C_T\/ _Y^:E/\?&QW_%1(8_Q,3 -M%O\8%AG_$Q$4_QD7&O\5$Q;_$! 3_Q 2%?\9&Q[_%QD<_Q45&/\9'1__("TN -M_R,K+?\H*RS_'2HO_R4K)_\L+C;_)$%W_R4K1?\C'R'_)"8D_S\]-O]144C_ -M75Y7_Q@9&O\.)$3_&41N_P8S>O\H29+_'CMK_[NFHO\@)"S_)2 :_TM+2/^A -MG);_.C L_^76UO_PVMO_-C0Q_]C0SO_>S\__FI:4_][/T/^EH:/_2DQ/_]#) -MR?^LIJ3_U,[,_\"ZN/_$O+C_O;.\_S(M+?\R,"W_2$9(_YN;F/^8EI'_/3LT -M_ZFEH_\S+RW_KZRG_T ^-_^O_\JRJ?_)L:C_PZF@_[RAEO_5N*S_OZRB_T,W,_\> -M&1W_1T)(_Q<3%?\?&QW_)2$C_T(^0/\_-S7_HYJ:_QL6&/\7%1C_%!$7_Q<3 -M'/\-#!G_%!(E_QT9,_\<&#+_&Q@O_Q42*/\?&C3_)B,P_S0R+?\T,BO_4%53 -M___V\O_!M+/_'QXD_Q(4%_\=&1?_)!\?_R$='_\5$Q;_-"DH_T,X-_\?&AS_ -M&AH=_T1&1/\P.#3_P[FU__'1_R,@'_\6 -M&!W_%QL=_Q\B(_\='2#_(" C_R(B)?\E*2O_)2LM_R8L+O\J,#+_+# R_S(X -M.O\E,C/_)C$R_RHO+?\?*C'_)3 I_R4G+O\D/W7_*3%+_R0B)/\G*"G_1T=$ -M_U153_]254__)B@K_P\D0/\80V__!C)\_R9'C_\C/FW_N*>G_S O-?\K)B'_ -M,S$N_Z";E?\T+"C_Z]S=_^_9VO\L*2C_ULW-_]O,S/][DO_)KZ;_Q:J?_\JRJ?_*LJG_Q["D_\JSI_\[+RO_ -M/CH\_Q\=(/\M*BG_2$E#_TI+1?]24TW_4E--_TQ(1O]+1D;_&147_Q45&/\7 -M$A3_%@X8_Q80'O\7%1[_%A,J_Q41*_\7%2__&ALT_R$://\>&"S_'1P;_R4D -M(_^(@X?___+R_\V\MO\@'R;_%ALA_T-!/O\E)"/_%A06_QH8&_^,?W[_FHR- -M_R$7&O\@&R'_.C\__S4W-?^_NK7_\.'<_^W?W/_CU=+_VLK'_^'1SO^RJZ7_ -M/T$__R\Z._\N.CG_+3DX_RTY./\N.CG_+SLZ_RTX.?\N.3K_-#] _S(]/O\N -M.SS_+SP]_R8S-/\@+2[_'2XD_R$E-/\;*BG_,#@Z_R4]=/\H,TS_'R A_RDF -M)?\I*2;_2DU'_SH^-O\V-SC_%R$P_Q\[9_\0/(#_'D!__RH]9_^?FZ/_0S@W -M_RN_]2YLO^LEH[_OZ:?_^'(P__:P<#_T[V_ -M_QL4%/\?'!O_7UU:_R8D'_\[/SW_+"\P_SL^/_\W.CO_.3T[_UY@7O]?8&'_ -M2TM._Q00&/\4#QO_#Q00_QD7*O\6$2W_%Q,M_Q44,?\3$C?_.35+_S,R.?]$ -M1D3_0T5#_]'(R/__\_?_SKRY_Q\<*?\<'RO_3$E(_QP;&O\9%QG_&1<:_QP6 -M'O\@&B+_'!<=_Q@6&?]'3$S_/3\]_[^ZM?_LW=C_\-W7_]"]M__HU]'_X-'+ -M_ZNJH_\Y0$#_+SL__R@P,O\L-37_*34T_R@T,_\G,S+_)"\P_R,N+_\C+B__ -M(BTN_R8Q,O\K-C?_*C4V_R)_\?(23_+4A^_RHT3_\C -M(R;_+"@J_R\M)O]85TS_8V)7_UQ85O\-%B?_#"91_Q$Z?/\>1(+_)SE?_[*M -ML_\K)BC_'ATC_R0?&?^\L/]=6%+_I9Z8_YB/B?]Y -M;6C_1$0[_U)52?]*34'_14@\_V%A5O_&N*__[]/,_^#'P/_ERK__\-?0_]+# -MP_\@%A__%1 6_Q@4%O\E(B'_+RTJ_Q83$O\U,3/_0S]!_QH6&/\F(2'_6%-3 -M_W5POK?_>T,W_,R@G_Z&/_\I)D/_8F-N -M_SH[//\F)BG_)",J_RPL+__2RLC___+M_X1R:/\6%!?_%!8;_UY=5O])1T3_ -M'!@:_QP7&_\B%13_'1$,_QL6%O\4%!?_$Q@8_RDM*_^KIJ;_W]#+_[*KJ_\P -M-#;_*C(T_RLX.?\J-C/_+SP]_RHV._\K,S?_*3(R_RDU-/\D,"__)# O_RHR -M-/\J,C3_("@J_Q@C)/\:(B3_("8H_R@N,/\F+"[_+"PC_QP[7?\'$R[_'148 -M_QTWXL_^NI*#_QKZ\_UY96?_,PK[_D(J(_T=(2?_'Q<#_,BHH_\S$ -MR/\D)"?_N+"L_]C*Q__.P<#_A'UW_R(D&__*QK[_2#PU_ZRLH_^LK*/_,"\H -M_ZNLI?\W.S/_D)*)_S\_-/]$13C_<7%D_V9G6O^1BX/_V,6__]["O_^ID8[_ -M)Q@8_RD=(/\2#0__$0\,_RLK'/\R-1__,30=_R\S'?\N,"W_,C,T_S$R,_\Q -M,C/_*BDH_Q43%?\8%AC_3DQ/_Q48._^AG+;_9F%<_Z>BNO\<&S__(R(__UM; -M;O\S.#+_.3TU_R ?)?\K*#3_961J_\C"P/_TZO3_5T9&_R4A*?\;'27_'1P; -M_QD7&O\;&![_&Q<@_QP8(?\;%Q__&18<_QD7&O\@'B'_&QH9_QH8%?\R*"O_ -MVL[*_TE24O\U/4'_-3T__S$\/?\O-SG_*C(T_R(?\7'1__&2$C_QHE)O\>*2K_(2PM_R$L+?\N-2G_-TEE_Q$9 -M*?\:&1C_(BQ._RLT1?\@(B#_'AHC_Q\A)O\B)2;_(R8G_R@M+?\P-3/_,C4V -M_S0S.?\\.$'_/C8Y_UA33O^&?GK_M*BK_\&\OO^FFY3_1T1*_^3=W?_RV];_ -M>71T_]K2U?_9R,C_T+NY_X)Z=O_$N+G_)B$C_\+!P/]03E'_-#8[_[^]O_]? -M75__O+&X_RLG*?^[LJS_WL[+_V%95_\V-2[_R<6]_V=F7_\_.C3_P[JT_SDW -M,/^NHIW_;&9>_SHZ+_]T=&?_:6=8_X![:?]W;UO_='!A_RXI)/\@&QO_$PX2 -M_Q$0%O\3%!7_&!4;_Q@2%O\7$@S_-S$A_SLW(?\T-"'_-C0L_Q<6%?\D(B3_ -M)"(D_R$?(?\7%1C_$A 3_Q,3%O\?(23_!@HP_S6K_?WEI_WQV9O\\.C/_-#DU_P\5 -M$?\@)"+_&QP=_R(@(O\H)BC_)R8E_R@F(?\W-3#_'1H5_R0@'O]*1T;_$A 3 -M_Q(0$_\7%1C_$A 3_Q84%_\5$Q;_$1$4_Q@:'?\]0C[_(R<_^=D8S_ -M;&-=_TI%1?^1E)7_,SP\_T9+2?^1D9K_'APL_R@I,/^0CXC__^_B_[R2:O^Y -MCV'_K8E<_ZZ#5?^WBU__M(E9_[2+5_^WBUG_O(Y;_[>*5/^WBU/_O8E7_ZF -M5O^1>5[_V,J[_^31R_\L+2[_$Q4:_Q(6&/\6&AS_$Q48_R@J+?\0$A7_)RDL -M_QD;'O\F*"O_%!89_R4G*O\1$Q;_&R$C_QHB)/\?)2?_(2/_*PL7_V6__=W)F_WYZ:_][=&;_;&9<_Q\='_]0 -M3$K_4TM'_R$;&?\@&QO_+BDM_SP\.?]04TW_-#7E'_@'IR_R(@&_^QJJ3_X,[+_X1Y>/^HHYW_M;&I -M_S(P*/\V-2[_O;RU_Z2?FO\C)!W_F96-_W%E7/]U;F+_:V9:_WET:/\@'1C_ -M'1\B_QD7%/\^/3;_,#,M_TU33_]G96?_8F)?_T9+1?\I+B[_(BDI_RHM,O\8 -M%Q[_&QD;_YJ2E?^@F)O_HYN>_ZZFJ?^SJJK_N[*R_[RUM?_$O[__Q,Z]_UM@ -M6O]866#_J[.O_RLM,/^6DIK_,2PP_S8R-/]W=7?_B8F4_R0B,O\='B7_+3,U -M___T[O_4FV'_S)YQ_[Z%0__"DUW_OY!6_\256__ D5?_OY%7_[^,5__!D5+_ -MDFQ%_RT;#?]<4U/_8&!7_]+'P/_=SL__*S$S_RTR./\^0$7_)2DK_R8H*_\M -M,S7_(BHL_R0L+O\6'![_+# R_Q06&?\I*S#_%!,9_S0S.?\A'R+_&!X@_R,K -M+?\F+C+_*S V_S@T-O_4R<[_X,_7_^G7U/_MV='_\=K5__'9UO_SVMG_^-S9 -M__/7T__AR<;_^./?_Z.9E?\V,T#_)52._QXS@?\K4XK_P<+-_U=05_\G&"/_ -M='AZ_Y^7C?^'@GW_W=/6_][)SO\9'1__F9>9_\[ P?_8Q\?_9EE4_\_)P?\H -M)R;_14(]_X)[=?\^/#7_6UI3_T$\-_\3$0S_# H'_ZJBH/_.P\+_Q+RX_U!. -M1_] 1#O_6E1,_[:JI?]*0SW_+"TF_[>PI/^">&K_E8N _Y2)?O]A64__+RTJ -M_S@[0/]A8V;_8F5?_U-43?\R,2K_3$I#_RXL*?\R-#+_(RHJ_QD='_\;'2#_ -M%QD<_Q\A)/\M+S+_EXV)_Z&4C_^CEI'_FXZ)_Y6,AO^1B(+_C(-]_XR#??^$ -M?7?_*B8H_V%A:O^VLKO_,BXV_XZ+D?\6%!?_$ X0_X5_@_]Z=8'_*BDZ_RDI -M,O],45;___'K_\6,4O_ DF7_SY94_\*37?_)F6+_R)AA_\657O_*EU;_R)EI -M_V!%(/\F&A7_(AP@_R$?*/]/3TS_S\.\_^?6UO\O,S7_%QD@_QT<(O\C)RG_ -M&QT@_R,I*_\P.#K_*"\O_Q@='?\K+B__&!D:_SL\-O]&24/_*3 P_QDC)_\< -M(R__(R8Q_S8S.?_1R,C_Z-;2_^W:U/_VW]K_^-_:__+_QX;(?\G(B;_)" B_QP:'/\9&AO_(!TC_Q@8&_\7%1C_<6=J_XN#AO^> -MF9G_='!N_ZNHH__.O+C_+B@@_R\R)?_'O:[_GX]\_YN.??^1B('_75Q;_TY1 -M5O\Y04O_-3]*_SD^1/\I,2[_+S8/]46ES_ -M4%98_U%24_]/3E7_9F9U_Z^IM_]X='W_B(6+_X:$A_^IIZG_BH2(_W]ZAO\E -M)#7_.#A!_VQN'B'_(2,F_RDM+_\H*C'_3E%6_Q46%_^1B8?_ -MT\# _]"]O?^DF)3_3$,]_T-$/?]35T[_BH1\_YR+A?]I8V'_6EI=_SQ$3O\W -M1%7_-T=;_S%"6?\Z25S_,SQ#_RHP,O\A)RG_-CH\_Q88&_\G)RK_,C@Z_S,_ -M0_\K,CC_+CH^_RPW./\9(2/_*"PN_]K2U?_;TM+_X=C8_][5U?_HV=K_Y]77 -M_^C6V/_GU=?_]./C_]3)SO]X_S%"6?\T/$;_%A@;_Q06'?\Z-SW_&18<_Q<9'O\O -M-SO_'2DM_R$J,?\C,33_(S Q_S R-?\K)2G_Y]//__+;UO_OVM7_]^+=__?B -MWO_ZY>'_]>#;__?BW?_]XMO_S[FZ_VAB:O^IJ[#_D8V5_WY[@?^XM;O_IZ6H -M_VUG:_]Z=X/_(R0U_R@I,/\I)RG___7K_]FE;/_-IGS_VJ1A_\JA8/_%E5[_ -MO91C_Q\- /\@&#K_,"I&_RHI,/\\/#G_3TI%_SDT+O\]-3'_U,3!_^W9U?\V -M.SG_(R@M_R0D)_\M,C+_%AH8_S$S,?\_/CW_+3(R_R(F*/\G*2S_'1@>_VQF -M9/_$M[+_[M;3__'7U/_VW=C_\][9__'>V/_XW]K_[MO3__G%@O_)O[O_ULC%_[ROM/]J -M8&/_T<7!_\R]N/]M9V7_)B@K_R(G+?\V.3[_)BHL_TI.4/\[/T'_1TQ,_SL^ -M/_\@(2+_'QT?_];*S?_&O+__&A88_QX:'/\Q-CO_*B0H_Q8>(O\N/TW_,3]8 -M_SE#3?\]4&+_,$1@_R8S1O\1%Q__.D=8_RXY1/\=&AG_*S \_RPL+_]A863_ -M+#0^_S=!1?\@+"O_+#4[_R0Q-O\K-SO_)BPN_RTK+?_GV-/_[]K5__+=V?_U -MW]W_^.'B__;@WO_VX=W_^.'<___GX/_FU=7_U?_TWM7_\N+8__7BV/_AS\O_V,7+_SQ$ -M5/\M057_.T5:_R=!;/\7("[_GY.$_R Q5?];763_%QXD_QLS6O\C,$G_$BQ- -M_R=6C?\L69G_,4V&_[Z^S?^NL*W_0#@[_QD4&/^!A'C_@'Y[_\:\N/_5QL'_ -MNJZQ_X%Y??_&O;W_R;V^_T1 0O\/%1?_&!HA_R,G*?\3%QG_%!@:_Q@<'O\1 -M%!7_'A\@_S$O,?\Y-3?_-C$W_S@Y0/\W.4#_'!LB_R8O+_\B(2?_'2HW_RT^ -M5O\Q/E'_)2HO_QXH-_]%3V3_EI6;_ZZII/]W?HK_,#I(_[*MK?\Y/TG_04)# -M_]'-S_\P-#S_-3U!_QLD)/\L,SG_("TR_S$]0?\8'B#_%187_]_0R__RW=C_ -M]=O8__G__#9VO_OVMC_[]G7_YJ.D?^$AHW_J*NP_Z";G_]F -M867_K*>K_Z:AI?]S;G#_$1(=_R F-O\N+C?_H9V?__SPZ__=IVW_RJ!R_\:7 -M7?^ND'K_.2(S_QX7-?\K)$+_*"$S_QP7'?\?&AK_(!D9_QH3&O\=&!S_*24C -M_\["O?_SW-?_/STZ_SDW.?]A6EK_-C@U_QP<&?\G)2+_+RHJ_YB,A?^FEHW_ -MT[VT_^_3R__ES\;_\-C/_^W1R?_LULW_\M;3_^+)R/^RH)W_N*:C_T8Z-O_6 -MSMC_-$=9_S1.7/\[/DG_.%:"_Q\?(O^QFGW_)3MB_T-%3/\Z/S__'#%4_Q8@ -M-/\@,D[_%SAM_R=,C?\L0'K_N[G)_X**AO\D("+_&!,7_W=Z;O]V=''_M:NG -M_]?'OO^^L;#_8%M?_U)-3_^PJJ[_B(J/_R$F*_\<'R3_&1T?_RTQ,_\R-CC_ -M)RLM_R4F)_\>'![_'QL=_YF4EO\X-SW_1DM1_R\T.O\7$QO_("0B_R$>)/\A -M+CO_,$!0_SD[0_^IHJ+_H**Q_TU79O][>W[_YN#>_Y*9I_\V/TW_P[BW_S@] -M0_\Y/CS_S,C&_S_QD1)?\T+D+_$ T9_Q84%_\8$QG_% T5_Q(/ -M%?\K*"?_Q;NW__#6S?^KHIO_:V5C_R,9%?\E("3_&10:_Q,.$/\<%Q?_$@T- -M_R(='_\?&!__(QPD_RH?'O\T)"'_.",A_RX<&?\G&1K_(AT?_QTB(/]U>7?_ -M0T5#_];1T_]::WO_&B8J_Q89)/\F3H;_&A\K_W)B4O\=-%[___CSLG_D7UU_SXU+_]&1#__\N'4_Y^'>/^LFHS_@W=N_]_0U/]!0$?_769M -M_T!#2/^;F9O_&147_YJ6F/^GHZ7_<&MO_R(B,?\E*#K_+R\X_ZZFJO__[M;_ -MQYMS_SX>!/\<%17_&108_Q40%/\7$A;_%A$5_Q,1%/\6%!?_%1,6_Q43%O\4 -M$A3_%!,9_QD4&/^^LJ[_Z-7-_VI=6/\E'!S_2D \_TI%1?\9%1?_%A(4_QH6 -M&/]12T__-2\S_R8@)/\Y,S?_%A$5_Q<2%O\9%!C_&A49_QL9'/\5&1O_.D1! -M_U%64/\R-T/_[-O._S5#6/\G(R'_$!8F_S1:C?\;&RK_4T X_QTI1O\9'"[_ -M&AH=_Q4=,?\;)3#_'2 Y_Q <.?\C-V3_(#UW_ZVQQO^2C8__+2\T_Q89&O]P -M&R'_)R(D_TA#/?\9&A3_$1$4_RDG*O^&?GS_+RTP_Q,6&_\0$Q3_*BXL -M_V=F9?\P,3+_'2 E_SD^1/\U,S;_+2PK_T!#5?\Q04K_@I"/_]W9V_\P-$G_ -M-D!/_[^WL_\U.D#_/$$__\W)Q_\O,3C_-C<^_SX^1_\G*C7_)24R_QDB*/^' -M@H3_M:ZU_][3R/^&<67_4U)'_RTL)?_?T,O_CGEM_ZF8B/]H9%S_TL+&_S]! -M2/\V.D+_0T)(_YB6F/\B'B#_E9&3_Y>3E?]J:&O_)24P_R$C,O\T-#?_K:BN -M___MX/\L'P[_'QPB_QT:(/\A'AW_'AD=_QD4&/\9%!C_%A07_R >(?\O+3#_ -M-S4X_SD[0/\_0$?_5E%7_\:YM/_NV]/_BGQY_T4V.O\I%QG_%@\/_Q,/$?\8 -M%!;_7%A:_VME:?]=5UO_2$)&_UM56?]54%3_%1 4_QX9'?\2#1'_C8>%_ZVE -MH_^]N+/_N+"L_Z6DJ__"L:3_4F)\_R,@'_\3&2/_1EN+_QD;(_]>4TC_$Q@Q -M_QH<*_\2$A7_%ATK_RHS.O\5%RS_#A4I_Q ;/?\C07G_HZF__XJ"AO\I(2O_ -M%1,6_V9E9/\B(A__,S0N_XZ%?_^BG)K_%Q47_RHG(O^(@'S_C(6%_Q\:'/\9 -M%QK_%A06_Q04%_\8%13_,28?_V5=6?]84U?_-#(U_XB ?O]544__@()__X:( -MA?\W/#C_&!L@_V-C9O]N:6G_L*RN_[VZN?]W=V[_.SY#_SA#1/]\B(7_W-C: -M_SD]4O\Q.TK_OK:R_S,X/O\^0T'_S\O)_S(T._]"0TK_-S= _RTP._\E*#/_ -M(RTQ_[RSL_^VJ[#_X-/&_XAN8/]223O_8EA-__'F[_G(]^_VEC6__4 -MQ,C_.#I!_S@\1/\^/4/_D(Z0_R <'O]>6ES_-# R_VUK;O\F)C'_(2,R_S,S -M-O^OJK#_^-?H_Q@:&/\6$AO_& X7_Q02%/\5$!3_$PX2_Q@3%_\Y-SK_/SU -M_TI(2_]%0T;_0$))_T-%3?]'0DC_T+^Y_^W7S_^$=7;_(!@<_QP7&?\7$Q7_ -M&!06_R\K+?],2$K_6U59_TQ&2O\4#A+_(QTA_S$L,/] .S__&A49_Q0/$_^Z -MKZC_Q;&I_Z")A/^ ;&C_:V-F_[BFF/\S1F3_&!D:_Q(7'/\C)E#_%1@=_UQ8 -M2?\:&"O_'1TH_QH8&O\6&"#_(RPR_Q86)?\4%A[_&!PQ_R(Z:_^4EZC_I)N; -M_T,^0O\<%AK_03Q _QH8&O\;'1K_2DA _Z&>F?\:%AC_+"LJ_T! /?\R+R[_ -M$P\1_QH5&?\>&QK_*"PJ_VEI9O]B4DG_MZJE_\*ZOO\E("3_9U]=_Y^7D__B -MWMS_<7-Q_TM/4?\V.#W_7UI5_V)64?]/35#_6%)6_TU-0O]+2DG_&1P=_W5^ -M?O_=V=O_/$!5_RHT0_^_M[/_1$E/_S@].__/R\G_*2LR_ST^1?] 0$G_*RXY -M_R8L-/\9)"7_P;:U_\*RMO_CU,[_=5U4_U!&._];44/_Z]3/_W]L8/^+@G'_ -M9F!8_]3"QO]!0TK_.CY&_T5$2O]^?'[_(Q\A_Q\;'?\B'B#_:6=J_Q@8(_\5 -M%R;_3$Q/_[*ML?_YV/?_%A$5_R$1%?\=#QC_%!(5_Q40%/\8$Q?_%Q(8_PX) -M#?\U,#3_1D1'_U!-4_]&1U+_5EED_TQ'3?_&M:__Y]+._XQ_?O\;&1O_%1@9 -M_Q43%?\8%!;_&A88_Q82%/\1"P__#@@,_R :'O\;%1G_% \3_R ;'_\4#Q/_ -M'AD=_S\^,_^]M*;_P+*I_[RVKO_'O[O_JIN._TA;>?]34%;_&A\?_RLF2O\< -M'B'_6%9'_QX8)O\?'2;_&1<:_Q04'?\E+#+_$Q8B_PP-%/\:&B?_#!I!_T9& -M4?_ N;/_)B@F_QX9'?\6$17_%A89_Q(5%O\E)A__5E-._R,?(?\A(R'_)"DE -M_S]$0O\?(R'_4U%3_VYL:?^*B8C_'1\=_XMX;O_(M+#_UL?+_R,=(?]:5%+_ -MP[V[_^+:W?^!?H3_*"HQ_R ;(?]Q96'_?G-L_SH\0?\7$AC_6%9._S0Q,/\Z -M.#O_;7%S_]G6U?\Z/U'_,3M)_\*ZMO] 14O_.3X\_\C#P_\G*RW_/D!#_T9' -M3O\H*S;_,C8^_Q&!S_+RHD_ZF?E?^/@7C_:V-9_W%@6O^2C8C_0%-E_R$9)_\9&1S_ -M(R$T_R A*/]F85O_%A(:_Q\?*O\6%B'_'AXI_R$@_\6&!W_&1@>_R_QX='/\M+"O_-#,R_T)! -M0/\N+2S_*RTJ_WA]=_^@GI?_CHB&_^#5VO\;'!W_;5Q/_]W(P__MU=K_,2DM -M_T$\//^UM[7_XMC;_X:$A_\R.C[_'1LD_VID:/]H96#_4590_VEG8O]$03S_ -M8U]=_R4B(?^)B8S_X]W;_SQ 3_\\1E3_M[*M_T%&3/\]0$'_H)ZA_S Z-_] -M1D+_24A._S8Y1/\I*C7_(BHL_\2YN/_$M;G_V -M_V]J;O]Q;7W_*"E"_RPN-O]I;&W_XMCA_R@C)_\>(![_,S$L_S&_\_ -M/SS_0T- _R0B)/\?(1__/T1 _V=D7__-R,/_ZMO@_R:_TM56?\6&!__)R@I_VUL9?]+3T?_8F-< -M_RHK)?]?9&#_45E6_XJ.D/_AV]G_/T-2_SQ&5/^ZM;#_049,_T!#1/_+RD9#_,R0D_R09&/\G&1K_3D=!_SA# -M3O\:$R3_%!46_Q<4)_\I+#?_,3,V_R0D+_\='2C_(2$L_QP<)_\4%A[_$! 9 -M_Q,1&O\3#QC_%A,@_Q<:)?\H+3/_/#H]_S\].O\].S;_/3LV_S\]./\Q+S'_ -M'AP?_QH8&_\<&AW_'!H=_Q<7&O\8&QS_BX>%_]#(Q/_IU]O_*28L_S4S+O_4 -MQ\+_[]?<_RXF*O\Q+"S_MK&Q_^G9W?^8F)O_6&9I_YRDKO\3%AO_3DY+_WM] -M>O]76%G_*RTP_RDS-_\X1TS_@XB-_]O5T_] 1%/_.4-1_XN&@?\^0TG_1DE* -M_\O)S/\Q.#[_0D5*_SX]1/\I+#?_-3<__R@P,O_!MK7_OJ^S_]/1SO]#0T#_ -M04=#_UI:5__,RL?_3U%._UA=6?];75K_T+_%_TI-4O^TM[S_:F5K_YR6GO\F -M(27_IJ.B_YV8GO]J96G_=7&!_RDJ0_\R-#S_B82(_]C0WO\3%B?_.4=<_Q$> -M._]!3&7_*"]%_QL=+/\<'"?_(1HB_RTF+?\P*S'_,S$T_S0O,_\_04;_-CA -M_SHX.__8RG[_,"HN_Q80%/\W,37_&1<9_QP8&O\B'1__'QT?_Q00$O\N -M*2/_/45/_Q0*&?\3$13_$Q B_R$D+_\@(2C_'!PE_Q<7(/\<'"7_&AHC_R(B -M*_\;&R3_%A0=_Q<3'/\5$A[_%!0A_Q49(?](24K_24M)_RHM+O\<'R#_&AT> -M_Q@:'_\8%Q[_&A8>_QX?)O\F)2O_.#H]_QPA(?\Z.SS_O+FT_^?5V?\F("C_ -M+C(P_\*VL?_UW>#_*B(F_R\J*O^SK*S_V,O*_Z*=H?]7:V__FZ*N_Y>9H?\G -M)BS_'ATC_R(F+O]E9FW_L;;"_T9=:?^"BY'_V]73_T-&4O\Z1%+_LZZI_T-% -M3/\[/C__OKR__S$V//\[/47_0#Y'_RS_R,E -M*/\F*"O_("@J_RHN,/\M+3#_*R\Q_RDJ*_\O+S+_'B(D_T-(3?]%2DC_T+_% -M_R\F+?\H*2K_KJ*=__7=X/\I(27_+"\ -MP?^GDXO_O:.6_["6B/_!J)?_R+&?_\VRH?_!I9?_R;*F_]O'P_]:7%__KK"X -M_UA56_]U<7G_)R(F_YN9EO^/BXW_75A:_VMK>O\I+$7_-#0]_VA=8O_MV>/_ -M(A@A_QT<(_\='"/_*2,K_Q@2&O\8$Q?_'QT?_R0@(O\>&AS_'!@:_QH6&/\> -M%Q?_)2 F_ST\0_\F("3_HYF<_[2NK/^)AH'_+"DH_QX8'/\4#A+_KZFM_QL5 -M&?]P:F[_*"(F_UM56?\W,37_F8Z3_V1<8/^"?(#_$PX2_Q40$O\F(2/_)R(D -M_Q\:'/\.#A'_%A(4_Q(>,_\H-5+_$A$>_Q(/&_\4$1W_%Q0@_QL8)/\>&R?_ -M'QPH_QH7(_\@'B?_'QTF_QH8(?\2$!G_$1 7_Q(1&/\3$AC_%!,9_R$C)O\> -M("/_.CP__SH\/_\4&AS_-SD\_U!+3_^4B8[_:V1K_X)]@_]"0$/_8V%C_Z6C -MH/_IVMO_*R4I_RXN*__-P;S_\MK=_R8>(O\I)";_L*"H_\# O?^ZJ;G_,TQ= -M_V9U>_]OA)#_;H:9_UEXBO]RD*;_;Y"<_V*-G_\H/$K_@H2'_]C0S/].35K_ -M.41/_UQ>5?\Z.T+_,S_V9B:O\E("3_E9.0_XR(BO]E8&+_=76$_RTP2?\P,#G_KZBH -M_^G(O]",CK_,2 F_R$5%O\F&R#_'!,:_QT7&_]- -M1TO_&A08_Q<1%?\<%AK_*B0H_QP6&O\>$QC_% P0_QP6&O\7$A;_%A$3_QT8 -M&O\G(B3_'QH<_QL9'/\>&AC_$AHJ_Q8=,?\7%R+_&QLF_QL;)O\;&R;_'!HC -M_QT;)/\>'"7_*27K_WM;2 -M_TE(5?\M.$/_+#0J_TU.5?\[/4#_+S(S_R(/\C'B#_'1@:_R,<%O\<'B/_*",I_QX:(O\='2;_'1TF_QP= -M*/\L*S+_,C$W_R ?)?\8%QW_&A<=_QH7'?\9%AS_%Q0:_Q<7&O\='"+_)B4L -M_QT:)O\7%AS_7EYA_S P,_],3$__+BHL_QT@(?\Z0D3_&1L>_Q47'_\<'"7_ -M$Q87_V-?7?_$O;?_ZMK7_RHF*/\G(1__LJ:?_^/+SO\P*"S_,"PN_\.WL_]N -M=W#_N[6Y_S]27/^0D9+_PL3)_S<]3?\Y057_>H&'_]3,RO]H:'?_/$95_SQ" -M1/]T;&C_3$M8_RXY1/\1&Q+_(B0I_S@Z/?\5&AK_)BLP_SD\0?])2$__,C8^ -M_S0U0/\@)2K_JZ*B_\:WO/^LFY7_JI2+_ZB3A_^?BWW_EXA[_Y>%>_][:&#_ -MBGQS_^?2S?]C8V#_JZNN_TI%1?](14O_(!L?_X)_?O]I96?_9%]C_UU=;/\C -M)SW_/#U$_Y60EO_DT>?_*28L_S V0/\V,S__(R,L_Q,4'_\3%!__.SQ'_RLD -M+/\N+"[_/S0S_UI25O]965S_-#)_\L -M*2__(" I_QX;)_\6$1W_%Q(>_Q<2'O\6%!W_&1<@_QT;)/\?'2;_&AHC_Q<7 -M(/\<'"7_,S,\_U=46O\J*"O_$ X1_QH8&_]@8%W_>'IW_SP_0/\5%QK_'B E -M_T- 1O\9)B?_65M>_\6RLO_RU='_-RY_S4J+_\Q+S'_ -MSL*Y_V]UA?_,P<#_.TA9_Y".D?_*Q<7_-#Y-_R\[2O]Y?G[_V];1_VUO?O\R -M0E7_+3LZ_U122_]245[_,CQ*_QD='_\5&1O_,C8X_SH^0/\Z/T7_/3]"_TQ. -M4?\P-#S_)2LU_R$D*?]K:&?_N["U_]/(Q__-P[__U,K&_]S2SO_EV=7_Z-K7 -M_^77U/_JW-G_]N+>_UQ>7/]L;G'_)"$@_SLY._\?'2#_1D1'_QH8&_];6F'_ -M'A\P_R0G./\T.#K_@H""_^'3[_\K+37_2%%?_RXP/_\:'2C_)BHY_QTA,/\0 -M%"/_5U!:_VEK;O^^L+'_Q+G _V5E;O].4%C_1DE._RHE)_\E'A[_(1H:_R,< -M'/\C'!S_*"$A_R$:&O\I(B+_+B:_\W(R/] 2EG_.454_VIS<_]S<&O_ -M?7^._S% 4_\T0#__1T4^_U958O\B+#K_/D)$_SD]/_\_0T7_/4%#_SQ!1_\W -M.3S_/D!#_S T//\G+3?_(20I_R4G)?^BG*#_YM'/__OBW?_XW]K_^N'<__WF -MX?_ZX][_^.'<__GBW?_TV-K_;6MM_R8F*?\X-3#_DY*1_R4C)?\B("+_(1\A -M_U-26?\N+T#_)"_RTH*/\U,##_'AD9_RTH*/\D'Q__)"(D_XM^>?]%-SC_)C15 -M_Q(>._\8&2K_%A,?_Q85(O\>'2K_&AHE_QX>*?\8&"/_%!,:_S(Q./\?'B7_ -M(!\F_QX<'_\>'!__'!H=_R_R@I.O\D)SC_-#@Z_TA&2/_AS^/_,2PP_R(C*O\R+C;_)2 B -M_Q0/$_\>&1W_,2PP_T,_1_\H*B__S+_$_]G(TO]85FG_1DE;_T-#3O\I(27_ -M*A\>_S0I*/\N(R+_*R ?_S H)/\L)R+_-"\J_R@C'O\R*B;_,B*/\>&B/_&ADF_QD:)?\8&"'_*2DR_S$Q.O\K+"W_(R(A -M_R$?(?\?'1__'QT@_QP:'?\7%1C_-30Z_Q<4&O\5%1C_'R A_R\I+?\C)"7_ -M4TI$_X5V_QD5%_^EGI[_VL_6_T-#3O\\/$O_0#I( -M_S$J,?\G("#_(QP<_RLD)/\F'Q__+",C_S4L+/\X+R__,"(2S_,S(X_R4C)O\@'B'_'AP?_R,@ -M'_\A'AW_(1P@_R$<(O\F'R;_'AD=_QP;(O\O,SO_FI&8_YRAH?\V3T[_15]H -M_SHW1/^3@XO_N:JN_V%:8?_DW>?_?H&2_T%)7?\N*C+_FY::_\_ NO\W+#'_ -M*R@N_[:II/^]KJ__?7)Y_R@C(__%N;#_FY&-_\C'SO],3E7_%A06_W^!B/]# -M35O_.D95_QTL*/],3E/_CXJ<_R@R1O\?(R7_2DM,_QX@*/\H*SS_.SU$_S0X -M.O]"2$K_.T%#_RXQ-O\N,3;_*2PQ_RHM,O\F*S'_*"LP_S0V.?\D)2;_PKBM -M_[>CF__@R<3_BWEO_Z"-A?^[JZC_8UM9_U-+0?_FU-#_XLW+_Y:+BO\U.CK_ -M,S@]_R$>'?^0BH+_>WEQ_R8F*?\E*#3_*RX__U-26/^%A8+_V,O=_RXF,/\Q -M+##_'QLC_QL7'_\B'R7_'1H@_S M,_\Q,3K_%Q0:_S&R'_'!D?_QT:(/\H(RG_*R8J_RLC)O\M)"3_ -M)",B_V=E8/]F85O_*!T<_[*GKO]S;77_)B7%[_ -M-#8]_SQ'4O\\2U'_'RD?_T5(0O^5E)O_*2\Y_UQ?9/\;("7_+C9 _Q@B,/\] -M1DS_-#H\_T!"1?\9%QK_%QD>_RTP-?\I+#'_+C$V_R$F+/\B)2K_+C S_SDZ -M._^^M*G_K9F1_^++QO^,>G#_F(A^_\"TK?]_)?\='"/_(!\F_QX>*_\G*"__95Y>_]_0T?\W -M-3[_,# __T0^3/]".T+_+28F_R4>'O\E'A[_(AL;_S J+O\9%!C_%1 4_Q<2 -M%O\:$A7_(AL;_RLD)/\K)"3_-C$Q_R4=(/]^)/]L:VK_,"LF_YN.C?\I(R?_N*VF_R@>&O]I:&__1$9- -M_QL?)_\W0$[_1D]@_S]"3O\0#1K_"0 2_R(7+O\.!QG_*20P_QL;)/\Q-$#_ -M*"\]_R0F+?\9&1S_24E,_Q04%_\;'2+_*2PQ_R\R-_\N,3;_)"DO_R,F*_\F -M*"O_/3X__[ZTJ?^SGY?_YL_*_Y.!=_^.>W/_P;*M_VE?6_]>4DG_[M_:_^33 -MT__7R,G_14!$_SDZ._\C(1[_85]:_RLP+O\I+2O_1TE1_S0T1_\T+SO_TL;/ -M_]3$V/]%/D;_(R F_R$?*/\W-T+_.3I%_U-47_\F)B__*"@S_Q\?*/](0$/_ -MWL_/_T,_2/]#0U+_/#E&_T [0?\D'!__*2 @_S(I*?\S*BK_&1,7_QH5&_\> -M&1__'1@<_QL3%O\@&1G_)1X>_R@A(?\P*"3_D8B"_]?(P_]J7EK_)R(D_R$; -M'_\H("/_,2@H_R0B'_]>8V/_8F9H_XJ%A?]02$;_(!T<_Q\='_\C'!S_)1TA -M_R$;'_\F("3_*B(E_T])1_^1CHG_G)>1_[2PJ/\V,3'_,"LO_W]^A?\T.$#_ -M9&9D_[NVNO_(O^EF93_@GEY_R\Q -M.?\R-#S_+35%_SI%5O\(#R/_)1TX_VIDGO]13I#_.#AQ_Q@;2O\:$BW_+RD_ -M_Q01)/\7%R+_&!,7_QL8'O\A(23_J*BK_RLN,_\L+C/_-CD^_RPN-?\C*"[_ -M'B$F_R4G*O\S,3/_P+:L_[*?E__>QL/_DX%W_X5T;O^MFY__;&IL_X)[=?_D -MU];_X\[,_["?G_^[LK+_)R4H_R\J+O\T,3#_("8H_U]F9O\L-#[_,C=)_S P -M.__3R]7_U'RK_&ALF_R0=)_\8$1C_&1,; -M_RXG+__DU=G_1T!*_ST]3/\V-D/_3TI0_RH>)_\I'"'_+2,?_R\C)/\:%!C_ -M(AP@_R(='_\J(B7_)R @_RDB(O\K)"3_*2(B_S0J)O]E9F#_X-/2_X%O$!G_'Q8=_QL9 -M,_]75X#_4E)Y_P\/'O\E("#_+C0\_T-!0__;TM+_*BDP_RXM-/\V.$#_*RXY -M_R8J,O\A)"G_*RDL_SHU-_^_L*K_UL.]_^W8UO^>BX/_A8!T_]C S_] 3E?_ -M+ATC_W9VA?_6Q\?_.# S_V]L_R <'O\@'2/_ -M>G)P_SP^1?]'5V?_.T53_SE"0O\;%C+_:5:$_Q4,'?\3%!O_$@X6_Q80&/\4 -M$1[_%Q8=_PH&%O\Q*T'_&14>_R4<'/\_0TO_24=)_];1T?\@'R7_+BTS_S$S -M.O\N,CK_,#4[_R4H+?\P+C'_(1P>_XM[_]Q;67_R[;, -M_Q_O?\M*"K_1#]%_RTI,?\X,3'_GY6+_X6$??^-BHG_ -M9F9O_RHM/O]%04G_Q+W'_]K#X/\E'"/_&!$8_R$0&O\A&B'_&QLD_R(H,/\M -M,#O_)20J_RXM-/]545G_ULS/_T([1?\[.TK_4U-@_U-.5/\P*";_(148_RP@ -M(?].13__O[.L_]S/RO]&/CS_*"(F_R,;'O\I(B+_)1X>_RDB(O\S*27_B8J$ -M_][1T/^@CI#_*" C_RG/^FG)C_P[>P_YZ6E/\H(R7_*B(E_U=(2/^4DH__WM+5_^+3V/\O -M+BW_)" B_R(>)O\W.D7_/4!!_[RTLO_:R\O_XM[<_U5:5/\U,S7_8%E@_Z.8 -MG?_MU]C_SL7,_SQ!3?\<&R+_8EI8_U5/3?\:%17_(Q\A_R$?(?\<&AS_'QT? -M_Q\='_]834S_2$E0_T939/]!2%;_)QTP_STK+?^KDH'_=EI7_UH]//^8=6[_ -MA6%7_X1B7_\K&!+_EH%__Z>1D_\4!@/_-RDF_T)$3/])2DO_U=+1_QP>(?\L -M+2[_/T)'_S U._\L,3?_)"_RPH*O\\-SW_+R@R_T X-O^@E(7_@GES -M_XE]?O]?6V/_)BDU_SLZ0/^\M[W_S+S8_RDJ,?\4'R;_&QTD_R(B+?\E*C;_ -M/$1._Q,:(/\E)"K_*RHP_SDV//\?&!C_/3E"_SL[2O]*2EG_4U!6_RLC(?\X -M+"W_*AXA_RLD'O^7BX+_V,S%_UE.3?\J)BC_(!L=_RHC(_\J(R/_*"$A_S F -M(O^)BH3_WM'0_Z22E/\H("/_)Q\B_RHC(_\K)2/_+RDG_VUN;_]@96K_)B$C -M_Z21A?_ K:7_Q[NT_\6YL/_(N[;_JJ.C_R@E*_\E(R;_1C@U_[>PJO_?T-#_ -MZMO<_S0Q,/\D("+_'AHB_S7O_>GU^_W5[??]H -M96O_KJ.H__/AWO_8S=3_24Y:_QD:(?\H(B#_)A\?_R8A(?\A'1__'!P?_R > -M(?\A'R'_'AL:_T8W-_]!.T/_1T]?_U9;9_],3E7_#0,,_RL4'_\R(2?_%0H7 -M_R$4'_\G%Q__&0T6_R$:(O\8"QC_)A@G_R :(O^6BHO_1$)+_T=(2?_1T,__ -M+"XQ_TQ.3/\9'!W_("4J_SQ!1_\I+C/_2$-'_][6V?^)>&O_P:NB_^G3R_^8 -MA';_?W1I_]>[S_\<+CC_+"4L_R8Q//^1D(__*28E_S8P-/\I(RO_1S\[_YN+ -M>_^1AG__D8.$_TE$2O\B)3#_(R,F_ZZLKO_=SN;_)RLS_SM)6/\G*S/_-C8S -M_T) /?\_.SG_&Q,1_RPM)_\M,R__66%=_]72T?\X.4#_+3 \_SHW1/]I9&C_ -M+"(E_RXD)_\F'Q__)B(@_ST\-?_7R\?_;%M;_R8?'_\A'AW_)R @_R\F)O\M -M(2+_-2@G_XZ.B__>T=#_LZ*B_RDD)/\D'Q__*",C_RHE)?\X,"[_96=E_V)I -M:?\B'2'_F8R!_\.RLO^#?';_:6=B_^76VO^MH:+_*28E_R4@(/\X,RW_O;2N -M_]3(Q/_DW-K_.#4T_R0@(O\@'"3_,C5 _SY%1?_"L[/_S+^^_^_DX_]Q:G;_ -M1U-<_UY=8_^YJZS_Z=K4_^70U?]%15+_&!HA_R0?(?\F(B3_(Q\A_R <'O\@ -M'![_(1T?_R(>(/\>&AS_-2EHO]955[_0D5& -M_];3TO\K+3#_.#HX_S4W-/\R-3K_,#$\_R@P-/_&NKO_Y]C=_Y5_=O_)L*O_ -MY'!G_(QL?_Q<; -M&?\?)1?_/D,W_SE"-?\M.BW_(RX;_R)"+?]ICX#_QL7$_TE$2O] /D?_-2\W -M_T Y.?\N(B/_)1L>_RLD)/\E(1__("0<_\C#OO^#<'#_,B0E_R0='?\G("#_ -M,RHJ_RTA(O\P(R+_AX>$_]K-S/^_KJ[_*20D_R0?'_\M*"C_,"LK_S8N+/]E -M9V7_7V9F_R,>(O]V;&'_:EU<_XR*@_^,CXG_Y]C<_["DI?\O+"O_)B$A_RLJ -M(_^MIJ#_R+JW_^O@W_\Q+BW_(Q\A_QL7'_\P,S[_/$-#_[^NKO^_L+#_\N7D -M_VYH=O])5F'_5E=>_[*FJ?_AU<[_Y]+7_S\_3/\@(BG_)2 B_R,?(?\C'R'_ -M(!P>_R <'O\A'1__(AX@_QX:'/\K(R'_24M._T926_]:96S_1$]:_SE#3O\J -M,3__,C%._S G8_\T*F__/S9\_UM1FO\8%4G_95^+_T$]7?\Y04O_E923_UA4 -M7?],3U#_V=;5_S R-_\P,3+_24M)_S R.?\Q,CW_)R\S_\.WN/_DU=K_?G%L -M_\"KJ?_WC_U\K)_\BWM_\H(R/_)2 @_R_WMP9?]H65G_LJNE_YN9E/_DU=G_MZNL_S,P+_\G -M(B+_(2(;_ZZIH_^MGYS_Y=C7_S,N+O\E(2/_)" H_SD\1_\Y/C[_P*VM_Z>6 -MEO_NW]__8UUK_SA)5O]#1T__JZ"E_^'4S__FT=;_/3U*_R B*?\H(R7_)B(D -M_R4A(_\B'B#_(AX@_R(>(/\B'B#_(AX@_R,;%_]14$__/$5,_XB*D?^+B8O_ -M24]1_SM'3/] 2%+_>'I__T9'3O\H+CC_'"4S_TQ55?]Y>GO_Q\')_SD^2O^+ -MB8O_3TM4_T)%1O_)QL7_+S W_RDI+/^8F9K_/#Y&_ST,W_J9B8_R8C -M(O\A'AW_)R @_RXE)?\N(B/_,20C_T1%/__7R,C_S+N[_R@C(_\E("#_)!\? -M_R8A(?\N)R?_*RDK_SH_/_\?&A[_;U]6_W]O;/^1B(+_I)^:_^C9VO^ZKJ__ -M+2HI_R,>'O\D)1[_KZFA_Y.'@__BU=3_/CDY_R,?(?\C(";_1$=2_T1(2O^\ -MK*G_DX*"_^?8V/^#?8O_-TA6_U]B;?^O_\RPK/^9C8;_V<37_R,Q0/\E(2G_)BLQ_WAX -M=?^=F)+_D(N+_X![>_^(@7O_9V!:_UQ=9/^5D)3_*"HM_S=#1_\[1$3_9FMK -M_][;S_\M*BG_,"XW_S@^.O]_?HO_9D.*_Z-[K_]%+$O_JHJ]_WM8F/_3PLS_ -M[-K0_TI&3_\^/DO_4U)?_ST\0_\K(R'_+R,D_S D)?\^-##_ _]W+R/_2P<'_)B$A_R0? -M'_\H(R/_*R8F_R@C)_\I)"C_)B$E_Q\:'O]S8V#_C(![_WIWWO\Z-37_)R,E_R0B)?]256#_ -M1$=3_[JKI?]U9V3_Z=O<_Y6)DO] 2EC_7%]J_Z.;GO^?F)C_Z-O6_T-#3O\N -M,3S_*B8H_R8B)/\C'R'_)" B_R(>(/\B'B#_(!P>_R(>(/\7$!C_*2XT_\K% -MR_^\M+C_W-/3_U%59/\A*3/_0$=3_VQN=?^7CH[_W,W2_TY17?]L;G7_=VUP -M_]W.T_]$1U+_AHN+_V%?:/\^04+_QL'!_RO_4R-?_+BY!_R$C*_\Y -M-3?_C7QV_]K#M_]!-3;_)R,E_V!>6?^$A7__B(B+_Y2/D_]P<7+_2E-3_U5: -M6O^'B8S_Z+O?_XA.H/^F9-'_QYS2_UQ(4?\U&3/_1S [_S4N*/^)?7G_FHF4 -M_]3(Q/_MVM3_4T]7_S'O\J)27_)R(F_QH5&?\A'"#_'!<;_U1$0?^6BH7_8V!;_ZFC -MH?_;S5E+_Y-O;_SPW-_\G(R7_'1L> -M_T!#3O\[/DK_L*&;_U]13O_DUM?_K:&J_T)-6/]35U__7E=7_X%Z>O_DU]+_ -M3T]:_RTP._\D("+_)2$C_R,?(?\D("+_(AX@_R,?(?\F(B3_(1T?_RLC(?\S -M,2S_74Y._ZB>FO_7S\W_3U-B_RLS/?] 1U/_7%YE_X^&AO_FU]S_24Q8_U)4 -M6_]C65S_VLO0_SH]2/]^@X/_85]H_TE,3?_>V=G_+RXU_R\N-?^4DIO_/#U( -M_SU 1?\N-#[_MJFH_\"LKO^JD8K_HHA]_ZJ4C/^YGY3_CG]R_\K#S_\P,S[_ -M(R8G_XU_@/^3@7W_WLO%_TH\/?\<%A[_(1\B_UQ>6_]K;VW_='%P_W]^??]W -M?'K_9VMI_UU@8?_FQ=;_;DAI_]RUV/_[XMW_54A-_RDB+/\I)C+_-35 _WIS -M9_^5C7W_R[^Z_^30S/]'1$K_,S- _S@W1/]655S_*2$?_S(F)_\S)RC_-"HF -M_Y&%?O_9RL7_Q;:V_RLC)O\B'1__)1T@_RXE)?\K(!__-BHE_X* >?_2P+W_ -MTL'!_RDD)/\E("#_)B$A_R(='?\<%QO_%A$5_Q<2%O\;%AK_134R_Z>;EO]. -M2T;_IJ">_]W/S/_7S,O_,"TL_R8A(_\R+BS_Q+:G_U5-2?_BV=G_.C4U_R8B -M)/\:&!O_(R8Q_T)%4?^FEY'_4D1!_^'3U/^WK+/_/$A1_U9;8?^9DY'_D(F) -M_^GAWO_<&-8_]K2T/]35V;_+34__T5,6/]:7&/_?71T_^G:W_]% -M2%3_3U%8_V!66?_>S]3_1$=2_XZ3D_]T_][:&#_R[_( -M_T$_0?\X,R[_9EM:_SX\.?\J+"K_-C0V_R =(_\V-SC_='AV_VIM4E/_-#$E_RPH)O]$ -M.T+_>FYE_XZ%=__)O+O_W(/\F'B'_+20D_RXF)/\V+2?_;FEC -M_]K(Q?_/OK[_*R8F_R4@(/\D'Q__*",C_Q0/$_\4$!+_%A$5_Q@3%_\P)B+_ -MLJ6@_T-!.O^ZL*S_T\?#_]S1T/\T+R__)R(D_S@T,O^_LZ3_23\[_^79VO]" -M/3__)B(D_R ;'_\C)C'_0D-._ZB_T-&4O]46V'_1CY!_]O/TO] 1E#_<'-T_VEH;_]'2DO_GIJ<_S0V._\M -M+#+_IJ*K_S8Y1/\O,C?_+C0^_Y^2D?^QGZ'_:U]:_UQ74?]H:6/_;FIB_WUK -M9__#LKC_ULS(_]&_O/]V85__JJ&A_R0C*?\_-SO_)B0A_XN.B/]G;&K_455= -M_W%P;_]^?'?_5UE6_U!12_]344G_X]/*_V=84__ATM+_Y=#+_VQ@8?\Q*C'_ -M.3,[_SPX0?^+@GO_?G5N_[ZRK?_@S,3_349-_SL]3/])2UK_.C8__S H*_\L -M)27_+RHE_R\J)/^/BX/_S<&Z_]+ O?\N)27_)!\?_RDB(O\J(R/_*"$A_RWMP_\"KI__&P;S_V]/1_S0M+?\D'R'_/34S_ZJDE/]5247_ -MY]C9_TI$2/\I(R?_(AP@_R >)_\M+S3_B(6$_T Z,O_BU-'_R;C _TM48O]$ -M257_E8^-_Z.T]C_0$-/_S]+5/\T,C3_S<;&_SQ!3?]*1T;_8&%B_T-(3?]02T__ -M+3$S_RTM,/^JI*S_045-_SM 1?\I,3O_6E)0_]#$Q?^*C8[_?W^"_Y^=IO]6 -M76/_+C<^_SL]0O\N)R?_,2@H_[2GHO\J)2?_(" I_TQ'2?^'A'G_I:29_V=L -M:/]L='C_8W9^_X:(C?^"@G__1T5"_UI54/_8R+[_<6)<_]W/S/_FTLK_=VII -M_S4M,?\_.#__0SU%_V=@6O]N9V'_K**>_][+Q?]M9F[_0T15_U97:/]'0D[_ -M+24H_RTF)O\K)B'_-C$K_VQH8/_)O;;_U,*__RLB(O\D'Q__)A\?_RTF)O\J -M(R/_+2(/\_-S7_E8]_ -M_W!D8/_:R\S_95]C_RDC)_\C'2'_(!XG_ST_1/]%0D'_M:^G_]C*Q__1P,C_ -M04I8_U199?^0BHC_H)F9_^/1S?]W<'S_1D=2_R@C)?\J)2?_K*6E_Y2,BO^+ -M?GW_G)&6_R4@)O\J(B7_?W1S_UI<6O_$O;W_MK.R_[RNMO]-55__0DQ:_TE. -M8/]'3E3_<6QL_^+7W/],3UO_.45._X2"A/_:T]/_.3Y*_ST^/_]765S_/3]& -M_R@G+?\4&!K_)"0G_[NUO?]"1D[_049+_S$Y0_^1B8?_W]/4_U=I=_\W36/_ -M)SQ5_S!%7?](7'#_%R$O_QT?(O\F)23_4$5*_S G+O\?&A[_I9^7_["EGO^. -MAX'_;6]M_VYV>O]6:(S_2%%B_U!:2_],3$G_4TY._]?(N_]Z;&/_V'O\G("#_*"$A_R@='/\B -M(1K_%A8C_RDE+?\<'1?_RJVI_W-P9?_,L*W_L*BD_]_7U?\V+R__)!\A_S H -M)O]XM_UAA9_]+ -M5V#_/T94_T=/4_]234W_W-'6_U-68O]#3UC_A(*$_]3-S?\]0D[_'2,E_R\Q -M-O]/3UC_)B'O_6R<3_AH."_UI@ -M8O^/EYO_8F-D_RLF)O\N)R?_+24A_RLF(?]A757_HY>0_]3"O_\I("#_(AT= -M_R0='?\K)"3_+R@H_RXE)?\B'AS_3TU(_\O O_\M)"3_(QP<_RLD)/\M)B;_ -M(14>_U588_\@)%'_-S!?_QX<'__'JZ?_MJO^4CXK_W-'0_S@O+_\D -M'R'_*B(@_UU62/]V:F7_V\S-_X5]@/\H(B;_(!H>_QD9(O\^/T;_.3@W_[6O -MI__3QL'_V,?-_T--6/]%2U7_?G9T_UE45/_(N;3_B8.+_T]27?\E(R7_+"W5S_]K. -MS_\C)2K_'"$G_U-68O\I)##_(ATA_R(@'?\D(AW_(B_UM94O]".3/_T,*__S H -M)O\B&QO_)1X>_S I*?\H(2'_*B,C_R\I(?^0B7O_R;VX_RLD)/\B'1W_*",C -M_RDD)/\K(BG_6&)?_R I6/\\/&?_'!X<_[VHH_]B4DG_MZJE_W1Q;/_=S,S_ -M/C4U_R,A(_\H("/_/C@V_SLT+O]G6US_E(N+_RLD)/\>&1__&AHC_SQ 2/\\ -M.CS_IYN6_\>YL/_;RW__0D)/_QT; -M'O\G'2#_IIB5_]'%OO^JFI?_MJ>G_S$H*/\G(R7_-CP^_TQ04O]85%;_IIZ< -M_S4Z-O\B*RO_2%%8_T9/7?]045S_AXF,_^/4V/]24&#_-T%+_U]@8?^^N[K_ -M-CE%_R@K-_\_04G_1DA/_T5(3?](3E#_*2DL_ZVIL?])25+_,3@^_S$U-_]+ -M24;_R\+"_R4@(O\B&AW_N:VP_R@C)?\@'2/_'!LA_Q86&?\E*"G_LZRF_]C+ -MQO_BUM+_N[>U_T)'1_]P=G+_4EA4_SD^0__CU]/_[]S4_^S9T?_SX-C_^^?? -M_\2[M?]%.S?_>FQI_]2^M?^:BH?_+28F_S\]0/\V+S;_'!T>_SP[.O^4D([_ -ML:6@_W!H;/\G)S3_0DA8_V9D=/\E'2#_+B,B_RTB(?\E(1__)2,>_R 8%/_/ -MPL'_+28F_Q\8&/\B&QO_*2(B_R\H*/\M)B;_,"HB_Y.,?O_,P+O_*R0D_R(= -M'?\E("#_+2@H_RLB(O]?9%[_7F5S_UI:9?\;&13_PJVH_T'B?_ -M04=1_T='2O^;D8W_M:FB_]K(RO]26F3_1$Q@_Q\>*_\6&R#_4TQ&_V5?9_\I -M)##_*B(F_S@I+?^LEY7_V%@O]Y:FK_*R(B_RRK?_XW=;_^=[7__[C -MW/_]Y-W_P+*S_RLC)O\A&QG_K9J0_Z>8D_\P*BC_04 __S8Q,_]%2TW_1$A& -M_Y&(@O^:C(G_CH.(_RPJ.O]$15S_<6U]_RLC)O\M(B'_,"4D_QX:&/\>'!?_ -M&A02_\B_O_\G(B3_(AT=_R$:&O\G("#_*R0D_RXG)_\M)Q__AX!R_\_#OO\H -M(2'_(!L;_R8A(?\F(2'_)B0A_UQ@7O]G;&K_9&-B_R(>'/^]J*/_-RTC_YV8 -MDO\].S;_WLW-_V%86/\C(2/_*",E_S8S+O^ >W7_3$1 _ZJBH/\J(R/_(!LA -M_QD9(O\]1%#_/3Y%_X^'A?]934G_X,[2_T1,5O] 2%C_+BDO_TI&2/^!>'+_ -M(2$L_S4R/O\H(R7_,2("7_0$-(_TQ06/\[04O_3E!8_VIL;__4Q9?]+3E/_-#H\_QP<'_^>FJ+_1D9/ -M_RPO._\N,#?_,30U_TM*4/^KI*3_V\[-_^G8V/_KWMW_XM31_[^MJ?^5A'[_ -M=V1<_^?2S?_MV]?_T\O'_];+RO_3S\W_/T)#_V]Q;__JV];_^=[7___DW?__ -MY=[__^7>___GX/^BD9?_(QL?_QD4%/^,>V[_I)2+_R4@(/\^.SK_1#\__S=! -M1?]$247_CH-\_X^!?O^IH*#_/SQ(_SY 5?]84F#_+B_RXI*?\H*"7_8&)E_V5K9_]D9&?_(AT=_\*NIO\_ -M-"W_@X)[_QL<%O_:R\S_'_ -M_^;?___GX/__YM___>3=_YR$C?\J&B+_03LY_WUL7O][:V'_)!\C_T$Y-_]" -M.CC_+S@^_S(U-O^+@GO_>6QG_[ZTL/\V-3S_3U)D_TQ(6/\K(R;_*R$D_R\C -M)/\L(1K_*B0<_WAP9O_2Q\#_,B@K_R :'O\A&1S_+R8F_RXC(O\N)27_)R,A -M_VMJ7_^XKZG_*"$A_R$<'O\C'A[_+"@F_RPC(_]B8V3_8FMK_V%D9?\@'AO_ -MNJF;_R4=&_]W>'G_&!<6_\2]O?^4AH?_*" >_R8>&O];44?_95Q._V)>5O^Y -MK*O_*RHI_R8?)O\9%1[_.$%(_R_R$9'/\P)R?_+R0C_R\F -M)O\A'1O_7UY3_XZ%?_\G("#_(QX@_Q\:&O\J)B3_+20D_UE:6_]:8V/_:6QM -M_QX=(_^QI9[_'Q<:_S_["DG_^7G_\>#:__OB -MU?__Y-G__^7A___CW___Y=[__^7<__WDW?^FD8W_+B(>_S\X,O]D447_=F9< -M_QH5&?] .#;_,"@F_RDE+?\E(R7_:&A?_UM23/^XJJ?_,"HR_TY18_]&2%?_ -M,"LM_RLA)/\T*"G_,"4>_R@B&O^-A7O_QKNT_RXD)_\?&1W_'Q<:_RPC(_\M -M(B'_+",C_R8B(/\Z.2[_7U90_R8?'_\?&AS_*",C_R <&O\M)"3_4U15_UYG -M9_]B96;_(!TC_ZJ9D_\X*RK_6E12_W%K8_^TJJ;_IYN<_R8@)/\F(R+_65), -M_T,],_]V=&__R[Z]_RDH)_\A&B'_(!PE_SD^2O] 0D7_@H!X_YB.BO\@'2/_ -M6EQD_TA/6_]-5V7_045-_T-&4O],5F3_355?_R A(O\O*2?_J9V6_Z*,@_^L -MEH[_HY.0_RD>(_\D'B+_*BPQ_TE05O]+5%O_2U5?_U!17/]<96O_M[.[_T$_ -M3_\I+SG_EY.;_R(?)?\K-4#_)BX^_QH>+?\A(";_A8" _TY24/\U.CC_&1L> -M_SDX/O]!1$G_'ATC_S4R./\A(RC_*"PT_R4G+O\\/D/_/CY!_YF/>__!II__ -MY,NZ_YF&;O_3P[K_EHB)_S,M,?\G(B3_Y]+&_\:]M_]/5UO_86=I_^',T?_V -MWMO__N?;___HW__[WMW_PZ6G__S@W/__Y][__^;?_[.DGO\F'AK_.30N_U=* -M/?]Q8UK_&!(6_S(I*?\F'1W_*"$I_QT9&_]+3$7_44A!_\BVL_\H'B?_861U -M_T5(5/\X,S/_)QT@_S,G*O\S*"'_*R4=_VYE7O^_M*W_,BDI_R$<'O\?%QK_ -M*R(B_S$F)?\J(2'_)R$?_RHH(/\_.#+_(!@;_R ;'?\G(B+_)2$?_RHC(_]/ -M4%'_769F_V%D9?\C'B+_IY2*_VY=5_]<4$?_<&9;_ZJ>F?^SI:;_)R(F_R0@ -M(O])1#__,BTG_W-Q;O_+P+__+"DH_R,=(?\A'27_(R\V_SH\.O]J75C_(QX@ -M_T1)5?]#2E;_04E3_T--6/]/4EW_2U!<_TM59/],5V+_(20E_RTH(_^GEX[_ -MNJ69_Z6/A_]$-C/_)QT@_R8@)/\N+C'_/$-)_T=05_]C9V__HJ*K_U1=9/\N -M*S'_-31!_S4Z1O\:&"C_.3='_RHR0O\<("C_(" C_XR(AO]G6U;_BHZ&_X:+ -MA_]\?'__-SD^_TY15O\;'2+_*B(?^@C8'_8%!&_SDM)O]?54O_D(1__[6HI_\F -M'B'_)AP?_S4P,O\N+"[_85U?_\>^OO\N)27_(QX@_R$?(O\;'2+_-C<^_TU1 -M6?\^1$[_+C(Z_TE/6?]"257_14Y<_T!*5?]&4%O_/DA3_TE37O\A(RC_*2$= -M_ZB8CO^XI9O_:EI7_X5X=_\B&QO_)"(D_R@C(_\T.3__0DA2_["GI_^EH*#_ -M24Y:_TU+3?\X.D+_(2LZ_SA#5/\H,4+_'1TH_RDD*/^AG9O_6%-'_Z>'__^C;___FV_^CE)7_ -M(QD<_R\H*/] -S#_8%92_QH1$?\F'B'_(!H>_R0>(O\>&AS_+2LH_R,;%__" -MLZW_.34S_T)'3/]L<'+_-BXL_RXB(_\Q)2C_,RHD_R0=%_\Q*"'_DXB!_SDP -M,/\A'![_'Q<:_RHA(?\P)23_+R8F_R4>'O\8%!+_'!H7_Q40%/\;%AK_)AXA -M_R@?'_\J)B3_14=%_V-L;/]@9&;_(!\E_XIX;O]00CG_*Q\;_T4[,?]U:63_ -MNJVL_RDA)/\F&R+_+R@O_QP>(?\/$A/_44M)_RD@(/\A'![_(!XA_QL=(O\I -M*C'_/$!(_T9,5O\M,3G_6F!J_S]&4O])4F#_35=B_T--6/]"3%?_45MF_R$C -M*/\J(B#_I):-_TH\,_^)?GW_& \/_R0?(?\A'"#_4$='_T)$2?]%2U/_9U]= -M_W)M;?\]0D[_+RTO_S]!2?]%4F7_+#9%_R@H,?]12$C_M+"N_V1;5/^]K)__ -MHX^'_U=84?]H;6G_O[W _S(T.?]/45;_(2,H_S R-_\K+3+_(2,K_RTO-O\Z -M/$'_-C8Y_V1;5/^##__^7> -M_Z"1E?\B&A[_*20F_S(K)?]734G_'!,3_R4=(/\>&!S_'A8:_QL7&?\D)2;_ -M'AD;_[VPJ_\Q+RS_66%E_X*'C/\X,#/_-"@I_R\D(_\Q*"+_'A82_T(Y,O]3 -M2$'_*R(B_R(='_\>%AG_*B$A_RH?'O\K(R'_)1X>_Q0/$?\7$A;_%1 6_Q0/ -M$_\E'2#_*R(B_RLG)?\J+"K_9W!P_VEM;_\?'B7_?&QC_UI.1_\Q)B7_1#LT -M_UQ02__"M;3_+"0G_R8=)/\C'2'_*2("C_ -M("$H_SLZ0/\D(B7_'AH8_T(Z-O]0143_(1T?_R4A(_\B'B#_(Q\A_R8B)/_I -MU-#_HYV;_VQT=O]234__]=_=__KAX/_[XN'__N7D___IXO__Z>+__^KB___K -MYO__Z^;_E8B-_R$8'_\A'"#_*B4@_TI"0/\5#@[_)!P?_QT7&_\@&!O_'AL: -M_R@D)O]33$S_M*>F_S(P,O]A:&[_2D]5_R\G*_\S*"?_+B0@_R\E(?\;%1/_ -M+B@@_S\W+?\;$Q'_*20F_QX9&_\K(B+_,28E_RD@(/\H("/_%A 4_QP6'O\3 -M#A3_% \3_R$<'O\E'A[_*B4E_S@Z./]IYMO\Q*2S_)2 B_SLV,?^+@GO_:5E/_QT1#?\I("#_*B4G -M_S0R-?\7&1[_)"4L_TE-5?]67&;_1$I4_T]48/\Z04W_0DM9_U-:9O]#35C_ -M1E%<_TY79?\B'B?_+"(E_W5K9_\;%A'_)B(D_R >(?\A'"#_'18=_YJ-C/_@ -MV-O_/D%&_V!;5O^8E)+_-3M#_S P,_]+3U?_&A\E_XN)AO^QIZ/_8UI:_ZJD -MG/^:BW[_IYB+_V5E7/\\2DG_*S/8___HW?__Z^#_^^3?___KY___ -MZN;__^WG__WJY/^-?(;_(!<>_QT;'O\?&AS_.30V_Q<3%?\<&!K_'AH<_R,? -M'?]S;FG_M*NE_U!#/O]22DC_*2R_R\G*O\C(!__?75S_R,6%?\E'1O_(ATA_R0< -M'_\H(2'_(1TE_Q@8(?\A(2K_1TA3_TY17?]-4V/_1DY>_T5-7?\Z0E+_6U]N -M_T]99_]'5F/_3UAF_R1C_\Y.3S_;W!W_U!06?]E:&G_?W]\_X!X=/^\ -MJZ7_GY2-_Y>,A?]D7%C_1TU)_S="0_\J-3;_-#L[_X.)A?])3U'_)20J_S(O -M-?\A(RC_)RTO_R,D+_\Z/#G_Y.'@_RLH+O\A'![_IIN:_R$9'/\?'"+_+BLJ -M_Z.AF?^___HW___ZN+_ -M_^OC__[JXO__Z^/__NOC_WUL=O\>%1S_&!89_Q@3%?\M*"K_&!06_QH6&/\< -M&!K_65!*_S@O*?\T+BS_03P^_T5 0O\B("/_04E-_U9;8?\H(R7_*R0D_R8? -M'_\L)27_%A 4_QH7%O\<&A7_%1$3_Q82%/\;%QG_)A\?_RXF)/\F'Q__)2 B -M_Q81$_\;%AC_)2 @_RDD)/\F(2'_)B$A_R&R'_ -M3D<[_V]A7O\;%AK_0$5%_QL:&?]G8ES_)B0?_QX?(/\7$A;_(AH>_R$?(O\A -M'B3_(1D<_R(;&_\;%Q__("(J_SD[0_\_14__2E%=_T)+6?\Z0U'_1D]=_U9? -M;?\_3%G_2%5B_TE47_]-5V'_-S8\_R@C)_\@&Q__(!L?_X%Y?/\I(23_'!<9 -M_QL7&?^>F);_KI^D_T-%2O]74DW_D8J*_TA"1O_CU=W_Y=KA_Y&/F/]<5%?_ -MO*RC_[RIG?]]>W3_24Q&_S]$0O\Y1T;_+C(!W_9VID_WEV%AG_'AH<_]S4TO_PW^7_0T5*_V5C7O^"@(+_8%I>_^C6VO_IW=[_V-+: -M_^[@X?^]KJ'_BH)X_TU/3?\X04'_.$='_R\Y/?]%2DK_B9&._S Y.?]!3$W_ -M/T=+_R,B*/^?G*+_,S4Z_RPT-O\Q,CW_75E7_^;8V?]*04C_F)*0_YF4C_^/ -MCHW_C8N(_V1I9_]=9&3_9F5>_^W=T__VW-'__]_5__[CV/__YMW__^;=___E -MW/__Z-___^OC__SHX/_ZYM[__NKB___JXO]:25/_(1@?_QL9'/\=&!K_&!,5 -M_Q41$_\6$A3_%A(4_QT6'?\E'R/_/#_TU36_](2U;_ -M/SD]_R<@(/\B&QO_*"$A_Q42$?\3$13_&!89_Q(0$O\3#Q'_'1D;_R4>'O\R -M*BC_*2$?_S H)O\J(B#_+"0B_R@@'/\O)R/_+B8B_RHB'O\J(R/_(R$C_UIC -M8_]C:FK_)2(H_S I'?^8BH?_-3 T_W5P:O]%0C?_(QL7_QP-$O\B&AW_(1L9 -M_R<<&_\A'1O_'QH>_R,;'O\E'A[_)2$I_S0V/O\T.D+_0TM5_SU'4O\U/TG_ -M0$I4_T]98_\X0DS_,3M)_SX^3?^KH:O_I)ZB_SLV.O\F(27_(1P@_QP7&_]2 -M0T?_,B,G_R(8&_\/#0__J9Z=_^/2V/];76+_7%I5_W%V=O]A7&#_Y-+4_^/9 -MU?_HX.3_NJVH_XA^YMW__N3;___GWO__ZN+_^^??__[JXO_]Z>'__^CA - -end diff --git a/sys/lib/python/test/testimgr.uue b/sys/lib/python/test/testimgr.uue deleted file mode 100644 index 76e9488d0..000000000 --- a/sys/lib/python/test/testimgr.uue +++ /dev/null @@ -1,1170 +0,0 @@ -begin 755 test.rawimg.rev -M_UI)4_\A&!__&QD<_QT8&O\8$Q7_%1$3_Q82%/\6$A3_'18=_R4?(_\\-S?_ -M14(]_QP4&/\:%A[_35-;_TA+5O\_.3W_)R @_R(;&_\H(2'_%1(1_Q,1%/\8 -M%AG_$A 2_Q,/$?\=&1O_)1X>_S(J*/\I(1__,"@F_RHB(/\L)"+_*" <_R\G -M(_\N)B+_*B(>_RHC(_\C(2/_6F-C_V-J:O\E(BC_,"D=_YB*A_\U,#3_=7!J -M_T5"-_\C&Q?_' T2_R(:'?\A&QG_)QP;_R$=&_\?&A[_(QL>_R4>'O\E(2G_ -M-#8^_S0Z0O]#2U7_/4=2_S4_2?] 2E3_3UEC_SA"3/\Q.TG_/CY-_ZNAJ_^D -MGJ+_.S8Z_R8A)?\A'"#_'!<;_U)#1_\R(R?_(A@;_P\-#_^IGIW_X]+8_UM= -M8O]<6E7_<79V_V%<8/_DTM3_X]G5_^C@Y/^ZK:C_B'YP_TQ12_\Z/S__/T=) -M_R$O,O]15ES_B(R*_S8\./]#2TW_.D9*_SI"1O\?'B3_V-7;_S8X/?\N-CC_ -M+S [_UU95__IU]G_74M-_^#1R_^>E(G_7V!9_UU<5?]875W_5F)A_V]N9__L -MW]3_]]_6__W=U?_[W]?__.+9___FW?_^Y-O__^?>___JXO_[Y]___NKB__WI -MX?__Z.'_;EUG_R$8'_\3$13_&106_R ;'?\5$1/_&A88_QH6&/\D'!K_*!\? -M_T,^/O\]/#O_0SU!_QX;(?])4%;_3E):_S8P-/\I(B+_*R0D_RHC(_\6$A3_ -M%1,5_Q,1$_\4$A3_$@X0_R <'O\C'!S_-"PJ_R8?'_\I(B+_)!T=_R@A(?\I -M(R'_*2,A_RDC(?\L)B3_*B(E_RXL+O]B:VO_96QL_R =(_\[-"C_AGAU_Q@3 -M%_\7%Q3_7UU8_UI84?\C'!S_&A@;_R(=(?\C&Q__(!L?_R(=(_\@&!O_*2(B -M_R4A*?\D)B[_+C0\_SM#3?\\1E'_0DQ7_TI47_]$3EG_1U%<_SY(5O]!2%3_ -M7EYG_Y&3F/]!/T+_(ATA_RDD*/\E("3_3T-&_R@9'?\>%AG_'AH<_]S4TO_P -MW^7_0T5*_V5C7O^"@(+_8%I>_^C6VO_IW=[_V-+:_^[@X?^]KJ'_BH)X_TU/ -M3?\X04'_.$='_R\Y/?]%2DK_B9&._S Y.?]!3$W_/T=+_R,B*/^?G*+_,S4Z -M_RPT-O\Q,CW_75E7_^;8V?]*04C_F)*0_YF4C_^/CHW_C8N(_V1I9_]=9&3_ -M9F5>_^W=T__VW-'__]_5__[CV/__YMW__^;=___EW/__Z-___^OC__SHX/_Z -MYM[__NKB___JXO]];';_'A4<_Q@6&?\8$Q7_+2@J_Q@4%O\:%AC_'!@:_UE0 -M2O\X+RG_-"XL_T$\/O]%0$+_(B C_T%)3?]66V'_*",E_RLD)/\F'Q__+"4E -M_Q80%/\:%Q;_'!H5_Q41$_\6$A3_&Q<9_R8?'_\N)B3_)A\?_R4@(O\6$1/_ -M&Q88_R4@(/\I)"3_)B$A_R8A(?\G'R+_)B0F_V=P'R#_%Q(6_R(:'O\A'R+_(1XD_R$9 -M'/\B&QO_&Q7S_*2$D_QP7&?\;%QG_ -MGIB6_ZZ?I/]#14K_5U)-_Y&*BO](0D;_X]7=_^7:X?^1CYC_7%17_[RLH_^\ -MJ9W_?7MT_TE,1O\_1$+_.4=&_RXW-_\Y0D+_CI65_RXU-?\W/3__.3@^_Q@5 -M&_\Q,SC_-3L]_RHK-O]03DO_W-75_R4F+?\6%QC_-S P_R___HW___ZN+_ -M_^OC__[JXO_^ZN+__^OC_XU\AO\@%Q[_'1L>_Q\:'/\Y-#;_%Q,5_QP8&O\> -M&AS_(Q\=_W-N:?^TJZ7_4$,^_U)*2/\I)RG_1$Q._T-(3?\P*RW_*B,C_R8? -M'_\I(B+_&!(6_R,@&_\E)1C_%A(0_R,>(O\>&AS_*R0D_RPD(O\G(B3_)R(F -M_Q81%?\5$!3_%! 2_QP8&O\D("+_)" B_RHB)?\M*RW_:'%Q_UUD9/\>&R'_ -M5D]#_W)D8?\B'2'_.#XZ_R,>&/_$M[+_+R&AS_&Q<9 -M_Q<2%/^ZMK3_WM'6_T5$2O]:4D[_EY&/_SDY//]O<'?_4%!9_V5H:?]_?WS_ -M@'AT_[RKI?^?E(W_EXR%_V1<6/]'34G_-T)#_RHU-O\T.SO_@XF%_TE/4?\E -M)"K_,B\U_R$C*/\G+2__(R0O_SH\.?_DX>#_*R@N_R$<'O^FFYK_(1D<_Q\< -M(O\N*RK_HZ&9_YR9E/_6RF_S(P,O]A:&[_2D]5_R\G*_\S -M*"?_+B0@_R\E(?\;%1/_+B@@_S\W+?\;$Q'_*20F_QX9&_\K(B+_,28E_RD@ -M(/\H("/_%A 4_QP6'O\3#A3_% \3_R$<'O\E'A[_*B4E_S@Z./]IYMO\Q*2S_)2 B_SLV,?^+@GO_ -M:5E/_QT1#?\I("#_*B4G_S0R-?\7&1[_)"4L_TE-5?]67&;_1$I4_T]48/\Z -M04W_0DM9_U-:9O]#35C_1E%<_TY79?\B'B?_+"(E_W5K9_\;%A'_)B(D_R > -M(?\A'"#_'18=_YJ-C/_@V-O_/D%&_V!;5O^8E)+_-3M#_S P,_]+3U?_&A\E -M_XN)AO^QIZ/_8UI:_ZJDG/^:BW[_IYB+_V5E7/\\2DG_*S/8___H -MW?__Z^#_^^3?___KY___ZN;__^WG__WJY/^@D97_(AH>_RDD)O\R*R7_5TU) -M_QP3$_\E'2#_'A@<_QX6&O\;%QG_)"4F_QX9&_^]L*O_,2\L_UEA9?^"AXS_ -M.# S_S0H*?\O)"/_,2@B_QX6$O]".3+_4TA!_RLB(O\B'1__'A89_RHA(?\J -M'Q[_*R,A_R4>'O\4#Q'_%Q(6_Q40%O\4#Q/_)1T@_RLB(O\K)R7_*BPJ_V=P -M(_\6%Q[_0$1,_U%78?\B)B[_ -M3%)<_S]&4O]'4%[_/4=2_T5/6O]$3EG_25->_R -M&1G_)R,E_R,>(O\A'"+_<&%A_XZ)C?]!1DS_75A3_Z.?G?\\04W_+RTO_SH\ -M1/]%3ES_*BLR_V!:6/^HG9S_6U90_\"SJ/^EDH;_CX-Z_T)*1O]36U?_<')P -M_S8W/O].3U;_*"HO_SH\0?\L+C/_'B H_R A*/\[.D#_)"(E_QX:&/]".C;_ -M4$5$_R$='_\E(2/_(AX@_R,?(?\F(B3_Z=30_Z.=F_]L=';_4DU/__7?W?_Z -MX>#_^^+A__[EY/__Z>+__^GB___JXO__Z^;__^OF_Z.4E?\C&1S_+R@H_T W -M,/]@5E+_&A$1_R8>(?\@&A[_)!XB_QX:'/\M*RC_(QL7_\*SK?\Y-3/_0D=, -M_VQP_Q@4$O\<&A?_%1 4_QL6&O\F'B'_*!\?_RHF)/]% -M1T7_8VQL_V!D9O\@'R7_BGAN_U!".?\K'QO_13LQ_W5I9/^ZK:S_*2$D_R8; -M(O\O*"__'!XA_P\2$_]12TG_*2 @_R$<'O\@'B'_&QTB_RDJ,?\\0$C_1DQ6 -M_RTQ.?]:8&K_/T92_TE28/]-5V+_0TU8_T),5_]16V;_(2,H_RHB(/^DEHW_ -M2CPS_XE^??\8#P__)!\A_R$<(/]01T?_0D1)_T5+4_]G7UW_(?^@C8'_8%!&_SDM)O]?54O_D(1__[6HI_\F -M'B'_)AP?_S4P,O\N+"[_85U?_\>^OO\N)27_(QX@_R$?(O\;'2+_-C<^_TU1 -M6?\^1$[_+C(Z_TE/6?]"257_14Y<_T!*5?]&4%O_/DA3_TE37O\A(RC_*2$= -M_ZB8CO^XI9O_:EI7_X5X=_\B&QO_)"(D_R@C(_\T.3__0DA2_["GI_^EH*#_ -M24Y:_TU+3?\X.D+_(2LZ_SA#5/\H,4+_'1TH_RDD*/^AG9O_6%-'_Z>'__^C;___FV_^SI)[_ -M)AX:_SDT+O]72CW_<6-:_Q@2%O\R*2G_)AT=_R@A*?\=&1O_2TQ%_U%(0?_( -MMK/_*!XG_V%D=?]%2%3_.#,S_R<=(/\S)RK_,R@A_RLE'?]N95[_O[2M_S(I -M*?\A'![_'Q<:_RLB(O\Q)B7_*B$A_R4BO]N75?_7%!'_W!F6_^JGIG_ -MLZ6F_R(/]$257_0TI6_T%)4_]#35C_3U)=_TM07/]+563_3%=B_R$D -M)?\M*"/_IY>._[JEF?^ECX?_1#8S_R<=(/\F("3_+BXQ_SQ#2?]'4%?_8V=O -M_Z*BJ_]4763_+BLQ_S4T0?\U.D;_&A@H_SDW1_\J,D+_'" H_R @(_^,B(;_ -M9UM6_XJ.AO^&BX?_?'Q__SZ -MQ_\T.5+_/S]4_U!$7?]94V?_8%QL_VMG=_][9G+_CG9[__SBW___Z-W__^KA -M_Z:1C?\N(A[_/S@R_V111?]V9ES_&A49_T X-O\P*";_*24M_R4C)?]H:%__ -M6U),_[BJI_\P*C+_3E%C_T9(5_\P*RW_*R$D_S0H*?\P)1[_*"(:_XV%>__& -MN[3_+B0G_Q\9'?\?%QK_+",C_RTB(?\L(R/_)B(@_SHY+O]?5E#_)A\?_Q\: -M'/\H(R/_(!P:_RTD)/]35%7_7F=G_V)E9O\@'2/_JIF3_S@K*O]:5%+_<6MC -M_[2JIO^GFYS_)B D_R8C(O]94DS_0STS_W9T;__+OKW_*2@G_R$:(?\@'"7_ -M.3Y*_T!"1?^"@'C_F(Z*_R =(_]:7&3_2$];_TU79?]!14W_0T92_TQ69/]- -M55__("$B_R\I)_^IG9;_HHR#_ZR6CO^CDY#_*1XC_R0>(O\J+#'_25!6_TM4 -M6_]+55__4%%<_UQE:_^WL[O_03]/_RDO.?^7DYO_(A\E_RLU0/\F+C[_&AXM -M_R$@)O^%@(#_3E)0_S4Z./\9&Q[_.3@^_T%$2?\>'2/_-3(X_R$C*/\H+#3_ -M)2V__^Y]O__^C?__O>W?_#I:?__.#<___G -MWO__YM__MYV@_S$?(?])/3G_=F%5_W]M8_\B'2'_-BXL_S\W-?\D)BW_)"(D -M_WUY_R$9'/\P)R?_+R0C_R\F)O\A'1O_7UY3_XZ%?_\G -M("#_(QX@_Q\:&O\J)B3_+20D_UE:6_]:8V/_:6QM_QX=(_^QI9[_'Q<:_S_["DG_^7G_\>#:__OBU?__Y-G__^7A___CW___ -MY=[__^7<__WDW?^VMA_R0?(_]!.3?_0CHX_R\X -M/O\R-3;_BX)[_WEL9_^^M+#_-C4\_T]29/],2%C_*R,F_RLA)/\O(R3_+"$: -M_RHD'/]X<&;_TL? _S(H*_\@&A[_(1D<_R\F)O\N(R+_+B4E_R_RPH)O\L(R/_8F-D_V)K:_]A9&7_(!X;_[JIF_\E -M'1O_=WAY_Q@7%O_$O;W_E(:'_R@@'O\F'AK_6U%'_V5<3O]B7E;_N:RK_RLJ -M*?\F'R;_&14>_SA!2/\G)BW_,"HN_R8H)O][C_ZB=EO^XI)S_MZ>D_RTB)_\E'R/_ -M,"\U_TY/5O\D)B[_;&]Z_UU>:?]67V7_55%9_SG%C_UI/2/^O -MI*/_,2PL_QP7'?\L*C/_.4--_RDJ,?]_=G;_)B >_];)SO]*35C_14A3_X=\ -M>_]>6%;_*" >_TQ/6O\Z/$3_'AH<_RLF*/^=DI'_LJ>@_[RJIO^]KJ[_+",C -M_R8B)/\U-CW_5EA@_R B*?\<'B/_C(V4_TI,4_] 04C_9F=R_T9)5/]N<'/_ -MKZ.D_T5#4_\H,#K_:&IM_SHX._\E*#3_)BDU_T!"2O]66%__0T5*_S<]/_\M -M+3#_:65M_S] 1_\P,3S_-3<^_T9*3/\O,3;_?G)N_Z"+B?_1N;;_=6)<_]C* -MTO]83EC_*"$K_R ;(?_IU-+_X<_+_T4^./].1D+_34U*_WU\>__8D_\P*BC_ -M04 __S8Q,_]%2TW_1$A&_Y&(@O^:C(G_CH.(_RPJ.O]$15S_<6U]_RLC)O\M -M(B'_,"4D_QX:&/\>'!?_&A02_\B_O_\G(B3_(AT=_R$:&O\G("#_*R0D_RXG -M)_\M)Q__AX!R_\_#OO\H(2'_(!L;_R8A(?\F(2'_)B0A_UQ@7O]G;&K_9&-B -M_R(>'/^]J*/_-RTC_YV8DO\].S;_WLW-_V%86/\C(2/_*",E_S8S+O^ >W7_ -M3$1 _ZJBH/\J(R/_(!LA_QD9(O\]1%#_/3Y%_X^'A?]934G_X,[2_T1,5O] -M2%C_+BDO_TI&2/^!>'+_(2$L_S4R/O\H(R7_,2("7_0$-(_TQ06/\[04O_3E!8 -M_VIL;__4Q9?]+3E/_ -M-#H\_QP<'_^>FJ+_1D9/_RPO._\N,#?_,30U_TM*4/^KI*3_V\[-_^G8V/_K -MWMW_XM31_[^MJ?^5A'[_=V1<_^?2S?_MV]?_T\O'_];+RO_3S\W_/T)#_V]Q -M;__JV];_^=[7___DW?__Y=[__^7>___GX/_$N[7_13LW_WIL:?_4OK7_FHJ' -M_RTF)O\_/4#_-B\V_QP='O\\.SK_E)"._[&EH/]P:&S_)R_UYE -M<_]:6F7_&QD4_\*MJ/]'.3#_IIV7_V%?6O_>S&1W_+BLJ -M_S(N+/]W;W+_HIF9_RTF)O\A'"+_'AXG_T%'4?]'1TK_FY&-_[6IHO_:R,K_ -M4EID_T1,8/\?'BO_%AL@_U-,1O]E7V?_*20P_RHB)O\X*2W_K)>5_]G(PO^7 -MA8+_>6IJ_RLB(O\G(R7_+S(W_TY15O\W-SK_AH&#_QP?(/\/%1?_2U%9_T!' -M4_]'2%/_B8N._]O,T/]%0U/_-T%+_R(C)/\X-33_+"\[_SU 3/]"1$S_3$Y5 -M_TM.4_]"2$K_)24H_[&MM?]!04K_+S,[_S8Y/O])2TG_D(N-_R$='_\O*"C_ -M."\O_T(]/?](1DC_:F5E_Y&)A_^IG9G_Z]S6_]7(P_]:4$S_U__^X]S__>3=_\S'N_]<44K_II*._^') -MP/^9B(C_,2DL_S@U._]$/47_)B$A_R ?'O\N+"[_O[:P_XB#@_\\0D3_9G)V -M_V]Q>/\O*BK_,28E_RL@'_\D(![_6UE2_T(Y,__0PK__,"@F_R(;&_\E'A[_ -M,"DI_R@A(?\J(R/_+RDA_Y")>__)O;C_*R0D_R(='?\H(R/_*20D_RLB*?]8 -M8E__("E8_SP\9_\<'AS_O:BC_V)22?^WJJ7_='%L_]W,S/\^-37_(R$C_R@@ -M(_\^.#;_.S0N_V=;7/^4BXO_*R0D_QX9'_\:&B/_/$!(_SPZ//^GFY;_Q[FP -M_]O)S?](4%K_25!>_T]'2_\B(2?_4$4^_X%[?_]"0D__'1L>_R<=(/^FF)7_ -MT<6^_ZJ:E_^VIZ?_,2@H_R0_]3"O_\I("#_(AT= -M_R0='?\K)"3_+R@H_RXE)?\B'AS_3TU(_\O O_\M)"3_(QP<_RLD)/\M)B;_ -M(14>_U588_\@)%'_-S!?_QX<'__'JZ?_MJO^4CXK_W-'0_S@O+_\D -M'R'_*B(@_UU62/]V:F7_V\S-_X5]@/\H(B;_(!H>_QD9(O\^/T;_.3@W_[6O -MI__3QL'_V,?-_T--6/]%2U7_?G9T_UE45/_(N;3_B8.+_T]27?\E(R7_+"W5S_]K. -MS_\C)2K_'"$G_U-68O\I)##_(ATA_R(@'?\D(AW_(BFQC_]G-QO_ETLC_@')O_RHA(?]!.3W_24))_VIC7?]G8EW_3T=%_]/$O_]A -M7&#_.3Q'_V-F')B_X1X=/_>S]#_;&9J_R@B)O\F("3_'1LD_SY 1?\\ -M.3C_M:^G_^'3T/_5Q,S_3%5C_T1)5?^$?GS_BH.#_];$P/^*@X__1TA3_RPH -M*O\O*"C_KZ2C_ZN=FO^'=W3_HI:7_R\I+?\K(R'_JI*5_U%)3/_+O\#_O["P -M_[BGK?]886?_2U=@_S]&5/]'3U/_4DU-_]S1UO]35F+_0T]8_X2"A/_4S0_XJ(@_]/4U'_/4)"_W-[??\Z2UG_86!F_UE<4/]03D?_8UM1 -M_]C(OO]Q8ES_W<_,_^;2RO]W:FG_-2TQ_S\X/_]#/47_9V!:_VYG8?^LHI[_ -MWLO%_VUF;O]#1%7_5E=H_T="3O\M)2C_+28F_RLF(?\V,2O_;&A@_\F]MO_4 -MPK__*R(B_R0?'_\F'Q__+28F_RHC(_\M)R7_2D(^_RH@'/_+O[O_*R(B_R0= -M'?\B&QO_*R0D_R47'_\C&Q?_(ALB_RXF*?\@(1K_SK*N_W-R9__#J:;_N+.N -M_]W5T_\V+R__(QX@_S\W-?^5CW__<&1@_]K+S/]E7V/_*2,G_R,=(?\@'B?_ -M/3]$_T5"0?^UKZ?_V,K'_]' R/]!2EC_5%EE_Y"*B/^@F9G_X]'-_W=P?/]& -M1U+_*",E_RHE)_^LI:7_E(R*_XM^??^_XZ'@?]M;VW_;G9Z_U9HC/](46+_4%I+_TQ, -M2?]33D[_X]/*_V=84__ATM+_Y=#+_VQ@8?\Q*C'_.3,[_SPX0?^+@GO_?G5N -M_[ZRK?_@S,3_349-_SL]3/])2UK_.C8__S H*_\L)27_+RHE_R\J)/^/BX/_ -MS<&Z_]+ O?\N)27_)!\?_RDB(O\J(R/_*"$A_RWMP_\"K -MI__&P;S_V]/1_S0M+?\D'R'_/34S_ZJDE/]5247_Y]C9_TI$2/\I(R?_(AP@ -M_R >)_\M+S3_B(6$_T Z,O_BU-'_R;C _TM48O]$257_E8^-_Z.T]C_0$-/_S]+ -M5/\T,C3_S<;&_SQ!3?]*1T;_8&%B_T-(3?]02T__+3$S_RTM,/^JI*S_045- -M_SM 1?\I,3O_6E)0_]#$Q?^*C8[_?W^"_Y^=IO]676/_+C<^_SL]0O\N)R?_ -M,2@H_[2GHO\J)2?_(" I_TQ'2?^'A'G_I:29_V=L:/]L='C_8W9^_X:(C?^" -M@G__1T5"_UI54/_HV];_6U%'_^37TO_BSM?_7E)3_S0Q)?\L*";_1#M"_WIN -M9?^.A7?_R;R[_]W)Q?]!/T'_,3$^_T1$4?](1T[_,"HH_RH>'_\S)RC_-RXH -M_YB-AO_8R<3_T\+"_RHB)?\C'B#_)AXA_RTD)/\N)B3_-BTG_VYI8__:R,7_ -MS[Z^_RLF)O\E("#_)!\?_R@C(_\4#Q/_%! 2_Q81%?\8$Q?_,"8B_[*EH/]# -M03K_NK"L_]/'P__V?]04%O_/4!+_R8A(_\G(R7_*24G_U925/]G8F3_4T]1_R,>(O\K)RG_ -M*B8D_T='1/]G6%S_A(&'_]C0T_]88&K_359=_TA/6_]56F#_=&MK_^;9WO]# -M1E+_5%MA_T8^0?_;S]+_0$90_W!S=/]I:&__1TI+_YZ:G/\T-CO_+2PR_Z:B -MJ_\V.43_+S(W_RXT/O^?DI'_L9^A_VM?6O]<5U'_:&EC_VYJ8O]]:V?_P[*X -M_];,R/_1O[S_=F%?_ZJAH?\D(RG_/S<[_R8D(?^+CHC_9VQJ_U%57?]Q<&__ -M?GQW_U=95O]044O_4U%)_^;%UO]N2&G_W+78__OBW?]52$W_*2(L_RDF,O\U -M-4#_>G-G_Y6-??_+O[K_Y-#,_T=$2O\S,T#_.#=$_U957/\I(1__,B8G_S,G -M*/\T*B;_D85^_]G*Q?_%MK;_*R,F_R(='_\E'2#_+B4E_RL@'_\V*B7_@H!Y -M_]+ O?_2P<'_*20D_R4@(/\F(2'_(AT=_QP7&_\6$17_%Q(6_QL6&O]%-3+_ -MIYN6_TY+1O^FH)[_W<_,_]?,R_\P+2S_)B$C_S(N+/_$MJ?_54U)_^+9V?\Z -M-37_)B(D_QH8&_\C)C'_0D51_Z:7D?]21$'_X=/4_[>LL_\\2%'_5EMA_YF3 -MD?^0B8G_Z=S7_T9&4?\X.T;_)R,E_R_]P8UC_VM+0_U-79O\M-3__14Q8_UI<8_]]='3_ -MZ=K?_T5(5/]/45C_8%99_][/U/]$1U+_CI.3_W1R>_]%2$G_R<3$_S0S.O\L -M*S+_FIBA_S,T/_\X.T#_)"HT_ZN>G?^NFIS_CGUW_W!D7?]".S7_DH1[_WMH -M8/_+O\C_03]!_S@S+O]F6UK_/CPY_RHL*O\V-#;_(!TC_S8W./]T>';_:FUR -M_YF6E?]H9F/_<'5Q_U164_]454__Z+O?_XA.H/^F9-'_QYS2_UQ(4?\U&3/_ -M1S [_S4N*/^)?7G_FHF4_]3(Q/_MVM3_4T]7_S'O\J)27_)R(F_QH5&?\A'"#_'!<; -M_U1$0?^6BH7_8V!;_ZFCH?_;S5E+_ -MY-O;_SPW-_\G(R7_'1L>_T!#3O\[/DK_L*&;_U]13O_DUM?_K:&J_T)-6/]3 -M5U__7E=7_X%Z>O_DU]+_3T]:_RTP._\D("+_)2$C_R,?(?\D("+_(AX@_R,? -M(?\F(B3_(1T?_RLC(?\S,2S_74Y._ZB>FO_7S\W_3U-B_RLS/?] 1U/_7%YE -M_X^&AO_FU]S_24Q8_U)46_]C65S_VLO0_SH]2/]^@X/_85]H_TE,3?_>V=G_ -M+RXU_R\N-?^4DIO_/#U(_SU 1?\N-#[_MJFH_\"LKO^JD8K_HHA]_ZJ4C/^Y -MGY3_CG]R_\K#S_\P,S[_(R8G_XU_@/^3@7W_WLO%_TH\/?\<%A[_(1\B_UQ> -M6_]K;VW_='%P_W]^??]W?'K_9VMI_UU@8?_>V\__+2HI_S N-_\X/CK_?WZ+ -M_V9#BO^C>Z__12Q+_ZJ*O?][6)C_T\+,_^S:T/]*1D__/CY+_U-27_\]/$/_ -M*R,A_R\C)/\P)"7_/C0P_W)F7__7R,/_K)V=_RLC)O\@&QW_)Q\B_S,J*O\O -M)"/_,24@_XF'@/_=R\C_TL'!_R8A(?\D'Q__*",C_RLF)O\H(R?_*20H_R8A -M)?\?&A[__]Z=W+_IZ&?_^'3T/_*O[[_+RPK_R4@(O\L*";_Q+:G -M_W5M:?_GWM[_.C4U_RBEO_$J)K_ -MNYZ2_\&EE_^;BGK_U,C7_RXN0?\A(RO_.34W_XU\=O_:P[?_034V_RO\H/RS_("PK_S$Z,_\W1#G_*#0]_S]"5/_*PL7_Y]C2_SL[1/\\0$__2TE9 -M_T9"2O\N)"?_+2,F_R<>'O\P*BC_8UQ6_][0S?^IF)C_)B,B_R$>'?\G("#_ -M+B4E_RXB(_\Q)"/_1$4__]?(R/_,N[O_*",C_R4@(/\D'Q__)B$A_RXG)_\K -M*2O_.C\__Q\:'O]O7U;_?V]L_Y&(@O^DGYK_Z-G:_[JNK_\M*BG_(QX>_R0E -M'O^OJ:'_DX>#_^+5U/\^.3G_(Q\A_R,@)O]$1U+_1$A*_[RLJ?^3@H+_Y]C8 -M_X-]B_\W2%;_7V)M_YR4F/_:SLG_YM36_S8W0O\N,#?_*"0F_R(/\B'B#_(1T?_R,?(?\H'1S_1T-%_U%05O_ N<#_ZMGC_UU69_\] -M0E3_0DE;_WUV@/^UJ;+_Y]WL_U129?]A87#_C(*+_^#3V/\\/T3_CI"._U!. -M5_]"14;_SLO*_R@I,/\K*C#_B8B._S,T/_\N,#C_+C8Z_\2XN?_FUMK_T<&X -M_].YK/_7MZ__S+"L_YF-AO_9Q-?_(S% _R4A*?\F*S'_>'AU_YV8DO^0BXO_ -M@'M[_XB!>_]G8%K_7%UD_Y60E/\H*BW_-T-'_SM$1/]F:VO_O\3*_SY(-_\V -M0C/_+T P_TQC4/\Y5$/_#"D7_SY?3?\S3CW_/%I*_YBMH?_9TWC_U\K)_\BWM_\H(R/_)2 @_R_WMP9?]H65G_LJNE_YN9E/_DU=G_MZNL_S,P+_\G -M(B+_(2(;_ZZIH_^MGYS_Y=C7_S,N+O\E(2/_)" H_SD\1_\Y/C[_P*VM_Z>6 -MEO_NW]__8UUK_SA)5O]#1T__JZ"E_^'4S__FT=;_/3U*_R B*?\H(R7_)B(D -M_R4A(_\B'B#_(AX@_R(>(/\B'B#_(AX@_R,;%_]14$__/$5,_XB*D?^+B8O_ -M24]1_SM'3/] 2%+_>'I__T9'3O\H+CC_'"4S_TQ55?]Y>GO_Q\')_SD^2O^+ -MB8O_3TM4_T)%1O_)QL7_+S W_RDI+/^8F9K_/#Y&_S'A/_:S(/\>&AS_*R,A_TE+3O]&4EO_6F5L -M_T1/6O\Y0T[_*C$__S(Q3O\P)V/_-"IO_S\V?/];49K_&!5)_V5?B_]!/5W_ -M.4%+_Y64D_]85%W_3$]0_]G6U?\P,C?_,#$R_TE+2?\P,CG_,3(]_R&IA_W9K9/^2@8'_1CU$_R,D*_\^/#__MJNJ -M_]W.YO\G*S/_.TE8_R'?\G("#_+R8F_RTA(O\U*"?_CHZ+_][1T/^SHJ+_*20D_R0? -M'_\H(R/_*B4E_S@P+O]E9V7_8FEI_R(=(?^9C('_P[*R_X-\=O]I9V+_Y=;: -M_ZVAHO\I)B7_)2 @_S@S+?^]M*[_U,C$_^3_R <'O\A'1__(AX@_QX:'/\U)RC_2T9,_U5@ -M:_]16V7_1TU=_R@H-_]@76__6S_B'UV_Y&"@_]+1$O_(R4L_S4U -M./^AG)S_S+S8_RDJ,?\4'R;_&QTD_R(B+?\E*C;_/$1._Q,:(/\E)"K_*RHP -M_SDV//\?&!C_/3E"_SL[2O]*2EG_4U!6_RLC(?\X+"W_*AXA_RLD'O^7BX+_ -MV,S%_UE.3?\J)BC_(!L=_RHC(_\J(R/_*"$A_S F(O^)BH3_WM'0_Z22E/\H -M("/_)Q\B_RHC(_\K)2/_+RDG_VUN;_]@96K_)B$C_Z21A?_ K:7_Q[NT_\6Y -ML/_(N[;_JJ.C_R@E*_\E(R;_1C@U_[>PJO_?T-#_ZMO<_S0Q,/\D("+_'AHB -M_S7O_>GU^_W5[??]H96O_KJ.H__/AWO_8S=3_ -M24Y:_QD:(?\H(B#_)A\?_R8A(?\A'1__'!P?_R >(?\A'R'_'AL:_T8W-_]! -M.T/_1T]?_U9;9_],3E7_#0,,_RL4'_\R(2?_%0H7_R$4'_\G%Q__&0T6_R$: -M(O\8"QC_)A@G_R :(O^6BHO_1$)+_T=(2?_1T,__+"XQ_TQ.3/\9'!W_("4J -M_SQ!1_\I+C/_2$-'_][6V?^)>&O_P:NB_^G3R_^8A';_?W1I_]>[S_\<+CC_ -M+"4L_R8Q//^1D(__*28E_S8P-/\I(RO_1S\[_YN+>_^1AG__D8.$_TE$2O\B -M)3#_(R,F_ZZLKO_:P^#_)1PC_Q@1&/\A$!K_(1HA_QL;)/\B*##_+3 [_R4D -M*O\N+33_55%9_];,S_]".T7_.SM*_U-38/]33E3_,"@F_R$5&/\L("'_3D4_ -M_[^SK/_'O\I(B+_,RDE_XF*A/_>T=#_ -MH(Z0_R@@(_\G'R+_*"$A_RPF)/\P+"K_7U]B_UUB9_\E("+_L**9_V584_^F -MGIS_IIR8_\.WL/^>EI3_*",E_RHB)?]72$C_E)*/_][2U?_BT]C_+RXM_R0@ -M(O\B'B;_-SI%_SU 0?^\M++_VLO+_^+>W/]56E3_-3,U_V!98/^CF)W_[=?8 -M_\[%S/\\04W_'!LB_V):6/]53TW_&A45_R,?(?\A'R'_'!H<_Q\='_\?'1__ -M6$U,_TA)4/]&4V3_04A6_R<=,/\]*RW_JY*!_W9:5_]:/3S_F'5N_X5A5_^$ -M8E__*Q@2_Y:!?_^GD9/_% 8#_S]_\;!V?\R-3K_'" H_Q,2'_\;%QG_$Q,6_Q87'O\< -M%R/_'!<=_Q(.%O\J)"S_T,3'_U-,5O] 0$__04%._U!+4?\L(B7_*Q\B_TQ! -M0/\W+"O_6$U,_Y>/C?\T+2W_)!\A_R8?'_\K)"3_*R0D_R@A(?\R*"3_B8J$ -M_^'4T_^+>7O_(QL>_R4=(/\K)"3_+2 -M_R =(_]Z*/\?)37_Q[^]_RTH*O]$/T7_+2DQ_S@Q,?^?E8O_A81] -M_XV*B?]F9F__*BT^_T5!2?_$O'RK_ -M&ALF_R0=)_\8$1C_&1,;_RXG+__DU=G_1T!*_ST]3/\V-D/_3TI0_RH>)_\I -M'"'_+2,?_R\C)/\:%!C_(AP@_R(='_\J(B7_)R @_RDB(O\K)"3_*2(B_S0J -M)O]E9F#_X-/2_X%O$!G_'Q8=_QL9,_]75X#_4E)Y_P\/'O\E("#_+C0\_T-!0__;TM+_ -M*BDP_RXM-/\V.$#_*RXY_R8J,O\A)"G_*RDL_SHU-_^_L*K_UL.]_^W8UO^> -MBX/_A8!T_]C S_] 3E?_+ATC_W9VA?_6Q\?_.# S_V]L'O\H -M(2'_,"@D_Y&(@O_7R,/_:EY:_R_]34T?^]P[__ -MJ[&S_]31U__LV]O_\MS4_[FUM_\_4%;_%20D_W=X>?^ZK:C_75-6_QX<'_\= -M'!O_D(J(_T4Y-?\C'B+_I9F4_X)Y>?\O,3G_,C0\_RTU1?\Z15;_" \C_R4= -M./]J9)[_44Z0_S@XW7_Y-?6_^/.S/^PGY__N[*R_R_R4>'O\B&QO_,"HN_QD4&/\5$!3_%Q(6_QH2%?\B&QO_ -M*R0D_RLD)/\V,3'_)1T@_WYR=?]A65S_)!\C_R$<(/\K(R;_+R8F_R_R(<(/\?&1W_(QTA_Q@3 -M%_\<%QO_'1H9_U123_^/BHS_3TI._Q\>)?\]04G_5UQ8_\#"Q?_3T>'_O+?) -M_R,<+?])0U'_U<[8_^K=W/_JUMC_IYRI_TI"5O\\(S3_=VYU_\.TKO]+0$7_ -M(1XD_VQK:O\P*R;_FXZ-_RDC)_^XK:;_*!X:_VEH;_]$1DW_&Q\G_S= 3O]& -M3V#_/T)._Q -&O\) !+_(A&R'_'!D?_QT:(/\H(RG_*R8J_RLC)O\M)"3_ -M)",B_V=E8/]F85O_*!T<_[*GKO]S;77_)B7%[_ -M-#8]_SQ'4O\\2U'_'RD?_T5(0O^5E)O_*2\Y_UQ?9/\;("7_+C9 _Q@B,/\] -M1DS_-#H\_T!"1?\9%QK_%QD>_RTP-?\I+#'_+C$V_R$F+/\B)2K_+C S_SDZ -M._^^M*G_K9F1_^++QO^,>G#_F(A^_\"TK?]_T>/_ -M*" J_R ;'_\A'27_(ATC_QL6&O\?&A[_*",G_QL8'O\9%1?_I9Z>_]K/UO]# -M0T[_/#Q+_T Z2/\Q*C'_)R @_R,<'/\K)"3_)A\?_RPC(_\U+"S_."\O_S G -M)_\R*RO_*R0D_R<@(/\K)"3_*R,G_Q40%/\5%1C_&Q49_QP5'/\<%QO_(!@; -M_RLB(O\C(2/_?\H(R/_Q;FP_YN1C?_(Q\[_3$Y5 -M_Q84%O]_@8C_0TU;_SI&5?\=+"C_3$Y3_X^*G/\H,D;_'R,E_TI+3/\>("C_ -M*"L\_SL]1/\T.#K_0DA*_SM!0_\N,3;_+C$V_RDL,?\J+3+_)BLQ_R@K,/\T -M-CG_)"4F_\*XK?^WHYO_X,G$_XMY;_^@C87_NZNH_V-;6?]32T'_YM30_^+- -MR_^6BXK_-3HZ_S,X/?\A'AW_D(J"_WMY_S(J)O\R)R;_+R0C_RXC(O\I(B+_*B4E_QP7%_\7$A+_'1@:_QT8 -M&O\=&!C_*R8F_QT6'?^%>G/_=FE<_TO]7D:?_2(BG_S!PC_\Z -M9HC_*C!&_W!:6_\W(B?_)"$G_[:OJ?_0N;K_8519_R\M+__-P;C_:FMV_]K1 -MT?]!2UK_4$Y1_\"^P/]&4%__/DI9_Q_RTH*/\U -M,##_'AD9_RTH*/\D'Q__)"(D_XM^>?]%-SC_)C15_Q(>._\8&2K_%A,?_Q85 -M(O\>'2K_&AHE_QX>*?\8&"/_%!,:_S(Q./\?'B7_(!\F_QX<'_\>'!__'!H= -M_R_R@I.O\D -M)SC_-#@Z_TA&2/_AT^__*RTU_TA17_\N,#__&ATH_R8J.?\=(3#_$!0C_U=0 -M6O]I:V[_OK"Q_\2YP/]E96[_3E!8_T9)3O\J)2?_)1X>_R$:&O\C'!S_(QP< -M_R@A(?\A&AK_*2(B_RXG)_\Q*BK_)A\?_RHC(_\M)B;_*B4E_R_Q@5(?\3$!S_&!4A_QT:)O\:%R3_'QPI_QD6(_\@'2K_-#([_RDH -M+_](1T[_'QXE_QX<'_\3$13_#PT0_PL)#/\7$AC_0C@[_QX4$/\8&A?_%A<0 -M_S8U+O\A.#/_35]C_S]!2/_7R,/_,B -M__CAW/_YXMW_]-C:_VUK;?\F)BG_.#4P_Y.2D?\E(R7_(B B_R$?(?]34EG_ -M+B] _R0G./\V.CS_3TU/_^31Y_\I)BS_,#9 _S8S/_\C(RS_$Q0?_Q,4'_\[ -M/$?_*R0L_RXL+O\_-#/_6E)6_UE97/\T-SC_+3(R_R8E)/\B'1__)2 B_R(= -M'_\E("+_+"0G_R0<'_\I(23_*R,F_RDD)O\C'B#_*",E_R8A(_\F(2'_(1P< -M_R0?'_\D'Q__&A45_R(='?\G(B+_)!\?_R(:'O\C'!S_(1\B_Q@A,O\0%RG_ -M'AXG_RPI+_\@("G_'ALG_Q81'?\7$A[_%Q(>_Q84'?\9%R#_'1LD_Q\=)O\: -M&B/_%Q<@_QP<)?\S,SS_5U1:_RHH*_\0#A'_&A@;_V!@7?]X>G?_/#] _Q47 -M&O\>("7_0T!&_QDF)_]96U[_Q;*R__+5T?\W)R__(R,F_XF+@O_+M[G_-2HO -M_S$O,?_.PKG_;W6%_\S!P/\[2%G_D(Z1_\K%Q?\T/DW_+SM*_WE^?O_;UM'_ -M;6]^_S)"5?\M.SK_5%)+_U)17O\R/$K_&1T?_Q49&_\R-CC_.CY _SH_1?\] -M/T+_3$Y1_S T//\E*S7_(20I_VMH9_^[L+7_T\C'_\W#O__4RL;_W-+._^79 -MU?_HVM?_Y=?4_^K'S#_)"(/\C'B#_'1@:_R,<%O\<'B/_*",I -M_QX:(O\='2;_'1TF_QP=*/\L*S+_,C$W_R ?)?\8%QW_&A<=_QH7'?\9%AS_ -M%Q0:_Q<7&O\='"+_)B4L_QT:)O\7%AS_7EYA_S P,_],3$__+BHL_QT@(?\Z -M0D3_&1L>_Q47'_\<'"7_$Q87_V-?7?_$O;?_ZMK7_RHF*/\G(1__LJ:?_^/+ -MSO\P*"S_,"PN_\.WL_]N=W#_N[6Y_S]27/^0D9+_PL3)_S<]3?\Y057_>H&' -M_]3,RO]H:'?_/$95_SQ"1/]T;&C_3$M8_RXY1/\1&Q+_(B0I_S@Z/?\5&AK_ -M)BLP_SD\0?])2$__,C8^_S0U0/\@)2K_JZ*B_\:WO/^LFY7_JI2+_ZB3A_^? -MBWW_EXA[_Y>%>_][:&#_BGQS_^?2S?]C8V#_JZNN_TI%1?](14O_(!L?_X)_ -M?O]I96?_9%]C_UU=;/\C)SW_/#U$_Y60EO_IW.?_&Q$:_R8?)O\@&Q__(ATC -M_R0?)?\G)"K_+2HP_Q@3%_\=&1O_%Q,5_Q41$_\7$!#_'!<=_ST\0_\D'B+_ -M0C(Z_S$@)O\A%1;_)AL@_QP3&O\=%QO_34=+_QH4&/\7$17_'!8:_RHD*/\< -M%AK_'A,8_Q0,$/\<%AK_%Q(6_Q81$_\=&!K_)R(D_Q\:'/\;&1S_'AH8_Q(: -M*O\6'3'_%QO^[L;O_0%1B_Y.(C_^^O -M)_\?'2;_&A@A_Q(0&?\1$!?_$A$8_Q,2&/\4$QG_(2,F_QX@(_\Z/#__.CP_ -M_Q0:'/\W.3S_4$M/_Y2)CO]K9&O_@GV#_T) 0_]C86/_I:.@_^G:V_\K)2G_ -M+BXK_\W!O/_RVMW_)AXB_RDD)O^PH*C_P,"]_[JIN?\S3%W_9G5[_V^$D/]N -MAIG_67B*_W*0IO]OD)S_8HV?_R@\2O^"A(?_V-#,_TY-6O\Y1$__7%Y5_SH[ -M0O\S-SG_=D/^SF8O_PZJ9_\2JE?_-KYK_PZ22_\FPG__@R<3_='5V_ZFJL?]?6E[_ -M9F)J_R4@)/^5DY#_C(B*_V5@8O]U=83_+3!)_S P.?^OJ*C_Y]3D_R,=*_\P -M.DC_&R R_R$F./\8&RS_%14@_QL6'/\9%1?_'!@:_R_R,E -M*/\F*"O_("@J_RHN,/\M+3#_*R\Q_RDJ*_\O+S+_'B(D_T-(3?]%2DC_T+_% -M_R\F+?\H*2K_KJ*=__7=X/\I(27_+"\ -MP?^GDXO_O:.6_["6B/_!J)?_R+&?_\VRH?_!I9?_R;*F_]O'P_]:7%__KK"X -M_UA56_]U<7G_)R(F_YN9EO^/BXW_75A:_VMK>O\I+$7_-#0]_VA=8O_8T-[_ -M$Q8G_SE'7/\1'CO_04QE_R@O1?\;'2S_'!PG_R$:(O\M)BW_,"LQ_S,Q-/\T -M+S/_/T%&_S8X0/\Z.#O_V,G)_\R]M_]Y;F/_>6UH_QH5%_]@6U__44Q0_Q<2 -M%O\B'"#_)1\C_TY(3/]:5%C_@'I^_S J+O\6$!3_-S$U_QD7&?\<&!K_(AT? -M_Q\='_\4$!+_+BDC_SU%3_\4"AG_$Q$4_Q,0(O\A)"__("$H_QP<)?\7%R#_ -M'!PE_QH:(_\B(BO_&QLD_Q84'?\7$QS_%1(>_Q04(?\5&2'_2$E*_TE+2?\J -M+2[_'!\@_QH='O\8&A__&!<>_QH6'O\>'R;_)B4K_S@Z/?\<(2'_.CL\_[RY -MM/_GU=G_)B H_RXR,/_"MK'_]=W@_RHB)O\O*BK_LZRL_]C+RO^BG:'_5VMO -M_YNBKO^7F:'_)R8L_QX=(_\B)B[_969M_[&VPO]&76G_@HN1_]O5T_]#1E+_ -M.D12_[.NJ?]#14S_.SX__[Z\O_\Q-CS_.SU%_T ^1_\G*S/_+C X_R4M+_^! -M>7?_NZ^R_]S*QO_>R\7_WLW'_]W)P?_BR<+_T+NV_]C$P/_1NK7_W\G+_U-6 -M6_^EJ*W_5U)8_XJ&CO\E("3_HI^>_YN6FO]E8&3_<&Y^_R&!S_)R$E_R8@)/\B'"#_%0X._YZ1 -MD/\S)"3_)!D8_R<9&O].1T'_.$-._QH3)/\4%1;_%Q0G_RDL-_\Q,S;_)"0O -M_QT=*/\A(2S_'!PG_Q06'O\0$!G_$Q$:_Q,/&/\6$R#_%QHE_R@M,_\\.CW_ -M/STZ_ST[-O\].S;_/STX_S$O,?\>'!__&A@;_QP:'?\<&AW_%Q<:_Q@;'/^+ -MAX7_T,C$_^G7V_\I)BS_-3,N_]3'PO_OU]S_+B8J_S$L+/^VL;'_Z=G=_YB8 -MF_]89FG_G*2N_Q,6&_].3DO_>WUZ_U=86?\K+3#_*3,W_SA'3/^#B(W_V]73 -M_T!$4_\Y0U'_BX:!_SY#2?]&24K_R\G,_S$X/O]"14K_/CU$_RDL-_\U-S__ -M*# R_\&VM?^^K[/_T]'._T-#0/]!1T/_6EI7_\S*Q_]/44[_6%U9_UM=6O_0 -MO\7_2DU2_[2WO/]J96O_G):>_R8A)?^FHZ+_G9B>_VIE:?]U<8'_*2I#_S(T -M//^)A(C_XMCA_R@C)_\>(![_,S$L_S&_\_/SS_0T- _R0B)/\?(1__ -M/T1 _V=D7__-R,/_ZMO@_R:_TM56?\6&!__)R@I_VUL9?]+3T?_8F-<_RHK)?]?9&#_45E6_XJ. -MD/_AV]G_/T-2_SQ&5/^ZM;#_049,_T!#1/_+RG[_ -M'A@<_R\J)/^IGY7_CX%X_VMC6?]Q8%K_DHV(_T!39?\A&2?_&1D<_R,A-/\@ -M(2C_9F%;_Q82&O\?'RK_%A8A_QX>*?\G*C;_+3 \_Q04(?\4$R#_%QDN_Q\A -M*?^'A(/_%A@=_QD8'O\G)2C_,"XQ_QT;'O\>'1S_+2PK_S0S,O]"04#_+BTL -M_RLM*O]X?7?_H)Z7_XZ(AO_@U=K_&QP=_VU<3__=R,/_[=7:_S$I+?]!/#S_ -MM;>U_^+8V_^&A(?_,CH^_QT;)/]J9&C_:&5@_U%64/]I9V+_1$$\_V-?7?\E -M(B'_B8F,_^/=V_\\0$__/$94_[>RK?]!1DS_/4!!_Z">H?\P.C?_0$9"_TE( -M3O\V.43_*2HU_R(J+/_$N;C_Q+6Y_]G-R/]-1#W_03LS_U)'0/_DT]/_7%)( -M_V=D4_]72D7_U<#&_T1'3/^!A(G_=G%W_UA26O]54%3_'1H9_QT8'O]O:F[_ -M<6U]_R@I0O\L+C;_:6QM__G8]_\6$17_(1$5_QT/&/\4$A7_%1 4_Q@3%_\7 -M$AC_#@D-_S4P-/]&1$?_4$U3_T9'4O]6663_3$=-_\:UK__GTL[_C']^_QL9 -M&_\5&!G_%1,5_Q@4%O\:%AC_%A(4_Q$+#_\." S_(!H>_QL5&?\4#Q/_(!L? -M_Q0/$_\>&1W_/SXS_[VTIO_ LJG_O+:N_\>_N_^JFX[_2%MY_U-05O\:'Q__ -M*R9*_QP>(?]85D?_'A@F_Q\=)O\9%QK_%!0=_R4L,O\3%B+_# T4_QH:)_\, -M&D'_1D91_\"YL_\F*";_'AD=_Q81%?\6%AG_$A46_R4F'_]64T[_(Q\A_R$C -M(?\D*27_/T1"_Q\C(?]345/_;FQI_XJ)B/\='QW_BWAN_\BTL/_6Q\O_(QTA -M_UI44O_#O;O_XMK=_X%^A/\H*C'_(!LA_W%E8?]^&AS_(!P> -M_W5S=O^ ?XS_+"T^_S$S./^PJZ__^-?H_Q@:&/\6$AO_& X7_Q02%/\5$!3_ -M$PX2_Q@3%_\Y-SK_/SU _TI(2_]%0T;_0$))_T-%3?]'0DC_T+^Y_^W7S_^$ -M=7;_(!@<_QP7&?\7$Q7_&!06_R\K+?],2$K_6U59_TQ&2O\4#A+_(QTA_S$L -M,/] .S__&A49_Q0/$_^ZKZC_Q;&I_Z")A/^ ;&C_:V-F_[BFF/\S1F3_&!D: -M_Q(7'/\C)E#_%1@=_UQ82?\:&"O_'1TH_QH8&O\6&"#_(RPR_Q86)?\4%A[_ -M&!PQ_R(Z:_^4EZC_I)N;_T,^0O\<%AK_03Q _QH8&O\;'1K_2DA _Z&>F?\: -M%AC_+"LJ_T! /?\R+R[_$P\1_QH5&?\>&QK_*"PJ_VEI9O]B4DG_MZJE_\*Z -MOO\E("3_9U]=_Y^7D__BWMS_<7-Q_TM/4?\V.#W_7UI5_V)64?]/35#_6%)6 -M_TU-0O]+2DG_&1P=_W5^?O_=V=O_/$!5_RHT0_^_M[/_1$E/_S@].__/R\G_ -M*2LR_ST^1?] 0$G_*RXY_R8L-/\9)"7_P;:U_\*RMO_CU,[_=5U4_U!&._]; -M44/_Z]3/_W]L8/^+@G'_9F!8_]3"QO]!0TK_.CY&_T5$2O]^?'[_(Q\A_Q\; -M'?\B'B#_:6=J_Q@8(_\5%R;_3$Q/_[*ML?__[>#_+!\._Q\<(O\=&B#_(1X= -M_QX9'?\9%!C_&108_Q84%_\@'B'_+RTP_S?]%-CK_*1<9_Q8/#_\3#Q'_&!06_UQ86O]K96G_75=;_TA"1O]; -M55G_55!4_Q40%/\>&1W_$@T1_XV'A?^MI:/_O;BS_[BPK/^EI*O_PK&D_U)B -M?/\C(!__$QDC_T9;B_\9&R/_7E-(_Q,8,?\:'"O_$A(5_Q8=*_\J,SK_%1S_S4Z -M0/\\03__S"A/^UKK7_WM/( -M_X9Q9?]34D?_+2PE_]_0R_^.>6W_J9B(_VAD7/_2PL;_/T%(_S8Z0O]#0DC_ -MF):8_R(>(/^5D9/_EY.5_VIH:_\E)3#_(2,R_S0T-_^MJ*[___+I_]FC:O_ -MEVW_?5PX_QT;%O\1#AO_%!$>_QD1)?\T+D+_$ T9_Q84%_\8$QG_% T5_Q(/ -M%?\K*"?_Q;NW__#6S?^KHIO_:V5C_R,9%?\E("3_&10:_Q,.$/\<%Q?_$@T- -M_R(='_\?&!__(QPD_RH?'O\T)"'_.",A_RX<&?\G&1K_(AT?_QTB(/]U>7?_ -M0T5#_];1T_]::WO_&B8J_Q89)/\F3H;_&A\K_W)B4O\=-%[___CSLG_D7UU_SXU+_]&1#__\N'4_Y^'>/^LFHS_@W=N_]_0U/]!0$?_769M -M_T!#2/^;F9O_&147_YJ6F/^GHZ7_<&MO_R(B,?\E*#K_+R\X_ZZFJO_\\.O_ -MW:=M_\J@%S7_*R1"_R@A,_\<%QW_'QH:_R 9&?\: -M$QK_'1@<_RDE(__.PKW_\]S7_S\].O\Y-SG_85I:_S8X-?\<'!G_)R4B_R\J -M*O^8C(7_II:-_].]M/_OT\O_Y<_&__#8S__MTF[_=G1Q_[6KI__7Q[[_OK&P_V!;7_]234__L*JN_XB*C_\A)BO_'!\D_QD= -M'_\M,3/_,C8X_R_Q\;'?^9E);_.#<]_T9+4?\O-#K_%Q,; -M_R D(O\A'B3_(2X[_S! 4/\Y.T/_J:*B_Z"BL?]-5V;_>WM^_^;@WO^2F:?_ -M-C]-_\.XM_\X/4/_.3X\_\S(QO\W.4'_.C]$_QHA(?\P-3O_$QH@_QXC*/\L -M*BW_*2$D_^?3S__MV-/_Z]G5__+DX?_ZY-S_]MW6__'S,C_Z=?9_TE# -M2_]\A8S_F)N@_Z6CI?]*1DC_I*"B_Z*>H/]Y -MU?_RXMC_]>+8_^'/R__8Q/^ ?GO_QKRX_]7&P?^ZKK'_@7E]_\:]O?_)O;[_1$!"_P\5%_\8 -M&B'_(R_Q$4%?\>'R#_,2\Q_SDU-_\V,3?_.#E _S(/\5%A?_W]#+__+=V/_UV]C_^=S;__?;W?_VW=[_\-G:_^_:V/_O -MV=?_FHZ1_X2&C?^HJ[#_H)N?_V9A9?^LIZO_IJ&E_W-N_VQF9/_$M[+_[M;3__'7U/_V -MW=C_\][9__'>V/_XW]K_[MO3__G%@O_)O[O_ULC%_[ROM/]J8&/_T<7!_\R]N/]M9V7_ -M)B@K_R(G+?\V.3[_)BHL_TI.4/\[/T'_1TQ,_SL^/_\@(2+_'QT?_];*S?_& -MO+__&A88_QX:'/\Q-CO_*B0H_Q8>(O\N/TW_,3]8_SE#3?\]4&+_,$1@_R8S -M1O\1%Q__.D=8_RXY1/\=&AG_*S \_RPL+_]A863_+#0^_S=!1?\@+"O_+#4[ -M_R0Q-O\K-SO_)BPN_RTK+?_GV-/_[]K5__+=V?_UW]W_^.'B__;@WO_VX=W_ -M^.'<___GX/_FU=7_W/_YW]S_^-S8___@W/_XW-C_^-[5__??UO_QV-G_\=?4_VY:5O\Q -M*"+_+2X1W_X^-B/\N(!W_'!02_PT<'/\O0$[_-455_S=+8?\R -M1V/_+D-?_S%&7O\Q0EG_-#Q&_Q88&_\4%AW_.C<]_QD6'/\7&1[_+S<[_QTI -M+?\A*C'_(S$T_R,P,?\P,C7_*R4I_^?3S__RV];_[]K5__?BW?_WXM[_^N7A -M__7@V__WXMW__>+;_\^YNO]H8FK_J:NP_Y&-E?]^>X'_N+6[_Z>EJ/]M9VO_ -M>G>#_R,D-?\H*3#_*2_V _/_\=$"/_'R$?_U902/]J9&C_/T Y_]/'P/_GT]7_.#H]_QT< -M(_\9%AS_+3$S_S8X._\G+2__*3$S_RTR,O\4&!;_-37%T_S,N-/\M+S?_;G1^_VUO("__&$R%_R$\B?\D -M3(K_OK_*_WQW=_\C$R'_$!,8_YJ2B/^'@GW_T,;)_]_)R_^;G9O_R<7#_]3$ -MP?_9RL7_.S,V_Q47'O\8&!O_)2,F_QX>(?\A(R;_*2TO_R@J,?].45;_%187 -M_Y&)A__3P,#_T+V]_Z28E/],0SW_0T0]_U-73O^*A'S_G(N%_VEC8?]:6EW_ -M/$1._S=$5?\W1UO_,4)9_SI)7/\S/$/_*C R_R$G*?\V.CS_%A@;_RG9^_X!]@_^SL;3_K:NM -M_X)\@/^$?XO_)R8W_R4E+O]L:FS___'K_\6,4O_ DF7_SY94_\*37?_)F6+_ -MR)AA_\657O_*EU;_R)EI_V!%(/\F&A7_(AP@_R$?*/]/3TS_S\.\_^?6UO\O -M,S7_%QD@_QT<(O\C)RG_&QT@_R,I*_\P.#K_*"\O_Q@='?\K+B__&!D:_SL\ -M-O]&24/_*3 P_QDC)_\<(R__(R8Q_S8S.?_1R,C_Z-;2_^W:U/_VW]K_^-_: -M__+_QX;(?\G(B;_)" B_QP:'/\9&AO_(!TC_Q@8 -M&_\7%1C_<6=J_XN#AO^>F9G_='!N_ZNHH__.O+C_+B@@_R\R)?_'O:[_GX]\ -M_YN.??^1B('_75Q;_TY15O\Y04O_-3]*_SD^1/\I,2[_+S8/]46ES_4%98_U%24_]/3E7_9F9U_Z^IM_]X='W_B(6+_X:$ -MA_^IIZG_BH2(_W]ZAO\E)#7_.#A!_VQN_RPP,O\4 -M%AG_*2LP_Q03&?\T,SG_(1\B_Q@>(/\C*RW_)BXR_RLP-O\X-#;_U,G._^#/ -MU__IU]3_[=G1__':U?_QV=;_\]K9__C,X'_*U.*_\'"S?]74%?_)Q@C_W1X>O^?EXW_AX)]_]W3UO_>R<[_ -M&1T?_YF7F?_.P,'_V,?'_V995/_/R<'_*"W7_/CPU_UM:4_]! -M/#?_$Q$,_PP*!_^JHJ#_SL/"_\2\N/]03D?_0$0[_UI43/^VJJ7_2D,]_RPM -M)O^WL*3_@GAJ_Y6+@/^4B7[_85E/_R\M*O\X.T#_86-F_V)E7_]35$W_,C$J -M_TQ*0_\N+"G_,C0R_R,J*O\9'1__&QT@_Q<9'/\?(23_+2\R_Y>-B?^AE(__ -MHY:1_YN.B?^5C(;_D8B"_XR#??^,@WW_A'UW_RHF*/]A86K_MK*[_S(N-O^. -MBY'_%A07_Q .$/^%?X/_>G6!_RHI.O\I*3+_3%%6___PX__,G6W_RIIG_\N< -M9?_#E%K_QI1;_\*05__!CUC_P)-7_\"/7/_!C%;_OI!3_ZE]2_]&+QC_86-A -M_\S%Q?_=T(B3_(R@H_RPQ,?\R.#K_*S U_SU#2_^A -MHJW_*#U:_UUFC__9S-__\-G:__75R__PV=K_\-K8__'9UO_NW-C_[^#;_^WA -MV/_CV-?_766%_SY1E_\M3'S_O4?^ >G+_(B ;_[&JI/_@SLO_A'EX_ZBCG?^UL:G_,C H_S8U+O^] -MO+7_I)^:_R,D'?^9E8W_<65<_W5N8O]K9EK_>71H_R =&/\='R+_&1<4_SX] -M-O\P,RW_35-/_V=E9_]B8E__1DM%_RDN+O\B*2G_*BTR_Q@7'O\;&1O_FI*5 -M_Z"8F_^CFY[_KJ:I_[.JJO^[LK+_O+6U_\2_O__$SKW_6V!:_UA98/^KLZ__ -M*RTP_Y:2FO\Q+##_-C(T_W=U=_^)B93_)"(R_QT>)?\M,S7__^_B_[R2:O^Y -MCV'_K8E<_ZZ#5?^WBU__M(E9_[2+5_^WBUG_O(Y;_[>*5/^WBU/_O8E7_ZF -M5O^1>5[_V,J[_^31R_\L+2[_$Q4:_Q(6&/\6&AS_$Q48_R@J+?\0$A7_)RDL -M_QD;'O\F*"O_%!89_R4G*O\1$Q;_&R$C_QHB)/\?)2?_(2/_*PL7_V6__=W)F_WYZ:_][=&;_;&9<_Q\='_]0 -M3$K_4TM'_R$;&?\@&QO_+BDM_SP\.?]04TW_-#G5U_]')S/_8Q\?_V<;&_R,@'_^_NKS_3DY1_X.! -M?/^:EI3_FYF;_\O'Q?]V=W'_P;BX_RHF*/^ZL:O_X-#-_["HIO_!P+G_:&1< -M_SPW,?^JJ*'_4TY(_S8T+?_ N[7_,BXF_\&^L_]Z=VO_>WEJ_W]Y:?]\=F;_ -M/#HS_S0Y-?\/%1'_("0B_QL<'?\B("+_*"8H_R(?\;&AG_&A@5_S(H*__:SLK_25)2_S4]0?\U/3__,3P]_R\W.?\J -M,C3_)R\Q_Q\G*?\;(R7_&2$C_QDA(_\@)";_'!XA_Q<='_\9(2/_&B4F_QXI -M*O\A+"W_(2PM_RXU*?\W267_$1DI_QH9&/\B+$[_*S1%_R B(/\>&B/_'R$F -M_R(E)O\C)B?_*"TM_S U,_\R-3;_-#,Y_SPX0?\^-CG_6%-._X9^>O^TJ*O_ -MP;R^_Z:;E/]'1$K_Y-W=__+;UO]Y='3_VM+5_]G(R/_0N[G_@GIV_\2XN?\F -M(2/_PL' _U!.4?\T-CO_O[V__U]=7_^\L;C_*RSLO_85E7_S8U -M+O_)Q;W_9V9?_S\Z-/_#NK3_.3_RTQ+_^=G:;_>WF)_RHK -M,O_$O[K___+M_X1R:/\6%!?_%!8;_UY=5O])1T3_'!@:_QP7&_\B%13_'1$, -M_QL6%O\4%!?_$Q@8_RDM*_^KIJ;_W]#+_[*KJ_\P-#;_*C(T_RLX.?\J-C/_ -M+SP]_RHV._\K,S?_*3(R_RDU-/\D,"__)# O_RHR-/\J,C3_("@J_Q@C)/\: -M(B3_("8H_R@N,/\F+"[_+"PC_QP[7?\'$R[_'148_QTWXL_^NI*#_ -MQKZ\_UY96?_,PK[_D(J(_T=(2?_'Q<#_,BHH_\S$R/\D)"?_N+"L_]C*Q__. -MP<#_A'UW_R(D&__*QK[_2#PU_ZRLH_^LK*/_,"\H_ZNLI?\W.S/_D)*)_S\_ -M-/]$13C_<7%D_V9G6O^1BX/_V,6__]["O_^ID8[_)Q@8_RD=(/\2#0__$0\, -M_RLK'/\R-1__,30=_R\S'?\N,"W_,C,T_S$R,_\Q,C/_*BDH_Q43%?\8%AC_ -M3DQ/_Q48._^AG+;_9F%<_Z>BNO\<&S__(R(__UM;;O\S.#+_.3TU_R ?)?\K -M*#3_961J_\C"P/_^[_#_QK2P_SX\1?\D*##_&!83_Q@7%O\5$Q7_%1,6_Z*= -MG_^OIZK_&108_Q86&?\E*BK_-3(/\;(R7_'24G_R H*O\O,2C_)$!;_PP7+_\A'1__(#MQ_R0M2_\: -M&1__(QXB_Q\;&?\Y-S#_2DA _TQ'1_\5&2[_'"U1_QTW8_\I0&K_'RE$_UI4 -M6/\H)2O_'R G_QX:'/\D(B3_*"8C_^;MJ?_$OKS_44Y-_]/*Q/^]LZ__J*6D_\K%O_^QI:'_Q+S _RTM,/^WKZW_ -MWM#-_S,H)_^AG);_5%1+_VIJ7__ MJS_-CLO_YVBEO]!/SC_N[JS_T$_./^N -MJ:/_5%1+_SL^,O]664W_4E5)_TY-0O_7Q[[_]-7/_^K/R/_6O[K_J9>3_T@_ -M/_\3$!;_%1(8_QD4&/\7$Q7_,"TL_Q83$O\=&1O_)R,E_Q@4%O\<&1C_+2@H -M_TY)2_^;E9G_#PL__Z>BS/^VL[__KJ/8_Q01//\@'C__*29#_V)C;O\Z.SS_ -M)B8I_R0C*O\L+"__TLK(___S]__.O+G_'QPI_QP?*_],24C_'!L:_QD7&?\9 -M%QK_'!8>_R :(O\<%QW_&!89_T=,3/\]/SW_O[JU_^S=V/_PW=?_T+VW_^C7 -MT?_@T'2/_)!\9_YRS_\"ZN/]23T[_VM'+_[RTL/^ZL[/_S,.]_];(Q?_.QLK_)24H -M_\S$PO_:S,G_6U-1_SDX,?_!O;7_(B<;_X!]N_]2YLO^LEH[_ -MOZ:?_^'(P__:P<#_T[V__QL4%/\?'!O_7UU:_R8D'_\[/SW_+"\P_SL^/_\W -M.CO_.3T[_UY@7O]?8&'_2TM._Q00&/\4#QO_#Q00_QD7*O\6$2W_%Q,M_Q44 -M,?\3$C?_.35+_S,R.?]$1D3_0T5#_]'(R/__]O+_P;2S_Q\>)/\2%!?_'1D7 -M_R0?'_\A'1__%1,6_S0I*/]#.#?_'QH<_QH:'?]$1D3_,#@T_\.YM?_QW-K_ -MY]O7_^'5T?_=T,O_V_Q83*O\5 -M$2O_%Q4O_QH;-/\A&CS_'A@L_QT<&_\E)"/_B(.'___S[_^WJZ[_%1(8_Q<7 -M&O]U<'#_/3@X_Q82%/\8%AG_)A\?_QL4%/\;%QG_%1<:_TI)2/\T/#C_P[NY -M_^K;V__@T=+_XM#4_]G(R/_3P\#_GYJ4_Q\;'?\5$AC_$Q,6_Q@6&?\3$13_ -M&1<:_Q43%O\0$!/_$!(5_QD;'O\7&1S_%148_QD='_\@+2[_(RLM_R@K+/\= -M*B__)2LG_RPN-O\D07?_)2M%_R,?(?\D)B3_/STV_U%12/]=7E?_&!D:_PXD -M1/\91&[_!C-Z_RA)DO\>.VO_NZ:B_R D+/\E(!K_2TM(_Z& -M&R'_&QL>_R4@(/]U<'#_&147_Q$/$O^JHZ/_LJNK_Q<3%?\3%1C_'AH<_R$I -M)O^QKJW_P;R\_W=\@?])457_0TM-_T)+2_]*3TG_%Q47_Q,0%O\2$!/_&A@; -M_Q02%?\5$Q;_$Q$4_Q04%_\2$A7_&1D<_QH:'?\8&!O_&Q\A_R M+O\B*BS_ -M(RDK_QHE+/\C)2/_)28Q_R9">_\?)#[_)R,A_S4V,/]'13W_5E9+_TU/1O\A -M(R'_%2Q)_R!+=?\)-GW_)D>0_QPY:?^QG)C_%1DA_R8A&_]34U#_G)>1_T V -M,O_NW]__[]G:_S N*__9T<__W]#0_WMY=O_;S<[_GYV?_T5)2__3T,__K:NH -M_]73T/^\NK?_HYZ9_ZF?J/\T+R__'!H7_S4X/?\>(R/_%AH8_S@Z-_\S+S'_ -M&A88_W!M;/]&1$'_*"'%[_WYW@?^NI['_J)^?_Z^FIO\:%1?_%Q48_Q<9(/\4%2#_(R(S -M_QH7+O\:%RW_$Q B_QD5)?\4#!K_$ P4_S0Q,/\_/C/_2T@\_S@V+___\>W_ -MJIZA_R$>)/\:&AW_A8" _[:QL?\2#A#_&!89_QT6%O\K)"3_&147_Q47&O]H -M8F;_%1P<_YJ=GO\Z/3[_+C\__S%"0O\T1D3_.DQ(_TI33/\4%1;_%A,9_QP6 -M&O\9%QK_'AP?_Q43%O\3$13_%A07_Q02%?\<&AW_&A@;_Q45&/\:'B#_(B\P -M_QHB)/\B*B[_$QTG_R(>(/\:'2G_(3IU_R0F0?\J)2#_45%&_SL[+O]864S_ -M,30H_QX@'?\8+TS_'TIT_PDV??\J2Y3_(C]O_\2OJ_\4&"#_)B$;_W1T_\_( -MR/^ZLK#_VM+0_\*ZN/^[LZ__I9ND_U)-3?\B(!W_'ATD_Q06&_\7%1C_'!@: -M_Q -$_\3$!;_$Q$4_RLI*_\K*R[_&1L@_Q06&_\1$QC_)"4F_S4V-_\^/T#_ -M2TQ-_R@F*?\6&!O_+#$Q_V9H9O]05%+_/#X[_U=23?]L8%O_?W-L_W)J:/\> -M&1W_4$I._R$<(O\0"A+_+"8N_VQF;O]<4U/_K:2D_QH5%_\7%1C_#P\:_Q(1 -M'O\B'RO_%@\9_Q44&O\7&!G_HIV=_Z:>G/]*2$'_1D0]_TY)0_]23$3_?W=S -M___Z^O^\L;#_)R(B_R0@(O\D'Q__C8J)_P\+#?\5$!3_LJBD_[>KI_\?%Q7_ -M'!D8_Q\5&/\@)"+_EI:3_U]B8_\T0D'_.$9%_SI)1?\^34C_0T]&_Q$4%?\; -M%AS_$Q$4_Q@6&?\9%QK_%Q48_Q02%?\9%QG_%A06_QP:'/\5$Q7_&!88_QPA -M(?\F,C'_(BDI_R4L+/\9'2S_'QL9_PX5(?\A.W3_&A\X_R%!?_ -M?'MT_Z*:EO]@5%?_Y=?8_^O(?\:&AW_%!07_Q$1%/\4#Q/_% \3 -M_Q,1%/\2$A7_%QH;_QH=+O\-$2#_&!$B_R4:+?\G+37_-CLY_U164_]54DW_ -M5%!._QD4&/]13E3_+BLQ_R(=(_\N)2S_;FEO_TU$1/^NI:7_&!,5_Q43%O\. -M#13_% \3_ZRGI_]\>'K_.#8X_S P+?^6EHW_H9R6_TQ*0_\>'AO_(R$C_R@C -M(_^WM;C___3Q_Z&6E?\:%Q;_'AH<_S&1__%1(8 -M_Q<9(/\4&B+_=W!W_QPD(/^*CXG_>7Y\_S5!0/\Y0D+_.4- _SM&0?]"3D7_ -M$A,4_QD4&O\5$Q;_%1,6_Q84%_\7%1C_%!(5_Q84%O\7%1?_%A06_QD7&?\8 -M%AC_'2 A_R(N+?\@)R?_+#0Q_Q,5)/\<&13_"Q4@_QHR:_\9'S7_0#\^_T!" -M0/\K,"K_'QPB_S8T+?\W.3;_'S99_RE7A/\:1I#_*TJ2_SE2;_^QGZ'_%AX: -M_R8;(/^*BW[_I9^7_VA:6__JV=G_Z-C<_SDT-O]Y>7;_UGO_8S,__ -MC9*2_WR#@__(QK__O;BS_^#7U__*P;O_O[>U_XJ%A?]Q;FW_+BTL_QH<'_\6 -M&!O_%!07_Q@6&?\/#0__$Q$3_Q,1$_\D(B3_'AP?_QP:'?\9%QK_%!(5_Q4/ -M$_\4#Q/_$ X1_Q,3%O\8'RO_'R5%_Q$7,?\:%RW_6$EB_V1I=?]D:6G_5EA5 -M_X6#?O]134O_&A49_U).5O]_?H3_?WA__X!W?O^VL;?_A7Q\_Z:=G?\<%QG_ -M'!H=_QP;(?\<%QG_K:>E_X:!A?\[.3S_+RXM_X:&??^=FI7_244]_QH8$_\: -M&!7_-"TG_[ZXO/__]/#_?79V_QD:(?\0#A'_B(2"_ZJGIO\>&AS_'1@<_W1I -M:/]N9F3_&A45_QT;'?\O)RK_%R 9_S8],_\Z0C[_)BTM_R,F)_\9'1O_*2XJ -M_T901_\;'!W_&10:_Q43%O\8%AG_&!89_Q@6&?\4$A7_%A06_Q43%?\6%!;_ -M&1<9_Q43%?\>(2+_(R\N_Q 7%_\K,S#_%!8E_QL8$_\4'BG_&3%H_R\S2/]( -M1D/_)"0A_RTK(_\Z,#/_.3,K_S\].O\D0&+_+%>%_QY&D?\J2Y/_1%]W_[>E -MJ?\3&AK_(A<<_XV0?O^CH)3_>'!N_\&UN/_2R]7_'!XF_S@[//^UJ*/_J:2D -M_]G/TO]]@H+_FYZ?_\K%P/^ZM++_W-+5_\B^NO_.QL3_?GEY_XF&A?\?'AW_ -M%QD<_Q47&O\1$13_%Q48_Q05%O\.#Q#_/T!!_QX?(/\G)2C_)2,F_R >(?\4 -M$A7_%A 4_Q0/$_\/#1#_#P\2_QPE/?\;(5'_$QY _Q8;-/\O(#G_:6YZ_V1I -M:?]H:F?_B8>"_U).3/\D'R/_/#A _T9%2_\1"A'_.C$X_XR'C?]C6EK_HIF9 -M_Q\:'/\6%!?_$Q(8_QP7&?^JI*+_-"\S_QH8&_\G)B7_?W]V_WUZ=?\_-C#_ -M*R8A_Q\:%/]63$'_R\'$___V\/]53U/_-3I&_R@E*_\D(![_L:ZM_QD5%_\: -M%1G_8595_V-95?\;%Q7_'1P;_RH<'?\H*2+_E92)_X>(@O\E+"S_'R8F_QXF -M(_\J,B[_2E9-_Q@9&O\6$1?_$Q$4_Q84%_\6%!?_%A07_Q,1%/\4$A3_%!(4 -M_Q84%O\9%QG_%Q47_Q\B(_\G,S+_"Q(2_RTU,O\/$2#_&Q@3_QCLO]'6&7_.D9*_XZ& -M@O^HI:3_W=78_Y.8F/^IJJO_P;^\_[JYN/_8T]?_NK:T_\G"PO]S;F[_A8*! -M_R\N+?\8&AW_&AP?_Q(2%?\8%AG_#0X/_UA;7/]15%7_(B4F_R >(?\D(B7_ -M'1L>_Q,1%/\6$!3_% \3_Q$/$O\4%!?_'28^_QPC4?\4'4+_'" \_RX>.O]A -M9G+_65Y>_VMM:O^5DX[_44U+_Q<2%O\L*##_'ATC_S(K,O\Z,3C_?GE__U1+ -M2_^IH*#_'!<9_Q@6&?\3$AC_&106_Z6?G?\8$Q?_%1,6_QH9&/^!@7C_F9:1 -M_SPX-O\F(B3_&1@7_U--0__ O;S___7R_T Z/O\;'"/_&!D:_WAZ=_^\M;7_ -M&A@:_Q43%O\F'Q__&A88_Q83&?\='"+_BX:&_RHK)/^=E(W_@X%\_R\W-/\H -M+2O_&1\;_RTS+_]365'_&!88_Q01%_\4$A7_%1,5_Q02%/\3$1/_%!(4_Q43 -M%?\4$A3_&1<9_QD7&?\7&!G_(B&O\=%1G_&1\G -M_R0V;O\9'R__)BHB_RTP*O\V+2;_.S8V_VUP_[[#P_\^04+_S?]'1$/_&!06_RTH+/]'0DC_13M$_T,T/_^$ -M?(;_85-4_Z&9G?\4$AO_$Q48_Q,1$_\<%Q?_EY&/_PT+#O\5$AC_&!<6_V5F -M8/]K:6;_-38W_QH<(?\4$A3_5%)*_[VZN?__^/?_3$1(_R4D*O\>'R#_+S0P -M_[^VMO\9%QG_)"0G_[.KJ?^ZM;?_&Q8<_Q$/$O\>&1G_'R,;_Z&6C_^ ?GG_ -M-#PX_SD_._\M,R__-3LW_UU@6O\8%AC_%!$7_Q02%?\3$1/_%1,5_Q43%?\5 -M$Q7_$Q$3_Q02%/\9%QG_&1<9_Q87&/\A*"C_,3HZ_Q(7%_\M+3C_(RLA_R,9 -M(O\?)2W_'RUE_S8U1O\W.#+_/T$^_S,X,O^9I:3_F:6I_VYU=?]/96/_,UEY -M_W1\D/^(@'[_AH&!_ZRFJO\;%AS_'AP>_XV.B/^=F(S_2%EF_T=MB/^OS^7_ -M=(ZC_T147O^$A('_F9J4_R_^$ -MB8G_D8^1_ZB@H_\8$Q7_%1,6_QH:'?\0$!/_%Q<:_PX.$?\6%AG_'1T@_QX> -M(?\?'R+_&1D<_QD9'/\/#Q+_$PT5_Q,.$O\0#A'_%!(;_Q4>-O\9(U#_&R5* -M_Q09-_]E3WS_?GF%_Q 8&O\:&B?_'1D;_U524?\H)";_,"LO_RF_\Q,C/_'!P?_QT;'?]+2D/_AX2#___X]_]#.S__'QXD_Q46 -M%_\E)2+_L:6F_QL9&_\9&Q[_&1,1_Q81$_\<%QW_&QD<_Y*-C?]%24'_HI>0 -M_W]]>/]<95[_9FUE_V!G7_]A:&#_9&A@_Q@6&/\9%AS_%A07_Q84%O\:&!K_ -M'1L=_Q84%O\5$Q7_$A 2_QD7&?\7%1?_%Q@9_R8M+?\T/3W_%!D9_S,P//\A -M*![_&A 9_PD2&?\;*6'_&Q'S_3596_U)I -M:/\S6'?_<7)]_Y> ;?^%=V[_J*">_R$?(O\?'1__C8J%_ZBAE?^1HJ__)4]I -M_[//Y/^URMS_$QTG_XJ%?_^#@'O_'B(D_UE;8/^_N[W_O;F[_RPQ,?\T0#__ -M-#T]_TQ85_\D)RC_E(R/_QD1%/\6%!?_&AH=_Q 0$_\8&!O_%148_QX>(?\> -M'B'_0T-&_RHJ+?\@("/_*BHM_Q(2%?\4#A;_% \3_PX,#_\3$1K_%2$\_QHE -M5/\<)TK_,C5._V)4>O^ ?H?_#1 5_Q42'O\0#0S_4$U,_QD5%_\@&Q__0T)( -M_U945O]C7%S_IJ*J_VYO=O\6%!?_&1(2_S$E(?\?&AK_&Q04_ZFCH?\4$1?_ -M$P\7_P\-#_]B8UW_FYN8_ST].O\=&QW_&QD<_RTN*/\:%AC___KY_RLC)_\2 -M$1?_'!T>_WEW=/^FEYC_%1,5_RDM+_^[M;/_G)>9_Q@3&?\=&Q[_%Q(2_T5) -M0?^HG9;_A8-^_V5O9O^%C8/_;'1J_V=O9?]I;67_%Q47_QH7'?\:&!O_&!88 -M_QL9&_\>'![_'!H<_Q@6&/\:&!K_&A@:_Q@6&/\7&!G_*"\O_S([._\4&1G_ -M-3 \_R(F'?\@%A__'2DP_R$V;/\6%"3_(A\>_R$M-/^*I*?_@IVD_UUT>?]& -M4D__46IO_RU5?/]T>8O_D8!R_W-@5O^>DHW_(2(C_Q\;'?^2BH;_IYV2_YFJ -MM_]VHKS_F,38_ZG-XO\J.TC_B(.#_YV8D_\>'B'_2TI0_\7 PO^NIJG_.C@Z -M_S@[//]+3D__/D-#_QH='O^"?H#_&!D:_QD9'/\<'!__$Q,6_Q04%_\6%AG_ -M%A89_QH:'?\]/4#_'Q\B_QD9'/\?'R+_#@X1_Q0.%O\4#Q/_$0\2_Q(0&?\8 -M(CW_(BI6_Q8<-O\8&"'_5$QG_T ^1_\K)R__&QHA_X.!?O]23T[_&A88_RE -M_RLH+O\?&R/_%!(4_V)C7?\;&QC_,S$L_QL8%_\5$Q;_*2TK_Q@6&/_Y[>[_ -M)Q\B_Q81%?\>&QK_'1T:_YJ.D?\H)2O_*"DJ_S$I)_\J)2?_%1(8_R(@(O]^ -M>7G_6U90_Z.:D_^4DHW_;G5N_Y&6D/]Z?7?_;G5N_W)S;?\4$1#_&108_QD4 -M&/\6%!?_&!89_Q@6&?\9%QK_&1<:_Q84%_\@'B#_%Q85_QL:&?\G,S#_-#DW -M_Q8:&/\X/D#_(1\<_QX7$?]&3E[_)"U<_QH;)O\@'AO_)C0S_X:;G?]SB8O_ -M87=U_UMD7?]>=7#_+D]Z_WA\?O^.@O^I -ME8W_4%AB_V24J?]YJ,#_F\WH_UM\D_^\M[W_@G9W_Q\@(?\[/C__S\G'_ZBA -MH?\Q+S'_+R\R_RHI+_]<6%;_'1H9_T-"2/\)"!7_'18B_R :(O\9%AS_$!,4 -M_Q45&/\4$A7_$0\2_Q84%_\?'2#_%A07_Q$/$O\1#Q+_$A 3_Q(0$O\2$!/_ -M%1(8_QTC0_\1%C#_$0\2_Q<1%?\I)2[_)R0J_S M,_\N+"__,2\Q_R8D)O\> -M&AS_0CT__R(E/O]*46?_%!XL_R,S3?]*5G7_"PP=_R$9%?]A7$K_0SXY_Q@3 -M%?^BG9__*B0L_QH5&_\5%Q7_24Q&_U!/2/^LHI[_&1T;_Q@9&O\H)BG_,"XP -M___S\O\H("/_)"$G_R$<'/\_03[_=&EN_Q -$_\E)B?_-2HI_R7/_>'AU_Q<4$_\8 -M%!;_%Q(6_Q$/$O\6%!?_%!(5_Q<5&/\5$AC_%A07_R,A(_\;&AG_'!L:_R)U#_%1LC_R(>'/]46UO_5&=G -M_W2*B?][CHC_8&IA_UEP:_\N2WO_=WQZ_YF#@?]U:V#_=G!N_RHK+/\P,B__ -MCXZ#_VIB8/\,)S+_<:C _X.QS?]BEK?_>:+ _[.SO/]N8F/_)"(D_RXR,/_/ -MR(?\=&QW_ -M(B B_VIF:/\F(2/_$P\?_Q@8(_\5&!W_&B4P_QXF.O\Y/47_)R(=_S4O)_]L -M:VK_# T._Z2BG_\U,"O_(1P<_Q88%O\^0S__3$I%_\6YM?]'3$K_+B\P_QD4 -M&/\8%AG___3Q_SDT.O\7%R3_)B$E_RDK*/]]_["PL_]"1$G_LK"S_QH:'?]S=7C_%1(8_QXB)/\E -M*2O_%!07_Q,.$O\6%!?_&A@;_Q<5&/\2$!/_%1,6_Q,1%/\0#A'_$0\2_Q$/ -M$?\1#Q'_#PT0_QL8'O\?)CS_%!8E_QT8&O\E("3_$A 3_QD7&O\L*BW_'1L> -M_Q<5%_\5$Q7_34E+_RDD)O\:$A;_%A(4_Q(1$/\A'R+_$18<_Q@>(/\L*2C_ -M'Q,6_V1:;?\;$BK_C("5_X%V??]%/#S_(1X=_SQ /O\P,C#_S\3#_S U,_]' -M2$G_(!L?_QH8&___^//_03U&_U-8:O\4$A7_)"0A_V]D:?\7%!K_$Q05_R@= -M'/\6$!3_%Q8<_QH6&/^/BHK_?WAR_YV7C_^MJZ;_TM#-_]C0S/_7R\?_K:BC -M_ZNIIO\9%A7_&Q<9_QH5&?\3$13_%Q48_Q$/$O\4$A7_%1(8_Q84%_\6%!;_ -M.3@W_R0C(O\I.#3_-3DW_QD=&_\O-##_)2(H_QT?'/\4&B+_%QL[_QP>(?]; -M65;_BYB=_XFCIO^%F9W_96UO_UAB7_]7;VS_)4)R_WA]>_^+=7/_;V5:_T]) -M1_\D)2;_(R4B_YV4C?]=;''_'RY%_Q K0_]]I;K_F\OG_Z',Y/^\P,+_4$=' -M_RDG*?]@9&+_SLC&_YF4E/\;&1O_N[N^_TI,4?^XM[[_&1L>_V!C9/\8%!+_ -M(1T;_R8A(?\9%!;_% \5_Q@6&?\B("/_'1L>_Q(0$_\1#Q+_$A 3_Q84%_\3 -M$13_$0\1_Q$/$?\-"P[_'!D?_S,[2_\2$A__%0\3_Q(3%/\0$!/_&!89_R0B -M)?\7%1C_&!88_Q<5%_\8%!;_&A47_QP7'?\-#Q;_!PP2_P@'#O\3#A+_'!H7 -M_Q\;$_]^:6?_?6)R_T@N2?]3/5?_0C8__XV"@?]645'_.3L^_RTO-/_.PL/_ -M+C,Q_TQ-3O\=&!S_%Q0:___Y^O\G)BW_*B\[_S4T.O\H(B#_5U%5_QX;(?^6 -MD9/_M*RJ_SXY/?\.$!7_&A@:_QX;&O^ ?G?_E9.+_[RZM?_7T<__V]#/_]?, -MR__"M[;_K:FG_R0A(/\:%AC_%1 4_Q,1%/\9%QG_%Q47_Q@6&/\7%1?_%Q47 -M_QL9&_\?'1__'R,A_R\W-/\X/3O_'"$?_S0X.O\?(2;_&AT>_Q$6'/\7&BS_ -M%R(C_T-84O]YCY?_EK&\_WR8H/]>>(/_0U=E_TAE7MY_Y:$=O]P -M95K_2T=%_T)%1O\Q-C+_CH^(_WIW=O\<&2;_05IQ_X&PPO^9Q=G_C+?)_ZJY -MN?\X-33_.3X^_V1I9__-R_]O:&__HYZ@_YV7E?]*1T+_55-5 -M_];*R_];4U'_2D-#_QH5%?\<%AK___3T_RPG*?\>("7_(1X=_RXF)/],1DK_ -M(R F_R8>(?\J(B#_'1@<_Q@:'_\<&AS_=G-R_X.">_^8F(__O+JU_]C0SO_> -MT]+_V<[-_\6ZN?^JIJ3_1T1#_Q82%/\7$A;_%Q48_QH8&O\7%1?_&!88_Q<5 -M%_\7%1?_&QD;_QT;'?\?(R'_,38T_S,X-O\=(B#_.#8Q_R0B'_\?'"+_%A,? -M_Q01*/\P-U7_'S%5_R V7/\O5'?_.VJ-_RU:@O\>16__+%5Y_RY(;_]\@XG_ -MGI"!_VQ@5_]%03__+C$R_RHO*_]?8UK_@7]Z_UUF;?]9?)/_;YZV_Y_!V_^# -MI;G_H::K_S,L+/\T-3;_55I8_WZ ??]L:VK_*2PM_Z"DIO]>8VC_PL##_Q,1 -M$_\0$Q3_'AH<_R,A&O^XKZG_BWQ\_Q<1%?\6%!?_%!(5_Q02%?\3$13_$Q$4 -M_Q,1%/\2$!/_$A 3_Q,1%/\2$!/_$Q$4_QH8&_])1TK_%1,6_Q .$?\2$!/_ -M$A 3_R >(?\B("/_(R$D_Q<5&/]$0D7_%!(5_Q .$?\4$!C_$@X6_QH6'O\G -M(RO_,2XT_S@S.?].2%#_85ID_Q$.&_\4$1W_'!@@_T(]0?^MJ*K_LJJH_WMO -M:O]L967_BX*"_W!G9_]L967_7%=7_T,^0O__\.S_.S0T_RDJ*_]-1T7_-2TK -M_S8P-/\:%QW_65%4_V-;6?\G(B;_&QTB_R8D)O\V,S+_CXZ'_YB8C__$PKW_ -MV='/_]?,R__:S\[_Q;JY_ZJFI/]/3$O_%1$3_Q81%?\3$13_%Q47_Q84%O\5 -M$Q7_%1,5_Q84%O\>'![_&A@:_R(F)/\X/3O_,#4S_R,H)O\U.3?_%Q\I_PL7 -M,O\,$S?_"!,R_RL\:O\>.7;_*4M]_R=0@?\^;)[_+%J,_S);C/]%:)#_3F:- -M_TQ47O^7C8+_=VMB_S@R,/\_0$'_2$A%_VIN9?]J;F;_=8.&_SM=GK_N,#"_Q4?(_^] -MN[[_'!H<_QH='O\>&AS_%1@2_[>IIO^;@(;_% \5_Q$1%/\4$A7_%!(5_Q . -M$?\4$A7_$Q$4_Q,1%/\1#Q+_$A 3_Q43%O\3$13_%!(5_QX;(?\3#Q?_$0T5 -M_Q ,%/\1#Q+_&A@;_QD7&O\8%AG_$A 3_QT;'O\4$A7_&A@;_Q(/%?\2#Q7_ -M%1(8_Q42&/\3$AC_$1,8_Q,5&O\7&1[_$1(9_Q,2&/\R,#+_'QT:_Z&5_T]-3_])1T3_'QL=_QP8&O\C)2C_/DI3 -M_Q8M,O]/8F[_CJBU_QPE)?\E("#_/#] _TA-2_]65E/_34Q+_TQ-3O^RM+?_ -M&!L@_[2OL_\>'![_'R(C_QX:'/\A'QS_N;6S_UA35_\6%1S_$@\5_Q(0$_\0 -M#A'_%A07_Q\=(/\5$Q;_%1,6_Q02%?\3$13_$0\2_Q,1%/\2$!/_-S,[_S(N -M-_\=&2+_&A8?_Q(/%?\7%1C_%Q48_Q<5&/\/#1#_(!XA_Q<5&/\0#A'_&A@; -M_Q02%?\4$A7_%!(5_Q,2&?\3$AC_%!07_Q,4%?\4%1S_$ X7_U%/4O\?'!O_ -M;F]P_V9D8?^%@'K_5%-2_TQ04O]%24O_2$A+_TI(2_]'14C___C[_R(?)?\5 -M%AW_'QP;_SPV-/\@&Q__(QTA_RX?'_\G%Q3_(AH>_Q,5&O\1%!7_0$%"_XB& -M@_^;E8W_Q\*]_];/S__=U-3_V]'-_]'%P?^>EY?_'!<9_Q82%/\4$A3_$ X0 -M_Q43%?\=&QW_$Q$3_Q<5%_\9%QG_,"XP_QH8&O\E*B;_,C8?]%.C__'QH:_RXJ+/\;%1G_%Q,5_R0C -M(O\?&AS_-"4?_R<9%O]74E3_>W-Q_R4=(/\E)"K_)BHL_R @(_\H)BG_&18< -M_VAG;?\@'R7_G)ZA_Q<9'/\:&AW_'1L>_R,>&?_$P<#_:&=M_R,@)O\7&A__ -M%QD>_Q(/%?\8%QW_*RPM_QT;'O\@'"3_$Q$4_Q84%_\U,S;_#0L._Q84%_\Q -M+C3_.#0\_QH6'O\;%Q__%Q(6_QH5&?\6$17_%1 4_Q83&?\7%!K_%!$7_Q83 -M&?\1#A3_$0X4_Q83&?\5$AC_%A,9_QL9'/\9%QK_&1<9_Q$-%?\3#Q?_.#0\ -M_RLH+O\G*2S_U_[VUL?\<%QO_&!<=_QD5%_\5 -M$Q7_DHV-_YZ5CO_*Q<#_UL_/_]W4U/_77_(!D9_RPJ+/\S.CK_2$M,_RDJ -M*_]A8F/_?7Y__Q$2$_^SM;C_&QT@_Q86&?\<&AW_*28A_[VXN/]@6F+_&Q@> -M_S(W//\X.C__'QPB_R@J+_] 04+_%Q0:_R7_R0?(?\= -M&1O_%A06_Q<5%_\9%QG_&A@:_Q,1$_\2$!+_&A@:_QP:'/\:&!K_)RPF_S<\ -M.O\J+R__)2LG_R\Q+O\H)B/_/#DT_T0_.?]'/SW_&Q(2_R,<'/\>&1G_,RHD -M_T0\./]234W_:%]9_V9:4?]Q9EO_>FU@_X5W:/]Y<6?_9F-8_VQK8/\U,S#_ -M(!XA_R(@(O\H)"+_+1X8_T8K&O\X(17_U,;#_Y2,BO\>&AC_75]<_V%L9_]: -M8%S_7V5A_VEO:_]=8U__/4,__TI/3_\1$Q;_#P\2_Q84%_\W-"__3$='_R : -M(O\8%1O_-#D^_UQ>8_]95ES_,#(W_U!14O\2#Q7_(!PD_Q<5&/\6%!?_&QD< -M_Q84%_\@'B'_%1(8_R0A)_\4$1?_'ALA_QH5&?\:%1G_%A$5_Q0/$_\7%!K_ -M%A,9_Q@5&_\5$AC_%A,9_Q01%_\6$QG_&18<_Q00&/\@'"3_%1$9_R,?)_\U -M-C?_4U53_V5G9?]*3$K_2DQ/_T1&2?]!0T;_/D!#_T)$1_\_043_.SU _SY -M0_\Y.3S_^O+U_S0O-?\D(RG_;VIJ_Y:2D/\>&1W_+2@L_Z"5E/^+?WO_'1<; -M_QH9'_\=&QW_'1X?_Y60D/^>E8[_S\K%_];/S__8S\__U,K&_]C,Q_^=E)3_ -M&A47_QT9&_\5$Q7_%Q47_Q@6&/\:&!K_$Q$3_Q,1$_\;&1O_'!H<_QP:'/\G -M+";_.3X\_RHO+_\F+"C_-30M_R\J)/]+13W_6U-)_W]S:O]-03C_13LQ_TU% -M._]P8U;_(1D5_R\K+?]/1#W_%Q[_&Q@>_Q42&/\5%A?_$Q05_Q87&/\0$1+_#@T3_QP;(?\8&1K_ -M'B >_R@M)_\\03O_*S L_RLP+/\O*RG_03PV_U=11_]H7E#_8E!&_U! -O]% -M.B__75-(_U]23?\5$!+_$! 3_VYI8_]L8EC_>VYA_WEK7/^$=VK_8UQ6_V!< -M5/]Q;&;_'A89_Q40%O\2$!/_(!D9_U1!.?]A0RW_5#_Q06&_]$1DG_%!8;_QT=*/]$ -M1DO_+2LT_Q\<(O].3$[_3TQ2_Q01%_]85EG_'AP?_Q84%_\1#!#_&A88_Q@3 -M%?\A&AK_&Q8<_Q,/%_\;%Q__'1DA_QP:'?\@'B'_'QT@_U)04_]O<73_55E; -M_TU14_]*3E#_0TA-_S]$2?\^0TC_/T1)_T!!2/]#0DG_0D%(_T)!2/\]/T3_ -M/4%#_SH^0/\V.CS_%1,5__SZ]_\K*"?_&!88_QL9'/\M+3#_&!@;_Q86&?\4 -M%!?_'ATD_Q06&_\5&!G_*28A_QX?(/^/CHW_GIB0_]/.R?_3R\G_U8_Q@2%O\9&1S_&!,7_QP8&O\:%AC_'!@:_Q<3%?\1$A/_'1X? -M_QL=&O\D)R'_'" 8_T!#/?\E)R3_%1<5_QX:&/])1T#_5E-(_VE?4?]X9ES_ -M6$@^_T4X+?]21SS_8E-3_QH2%O\8&AC_W=U_V]Q:/]B9&'_&AD@ -M_Q<6'/]%0#O_3TE'_QL5'?\5%QS_&B(F_SD[0/\9%AS_%!8;_T=)3/\/$!?_ -M'!PE_U!25_\V,3W_'QLC_V%?8?]855O_$Q 6_UA66?\>'!__'QT@_SLZ0/\8 -M%QW_%!$7_Q83&?\9%!C_$@P0_RHD*/]*1$C_4E!2_W1R=/]<6ES_6%98_TM- -M4O]'2D__1DE._T)%2O\_0D?_.SY#_S@[0/\S-CO_+C U_RXM,_\N+3/_+BTS -M_RLM,/\K+3#_+C S_RLM,/\@'B#_\_7R_SP^//\A'R'_CXJ._T]-4/\6%!?_ -M%Q48_Q43%O\C&Q__&108_QT@(?\6&!;_&Q\=_Y"1B_^BFY7_U<_-_];+RO_5 -MR<7_T\K$_\W'O_^>DI/_% \1_QD:&_\;%QG_&!,3_QD4%/\>&1G_%A$1_R4F -M(/\R-2__0$,]_T)%/_\R,B__+BXK_R$@'_\1#Q'_(!L;_T1"._]$03;_7%)$ -M_WIK7O]31#?_0C,F_U-"-?]:2TO_'AD?_R,E*/]234?_;6)7_V582_]K7E'_ -M95Q5_U)-4?].2TK_:FAC_Q41$_\6$A3_&A<=_Q83&?\J'A__6#TL_TTX)O]H -M7UC_;FIL_QX7(?\@'R;_4UM?_V%E9_^)B(?_%!$7_Q<3'/^"@(/_?X%^_V-C -M9O\8%A__%!,9_TY,1_\6$Q+_&14>_Q@7'O\8("3_5%9;_Q,0%O\@(B?_65I; -M_Q,2&/\H)R[_9&1G_S0P.?\?&R/_9V5G_V%>9/\3$!;_5U58_QX<'_\C(23_ -M96-F_QP;(?\6%A__1TI5_R <'O]D7U__@GU]_UU86/].3$__2DI-_T]/4O]& -M1DG_0$)'_T)$2?\^0$7_/3]$_SY 1?\Y.T#_/D!%_ST_1/\]/4#_/S]"_SX^ -M0?\_/T+_/CY!_SP\/_\S,S;_(" C_QH6&/_V\O#_/SHZ_RTK+?\G)RK_FIB; -M_Q@3%_\8$Q?_&108_QP8&O\5$Q7_&AT>_Q@6&?\?&QG_FI6/_YF4CO_6V=K_ -MS]/5_]#0T__-R,K_R[_ _V)65_]'0D+_?X%__V)?7O]34U#_0D(__S,S,/\N -M+BO_.#LU_S0V,_\K+2O_(R,F_QP9&/\6$Q+_$0P0_Q40%O\@&1G_14,\_U93 -M2/]M8U7_@')C_W-E5O]N7$[_;UM-_UU.3_];5U__*"LP_T5"/?]G6U+_9EE, -M_UM01?]*1D3_(Q\G_QH8&_]555+_'AT<_QH5%?\9%AS_&!<>_Q\9'?](+B'_ -M2C@J_U)33/]&14O_(!LG_Q<9(?]>9VW_8F=L_VAG9O\=&B#_&QLF_T)$3/\X -M.CW_+2PS_Q@6'_\6%1O_/$$]_PT/$O\4$1W_&!8?_Q$9'?]%1TS_&!4;_Q06 -M&_],3DS_&A@;_R,@)O]F9&;_+"@Q_Q\;(_]H9FC_75I@_R,@)O]&1$?_(1\B -M_R0B)?]02DC_13\]_T9$1_\5%1[_8F1I_U!/5?],2U'_24A._TE+4/]&2$W_ -M/T%&_T!"1_]-3%+_-30Z_S O-?\M+#+_*RHP_RLJ,/\J*2__*2@N_R_Q@3%_\8$Q?_%Q(6_Q02%?\5$Q;_&108_T0\./^7D8?_F9B1 -M_\'$Q?^TN;[_K[.U_[:TM__!N;W_96-E_V=J:_]=8&'_,S8W_R0I*?\A)B;_ -M(",D_R,D)?\B("+_'1L>_Q@6&?\6%!?_$ X1_Q,.$O\3#A+_$@T1_R(=(?\_ -M.3W_+"8D_UY72_]K85;_74] _WQD5?]^9%G_+1XB_R@C*?\W,S7_/CLV_V5: -M3_]A5TG_5TQ%_SPV-/\:%A[_%Q@?_SP_1/\]/$+_'ALA_QP;(?\/#1;_)B(K -M_RTB)_\E(AW_6EQ3_U-15/\;&"3_&1DB_UE<7?]77%;_6EQ9_QD9'/\9&![_ -M7F)@_V]Q;_]D9&?_&!<>_QP;(?\_03__*2DL_QD5'?\=&2'_/ST__QT:(/\9 -M%1[_%Q8=_S$P-O\;&![_'!H=_VII:/\B'RO_(!TI_U!+3_],1D3_*B(>_R@@ -M'/]/2D7_:&5@_XF%A_]85EG_24=*_Q44&O])3%'_1DE._SP_1/] 0TC_/D%& -M_T)%2O]%2$W_0$-(_T%$2?\_0$?_.CM"_SP]1/\Y.T#_.SU _ST_0O\O,33_ -M*RPM_RPJ+/\I)RG_*2_\6$17_&A49_QD4&/\8$Q?_&!,7_Q\:'O\F(27_2T5#_Y"+ -MA?^+B83_'Q\B_V)G;/]26%K_2DY0_S4D/_;%E'_W5@5/\I(27_,BTS_T1 0O]" -M0#W_55!*_U%,1O]'0D+_.C4Y_Q\;(_\7&!__4UA>_U-26?]/3E3_5U9=_Q@6 -M'_\[.$3_,R\X_UM96_];7%;_6%99_QH7(_\9&!__6UQ=_U]C6_]@8F#_&!<= -M_QH9'_]?85__8&)?_UY>8?\8%Q[_%Q8<_T5$0_\V-#?_&!0<_QT:(/]K9F;_ -M;6AN_QD5'O\<&R+_;VQR_QT:(/\C(23_5U57_R8@)/\L)"C_4DU-_UM65O^ -M>WO_A8""_T1 0O\T,C3_)"0G_Q\>)/\;&B#_$A$7_R(B)?\H)BG_*RDL_S(P -M,_\R-#?_-SD\_SD[/O\Z/#__.3M _S@Z/_\V.#W_-3<\_S(T-_\L+C'_*"HM -M_R_R@F*/]>7%[_>G5P_ZFAG?]W_U157/].3E?_1$9._SU#2_\X.T#_.3Q!_R\R-_\I+#'_*RDL_R\J+O\M -M*"S_+2@L_RLI+/\H*"O_)B8I_R8F*?\F)BG_)24H_R@H*_\G)RK_)R%!?_,2DL_RPG*?\<%QO_% \3_Q40%/\4#Q/_%1 4_Q40%/\4#Q/_ -M%Q(6_Q,/&/\7$AC_&!,7_Q@1&?\3#!/_%Q$5_Q40%/\1$13_$A 3_Q(0$_\1 -M#Q+_$0\2_Q 0$_\-#Q+_%1,6_R ;'_\5$Q;_$A 3_Q$/$O\1#Q+_$0\2_Q . -M$?\1#Q+_$ X1_Q$2$_\8%Q[_&!0<_R$='_\1#Q'_2D9$_U502O\C(B'_$Q$: -M_Q43'/\M+#+_4U15_TU05?]665[_7EUC_S M,_\<&"#_%Q@?_UYC:?]B86C_ -M8F%G_V-B:?\8%A__%Q0@_UY?9O]@86C_8&%H_U166_\;&B'_&!<>_V5D:O]E -M9&K_7UYD_QD7(/\<&B/_34U0_S$S,/\G)RK_&QHA_QD8'O]!0#__+2LN_R < -M)/\G)"K_0#TX_T(^0/\A'B3_'Q\B_V1E7_^"@WW_EI64_V=E:/]565O_55A= -M_TY05_]*2E/_2$=._T9'3O]%1T[_049,_SY#2/] 14K_/D-(_SU"1_\^0$/_ -M/CY!_S0T-_\O+S+_+"HM_RLI+/\J*"O_*B@K_RLI*_\H)BC_*2(/\E(2/_)B$E_R,>(O\W -M,C;_)!\C_Q81%?_Z\?'_(!<>_QL4'/\;%AK_&!,7_Q40%/\5$!3_%1 4_Q40 -M%/\5$!3_% \3_Q<2%O\7$Q7_%Q(6_Q,.$O\8$QG_'!4?_Q@3%_\5$A'_%! 2 -M_Q$/$O\2$!/_$Q$4_Q,1%/\3$13_%!(5_Q82&O\<&"'_&Q8:_QP8&O\?&QW_ -M&Q<9_Q<2%O\5$!3_%1 4_Q0/$_\3#Q?_%Q,;_QX9'_\?&1W_'1D;_R,@'_\G -M)"/_(1X=_Q82&O\8%!S_(!XA_TM+2/]-3TS_3E)*_TY/2/\<&!K_'A -M_QL=(O]A8FG_8F)K_V%A;/\7%R#_(B,J_TY05?]355K_5U)8_R6/]K:FG_E9.5_X2 @O]95E7_6%A;_U-56O]04EG_3E!7_TM-5/]) -M2U+_2TU4_T=)4/]"1$O_1$9-_T1&3?]#14S_04-*_T%#2O\^04;_0$-(_T!# -M2/]!1$G_/#Y%_ST_1O\]/T;_/D!'_ST_1/\\/D/_/3]$_S@Z/_\R,#/_*B@J -M_RLI*_\H)BC_*"8H_RDG*?\G)2?_)"(D_R[U_SXT/O\F'"O_'QDA_QD4&/\6$17_ -M%1 4_Q<2%O\:%1G_&!,7_Q40%/\8$Q?_%Q03_Q<3%?\:%1O_'17YX_Y&1 -MCO]O:FS_5U=:_U)45_]14U;_4%)7_TY/5O])4%;_2$]5_T1(4/]%1E'_1DA0 -M_T=)4/]&2$__1$9-_T%#2O]$1DW_04-*_T!"2?] 0DG_04-*_T1&3?]!0TK_ -M/D%&_T)%2O]!1$G_1$=,_T%#2O]!0TK_/3]&_T!"2?] 0D?_/D!%_S]!1O\^ -M0$7_.3M _ST_1/\\/D/_.CQ!_ST[/O\W-3?_,C R_S N,/\M*2O_)B(D_Q82 -M%/\7$Q7_%1 4_Q(-$?\7$A;_%1 4_Q81%?__^?C_(1,4_RD;(_\;%!S_&Q8< -M_Q<2%O\<%QG_(AH=_QX7%_\=%1C_%Q(4_QD4&/\6%!;_%Q47_Q,0%O\7$QS_ -M&A,?_QT7&_\A&AK_%1,5_QP9&/\Z-S;_/#H]_T5$2O])24S_3T]2_QT9(?\C -M'";_(APD_TE&3/]'1$K_1$)%_SDW.O]$0D7_3DQ/_U%/4O\9$AS_&Q0>_RDE -M+?]45EO_55=<_U577/]<7F/_7%YC_Q41&?\:%A[_(B$H_UE87O]56%W_6%Q> -M_UE;7O\8%1O_(!PD_Q<6'/]14U'_7%I5_U=63_]345/_&A8?_QX:(O](1DC_ -M/3XX_TE*1/\I)RK_(AXF_R0C*?]:6US_6UE6_UY85O^!?'S_@7Y]_UY?8/]0 -M5%;_5%=<_U-56O]25%O_3E!7_TM-5/]&2$__0T5,_T1)3_](25#_2$=._T9' -M3O]*3U7_24I1_TA'3O]#14S_24M2_TA)4/]&1T[_0T1+_T)$3/] 0DK_0T5, -M_T9)3O]%2$W_1$=,_T!#2/]$1TS_04-(_T-"2/\_/D3_0T)(_T%#2/\Y/$'_ -M.T!%_T _1?\^0$7_.CQ!_SH\0?\Z/$'_.SL^_S\]0/\5$Q;_)2,F_Q<5&/\T ->,C7_%Q48_R\ "MR L]0 +G@ "_Z Q?0 ,P #2# V!@ -M-XD #D+ ZC@ /! #V3 _%@ 0)D $(< !#GP 12( $:E !( -M* 2:L $LN !,L0 3C, $^V !1.0 4KP %0_ !5P@ 5T4 %C( -M !:2P 6\X %U1 !>U 8%< &': !C70 9. &9C !GY@ :6D -M &KL !L;P ;?( &]U !P^ XT 'T0 !^DP @!8 (&9 "#' A)D (8< "'GP B2( (JC ", -M) C:< (\J "0K0 DC ).S "5-@ EK4 )@U "9LP FS( )RS -M ">- G[, *$N "BIP I"@ *6E "G)@ J*( Q8 -VP #UX -M !#? 27 $]@ !56 6UP &%D !G: ;70 '. !Y@ ?XP -M(68 "+H D:P )>H "=J H[0 *G "OS M=@ +O@ #![ Q -M_@ ,X$ #4$ VAP . D #F, [#P /)$ #X4 _EP 01H $*= -M !$( 1:, $H &MM !L\ ;G, &_V !Q>0 LP H#0 *&L "C* I*< *8F "GI -MJ2$ S9 .7 #]\ !%> 2VP %%< !76 76 &-D !I; ; -MW@ '5\ ![A @9 (>< "-I D[ )FD "?K I;@ *O$ "QT -M M]P +WD ##\ R?P - ( #6% W" .(H #H- [D /1( -M #Z5 ! & 09L $,> !$H0 1B0 $>G !)*@ 2JT $PP !-L@ -M3S4 %"X !2.P 4[X %5! !6Q 6$< %G* !;30 7- %Y3 !? -MU@ 85D &+< !D7P 9>( &=E !HZ :FL &ON !M<0 ;O0 '!W -M !Q^@ 8 'F) ![# ?(\ 'X2 !_E0 @1@ -M (*; "$&@ A9L (<> "(H0 BB0 (NC "-)@ CJD ) L "1KP -MDS( )2U "6. E[< )DW ":M0 G#0 )VU "?- H+4 *(K "C -MJ0 I28 *:G "H(P J:( " @0 ($ !_ ?P 'X " -M @0 ( "! @0 ($ "! @0 ($ " @0 '\ -M " @0 ($ "! @0 ( "! @0 ($ "! @0 -M ( "! @0 ($ "! @0 ($ "! @0 ($ "! -M@0 ($ "! @ ($ "! @0 ($ "! @0 ($ "! -M @0 ($ "! @0 ($ "! @0 ($ "! @0 ($ -M "! @0 ($ "! @0 ($ "! @0 ($ "! @0 -M ($ "! @0 ($ "! ?P ($ "! @0 ($ "! -M@0 ($ "! @0 ($ "! @0 ($ "! @0 ($ "! -M ?P ($ !^ @0 '\ "! ?@ '\ "! @0 ($ -M !_ ?P '\ " @0 ( "! @0 '\ "! @0 -M ($ "! @0 '\ "! @0 ($ "! @0 ($ "! -M@0 ($ "! @0 ($ "! @0 ($ "! @0 ($ "! -M @0 ($ "! @0 ($ "! @0 ($ "! @0 ($ -M "! @0 ($ "! @0 ($ "! @0 ($ "! @0 -M ($ "! @0 ($ "! @0 ($ "! @0 ($ "! -M@0 ($ "! @0 ($ "! @0 ($ "! ?P ($ "! -M @0 ($ !_ @0 ($ "! @0 ($ "! @0 ($ -M "! @0 ($ "! @0 ($ !_ @0 '\ "! ?P -M ($ "! @0 ($ !_ ?P '\ " @0 ( "! -M@0 ( "! @0 ($ "! ?P ($ "! @0 ($ "! -M @0 ($ "! @0 ($ "! @0 ($ "! @ ($ -M "! @0 ($ "! @0 ($ "! @0 ($ "! @0 -M ($ "! @0 ($ "! @0 ($ "! @0 ($ "! -M@0 ($ "! @0 ($ "! @0 ($ "! @0 ($ "! -M @0 ($ "! @0 ($ "! @0 ($ "! @0 ($ -M "! ?P ($ "! @0 '\ "! @0 ($ "! @0 -M ($ "! ?0 'X !\ ?0 '\ !_ ?P 'D !\ -M?P '\ !_ ?P ('J^!0C'!P6&1T7&!08%A<6'!\;&A48-CU*3%(A -M)B1,2D4Z14]2'!XM6UQ<8V,9'BA>75Y>&R0<455/4Q\B2#A$*B8I7%96?'U@ -M5EQ:6U=43TQ/4$Y.55%.3%)03DM,2DQ.34Q(3$A(1$A(00-% T&+/D 6)A@U -M&"@5$Q4!% $6 .WY$QL4%A(7&A<5$A04%1 3$Q<:$QDW.D1)3QD<'$9$0C=" -M3$\2%"565U=>7A$6(5A87%L5'!936E91%AI&/DHG'B-;65A\?E]45U544$U( -M14E)1T=/2D=%2TE'1$1"14E(1T-'0T(^0D,\0#] SR+.ST3(Q4R%242$!(! -M$0$3 .W_(2D;&Q<<(AX=%QD6%Q,7&ATA%1PZ/$5)3QTC(DE'1#E$3E$9&RE4 -M555<7!4:(EE56%D8(!=17%=3&AY(/4DI(B1:6UZ!@5Y05%-23DM&0T1(2$9* -M24A#24A&0T) 0T9%1$!$04,_0T$Y.T ^ SJ+.S\5)1'1Q!21H>'1@<'R B)"@9&!U+35!15!<9+VE545$<(QA86%M4 -M&QM86ULE(1Q?1RTB*%)YD6]74E%03DE(1$5&1T9$041!0$!!1$$^0D%$04$] -M0$ ^/SXY/3PZ/3(3$_3!L=)DY13$\<)AU64DY6(!]65%(E -M(2!A8F8<)UE-3U10=UU76%976E984U!03D]034=)1$Q(25)&2$A'2T5%1D4] -M-3 J*R@J(R,G("P8$QF!75DQ+2D=.2D='149'1#Y .T- 04H^/S\^0CX^/SXZ,BTG*R@J(R4I(BX9 -M%!@!$P$8 (7Q'AP:%P44C!,6%182&1\7$1(2$P,4XA4:(1H:'1D6%!03%QL? -M'1L?(QT:'"%(3$I(&B$>4U=45QT@95]C0QXB:6ML("I56E@C(UA8:96"55M: -M65=44E102TU-3$I*1DA(245&1D=$0T0_,RHK*"@I)R0E)B$A0> -M2T]23Q@7&%9:6544&5]>8CP7'6)B81(2$>,@$? 1$ A?LF&Q<8!16!% ,7[148-!H5%!$2$0\-$!\;%A43%!(3 -M$A,1%Q@9&2U%/188*5)-45(G(!U;8UUG&1I:8FA%%1I?9&(2&V%>81\ -M*%I@=F165UI13$I%2$5%0T5"/#U!/3X\/#@Z+"DN*BHG*24H)28G(B4F(S/RXD*CA )")? -M?91H6UU74P-.BTQ(2DA'0T$W,BTL RN%*"DH*B<#)@4D@2(!)@$0 )[P%"DG -M%P\0#Q 0#Q(/$A,1#!$0$1 0#P\0#Q,;$Q ##[L.#PX2%Q0=#T90(A$3+%10 -M65TM&!AC86%B%A1?86%6&A=D9%X7&DTS)QH80"L<)#T^'A]E@Y5E65A02@-' -MED9#14-"0#XT+RHI*"@I)B_!XQ+!P4%105%107 -M$Q<8&!,7%1$2$A$1$ T5(!42 Q'4$!$0$1@8(1%*52,3%2U3359>,!P77F)B -M8Q@77F!@5!L8965?&1Q-,2<;&4$M("= 0B$?9(*69U553DI(1D5!/D ^/3X^ -M-"\L*RHJ*R@I*"DF)24F!22!(@$F 1( EOD;&Q<8%AL8%144%Q4;$QHE(RXA -M%!0#$X42&&P6$P,2Q1$2$1Q3.!LS1$%+&QPY.D)8630C'VQN*%YPG71>7%=.2T!!-S$L+@,L@2L#*8DH -M*RHJ)R>JEW6U1.1#TX.2\I*R\M+2LH R:))2@G)R0D)2@G!"6!* $B -M 2T ]?,F&QM[%1D8%Q<>)4.%A")L6E Z,"TI'Q@7&!$3%!(2$1(2$11 &QLY -M0T=4)3-"/4I&0CDC'UY95%T?1#A;5EDC'UU;8!T?7U]A'AQ#-QP@9FX>(G(@ -M)%X)"-"%Q9$-!0:9F@5&VP:(54@)$U6 -M>X! ,B0>&A$B)BDP-#D[/#LZ.#&!=%-A@=:VT9'&\=(U]96MA-RDF)"4B'AD7$1(2$2$])$M60%59(BDU-D])130>'T1"(2$6 -M*R<=4U0D(EU661P>8&]G'B$_+!TA/R >'38>'6@K*4]$'AQ%8(=92AI13D1( -M1DI-2$E'0D1 0$(T+2PI*0,H 1T!% "@]"(7%Y :$Q,2$A,4/)&8Q+FSM+EC -M:F V*28C)" ;%A0##I@-'3DF5V%/9&0>(S,[6E=,-A88/SP;&PT#(H1<41@9 -M URS&1AB<607&T$I%1D]&A46,!@::1\=2T8B($IEA59'%$Q)/T-!14A#1$ [ -M/3L]/S$L*B:UU\?BTH-SYE85<\&A<\/1X<#R8M)5I3&QE95UH9&5YO -M9!@&1F/CMK5T\K 5T)_7E _,"LU,RLF&!(0 -M%AD\2%5C5DY-3U\P/5),140G&U(<%1P>'2$J3$LG(6UL9B F3#TS'QL]$AT? -M'4P;&TP;)F8Q(VA@)D8$Q,4&!,=%AN5E-G3T,B_5D*!7U-",RX[-BTC&1,,$!E#4V-R -M95Q;3E:&!@9'!4:&!^:F=;/T,W+8D=_8E-",RXX-"LC'!81%2!%5FV &AD8'TA*4D8@%UYB:!T;0C@M&!8\#108$448%$P:(V8L'VA= -M(T8A)%!%1A5B4$Q)248_0$TU,"TK*RHI)P,I@RLI*@$; 1D ^_(\(8Y0%Q@6 -M'Q@A%AV+E-R8U2Q\H1U=+4551 -M2F,3%!T9'RPF6&PA)E]GAQ<<@WYF'QE'$AX>)%L6)UL8+F7WU83TU224=)141%0$5$0$)!0D$_-@$C 1@ ^_4^'XI-%!43&Q0@&!^1 -MF\_+R$%4<(6,;%DH<7WU8 -M3$I/1D)$0#] .T _/3\^/SX\,P$@ 18 ^_,\(8]/%A<5(QD=%AN0HM76U=/- -MGA09&Q@9'A8E,D!",BXA$2!$1%QZ4T)36AXC4FUE:V523FH5%AH6*EA-:&X> -M(%-AB107@G]C&!1.%AD8&%03(%D3*&0T'V=A$U<>(V4<%D<@9()=3DI/1D!" -M/CT^.3X]/3\^/SX\,P$@ 1H ]? /3\*Q@;+1@6%!X4%2D>CY[3T]73RZ,8&1@<&AP7$1T;)!Q )14>259I -M>%A%4F(:&')E;6IS56E:$Q45'T5;2I:&)"EB?(D7&WMO8AH714\;%1HY&11' -M#QQ0-A]A6!-8'A\[&!06&1(J2E)T7%A+1T9"/SLX,P0N@RLK+@$K 2 ^_4J -M''^5&B!G&!<5&!(3(1H>)SLL+"DV1U!&-B](31(3 -M8UAA7&I65&89%A,9.2TE=84K95943@PD/TTE(QU 3AP<-%T>&TD;*$LT(DY2 -M%UD?%Q 8%1H<%Q\A'2$@4W1;4U!-24A)2$E(2$1#0 $\ 14 ^_0G&7Z4%QUE -M;!4G%"B+E,W1S-# FA<8$A84%Q$-&QD@+4$P,"L\45Y00#I34A 0:6)N:W=< -M7&P6$! 904,W?8*#PK*R]!5VAB4$5=7Q40;FQ[>81C8'$>%1(@ -M5&%4D(\K8%!03 %A$:&"$;$QL= -M'" ?4F]534I#/SX_0$-"0CT].@$V 14 ^_4U*6J0'2R4>QL?'1^0CL7/S\;' -ME!<;%1<8&A,3&QP<)CPO*"TD/4EJ.#$[5A4M/5AC9W!>5V@T'QLB'BP>JE\O -M:6UA7#]#-%46$"$TB",F.V49($PC("'B4E -M1W5B55%*2$5#0C8V.0$T 1H ^_(O(VJ2&2B5?Q<9&QZ0E&A0;&R4E1W5?3DI#03X\.S$Q -M- $O 1D ^_-(,!IE(R4=&18?&BZ(CL7+SL[%ER$;%A<9&A,2&AP:)CHO)RXC -M-#D]$AP9)#A-65%;8&AG6& P(2(B&!H5PXH87&=<86M?/T\6$A$B$1&Q45$0\4$Q42$Q$3%A <$1\V56=,3$9#0$1!/0% 3D ^_A'*Q]O -M)" @(14:'RZ-GL_2U]S6H"0=%A<9&A,2&AP:)S,T12:&9Q -M>H5Y9FPU("(H+48XU)0>76%:7VE=/4H1#Q8W3" 8-%Q9,% 2(!<6&Q8@%204 -M'AH:%A07%A@5%A06&10@%2,U4V5*2D1!/D(_.P$^ 3D KO8H)HEM*1FUL1L= -M%Q6-CL#/U,[!EQP5%189'!,3&AL;(S@S*"\D0#M534 Q+B4$&U%Q<5$XV5Q<_4 -MTL:7&A,3%!<:$1$8&1DI.C,L-2E&0UE1138L(A86%QLE=EM<9CT:%S(<,R6] -M>1DJ.DLJ8GX2M1T6&B:X6A@W.APJ010C$0HP%! <%1 .$Q01$ \7$ \6#A<0 -M$A,1$ATJ*U!*2$=&04!# 40!0@#[^RRM;=W-*@'Q<5 -M%AD<$Q,:&QLD-2XF-"Q+26-92CDP)!@8&Q\L@&=B:4 >&30G2CG*@R L,T@I -M87T1LQL6'"F]8!LR.!\H0!'!84$!4=$Q<9,!HE,C,D/"AO8G]L -M;7!UR4E)B H&6@@G!<:'2/$:",7%Q(8*QT@ -M$Q8U#18Q.!H;%QH6%187%!81$185%AL9&1$3."LG'"6'C+W,R<[!FR,4%A07%A45&",;)CPR)S@M8&I33EU,/D!/:F9O -ME4]$'1HH4S)NM24@0$M32TZW(+,>(QP:&Z A'.?3TD?'",^%D^.'"4\ -M2%9-3+(8M!X?'B&Y6!82$A 6'Q45%!,1$Q(W,AT:$@,7A0\@%Q : Q2/$Q,4 -M$Q0041]N9H543$5( 4H!1P#J[#0K12LT'519)B(F,H>/O<_+SKFD2Q,5%!<6 -M%146'AHD.S,F-RDR-S)J=GV!GHR,D(U>@F(P045E9H9QQ."RA'M!("]&>L(C -MOAP>'!*FAA44%141%104$A,6%!4A%Q44$AL:&1,>%1L5%008C1H>&1@R&IR# -M5UU>7$@!3P%3 );P-"I'+3 745LB'20SCIC"TS\C,TAZP!^[&AT:&*F -M#Q$2$@X2$1$/$!,1$AL/#0P/&!<6$!L2& \/ Q*.$Q49$A(P'9R$7%U<6D8! -M30%0 /O_.RE--38:66,G&R8VCYC$V=?:Q:I/%183%Q85%18>&B(X,",U%PL, -M""L>*2<^+#)%3DR7=S@_2&IJ=3M]H'AUA$,;+4-UN!6]'!H>%;>;%!$4%! 4 -M$Q,1$A43%!X3$1 1&AD8$AT4&A(2%143$1,7$1,R'Z&/:&9@7DH!40%2 -/T -M*24=)$HF(2 <'QQR>X^USM+-N:1#%!88&A<8%Q<;'2$T-B Q'R(?*%557'>- -M@F]Y;XF!5S\R*UIZ;9.VV[FK+#98?6HMIFC#$Q0<&JE\%1<5%0,4I1,3%!,4 -M&TH6$1,3(2,D&$45$1@6'BLT.5!D&QT@0:JH:F6"9V4!5P%" -/T)R >)D8@ -M'B(8&AIS@IBZT-/.NJ9$$A(5&!46%149&R,V."(V(AP3$3P:6F+#5:@&LLI&/ $1,:(:]\$102$@,1I1 0$1 1&$<3#A 0 -M'B A%4(2#A .%B,N,TA:#A$8/:BJ;V6"9V4!5P$^ -/_+!XA+DPC)BH=&!QV -M@YB\V-[9Q:I'%A<7&A<8%Q<;'1\Q,QTX)!\6%# ?("\[+1XL+GR>;$4N*E^! -M75EOGX.A,S15?FPIH%["$Q >([B+%Q84% ,3I1(2$Q(3&DD5$!(2("(C%T04 -M$!02&BVR+<&P!7 %# -/Z+3LZ(%4ADZH]%1H:=XNUS\_+ -MMJ<@&!04&1<8%Q<;'R$T.Q\Z)AX<+"-2E[R@@V5Q9'EV6D5&,HAV)G'"V%@,3I1(2$Q,.'%5-%1,0$1L8$@D3&4I&11@P -M.H-1;&M[;Z"50E7+44,!%0$: -/Y)B\T(E$;D:PY$!@;?I.ZT=#,MZDA%A 1 -M%Q46%149'2,W/2$X(1T6&B)8C[&8>%=E1WN$94=%-H]W&5JPQ;>Y-3YIR8H8 -MCF.D$S,BAE\=%Q0;$P,0I0\/$! +&4]'$A -#A@5#P80%4(].@\I-7Y'75IN -M:)Z71U/*4T,!%0$6 -/_)RHU*%<>EK0^#AH>@)6\U]O7PJTD&A43&1<8%Q<; -M'Q\O.!PT'QH1%Q=#>99\7D-(,GF6<$M",8YZ'$&!F8RJ.#EDS8\)>KT-#+J*D6%Q41%0\2$A04.",X.1TT(A\:&QY9 -MF*.9;6)O0GUU94DE)91L+BNER\S 1R=DR)09NTRW&V,4'2$4#Q8@&Q /$!01 -M#P\+&3L2#Q,0%B(5%A44%1LTFS'7@8)"L7$A<;&!,6%!$2$1$0'CPE&B03&BT> -M%Q5+)A84$"(<("@6;2J5?3P=/C##,TD!'P$; -?T-!&!XY.QPV(B8I)AL[B:R6AFUT07Y_;4(J)9 C7XV3 -MD7VP52H8RIL0#+$-4@!&P$8 )O_.1!>&5=)'F5=T@I(Y\9-EME75"J7RP4 -MT* >L$*R&G,5'B44$Q8:%Q(5$Q #$:$/&Q\4'242&2P=%Q5-*1H6$B$1&"P? -M9!N,@44A/##/,$@9>+)B&%K>WJ!8&XL+X-@,L#-M\"\8R0PQYHLJ3&K -M%VHQ12D9%!07$Q0;& 02H1$?01\+)1L:)2$=(F@C'R,=,#I%'2=J#I\K'!8_ -M1;5*, $8 1D ^_,@(1Q!:0TF*B$3%U9@FJ.%G9!Y>!04$@\4$A42%"$:&S8\ -M'#LB,"PG&QY;9XJ.:G!+?(-K<"LRCF(GJ+&6HK-B(C+)FBJF+*T88R0Y(A,1 -M$100$1@5#P\0$ X9(PT+(Q47(AX;(&8A#Q@8)28](B]K#:(P'!A#2KE,+P$4 -M 18 ^_\H)"$_=! E-2<4&UMGH*6 G))V>!<8%Q$6%!<5%B,;'" -M%2)45'1[8%DN=YEU=BHPCVH,<8-B>;-N)"[/GRRF*K$;8B<\(101$Q82$QH7 -M$1$2$A <' H0*!@9)" =(FHF$Q@5&AXY)S5L#*0U(18^3,5'+@$9 1@ ^^XB -M%1H:D2LJ)R<8(GE0DXUND'=N;1 8&!<9&1H:%R 5&3 W&$ <$5Y<)ALSG8MU -M77!Z?H)-?B$O@HUBJ<#HD[UW(3_'H3$R+U892!4B(AP4&!42%R 7$A(3$A,8 -M0S 2%2XJ,R\Q)AP_/F,U8,&5P^$YTD%1=,3Z(=&0$F 2X V/DG%AX=FB@H,2H5(GY; -MHY1ND7IN)QGBA\OAZE0 -M9'F;6[R"'SO/J#$O*EP=0PD=(!D0%101%A\6$1$#$J 5'1$1%RDG,"XQ)AY" -M(DH4(TH+(6%#&*(J&A5)4*P9& $H 3 ^_DG%QYTF!4OLYD9'A)!EGYF@VIE -M91<=&Q@;'AP8&AH8&2\[&3P='S!L)!XTIZ1Y3V]\BW)6C2,=AI*WO-CB2(.3 -M(5#"J3H\3T,>@!H<'Q87&1D=0"(<(A$6$Q(9/58V(6='+R%^3A@F)#% @Z V -M%B8=%J4N(Q1=&"P7%@$K 1@ ^_HC$1UWEQ,MM9<3&Q))G8-OC71O;147&!89 -M'!H6&!@6&"\[&3 F%BDV%!\MI)UT4FI5>8!@DB(;BIVJHL3-.X.8'DK IC@[ -M3D,=?AD9'!,4%A8:/1\9'PX.#P\0(BH<&$P^)QJ!3Q8B$B,U;8$D%BT?%J9=IBI*HB='DO%KCHX2SX:@A@9 -M'!,4%A8:/1\9'PX4%!$2&"(6&%1 *QN#4AHG#1PR9W8?'3@C':TK'Q1B&S,; -M%0$I 1@ ^_<_)!$1,='(U!D'A>95]@8!@<%Q8:'185$AD7&2T]&3P> -M&1EA)Q\=2J1\5FAW?6UNGB(?A96O:>3<)W][)&"]NS$_/50RH@*A(. -M#PP1(24G-51^$!(-314;0E1%J"$?C:B1);.U$XJ#'EF_O2PT-$PDE!D6&A 8%1X>0RH@*A(4% X3%1H< -M,F* #1404!D@0U9CIFX6&3$?&ZD4$P]BFST=&P$M 1H F?=(*B PMADGJ;<< -M$AD;CWDX.R\W6A@7%1,#%=\3%!D9&"@Z%S@A(BUE1C(^,J2I=6-YD'Z!JAP> -MB(QFB.6C7H&4+SJPP6EG>XF1HQ46'1,:$1D@(2(<'!(5$A$;-E!*-WR%&B<; -M428O)1LJ=S59%!(4$HT8&!=8FS,?'0%# 8, F?A$)!\TMAXF/H!,3&A 7#A8='A\9&0\-#@X2'B,E&4]Y&!H94B0K(Q@E -M<#96#A 2$H\2$!5>GC(<&P%* 80 F?],)1XOOQDDL[H;$1X?H8 T.2TU71@4 -M%!,#%=\3%!D9%B$Q$BTC(Q\?-C<_,YF9;D\S=(B&K!L>C9U(1Z]T1(29)S"P -MPV1<=(21J!@5&A 7#A8='A\9&0\3$Q 4%1D;%&5^$!H=52@P)R(R>4%@$106 -M&945%!==GC$<'0%+ 8< GO(^(QIWM1H6'Q@9(H8DC7PT*QLO41@7%144$Q05 -M% ,9VBAI1K@X!80BF>QX[%NU[#0LM< -MDADH'!8:$R$F*QP>&!,4$A,A,$M!.WE]-BMY0Q8L2$0_AE2=&Q@3%X\.&!9@ -M9C%1\V'RHP+39P3U%0.T]HLATK1<95545&QTBB8(L)B,N31H7% ,7 Q3=%AD7(S(2,B 3+&4S&"4K'3R$ -M9(6+EGVR)!R!E9.KLF5*@J38F*N\N->TPFZ!+1T?%1D/7%4F(24>%!03$A<^ -M44(\.G)>:HY+%C C,CA_2Z 9&1@6G1<6&'B1-B07 4,!O "8]D\Z)2"N%156 -M61<<'"F4B"PF)C)6&1$1 Q3@$1(2%!<5(C,2-1$8(3 A'RHZ(D>(0E= 3F>N -M'QF0G(ZDHUA&AJ75F*J_N=.VPFZ"+AH<$A8.6U0E'B(;$1 /#Q0F(QT@'F9> -M;9--$B@=*S%Y2Z 7%A(4GQ,3&8&6."(8 4T!O0"8_U4U*"2Q&1IA8QL=*BB5 -MAR4?'BI*&!83 Q;@$Q04%AD7'R<++0\;%QD>(2P\)TJ"(RP<+4G &B.0GHR9 -MET -M,CI^5*D<&!,9I1@5&H&9/"89 5,!P "8\'8A$8*F'!QH9!4=*ADS/BTG&RI' -M'1H6 QG@%185%AD5(BX7,"43*6A(0R$C,RLZ8H61DW>I&AQ^E&ZXU28\HZ32 -M@I_ LM6ZQ'F%'1P:%!@6$$$@*"8A%103$!(]44 T.7II9X),(T!+$3B-6ID< -M%Q@9HC,;)79U,"$4 4$!Q "8]'8:#H2G&AAI9A4;)R ]0BTF'2Y0'!03 Q;@ -M$A03%!<3(2\7,Q88'C$S1B0K,#,]0%=&2U^E&A>0H'"URQX[J*3/@I[%M-*^ -MQGF&'AD7$145#T ?)2,>$A /#0\E(1X;(&YI:H=.'SA%"C&'6ID:%!(7I"\8 -M)G]Z-B8: 4P!P0"8_WT9$(BJ'AUT;AH=+Q*D2W$R*-HWC!TAPXM:G9?9O*NMS(SGZ)'Q<5 -M$1<4#C\>)R4@%!84#P\<&Q,6+VED:(E2)#Q&$3J,8Z(?%A,[M85M+!\;%QD/$Q,D -M'QT:%1,3$18K13$M8G5I57Y+&5:$?WZW?)T9'2$9I84\+7V5/1,5 2'>Q?)T7&AL7IX$Y+H::11@8 2T!N #N_Z$:'C>V -M%A\>%1<4=QR*>34Y.3M"$AD5%187%!87%AD8'2(@+!,<"QH90$ K'S8W'RD: -M*SFQ%B:*I6CJZ#EYU:78C7S(O>#*OXIQ+AH6%!@/$Q,D'AP9%!44$!,8'Q$: -M6&1D5H51&E)_?X"VA:8$'(FMACLOAIU)&AH!- &^ /OZL"(B'XD-%*2G%1@8 -M(I-C045%2$85'!09&A@5&18<%1@A,2DL+!DA=#@E*C0Y*S!3A(Z5=)@?%W26 -M5]C=*+NCH=&+:LVUU[ZRBEPQ'QT7&1,3%"8A'1<4$Q,4%1LN("(M-3E334X8 -M5#$C+&]$I146%!.G>C@MC99#&R,!(P&X /OZL2(@'XH+$*BK%QD5))9B0D9) -M34\4%A$6%Q42%Q0:$Q8A,BDL'1L5.Q\F+3LX,S8Q5D1-49@B%'N:5-?<*L&I -MH&A01#P\1$AH=$1$:+3M64E 43BL=)6E$ -MI1,3#0^G>#8PEIQ*'B$!(P&U /O_O"&A01%!03$A<:#1@E)S94550942XB+FY-KA@5#A2L -M?#@PEJ%,'B,!* &W /OMH20=@+$0&18D%QIF')X^/T)$2$P6&1H:'Q84%Q4= -M&Q@@,"0N)R I=4$@1BY,*!U,='V4;ZL@&W&=.]O='97'MM":7LBPT+BOI$T= -M)!L8&A,6%"LN(!L8)C= 32D;,692.TU;;&@=3B(2+FY3I!<8&AXK&1H9G9Q! -M/4,!1 %S /OQGAX:@+$.%A8D%1=B')T]/T)&3%,5$Q87'!,1%!(:&!4>+R(J -M'1X=.B8E43M9-" O2C9+/Z\8(72C/]O<()?'N<^97,BRTKJSFTT@'185& T0 -M$2DK&Q83)38_3"88,6A4/E)@KR(I_6N=N85L^ZVL*[I5(B'A07'! 3$RLK&101 -M)#4^2R@6+&90/%=L?W(>4"$0+&Q -M(' 7$J.K%1@<)JV\@55-2TD7%A,;%184%Q4<'1LA+BPK+",Q>SXA,#U+1B%) -M=7V0:9@A&U"1,M_:*\_0=LZ?2\^HT+>9J"\7/2,8-S$8;$$F-*(C7DE /EA+ -M5XBAL+.NISTA5WI[@;&?IA<8(" S+BTB)1H4,#,!/ $O /OPI1L;(' 5#Z.K -M$Q4:*:Z\?%%+2T\5$! 8$A,1%!(9&A@?+2HI)24F0B0C-D563R,L2S9'.9P9 -M(5.7-M_9+M'0>GR\:.",:.B\6;40G-J0E84Q#05M.7(VEM+BU -MM$,:3W)Q=Z>?IA45&14B%Q<0%0P,,3X!2 $V /O_L1X;)749$:JR%Q,>(;'! -M=TE#0DH7$Q(:%!43%!(9&A@;("(C&B,E)A\G-4=632$5( DF'+$5)E.<0.[O -M,-G?>]N?1=.MU;RCJ30<-1X6.#,:<$8H-*(C7TI!/UE.89FWR-'1S50C57AX -M?JZHKQH7%Q0C&AH3&100-#\!2P$X /OOKA@:<#@4&1\4&1I(.+G;TM3(P)0= -M&!89%!H6$Q4>'!@?+BTL+R5-' B03) /D1(KZFHH):LHC,=2!4=(T UFA@8 -M%QP9)3,R+R@T,"T!*P%3 /OSJQ(7<#@2%A\4%Q=)/+O;T=#(PYH;$A,6$1<3 -M$!(;&14=+2LK*BLN02L?)CU17ADD1#-).Z8D($N<,-;:--#/EL^A3,FFSKJ\ -MLRTP1IN6.Z4OK#Z:.G8H23I(1DQ0M[*QJ:&XK#<90A,;(3XWFA85$1,,$AD8 -M&!(:(S(!,@%5 /O_MQ47=3T6&"8;&Q5*-,/JX.+9TY\?%1,8$QD5$! 9%Q49 -M(",H'24L)"4C)#]171@.&08H'KL@)4NA.N7P-MC>FMZE2M"LU,#$O3(R2)N8 -M/:DSKT"<.74G139$0D94RLK)P[S5OT,>1QXR"JZD58?C:9 -M**(D5SL^/%.2II^IJ:2G*SP@*4-%34U&1A<8%!@>'BHK+S0\+!L!(P&' /OV -MM!X4&1\=$RDX&AI&.+GAD&@+ZDK8$1' -M15^>KZJRLK"S+SH=*DE+4U-(1A45$@X0%1,1%1L:&!P!) &# /O_P1\2'20A -M%31#'QI$,,/QY^'=V9XC%A]>P2MNZRL7&R2S >K$]BDYEC$2A+JHL7D!#05BER<7* -MRL?*.SX?+4A*4E),2QD5%Q86%Q85%QHA'AT!)0&( /ORMB8A/B,6&WZ-&B$_ -M-;76Z<[7TQC6$RWN9:FR,&]%!Q=)#\O/CH] -M8&!+$ \4%Q$3%!(U,D8!10'( /O_S2 60R46&HR:(2 Z-;_P[>/:X;(_+RXM -M+2XO+2XT,BXO)B =(1LP)2@?*2E*.C87'Q >*I]#)RN?,^OO*\_DO,FW3MNT -MR=;0S2C)T\$YH2NT0XZ@7:Q"7TE@54G#U*R_X=K3&Q]?)CLL.SZ3]&TL\/(QB7$S%,XO2=] -M/+Q8GH]M1%5-2&&XT\?*U\,6$!0B+1,Q/Q8A4W"%'10?&AD0%B4P)2)[(K'B2<,>[Q.62U^L+Y8XLSBC2S)-24*^ -MS\BZDS\6&!@5+!(;)188*$N9/\R_V#P_0VX\*2H!+P'( /OOM#PH%A<3$YVG -M%!8J-[#-T89E7$\V.C8S-C(N,2TM+AXC)2@Q0!<=.RT9'ALW2$<9+3= *50E -M(!HB)MS<0V;)LJV^3LJSI<6EO"VOT"B<5&JV.Z(_NC^I5#Y954W'U<^_ES\0 -M$A03+1,9(Q09*$F5"Z*SHQ$>)F,[)B,!+ '* /O^QCXD&!@5%:*O&18E-;7< -MX(]J74DK+BXJ*B8B)B(B(Q8;'2 O) PA("0:(Q\Y2DP5'!TI'UHH'QXD*.;O -M0VO8O[?$4=.]J,JQQ"VWWC.A5&K -IU!NT&N5#M64D[7].K6J4@3%1D7,!8= -M)Q@<+4Z;#Z>VKA0@*6(Z)B0!+ '2 /OM:!<;5D0:&Q0,%A<8*Z;+JS8T.3,] -M.SLQ\!W&[XUHZ,HI3.)-#AD6H._OXX8( \,'!\='2TT,S,H%1A/ -M.[90/T1Q9I'8WJDG*1(1*S(Q+RXR,3$J%1A.%:%FIQPC6S,Y("L! -M90'( .3T1BDE&QH>("$?'!HA&14KRE)!/STY-#$I)2,C)B$?(R8J+2TI92D8 -M3D4@(R8F)RTS-CE!.4YZJ[Z42MW6=-7(N7:Y(\!1.[]?N"FLRU(2$N-Q$:(BL@'A\B(R@P,C0\ -M/EB&M,&F1^3R>=K9T(+$)L)0-+]?O"N[WF$VR6<_PSFN;#IT:8!W="X@$Q$3 -M&!@7-SLT-AT15$S,M04HR/CUJG+W)T<_2ULR_(S"0 -M5=O1= -M1A,3&!,7%A0=/C9SC%U%E3Q)FBP!, &( .'F+BLK+38K.#U"2%M<9VY\S\8Y -M*2LR+2LH("D5)1$A(2,G*BT];R,F*3,A.#]LGK[*U]?3V-;))"N74]O4=H3C2[+KYW>7EV.CD5)!P@ R:7-1H@1Q 0%1 4 -M$Q$:0B=>D6-%E#Q+D1P!*0&/ /OP0CG9)RB@6.3L>M'8V2._3H.: -MF\MVP2JZX+#!:#RJ4S; ,L%Z>W]\/#0/(!LB*",7(QG_#*OV^W(+'.=TXVNGLP -MKDQV>7)Z=&8=3$L;&RD\4SBL]WRGZ.R&^_([O>?T\ZP7TQLTUX@7=^ -M>VP?4%,A("X\4#0?&Q(<&QD:%A@8%AA016"Y+IZ?(RB))P$G 30 ^^-M9V5: -M6U=85UQ64TL88<7-)QHD(ATL&BT?+AHO&24D*#$Z-4NM6H_?VLO:V-;8V]C7 -MA9=\TT=5+X]OW-)./\G,A+)VI*"ZUFAV-7&)::!@B%#8M -M3V=?12XI,AX;E9N>J:JRM;^]6F"O,)HP-'>4,@$E 34 ^_"=FIR4E)"/DX^, -MD'TO8\71)Q4?(!HI&"L=*Q:.Q,#6\GR2596YF=!T?%STS4V5B2RXI -M+1<9DIB;IJJRM;_.8%FS+9(L,G6)(@$> 3, ^__,RLO#QL+!P,#!OJE&8Q2 -M0MCFFLLJOXYWQEZ (K'@A*BU,C:]I".9<75K>2 =&3XP36=B1BDB*A@;FJ"C -MKK.[O,3$6UBK*Y8Q-G>)) $= 2T A^YA<4-=5EL#5_%210U35\#/,SA%*RLU -M+"X>,ADP&3DB("TR-C;.U]31U=;9V=/&WY5 CH&*S5HU]ULX?F<''5,$F -M/74U4S<,!Z#"N$<[3*4])J1J@'Y/*D!F7TTJ0RDR*A\@'"0RB8^1B8:"?7UW -M*&J[-I$7$(.!.@$R 58 ^_2;GH63D)61D8R1;!M38,?.,3) *2@S*BP<,!8K -M$S,?'BLN,#3)S]?9VMG:W-?)XYDS5#-3PE 8>)>"T\D=E\#'6"E91A+SAA8E,R3"XR(QD;%Q\MEZ&CFY61C(R$*F&V,HX6$(5Z*@$I -M 4P ^^M2951=8F%>5FD@%2 H3+S6-2 B*2 K.B\=+QHV0S G+S$YR-+4VMK4 -MU]C7T:\<,6\ID8B(S%]G)Y"&ULU!P#F7"HO"@RO8^.B%Q103\^ -M,3=#/B(S+RXA)R6E923F:I=(6$IX1Z) $X 6X ^__%P,_"RCM]OCR\_?V[,8E+V80(20C -MO5]H'Z*0W=DZQ=[).AP>)R0<&2 8%W&+GG2KSBXOQY^;D5U..34Y*2\^/",N -M)RD=(1\K8G)M:&!85%!13V:O>(B&J8I_)0$X 6P ^^YDH)V=F9N$BV-:1$1'0DD\,"H"SK8*$)P$E 6P ^^EN;69I:%MI-T$4'8!\0,3<."4=,AHG(S%#+Q4N'VS2 -MW-S8W-C5UMG45B(?*AX:*QHH@I"(R(T@'W]_PL6UP+^_2RXG(QLD-AT;%RR\ -MM3)WB!T2'$Y586-?7EE&&QT]'!X[+3$T,34IS];5W=[AV]W;NFJPE8&[J&N# -M-0$P 2D ^_*HF::;FI"2'R(4&XF!2\G;-Q\7,!4E(S5),A@G%V7.WM_ -MW]C76B@G*"0A,"(=3$9-PI09&HF$PL2UPL3$3"PG(AHD-A@9&3+!N3N$C2 4 -M'$!%2T=#1D(\&!8W%ADW*2HQ,#(ET]O:XN+EX.+BN6*KC7NUI6=W) $I 2< -M^__?Q-W'SL._0#$-'9F-3M;Q-" :+!,A'#!$,AHH&V[=]/GX__CX]_'Q;C$M -M+"TJ-2@<'2@FO98D&(^'R]V\R-'962@B'Q+>W=S@U7BTFG*QJ7]D- $X 8T ^_6EIJ2AE90-&"HI -M/$HT-<39.R@D,AHS/C(F*1AFM];7W=[>W]O/S]#4$0S%T'GU7&OE&RKHWU<)@$Q 8P ^__9S=K*Q;T?(# J/$\Y/=3M -M-B,D+18Q/RTB)QULQ.[Q]O/Q^.[YXE(=+!QK("DG,R<8/3,MQ)X=&8*'R=:\ -M:M',;28B-B9*.T<[(!_6QAH>,2H6+C$Y/3 F$3HN'2LL82PW("PD*R8MY^_R -M]?CV]OC_YG*MF7&PJ():'P$P 8L ^^MQVMC7 -MD8VPGV6KI7 =-@$W 9\ ^_"KHZ.GA1L3"1,S-"D7*[W;/B$?-TLT&24@?\/8 -MW=_=WM[BXL_%1$%%02"3,5T>,S L5EE-OK X%(1^O,:N>;V]0!4:)Q<8'!0? -M+S4Q.3D;+R$J/CXJ*$^5J7XZK3]"S30])#,M/1X6T-W;W-O=V=K9CH:KFV&G -MH6X2)@$N 9T ^_WASMW:K2@8$!@V.3$;,,OM.1P@,4'8/"T[)Q>?(%L7&R,2)RPQOJY &8& QM6Z@<;)1 \8(Q,4&!$>,3DV.#<< -M)B(=+3$E'D66KG'98]43H;(B0[4$.B -ML69^WJ=-MT,\QD%$(3L@*"TDS]/5X=S6U\C92XR@I4BBH'0(AQ6TVJBB8?'3$V*R8<&Y0W2S03)!XN0#NBHE=[X)D_ -MN#T^R#D_(34:(RHAT]C9Y.3=W,S70X6;HT:@GG,G* $L :4 ^_S=RL:N.1XK -M*!P?(!H=*<[S/SEA-APG+YBFT^_E\.WL\N*RN$;6-#0[.!^Q)4,Z'!8@%R^8%*PB"$<&2TR)R4>'YDX1B\7("$A,#FIH$U[YI(VPS@YS#(2$9&A\@=T/3>RHDABM27GQ.1VQ&3'MTQU\Y%6U- -M6[RN2H2'438U*RXF%QL?'80V.3$7#Q\P,[O:CE9^WDU+MTP[T#HZ,30S(KA[ -MR74O/]1XC&[41VU(FQ>8I6\Q.@$X :H ^_*CEUP;#A$1+@T4$PT/*+O6HF49 -M(!0.%PT=&!P?)",<&1TB>471:R893A]B-'-5,&(P'SPZM6,X$G907\*O2(6# -M3#$P*2LC%AT=&X0S-"\3$ALF++?;?4QXVCT]NT8_TC,U+RTJ';1XSGTU1.&' -MFG?00&9#F166HVLB* $O :8 ^__9P'T=$109-! 6&!02*\7PJVLC)1D3'!(B -M'R,J-#@N)R(==4/66AH6)AIR'7-6(EPI"R(HN%TW%'129]&Z2HB(2BPM)2DA -M$QL?'XLS,2L8%" <(+WH?#QQWSUWH93+=^.J6C2/S9#F"*5EVHE(0$T :T ^^ .(B = -M'1@8%R$P.$!'5[33>3H9#Q$66FE;1EE4%!T1A:.SK*ND?!\CBR-(,2L5*SHL -M*3UYOX8K%F0?+G^:%R)\A1P:%A<4'UE7-7Y/?X4X(&9IKKEN0T2%VE)*LCY! -MR3M*0#LS,;.PQF [3==N?EO(041#D!Y<,FXQ,@$V ; ANT?'!H>&0,4\AXM -M-3M 4;G;?#87#P\46&570E50$!D-AZ6XL*2Q8B 96QM3&!P2'3,7%1M!J8(A -M$V4B-(6<%2> A1H7%!05)EU3,H!1@H@\&V-IK+IW/D.(V#T[MCA#RS1#-S H -M+;.KTVY)6-QZCV/$.CP]CAQ:,&LF(P$S :H ^_\L'QTA'AD9%B O-SD_5L;N -MBD4I%A,87&M=2%M5%1X2C:V]N*7"4B,31AE>$QH2%BH5#A CHXHI%68B,XZB -M%RJ(C!\9%A08,658-(A5@(8W&&-NL+UW.SA\W#DQOC,^SS)"-RTE([RVX(A2 -M8O&/G&G4.#@^D"!>-&TF(0$S :\ ^^@8&Q<4%!(7.D!+1DE-2+G/=AP9%18M -M2EE*$B$P/QD3J*F$:&:89!H<4!U)*R@:(#(E'C%KJ)M"&D :&D"9&"H]+A$9 -M&BIF2:6^)%V3W'%1/5514%9"21U^VU5#LT\[R3)%23DT);6VSE0[0\]@<5C& -M2D9*?B$=(&HC)@%/ ;$ ^]<:$@X2$ X3-SU(0T)%0K_7=1@7$Q0K2%5&#ATL -M.Q4/K[&);&.F1AD7)AA8&!T8&"P6%APZEYL^%CP8'4B>%BM +P\5&RQI4JJZ -M(%^7WG-/.%I635)-2AQ^V4 TMTD]RRL^0"XL)+:RU%U&4=1L@F#"0SY$?!\; -M'F<8%P%, :T ^_@8%A@4%1,8.3]*14!#1]#MA" <%Q@O3%M,%",Q0!H4NL6@ -M@&NX,Q@2(Q5<&AT:%B,6%!@BE*1#'$$:&TJA&BQ ,A,:'BAI8K?")6>?XG%+ -M-E]B3UA-2QEUW3PJOT0XSRD]0"LF&<'"XW506^M_BV;403I%?B,?(FD8%0%, -M ;( ^_<5%1@5%!<8#31'4U)D3:_.?AL9%188% \,'AD3'Q,=,Z:IKKN.>58? -M2B%')B8:'3(B%"=!4;,F'149%A].(2$E0B%3:8@=;K#+(5*[W80Q(6%L01A. -M,#MSU5%)MDL\PRU#3C8^([6VR#TV/M%475/'344Y<",<'G:,/@$X :\ ^]@1 -M$0\2$!,2"3!$34=91[72?QD8$Q06$@L(&A4/&P\9/K2RMK^;6U ?)AY6&!T7 -M%"P6#1H:1KDH&1$6%293'R,I1"-1;(D?>+3''52]VGXJ&V5S/!)6,3AQUC\[ -MND4^PRM 1RLV(KFTSD,^2-1A/[W O,>J2%,:*QQ8'A\9%"43#!H, -M1L F'A86$B56(R$D/Q]3;HH=B\C6(UK#XH$H('%^.A=8-#IMV3HQPD YR"<^ -M1B@R%\/&UU)"4.QP=F'513DV;R4>('6 + $Q ; @NDB Q?V%A(6&"Q)/U16 -M/JM>/V19%D2B&"-'@FUE97X<))5X65J(92<<-"A;&BHA*38\(2 N*8,='B@Q -M'APK,D L*G>7AMH=3\/:+3RUVX<^)&A@4&(\72&,VT]4K4Q!H3="3D0U++BY -MR#TS0--(4T7&3(EW6E09'FY]0@$V 6T ^]L8$!(5%! 4&BY%-TA)-:Q=0VI; -M$D">%!]#?FEA87H8*I^!8V"-4QD9(2%A$A\6'BHP%!,9(808&"4N&QTL,T$M -M+7V>B-4<7,C5*3RWV(0Z&V1E5F=!7R*)W4!&LD9 GCI&2#DJ*KFUS40[1]-2 -M9$K 1X1Q4E :&&IM*0$N 6P ^^TB#Q :&149(#)*.TM).;EK2V]?%T6C&25) -MA&]G9X >+ZF/:W&20"$9(R!F%A\6'B,2(@-#@V,"PR'QPH*& H'RX^.CD;/$ D'T!?P^ J*\#@(R^T -MV)I9'REE1UPE8%:0V5)4L$Q$S$%&4#\R+K>SQCTV1M-$347*6;YJIB5FHG"# -M1@$X 5\ ^]@C(#$S/4I003Y$.BDS-BO(GW!D&!L-:Q<[%5,0'V,7'F.)FGN< -M4!,;'ADC*RTK)2$G%! 7'5TB(C-#/SP>/T,B(41DR-LG-<;;'R^UU9=5&"AL -M3V,K9%F.VT-&M49#R4%&230J++BOQC\Y2-!'4T;"5+EDGB%GG&QS+0$P 6 -M^^(H'C,W04]51D%&/"HR.#+5J'9I'2 2/T,D'S]GS>HG/=?S)S2XX9=+%B=M2V(J7U&* -MX3\\ND% RSA!2C$H),.^ST,[3MA'4$G34;9II"9JH7%W+ $N 6$ ^]DV-#E' -M+" A*S(Y.38V02M<2&1Y&Q<<'!E:'!@<)20@#I D&!I!3B06)SEDP-TR-TU-1@4E* -MS#Y*1#<_,K6SSD!#5\=.65K%4KQKGB6BGFF!0P$\ 8@ ^]HX-3<_(1H?*S W -M.C,M.2A=3VY_&1,8&!56&!08(2 <#I$D&1E'0Q,5%"PS)!TA'!80$0\3&BTZ -M/3L[/2\<&!H:%QN'R-(U41#AD-)R3A%/2PW -M,+:OT4-'6LI175V_3;=EEB&CF&5Q*@$T 80 ^^<^-CD]'ALC,C4[.S,M-RIJ -M6G:&'A@='1M<'AH>)R8B%9XS)"=..!H4%RDQ)!TA'!00$Q,6%R@\/ST]/S$> -M&AP<%QB+T.DI-=3O+C&VZ9A8G!-.>U(2%*22X@'A\>'B8K/2$\ -MM-DH,+'@)BJLRJ%OKJ$L(RYMPFF1TU)2J4P_OSQ%1S,X+W>RQL7'P<*VP+7+ -M6ZU8CB2>FF1^00$] 7D ^] 61QY,+QT<&B8K,2]!.#C)O6YM%5M,$AP?2%1Z -M*A Q%Q@='1 I10H1$"0A'!<<&B(;%!,2%!E)2RT?'1H7%A\E.B$[N=4@,K;= -M(BJLRYUKHIDF'29FMEV+U49$KD4^O#8]/BLP+7FORLO-RW>+0V-'?4Z57BB6BFV5P)P$S -M 6X H>0K2#(X+" <%QHE,SPW-RQ;8SY&'Q<5$A8A%Q09$Q49$P,AC!(2'2(7 -M'QTC(QT<'P,FR" 9&ALN,QXH*RHP,#$K,B1-2,4M*IW@)2FSRJURBF2%7VQ1 -MI7:"SW1&ED9#O#1"4CDS,WS!BY:(EY^AEZ;#7[A;>2:6C5IZ10$] 6( H=0= -M.B F&Q46%1@C,3PQ,"A=:4E+'1,1#A(=$Q 4#Q$5$0,?UQ 7$1,.$Q$7&A85 -M&!T;&Q40$14M,!LE*"@N+2\J+R)(2K\F*:+=(2>PT:)GAEQW4EQ*DFB TV<[ -MGC]!NB\[22XH+WR\DZ.6J+&RI;+'7+!5<2*9BUAK+ $T 5T H>$YZVV@PH$ [OBPY -M2RLE(X''I[VPP;CUUK*0$T 6@ ^^,A(R,K&A&QT@)"Y"9BJ::B20BF*$20$Y :@ ^]D8'!PC$A,=(!H8%A<@/""9KH8I -M& ZI%6HB53&.7'P.$"$B&@X2'C41#Q$4&!L<%QX=&! 0$1(3(R \/!HY2XED -M?4!AH]HE+L':'B2@P*E,=82&>)"0C3R$T$U$7CLW99((3%28G'PX6$B@2$A07&QX?&B ?&A(1$A,4(1XZ.A0W4)1K@D)CI>DK -M+LWR)BFPP+HS9F]N67)O8BB"V$XY7#HSSP\3-P\G@=*E? -M9B65C&5U+0$P :\ J><:)A\C)2HP%QL5$Q =0R(Z)A8@&AM+&!4:*!H8$!H6 -M$QHD'!P8*C$B R;/(R0E,#$S&A86%1L;*4,O+S%92!,;.C!&G-@H);;6*2^I -M>KMBC\IIA(?&;$]ZTE5#*E5 ,S%"44 W)Y'"IY>5E9N8EJ#!;[9.6R6+AF-U -M1P$[ :, J=P1'QL='R0J$QD3$1 7/!XR(!4;$Q='%!$6)!83#!82$1@B&AD: -M&AT7 QO/&AL<)RLM%! 3$A02)$ L+"Y610\3,RQ&HM@F*KW3)2VD@K%4B+U7 -MD;)B B)"%!P7%ATG'QL>$A87 QO/ -M'!T>*2XP%Q,3$A44(CXJ*BY40Q<7-#%+J>LJ+T8"YN -MWDDM+$T[+R'A@<'B,: QV#*S$? Q?)%A07'"4: -M%EXP3"H@0AL7'!9?O=HF(:;+*"RW=[52D<0]08',:$9";$LY&R0Z&BL\2#8U -M):*WFY23BXB%:'S28ZM%11M_95]=)P$] 9 G>4T+1XJ(R$N'QX8&B8E02<8 -M%Q84$!H9&1(:$QL; Q';%APC(QTC'"@>'1T<+#(@&!H:&1<7'28=%UXP3"X= -M.AD5'!-CQ.HJ)[+C,###;KL_D,(W.7K4:#P\=$PN$2(X%28Y23(T(*O&K*JH -MGY>7>XKG8ZM*2""":61=(P$\ 94 ^^'AT@)"8C("4\6BL1&UUW0!HE1B=> -MLM$O)H*Y+S&YAUQ[_&SM77U-G> -M7'$@.R!'&V$P. $Z 8( ^]$F-C,C%!0\)"PT4EDW,B4=(!T@)!PA(R0>(R$A -M'!\?%1TB'QH<'R$7'BD@&Q$2$A07&QT:%QPS5"@.&&!Z/Q<@0"9;LM4G(XNW -M*B_"=<%(CL4^.W[6;T([4E$\'1DV/C\_3C0K)&BPR,/*TMG:U]SB7FXA.1U$ -M&%H?)P$X 8 ^^0I,#8C$Q,[*RX_6EDT+28B)2(E+"0I*RDC*"8F(20D&B(G -M)"(C(1@0'BP@'A87%Q89'1\:%QPS5RH0&F!X/!4>0QE9Q?(W(XG+-3'.;\P[ -MD,HT+WG;;3(M5%(R&14R.CH]3# E(6N[T\W4W.7HY>KV7&PD.Q]&&EL>) $T -M 8( ^^\U7S\H.3 C6FZQP&Y83B<>&AP<(1HB)RH?(R8E(B@F+R0@'!\^/XR- -M*" >(1PA)B0I(RH[+TXE'Q00#!@[$!<0+C-C2,,N)#A:,S:U.\-4FLA95'-K -MCE,_/F(Z1#]%0T<\0SPW*26@S]W:W.'>W-W:;2DPD24B(5E . $\ 4\ ^],M -M43 =*B$44&NPN650224>&AP<(1HB)RH?(R8E(B@F+R0@'"$_-6=L%!05%1 5 -M&A<<%ATR*$<>'!$-"1(X%!H7-3A?0<@G'T)9+S2^*\1#E\A*17-P?T! 154L -M0CU#04$Y0#0M)">+?X>;CX>+8:R8UDB,@'U(O)P$Z 4T ^^$K2"X:)AT0 -M5VF^Q&5.1BHE(2,C*"$I+C$F*BTJ)RTK-"DE(1],/$-4#1<7&!,8'1H?&2 T -M*4@?'A,/"Q="'A@6-B%-/]&1,5'1H>&!,Q'A\<'!HE)Q$?)!M6LFDY -M)$>%?:XQ*+JZ/">^2LI%B<-,0S9*A2XR/TXE-"XS*RXQ+3$P)"@UNK2OJY^5 -ME8UX131.;ADE85&!0R'R >'APG*1,A)AQBPV,>"AYD6J,V -M+;;,1RG*1-4XB\A"-RI,@R0F04\;,"HO)RDO*RTJ(20UR,;!O:VAH9F32C93 -M;AHF8E@H) $T 4@ ^^,P*C8B$QTP1R_$TFE;3B4>*"(?)"(J'B8F(R(B)1<2 -M&AH8)AUS7$,Z*",F)2$R.BTA(1\@'1@Z&A@A+25$<'JGIX^(1ELG)ZFZ62^X -M=M%:4!:T8I&@$Q 44 ^^,J'R4C -M&AXG'A>>UDY+2#$@'"0?(RPO)RLD("0G%!@9'!L;(B-G+Y#09R4L."8A'Q\= -M("(F'2([F*%.:$2+KF'GDETRFKHQ+J2O>2.PC -MST,\.BH@'"0?(RPO)RLD("0C$ ,5VA<8(B%M/9/%6QHA,B,>'" >'!P?&1LS -MD:%/7S>#JEK=@4DJEL L**FN8VK6TO4S8LZ.!Z*>28H+@%2 84 L=XH("$B&Q\H&QFEVD,\0#$G -M(RLF+#4X,#(K)RLK%14;'!P@*R-R1Z'28AD>,R4@'B,#(<R8E*P%3 84 ^]TP,",?)2 S.AHPV41.1C,?("8?,2TQ -M'1HBT(2,B'QHE(28KHJ=\7$!IKVCT3X_3$(F'AX;+A@4%A4;)"0Q('5<(R F)B5??I,H -M'1L<'B =(1<;&4^,3B5)6,7AR2U1V-S8J58T=:Y%)&HFC2>F&F]-)TY@3AH2 -M+ADP)$ ]+1Q,%R(Q-S8O*RL_J9?*=W.M6TG:T\E$.QY:+BM11P$[ <\ JM0J -M(!(8'AP?'BA>T#4P/CLF'AX;*A00$A(;)"0Q'7)9'QPC)B9A@),E&P,:SAP9 -M'1,7&E**2AY!7,+1MQQ#SMW6G$(C;K1 'FLKCB.M'FA&'T!/0@T %PKJITH\=\-+(6PPFRFX*&E$&S=&/Q )(@XI&S$H)!E)%!LI -M+RXD(R8]OK/FDX[!:5[NY-=%.2-A*RE'- $T =( ^]A&)BA"15\O,RA#STA2 -M1D$?("DJ%QL?'!89'B$D@L-:)!\C*!]C:(5&'!\<(1\D)4>)D:@Q+X5 9+K> -MT;^SU]O4MU8D>:A6'QN(-2*4>3D\158C.)Z0<4HM/R0B%QXDJS,S/C4N)BHS -MK)?#=VZ?;'76S)^R*"XP*&8^20$[ =4 ^\0^(!\W.E0F*!] SS]#.3L<("DJ -M$Q49&!,9'B$HB,A>(AL@*")C9H5('1T<'1L@(DF.E[ Q*WXX9K;6U,.QT=O< -MM5 D>*U3'!R*.1Z9>3$T-44/'61..!L2*1$7$Q@AJ"XN.2XH(2'1L@ -M)2@PD==J)R$H,21>8HI0(!\C)2$F*D^1G+0V,'\T9+ODX6M;(+DX["[ -M)R\T(%\L,@$P =, ^^)-/"T]*B8G&!LOV4I,0U G(1\D&" ?)2 B)"(F8-)Q -M(" E(B5B8QFX'B8@#AAG&IJWLZ\S(1]%2L?BV%589BP>&1TS@'D>(#Q#TC T0#DR*2PWJKW6@W3/5R.%QS-R.S*OD$5H -M2@$T :D ^\E+,QXP'QL=$1,GU4 ]-DH>'",C%!P=(B B)"(J9M-O'1TE)"=? -M7A>\'B <#A1C'J"_N+(T'Q"!)24L*BM?61S()2,B -M%1EH**_!Q, U(QLW3'B-P16=30C*$'1L6&!X=%D$>'$M) -MT24S.CH[+3$>V7,-R@UO2I%,3&+?8EO/@%) << AL$U(!(7$P,7\@XD -MQ$Q 04LB'T$L38\M'Q\D)"$HBM1Y&QTD)RE@6"*1'1<>C)M0(+*#I<\P(1LY -M/[_3UD\XP=C?PST:*C$]%1H>'!UR/E=%0A96#!0.$!$6!BL5'$-'T1\M,S(U -M*"X<>ZW4A6VV*1XEOR@_*3&5A(IF+0%! ;T ^\8R'!,;$Q8<'!(JT%- 05 L -M*TPW6)&+(R4K+2U@4R>;)!HCF*97++Z!K]HR)1\V/LGBXU$\ -MS.?US#@;,C="&2$E("!Z/$<[.1MI%1,2%A07"C$9)3])UB N,2XP)3 AB\'I -MF''+%R8?QRU$+3B?A8UF*@%% <0 ^^ C&!HA)# [*C19ST5*8%0F&"$_K,H\ -M)AXB'B(EA-"0(R(A)"IB9R*94YR8L)0E)4B/U=@M(B9%0;++W%0U8)W8S$TB -M6$T5(2$<'Q],4&16,"V!5SQN5U\2?Y,#)DQ+T2$N1SLW+!T9;*+,=&72."\] -MGBH],C:%7U;*0$Z ;< ^]HE&"$A&R(M)2Y5UD([4U,P(2Q.O]Q&*",I)2DSB=Z@*"4WN(O)"(W/;S:XE4U8*/MSCP<8E4:(R$<'Q]82$9! -M)SVK=EJ8A80KEJ<4-T))U1PL/S L)!P@L5-*!TC(R$BA-"4(R(C(R=O:B.% -MI;2PMJ,K)C6JT-PP(B)%4F'*>WY]:ZC>U%HA(!\A'Q\A(1HW0U]G50P?)Q7U[9:/AS4X:(A\A'1P>'QLW.T];3@,4(0H4%PT:"Q@: -MBD)(T"Y.'"5!+D/6>*O3A'2[+B4QD"8P(S^+AH-$)0$C :P ^\PI%!LB)3P3 -M)2LY'ST[2E,K."HKE]A9*B J*B@PB=ZD*"WIU:*[SV$D9*"8F(1P@(1Y&04=63 TK,A4A)QDA&"8@ED1'T2Q, -M&2 \*4C>B<'IF'_7'"PFD2DV*4>;D9%)(@$C :X ^^8S6#,S/3D1)R]=T4 \ -M1&@E)Q\@-<=;'QT@)B(GB]"B)!\C)2YE:2&!LG9BVJ(E("VNQ-HT(B1 1;.^ -MXW9<8ZS4U5(A(20A'AX?(!PH3&ME73=OE#D?&A8Z458HHEY&TC X-#H\-+O= -M=JO+=V?3/R,_:"4N)T1L=H-++ $X 9P ^\XK22LV0#L3+3-ATCDP-V0B)!\B -M/,M;'QX@)B$HCM&B)!\C)3!G:1V,LGQGUJ$F(#.TR-PU(!PU1;._Y&I37:O: -MT$4:'R(?'!P='AHG1F!;32A=;B(0#0D9)S0AI55%TRTZ-S4Q,+K8?[#,AG' -M,QLU9B,FW(R B)"0]9!YE6:64V:PO(ANC -MG-@U-$](B,B(04>KQM018J)3T=(>D<-28Z -M+FA"-5*U79 Z(0%# :D ^\\R5WHL*S,Y/53%TD1/64HG)AXH5LV8(AT@)2,C -M/\B[(R ?(2WM: -M9)0M1P%$ 6L ^\A%;X\_+#I$-$+"V#M 24(D(QXJ7-"8(QX@)2(D1'QX>'1\=0U"Y -MV59"27:IW5)A@M,_D$Y%RRDJB#0P-KC6P;FWL(W$,2$K>)B+>X%@79 J0P%$ -M 6L ^\8N3'4H(#$W*#_*YSL\2T8N+2)V0@(AG7)4H-P$[ 68 ^\\I -M-SJ+BJ]+O9C,T$]+7T,A)"4P7\.=)ATB*B,@@,C!(1\C)BW*?T+XK -M(B:G:=XU)25@4Z5DW))8:IZ8UDX\*"0A(B @'B 8-,NXTV0S4W6.TEUU<--2 -MBVA"P2TQFD,_-JJ[EIJ2EWK702LW=KAT[\L("BV;=XU -M(R)51ZMGVXE*7YN8VT,Q)B(?(!X>'!X0+L6TTU4I1VZ.S5%N;I8K(+B,U?,,U(UZ%B(]Q4P%: 8D ^]XM,#A_9J-%JGO3[$H^ -M4STK+S ^L*R G,R\QB=W2)B0H*R@I)A]SC'JGX93$U%=$8&$@("0O -M<,"U)ATD*R4K@)289(!M!A5NARLDM)2>H4MLW)1Y.2IM.UZI87U=Z -MTEH[(B,A(B A)!\A+$Z:S6(]4V6&W%A;7-!(@VA-V34UFTA%/JBNBGV,E'+/ -M/B> ?<4]'B);;7!]>@%I 6$ ^[M.9)Q(&3 N?8G(VD\W4UHB'R,S=\6U(QLA -M*R8PB,K#*2$>)2(5'!=$BF"CSSU,S1UZ&UTQ46;W%^? %K 6 ^^B(IL=<-4;W!)" A'1L5 -M%AHRED:>S,LL(RRG2=DU)!LQ49%!U+-189&)UU%&)24C)"NL(295:WM8T&8_ -M6&-TWU186=12DWM)Q#HRH3] -)V<=UTU>V#(02Y:.2HV(SAV)((B8UX=CTEI7+Y$(Z)AHC0J92X;<\5IF0Z48X)R'B0F+6G(OB8@'R,/$!$3)J5!L,?1+R(TLS_9/2(;)D.<*-&Y2%V0 -ME-Y00"$C)5)B3QXG)D=8@=!@5D]::]E&6S[/1G-H2IHV+*(Y,C22GU]7:6IK -MLLR_8:$C-R2.;%5P?%D"40#[Z%ODXEXT+$1ZCLG=03%$2# J,S>8V-,J(R8M -M+C9NVL\K)20H%!06&#"R0[K3W#0G.+])Y4(F("-"J#3>QCQ6E9OK4#TF)RE6 -M9U,C*RI'9X386$U(573F0U1&VT!P:4>>-"VF-B\NG[%K7&AN?\T2TA,Y1%V4@G("ZO!TRT?-:1)V$0C'!XOA3K4N%1)CYS453LG*J4V>Y(='!TM+AO%85=0 -M6VC30TLRQD%'84A+,2VD14 Q4L2-?YU=-STG**$I&QT=HB" 44!50#[ -MXV?AY6PQ.3R+?K[@33M).C L+R^/S=(N)"DJ*"=DPLPM)B0J(R,@*!^]>\#& -MVS0D/:I5YTHI(B MB$#BR4M$E:/F7#HM,*H[AYLA(B,K-R#05TM)4VW>0#\T -MS3Q*8$-0+2VJ03LI6M"*?Y]6+CLN,;0J($R'I6=L8X:" 4]3DM#A]1W8U5=<"\B)$HN'I>>@6UZC&)+ 4D!3@#[R&+/TFHM.#U@9Z++ -M9D170B4F)C%HO<(B'Q\F(R="(+\B'1LD%QL;)B&R-X]DRU\C'1X_ -M0J_*P$I9BIG1<$;4-61RTM -M*S9LR=0K)"8M*BU**LLK)"(K)2,B+B#.<\.XW38C/Y5PVF4I(R ]1;78T4%4 -MD*#C=T8H*JR4BYPE*G]:Q+:\34))1W'B3#F$VCD]5STH%"2[0D$QD=]7-R

I9:VDU2\A)F)TT&HF)"1%.*?0S&-5?(/ CU,J -M**.:=)(4T)[ -M2V!< 4X!6P#[UWK9Y8 J04EJ9T_383EC0RXK+BASO=8K(2,J*S,A),PM)2*Q[$@F*;9"8G(2%5D+\@'1TD*"4<2+\D'"0F'F-17Q^G -M8*J*T"\A($AES8 F'B)&-Z?!S5A5=%2TBUTE)YF?AIX?)BM)H*985U946#[< -M559KPTDW&5%222VY2#8^<\\J)V(P(1T=)5ACS*13/9!F;'Z! 6P!DP#[QEW( -MSW3< D'"0F%5@D,!RK:JV/T2\? -M(E9JS'TB&AD_.*_&QTU+=E2Y@U(C)YVDBYT<)B9)HJM:6%%(5#_924QIPSTQ -M$DA+1RJQ0#$V=(B& 7,!H@#[TFG7XH4L,T5H -M,276AEJ/8BLN+2MAH]0I(B0K+RXB3\LM(RLM(54@-Q['4W#@D*EUVVX4H -M(!D^.;73V$-%?EG(B4\E+*FSFJLD+3%"GJUB3$5!3$+E1D)KRC@J$4A)02JW -M/"PP>]HC'%,I(B(D(EIMW;),,HE><9*2 7X!K@#[NTJ.P(@L.T4A'BZP@T1V -M>"HE'QY2,[\F&QXI(2,A>[@D'2,D*5]89QRC2:5LS#4C(S8N7(LD'R-(/):P -MS5I>2R<^?T\>()6^EZT(;'9C%FJ.HZ@;#18=" B(1\>%,$F&!LB*"8B?KLD -M'2 H(EYS912H,)=:S3LB'2HL >,!Y #[ -MQ$5ZU)HM/S86AO"1Z9A -MWD0B'BXR=Z(M(1Y!1YNUVE)$'Q9392DJ.*S9EWDK)R].-X8<#TM 1XG;13O56G-H3SY.Q_CY ?X!_0"BLR89D),H -M/S--1H*)B#I =X!X #[LB,;FI@J0#%+2(B, -M@RI%;2,B)1H<%+\B'1H@)"U*V$9-+;R\O/0G';WN3E >4!YP"BP"LAK:&L@G(B$G*RXMA\\H( ,FU%QG9"*]-YT]WF$C*#: 3*HJ(!D]/8]9X$1 -M+DJ!(34H,:' J+4L)C=.&$X>0$P[3FK4.RE';R4S/EQ+-!R>1BPN,4NKV^GK -MXK^5=^?MT];3/V_J^03_ /N7'Q1NBR Z/T5%?'Z@2%5@)R(A(!5=P"<>&" K -M)2!PMB(<'BDE96=G':8M>Q;,9RJKB,B-E@B -M'HU,06=)<*-#,&HX*"E"6$4]+65 ,3=*,7*+N6+*3B$;U,\^1DU\S]GIYN%%3DU]W/@$_P'] /N-(CE> -M82,W.#XV>V>P/&18)B0D&AQFP"L>'"8B)2%?J2$>'B8C9&ME&YL;>1:]AQX: -M1TY6JRDF'D@M+B9Q1$M<5%-<0!PFHY:FEE6459/"9+/T1"+2A. -M0SA$*BU&0#\_*8>JPW_(/RW-T!W0'A /N$&CML:Q\Y.C@U -M@FRT-5)((R$C(21PQR@:&28C)2-JKR$<'B@C8VMD'JD=>!>]AB >45Q>K"H? -M%4$F*BAS.SM544M2.1@CIYVDIR(?+T\F;UY?435*/"M +S8V'AU&/C4_)"=! -M.#@Z)I:MT)/'-Q\BT\,_:EVQX>7GY>8!Y 'H /B<*D%]>R1!0B\RBWF^-D], -M*RLO+"IXTC(@(2\N+B=KN"@A(RPL8F)A(+HE=QC$E"@F6V5BN2LF&3@G,"9[ -M/S543T5,.AXKL:BXMRTE,$XD;%U653= -RT_)R\Q'!I$/#4\)2H_-#8X)J#% -MYZ/3/B4IZ]5#:%.U^/P%_P#[H"$Y56,A+#4M)'%&CH[LY@E(44[9+@L("Y<-QDY7#E>7$Q244P='I^# -MF* C(CM>.7!K;%T]3#NC,3U!+B =P!W0#[G1\]86T=+C)"@H9;XI&ADG)"8=7H4@ -M'AHF)%IC;!VE%S= M9'C57 -M,69@9E4M0CVI*R@M(B(V/!L:.BD?/"\T,3>3K="3OS0?(=#!7#UYX.+DY>/E -M >4!Y #WMS%)=G\B-C\D)'UMK#)623$H,#,N;(HC9%ME35)D7R(GEH..D",B,59;7UQKNT\YFR5 /BTF@% X -M'CY)(S@H-"Y#07N?NFZZB3$DQK=;:=';V]_=I]P!W@'? /N1(CA19A4X*"4C -M:%*J*E%(*R$H)2*%NR09%R,B(R(Y5A\:(QPD5&=E'9DK5&NJFR C4CUTOB@: -M'#Y"@(X=7$]7149652$IG8R6DQX>+%!455%ELS\ODQ\U+AX@@%(Z&SA$'3(C -M+"<^/H^FRX;#B"TBTKU79\S>Y^C>I> !YP'F /NF+C]D=AI ,"DE:%NX,$Y& -M,"LT,"B-QBX?'RPM+"8Z7R8?*" M4UYB(*HX6G&TIR8F64-VRRDA(#E @I@@ -M6DA-04-,32 OJ:*LHRDD*DE+2U!'V_O_[P_P"_P#[GAHN/5H6*1TI&T5!LR=U5#,@*B$=7JTI -M'AHB)2$?(#(;'2(?(U%F92**5T=;F:8F(C\G;K\H(24V.E@@55936%U<9&(E -M(XZ9AS,@)#%)5V^K9#%!1BA'0B@CAE:&AW\^5B(M/2LX.D)GF*I8I(TJ(\_' -M4E1=9VQW24I)35)055ECS8= -M("Y#4&>B72LT.A@W,B @B%N.BWPY41TG.",R-3]ZH[MPK9(J(\VZ.3]$4UQG -M9G;B >@!Z@#[LR8Y5W$8,B8H'4M1R"AA13@G,S,K;K\R(1\K,2HG*C\@("ZI40G)BX\1V.B -M5"XU-1HY*AP@C&>*AGPW3ALJ-A\M,S^'OM:#Q:$Q*NG'-#]066!K>X[\ O\ -M^Y(=+C15$B8A*2 V,+,J67 E)"0<&%RA+1P7)"$D'ADC%!TD'2(_:6DA@48F -M2W^G(1\R+E^^)2 B(CY93CI955Q56U->*!V.FU=W&R0C/U*GH%I-0CI40B@H -MFT>1?EC905,H-#0V-D!$4(:31)TF(B/3LWE/X.'BWN34X0+; /N2'# ^6A(C -M'24>.S>U)DYD*2,<(AYCJ"T:%"0B)!X>*A(9(1TD06EG'HU0+56$J!X<,"Q= -MOB4>'QTW440R3TE.2E!(4R,AF*5:>!LB(SE(IZ!.2SHK0S$=))U3G(E;T3Q. -M(R\O+C [05^8HE*<(R$AT*YR2-C9VM;9S.4!Z 'F )JC*#A(9ALK(RLB/D/* -M+DUG,2\J*R5LLS8?' ,MWB4A*Q8>*28H/V!C(*!@.5^0M28F-2YAQRXC(1LV -M33XN24)%0$8^22$IJ+AJA2(D*#1"L*5)33@A."@=*:%8IXE=USE+(2TM*BLX -M/VNMNF.S+R F[+MG1^;IZN;FW/H"_P#[E1PH,%(1(1XB'"@7K3-,$A<4&B$?)$5L9B5N.1LQ9*PD(B\A$TD@'B$B,4A6.6I28&)8 -M5V8H((TS?0\A($=)4UUM3B])944Q2*Y4GX=1:< Y5B@W,BLV03E4:65J(2 C -M)=.W7RW9V]O !W@#[E!DH-U81'AH>&BL;LS5'<"XB)2H=*(@P'!%!H0%AX?)D=L9!]X0A\[::TA&R@>$DL@'!X=*D!,,6!&4E=-3%LC(I8\ -M?@\?'$=$2U]M0BU!4C8H2+!;K(]8;;TT42,R+2,O/#9;'BYN;J >D!Y0#UHR,O0& :)B D'BTCPCE";#8N,3,D,9,Y(1\J,"\E&!P5 -M&R8H*D5C8""*4"M%=;HI)B\<#U$I(2 ;*3Q&+5H_24U#0E$A*J1*B1@D(5!" -M16=R/2\_12PH4;1DO:-7:+\R3R$P*R$M.C9D@WY\+B4C*/#%5S+Y"/\ ^)4> -M)B5)$R <&ADF&ZLL98PS*2,B$C)!(A\9(1XA'A$6%A,@(B4J<&\E8T+AY%=1DE(B)AC4Q3G4TO1%PR6)Q0J(9Z -M1E=P/E8O03,H*$ E $'R,@(230FW9/W>#AY /B N8 ^Y$:)"M-$QT8%A;$XF.U"U)!T=)W5D&!@6 -M'A=$5R921E!'3TY3)1U,>QDC'AQAB498GT$M/$XK6IU6LY*#2EMR-T\J/"X@ -M(3HB&CI%'2$>'R+4G71-W^'BY>GIZ@+K /B@(BDR5QPE'AX;)!Z],5F".#0O -M,1Y"4RLB'BHJ*R44%Q44)2LK*F=I'WQ:,41)R,A<(Y!7:,\+SI%*F"H6\"ECT)3<#9.*#HL'B [)!Y"4"$E -M(B,FZ:-L4O7Z^_X%_P#[C1\@($ .'QL;&B9,IC)N52LG("$3("T1)ALB)2 C -M%!X4$QX>)3AR:2%94"+%5F5&!-66987&4G)6<1)"$@ -M'8S;1E:20S-7)8:C6IQ^BUQ)-%!'6B(_,2LP1"DC,KPK(1\C)*MO:2W8V-W@ -MW^?F > -M)3IR9QIB52(FL6(AX<%HW805N4 -M.S!/'XFG6J2+F&5*-U1"51TY+"0G02T! -MZ@#YE2$A*DH5)!T@'BA3M#)A2B\S+B\;+C\;*1XK,2DH%AP3%"$E*CAI8QMN -M83 [-\'APV -M%1H<'6FE/D@I3DTM(Q\B%AL8$"(<)"(D)A44$AHB(B4M<60A0V$A.ABR*A]S -M%1LA'R$E(2I376->75)N9V-F+2,?(R8<&12TUDI.CSQW66E\=*6-A5A)0S8[ -MA5$J-2@O+SG@+AZ:'"(JF93(J=/CV][>W^+CX@+C /M\%QL:-!,8&A]NJT-* -M)TQ(*R,?(A(@)1(>&B0D(B(1$! 8(" B*W%D&T]D'3X>MR<@=18='1PA'1@A -M2%%33DU"7UE66"8?&Q\D&A<2MM%$4I$Y<%!H?WBKE(Q<34(U.XE/)"\C+20\ -MX2@15J7.6]097^ O)^79$ -MW^+CX@'B >, ^VP5%A,H%!884"\N/$ @25LC)!\E$!<:$1(7'R8?(!$6("0A -M(1\D<&H;1V$611IB)!\2&A\>&1L7(CM%44M#3U],5517-B,;&WDA%Q>8GT52 -MBD+5VH]4K*E[3$1'-T*5-3TX%3,[*T[5)AXN;GZ.KKZ@'J -M >L LWT>&!@M&!H<63@T044B058H*R8L%AH<%18;)BXF)18;)2DF)B -M3F\;0!MG)AX7(@,AOR(;(#D_2D(Z1E8_2$E--R@@(($I'!N>KD-7D4CCY9%< -MO+Q]23\Y+CF.+C9WG@SOSX_ 7_@?X!_@'_ )]G'Q06 -M'1,8&!H?/CM!(59:-"(D(Q05$Q00'APJ'R(=!"'8)"4N:VPC*'47%%A1'!LA -M'Q\C&R(I+CQ-45=?65Q65&>80B$H)$8=&1S2Y4I>@E[:WMKAH7A-04<]2HXY -M34LHHCHV/5?92)"/C8AG9%[3T=78W=WDS\=)"!#&18:U-]%8X!:UMW2X*Z"3T%'.4J1.4Q'(IPU-#)9 -MV$&2E(Z+:61EW=S?X^;FY>CKZ.8"Z@"@;B$3&2 5&AHD*$,]0QY)3C8I*RH6 -M%1,4$B C-"8I)"@#*=$L*BYB92 [AA@77UHC&B(C("(@*24D+CL\0DI$1SY! -M7I%!(BDE3R@>'MSP0V6"8.CIV.Z]BDTX."]%B3!!/R.?,RPQ7>9*F)F/C61= -M9NWV__X%_X+\^@'^ ?\ M%,?'!H5$Q04'2,W/1@>6U8](!LA$109$A$;'B@? -M)B B'",B'B,C8VHH'82H<$L_23)(38Z2T<_2EE".SZAGC8A'!=#(Q@-GM)=6G9< -MTMG@K7Y1/T-;7'%AY./HNHA, -H.C\A48@V0SHZ']@V+B]=Z5W@GE]=6%9O[/?]^_S__O__^_X!_0'_ - -end diff --git a/sys/lib/python/test/testtar.tar b/sys/lib/python/test/testtar.tar deleted file mode 100644 index 1f4493f3516ca1003553c591f94027068d8a6761..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 133120 zcmeHw34B!5_5UQ00AUdY6%g^UGy-OlNhTXnaT1b{KmutJ2;u@SGcTE!%*HI)tQwF_ zL^<;QENr5C|2?RJ@+j$lLW+s_3wS34`gQEyW6>E z`JQv{Juf~XKEYDpc2yS0u4=>axlGDsILu#DVoIuZj~+3Y67fr#K`1yr-3hNX;PZ=K zK`?mTZh!cl@NYkNKm6&_=9^#g`4f)weKBF=%I)H@P|L#e*5in=g#%{d{(QqxVU)Cm@%V9jT$gu0467nCWy)! zx*qDgGylO&>7V`e|9*Nyn7-F?%kC-DBPTprG5Qt1^B;8&e{snf%)-H+D&Ffe&#=8l1XpJqNUa!KRt>yr1`yWRE4!lgeo z&Yp8a`89zB3wsJZ7v8*}_vE>^{r>i4w@2Ty${sZ&s%dp*^zwVx+;@NK;^w9vL&mqP zTD11D$Ddd`{gGRG4SC?{g?*mfyk+b4f82EIkoi08+g|$X%j;fP5HrN`ntj77@4ol9 z{tw^MyQk~sdrX5?uG;;V1=;_4|36C$lj zSll1A?a+Usi(dL}|5b)tuPCn@{NbqE)(vb~H!LgDJm}?t%dh(?f7OGfZ*(bo@B{mF z%V%$|w>~a7##!cE(Wn2)@Agz|`A^qP*LO>ZymH|e!@AEu?~}iJpZW5mzsxi3|LjA9 zuSd57aSNNS%E(H+|2I27TepA4`Q4uA`F~D-W7!R(y1w6Ymu2QF|GV(ZdG9ay_gybG z9-92ap|z{8H+)q)vCE-Rp619|y_#qCeJ16*-CfSiN)_j&_HCZh@4OGDE?8i1w9mWZ z`Md9KyyC(G$paS+H}-vN==zzP%O;&WbIq`5%cwUtFV3s8Mcmrut=YTlmuF5JF>idv z65B1gXMJKjKjW{a&GX+XmH*ZE(6e=tE%nnt#FDI;Z@sxJVA{N_(sus?_s1@E8a`_B zv}8>ytlqJ5%N;jokIGz8P%3R%D#v`2^@q9VH0|hBJ+Q?dTOQeb-?CkzW$o~q35Ipe z1NZk>8{fZRgMHxvZpM1s>iz*Jy+!Ee^yIOvpuS=sp`SuEiIl0A6PeN z&<9-~tLggI&}Uw5di~*@RrjpzcH^Pg2S?t2)+N*LYiZhA9MSyZEdxI;yK~HE&hwwS z`q3fh-Fo{)|6KNZ^qw+l_2TOIC(gBh6o1y79lJ-_Z~Lg+6+1RRyK4AnDUaU0dFolc z7Iisq*bg_>JvaKzgW! zf3i=a_p)ihu-Y{Q$ z=~W{l({Fxp*IC_*49hZ;EsfdJtM{b5GbnYAWl@c3U&LKKS5{aW+%x+AG3u^iTQ^@7 zc+Ow;ZvDs|kH?h8#uY}VT-;agzTlO?%XcqGZVEhQDBbkijsG1o|H5+*o!zzQ*2|u( zic0JjIpY0C`=nHk7=8BC+*JALA*Fx2>BFJBBL25->fUR%)!qAL!P3=Lf4ymb%Of!n z_2*t{-Z=Y@k6r@JpIy;YyMR{-Fk7Kzh-3p*!9}CHh(j8?Pni6U|5w_Fog# z?a;hU{ks>P-SWcfX;m|C-t(@Z{)H>3-+8cc-qyZn{>d?M?4g3o4PCQ$jq2WP_pg8A z&u0jRh;xQF1{U{!{XlZuc++1BA}4HIu&j?|jnOFo?WI|N8ra_wG3>lS37*k&4m{E0 z#sv$bhUHeiIC))6p7=!c|HjVRQ80bnivJ#*n^9R2^eM+45= zSrOZ^Vr%a;8_vv5Zkh77|An22Pd>O}_Jc{yF^%;Ffi9n9{4;7%%){NP-h5!yzI9RG z`7Ql&yUc5{#9c9J-7CGH-e31x^Jl%QH@_{sn(~Jgdxl<+F6`Lu5~O>(IATkeSv<~} zbEgdZaQgX)lX|@V=5>Qt{yAq%<0TIjPwF1qeAf4_iR*hm`{}y3ik#nXKlpC?YiD=4 zulH+J7aVFXdv@A~w=}&uy!Txz&wOT1#Zc*$1xaqSyN00mbshtZRYq@FL>)T&W+TZfy3-;-k9sGN*?2Ed-dDpT<{g&K! z#t%cyF@pZfX>qoneuI{yELc+ZX=RZ(3;$U>r_~Ex*kh=TZnBB#9?%lig zk=>=!4>j-k;I=(Gw!XPxbo1zc7QFw>jO(A8zx>OEhq^vAecOwd*XQ({@X@w@hwgsG zeR=$H{YPcGbJf2rohM-29&hzR-nu?^z#*nT~iZIs`C&opRj)MneY z4}P-uKL=;Ozwz;V|I+y0p9j@!7_=}x-qd?p=|3KObK2JG1%LS@>YJ z^ln38(dSRbMsAAAUv2C1+Vd?b-b=?$nYpL$pP%1yd)FUr1BPwve&E`sQA2%?k569w z;@{pdEcxM@*)OM_(J%)c}uJXnIboTabPZSnq&no_O*VnsE zyE6`*v10o5&*etmQ#SbKewFb{qZem?GXLP}k=Iv7OnNSASB@a1tXll(Kb~n=dB)tL zr7x$hzOm@3*bn~h7_sDF-Q=8^q^Wpu` z(#>afdv@)Li}$U*HRGKhulVQFH-ElxOJmCBhUbc>|8(iVC+9q}`GcuB)m^@L$Nv5| z|LHz|ebUNJ-rK%gwtnd!Z!14PV&mlXgQhNiyW-=kj1AVj*W}@weGpE*%STiTDn`zIU@;~+M zF(f@xSlQ64vP+k4Lm%zuynJ}tdAIqd4!hy~(!z^3pIuQDd&#ulL{A%VY2MHYZ>R77 zIBs>f$lRIN4_$bDY>{Mr$NhDg`~0;LZ?5Rp|>qx_y+9s zMPC^4dA9`(Z%D?y@HRn)Po+4cH#hGN9|~sWr_-XZR`>{$tKU!?_pUw9oWG?es^Z zZZy5#WmnFPFTB%p!^#_H8Afi)_LuL=`!dy*yVT}Na*bR!qu{$m-+yyy3cYkSW^rh+kRo~5D@Y=kwXPxtT*GW(B9+Nxn zj4j(zhT9{4>Ys4Ih{fmixH!7;wpA-L^A40=`PyxNtC(l%7ik`2{_=jq)bAEw>zx#{ zqPX$CtN)&|w839e`KY08WJLDCL&@WBoG_~V_Naee-FxfR-v3@*GH_W&{@KozF+G|zH!g*ZcV>x(ZQ8V2Ck|qPi(%;^{?1fD_5;* z%J;l-|H!|sjQHZ|Rric(T3Q)-sNy%yw3%z3Xua>M3Z-dlKC*}F|oTzm8eRkFk~eo4yuu>zkVU-t*W!j=l@}8`E9HE=JaUE zy?VEC`fnn3uZnwOSaZWO{i^SoKJ@#j#}AfP_ggh(=-rW@URm|kr4d!P&S<{p_itq^ zeRt&V_uVb7n6Ynf_NO=2&n&uU$D{MlGA!RYY+BOvJATNWV$K-t+VI-~N28a^!giJNm9yFIhvya`=~zWwgnzF$qUdXgsh>#}g8;kpg$Zf-gMy4RMj z_0Ii|ZSZf0J}|l8*#~Ehu4`IkzO$j|nmOhk5TqrdUCG;AOE)9mDuS6k%$ zEiFyS5lKV;w@2vqRm)RNLbt6CUbQVMa{q*MySLgfap~6+s`{;ez9ltD82$3-9=9hB z9G&{mnEmTV3lF{B^w5YUk#9|y_d(3$N4G@oiFtT|IB0@p{zpv@pVK$Oa5212ejOVM z#GeZB-{f}Uzo|U_du(R-$hDY^1(PR@pOjgcV?2HzkK6@*_asu__)U6{uS|)0{MVe8 zg!LVhN&8Eo;kNPLq?9yM;t7ubVil-Dc1VYvil4iG*n+3_4IcmH@n0VQUmpME@n0VQQjVDrTzW^~r8mhEOck$n+_uK=k>Ig>IW% zAxpLlAzSoIF_{6>GL>X&Pzn9_O=>wbmX>lFRyi|B|M=atX_^dr%1oDgsr zld#t;rpS#h=E*+4+gqOz6BCo~@_XI30BS-1SqDn(l7ImUR=3M9$}XSa#}Beb7}4Q4 zB5{;KRJ+`@E3fX`NVo(f=BXrM6YO*;_ZH?L#VaOR(p`ZXoOYc4ESVMB^q?GLDYy| z*&V>wfFC&;TsGWO=*gyy7!}kThbgYaTq+|FKx9Gi6EkbP^mBhPI?2nL7mP-uK>yL7 zqr2F{Xu44Hi$_(!( zSVaLZ1QWdCf_w#Jo8*vPlCPZsDAE)s`LR+WudFT=PQYmBwDxoAiZZDWozm#5RrIQ6Ao7mLKq?h;@ z67I5zUR%3u3pHSp0=HC4tfLS$rA_+<5R?EoRmiDvI|3x(dgJ&|1evh9A!`aTQw7$| zT)7Tibx5MG)o4SD(&tRk-k>#|CZM}Hc&f|2wt4(_R}mKk$3b;!b^h%izTPK zhRXW_9-3k{e245O84UQK4N~BN`_$l${>0N)$gtpj>c<$xoJ-B!h7t+G- zEtfO~457&dYEpzkhMK8ov!WY|0=e8P0z5(lytT4lRncY>)O()0mQ;ZvMk+xs^axRdPE|=bL3c9U6o)n*=@vcx}wZlq7CA7KJQO60AUjPKA?wfJ? zLa)UP9)XnzVbwNO;0JB;;sCE$Z(@M6t&#_5S^+g9MfK~&z>4*P3+kpEAeoF1`3iWf zUh)&(Dak|!lED7?PGEga6t_l6SJ*QP#$O=1yu!r zzX5$AW5740<=rk;Jvy6Y0*O_q!Ya4P=mV*G;M+{E7x=T)7|Fc=d&LQp9kK^X6(F{R zDx!WCOSNuqbx`quK_&&9k{7a0%<2fMYPx8v7F9*TYA{38rnuyada8i3sxjsO7X$W# z-HB7!7rmA?H6(-86tIP^0M?ODP%ljJINTz{MI!Jo`+#xvt5}jNd{(0on^ir(iylY?VyLSAWUkx-%PXOXE3ng~d7cIH&IbctV*A?d7e8c<{j^oErz zDmfyIqX=6~6&5#OLp_7y-U9V(BXj`0VSfwbarn=i0v$qmV2ZyaR zfVSHfqvl&fsibs}tqq0>vOz9$jrES>L-@3fLGh9h2&eMO6c22jt-U^k4}A>CPH3S3 z#sP%S3RF}ubfM|S(1zLPJjns=r_kL@#+v*LMNL3eyQ|wDwN}jp!oh`Zw^!0?fCmBF z25;WMe2(!F{5r+1z?sOZ_ruc#AkT%$Rcda>7=Kz^JJ7Mj@X%EBruXK-Yj} z@Ftj%gEb1#k`vr;xYT|m5pscLNGOFGLK%Qga1t?{G64*rYNMdPnzGf(n`s=LdXg0( zAJh|}0ggnALec97DP^_18SP^ZM27_QXp^8qZNx~qP$2#U0Bq_F!vG8oqhcr!t?y=# zpoD30JmQ55%N)rXSp;MFs3xU9Wb>6Prv|1(YZ#(48FrC073+MK+YLX;MQXg=LF5oz z)(V693fz^I)VnD@^4Wk}3C6cI>`KeofpX@zm*A^88U4p$<@!(NGQ0JOJi8)0@HGUE3`)IBl%#+)%+8gA$BatWT z!uZq|g4NrvELV29Bp?em=oIw4Nc7tUqcFL=O0xP9YLFGpG5bd}3-4NF~OnLULG~;0SOm+Y7n?g^?2wg2D)?|9oNHsO~k_n7jCW+M;GE9PmAmU*QDg#lernC*kP)yN6hWWiRK>3kN!=lEa zk6=}@Ev)B9(_h{0sb zJ_JPSnTca&h8PgKiDBODBD1%9K z*S4Mp6;?8>or1=7eoZ-{`$CcVlq8})03CNVR1Y9!fm{u38_0obqtnoB7t_qFfc>072 zuiGh1mp$;$;2_q7&KYXRv^x-Eb30Xiod#W{4U_%App&W&9s^0ftYQe@>+3>rqn39kSOYJ2%1li$Dzf{L;Aoz<{`Al+*u+=B55CTXW4!PVSIi8f=ROi z*sH+&M67#+juPeb5D7+~)u|xBl}+p8iU&@QYkg3{c`!0L-Av-Y(w0^-1g0{NG_>h*NTE#N-D4VV(f>Q|HL9EQ; z_ey!lGxKl}6to|Whs(-`kAMIGErH2c*dz@O=Yvc>L;rf%qD>#Pg#gwK0s<R}Jj-k;(r3Or5ro-W8Ym}L;dd+Kqa3gdN$HS&9q(HQ2nh?v;g5xnlj?;s6 z79|o7DL@#Wc8AboZWmxUVmu-gB$;yNX=ekp(Yi7T58{{f905P(=s+FA-V+4!=o7|1 zWU4M(K9wf13Cbu~&a6Y?PhrZS3w&sCe3$pmyVInlHwgSIENgO(Nl4xMME!DEc5bXgH6*m&oId`gZ?^PD`ry;Q$bz| z`Hbz%$2hMjSH>x>o+^FG5c#%ssFK)THSN`bdDK?xCV~{St;$Wh+m!mEQdzZ9~*(w#@cXV5JbQ z6*l*=H8;IY^}~3tTme2;HC8Gi#7e9aE4U(b;ih##<$JL#*|9Lr_%;nZ7jVh51Sdms ztgwT^q;3{aZ_7T2Y+xfKtsPL;(;#yYgbKNiI*)*RJVo27<5oAe6u{0fQF1HG5@>$B zEaDFBY|v`Jl+mDJ)P7-HmbDLVQ9KnrI>d&6DQw$y8hxe%fVHARZ9E;_Ka9yBup=-} zpP5U==_gnT6HBO&T2DvciOXp_FR-!E0h8W-vkKvb9FGU#IvFNdTlrzt038O+dr*xk z5W5|C6zU^T1!G8TN!74*VQt-r5Rp$~3bh03pHkWD_Sw}@i~;*GStVeih#Qy~;Q=gu zlfw;ILz4^01GXl*PINo`K6i~)98;icEw+xL$uH|tc*FEE4mzB51)gh!&B1ao#kEn`Y%;4}noY3DHFyp>pPUqZ$(lvlLZUud&^BO8 zwKyR(EJCnF`B1-zc4E->M>t+`n9*0FBf(WyNWYnF-y;_b@QxfUD|ASK=q$I1ZHLZ& zDG4;ls3N##Nh3+bNK`5oyU{~MiGwCO5Nl;d3Z;5R2G#|#p2|LTEbQAU(!#jvJycl)~-@SU%Q`*Z8-XFxz^L$nj+>T zM6I!~Db&E0lMv8=6mXiLh2_Yt)FTOcEJURVg}q@;p;w^sK^wRiv?PD{tI#^m0SVJJ zq?th)Z04$W(l&Nw{xEU{P-qezTAyx^&BTt(7;P%02UD93=;MaGf^ZWXPl z_aJ1!OeG$L%?V3YcqOT!{g_ecz(e3Dx}Qorh!htMn7X&|O2{tS5D$Y?j(V_09hScTQp4y)>;|C? zoD<>O{TVf&@Ip4M6HgcL?f$f=p)!&FM`I$|v4R~Cr~7t)HjIZT~h zJm5lL^Nxg&JGo+^EZBEqQxgbr`&VquJv8~-Mgc+&Qjv9{rD1veNfuGP_> z8)4)J_nm~DX(aX?UpSzSlb5Y6iigJTK$i9|4UICL+lgfd);L8VX{GLGcF5~JIYqX` zp+8BTJ1N9Q53cL@#yU3jLCY&*4JM5j+&u`W;$`t)2oV%r=~+Y_$jktO~5c6bucb#T3p5e(52b>*maU|3g{ zVIM*weEJ3_=E-#Ys39}kojjYYbODO6gU1ya8KDI`u=Yu0JUKgK3Ga1g)s^+!44R#c zowY>qPAvJ7!akkPm!7uE)yztCA`1Z1)1BE;O^lNUE8DT;4vE-jkM7fDsOS z*P+cdVA_tK!@#gRnau!w@66sF)&Zz3wsoZ=$q?A^p|Co6l7#Sm$Mf!x;F)Qq;xs>p zLX+9)omNDPP8?=|!*H@UY7sBc^2E`d<3t`MS_##5ipJ@OoY+Xfnz}(e4flJo$t0Jx z<421+y=Uy$oK2!h?M%88qC}_8Hn9%ClkI4}6xIQ7Wt+26MUzYNr_o6_c3w)^f{Di1 zm5I$y!989led8S)11+I-?0{Cs^K&UX7f+czf0!F{M|0nhlJ3lYL1yYg7BhZ9k~oTB znNLpM9X4us7aiZ^$odZ6>saO<;@pm(4OD0jh}WU)dQ5|MaDOKC`{W-=%xtx>v=|uy zmBYdzzE&`Ow+}uTJMKYqb`tU>DFg?%b!=BF?SSlDl2@ezu)D!M*(Y{iEMwSCWQ-zl z?fAA@V%kogLnTwuxpSyAi6<}Vl`;WfL3Q(U$1-X%$Ap$GI(C>=UI z;SM&OGh9ngvmZ0@qn_XusF!U=XLpKmM?Wkbb|)Kmw4>I9l!Ik*aVM7!DM5an$>0b4If=-BvjsXhMCQrE-W9az!hW z@VfOzaJH4cTX2#`Ms{x;m!odQi#VOeT2XRoXS(P;BK3MHoWfy0C`85yyK1GB+L&@c zEe^U7$G`wtw5wdXaS`4lVN}k#wL3H=F?t-t0@*S`D34=@_#R)b+_zK`o9RSU(nU~? z0i2T28l=CK@i@GXqwjdWF5V^K%pNY~piG>QMMR_@w5yzc2zf<``m}mXY63F(igxW; zu#QzZKxGMp&{{v3Rwm^8MA520jx$Q^$XY8dR?qyz36qeSMSmC{TvjE6MyrvILq1N% zV6COkR%Nv)M_!FqFHZc1&WXC`XPg~*Rs3!brHofD4?C}B#FSX9C?!|YOI(yuYo~E= zNL>tggGT`!q803goQOf;($e2h+I0uyj#a=C0D|QxUq;wffgBFi5@f-tH>M;4#gRfJ z2^5i^xkwXb8_N*twBSr0(iixA`h+Woz9BRu0J+-ZXvc#eES?G!#G!EgapVHQvp83X zd>F!n(8sGJ3o@@FjN^3TV3fZ;SVT$l$vPD}>w*&*Xpy6zjug6m`ViQmPN)~Dq9Sax zLX||vJuLy3LTlNovtjToZ7Y3&7p<^Ewiemyiw|Wkc2XSKGaRC~I;ii^9&!|0kdMS$ zEm1Pp;20=T2&BR*g$V`30>4<$eQUfG!Yp}_sJ=d4MAwjO9hdr65ao=gToshU3gvYn zko*d-7}Q~~6v$}`feIB^s;FFYU8IcLf{!=_hsWY&TfC^~ir`slVw7zU*tR`DNxHKz zK{#|~vmmorwJX?+dhQmw!HPqTRKI%F;Uyq`KQi?Cg?iEMcIyPtPhqv9uu$3N)kSRJ z>bZ0x8R()_kH3{k7TH}ZRm!4EuUySE#HbV|x=y>2gUI5mmOaS&rr05E&`Nrvw)$Q` z+Qk}6IWnczBY%B zt{ei_nO8rK9fvK1IO&K}mf1{5)VcFoLq@G+ID^8HVCO?FWFm3cEwDQ{A&V1~!OB?{ zekMmuxb-5=T6>$0t8cZL0ORcpu{e+-`oYqGB#}D(m1JpT{=+pVY`V4DVy%_qT}Tpu zYl2kEtYvH4F90c2Rk53v01j&U;+4a0-)~bAd3VoA4%^;00EtUo1`~qdU@B z;w2DzG4+f&Gh`kdht{upcZ1#HtV@jdDnby9kY~mhGODYOiq2{a{y{|9DAar-jNPop zOcwx_@*q+=S&(^zUN)iAMolcD$UbGC*DjKLd?2`7ftMjY&&KBOd+H+faZ+XF_Nm%qSML+%IY!~#gv+pDl zIGP-GInj`lVM@&q>qnZwNl+)jr%AcA0uwChrD_y|58_j00HCwR;&gjq`~yDB0)#w7 z!Aw$Kv_V1*$RBdy%@OPs9Id8a%PU3W2DA;LJRJ08Z)31XQha%RK!>2}QFV+#bOykA zdJ`Vy47*R$1lq9mqu@j(plZEWPWJ5x@~UJmMbBCxeY{f48LmLoOdzB|kh4+m5|Ew8 z!YJg!!FZjY)O0y*$*VvPC7F)?G&@s|P9Tj{Q23|`e-(~X+v+U=yof?4PuL3}KqN}J z&aNu4!p-2BKj3r*!3pJi2M%C(4kk$`j#nNRs^x08MWmDiqzV9jnd)HqQZP(p@x%Lt zLPlDJEG>42MR^m0UH0hu1294;cKdt*C&UNuBXbKQ5qca&oP;l}CoA;n31Bs0BvSk1 zVWA3Npqu;UvKZU65mw0yD0)vaBuayBwH*fG$C>=^W z7)!x$j(Ts<7Al!Dl>8X#j46M-E}I1@3M$>2RZw$FfEU{MK}yyMf~`pCk5mOvVw&Ms z(xTv{C{R6N^&?R&61@58wSjQUg2oL;IgpG!XeM+CJdB0Jgj5H8TA&tf(Nz&Z3e}y49JFf9El&p5j7SnWI*aV?VS!535iJPO-9%2CvqFtXpihDxDkE6maNYD~}akE<9LEoi7=QBlODI0hEb&RUl=^2)!u3 zuf1z+vVi zCMKAcT?x<7dnBjgWo9hffckDpO7sUX%I1TrR^RyOt8sMsktyW*6yYKv0}o5grw!s4zF!haAbQ2H zcVOsmo$+PFU=E%T^$FZA7 ze*Z7tyk{~Q5>3fTX{kwA9!NHr60wq-V!%0fV{y*-tyHwbAM@IPf~J}eo2?*3s5 zp4vC!6XFvr^rk8x`0C@-RW`$zKu>X+%g8WGn zjmPifiI_*;Mu#YH{3bofSHBqlC1VG@iQ&KFZ=5vw|2cg3bN4$${gYoP$yjoE;cSN@Cnu_o%n9lGu^>;1F*~2lf5Ne-t^GPoresrEO3E*of4l%9 z%^;+-U){0&^;pgSvF+6ft1Z=-o1Z)R_$mMs0KhMkf8?Wr{HLA>D*Vdlzrc6Ljd=B|N zG2}Cm9nVM5|A?{C|7{6MzarjB|Es1;Db@B#{>%T56aY3iC#R&QrH{$X8ke1u%fEAa zaDL$O!1V#whuj`;d&uzs#{(P>a6G{A0LKFy4{$ud@c_pI91n0j!0`ab0~`-a6G{A0LKFy4{$ud@c_pI91n0j!0`ab0~`-a6G{A0LKFy4{$ud z@c_pI91n0j!0`ab0~`-a6G{A0LKFy4{$ud@c_pI91n0j!0`ab0~`-< zJize)#{(P>a6G{A0LKFy4{$ud@c_pI91n0j!0`ab0~`-a6G{A0LKFy z5BzdGpuPXYSe9R!XPh*ppy1fQb>oQd|4?5{5q$qI-v5zk#%nJOLOZXkIQFk#_?5r^ z<=7LH*T^ZrDZnYfDZnYfDZnYfDZnYfDZnYfDZnYfDR8P$fUlqM^%K5+!q-pu`Uzh@ z;p->AeEo#mPi{ZC{p9wO+fQykx&7q!lj8x72RI(!c!1*pjt4j%;CO)J0geYa9^iO@ z;{lEbI3D15;8eo{r`mo5-XBf@P618VG~fKz}|fKz}|fKz}|fKz}|fKz}| zfKz}|;B=z^kFWFiI*+gO_&SfT^Y}WCuOIvPI=8RfzH 3: - import _hashlib - exec 'creatorFunc = _hashlib.%s' % sys.argv[2] - print "testing speed of _hashlib.%s" % sys.argv[2], getattr(_hashlib, sys.argv[2]) -elif hName == '_hashlib' and len(sys.argv) == 3: - import _hashlib - exec 'creatorFunc = lambda x=_hashlib.new : x(%r)' % sys.argv[2] - print "testing speed of _hashlib.new(%r)" % sys.argv[2] -elif hasattr(hashlib, hName) and callable(getattr(hashlib, hName)): - creatorFunc = getattr(hashlib, hName) - print "testing speed of hashlib."+hName, getattr(hashlib, hName) -else: - exec "creatorFunc = lambda x=hashlib.new : x(%r)" % hName - print "testing speed of hashlib.new(%r)" % hName - -try: - test_create() -except ValueError: - print - print "pass argument(s) naming the hash to run a speed test on:" - print " '_md5' and '_sha' test the legacy builtin md5 and sha" - print " '_hashlib' 'openssl_hName' 'fast' tests the builtin _hashlib" - print " '_hashlib' 'hName' tests builtin _hashlib.new(shaFOO)" - print " 'hName' tests the hashlib.hName() implementation if it exists" - print " otherwise it uses hashlib.new(hName)." - print - raise - -test_zero() -test_scaled_msg(scale=106201, name='[huge data]') -test_scaled_msg(scale=10620, name='[large data]') -test_scaled_msg(scale=1062, name='[medium data]') -test_scaled_msg(scale=424, name='[4*small data]') -test_scaled_msg(scale=336, name='[3*small data]') -test_scaled_msg(scale=212, name='[2*small data]') -test_scaled_msg(scale=106, name='[small data]') -test_scaled_msg(scale=creatorFunc().digest_size, name='[digest_size data]') -test_scaled_msg(scale=10, name='[tiny data]') diff --git a/sys/lib/python/test/tokenize_tests.txt b/sys/lib/python/test/tokenize_tests.txt deleted file mode 100644 index 4ef3bf134..000000000 --- a/sys/lib/python/test/tokenize_tests.txt +++ /dev/null @@ -1,178 +0,0 @@ -# Tests for the 'tokenize' module. -# Large bits stolen from test_grammar.py. - -# Comments -"#" -#' -#" -#\ - # - # abc -'''# -#''' - -x = 1 # - -# Balancing continuation - -a = (3, 4, - 5, 6) -y = [3, 4, - 5] -z = {'a':5, - 'b':6} -x = (len(`y`) + 5*x - a[ - 3 ] - - x + len({ - } - ) - ) - -# Backslash means line continuation: -x = 1 \ -+ 1 - -# Backslash does not means continuation in comments :\ -x = 0 - -# Ordinary integers -0xff <> 255 -0377 <> 255 -2147483647 != 017777777777 --2147483647-1 != 020000000000 -037777777777 != -1 -0xffffffff != -1 - -# Long integers -x = 0L -x = 0l -x = 0xffffffffffffffffL -x = 0xffffffffffffffffl -x = 077777777777777777L -x = 077777777777777777l -x = 123456789012345678901234567890L -x = 123456789012345678901234567890l - -# Floating-point numbers -x = 3.14 -x = 314. -x = 0.314 -# XXX x = 000.314 -x = .314 -x = 3e14 -x = 3E14 -x = 3e-14 -x = 3e+14 -x = 3.e14 -x = .3e14 -x = 3.1e4 - -# String literals -x = ''; y = ""; -x = '\''; y = "'"; -x = '"'; y = "\""; -x = "doesn't \"shrink\" does it" -y = 'doesn\'t "shrink" does it' -x = "does \"shrink\" doesn't it" -y = 'does "shrink" doesn\'t it' -x = """ -The "quick" -brown fox -jumps over -the 'lazy' dog. -""" -y = '\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n' -y = ''' -The "quick" -brown fox -jumps over -the 'lazy' dog. -'''; -y = "\n\ -The \"quick\"\n\ -brown fox\n\ -jumps over\n\ -the 'lazy' dog.\n\ -"; -y = '\n\ -The \"quick\"\n\ -brown fox\n\ -jumps over\n\ -the \'lazy\' dog.\n\ -'; -x = r'\\' + R'\\' -x = r'\'' + '' -y = r''' -foo bar \\ -baz''' + R''' -foo''' -y = r"""foo -bar \\ baz -""" + R'''spam -''' -x = u'abc' + U'ABC' -y = u"abc" + U"ABC" -x = ur'abc' + Ur'ABC' + uR'ABC' + UR'ABC' -y = ur"abc" + Ur"ABC" + uR"ABC" + UR"ABC" -x = ur'\\' + UR'\\' -x = ur'\'' + '' -y = ur''' -foo bar \\ -baz''' + UR''' -foo''' -y = Ur"""foo -bar \\ baz -""" + uR'''spam -''' - -# Indentation -if 1: - x = 2 -if 1: - x = 2 -if 1: - while 0: - if 0: - x = 2 - x = 2 -if 0: - if 2: - while 0: - if 1: - x = 2 - -# Operators - -def d22(a, b, c=1, d=2): pass -def d01v(a=1, *restt, **restd): pass - -(x, y) <> ({'a':1}, {'b':2}) - -# comparison -if 1 < 1 > 1 == 1 >= 1 <= 1 <> 1 != 1 in 1 not in 1 is 1 is not 1: pass - -# binary -x = 1 & 1 -x = 1 ^ 1 -x = 1 | 1 - -# shift -x = 1 << 1 >> 1 - -# additive -x = 1 - 1 + 1 - 1 + 1 - -# multiplicative -x = 1 / 1 * 1 % 1 - -# unary -x = ~1 ^ 1 & 1 | 1 & 1 ^ -1 -x = -1*1/1 + 1*1 - ---1*1 - -# selector -import sys, time -x = sys.modules['time'].time() - -@staticmethod -def foo(): pass - diff --git a/sys/lib/python/test/xmltests.py b/sys/lib/python/test/xmltests.py deleted file mode 100644 index d20370922..000000000 --- a/sys/lib/python/test/xmltests.py +++ /dev/null @@ -1,21 +0,0 @@ -# Convenience test module to run all of the XML-related tests in the -# standard library. - -import sys -import test.test_support - -test.test_support.verbose = 0 - -def runtest(name): - __import__(name) - module = sys.modules[name] - if hasattr(module, "test_main"): - module.test_main() - -runtest("test.test_minidom") -runtest("test.test_pyexpat") -runtest("test.test_sax") -runtest("test.test_xml_etree") -runtest("test.test_xml_etree_c") -runtest("test.test_xmllib") -runtest("test.test_xmlrpc")