fix using of SQLAlchemy.in_ operator in UT

the in_() operator accepts a list or other non-string sequence.
the error message indicates that a plain string is being passed
which is invalid. 1.3 erroneously allows this to silently pass,
producing a useless expression:

>>> print(column('q').in_('fake-string'))
q IN (:q_1, :q_2, :q_3, :q_4, :q_5, :q_6, :q_7, :q_8, :q_9, :q_10, :q_11)

1.4 correctly detects this error.

Change-Id: I43dd37f975b49de21cd34bbc8ce9378e09e88420
This commit is contained in:
Andrey Pavlov 2021-03-27 17:15:17 +03:00
parent faf3cc0608
commit cdb6eefc25
1 changed files with 3 additions and 3 deletions

View File

@ -242,7 +242,7 @@ class DbApiTestCase(base.DbTestCase):
(item_id, other_item_id))
self.assertEqual(1, len(items))
items = db_api.get_items_by_ids(self.context,
(fakes.random_ec2_id('fake')),)
(fakes.random_ec2_id('fake'),))
self.assertEqual(0, len(items))
items = db_api.get_items_by_ids(self.context,
(item_id, fakes.random_ec2_id('fake')))
@ -294,7 +294,7 @@ class DbApiTestCase(base.DbTestCase):
[public_item_ids[0]])
self.assertEqual(0, len(items))
items = db_api.get_public_items(self.context, 'fake',
fakes.random_ec2_id('fake'))
[fakes.random_ec2_id('fake')])
self.assertEqual(0, len(items))
items = db_api.get_public_items(self.context, 'fake0', [])
self.assertEqual(0, len(items))
@ -454,6 +454,6 @@ class DbApiTestCase(base.DbTestCase):
'key': 'key',
'value': 'val2'}
db_api.add_tags(self.other_context, [tag2])
db_api.delete_tags(self.context, item_id)
db_api.delete_tags(self.context, [item_id])
self.assertThat(db_api.get_tags(self.other_context),
matchers.ListMatches([tag2]))