From 9730bcb4a6d3d2dfc1717fa6e64cf4845d418637 Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Mon, 23 Jan 2006 07:50:06 +0000 Subject: Test getsignal() and some error conditions --- Lib/test/test_signal.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index 042cfa9..f7fcb04 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -1,5 +1,5 @@ # Test the signal module -from test.test_support import verbose, TestSkipped, TestFailed +from test.test_support import verbose, TestSkipped, TestFailed, vereq import signal import os, sys, time @@ -43,6 +43,28 @@ usr1 = signal.signal(signal.SIGUSR1, handlerB) usr2 = signal.signal(signal.SIGUSR2, signal.SIG_IGN) alrm = signal.signal(signal.SIGALRM, signal.default_int_handler) +vereq(signal.getsignal(signal.SIGHUP), handlerA) +vereq(signal.getsignal(signal.SIGUSR1), handlerB) +vereq(signal.getsignal(signal.SIGUSR2), signal.SIG_IGN) + +try: + signal.signal(4242, handlerB) + raise TestFailed, 'expected ValueError for invalid signal # to signal()' +except ValueError: + pass + +try: + signal.getsignal(4242) + raise TestFailed, 'expected ValueError for invalid signal # to getsignal()' +except ValueError: + pass + +try: + signal.signal(signal.SIGUSR1, None) + raise TestFailed, 'expected TypeError for non-callable' +except TypeError: + pass + try: os.system(script) -- cgit v0.12