It’s difficult to tell from that tiny bit of code, but the fact that your IDE underlines self
suggests to me that you are doing this at a location where self
is not defined. Do you understand that the way you use the unittest
is by extending the TestCase
class and writing test methods inside your class?
It is worth following the example in: https://docs.python.org/3/library/unittest.html#basic-example
If that doesn’t solve it, post us enough code to appreciate the context. And not a screenshot, do it like this: About the Python Help category