def METHOD_NAME(self):
    """Ensure getattr() is invoked no more than once per attribute"""
    # note the special case for @property methods below; that is why
    # we use __dir__ and __getattr__ in class Foo to create a "magic"
    # class attribute 'bar'. This forces `getattr` to call __getattr__
    # (which is doesn't necessarily do).
    class Foo:
        calls = 0
        bar = ''
        def __getattribute__(self, name):
            if name == 'bar':
                self.calls += 1
                return None
            return super().__getattribute__(name)
    f = Foo()
    completer = rlcompleter.Completer(dict(f=f))
    self.assertEqual(completer.complete('f.b', 0), 'f.bar')
    self.assertEqual(f.calls, 1)