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

Method testHasAttrString

Lib/test/test_class.py:450–462  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

448 self.assertCallStack([('__delattr__', (testme, "cardinal"))])
449
450 def testHasAttrString(self):
451 import sys
452 from test.support import import_helper
453 _testlimitedcapi = import_helper.import_module('_testlimitedcapi')
454
455 class A:
456 def __init__(self):
457 self.attr = 1
458
459 a = A()
460 self.assertEqual(_testlimitedcapi.object_hasattrstring(a, b"attr"), 1)
461 self.assertEqual(_testlimitedcapi.object_hasattrstring(a, b"noattr"), 0)
462 self.assertIsNone(sys.exception())
463
464 def testDel(self):
465 x = []

Callers

nothing calls this directly

Calls 5

assertIsNoneMethod · 0.80
AClass · 0.70
import_moduleMethod · 0.45
assertEqualMethod · 0.45
exceptionMethod · 0.45

Tested by

no test coverage detected