mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-22 02:29:07 +00:00
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
import pytest
|
|
from thefuck.rules.hadoop_dfs_missing_dash import match, get_new_command
|
|
from tests.utils import Command
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
|
Command(script='./bin/hdfs dfs ls', stderr='ls: Unknown command\nDid you mean -ls? This command begins with a dash.'),
|
|
Command(script='hdfs dfs ls',
|
|
stderr='ls: Unknown command\nDid you mean -ls? This command begins with a dash.'),
|
|
Command(script='hdfs dfs ls /foo/bar', stderr='ls: Unknown command\nDid you mean -ls? This command begins with a dash.')])
|
|
def test_match(command):
|
|
assert match(command, None)
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
|
Command(script='./bin/hdfs dfs -ls', stderr=''),
|
|
Command(script='./bin/hdfs dfs -ls /foo/bar', stderr=''),
|
|
Command(script='hdfs dfs -ls -R /foo/bar', stderr=''),
|
|
Command()])
|
|
def test_not_match(command):
|
|
assert not match(command, None)
|
|
|
|
|
|
@pytest.mark.parametrize('command, new_command', [
|
|
(Command('hdfs dfs ls'), 'hdfs dfs -ls'),
|
|
(Command('hdfs dfs ls /foo/bar'), 'hdfs dfs -ls /foo/bar'),
|
|
(Command('./bin/hdfs dfs ls -R /foo/bar'), './bin/hdfs dfs -ls -R /foo/bar')])
|
|
def test_get_new_command(command, new_command):
|
|
assert get_new_command(command, None) == new_command
|
|
|