def test_execute_and_import(): """ Import a generic module, make sure we do not get any type errors """ code = dedent(''' import os print(os.path) ''') results = ExecuteCode.execute_code(code) assert results is not None assert results != ''
def test_execute_code_function(): """ Ensure simple code functions execute """ code = dedent(''' print("foo") print("bar") ''') expected_output = dedent('''\ foo bar ''') results = ExecuteCode.execute_code(code) assert expected_output == results
def test_execute_empty(): """ execute_code function should be able to take empty content """ code = '' results = ExecuteCode.execute_code(code) assert results == ''