[Python-checkins] r42152 - python/trunk/Lib/test/test_signal.py

neal.norwitz python-checkins at python.org
Mon Jan 23 08:50:07 CET 2006


Author: neal.norwitz
Date: Mon Jan 23 08:50:06 2006
New Revision: 42152

Modified:
   python/trunk/Lib/test/test_signal.py
Log:
Test getsignal() and some error conditions

Modified: python/trunk/Lib/test/test_signal.py
==============================================================================
--- python/trunk/Lib/test/test_signal.py	(original)
+++ python/trunk/Lib/test/test_signal.py	Mon Jan 23 08:50:06 2006
@@ -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 @@
 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)
 


More information about the Python-checkins mailing list