Exemplo n.º 1
0
def test_echo_path():
    echo = Echo("{path.stem} for {year}")
    with patch.object(echo, "print") as m:
        echo.run(simulate=False, path=Path("/this/isafile.txt"), year=2017)
        m.assert_called_with("isafile for 2017")
Exemplo n.º 2
0
def test_echo_basic():
    echo = Echo("Hello World")
    with patch.object(echo, "print") as m:
        echo.run(path=Path('~'), simulate=False)
        m.assert_called_with("Hello World")
Exemplo n.º 3
0
def test_echo_basic():
    echo = Echo("Hello World")
    with patch.object(echo, "print") as m:
        echo.run({"path": Path("~")}, False)
        m.assert_called_with("Hello World")
Exemplo n.º 4
0
def test_echo_args():
    echo = Echo("This is the year {year}")
    with patch.object(echo, "print") as m:
        echo.run(path=Path('~'), simulate=False, year=2017)
        m.assert_called_with("This is the year 2017")
Exemplo n.º 5
0
def test_echo_path():
    attrs = {"path": Path("/this/isafile.txt"), "year": 2017}
    echo = Echo("{path.stem} for {year}")
    with patch.object(echo, "print") as m:
        echo.run(attrs, False)
        m.assert_called_with("isafile for 2017")
Exemplo n.º 6
0
def test_echo_attrs():
    echo = Echo("This is the year {year}")
    with patch.object(echo, "print") as m:
        echo.run({"path": Path("~"), "year": 2017}, False)
        m.assert_called_with("This is the year 2017")
Exemplo n.º 7
0
def test_echo_basic():
    echo = Echo('Hello World')
    with patch.object(echo, 'print') as m:
        echo.run(Path('~'), Path('~'), {}, False)
        m.assert_called_with('Hello World')
Exemplo n.º 8
0
def test_echo_path():
    echo = Echo('{path.stem} for {year}')
    with patch.object(echo, 'print') as m:
        echo.run(Path('~'), Path('/this/isafile.txt'), {'year': 2017}, False)
        m.assert_called_with('isafile for 2017')
Exemplo n.º 9
0
def test_echo_attrs():
    echo = Echo('This is the year {year}')
    with patch.object(echo, 'print') as m:
        echo.run(Path('~'), Path('~'), {'year': 2017}, False)
        m.assert_called_with('This is the year 2017')