[pytest] use method.__self__.__class__ instead of method.im_class [applied]