diff --git a/evalkit_cambrian/lib/python3.10/idlelib/Icons/idle_32.gif b/evalkit_cambrian/lib/python3.10/idlelib/Icons/idle_32.gif new file mode 100644 index 0000000000000000000000000000000000000000..89a600532f00e4d206bbc8a59b6baad82fd9dab1 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/Icons/idle_32.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe70991cfccd1267922e94d91e02e9a58d2d29fd3382a2f4975280b9023cb7b9 +size 1019 diff --git a/evalkit_cambrian/lib/python3.10/idlelib/Icons/idle_32.png b/evalkit_cambrian/lib/python3.10/idlelib/Icons/idle_32.png new file mode 100644 index 0000000000000000000000000000000000000000..464aceda8b1fa6e98d3553572e40ebe7d2de2ccb --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/Icons/idle_32.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:797cd05f1964d57c4c6c248ac7f7ea6a38019ada32a9ab7e6c28d060f87b03de +size 2036 diff --git a/evalkit_cambrian/lib/python3.10/idlelib/Icons/minusnode.gif b/evalkit_cambrian/lib/python3.10/idlelib/Icons/minusnode.gif new file mode 100644 index 0000000000000000000000000000000000000000..98541201db0e2935a0d113f67171d253473005e2 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/Icons/minusnode.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efa5aa1d1e3439ab85425bd2aa3a25b9e6c21309e672690cfb32219e1eb7a7f3 +size 75 diff --git a/evalkit_cambrian/lib/python3.10/idlelib/Icons/python.gif b/evalkit_cambrian/lib/python3.10/idlelib/Icons/python.gif new file mode 100644 index 0000000000000000000000000000000000000000..2d73d19be477b8af5f50c7712a2ce1be9db9c20d --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/Icons/python.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:158c31382f8e5b41fded0c2aa9cc66a382928b003cdd8b5b0518836ad9c89377 +size 380 diff --git a/evalkit_cambrian/lib/python3.10/idlelib/Icons/tk.gif b/evalkit_cambrian/lib/python3.10/idlelib/Icons/tk.gif new file mode 100644 index 0000000000000000000000000000000000000000..666c5cc86c65a985eb2a962f850bdad58178d64a --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/Icons/tk.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f16cb2e322891dbd9101302c09ffda0c2a3a72d053bb8c0927d507414c59cad +size 72 diff --git a/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/multicall.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/multicall.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..977181fb99f14e3f6a7357cfe1e10a52eac77677 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/multicall.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/replace.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/replace.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85aea696d66eca23814ab3ce79edb0dc03037ed0 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/replace.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/sidebar.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/sidebar.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f6571251421140c20d8f517fa2d99a51090c830 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/sidebar.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/squeezer.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/squeezer.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47c4fe12c97ae4b7cb85c19b3f4abfadfa5589a5 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/__pycache__/squeezer.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/__init__.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c3321e8c4a3ebfd56b76d82fb4191d3edb90961a Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/__init__.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/htest.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/htest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cf69c8ce2c84100fcbc5730258ecbe8ccbee411 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/htest.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/mock_idle.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/mock_idle.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f1ea4de3f4c6e7624819213ddedb00c122e1ec05 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/mock_idle.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/mock_tk.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/mock_tk.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..593abd48385038dc07740aff48c071db1092a6c2 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/mock_tk.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/template.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/template.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..557556c03bfdf1ec22dd3d4c8a1827fd34b89f45 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/template.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_autocomplete.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_autocomplete.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03647ebd108bbdbcf48cc9a3aba72fd328cd94cc Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_autocomplete.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_autocomplete_w.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_autocomplete_w.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eaacb0e1fed9f8147bbc0bb5d72c8d79221d8b0b Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_autocomplete_w.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_browser.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_browser.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6fab943ff36c722413b6b8c7f4c2656aa7129efb Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_browser.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_calltip_w.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_calltip_w.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a5420ee78e58e9578d50457b80adf6dfb8b5c79 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_calltip_w.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_codecontext.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_codecontext.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..432a983156b628a486965772943f73fc9ccaa7d9 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_codecontext.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_config.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_config.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..439fdfe2b767bd613f18f10e56ff06f418796b78 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_config.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_config_key.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_config_key.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4fb037397c94a72d3b276559460ea40a9b023003 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_config_key.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugger.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugger.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ba6faa6d2ef2019eede66128730b1b520c45cf41 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugger.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugger_r.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugger_r.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..10e97a25c75a6804513af253849785bda579e24f Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugger_r.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugobj.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugobj.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..297c435ef58c31e3b4c3fddb2a35aca87b5614e6 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugobj.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugobj_r.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugobj_r.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ecfbcdadbcc45386a73d7fe87cdf5928dcc4c753 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_debugobj_r.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_delegator.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_delegator.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8499be598a6c8d734a2e66b7d2c1c8441076613 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_delegator.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_editor.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_editor.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09532dcda0ef15dd19145949e6aec3311b247983 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_editor.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_filelist.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_filelist.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e0794f35c896312f759dfe863684091dea93fdc Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_filelist.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_format.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_format.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b3123c9e231d19d22affe1ec84a09062c26556c0 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_format.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_grep.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_grep.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e18876c3c8e69eea6776208bd88e42493b9f655d Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_grep.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_help.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_help.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bdc70a3bf60a835fb82f5e9c1a108f1f2d653c88 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_help.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_history.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_history.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e12d2e0fd7bf32f50983c321968e7f274d6d562 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_history.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_hyperparser.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_hyperparser.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7e551f3d35e1620a36a3d0448a2c250959878fd Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_hyperparser.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_iomenu.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_iomenu.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..04dcf4852f891a07856f8e1baf3efdc0db7a5d10 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_iomenu.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_mainmenu.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_mainmenu.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e426da242f5fc03c98d907f5fb3c5f73517fab68 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_mainmenu.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_outwin.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_outwin.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d99b7d58ea76919a070ef68f08622b33f036baa Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_outwin.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_parenmatch.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_parenmatch.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2b2037b71a4e7f2557d520d7aa6308206217168 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_parenmatch.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_pathbrowser.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_pathbrowser.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7bfecfc25725145706a9e31d9f35b064d7182bdd Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_pathbrowser.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_percolator.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_percolator.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e53a83e475028a38968174bd8c82064efeb2aea2 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_percolator.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_pyparse.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_pyparse.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fabd8d559a29e773c4b0f4b33ad5eaf79459d6bb Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_pyparse.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_pyshell.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_pyshell.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f75e154b3f59066500b2426bc734a39b321a551b Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_pyshell.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_query.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_query.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3c78df4c5276dc5bc0b4857746f194eb1e669e52 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_query.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_redirector.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_redirector.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..451bc8030a3f651157985b096dd196b7fac14090 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_redirector.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_replace.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_replace.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12b6a21fee0dd1796ea070acad978ab92f43da89 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_replace.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_rpc.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_rpc.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7a53636f340a01d0a207bc970b2a243501390ee5 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_rpc.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_run.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_run.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5265e413735d9aa1576808f4b8cd52715a399432 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_run.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_scrolledlist.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_scrolledlist.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..546f5b315d43996be1635bb4bf133beafe410057 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_scrolledlist.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_search.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_search.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d28d323b5aa8bae81f1800104c0d7df5c73ba542 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_search.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_searchbase.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_searchbase.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de8fe608da5ad43bac91227b7f2d7f06807ea9e7 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_searchbase.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_searchengine.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_searchengine.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c3d69dd600c05922bdbc785df8574fd761b2887 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_searchengine.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_sidebar.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_sidebar.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff403faee78bdfe3fd3294bb7994e58e9d86512d Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_sidebar.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_squeezer.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_squeezer.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..edee83f5adaeecac504597b4422cf08500da26ec Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_squeezer.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_stackviewer.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_stackviewer.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..10c32173604392b45525c1ddca8ff77769ef0dbc Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_stackviewer.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_text.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_text.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f159e9f0c496dbd9b7c778443dbe22ff612f9c46 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_text.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_textview.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_textview.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2436dfaae208d877e0eef822ea3cdd29122a363 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_textview.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_tooltip.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_tooltip.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6728efb1e47b50ab7c04d572abbc68701955ba6e Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_tooltip.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_tree.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_tree.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..65f6d41a970ed998d5738ecdc47d252a67967401 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_tree.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_undo.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_undo.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4855d0dddd9414af2dbdab6ebff2c62aa4c55802 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_undo.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_util.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_util.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..92c86f9907b2496812c1a08e21a629e927a3a560 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_util.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_warning.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_warning.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..969ad967dcad9ae9a68e48c47cc6b6d1bf6e81c4 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_warning.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_window.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_window.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cae871d82b613b9b722839846d9ba49f3639081a Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_window.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_zoomheight.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_zoomheight.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9cb7fdbeb85fb0d517c3d3350ce47f2b67e42431 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_zoomheight.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_zzdummy.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_zzdummy.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..acf62592b77d93ac04d9531fb58c40f1a4b4fed5 Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/test_zzdummy.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/tkinter_testing_utils.cpython-310.pyc b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/tkinter_testing_utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e913cd49c4409245dcc3e77bb57f307aba36e7c Binary files /dev/null and b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/__pycache__/tkinter_testing_utils.cpython-310.pyc differ diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/htest.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/htest.py new file mode 100644 index 0000000000000000000000000000000000000000..d297f8aa0094ee9424bbc3f60ccc7d2eb0b6d2ef --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/htest.py @@ -0,0 +1,445 @@ +'''Run human tests of Idle's window, dialog, and popup widgets. + +run(*tests) +Create a master Tk window. Within that, run each callable in tests +after finding the matching test spec in this file. If tests is empty, +run an htest for each spec dict in this file after finding the matching +callable in the module named in the spec. Close the window to skip or +end the test. + +In a tested module, let X be a global name bound to a callable (class +or function) whose .__name__ attribute is also X (the usual situation). +The first parameter of X must be 'parent'. When called, the parent +argument will be the root window. X must create a child Toplevel +window (or subclass thereof). The Toplevel may be a test widget or +dialog, in which case the callable is the corresponding class. Or the +Toplevel may contain the widget to be tested or set up a context in +which a test widget is invoked. In this latter case, the callable is a +wrapper function that sets up the Toplevel and other objects. Wrapper +function names, such as _editor_window', should start with '_'. + + +End the module with + +if __name__ == '__main__': + + from idlelib.idle_test.htest import run + run(X) + +To have wrapper functions and test invocation code ignored by coveragepy +reports, put '# htest #' on the def statement header line. + +def _wrapper(parent): # htest # + +Also make sure that the 'if __name__' line matches the above. Then have +make sure that .coveragerc includes the following. + +[report] +exclude_lines = + .*# htest # + if __name__ == .__main__.: + +(The "." instead of "'" is intentional and necessary.) + + +To run any X, this file must contain a matching instance of the +following template, with X.__name__ prepended to '_spec'. +When all tests are run, the prefix is use to get X. + +_spec = { + 'file': '', + 'kwds': {'title': ''}, + 'msg': "" + } + +file (no .py): run() imports file.py. +kwds: augmented with {'parent':root} and passed to X as **kwds. +title: an example kwd; some widgets need this, delete if not. +msg: master window hints about testing the widget. + + +Modules and classes not being tested at the moment: +pyshell.PyShellEditorWindow +debugger.Debugger +autocomplete_w.AutoCompleteWindow +outwin.OutputWindow (indirectly being tested with grep test) +''' + +import idlelib.pyshell # Set Windows DPI awareness before Tk(). +from importlib import import_module +import textwrap +import tkinter as tk +from tkinter.ttk import Scrollbar +tk.NoDefaultRoot() + +AboutDialog_spec = { + 'file': 'help_about', + 'kwds': {'title': 'help_about test', + '_htest': True, + }, + 'msg': "Click on URL to open in default browser.\n" + "Verify x.y.z versions and test each button, including Close.\n " + } + +# TODO implement ^\; adding '' to function does not work. +_calltip_window_spec = { + 'file': 'calltip_w', + 'kwds': {}, + 'msg': "Typing '(' should display a calltip.\n" + "Typing ') should hide the calltip.\n" + "So should moving cursor out of argument area.\n" + "Force-open-calltip does not work here.\n" + } + +_module_browser_spec = { + 'file': 'browser', + 'kwds': {}, + 'msg': "Inspect names of module, class(with superclass if " + "applicable), methods and functions.\nToggle nested items.\n" + "Double clicking on items prints a traceback for an exception " + "that is ignored." + } + +_color_delegator_spec = { + 'file': 'colorizer', + 'kwds': {}, + 'msg': "The text is sample Python code.\n" + "Ensure components like comments, keywords, builtins,\n" + "string, definitions, and break are correctly colored.\n" + "The default color scheme is in idlelib/config-highlight.def" + } + +CustomRun_spec = { + 'file': 'query', + 'kwds': {'title': 'Customize query.py Run', + '_htest': True}, + 'msg': "Enter with or [Run]. Print valid entry to Shell\n" + "Arguments are parsed into a list\n" + "Mode is currently restart True or False\n" + "Close dialog with valid entry, , [Cancel], [X]" + } + +ConfigDialog_spec = { + 'file': 'configdialog', + 'kwds': {'title': 'ConfigDialogTest', + '_htest': True,}, + 'msg': "IDLE preferences dialog.\n" + "In the 'Fonts/Tabs' tab, changing font face, should update the " + "font face of the text in the area below it.\nIn the " + "'Highlighting' tab, try different color schemes. Clicking " + "items in the sample program should update the choices above it." + "\nIn the 'Keys', 'General' and 'Extensions' tabs, test settings " + "of interest." + "\n[Ok] to close the dialog.[Apply] to apply the settings and " + "and [Cancel] to revert all changes.\nRe-run the test to ensure " + "changes made have persisted." + } + +# TODO Improve message +_dyn_option_menu_spec = { + 'file': 'dynoption', + 'kwds': {}, + 'msg': "Select one of the many options in the 'old option set'.\n" + "Click the button to change the option set.\n" + "Select one of the many options in the 'new option set'." + } + +# TODO edit wrapper +_editor_window_spec = { + 'file': 'editor', + 'kwds': {}, + 'msg': "Test editor functions of interest.\n" + "Best to close editor first." + } + +GetKeysDialog_spec = { + 'file': 'config_key', + 'kwds': {'title': 'Test keybindings', + 'action': 'find-again', + 'current_key_sequences': [['', '', '']], + '_htest': True, + }, + 'msg': "Test for different key modifier sequences.\n" + " is invalid.\n" + "No modifier key is invalid.\n" + "Shift key with [a-z],[0-9], function key, move key, tab, space " + "is invalid.\nNo validity checking if advanced key binding " + "entry is used." + } + +_grep_dialog_spec = { + 'file': 'grep', + 'kwds': {}, + 'msg': "Click the 'Show GrepDialog' button.\n" + "Test the various 'Find-in-files' functions.\n" + "The results should be displayed in a new '*Output*' window.\n" + "'Right-click'->'Go to file/line' anywhere in the search results " + "should open that file \nin a new EditorWindow." + } + +HelpSource_spec = { + 'file': 'query', + 'kwds': {'title': 'Help name and source', + 'menuitem': 'test', + 'filepath': __file__, + 'used_names': {'abc'}, + '_htest': True}, + 'msg': "Enter menu item name and help file path\n" + "'', > than 30 chars, and 'abc' are invalid menu item names.\n" + "'' and file does not exist are invalid path items.\n" + "Any url ('www...', 'http...') is accepted.\n" + "Test Browse with and without path, as cannot unittest.\n" + "[Ok] or prints valid entry to shell\n" + "[Cancel] or prints None to shell" + } + +_io_binding_spec = { + 'file': 'iomenu', + 'kwds': {}, + 'msg': "Test the following bindings.\n" + " to open file from dialog.\n" + "Edit the file.\n" + " to print the file.\n" + " to save the file.\n" + " to save-as another file.\n" + " to save-copy-as another file.\n" + "Check that changes were saved by opening the file elsewhere." + } + +_linenumbers_drag_scrolling_spec = { + 'file': 'sidebar', + 'kwds': {}, + 'msg': textwrap.dedent("""\ + 1. Click on the line numbers and drag down below the edge of the + window, moving the mouse a bit and then leaving it there for a while. + The text and line numbers should gradually scroll down, with the + selection updated continuously. + + 2. With the lines still selected, click on a line number above the + selected lines. Only the line whose number was clicked should be + selected. + + 3. Repeat step #1, dragging to above the window. The text and line + numbers should gradually scroll up, with the selection updated + continuously. + + 4. Repeat step #2, clicking a line number below the selection."""), + } + +_multi_call_spec = { + 'file': 'multicall', + 'kwds': {}, + 'msg': "The following actions should trigger a print to console or IDLE" + " Shell.\nEntering and leaving the text area, key entry, " + ",\n, , " + ", \n, and " + "focusing out of the window\nare sequences to be tested." + } + +_multistatus_bar_spec = { + 'file': 'statusbar', + 'kwds': {}, + 'msg': "Ensure presence of multi-status bar below text area.\n" + "Click 'Update Status' to change the multi-status text" + } + +_object_browser_spec = { + 'file': 'debugobj', + 'kwds': {}, + 'msg': "Double click on items up to the lowest level.\n" + "Attributes of the objects and related information " + "will be displayed side-by-side at each level." + } + +_path_browser_spec = { + 'file': 'pathbrowser', + 'kwds': {}, + 'msg': "Test for correct display of all paths in sys.path.\n" + "Toggle nested items up to the lowest level.\n" + "Double clicking on an item prints a traceback\n" + "for an exception that is ignored." + } + +_percolator_spec = { + 'file': 'percolator', + 'kwds': {}, + 'msg': "There are two tracers which can be toggled using a checkbox.\n" + "Toggling a tracer 'on' by checking it should print tracer " + "output to the console or to the IDLE shell.\n" + "If both the tracers are 'on', the output from the tracer which " + "was switched 'on' later, should be printed first\n" + "Test for actions like text entry, and removal." + } + +Query_spec = { + 'file': 'query', + 'kwds': {'title': 'Query', + 'message': 'Enter something', + 'text0': 'Go', + '_htest': True}, + 'msg': "Enter with or [Ok]. Print valid entry to Shell\n" + "Blank line, after stripping, is ignored\n" + "Close dialog with valid entry, , [Cancel], [X]" + } + + +_replace_dialog_spec = { + 'file': 'replace', + 'kwds': {}, + 'msg': "Click the 'Replace' button.\n" + "Test various replace options in the 'Replace dialog'.\n" + "Click [Close] or [X] to close the 'Replace Dialog'." + } + +_search_dialog_spec = { + 'file': 'search', + 'kwds': {}, + 'msg': "Click the 'Search' button.\n" + "Test various search options in the 'Search dialog'.\n" + "Click [Close] or [X] to close the 'Search Dialog'." + } + +_searchbase_spec = { + 'file': 'searchbase', + 'kwds': {}, + 'msg': "Check the appearance of the base search dialog\n" + "Its only action is to close." + } + +_scrolled_list_spec = { + 'file': 'scrolledlist', + 'kwds': {}, + 'msg': "You should see a scrollable list of items\n" + "Selecting (clicking) or double clicking an item " + "prints the name to the console or Idle shell.\n" + "Right clicking an item will display a popup." + } + +show_idlehelp_spec = { + 'file': 'help', + 'kwds': {}, + 'msg': "If the help text displays, this works.\n" + "Text is selectable. Window is scrollable." + } + +_stack_viewer_spec = { + 'file': 'stackviewer', + 'kwds': {}, + 'msg': "A stacktrace for a NameError exception.\n" + "Expand 'idlelib ...' and ''.\n" + "Check that exc_value, exc_tb, and exc_type are correct.\n" + } + +_tooltip_spec = { + 'file': 'tooltip', + 'kwds': {}, + 'msg': "Place mouse cursor over both the buttons\n" + "A tooltip should appear with some text." + } + +_tree_widget_spec = { + 'file': 'tree', + 'kwds': {}, + 'msg': "The canvas is scrollable.\n" + "Click on folders up to to the lowest level." + } + +_undo_delegator_spec = { + 'file': 'undo', + 'kwds': {}, + 'msg': "Click [Undo] to undo any action.\n" + "Click [Redo] to redo any action.\n" + "Click [Dump] to dump the current state " + "by printing to the console or the IDLE shell.\n" + } + +ViewWindow_spec = { + 'file': 'textview', + 'kwds': {'title': 'Test textview', + 'contents': 'The quick brown fox jumps over the lazy dog.\n'*35, + '_htest': True}, + 'msg': "Test for read-only property of text.\n" + "Select text, scroll window, close" + } + +_widget_redirector_spec = { + 'file': 'redirector', + 'kwds': {}, + 'msg': "Every text insert should be printed to the console " + "or the IDLE shell." + } + +def run(*tests): + root = tk.Tk() + root.title('IDLE htest') + root.resizable(0, 0) + + # a scrollable Label like constant width text widget. + frameLabel = tk.Frame(root, padx=10) + frameLabel.pack() + text = tk.Text(frameLabel, wrap='word') + text.configure(bg=root.cget('bg'), relief='flat', height=4, width=70) + scrollbar = Scrollbar(frameLabel, command=text.yview) + text.config(yscrollcommand=scrollbar.set) + scrollbar.pack(side='right', fill='y', expand=False) + text.pack(side='left', fill='both', expand=True) + + test_list = [] # List of tuples of the form (spec, callable widget) + if tests: + for test in tests: + test_spec = globals()[test.__name__ + '_spec'] + test_spec['name'] = test.__name__ + test_list.append((test_spec, test)) + else: + for k, d in globals().items(): + if k.endswith('_spec'): + test_name = k[:-5] + test_spec = d + test_spec['name'] = test_name + mod = import_module('idlelib.' + test_spec['file']) + test = getattr(mod, test_name) + test_list.append((test_spec, test)) + + test_name = tk.StringVar(root) + callable_object = None + test_kwds = None + + def next_test(): + + nonlocal test_name, callable_object, test_kwds + if len(test_list) == 1: + next_button.pack_forget() + test_spec, callable_object = test_list.pop() + test_kwds = test_spec['kwds'] + test_kwds['parent'] = root + test_name.set('Test ' + test_spec['name']) + + text.configure(state='normal') # enable text editing + text.delete('1.0','end') + text.insert("1.0",test_spec['msg']) + text.configure(state='disabled') # preserve read-only property + + def run_test(_=None): + widget = callable_object(**test_kwds) + try: + print(widget.result) + except AttributeError: + pass + + def close(_=None): + root.destroy() + + button = tk.Button(root, textvariable=test_name, + default='active', command=run_test) + next_button = tk.Button(root, text="Next", command=next_test) + button.pack() + next_button.pack() + next_button.focus_set() + root.bind('', run_test) + root.bind('', close) + + next_test() + root.mainloop() + +if __name__ == '__main__': + run() diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_calltip.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_calltip.py new file mode 100644 index 0000000000000000000000000000000000000000..e8d2bd17cb681170e7dbbe57d571ff4007b6db87 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_calltip.py @@ -0,0 +1,363 @@ +"Test calltip, coverage 76%" + +from idlelib import calltip +import unittest +from unittest.mock import Mock +import textwrap +import types +import re +from idlelib.idle_test.mock_tk import Text + + +# Test Class TC is used in multiple get_argspec test methods +class TC: + 'doc' + tip = "(ai=None, *b)" + def __init__(self, ai=None, *b): 'doc' + __init__.tip = "(self, ai=None, *b)" + def t1(self): 'doc' + t1.tip = "(self)" + def t2(self, ai, b=None): 'doc' + t2.tip = "(self, ai, b=None)" + def t3(self, ai, *args): 'doc' + t3.tip = "(self, ai, *args)" + def t4(self, *args): 'doc' + t4.tip = "(self, *args)" + def t5(self, ai, b=None, *args, **kw): 'doc' + t5.tip = "(self, ai, b=None, *args, **kw)" + def t6(no, self): 'doc' + t6.tip = "(no, self)" + def __call__(self, ci): 'doc' + __call__.tip = "(self, ci)" + def nd(self): pass # No doc. + # attaching .tip to wrapped methods does not work + @classmethod + def cm(cls, a): 'doc' + @staticmethod + def sm(b): 'doc' + + +tc = TC() +default_tip = calltip._default_callable_argspec +get_spec = calltip.get_argspec + + +class Get_argspecTest(unittest.TestCase): + # The get_spec function must return a string, even if blank. + # Test a variety of objects to be sure that none cause it to raise + # (quite aside from getting as correct an answer as possible). + # The tests of builtins may break if inspect or the docstrings change, + # but a red buildbot is better than a user crash (as has happened). + # For a simple mismatch, change the expected output to the actual. + + def test_builtins(self): + + def tiptest(obj, out): + self.assertEqual(get_spec(obj), out) + + # Python class that inherits builtin methods + class List(list): "List() doc" + + # Simulate builtin with no docstring for default tip test + class SB: __call__ = None + + if List.__doc__ is not None: + tiptest(List, + f'(iterable=(), /)' + f'\n{List.__doc__}') + tiptest(list.__new__, + '(*args, **kwargs)\n' + 'Create and return a new object. ' + 'See help(type) for accurate signature.') + tiptest(list.__init__, + '(self, /, *args, **kwargs)\n' + 'Initialize self. See help(type(self)) for accurate signature.') + append_doc = "\nAppend object to the end of the list." + tiptest(list.append, '(self, object, /)' + append_doc) + tiptest(List.append, '(self, object, /)' + append_doc) + tiptest([].append, '(object, /)' + append_doc) + + tiptest(types.MethodType, "method(function, instance)") + tiptest(SB(), default_tip) + + p = re.compile('') + tiptest(re.sub, '''\ +(pattern, repl, string, count=0, flags=0) +Return the string obtained by replacing the leftmost +non-overlapping occurrences of the pattern in string by the +replacement repl. repl can be either a string or a callable; +if a string, backslash escapes in it are processed. If it is +a callable, it's passed the Match object and must return''') + tiptest(p.sub, '''\ +(repl, string, count=0) +Return the string obtained by replacing the leftmost \ +non-overlapping occurrences o...''') + + def test_signature_wrap(self): + if textwrap.TextWrapper.__doc__ is not None: + self.assertEqual(get_spec(textwrap.TextWrapper), '''\ +(width=70, initial_indent='', subsequent_indent='', expand_tabs=True, + replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, + drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, + placeholder=' [...]') +Object for wrapping/filling text. The public interface consists of +the wrap() and fill() methods; the other methods are just there for +subclasses to override in order to tweak the default behaviour. +If you want to completely replace the main wrapping algorithm, +you\'ll probably have to override _wrap_chunks().''') + + def test_properly_formatted(self): + + def foo(s='a'*100): + pass + + def bar(s='a'*100): + """Hello Guido""" + pass + + def baz(s='a'*100, z='b'*100): + pass + + indent = calltip._INDENT + + sfoo = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\ + "aaaaaaaaaa')" + sbar = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\ + "aaaaaaaaaa')\nHello Guido" + sbaz = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\ + "aaaaaaaaaa', z='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"\ + "bbbbbbbbbbbbbbbbb\n" + indent + "bbbbbbbbbbbbbbbbbbbbbb"\ + "bbbbbbbbbbbbbbbbbbbbbb')" + + for func,doc in [(foo, sfoo), (bar, sbar), (baz, sbaz)]: + with self.subTest(func=func, doc=doc): + self.assertEqual(get_spec(func), doc) + + def test_docline_truncation(self): + def f(): pass + f.__doc__ = 'a'*300 + self.assertEqual(get_spec(f), f"()\n{'a'*(calltip._MAX_COLS-3) + '...'}") + + def test_multiline_docstring(self): + # Test fewer lines than max. + self.assertEqual(get_spec(range), + "range(stop) -> range object\n" + "range(start, stop[, step]) -> range object") + + # Test max lines + self.assertEqual(get_spec(bytes), '''\ +bytes(iterable_of_ints) -> bytes +bytes(string, encoding[, errors]) -> bytes +bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer +bytes(int) -> bytes object of size given by the parameter initialized with null bytes +bytes() -> empty bytes object''') + + # Test more than max lines + def f(): pass + f.__doc__ = 'a\n' * 15 + self.assertEqual(get_spec(f), '()' + '\na' * calltip._MAX_LINES) + + def test_functions(self): + def t1(): 'doc' + t1.tip = "()" + def t2(a, b=None): 'doc' + t2.tip = "(a, b=None)" + def t3(a, *args): 'doc' + t3.tip = "(a, *args)" + def t4(*args): 'doc' + t4.tip = "(*args)" + def t5(a, b=None, *args, **kw): 'doc' + t5.tip = "(a, b=None, *args, **kw)" + + doc = '\ndoc' if t1.__doc__ is not None else '' + for func in (t1, t2, t3, t4, t5, TC): + with self.subTest(func=func): + self.assertEqual(get_spec(func), func.tip + doc) + + def test_methods(self): + doc = '\ndoc' if TC.__doc__ is not None else '' + for meth in (TC.t1, TC.t2, TC.t3, TC.t4, TC.t5, TC.t6, TC.__call__): + with self.subTest(meth=meth): + self.assertEqual(get_spec(meth), meth.tip + doc) + self.assertEqual(get_spec(TC.cm), "(a)" + doc) + self.assertEqual(get_spec(TC.sm), "(b)" + doc) + + def test_bound_methods(self): + # test that first parameter is correctly removed from argspec + doc = '\ndoc' if TC.__doc__ is not None else '' + for meth, mtip in ((tc.t1, "()"), (tc.t4, "(*args)"), + (tc.t6, "(self)"), (tc.__call__, '(ci)'), + (tc, '(ci)'), (TC.cm, "(a)"),): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip + doc) + + def test_starred_parameter(self): + # test that starred first parameter is *not* removed from argspec + class C: + def m1(*args): pass + c = C() + for meth, mtip in ((C.m1, '(*args)'), (c.m1, "(*args)"),): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip) + + def test_invalid_method_get_spec(self): + class C: + def m2(**kwargs): pass + class Test: + def __call__(*, a): pass + + mtip = calltip._invalid_method + self.assertEqual(get_spec(C().m2), mtip) + self.assertEqual(get_spec(Test()), mtip) + + def test_non_ascii_name(self): + # test that re works to delete a first parameter name that + # includes non-ascii chars, such as various forms of A. + uni = "(A\u0391\u0410\u05d0\u0627\u0905\u1e00\u3042, a)" + assert calltip._first_param.sub('', uni) == '(a)' + + def test_no_docstring(self): + for meth, mtip in ((TC.nd, "(self)"), (tc.nd, "()")): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip) + + def test_buggy_getattr_class(self): + class NoCall: + def __getattr__(self, name): # Not invoked for class attribute. + raise IndexError # Bug. + class CallA(NoCall): + def __call__(self, ci): # Bug does not matter. + pass + class CallB(NoCall): + def __call__(oui, a, b, c): # Non-standard 'self'. + pass + + for meth, mtip in ((NoCall, default_tip), (CallA, default_tip), + (NoCall(), ''), (CallA(), '(ci)'), + (CallB(), '(a, b, c)')): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip) + + def test_metaclass_class(self): # Failure case for issue 38689. + class Type(type): # Type() requires 3 type args, returns class. + __class__ = property({}.__getitem__, {}.__setitem__) + class Object(metaclass=Type): + __slots__ = '__class__' + for meth, mtip in ((Type, get_spec(type)), (Object, default_tip), + (Object(), '')): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip) + + def test_non_callables(self): + for obj in (0, 0.0, '0', b'0', [], {}): + with self.subTest(obj=obj): + self.assertEqual(get_spec(obj), '') + + +class Get_entityTest(unittest.TestCase): + def test_bad_entity(self): + self.assertIsNone(calltip.get_entity('1/0')) + def test_good_entity(self): + self.assertIs(calltip.get_entity('int'), int) + + +# Test the 9 Calltip methods. +# open_calltip is about half the code; the others are fairly trivial. +# The default mocks are what are needed for open_calltip. + +class mock_Shell: + "Return mock sufficient to pass to hyperparser." + def __init__(self, text): + text.tag_prevrange = Mock(return_value=None) + self.text = text + self.prompt_last_line = ">>> " + self.indentwidth = 4 + self.tabwidth = 8 + + +class mock_TipWindow: + def __init__(self): + pass + + def showtip(self, text, parenleft, parenright): + self.args = parenleft, parenright + self.parenline, self.parencol = map(int, parenleft.split('.')) + + +class WrappedCalltip(calltip.Calltip): + def _make_tk_calltip_window(self): + return mock_TipWindow() + + def remove_calltip_window(self, event=None): + if self.active_calltip: # Setup to None. + self.active_calltip = None + self.tips_removed += 1 # Setup to 0. + + def fetch_tip(self, expression): + return 'tip' + + +class CalltipTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.text = Text() + cls.ct = WrappedCalltip(mock_Shell(cls.text)) + + def setUp(self): + self.text.delete('1.0', 'end') # Insert and call + self.ct.active_calltip = None + # Test .active_calltip, +args + self.ct.tips_removed = 0 + + def open_close(self, testfunc): + # Open-close template with testfunc called in between. + opentip = self.ct.open_calltip + self.text.insert(1.0, 'f(') + opentip(False) + self.tip = self.ct.active_calltip + testfunc(self) ### + self.text.insert('insert', ')') + opentip(False) + self.assertIsNone(self.ct.active_calltip, None) + + def test_open_close(self): + def args(self): + self.assertEqual(self.tip.args, ('1.1', '1.end')) + self.open_close(args) + + def test_repeated_force(self): + def force(self): + for char in 'abc': + self.text.insert('insert', 'a') + self.ct.open_calltip(True) + self.ct.open_calltip(True) + self.assertIs(self.ct.active_calltip, self.tip) + self.open_close(force) + + def test_repeated_parens(self): + def parens(self): + for context in "a", "'": + with self.subTest(context=context): + self.text.insert('insert', context) + for char in '(()())': + self.text.insert('insert', char) + self.assertIs(self.ct.active_calltip, self.tip) + self.text.insert('insert', "'") + self.open_close(parens) + + def test_comment_parens(self): + def comment(self): + self.text.insert('insert', "# ") + for char in '(()())': + self.text.insert('insert', char) + self.assertIs(self.ct.active_calltip, self.tip) + self.text.insert('insert', "\n") + self.open_close(comment) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_config_key.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_config_key.py new file mode 100644 index 0000000000000000000000000000000000000000..32f878b842b276dc892c0606503d4fb8abde2180 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_config_key.py @@ -0,0 +1,356 @@ +"""Test config_key, coverage 98%. + +Coverage is effectively 100%. Tkinter dialog is mocked, Mac-only line +may be skipped, and dummy function in bind test should not be called. +Not tested: exit with 'self.advanced or self.keys_ok(keys) ...' False. +""" + +from idlelib import config_key +from test.support import requires +import unittest +from unittest import mock +from tkinter import Tk, TclError +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Mbox_func + + +class ValidationTest(unittest.TestCase): + "Test validation methods: ok, keys_ok, bind_ok." + + class Validator(config_key.GetKeysFrame): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + class list_keys_final: + get = Func() + self.list_keys_final = list_keys_final + get_modifiers = Func() + showerror = Mbox_func() + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + keylist = [[''], ['', '']] + cls.dialog = cls.Validator(cls.root, '<>', keylist) + + @classmethod + def tearDownClass(cls): + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.dialog.showerror.message = '' + # A test that needs a particular final key value should set it. + # A test that sets a non-blank modifier list should reset it to []. + + def test_ok_empty(self): + self.dialog.key_string.set(' ') + self.dialog.ok() + self.assertEqual(self.dialog.result, '') + self.assertEqual(self.dialog.showerror.message, 'No key specified.') + + def test_ok_good(self): + self.dialog.key_string.set('') + self.dialog.list_keys_final.get.result = 'F11' + self.dialog.ok() + self.assertEqual(self.dialog.result, '') + self.assertEqual(self.dialog.showerror.message, '') + + def test_keys_no_ending(self): + self.assertFalse(self.dialog.keys_ok('')) + self.assertIn('No modifier', self.dialog.showerror.message) + + def test_keys_no_modifier_ok(self): + self.dialog.list_keys_final.get.result = 'F11' + self.assertTrue(self.dialog.keys_ok('')) + self.assertEqual(self.dialog.showerror.message, '') + + def test_keys_shift_bad(self): + self.dialog.list_keys_final.get.result = 'a' + self.dialog.get_modifiers.result = ['Shift'] + self.assertFalse(self.dialog.keys_ok('')) + self.assertIn('shift modifier', self.dialog.showerror.message) + self.dialog.get_modifiers.result = [] + + def test_keys_dup(self): + for mods, final, seq in (([], 'F12', ''), + (['Control'], 'x', ''), + (['Control'], 'X', '')): + with self.subTest(m=mods, f=final, s=seq): + self.dialog.list_keys_final.get.result = final + self.dialog.get_modifiers.result = mods + self.assertFalse(self.dialog.keys_ok(seq)) + self.assertIn('already in use', self.dialog.showerror.message) + self.dialog.get_modifiers.result = [] + + def test_bind_ok(self): + self.assertTrue(self.dialog.bind_ok('')) + self.assertEqual(self.dialog.showerror.message, '') + + def test_bind_not_ok(self): + self.assertFalse(self.dialog.bind_ok('')) + self.assertIn('not accepted', self.dialog.showerror.message) + + +class ToggleLevelTest(unittest.TestCase): + "Test toggle between Basic and Advanced frames." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = config_key.GetKeysFrame(cls.root, '<>', []) + + @classmethod + def tearDownClass(cls): + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_toggle_level(self): + dialog = self.dialog + + def stackorder(): + """Get the stack order of the children of the frame. + + winfo_children() stores the children in stack order, so + this can be used to check whether a frame is above or + below another one. + """ + for index, child in enumerate(dialog.winfo_children()): + if child._name == 'keyseq_basic': + basic = index + if child._name == 'keyseq_advanced': + advanced = index + return basic, advanced + + # New window starts at basic level. + self.assertFalse(dialog.advanced) + self.assertIn('Advanced', dialog.button_level['text']) + basic, advanced = stackorder() + self.assertGreater(basic, advanced) + + # Toggle to advanced. + dialog.toggle_level() + self.assertTrue(dialog.advanced) + self.assertIn('Basic', dialog.button_level['text']) + basic, advanced = stackorder() + self.assertGreater(advanced, basic) + + # Toggle to basic. + dialog.button_level.invoke() + self.assertFalse(dialog.advanced) + self.assertIn('Advanced', dialog.button_level['text']) + basic, advanced = stackorder() + self.assertGreater(basic, advanced) + + +class KeySelectionTest(unittest.TestCase): + "Test selecting key on Basic frames." + + class Basic(config_key.GetKeysFrame): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + class list_keys_final: + get = Func() + select_clear = Func() + yview = Func() + self.list_keys_final = list_keys_final + def set_modifiers_for_platform(self): + self.modifiers = ['foo', 'bar', 'BAZ'] + self.modifier_label = {'BAZ': 'ZZZ'} + showerror = Mbox_func() + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = cls.Basic(cls.root, '<>', []) + + @classmethod + def tearDownClass(cls): + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.dialog.clear_key_seq() + + def test_get_modifiers(self): + dialog = self.dialog + gm = dialog.get_modifiers + eq = self.assertEqual + + # Modifiers are set on/off by invoking the checkbutton. + dialog.modifier_checkbuttons['foo'].invoke() + eq(gm(), ['foo']) + + dialog.modifier_checkbuttons['BAZ'].invoke() + eq(gm(), ['foo', 'BAZ']) + + dialog.modifier_checkbuttons['foo'].invoke() + eq(gm(), ['BAZ']) + + @mock.patch.object(config_key.GetKeysFrame, 'get_modifiers') + def test_build_key_string(self, mock_modifiers): + dialog = self.dialog + key = dialog.list_keys_final + string = dialog.key_string.get + eq = self.assertEqual + + key.get.result = 'a' + mock_modifiers.return_value = [] + dialog.build_key_string() + eq(string(), '') + + mock_modifiers.return_value = ['mymod'] + dialog.build_key_string() + eq(string(), '') + + key.get.result = '' + mock_modifiers.return_value = ['mymod', 'test'] + dialog.build_key_string() + eq(string(), '') + + @mock.patch.object(config_key.GetKeysFrame, 'get_modifiers') + def test_final_key_selected(self, mock_modifiers): + dialog = self.dialog + key = dialog.list_keys_final + string = dialog.key_string.get + eq = self.assertEqual + + mock_modifiers.return_value = ['Shift'] + key.get.result = '{' + dialog.final_key_selected() + eq(string(), '') + + +class CancelWindowTest(unittest.TestCase): + "Simulate user clicking [Cancel] button." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = config_key.GetKeysWindow( + cls.root, 'Title', '<>', [], _utest=True) + + @classmethod + def tearDownClass(cls): + cls.dialog.cancel() + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + @mock.patch.object(config_key.GetKeysFrame, 'ok') + def test_cancel(self, mock_frame_ok): + self.assertEqual(self.dialog.winfo_class(), 'Toplevel') + self.dialog.button_cancel.invoke() + with self.assertRaises(TclError): + self.dialog.winfo_class() + self.assertEqual(self.dialog.result, '') + mock_frame_ok.assert_not_called() + + +class OKWindowTest(unittest.TestCase): + "Simulate user clicking [OK] button." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = config_key.GetKeysWindow( + cls.root, 'Title', '<>', [], _utest=True) + + @classmethod + def tearDownClass(cls): + cls.dialog.cancel() + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + @mock.patch.object(config_key.GetKeysFrame, 'ok') + def test_ok(self, mock_frame_ok): + self.assertEqual(self.dialog.winfo_class(), 'Toplevel') + self.dialog.button_ok.invoke() + with self.assertRaises(TclError): + self.dialog.winfo_class() + mock_frame_ok.assert_called() + + +class WindowResultTest(unittest.TestCase): + "Test window result get and set." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = config_key.GetKeysWindow( + cls.root, 'Title', '<>', [], _utest=True) + + @classmethod + def tearDownClass(cls): + cls.dialog.cancel() + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_result(self): + dialog = self.dialog + eq = self.assertEqual + + dialog.result = '' + eq(dialog.result, '') + eq(dialog.frame.result,'') + + dialog.result = 'bar' + eq(dialog.result,'bar') + eq(dialog.frame.result,'bar') + + dialog.frame.result = 'foo' + eq(dialog.result, 'foo') + eq(dialog.frame.result,'foo') + + +class HelperTest(unittest.TestCase): + "Test module level helper functions." + + def test_translate_key(self): + tr = config_key.translate_key + eq = self.assertEqual + + # Letters return unchanged with no 'Shift'. + eq(tr('q', []), 'Key-q') + eq(tr('q', ['Control', 'Alt']), 'Key-q') + + # 'Shift' uppercases single lowercase letters. + eq(tr('q', ['Shift']), 'Key-Q') + eq(tr('q', ['Control', 'Shift']), 'Key-Q') + eq(tr('q', ['Control', 'Alt', 'Shift']), 'Key-Q') + + # Convert key name to keysym. + eq(tr('Page Up', []), 'Key-Prior') + # 'Shift' doesn't change case when it's not a single char. + eq(tr('*', ['Shift']), 'Key-asterisk') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_debugger.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_debugger.py new file mode 100644 index 0000000000000000000000000000000000000000..35efb3411c73b546d67a30bc1907a7eb912b30d7 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_debugger.py @@ -0,0 +1,29 @@ +"Test debugger, coverage 19%" + +from idlelib import debugger +import unittest +from test.support import requires +requires('gui') +from tkinter import Tk + + +class NameSpaceTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def test_init(self): + debugger.NamespaceViewer(self.root, 'Test') + + +# Other classes are Idb, Debugger, and StackViewer. + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_debugobj_r.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_debugobj_r.py new file mode 100644 index 0000000000000000000000000000000000000000..86e51b6cb2cb22d31aa9c4a1d8cc5b713b8eec34 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_debugobj_r.py @@ -0,0 +1,22 @@ +"Test debugobj_r, coverage 56%." + +from idlelib import debugobj_r +import unittest + + +class WrappedObjectTreeItemTest(unittest.TestCase): + + def test_getattr(self): + ti = debugobj_r.WrappedObjectTreeItem(list) + self.assertEqual(ti.append, list.append) + +class StubObjectTreeItemTest(unittest.TestCase): + + def test_init(self): + ti = debugobj_r.StubObjectTreeItem('socket', 1111) + self.assertEqual(ti.sockio, 'socket') + self.assertEqual(ti.oid, 1111) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_delegator.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_delegator.py new file mode 100644 index 0000000000000000000000000000000000000000..922416297a42e028bc0db33fb1f5195190b29f6e --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_delegator.py @@ -0,0 +1,44 @@ +"Test delegator, coverage 100%." + +from idlelib.delegator import Delegator +import unittest + + +class DelegatorTest(unittest.TestCase): + + def test_mydel(self): + # Test a simple use scenario. + + # Initialize an int delegator. + mydel = Delegator(int) + self.assertIs(mydel.delegate, int) + self.assertEqual(mydel._Delegator__cache, set()) + # Trying to access a non-attribute of int fails. + self.assertRaises(AttributeError, mydel.__getattr__, 'xyz') + + # Add real int attribute 'bit_length' by accessing it. + bl = mydel.bit_length + self.assertIs(bl, int.bit_length) + self.assertIs(mydel.__dict__['bit_length'], int.bit_length) + self.assertEqual(mydel._Delegator__cache, {'bit_length'}) + + # Add attribute 'numerator'. + mydel.numerator + self.assertEqual(mydel._Delegator__cache, {'bit_length', 'numerator'}) + + # Delete 'numerator'. + del mydel.numerator + self.assertNotIn('numerator', mydel.__dict__) + # The current implementation leaves it in the name cache. + # self.assertIn('numerator', mydel._Delegator__cache) + # However, this is not required and not part of the specification + + # Change delegate to float, first resetting the attributes. + mydel.setdelegate(float) # calls resetcache + self.assertNotIn('bit_length', mydel.__dict__) + self.assertEqual(mydel._Delegator__cache, set()) + self.assertIs(mydel.delegate, float) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_history.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_history.py new file mode 100644 index 0000000000000000000000000000000000000000..675396514447514ff9c6811d095fe054fef589b0 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_history.py @@ -0,0 +1,172 @@ +" Test history, coverage 100%." + +from idlelib.history import History +import unittest +from test.support import requires + +import tkinter as tk +from tkinter import Text as tkText +from idlelib.idle_test.mock_tk import Text as mkText +from idlelib.config import idleConf + +line1 = 'a = 7' +line2 = 'b = a' + + +class StoreTest(unittest.TestCase): + '''Tests History.__init__ and History.store with mock Text''' + + @classmethod + def setUpClass(cls): + cls.text = mkText() + cls.history = History(cls.text) + + def tearDown(self): + self.text.delete('1.0', 'end') + self.history.history = [] + + def test_init(self): + self.assertIs(self.history.text, self.text) + self.assertEqual(self.history.history, []) + self.assertIsNone(self.history.prefix) + self.assertIsNone(self.history.pointer) + self.assertEqual(self.history.cyclic, + idleConf.GetOption("main", "History", "cyclic", 1, "bool")) + + def test_store_short(self): + self.history.store('a') + self.assertEqual(self.history.history, []) + self.history.store(' a ') + self.assertEqual(self.history.history, []) + + def test_store_dup(self): + self.history.store(line1) + self.assertEqual(self.history.history, [line1]) + self.history.store(line2) + self.assertEqual(self.history.history, [line1, line2]) + self.history.store(line1) + self.assertEqual(self.history.history, [line2, line1]) + + def test_store_reset(self): + self.history.prefix = line1 + self.history.pointer = 0 + self.history.store(line2) + self.assertIsNone(self.history.prefix) + self.assertIsNone(self.history.pointer) + + +class TextWrapper: + def __init__(self, master): + self.text = tkText(master=master) + self._bell = False + def __getattr__(self, name): + return getattr(self.text, name) + def bell(self): + self._bell = True + + +class FetchTest(unittest.TestCase): + '''Test History.fetch with wrapped tk.Text. + ''' + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = tk.Tk() + cls.root.withdraw() + + def setUp(self): + self.text = text = TextWrapper(self.root) + text.insert('1.0', ">>> ") + text.mark_set('iomark', '1.4') + text.mark_gravity('iomark', 'left') + self.history = History(text) + self.history.history = [line1, line2] + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def fetch_test(self, reverse, line, prefix, index, *, bell=False): + # Perform one fetch as invoked by Alt-N or Alt-P + # Test the result. The line test is the most important. + # The last two are diagnostic of fetch internals. + History = self.history + History.fetch(reverse) + + Equal = self.assertEqual + Equal(self.text.get('iomark', 'end-1c'), line) + Equal(self.text._bell, bell) + if bell: + self.text._bell = False + Equal(History.prefix, prefix) + Equal(History.pointer, index) + Equal(self.text.compare("insert", '==', "end-1c"), 1) + + def test_fetch_prev_cyclic(self): + prefix = '' + test = self.fetch_test + test(True, line2, prefix, 1) + test(True, line1, prefix, 0) + test(True, prefix, None, None, bell=True) + + def test_fetch_next_cyclic(self): + prefix = '' + test = self.fetch_test + test(False, line1, prefix, 0) + test(False, line2, prefix, 1) + test(False, prefix, None, None, bell=True) + + # Prefix 'a' tests skip line2, which starts with 'b' + def test_fetch_prev_prefix(self): + prefix = 'a' + self.text.insert('iomark', prefix) + self.fetch_test(True, line1, prefix, 0) + self.fetch_test(True, prefix, None, None, bell=True) + + def test_fetch_next_prefix(self): + prefix = 'a' + self.text.insert('iomark', prefix) + self.fetch_test(False, line1, prefix, 0) + self.fetch_test(False, prefix, None, None, bell=True) + + def test_fetch_prev_noncyclic(self): + prefix = '' + self.history.cyclic = False + test = self.fetch_test + test(True, line2, prefix, 1) + test(True, line1, prefix, 0) + test(True, line1, prefix, 0, bell=True) + + def test_fetch_next_noncyclic(self): + prefix = '' + self.history.cyclic = False + test = self.fetch_test + test(False, prefix, None, None, bell=True) + test(True, line2, prefix, 1) + test(False, prefix, None, None, bell=True) + test(False, prefix, None, None, bell=True) + + def test_fetch_cursor_move(self): + # Move cursor after fetch + self.history.fetch(reverse=True) # initialization + self.text.mark_set('insert', 'iomark') + self.fetch_test(True, line2, None, None, bell=True) + + def test_fetch_edit(self): + # Edit after fetch + self.history.fetch(reverse=True) # initialization + self.text.delete('iomark', 'insert', ) + self.text.insert('iomark', 'a =') + self.fetch_test(True, line1, 'a =', 0) # prefix is reset + + def test_history_prev_next(self): + # Minimally test functions bound to events + self.history.history_prev('dummy event') + self.assertEqual(self.history.pointer, 1) + self.history.history_next('dummy event') + self.assertEqual(self.history.pointer, None) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_outwin.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_outwin.py new file mode 100644 index 0000000000000000000000000000000000000000..e347bfca7f191a4a64210a9d6e006753385be2b5 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_outwin.py @@ -0,0 +1,166 @@ +"Test outwin, coverage 76%." + +from idlelib import outwin +import unittest +from test.support import requires +from tkinter import Tk, Text +from idlelib.idle_test.mock_tk import Mbox_func +from idlelib.idle_test.mock_idle import Func +from unittest import mock + + +class OutputWindowTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + root = cls.root = Tk() + root.withdraw() + w = cls.window = outwin.OutputWindow(None, None, None, root) + cls.text = w.text = Text(root) + + @classmethod + def tearDownClass(cls): + cls.window.close() + del cls.text, cls.window + cls.root.destroy() + del cls.root + + def setUp(self): + self.text.delete('1.0', 'end') + + def test_ispythonsource(self): + # OutputWindow overrides ispythonsource to always return False. + w = self.window + self.assertFalse(w.ispythonsource('test.txt')) + self.assertFalse(w.ispythonsource(__file__)) + + def test_window_title(self): + self.assertEqual(self.window.top.title(), 'Output') + + def test_maybesave(self): + w = self.window + eq = self.assertEqual + w.get_saved = Func() + + w.get_saved.result = False + eq(w.maybesave(), 'no') + eq(w.get_saved.called, 1) + + w.get_saved.result = True + eq(w.maybesave(), 'yes') + eq(w.get_saved.called, 2) + del w.get_saved + + def test_write(self): + eq = self.assertEqual + delete = self.text.delete + get = self.text.get + write = self.window.write + + # No new line - insert stays on same line. + delete('1.0', 'end') + test_text = 'test text' + eq(write(test_text), len(test_text)) + eq(get('1.0', '1.end'), 'test text') + eq(get('insert linestart', 'insert lineend'), 'test text') + + # New line - insert moves to next line. + delete('1.0', 'end') + test_text = 'test text\n' + eq(write(test_text), len(test_text)) + eq(get('1.0', '1.end'), 'test text') + eq(get('insert linestart', 'insert lineend'), '') + + # Text after new line is tagged for second line of Text widget. + delete('1.0', 'end') + test_text = 'test text\nLine 2' + eq(write(test_text), len(test_text)) + eq(get('1.0', '1.end'), 'test text') + eq(get('2.0', '2.end'), 'Line 2') + eq(get('insert linestart', 'insert lineend'), 'Line 2') + + # Test tags. + delete('1.0', 'end') + test_text = 'test text\n' + test_text2 = 'Line 2\n' + eq(write(test_text, tags='mytag'), len(test_text)) + eq(write(test_text2, tags='secondtag'), len(test_text2)) + eq(get('mytag.first', 'mytag.last'), test_text) + eq(get('secondtag.first', 'secondtag.last'), test_text2) + eq(get('1.0', '1.end'), test_text.rstrip('\n')) + eq(get('2.0', '2.end'), test_text2.rstrip('\n')) + + def test_writelines(self): + eq = self.assertEqual + get = self.text.get + writelines = self.window.writelines + + writelines(('Line 1\n', 'Line 2\n', 'Line 3\n')) + eq(get('1.0', '1.end'), 'Line 1') + eq(get('2.0', '2.end'), 'Line 2') + eq(get('3.0', '3.end'), 'Line 3') + eq(get('insert linestart', 'insert lineend'), '') + + def test_goto_file_line(self): + eq = self.assertEqual + w = self.window + text = self.text + + w.flist = mock.Mock() + gfl = w.flist.gotofileline = Func() + showerror = w.showerror = Mbox_func() + + # No file/line number. + w.write('Not a file line') + self.assertIsNone(w.goto_file_line()) + eq(gfl.called, 0) + eq(showerror.title, 'No special line') + + # Current file/line number. + w.write(f'{str(__file__)}: 42: spam\n') + w.write(f'{str(__file__)}: 21: spam') + self.assertIsNone(w.goto_file_line()) + eq(gfl.args, (str(__file__), 21)) + + # Previous line has file/line number. + text.delete('1.0', 'end') + w.write(f'{str(__file__)}: 42: spam\n') + w.write('Not a file line') + self.assertIsNone(w.goto_file_line()) + eq(gfl.args, (str(__file__), 42)) + + del w.flist.gotofileline, w.showerror + + +class ModuleFunctionTest(unittest.TestCase): + + @classmethod + def setUp(cls): + outwin.file_line_progs = None + + def test_compile_progs(self): + outwin.compile_progs() + for pat, regex in zip(outwin.file_line_pats, outwin.file_line_progs): + self.assertEqual(regex.pattern, pat) + + @mock.patch('builtins.open') + def test_file_line_helper(self, mock_open): + flh = outwin.file_line_helper + test_lines = ( + (r'foo file "testfile1", line 42, bar', ('testfile1', 42)), + (r'foo testfile2(21) bar', ('testfile2', 21)), + (r' testfile3 : 42: foo bar\n', (' testfile3 ', 42)), + (r'foo testfile4.py :1: ', ('foo testfile4.py ', 1)), + ('testfile5: \u19D4\u19D2: ', ('testfile5', 42)), + (r'testfile6: 42', None), # only one `:` + (r'testfile7 42 text', None) # no separators + ) + for line, expected_output in test_lines: + self.assertEqual(flh(line), expected_output) + if expected_output: + mock_open.assert_called_with(expected_output[0], 'r') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_pathbrowser.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_pathbrowser.py new file mode 100644 index 0000000000000000000000000000000000000000..13d8b9e1ba9572afeefc20b2bf0f6b7bf3a50716 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_pathbrowser.py @@ -0,0 +1,86 @@ +"Test pathbrowser, coverage 95%." + +from idlelib import pathbrowser +import unittest +from test.support import requires +from tkinter import Tk + +import os.path +import pyclbr # for _modules +import sys # for sys.path + +from idlelib.idle_test.mock_idle import Func +import idlelib # for __file__ +from idlelib import browser +from idlelib.tree import TreeNode + + +class PathBrowserTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.pb = pathbrowser.PathBrowser(cls.root, _utest=True) + + @classmethod + def tearDownClass(cls): + cls.pb.close() + cls.root.update_idletasks() + cls.root.destroy() + del cls.root, cls.pb + + def test_init(self): + pb = self.pb + eq = self.assertEqual + eq(pb.master, self.root) + eq(pyclbr._modules, {}) + self.assertIsInstance(pb.node, TreeNode) + self.assertIsNotNone(browser.file_open) + + def test_settitle(self): + pb = self.pb + self.assertEqual(pb.top.title(), 'Path Browser') + self.assertEqual(pb.top.iconname(), 'Path Browser') + + def test_rootnode(self): + pb = self.pb + rn = pb.rootnode() + self.assertIsInstance(rn, pathbrowser.PathBrowserTreeItem) + + def test_close(self): + pb = self.pb + pb.top.destroy = Func() + pb.node.destroy = Func() + pb.close() + self.assertTrue(pb.top.destroy.called) + self.assertTrue(pb.node.destroy.called) + del pb.top.destroy, pb.node.destroy + + +class DirBrowserTreeItemTest(unittest.TestCase): + + def test_DirBrowserTreeItem(self): + # Issue16226 - make sure that getting a sublist works + d = pathbrowser.DirBrowserTreeItem('') + d.GetSubList() + self.assertEqual('', d.GetText()) + + dir = os.path.split(os.path.abspath(idlelib.__file__))[0] + self.assertEqual(d.ispackagedir(dir), True) + self.assertEqual(d.ispackagedir(dir + '/Icons'), False) + + +class PathBrowserTreeItemTest(unittest.TestCase): + + def test_PathBrowserTreeItem(self): + p = pathbrowser.PathBrowserTreeItem() + self.assertEqual(p.GetText(), 'sys.path') + sub = p.GetSubList() + self.assertEqual(len(sub), len(sys.path)) + self.assertEqual(type(sub[0]), pathbrowser.DirBrowserTreeItem) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=False) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_pyparse.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_pyparse.py new file mode 100644 index 0000000000000000000000000000000000000000..384db566ac76cdb44fb3c2998a989e848d56cd6c --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_pyparse.py @@ -0,0 +1,483 @@ +"Test pyparse, coverage 96%." + +from idlelib import pyparse +import unittest +from collections import namedtuple + + +class ParseMapTest(unittest.TestCase): + + def test_parsemap(self): + keepwhite = {ord(c): ord(c) for c in ' \t\n\r'} + mapping = pyparse.ParseMap(keepwhite) + self.assertEqual(mapping[ord('\t')], ord('\t')) + self.assertEqual(mapping[ord('a')], ord('x')) + self.assertEqual(mapping[1000], ord('x')) + + def test_trans(self): + # trans is the production instance of ParseMap, used in _study1 + parser = pyparse.Parser(4, 4) + self.assertEqual('\t a([{b}])b"c\'d\n'.translate(pyparse.trans), + 'xxx(((x)))x"x\'x\n') + + +class PyParseTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.parser = pyparse.Parser(indentwidth=4, tabwidth=4) + + @classmethod + def tearDownClass(cls): + del cls.parser + + def test_init(self): + self.assertEqual(self.parser.indentwidth, 4) + self.assertEqual(self.parser.tabwidth, 4) + + def test_set_code(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + + # Not empty and doesn't end with newline. + with self.assertRaises(AssertionError): + setcode('a') + + tests = ('', + 'a\n') + + for string in tests: + with self.subTest(string=string): + setcode(string) + eq(p.code, string) + eq(p.study_level, 0) + + def test_find_good_parse_start(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + start = p.find_good_parse_start + def char_in_string_false(index): return False + + # First line starts with 'def' and ends with ':', then 0 is the pos. + setcode('def spam():\n') + eq(start(char_in_string_false), 0) + + # First line begins with a keyword in the list and ends + # with an open brace, then 0 is the pos. This is how + # hyperparser calls this function as the newline is not added + # in the editor, but rather on the call to setcode. + setcode('class spam( ' + ' \n') + eq(start(char_in_string_false), 0) + + # Split def across lines. + setcode('"""This is a module docstring"""\n' + 'class C:\n' + ' def __init__(self, a,\n' + ' b=True):\n' + ' pass\n' + ) + pos0, pos = 33, 42 # Start of 'class...', ' def' lines. + + # Passing no value or non-callable should fail (issue 32989). + with self.assertRaises(TypeError): + start() + with self.assertRaises(TypeError): + start(False) + + # Make text look like a string. This returns pos as the start + # position, but it's set to None. + self.assertIsNone(start(is_char_in_string=lambda index: True)) + + # Make all text look like it's not in a string. This means that it + # found a good start position. + eq(start(char_in_string_false), pos) + + # If the beginning of the def line is not in a string, then it + # returns that as the index. + eq(start(is_char_in_string=lambda index: index > pos), pos) + # If the beginning of the def line is in a string, then it + # looks for a previous index. + eq(start(is_char_in_string=lambda index: index >= pos), pos0) + # If everything before the 'def' is in a string, then returns None. + # The non-continuation def line returns 44 (see below). + eq(start(is_char_in_string=lambda index: index < pos), None) + + # Code without extra line break in def line - mostly returns the same + # values. + setcode('"""This is a module docstring"""\n' + 'class C:\n' + ' def __init__(self, a, b=True):\n' + ' pass\n' + ) # Does not affect class, def positions. + eq(start(char_in_string_false), pos) + eq(start(is_char_in_string=lambda index: index > pos), pos) + eq(start(is_char_in_string=lambda index: index >= pos), pos0) + # When the def line isn't split, this returns which doesn't match the + # split line test. + eq(start(is_char_in_string=lambda index: index < pos), pos) + + def test_set_lo(self): + code = ( + '"""This is a module docstring"""\n' + 'class C:\n' + ' def __init__(self, a,\n' + ' b=True):\n' + ' pass\n' + ) + pos = 42 + p = self.parser + p.set_code(code) + + # Previous character is not a newline. + with self.assertRaises(AssertionError): + p.set_lo(5) + + # A value of 0 doesn't change self.code. + p.set_lo(0) + self.assertEqual(p.code, code) + + # An index that is preceded by a newline. + p.set_lo(pos) + self.assertEqual(p.code, code[pos:]) + + def test_study1(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + study = p._study1 + + (NONE, BACKSLASH, FIRST, NEXT, BRACKET) = range(5) + TestInfo = namedtuple('TestInfo', ['string', 'goodlines', + 'continuation']) + tests = ( + TestInfo('', [0], NONE), + # Docstrings. + TestInfo('"""This is a complete docstring."""\n', [0, 1], NONE), + TestInfo("'''This is a complete docstring.'''\n", [0, 1], NONE), + TestInfo('"""This is a continued docstring.\n', [0, 1], FIRST), + TestInfo("'''This is a continued docstring.\n", [0, 1], FIRST), + TestInfo('"""Closing quote does not match."\n', [0, 1], FIRST), + TestInfo('"""Bracket in docstring [\n', [0, 1], FIRST), + TestInfo("'''Incomplete two line docstring.\n\n", [0, 2], NEXT), + # Single-quoted strings. + TestInfo('"This is a complete string."\n', [0, 1], NONE), + TestInfo('"This is an incomplete string.\n', [0, 1], NONE), + TestInfo("'This is more incomplete.\n\n", [0, 1, 2], NONE), + # Comment (backslash does not continue comments). + TestInfo('# Comment\\\n', [0, 1], NONE), + # Brackets. + TestInfo('("""Complete string in bracket"""\n', [0, 1], BRACKET), + TestInfo('("""Open string in bracket\n', [0, 1], FIRST), + TestInfo('a = (1 + 2) - 5 *\\\n', [0, 1], BACKSLASH), # No bracket. + TestInfo('\n def function1(self, a,\n b):\n', + [0, 1, 3], NONE), + TestInfo('\n def function1(self, a,\\\n', [0, 1, 2], BRACKET), + TestInfo('\n def function1(self, a,\n', [0, 1, 2], BRACKET), + TestInfo('())\n', [0, 1], NONE), # Extra closer. + TestInfo(')(\n', [0, 1], BRACKET), # Extra closer. + # For the mismatched example, it doesn't look like continuation. + TestInfo('{)(]\n', [0, 1], NONE), # Mismatched. + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) # resets study_level + study() + eq(p.study_level, 1) + eq(p.goodlines, test.goodlines) + eq(p.continuation, test.continuation) + + # Called again, just returns without reprocessing. + self.assertIsNone(study()) + + def test_get_continuation_type(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + gettype = p.get_continuation_type + + (NONE, BACKSLASH, FIRST, NEXT, BRACKET) = range(5) + TestInfo = namedtuple('TestInfo', ['string', 'continuation']) + tests = ( + TestInfo('', NONE), + TestInfo('"""This is a continuation docstring.\n', FIRST), + TestInfo("'''This is a multiline-continued docstring.\n\n", NEXT), + TestInfo('a = (1 + 2) - 5 *\\\n', BACKSLASH), + TestInfo('\n def function1(self, a,\\\n', BRACKET) + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(gettype(), test.continuation) + + def test_study2(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + study = p._study2 + + TestInfo = namedtuple('TestInfo', ['string', 'start', 'end', 'lastch', + 'openbracket', 'bracketing']) + tests = ( + TestInfo('', 0, 0, '', None, ((0, 0),)), + TestInfo("'''This is a multiline continuation docstring.\n\n", + 0, 48, "'", None, ((0, 0), (0, 1), (48, 0))), + TestInfo(' # Comment\\\n', + 0, 12, '', None, ((0, 0), (1, 1), (12, 0))), + # A comment without a space is a special case + TestInfo(' #Comment\\\n', + 0, 0, '', None, ((0, 0),)), + # Backslash continuation. + TestInfo('a = (1 + 2) - 5 *\\\n', + 0, 19, '*', None, ((0, 0), (4, 1), (11, 0))), + # Bracket continuation with close. + TestInfo('\n def function1(self, a,\n b):\n', + 1, 48, ':', None, ((1, 0), (17, 1), (46, 0))), + # Bracket continuation with unneeded backslash. + TestInfo('\n def function1(self, a,\\\n', + 1, 28, ',', 17, ((1, 0), (17, 1))), + # Bracket continuation. + TestInfo('\n def function1(self, a,\n', + 1, 27, ',', 17, ((1, 0), (17, 1))), + # Bracket continuation with comment at end of line with text. + TestInfo('\n def function1(self, a, # End of line comment.\n', + 1, 51, ',', 17, ((1, 0), (17, 1), (28, 2), (51, 1))), + # Multi-line statement with comment line in between code lines. + TestInfo(' a = ["first item",\n # Comment line\n "next item",\n', + 0, 55, ',', 6, ((0, 0), (6, 1), (7, 2), (19, 1), + (23, 2), (38, 1), (42, 2), (53, 1))), + TestInfo('())\n', + 0, 4, ')', None, ((0, 0), (0, 1), (2, 0), (3, 0))), + TestInfo(')(\n', 0, 3, '(', 1, ((0, 0), (1, 0), (1, 1))), + # Wrong closers still decrement stack level. + TestInfo('{)(]\n', + 0, 5, ']', None, ((0, 0), (0, 1), (2, 0), (2, 1), (4, 0))), + # Character after backslash. + TestInfo(':\\a\n', 0, 4, '\\a', None, ((0, 0),)), + TestInfo('\n', 0, 0, '', None, ((0, 0),)), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + study() + eq(p.study_level, 2) + eq(p.stmt_start, test.start) + eq(p.stmt_end, test.end) + eq(p.lastch, test.lastch) + eq(p.lastopenbracketpos, test.openbracket) + eq(p.stmt_bracketing, test.bracketing) + + # Called again, just returns without reprocessing. + self.assertIsNone(study()) + + def test_get_num_lines_in_stmt(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + getlines = p.get_num_lines_in_stmt + + TestInfo = namedtuple('TestInfo', ['string', 'lines']) + tests = ( + TestInfo('[x for x in a]\n', 1), # Closed on one line. + TestInfo('[x\nfor x in a\n', 2), # Not closed. + TestInfo('[x\\\nfor x in a\\\n', 2), # "", unneeded backslashes. + TestInfo('[x\nfor x in a\n]\n', 3), # Closed on multi-line. + TestInfo('\n"""Docstring comment L1"""\nL2\nL3\nL4\n', 1), + TestInfo('\n"""Docstring comment L1\nL2"""\nL3\nL4\n', 1), + TestInfo('\n"""Docstring comment L1\\\nL2\\\nL3\\\nL4\\\n', 4), + TestInfo('\n\n"""Docstring comment L1\\\nL2\\\nL3\\\nL4\\\n"""\n', 5) + ) + + # Blank string doesn't have enough elements in goodlines. + setcode('') + with self.assertRaises(IndexError): + getlines() + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(getlines(), test.lines) + + def test_compute_bracket_indent(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + indent = p.compute_bracket_indent + + TestInfo = namedtuple('TestInfo', ['string', 'spaces']) + tests = ( + TestInfo('def function1(self, a,\n', 14), + # Characters after bracket. + TestInfo('\n def function1(self, a,\n', 18), + TestInfo('\n\tdef function1(self, a,\n', 18), + # No characters after bracket. + TestInfo('\n def function1(\n', 8), + TestInfo('\n\tdef function1(\n', 8), + TestInfo('\n def function1( \n', 8), # Ignore extra spaces. + TestInfo('[\n"first item",\n # Comment line\n "next item",\n', 0), + TestInfo('[\n "first item",\n # Comment line\n "next item",\n', 2), + TestInfo('["first item",\n # Comment line\n "next item",\n', 1), + TestInfo('(\n', 4), + TestInfo('(a\n', 1), + ) + + # Must be C_BRACKET continuation type. + setcode('def function1(self, a, b):\n') + with self.assertRaises(AssertionError): + indent() + + for test in tests: + setcode(test.string) + eq(indent(), test.spaces) + + def test_compute_backslash_indent(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + indent = p.compute_backslash_indent + + # Must be C_BACKSLASH continuation type. + errors = (('def function1(self, a, b\\\n'), # Bracket. + (' """ (\\\n'), # Docstring. + ('a = #\\\n'), # Inline comment. + ) + for string in errors: + with self.subTest(string=string): + setcode(string) + with self.assertRaises(AssertionError): + indent() + + TestInfo = namedtuple('TestInfo', ('string', 'spaces')) + tests = (TestInfo('a = (1 + 2) - 5 *\\\n', 4), + TestInfo('a = 1 + 2 - 5 *\\\n', 4), + TestInfo(' a = 1 + 2 - 5 *\\\n', 8), + TestInfo(' a = "spam"\\\n', 6), + TestInfo(' a = \\\n"a"\\\n', 4), + TestInfo(' a = #\\\n"a"\\\n', 5), + TestInfo('a == \\\n', 2), + TestInfo('a != \\\n', 2), + # Difference between containing = and those not. + TestInfo('\\\n', 2), + TestInfo(' \\\n', 6), + TestInfo('\t\\\n', 6), + TestInfo('a\\\n', 3), + TestInfo('{}\\\n', 4), + TestInfo('(1 + 2) - 5 *\\\n', 3), + ) + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(indent(), test.spaces) + + def test_get_base_indent_string(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + baseindent = p.get_base_indent_string + + TestInfo = namedtuple('TestInfo', ['string', 'indent']) + tests = (TestInfo('', ''), + TestInfo('def a():\n', ''), + TestInfo('\tdef a():\n', '\t'), + TestInfo(' def a():\n', ' '), + TestInfo(' def a(\n', ' '), + TestInfo('\t\n def a(\n', ' '), + TestInfo('\t\n # Comment.\n', ' '), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(baseindent(), test.indent) + + def test_is_block_opener(self): + yes = self.assertTrue + no = self.assertFalse + p = self.parser + setcode = p.set_code + opener = p.is_block_opener + + TestInfo = namedtuple('TestInfo', ['string', 'assert_']) + tests = ( + TestInfo('def a():\n', yes), + TestInfo('\n def function1(self, a,\n b):\n', yes), + TestInfo(':\n', yes), + TestInfo('a:\n', yes), + TestInfo('):\n', yes), + TestInfo('(:\n', yes), + TestInfo('":\n', no), + TestInfo('\n def function1(self, a,\n', no), + TestInfo('def function1(self, a):\n pass\n', no), + TestInfo('# A comment:\n', no), + TestInfo('"""A docstring:\n', no), + TestInfo('"""A docstring:\n', no), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + test.assert_(opener()) + + def test_is_block_closer(self): + yes = self.assertTrue + no = self.assertFalse + p = self.parser + setcode = p.set_code + closer = p.is_block_closer + + TestInfo = namedtuple('TestInfo', ['string', 'assert_']) + tests = ( + TestInfo('return\n', yes), + TestInfo('\tbreak\n', yes), + TestInfo(' continue\n', yes), + TestInfo(' raise\n', yes), + TestInfo('pass \n', yes), + TestInfo('pass\t\n', yes), + TestInfo('return #\n', yes), + TestInfo('raised\n', no), + TestInfo('returning\n', no), + TestInfo('# return\n', no), + TestInfo('"""break\n', no), + TestInfo('"continue\n', no), + TestInfo('def function1(self, a):\n pass\n', yes), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + test.assert_(closer()) + + def test_get_last_stmt_bracketing(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + bracketing = p.get_last_stmt_bracketing + + TestInfo = namedtuple('TestInfo', ['string', 'bracket']) + tests = ( + TestInfo('', ((0, 0),)), + TestInfo('a\n', ((0, 0),)), + TestInfo('()()\n', ((0, 0), (0, 1), (2, 0), (2, 1), (4, 0))), + TestInfo('(\n)()\n', ((0, 0), (0, 1), (3, 0), (3, 1), (5, 0))), + TestInfo('()\n()\n', ((3, 0), (3, 1), (5, 0))), + TestInfo('()(\n)\n', ((0, 0), (0, 1), (2, 0), (2, 1), (5, 0))), + TestInfo('(())\n', ((0, 0), (0, 1), (1, 2), (3, 1), (4, 0))), + TestInfo('(\n())\n', ((0, 0), (0, 1), (2, 2), (4, 1), (5, 0))), + # Same as matched test. + TestInfo('{)(]\n', ((0, 0), (0, 1), (2, 0), (2, 1), (4, 0))), + TestInfo('(((())\n', + ((0, 0), (0, 1), (1, 2), (2, 3), (3, 4), (5, 3), (6, 2))), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(bracketing(), test.bracket) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_runscript.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_runscript.py new file mode 100644 index 0000000000000000000000000000000000000000..5fc60185a663e8f33d5fd10591df989190e038f8 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_runscript.py @@ -0,0 +1,33 @@ +"Test runscript, coverage 16%." + +from idlelib import runscript +import unittest +from test.support import requires +from tkinter import Tk +from idlelib.editor import EditorWindow + + +class ScriptBindingTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + ew = EditorWindow(root=self.root) + sb = runscript.ScriptBinding(ew) + ew._close() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_scrolledlist.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_scrolledlist.py new file mode 100644 index 0000000000000000000000000000000000000000..2f819fda025ba3d453e081327a05ffc2fd7cf972 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_scrolledlist.py @@ -0,0 +1,27 @@ +"Test scrolledlist, coverage 38%." + +from idlelib.scrolledlist import ScrolledList +import unittest +from test.support import requires +requires('gui') +from tkinter import Tk + + +class ScrolledListTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + + def test_init(self): + ScrolledList(self.root) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_statusbar.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_statusbar.py new file mode 100644 index 0000000000000000000000000000000000000000..203a57db89ca6a7df608cc7d24c4301299d222d8 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_statusbar.py @@ -0,0 +1,41 @@ +"Test statusbar, coverage 100%." + +from idlelib import statusbar +import unittest +from test.support import requires +from tkinter import Tk + + +class Test(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_init(self): + bar = statusbar.MultiStatusBar(self.root) + self.assertEqual(bar.labels, {}) + + def test_set_label(self): + bar = statusbar.MultiStatusBar(self.root) + bar.set_label('left', text='sometext', width=10) + self.assertIn('left', bar.labels) + left = bar.labels['left'] + self.assertEqual(left['text'], 'sometext') + self.assertEqual(left['width'], 10) + bar.set_label('left', text='revised text') + self.assertEqual(left['text'], 'revised text') + bar.set_label('right', text='correct text') + self.assertEqual(bar.labels['right']['text'], 'correct text') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_undo.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_undo.py new file mode 100644 index 0000000000000000000000000000000000000000..beb5b582039f8844dd179561c7bb939606184375 --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_undo.py @@ -0,0 +1,135 @@ +"Test undo, coverage 77%." +# Only test UndoDelegator so far. + +from idlelib.undo import UndoDelegator +import unittest +from test.support import requires +requires('gui') + +from unittest.mock import Mock +from tkinter import Text, Tk +from idlelib.percolator import Percolator + + +class UndoDelegatorTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.text = Text(cls.root) + cls.percolator = Percolator(cls.text) + + @classmethod + def tearDownClass(cls): + cls.percolator.redir.close() + del cls.percolator, cls.text + cls.root.destroy() + del cls.root + + def setUp(self): + self.delegator = UndoDelegator() + self.delegator.bell = Mock() + self.percolator.insertfilter(self.delegator) + + def tearDown(self): + self.percolator.removefilter(self.delegator) + self.text.delete('1.0', 'end') + self.delegator.resetcache() + + def test_undo_event(self): + text = self.text + + text.insert('insert', 'foobar') + text.insert('insert', 'h') + text.event_generate('<>') + self.assertEqual(text.get('1.0', 'end'), '\n') + + text.insert('insert', 'foo') + text.insert('insert', 'bar') + text.delete('1.2', '1.4') + text.insert('insert', 'hello') + text.event_generate('<>') + self.assertEqual(text.get('1.0', '1.4'), 'foar') + text.event_generate('<>') + self.assertEqual(text.get('1.0', '1.6'), 'foobar') + text.event_generate('<>') + self.assertEqual(text.get('1.0', '1.3'), 'foo') + text.event_generate('<>') + self.delegator.undo_event('event') + self.assertTrue(self.delegator.bell.called) + + def test_redo_event(self): + text = self.text + + text.insert('insert', 'foo') + text.insert('insert', 'bar') + text.delete('1.0', '1.3') + text.event_generate('<>') + text.event_generate('<>') + self.assertEqual(text.get('1.0', '1.3'), 'bar') + text.event_generate('<>') + self.assertTrue(self.delegator.bell.called) + + def test_dump_event(self): + """ + Dump_event cannot be tested directly without changing + environment variables. So, test statements in dump_event + indirectly + """ + text = self.text + d = self.delegator + + text.insert('insert', 'foo') + text.insert('insert', 'bar') + text.delete('1.2', '1.4') + self.assertTupleEqual((d.pointer, d.can_merge), (3, True)) + text.event_generate('<>') + self.assertTupleEqual((d.pointer, d.can_merge), (2, False)) + + def test_get_set_saved(self): + # test the getter method get_saved + # test the setter method set_saved + # indirectly test check_saved + d = self.delegator + + self.assertTrue(d.get_saved()) + self.text.insert('insert', 'a') + self.assertFalse(d.get_saved()) + d.saved_change_hook = Mock() + + d.set_saved(True) + self.assertEqual(d.pointer, d.saved) + self.assertTrue(d.saved_change_hook.called) + + d.set_saved(False) + self.assertEqual(d.saved, -1) + self.assertTrue(d.saved_change_hook.called) + + def test_undo_start_stop(self): + # test the undo_block_start and undo_block_stop methods + text = self.text + + text.insert('insert', 'foo') + self.delegator.undo_block_start() + text.insert('insert', 'bar') + text.insert('insert', 'bar') + self.delegator.undo_block_stop() + self.assertEqual(text.get('1.0', '1.3'), 'foo') + + # test another code path + self.delegator.undo_block_start() + text.insert('insert', 'bar') + self.delegator.undo_block_stop() + self.assertEqual(text.get('1.0', '1.3'), 'foo') + + def test_addcmd(self): + text = self.text + # when number of undo operations exceeds max_undo + self.delegator.max_undo = max_undo = 10 + for i in range(max_undo + 10): + text.insert('insert', 'foo') + self.assertLessEqual(len(self.delegator.undolist), max_undo) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=False) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_zoomheight.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_zoomheight.py new file mode 100644 index 0000000000000000000000000000000000000000..aa5bdfb4fbd4c62f97d04669e9e8de667cbce0aa --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/test_zoomheight.py @@ -0,0 +1,39 @@ +"Test zoomheight, coverage 66%." +# Some code is system dependent. + +from idlelib import zoomheight +import unittest +from test.support import requires +from tkinter import Tk +from idlelib.editor import EditorWindow + + +class Test(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.editwin = EditorWindow(root=cls.root) + + @classmethod + def tearDownClass(cls): + cls.editwin._close() + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + zoom = zoomheight.ZoomHeight(self.editwin) + self.assertIs(zoom.editwin, self.editwin) + + def test_zoom_height_event(self): + zoom = zoomheight.ZoomHeight(self.editwin) + zoom.zoom_height_event() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/evalkit_cambrian/lib/python3.10/idlelib/idle_test/tkinter_testing_utils.py b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/tkinter_testing_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..a89839bbe38add465aa20b89b327a5732d50f9fd --- /dev/null +++ b/evalkit_cambrian/lib/python3.10/idlelib/idle_test/tkinter_testing_utils.py @@ -0,0 +1,62 @@ +"""Utilities for testing with Tkinter""" +import functools + + +def run_in_tk_mainloop(delay=1): + """Decorator for running a test method with a real Tk mainloop. + + This starts a Tk mainloop before running the test, and stops it + at the end. This is faster and more robust than the common + alternative method of calling .update() and/or .update_idletasks(). + + Test methods using this must be written as generator functions, + using "yield" to allow the mainloop to process events and "after" + callbacks, and then continue the test from that point. + + The delay argument is passed into root.after(...) calls as the number + of ms to wait before passing execution back to the generator function. + + This also assumes that the test class has a .root attribute, + which is a tkinter.Tk object. + + For example (from test_sidebar.py): + + @run_test_with_tk_mainloop() + def test_single_empty_input(self): + self.do_input('\n') + yield + self.assert_sidebar_lines_end_with(['>>>', '>>>']) + """ + def decorator(test_method): + @functools.wraps(test_method) + def new_test_method(self): + test_generator = test_method(self) + root = self.root + # Exceptions raised by self.assert...() need to be raised + # outside of the after() callback in order for the test + # harness to capture them. + exception = None + def after_callback(): + nonlocal exception + try: + next(test_generator) + except StopIteration: + root.quit() + except Exception as exc: + exception = exc + root.quit() + else: + # Schedule the Tk mainloop to call this function again, + # using a robust method of ensuring that it gets a + # chance to process queued events before doing so. + # See: https://stackoverflow.com/q/18499082#comment65004099_38817470 + root.after(delay, root.after_idle, after_callback) + root.after(0, root.after_idle, after_callback) + root.mainloop() + + if exception: + raise exception + + return new_test_method + + return decorator