Exemple #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")
Exemple #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")
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")
Exemple #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")
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")
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")
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')
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')
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')