-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from Kuniwak/neovim-support
Neovim support
- Loading branch information
Showing
11 changed files
with
153 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tnoremap <C-h> <C-\><C-n><C-w>h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import unittest | ||
|
||
from vint.linting.config.config_util import get_config_value | ||
|
||
|
||
class TestConfigUtil(unittest.TestCase): | ||
def test_get_config_value_when_empty(self): | ||
config_dict = {} | ||
|
||
self.assertIsNone(get_config_value(config_dict, ['a'])) | ||
|
||
|
||
def test_get_config_value_when_nested_1_depth(self): | ||
config_dict = {'a': 'A'} | ||
|
||
self.assertIs(get_config_value(config_dict, ['a']), 'A') | ||
|
||
|
||
def test_get_config_value_when_nested_2_depth(self): | ||
config_dict = {'a': {'b': 'B'}} | ||
|
||
self.assertIs(get_config_value(config_dict, ['a', 'b']), 'B') | ||
|
||
|
||
def test_get_config_value_when_target_is_dict(self): | ||
config_dict = {'a': {'b': 'B'}} | ||
|
||
self.assertEqual(get_config_value(config_dict, ['a']), {'b': 'B'}) | ||
|
||
|
||
def test_get_config_value_when_target_is_depth_2_unexistent_dict(self): | ||
config_dict = {'a': 'A'} | ||
|
||
self.assertEqual(get_config_value(config_dict, ['c', 'b']), None) | ||
|
||
|
||
def test_get_config_value_when_given_default(self): | ||
config_dict = {'a': 'A'} | ||
|
||
self.assertEqual(get_config_value(config_dict, ['c', 'b'], 'DEFAULT'), 'DEFAULT') | ||
|
||
|
||
def test_get_config_value_when_given_default_but_not_used(self): | ||
config_dict = {'a': 'A'} | ||
|
||
self.assertEqual(get_config_value(config_dict, ['a'], 'DEFAULT'), 'A') | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
def get_config_value(config_dict, keys, default=None): | ||
inner_dict = config_dict | ||
|
||
for key in keys[:-1]: | ||
if key not in inner_dict: | ||
return default | ||
|
||
inner_dict = inner_dict[key] | ||
|
||
return inner_dict.get(keys[-1], default) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters