From c7a18a8b8d9ff723216d4535257e22e821d67aaf Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Tue, 13 Jun 2017 21:14:47 -0400 Subject: [PATCH] Fix tests for recent sql changes --- tests/end2end/features/test_history_bdd.py | 2 +- tests/unit/completion/test_sqlcategory.py | 25 ++++++++-------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/tests/end2end/features/test_history_bdd.py b/tests/end2end/features/test_history_bdd.py index c1000d6ce..f5639f5f3 100644 --- a/tests/end2end/features/test_history_bdd.py +++ b/tests/end2end/features/test_history_bdd.py @@ -30,7 +30,7 @@ def check_history(quteproc, httpbin, tmpdir, expected): path = tmpdir / 'history' quteproc.send_cmd(':debug-dump-history "{}"'.format(path)) quteproc.wait_for(category='message', loglevel=logging.INFO, - message='Dumped history to {}.'.format(path)) + message='Dumped history to {}'.format(path)) with open(path, 'r', encoding='utf-8') as f: # ignore access times, they will differ in each run diff --git a/tests/unit/completion/test_sqlcategory.py b/tests/unit/completion/test_sqlcategory.py index d81fa8cf0..ad1ff7e75 100644 --- a/tests/unit/completion/test_sqlcategory.py +++ b/tests/unit/completion/test_sqlcategory.py @@ -61,7 +61,7 @@ pytestmark = pytest.mark.usefixtures('init_sql') def test_sorting(sort_by, sort_order, data, expected): table = sql.SqlTable('Foo', ['a', 'b', 'c']) for row in data: - table.insert(a=row[0], b=row[1], c=row[2]) + table.insert({'a': row[0], 'b': row[1], 'c': row[2]}) cat = sqlcategory.SqlCategory('Foo', filter_fields=['a'], sort_by=sort_by, sort_order=sort_order) cat.set_pattern('') @@ -117,7 +117,7 @@ def test_set_pattern(pattern, filter_cols, before, after): """Validate the filtering and sorting results of set_pattern.""" table = sql.SqlTable('Foo', ['a', 'b', 'c']) for row in before: - table.insert(a=row[0], b=row[1], c=row[2]) + table.insert({'a': row[0], 'b': row[1], 'c': row[2]}) filter_fields = [['a', 'b', 'c'][i] for i in filter_cols] cat = sqlcategory.SqlCategory('Foo', filter_fields=filter_fields) cat.set_pattern(pattern) @@ -126,7 +126,7 @@ def test_set_pattern(pattern, filter_cols, before, after): def test_select(): table = sql.SqlTable('Foo', ['a', 'b', 'c']) - table.insert(a='foo', b='bar', c='baz') + table.insert({'a': 'foo', 'b': 'bar', 'c': 'baz'}) cat = sqlcategory.SqlCategory('Foo', filter_fields=['a'], select='b, c, a') cat.set_pattern('') utils.validate_model(cat, [('bar', 'baz', 'foo')]) @@ -134,8 +134,8 @@ def test_select(): def test_where(): table = sql.SqlTable('Foo', ['a', 'b', 'c']) - table.insert(a='foo', b='bar', c=False) - table.insert(a='baz', b='biz', c=True) + table.insert({'a': 'foo', 'b': 'bar', 'c': False}) + table.insert({'a': 'baz', 'b': 'biz', 'c': True}) cat = sqlcategory.SqlCategory('Foo', filter_fields=['a'], where='not c') cat.set_pattern('') utils.validate_model(cat, [('foo', 'bar', False)]) @@ -143,18 +143,11 @@ def test_where(): def test_group(): table = sql.SqlTable('Foo', ['a', 'b']) - table.insert(a='foo', b=1) - table.insert(a='bar', b=3) - table.insert(a='foo', b=2) - table.insert(a='bar', b=0) + table.insert({'a': 'foo', 'b': 1}) + table.insert({'a': 'bar', 'b': 3}) + table.insert({'a': 'foo', 'b': 2}) + table.insert({'a': 'bar', 'b': 0}) cat = sqlcategory.SqlCategory('Foo', filter_fields=['a'], select='a, max(b)', group_by='a') cat.set_pattern('') utils.validate_model(cat, [('bar', 3), ('foo', 2)]) - - -def test_entry(): - table = sql.SqlTable('Foo', ['a', 'b', 'c']) - assert hasattr(table.Entry, 'a') - assert hasattr(table.Entry, 'b') - assert hasattr(table.Entry, 'c')