MCPcopy Index your code
hub / github.com/python/cpython / _super_attr

Method _super_attr

Lib/test/test_monitoring.py:1986–2014  ·  view source on GitHub ↗
(self, optimized=False)

Source from the content-addressed store, hash-verified

1984 self.check_events(opt_func, recorders=self.RECORDERS, expected=opt_expected)
1985
1986 def _super_attr(self, optimized=False):
1987 codestr = """
1988 class A:
1989 x = 1
1990
1991 class B(A):
1992 def method(self):
1993 return super(
1994 ).x
1995
1996 b = B()
1997 def f():
1998 return b.method()
1999 """
2000 d = self._exec_super(codestr, optimized)
2001 expected = [
2002 ('line', 'get_events', 10),
2003 ('call', 'f', sys.monitoring.MISSING),
2004 ('line', 'f', 1),
2005 ('call', 'method', d["b"]),
2006 ('line', 'method', 1),
2007 ('call', 'super', sys.monitoring.MISSING),
2008 ('C return', 'super', sys.monitoring.MISSING),
2009 ('line', 'method', 2),
2010 ('line', 'method', 1),
2011 ('line', 'get_events', 11),
2012 ('call', 'set_events', 2)
2013 ]
2014 return d["f"], expected
2015
2016 def test_attr(self):
2017 nonopt_func, nonopt_expected = self._super_attr(optimized=False)

Callers 1

test_attrMethod · 0.95

Calls 1

_exec_superMethod · 0.95

Tested by

no test coverage detected