def checkCall(self, testFn, args, kw, fn, expectedArgs,
                    cfgValues={}, returnVal=None, ignoreKeywords=False,
                    checkCallback=None, **expectedKw):
        methodCalled = [False]
        def _placeHolder(*args, **kw):
            """
            Pretends to be the fn that we are checking the parameters of.
            """
            methodCalled[0] = True

            if checkCallback:
                checkCallback(*args, **kw)

            self.assertEqual(len(args), len(expectedArgs))
            for i, (arg, expectedArg) in enumerate(zip(args, expectedArgs)):
                if isinstance(expectedArg, _NoneArg):
                    assert arg is None, \
                           "%s: argument %d is not None" % (arg, i + 1)
                elif expectedArg is None:
                    pass
                elif (inspect.isclass(expectedArg)
                      and isinstance(arg, expectedArg)):
                    pass
                else:
                    assert arg == expectedArg, \
                           "%s != %s" % (repr(arg), repr(expectedArg))

            for key, expectedVal in expectedKw.iteritems():
                val = kw.pop(key)
                if isinstance(expectedVal, _NoneArg):
                    assert val is None, \
                           "%s: %s s not None" % (key, repr(val))
                elif expectedVal is None:
                    pass
                elif (inspect.isclass(expectedVal)
                      and isinstance(arg, expectedVal)):
                    pass
                else:
                    assert val == expectedVal, \
                           "%s: %s != %s" % (key, repr(val), repr(expectedVal))

            if not ignoreKeywords:
                assert not kw, "%s" % repr(kw)

            if not cfgValues:
                return

            found = False
            for arg in args:
                if isinstance(arg, cfgmod.ConfigFile):
                    found = True
                    for cfgKey, cfgValue in cfgValues.iteritems():
                        assert arg[cfgKey] == cfgValue, \
                               "%s: %s != %s" % (
                                    cfgKey, repr(arg[cfgKey]), repr(cfgValue))
                    break
            assert(found)
        if fn is not None:
            fnModule, fnName = fn.rsplit('.', 1)

            if sys.modules in fnModule:
                origFn = sys.modules[fnModule].__dict__[fnName]
                sys.modules[fnModule].__dict__[fnName] = _placeHolder
                isClassMethod = False
            else:
                fnModule, className = fnModule.rsplit('.', 1)
                isClassMethod = True
                class_ = sys.modules[fnModule].__dict__[className]
                origFn = getattr(class_, fnName)

                setattr(class_,
                        fnName, new.instancemethod(_placeHolder, None,  class_))
        try:
            rv = testFn(*args, **kw)
            if fn is not None:
                assert(methodCalled[0])
            if returnVal is not None:
                assert(rv == returnVal)
            return rv
        finally:
            if fn is not None:
                if isClassMethod:
                    setattr(class_, fnName, origFn)
                else:
                    sys.modules[fnModule].__dict__[fnName] = origFn
dataset/ETHPy150Open sassoftware/conary/conary_test/rephelp.py/RepositoryHelper.checkCall/swapped operands of `in`