def testRunString(self): """Test the RunString method.""" PythonEngine.AcquireLock() code = "import sys; sys.singleline_worked = 1" PythonEngine.RunString(code) self.failUnless(sys.singleline_worked == 1) code = "import sys\nsys.multiline_worked = 1" PythonEngine.RunString(code) self.failUnless(sys.multiline_worked == 1) PythonEngine.ReleaseLock()
def test_run_string(): """Test the RunString method.""" PythonEngine.AcquireLock() code = "import sys; sys.singleline_worked = 1" PythonEngine.RunString(code) assert sys.singleline_worked == 1 code = "import sys\nsys.multiline_worked = 1" PythonEngine.RunString(code) assert sys.multiline_worked == 1 PythonEngine.ReleaseLock()