aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_sys_setprofile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_sys_setprofile.py')
-rw-r--r--Lib/test/test_sys_setprofile.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/Lib/test/test_sys_setprofile.py b/Lib/test/test_sys_setprofile.py
index e82559f8fc3..9816e3ed646 100644
--- a/Lib/test/test_sys_setprofile.py
+++ b/Lib/test/test_sys_setprofile.py
@@ -3,7 +3,7 @@ import pprint
import sys
import unittest
-from test import test_support
+from test import support
class TestGetProfile(unittest.TestCase):
def setUp(self):
@@ -48,7 +48,7 @@ class HookWatcher:
def get_events(self):
"""Remove calls to add_event()."""
- disallowed = [ident(self.add_event.im_func), ident(ident)]
+ disallowed = [ident(self.add_event.__func__), ident(ident)]
self.frames = None
return [item for item in self.events if item[2] not in disallowed]
@@ -111,7 +111,7 @@ class ProfileHookTestCase(TestCaseBase):
def test_exception(self):
def f(p):
- 1./0
+ 1/0
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
(1, 'return', f_ident),
@@ -119,7 +119,7 @@ class ProfileHookTestCase(TestCaseBase):
def test_caught_exception(self):
def f(p):
- try: 1./0
+ try: 1/0
except: pass
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
@@ -128,7 +128,7 @@ class ProfileHookTestCase(TestCaseBase):
def test_caught_nested_exception(self):
def f(p):
- try: 1./0
+ try: 1/0
except: pass
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
@@ -137,7 +137,7 @@ class ProfileHookTestCase(TestCaseBase):
def test_nested_exception(self):
def f(p):
- 1./0
+ 1/0
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
# This isn't what I expected:
@@ -148,7 +148,7 @@ class ProfileHookTestCase(TestCaseBase):
def test_exception_in_except_clause(self):
def f(p):
- 1./0
+ 1/0
def g(p):
try:
f(p)
@@ -167,7 +167,7 @@ class ProfileHookTestCase(TestCaseBase):
def test_exception_propogation(self):
def f(p):
- 1./0
+ 1/0
def g(p):
try: f(p)
finally: p.add_event("falling through")
@@ -182,8 +182,8 @@ class ProfileHookTestCase(TestCaseBase):
def test_raise_twice(self):
def f(p):
- try: 1./0
- except: 1./0
+ try: 1/0
+ except: 1/0
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
(1, 'return', f_ident),
@@ -191,7 +191,7 @@ class ProfileHookTestCase(TestCaseBase):
def test_raise_reraise(self):
def f(p):
- try: 1./0
+ try: 1/0
except: raise
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
@@ -208,7 +208,7 @@ class ProfileHookTestCase(TestCaseBase):
def test_distant_exception(self):
def f():
- 1./0
+ 1/0
def g():
f()
def h():
@@ -293,7 +293,7 @@ class ProfileSimulatorTestCase(TestCaseBase):
def test_basic_exception(self):
def f(p):
- 1./0
+ 1/0
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
(1, 'return', f_ident),
@@ -301,7 +301,7 @@ class ProfileSimulatorTestCase(TestCaseBase):
def test_caught_exception(self):
def f(p):
- try: 1./0
+ try: 1/0
except: pass
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
@@ -310,7 +310,7 @@ class ProfileSimulatorTestCase(TestCaseBase):
def test_distant_exception(self):
def f():
- 1./0
+ 1/0
def g():
f()
def h():
@@ -341,7 +341,7 @@ def ident(function):
if hasattr(function, "f_code"):
code = function.f_code
else:
- code = function.func_code
+ code = function.__code__
return code.co_firstlineno, code.co_name
@@ -375,7 +375,7 @@ def show_events(callable):
def test_main():
- test_support.run_unittest(
+ support.run_unittest(
TestGetProfile,
ProfileHookTestCase,
ProfileSimulatorTestCase