Exemplo n.º 1
0
def test_code_execution():
    path = Path('/some/folder')
    python = Python("print(x)\nprint(path)")
    with patch.object(python, 'print') as mock_print:
        python.run(path, path, {'x': 42}, False)
        mock_print.assert_any_call(42)
        mock_print.assert_any_call(path)
Exemplo n.º 2
0
def test_code_execution():
    with patch.object(Python, "print") as mock_print:
        path = Path("/some/folder")
        python = Python("print(x)\nprint(path)")
        python.run(path=path, x=42, simulate=False)
        mock_print.assert_any_call(42)
        mock_print.assert_any_call(path)
Exemplo n.º 3
0
def test_code_execution():
    path = Path("/some/folder")
    python = Python("print(x)\nprint(path)")
    with patch.object(python, "print") as mock_print:
        python.run({"path": path, "x": 42}, False)
        mock_print.assert_any_call(42)
        mock_print.assert_any_call(path)
Exemplo n.º 4
0
def test_print_substitution():
    python = Python("print('Hello World')")
    with patch.object(python, 'print') as mock_print:
        python.run(Path('~'), Path('~'), {}, False)
        mock_print.assert_called_with('Hello World')
Exemplo n.º 5
0
def test_print_substitution():
    with patch.object(Python, "print") as mock_print:
        python = Python("print('Hello World')")
        python.run(path=Path.home(), simulate=False)
        mock_print.assert_called_with("Hello World")
Exemplo n.º 6
0
def test_print_substitution():
    python = Python("print('Hello World')")
    with patch.object(python, "print") as mock_print:
        python.run({"path": Path.home()}, False)
        mock_print.assert_called_with("Hello World")