Skip to content

Can't use parent's public method with protected method in it. #164

@mostepunk

Description

@mostepunk

Hello!
Here my code that raises some errors that I can't understand.

class Car:
    @protected
    def start_engine(self):
        return "Engine's sound."

    def run(self):
        return self.start_engine()


class Tesla(Car):
    pass


if __name__ == "__main__":
    t = Tesla()
    t.run()

This code raises error

Traceback (most recent call last):
  File "/home/mostepan/dev/food/plgr.py", line 98, in <module>
    t.run()
  File "/home/mostepan/dev/food/plgr.py", line 89, in run
    return self.start_engine()
  File "/home/mostepan/dev/food/venv/lib/python3.10/site-packages/accessify/access.py", line 112, in protected_wrapper
    raise InaccessibleDueToItsProtectionLevelException(
accessify.errors.InaccessibleDueToItsProtectionLevelException: Tesla.start_engine() is inaccessible due to its protection level

I think there is an error somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions