Current Path: > > opt > hc_python > > > lib > python3.12 > site-packages > > greenlet > tests
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
__init__.py | File | 9361 bytes | May 23 2025 10:34:46. | |
_test_extension.c | File | 5773 bytes | May 23 2025 10:34:46. | |
_test_extension.cpython-312-x86_64-linux-gnu.so | File | 17256 bytes | May 23 2025 10:34:46. | |
_test_extension_cpp.cpp | File | 6565 bytes | May 23 2025 10:34:46. | |
_test_extension_cpp.cpython-312-x86_64-linux-gnu.so | File | 58384 bytes | May 23 2025 10:34:46. | |
fail_clearing_run_switches.py | File | 1263 bytes | May 23 2025 10:34:46. | |
fail_cpp_exception.py | File | 985 bytes | May 23 2025 10:34:46. | |
fail_initialstub_already_started.py | File | 1961 bytes | May 23 2025 10:34:46. | |
fail_slp_switch.py | File | 524 bytes | May 23 2025 10:34:46. | |
fail_switch_three_greenlets.py | File | 956 bytes | May 23 2025 10:34:46. | |
fail_switch_three_greenlets2.py | File | 1285 bytes | May 23 2025 10:34:46. | |
fail_switch_two_greenlets.py | File | 817 bytes | May 23 2025 10:34:46. | |
leakcheck.py | File | 11964 bytes | May 23 2025 10:34:46. | |
test_contextvars.py | File | 10541 bytes | May 23 2025 10:34:46. | |
test_cpp.py | File | 2736 bytes | May 23 2025 10:34:46. | |
test_extension_interface.py | File | 3829 bytes | May 23 2025 10:34:46. | |
test_gc.py | File | 2923 bytes | May 23 2025 10:34:46. | |
test_generator.py | File | 1240 bytes | May 23 2025 10:34:46. | |
test_generator_nested.py | File | 3718 bytes | May 23 2025 10:34:46. | |
test_greenlet.py | File | 46251 bytes | May 23 2025 10:34:46. | |
test_greenlet_trash.py | File | 7947 bytes | May 23 2025 10:34:46. | |
test_leaks.py | File | 17714 bytes | May 23 2025 10:34:46. | |
test_stack_saved.py | File | 446 bytes | May 23 2025 10:34:46. | |
test_throw.py | File | 3712 bytes | May 23 2025 10:34:46. | |
test_tracing.py | File | 8250 bytes | May 23 2025 10:34:46. | |
test_version.py | File | 1339 bytes | May 23 2025 10:34:46. | |
test_weakref.py | File | 883 bytes | May 23 2025 10:34:46. |
import sys from greenlet import greenlet from . import TestCase def switch(*args): return greenlet.getcurrent().parent.switch(*args) class ThrowTests(TestCase): def test_class(self): def f(): try: switch("ok") except RuntimeError: switch("ok") return switch("fail") g = greenlet(f) res = g.switch() self.assertEqual(res, "ok") res = g.throw(RuntimeError) self.assertEqual(res, "ok") def test_val(self): def f(): try: switch("ok") except RuntimeError: val = sys.exc_info()[1] if str(val) == "ciao": switch("ok") return switch("fail") g = greenlet(f) res = g.switch() self.assertEqual(res, "ok") res = g.throw(RuntimeError("ciao")) self.assertEqual(res, "ok") g = greenlet(f) res = g.switch() self.assertEqual(res, "ok") res = g.throw(RuntimeError, "ciao") self.assertEqual(res, "ok") def test_kill(self): def f(): switch("ok") switch("fail") g = greenlet(f) res = g.switch() self.assertEqual(res, "ok") res = g.throw() self.assertTrue(isinstance(res, greenlet.GreenletExit)) self.assertTrue(g.dead) res = g.throw() # immediately eaten by the already-dead greenlet self.assertTrue(isinstance(res, greenlet.GreenletExit)) def test_throw_goes_to_original_parent(self): main = greenlet.getcurrent() def f1(): try: main.switch("f1 ready to catch") except IndexError: return "caught" return "normal exit" def f2(): main.switch("from f2") g1 = greenlet(f1) g2 = greenlet(f2, parent=g1) with self.assertRaises(IndexError): g2.throw(IndexError) self.assertTrue(g2.dead) self.assertTrue(g1.dead) g1 = greenlet(f1) g2 = greenlet(f2, parent=g1) res = g1.switch() self.assertEqual(res, "f1 ready to catch") res = g2.throw(IndexError) self.assertEqual(res, "caught") self.assertTrue(g2.dead) self.assertTrue(g1.dead) g1 = greenlet(f1) g2 = greenlet(f2, parent=g1) res = g1.switch() self.assertEqual(res, "f1 ready to catch") res = g2.switch() self.assertEqual(res, "from f2") res = g2.throw(IndexError) self.assertEqual(res, "caught") self.assertTrue(g2.dead) self.assertTrue(g1.dead) def test_non_traceback_param(self): with self.assertRaises(TypeError) as exc: greenlet.getcurrent().throw( Exception, Exception(), self ) self.assertEqual(str(exc.exception), "throw() third argument must be a traceback object") def test_instance_of_wrong_type(self): with self.assertRaises(TypeError) as exc: greenlet.getcurrent().throw( Exception(), BaseException() ) self.assertEqual(str(exc.exception), "instance exception may not have a separate value") def test_not_throwable(self): with self.assertRaises(TypeError) as exc: greenlet.getcurrent().throw( "abc" ) self.assertEqual(str(exc.exception), "exceptions must be classes, or instances, not str")
SILENT KILLER Tool