#1648: add sys.gettrace() and sys.getprofile().

This commit is contained in:
Georg Brandl 2008-01-20 13:59:46 +00:00
parent 92058d2933
commit 56112895d6
5 changed files with 104 additions and 0 deletions

View file

@ -4,6 +4,22 @@ import unittest
from test import test_support
class TestGetProfile(unittest.TestCase):
def setUp(self):
sys.setprofile(None)
def tearDown(self):
sys.setprofile(None)
def test_empty(self):
assert sys.getprofile() == None
def test_setget(self):
def fn(*args):
pass
sys.setprofile(fn)
assert sys.getprofile() == fn
class HookWatcher:
def __init__(self):
@ -359,6 +375,7 @@ def show_events(callable):
def test_main():
test_support.run_unittest(
TestGetProfile,
ProfileHookTestCase,
ProfileSimulatorTestCase
)