diff Lib/test/test_trace.py @ 44822:424cccfd2baa legacy-trunk

#1648: add sys.gettrace() and sys.getprofile().
author Georg Brandl <georg@python.org>
date Sun, 20 Jan 2008 13:59:46 +0000
parents 76844a0a579f
children 643c1397f954
line wrap: on
line diff
--- a/Lib/test/test_trace.py	Sun Jan 20 13:08:37 2008 +0000
+++ b/Lib/test/test_trace.py	Sun Jan 20 13:59:46 2008 +0000
@@ -268,6 +268,20 @@
         self.compare_events(func.func_code.co_firstlineno,
                             tracer.events, func.events)
 
+    def set_and_retrieve_none(self):
+        sys.settrace(None)
+        assert sys.gettrace() is None
+
+    def set_and_retrieve_func(self):
+        def fn(*args):
+            pass
+
+        sys.settrace(fn)
+        try:
+            assert sys.gettrace() is fn
+        finally:
+            sys.settrace(None)
+
     def test_01_basic(self):
         self.run_test(basic)
     def test_02_arigo(self):