Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Fix typo in unit tests (#7)
Browse files Browse the repository at this point in the history
* Fix unit tests

* Fix a typo

* Fix a typo

* Fix a typo

* Fix tests
  • Loading branch information
Andersson007 authored Oct 27, 2021
1 parent 98b99ed commit 9fce220
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions plugins/modules/cockroachdb_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''

Expand Down Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions tests/unit/plugins/modules/test_cockroachdb_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}]),
])
Expand All @@ -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),
])
Expand Down

0 comments on commit 9fce220

Please sign in to comment.