summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-01-23 07:50:06 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-01-23 07:50:06 (GMT)
commit9730bcb4a6d3d2dfc1717fa6e64cf4845d418637 (patch)
treeea8275dc12498f630aaca26323c3801bf3772329 /Lib
parentcd3e219cda507811631cf39612bf1ad4382ae470 (diff)
downloadcpython-9730bcb4a6d3d2dfc1717fa6e64cf4845d418637.zip
cpython-9730bcb4a6d3d2dfc1717fa6e64cf4845d418637.tar.gz
cpython-9730bcb4a6d3d2dfc1717fa6e64cf4845d418637.tar.bz2
Test getsignal() and some error conditions
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_signal.py24
1 files changed, 23 insertions, 1 deletions
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)