Replies: 1 comment 1 reply
-
See python/mypy#8267 - nothing pytest can do about this. Consider not using name mangling (double underscore) at all, it's regarded a bad practice by many, and single underscores to mark private attributes works just fine. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What is your solution for below issue:
In my project, I am using private methods. For accessing them, from another file (in same project), I need to do it as follows:
from my_project import Digit
DIGIT = Digit()
text = DIGIT._Digit__add_digit(text)
For testing with pytest, I have no issues, but mypy give me an error. It accept below way of using private methods:
NOTE: [ _Digit ] need to be removed!
text = DIGIT.__add_digit(text)
So, here is the conflict. Any idea?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions