diff options
author | Irina Truong <i.chernyavska@gmail.com> | 2019-05-25 13:08:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-25 13:08:56 -0700 |
commit | 8cb7009bcd0f0062942932c853706a36178f566c (patch) | |
tree | cb5bb42674ccce90b173e7a2f09bf72157ae4a86 /tests/test_completion_refresher.py | |
parent | a5e607b6fc889afd3f8960ca3903ae16b641c304 (diff) |
black all the things. (#1049)
* added black to develop guide
* no need for pep8radius.
* changelog.
* Add pre-commit checkbox.
* Add pre-commit to dev reqs.
* Add pyproject.toml for black.
* Pre-commit config.
* Add black to travis and dev reqs.
* Install and run black in travis.
* Remove black from dev reqs.
* Lower black target version.
* Re-format with black.
Diffstat (limited to 'tests/test_completion_refresher.py')
-rw-r--r-- | tests/test_completion_refresher.py | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/test_completion_refresher.py b/tests/test_completion_refresher.py index e6a39ba4..6a916a81 100644 --- a/tests/test_completion_refresher.py +++ b/tests/test_completion_refresher.py @@ -6,6 +6,7 @@ from mock import Mock, patch @pytest.fixture def refresher(): from pgcli.completion_refresher import CompletionRefresher + return CompletionRefresher() @@ -17,8 +18,15 @@ def test_ctor(refresher): """ assert len(refresher.refreshers) > 0 actual_handlers = list(refresher.refreshers.keys()) - expected_handlers = ['schemata', 'tables', 'views', - 'types', 'databases', 'casing', 'functions'] + expected_handlers = [ + "schemata", + "tables", + "views", + "types", + "databases", + "casing", + "functions", + ] assert expected_handlers == actual_handlers @@ -32,14 +40,13 @@ def test_refresh_called_once(refresher): pgexecute = Mock() special = Mock() - with patch.object(refresher, '_bg_refresh') as bg_refresh: + with patch.object(refresher, "_bg_refresh") as bg_refresh: actual = refresher.refresh(pgexecute, special, callbacks) time.sleep(1) # Wait for the thread to work. assert len(actual) == 1 assert len(actual[0]) == 4 - assert actual[0][3] == 'Auto-completion refresh started in the background.' - bg_refresh.assert_called_with(pgexecute, special, callbacks, None, - None) + assert actual[0][3] == "Auto-completion refresh started in the background." + bg_refresh.assert_called_with(pgexecute, special, callbacks, None, None) def test_refresh_called_twice(refresher): @@ -62,13 +69,13 @@ def test_refresh_called_twice(refresher): time.sleep(1) # Wait for the thread to work. assert len(actual1) == 1 assert len(actual1[0]) == 4 - assert actual1[0][3] == 'Auto-completion refresh started in the background.' + assert actual1[0][3] == "Auto-completion refresh started in the background." actual2 = refresher.refresh(pgexecute, special, callbacks) time.sleep(1) # Wait for the thread to work. assert len(actual2) == 1 assert len(actual2[0]) == 4 - assert actual2[0][3] == 'Auto-completion refresh restarted.' + assert actual2[0][3] == "Auto-completion refresh restarted." def test_refresh_with_callbacks(refresher): @@ -82,9 +89,9 @@ def test_refresh_with_callbacks(refresher): pgexecute.extra_args = {} special = Mock() - with patch('pgcli.completion_refresher.PGExecute', pgexecute_class): + with patch("pgcli.completion_refresher.PGExecute", pgexecute_class): # Set refreshers to 0: we're not testing refresh logic here refresher.refreshers = {} refresher.refresh(pgexecute, special, callbacks) time.sleep(1) # Wait for the thread to work. - assert (callbacks[0].call_count == 1) + assert callbacks[0].call_count == 1 |