title: How to test methods of an class that don't have parameters or returns in python using pytest
body: <p>Let's say that I have a class, this class have some attributes and some methods. This methods don't have any parameters or any return, they only work by changing the attributes of the class using the 'self.' property. How can I test these types of methods?</p>
  <p>Let's create the imaginary class Foo to serve as example:</p>
  <pre><code>class Foo:
       example_value = -1
  
       def function_1(self,a,b):
          self.attr1 = a
          self.attr2 = b
  
          self.function_2()
          self.function_3()
          self.function_4(self.example_value)
  
  
      def function_2(self):
          self.attr1 = self.attr1 + 50
          self.attr2 = self.attr2 + 40
  
      def function_3(self):
          self.attr1 = self.attr1 * 2
          self.attr2 = self.attr3 * 3
          self.example_value = self.attr1 + self.attr3
  
      def function_4(self,value):
          
          if value == -1:
              raise Exception('snippet')   
  </code></pre>
  <p>In order to test this class, what should I mock? Since two of the methods don't have any input parameters or returns, how can I track the value change of the class attributes? Should I mock only a method or the entire class? And how can I do it in a simple way with <code>pytest</code>? What could be changed in this code? The addition of a simple <code>get_value()</code> would simplify the test development for this class?</p>