def test_redirect_cannot_open(): text = '> b' with pytest.raises(TF): _cmdline_get_redirect(ps(text), text)
def test_redirect_dangling(): text = 'a >' with pytest.raises(TF): _cmdline_get_redirect(ps(text), text)
def test_redirect_to_command(): text = 'a > b c' with pytest.raises(TF): _cmdline_get_redirect(ps(text), text)
def test_redirect_double(): text = 'a > d > e' with pytest.raises(TF): _cmdline_get_redirect(ps(text), text)
def test_redirect_before_pipe(): text = 'a > d | e' with pytest.raises(TF): _cmdline_get_redirect(ps(text), text)
def test_redirect_not_found(): text = 'a' _, redirect = _cmdline_get_redirect(ps(text), text) assert redirect is None
def test_redirect_found_without_spaces(): text = 'a>d' _, redirect = _cmdline_get_redirect(ps(text), text) assert redirect == 'd'
def test_redirect_cannot_open(): text = '> b' with pytest.raises(Exception): _cmdline_get_redirect(State(text), text)
def test_redirect_to_command(): text = 'a > b c' with pytest.raises(Exception): _cmdline_get_redirect(State(text), text)
def test_redirect_dangling(): text = 'a >' with pytest.raises(Exception): _cmdline_get_redirect(State(text), text)
def test_redirect_before_pipe(): text = 'a > d | e' with pytest.raises(Exception): _cmdline_get_redirect(State(text), text)
def test_redirect_double(): text = 'a > d > e' with pytest.raises(Exception): _cmdline_get_redirect(State(text), text)