Nested inheritance not resolved

The following code is not resolved correctly (Python 2.7)

class Parent(object):

   class Methods(object):

       @classmethod
       def test1(cls):
           return "test1"

   @classmethod
   def methods(cls):
       return cls.Methods


class Child(Parent):

   class Methods(Parent.Methods):

       @classmethod
       def test2(cls):
           return "test2"


Child.methods().test1()  # test1 is detected
Child.methods().test2()  # test2 is not detected, this is not correct

 

When doing this however, it does work:

 

class Parent(object):

   class Methods(object):

       @classmethod
       def test1(cls):
           return "test1"

   @classmethod
   def methods(cls):
       return cls.Methods


class Child(Parent):

   class Methods(Parent.Methods):

       @classmethod
       def test2(cls):
           return "test2"

   @classmethod
   def methods(cls):
       return cls.Methods


Child.methods().test1()  # test1 is detected
Child.methods().test2()  # test2 is detected
 

Is this a bug and can it be solved?

0
1 comment

Hi Mixad65410, please create an issue on YouTrack (https://youtrack.jetbrains.com/issues/PY) and attach all relevant information for quicker resolution.

0

Please sign in to leave a comment.