def test_subprocess_delegation(self):
        """ Test subprocess call structure using mock module """
        orig_Popen = subprocess.Popen
        self.last_test = None

        def Popen(cmd, **kwargs):
            self.last_test = cmd

        subprocess.Popen = Popen
        context = RemoteContext(
            "some_host",
            username="luigi",
            key_file="/some/key.pub"
        )
        context.Popen(["ls"])
        self.assertTrue("ssh" in self.last_test)
        self.assertTrue("-i" in self.last_test)
        self.assertTrue("/some/key.pub" in self.last_test)
        self.assertTrue(self.last_test in "luigi@some_host")
        self.assertTrue("ls" in self.last_test)

        subprocess.Popen = orig_Popen
dataset/ETHPy150Open spotify/luigi/test/test_ssh.py/TestMockedRemoteContext.test_subprocess_delegation/swapped operands of `in`