mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	Merge pull request #333 from mlk/master
basic support for the hdfs dfs <command> when the command misses the …
This commit is contained in:
		
							
								
								
									
										35
									
								
								tests/rules/test_unknown_command.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								tests/rules/test_unknown_command.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| import pytest | ||||
| from thefuck.rules.unknown_command 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', | ||||
|         stderr='ls: Unknown command\nDid you mean -ls?  This command begins with a dash.'), ['hdfs dfs -ls']), | ||||
|     (Command('hdfs dfs rm /foo/bar', | ||||
|         stderr='rm: Unknown command\nDid you mean -rm?  This command begins with a dash.'), ['hdfs dfs -rm /foo/bar']), | ||||
|     (Command('./bin/hdfs dfs ls -R /foo/bar', | ||||
|         stderr='ls: Unknown command\nDid you mean -ls?  This command begins with a dash.'), ['./bin/hdfs dfs -ls -R /foo/bar']), | ||||
|     (Command('./bin/hdfs dfs -Dtest=fred ls -R /foo/bar', | ||||
|         stderr='ls: Unknown command\nDid you mean -ls?  This command begins with a dash.'), ['./bin/hdfs dfs -Dtest=fred -ls -R /foo/bar'])]) | ||||
| def test_get_new_command(command, new_command): | ||||
|     assert get_new_command(command, None) == new_command | ||||
|  | ||||
		Reference in New Issue
	
	Block a user