0

So for this function, I have a json file with list of files , which are tests

def wantFunction(self, function):
    test = '.'.join([function.__module__, function.__name__])
    if test in self.ctrl.keys():
            for in evidence.values():
                if os.environ['ENNVAR'] in controls:
                    return True
    return False

This takes the input from a json file (contains the list of tests), but once it detects a test which returns True, the wantFunction does not go through the other tests present in the json file (list). Could someone tell why it is happening?

idjaw
  • 25,487
  • 7
  • 64
  • 83
Harshdeep Singh
  • 327
  • 1
  • 5
  • 18
  • 2
    The `return` statement in your function *returns* control to the caller once it is reached. You probably want to use the builtin `all` and return `True` iff *all* the tests pass – Moses Koledoye Oct 17 '16 at 22:39
  • No it won't work, because `all` also returns True or False, and will not go through to check all the tests. @MosesKoledoye – Harshdeep Singh Oct 18 '16 at 10:45

0 Answers0