title: I have a class with one required and two optional parameters, and a repr method which returns with one of the optional params, whichever is given
body: <pre><code>class MyClass():
      def __init__(self, name, high=None, low=None):
          self.name = name
          if low:
              self.low = low
          elif high:
              self.high = high
          else:
              raise Error(&quot;Not found&quot;)
  
      def __repr__(self):
          value = self.low or self.high
          return '{}({}, {})'.format(str(self), self.name, value)
  </code></pre>
  <p>I have a unit test case, in which MyClass is being instantiated like,</p>
  <pre><code>gain = MyClass('name', high='high_value')
  assert isinstance(repr(gain), str)
  </code></pre>
  <p>But when my repr() is called, it is throwing AttributeError,</p>
  <blockquote>
  <p>AttributeError: 'MyClass' has no attribute 'low'</p>
  </blockquote>