From 9fce220c5187a68adc3ac7ac585a4011b36b24bb Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Wed, 27 Oct 2021 15:14:07 +0300 Subject: [PATCH] Fix typo in unit tests (#7) * Fix unit tests * Fix a typo * Fix a typo * Fix a typo * Fix tests --- plugins/modules/cockroachdb_query.py | 4 +-- .../plugins/modules/test_cockroachdb_query.py | 28 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugins/modules/cockroachdb_query.py b/plugins/modules/cockroachdb_query.py index c662835..e1e15c5 100644 --- a/plugins/modules/cockroachdb_query.py +++ b/plugins/modules/cockroachdb_query.py @@ -53,7 +53,7 @@ return value will be of the tuple type. - Returns dictionaries by default. type: str - choises: [dict, tuple] + choices: [dict, tuple] default: dict ''' @@ -269,7 +269,7 @@ def main(): query=dict(type='str'), positional_args=dict(type='list', elements='raw'), named_args=dict(type='dict'), - rows_type=dict(type='str', choises=['dict', 'tuple'], default='dict'), + rows_type=dict(type='str', choices=['dict', 'tuple'], default='dict'), ) # Instantiate an object of module class diff --git a/tests/unit/plugins/modules/test_cockroachdb_query.py b/tests/unit/plugins/modules/test_cockroachdb_query.py index ed32e12..38d893e 100644 --- a/tests/unit/plugins/modules/test_cockroachdb_query.py +++ b/tests/unit/plugins/modules/test_cockroachdb_query.py @@ -47,10 +47,10 @@ def test_convert_to_supported(input_, expected): @pytest.mark.parametrize('input_, expected', [ ([('first value', timedelta(0, 43200))], [('first value', '12:00:00')]), ([(1, Decimal('1.01'))], [(1, 1.01)]), - ([('string')], [('string')]), - ([(None)], [(None)]), - ([(1), (2), (1, Decimal('1.01'))], [(1), (2), (1, 1.01)]), - ([(1), (2)], [(1), (2)]), + ([('string',)], [('string',)]), + ([(None,)], [(None,)]), + ([(1,), (2,), (1, Decimal('1.01'))], [(1,), (2,), (1, 1.01)]), + ([(1,), (2,)], [(1,), (2,)]), ]) def test_fetch_from_cursor_tuple(input_, expected): # fetch_from_cursor_tuple function requires an argument @@ -64,9 +64,9 @@ def test_fetch_from_cursor_tuple(input_, expected): @pytest.mark.parametrize('input_, expected', [ ([{1: 'first value', 2: timedelta(0, 43200)}], [{1: 'first value', 2: '12:00:00'}]), - ([{1: 1, 2: Decimal('1.01')}], [{1: 1, 2: 1.01)}), - ([{1: 'string'}], [{2: 'string'}]), - ([{1: None}], [{2: None}]), + ([{1: 1, 2: Decimal('1.01')}], [{1: 1, 2: 1.01}]), + ([{1: 'string'}], [{1: 'string'}]), + ([{1: None}], [{1: None}]), ([{1: 1}, {2: 2}, {1: 1, 2: Decimal('1.01')}], [{1: 1}, {2: 2}, {1: 1, 2: 1.01}]), ([{1: 1}, {2: 2}], [{1: 1}, {2: 2}]), ]) @@ -83,14 +83,14 @@ def test_fetch_from_cursor_dict(input_, expected): @pytest.mark.parametrize('sequence,expected,fetch_func', [ ([('first value', timedelta(0, 43200))], [('first value', '12:00:00')], fetch_from_cursor_tuple), ([(1, Decimal('1.01'))], [(1, 1.01)], fetch_from_cursor_tuple), - ([('string')], [('string')], fetch_from_cursor_tuple), - ([(None)], [(None)], fetch_from_cursor_tuple), - ([(1), (2), (1, Decimal('1.01'))], [(1), (2), (1, 1.01)], fetch_from_cursor_tuple), - ([(1), (2)], [(1), (2)], fetch_from_cursor_tuple), + ([('string',)], [('string',)], fetch_from_cursor_tuple), + ([(None,)], [(None,)], fetch_from_cursor_tuple), + ([(1,), (2,), (1, Decimal('1.01'))], [(1,), (2,), (1, 1.01)], fetch_from_cursor_tuple), + ([(1,), (2,)], [(1,), (2,)], fetch_from_cursor_tuple), ([{1: 'first value', 2: timedelta(0, 43200)}], [{1: 'first value', 2: '12:00:00'}], fetch_from_cursor_dict), - ([{1: 1, 2: Decimal('1.01')}], [{1: 1, 2: 1.01)}, fetch_from_cursor_dict), - ([{1: 'string'}], [{2: 'string'}], fetch_from_cursor_dict), - ([{1: None}], [{2: None}], fetch_from_cursor_dict), + ([{1: 1, 2: Decimal('1.01')}], [{1: 1, 2: 1.01}], fetch_from_cursor_dict), + ([{1: 'string'}], [{1: 'string'}], fetch_from_cursor_dict), + ([{1: None}], [{1: None}], fetch_from_cursor_dict), ([{1: 1}, {2: 2}, {1: 1, 2: Decimal('1.01')}], [{1: 1}, {2: 2}, {1: 1, 2: 1.01}], fetch_from_cursor_dict), ([{1: 1}, {2: 2}], [{1: 1}, {2: 2}], fetch_from_cursor_dict), ])