@@ -666,6 +666,14 @@ def __init__(self):
666666 def meth (self ):
667667 ...
668668
669+ @classmethod
670+ def classy (klass ):
671+ ...
672+
673+ @staticmethod
674+ def static ():
675+ ...
676+
669677 @property
670678 def prop (self ):
671679 return self ._p
@@ -696,6 +704,10 @@ def verify_pre_post_state(obj):
696704 assert not hasattr (obj , 'extra' )
697705 assert obj .prop == 'p'
698706 assert obj .monkey == other .meth
707+ assert obj .cls_level is A .cls_level
708+ assert 'cls_level' not in obj .__dict__
709+ assert 'classy' not in obj .__dict__
710+ assert 'static' not in obj .__dict__
699711
700712 a = B ()
701713
@@ -705,7 +717,8 @@ def verify_pre_post_state(obj):
705717 a , prop = 'squirrel' ,
706718 aardvark = 'moose' , meth = lambda : None ,
707719 override = 'boo' , extra = 'extra' ,
708- monkey = lambda : None ):
720+ monkey = lambda : None , cls_level = 'bob' ,
721+ classy = 'classy' , static = 'static' ):
709722 # because we have set a lambda, it is normal attribute access
710723 # and the same every time
711724 assert a .meth is a .meth
@@ -715,9 +728,8 @@ def verify_pre_post_state(obj):
715728 assert a .extra == 'extra'
716729 assert a .prop == 'squirrel'
717730 assert a .monkey != other .meth
731+ assert a .cls_level == 'bob'
732+ assert a .classy == 'classy'
733+ assert a .static == 'static'
718734
719735 verify_pre_post_state (a )
720-
721- with pytest .raises (ValueError ):
722- with cbook ._setattr_cm (a , cls_level = 'bob' ):
723- pass
0 commit comments