diff options
Diffstat (limited to 'test/test_completion_refresher.py')
-rw-r--r-- | test/test_completion_refresher.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/test_completion_refresher.py b/test/test_completion_refresher.py index 31359cf..6f192d0 100644 --- a/test/test_completion_refresher.py +++ b/test/test_completion_refresher.py @@ -6,6 +6,7 @@ from unittest.mock import Mock, patch @pytest.fixture def refresher(): from mycli.completion_refresher import CompletionRefresher + return CompletionRefresher() @@ -18,8 +19,7 @@ def test_ctor(refresher): """ assert len(refresher.refreshers) > 0 actual_handlers = list(refresher.refreshers.keys()) - expected_handlers = ['databases', 'schemata', 'tables', 'users', 'functions', - 'special_commands', 'show_commands', 'keywords'] + expected_handlers = ["databases", "schemata", "tables", "users", "functions", "special_commands", "show_commands", "keywords"] assert expected_handlers == actual_handlers @@ -32,12 +32,12 @@ def test_refresh_called_once(refresher): callbacks = Mock() sqlexecute = Mock() - with patch.object(refresher, '_bg_refresh') as bg_refresh: + with patch.object(refresher, "_bg_refresh") as bg_refresh: actual = refresher.refresh(sqlexecute, 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.' + assert actual[0][3] == "Auto-completion refresh started in the background." bg_refresh.assert_called_with(sqlexecute, callbacks, {}) @@ -61,13 +61,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(sqlexecute, 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): @@ -80,9 +80,9 @@ def test_refresh_with_callbacks(refresher): sqlexecute_class = Mock() sqlexecute = Mock() - with patch('mycli.completion_refresher.SQLExecute', sqlexecute_class): + with patch("mycli.completion_refresher.SQLExecute", sqlexecute_class): # Set refreshers to 0: we're not testing refresh logic here refresher.refreshers = {} refresher.refresh(sqlexecute, callbacks) time.sleep(1) # Wait for the thread to work. - assert (callbacks[0].call_count == 1) + assert callbacks[0].call_count == 1 |