diff options
Diffstat (limited to 'tests/unit/completion/test_histcategory.py')
-rw-r--r-- | tests/unit/completion/test_histcategory.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/unit/completion/test_histcategory.py b/tests/unit/completion/test_histcategory.py index 4e3b657e2..cb37fb784 100644 --- a/tests/unit/completion/test_histcategory.py +++ b/tests/unit/completion/test_histcategory.py @@ -100,7 +100,7 @@ def test_set_pattern(pattern, before, after, model_validator, hist): """Validate the filtering and sorting results of set_pattern.""" for row in before: hist.insert({'url': row[0], 'title': row[1], 'last_atime': 1}) - cat = histcategory.HistoryCategory(database=hist._database) + cat = histcategory.HistoryCategory(database=hist.database) model_validator.set_model(cat) cat.set_pattern(pattern) model_validator.validate(after) @@ -111,7 +111,7 @@ def test_set_pattern_repeated(model_validator, hist): hist.insert({'url': 'example.com/foo', 'title': 'title1', 'last_atime': 1}) hist.insert({'url': 'example.com/bar', 'title': 'title2', 'last_atime': 1}) hist.insert({'url': 'example.com/baz', 'title': 'title3', 'last_atime': 1}) - cat = histcategory.HistoryCategory(database=hist._database) + cat = histcategory.HistoryCategory(database=hist.database) model_validator.set_model(cat) cat.set_pattern('b') @@ -144,7 +144,7 @@ def test_set_pattern_repeated(model_validator, hist): ], ids=['numbers', 'characters']) def test_set_pattern_long(hist, message_mock, caplog, pattern): hist.insert({'url': 'example.com/foo', 'title': 'title1', 'last_atime': 1}) - cat = histcategory.HistoryCategory(database=hist._database) + cat = histcategory.HistoryCategory(database=hist.database) with caplog.at_level(logging.ERROR): cat.set_pattern(pattern) msg = message_mock.getmsg(usertypes.MessageLevel.error) @@ -154,7 +154,7 @@ def test_set_pattern_long(hist, message_mock, caplog, pattern): @hypothesis.given(pat=strategies.text()) def test_set_pattern_hypothesis(hist, pat, caplog): hist.insert({'url': 'example.com/foo', 'title': 'title1', 'last_atime': 1}) - cat = histcategory.HistoryCategory(database=hist._database) + cat = histcategory.HistoryCategory(database=hist.database) with caplog.at_level(logging.ERROR): cat.set_pattern(pat) @@ -203,7 +203,7 @@ def test_sorting(max_items, before, after, model_validator, hist, config_stub): for url, title, atime in before: timestamp = datetime.datetime.strptime(atime, '%Y-%m-%d').timestamp() hist.insert({'url': url, 'title': title, 'last_atime': timestamp}) - cat = histcategory.HistoryCategory(database=hist._database) + cat = histcategory.HistoryCategory(database=hist.database) model_validator.set_model(cat) cat.set_pattern('') model_validator.validate(after) @@ -212,7 +212,7 @@ def test_sorting(max_items, before, after, model_validator, hist, config_stub): def test_remove_rows(hist, model_validator): hist.insert({'url': 'foo', 'title': 'Foo', 'last_atime': 0}) hist.insert({'url': 'bar', 'title': 'Bar', 'last_atime': 0}) - cat = histcategory.HistoryCategory(database=hist._database) + cat = histcategory.HistoryCategory(database=hist.database) model_validator.set_model(cat) cat.set_pattern('') hist.delete('url', 'foo') @@ -228,7 +228,7 @@ def test_remove_rows_fetch(hist): 'title': [str(i) for i in range(300)], 'last_atime': [0] * 300, }) - cat = histcategory.HistoryCategory(database=hist._database) + cat = histcategory.HistoryCategory(database=hist.database) cat.set_pattern('') # sanity check that we didn't fetch everything up front @@ -253,14 +253,14 @@ def test_timestamp_fmt(fmt, expected, model_validator, config_stub, data_tmpdir) hist = sql.SqlTable(db, 'CompletionHistory', ['url', 'title', 'last_atime']) atime = datetime.datetime(2018, 2, 27, 8, 30) hist.insert({'url': 'foo', 'title': '', 'last_atime': atime.timestamp()}) - cat = histcategory.HistoryCategory(database=hist._database) + cat = histcategory.HistoryCategory(database=hist.database) model_validator.set_model(cat) cat.set_pattern('') model_validator.validate([('foo', '', expected)]) def test_skip_duplicate_set(message_mock, caplog, hist): - cat = histcategory.HistoryCategory(database=hist._database) + cat = histcategory.HistoryCategory(database=hist.database) cat.set_pattern('foo') cat.set_pattern('foobarbaz') msg = caplog.messages[-1] |