Skip to content

Commit 206bf79

Browse files
committed
tests: replace .within assertion with .contains
Since python 3.14 `.within` requires argument to be iterable or list of items. So, let's replace it with `.contain` when it comes to substring search.
1 parent 93b9c6f commit 206bf79

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tests/integration/cqlengine/test_timestamp.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_batch_is_included(self):
4747
with BatchQuery(timestamp=timedelta(seconds=30)) as b:
4848
TestTimestampModel.batch(b).create(count=1)
4949

50-
"USING TIMESTAMP".should.be.within(m.call_args[0][0].query_string)
50+
m.call_args[0][0].query_string.should.match("USING TIMESTAMP")
5151

5252

5353
class CreateWithTimestampTest(BaseTimestampTest):
@@ -66,7 +66,7 @@ def test_timestamp_not_included_on_normal_create(self):
6666
with mock.patch.object(self.session, "execute") as m:
6767
TestTimestampModel.create(count=2)
6868

69-
"USING TIMESTAMP".shouldnt.be.within(m.call_args[0][0].query_string)
69+
m.call_args[0][0].query_string.shouldnt.match("USING TIMESTAMP")
7070

7171
def test_timestamp_is_set_on_model_queryset(self):
7272
delta = timedelta(seconds=30)
@@ -86,9 +86,7 @@ def test_non_batch_syntax_unit(self):
8686
with mock.patch.object(self.session, "execute") as m:
8787
TestTimestampModel.timestamp(timedelta(seconds=30)).create(count=1)
8888

89-
query = m.call_args[0][0].query_string
90-
91-
"USING TIMESTAMP".should.be.within(query)
89+
m.call_args[0][0].query_string.should.match("USING TIMESTAMP")
9290

9391
def test_non_batch_syntax_with_ttl_unit(self):
9492

@@ -111,16 +109,14 @@ def test_instance_update_includes_timestamp_in_query(self):
111109

112110
with mock.patch.object(self.session, "execute") as m:
113111
self.instance.timestamp(timedelta(seconds=30)).update(count=2)
114-
115-
"USING TIMESTAMP".should.be.within(m.call_args[0][0].query_string)
112+
m.call_args[0][0].query_string.should.match("USING TIMESTAMP")
116113

117114
def test_instance_update_in_batch(self):
118115
with mock.patch.object(self.session, "execute") as m:
119116
with BatchQuery() as b:
120117
self.instance.batch(b).timestamp(timedelta(seconds=30)).update(count=2)
121118

122-
query = m.call_args[0][0].query_string
123-
"USING TIMESTAMP".should.be.within(query)
119+
m.call_args[0][0].query_string.should.match("USING TIMESTAMP")
124120

125121

126122
class DeleteWithTimestampTest(BaseTimestampTest):

0 commit comments

Comments
 (0)