Skip to content

Commit fb04188

Browse files
committed
oops my regex forgot to account for this whitespace
1 parent 1f308bd commit fb04188

File tree

2 files changed

+36
-30
lines changed

2 files changed

+36
-30
lines changed

test/asynchronous/test_session.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ async def _test_ops(self, client, *ops):
134134
await f(*args, **kw)
135135
self.assertGreaterEqual(len(listener.started_events), 1)
136136
for event in listener.started_events:
137-
self.assertTrue(
138-
"lsid" in event.command,
137+
self.assertIn(
138+
"lsid",
139+
event.command,
139140
f"{f.__name__} sent no lsid with {event.command_name}",
140141
)
141142

@@ -170,8 +171,9 @@ async def _test_ops(self, client, *ops):
170171
self.assertGreaterEqual(len(listener.started_events), 1)
171172
lsids = []
172173
for event in listener.started_events:
173-
self.assertTrue(
174-
"lsid" in event.command,
174+
self.assertIn(
175+
"lsid",
176+
event.command,
175177
f"{f.__name__} sent no lsid with {event.command_name}",
176178
)
177179

@@ -422,8 +424,9 @@ async def test_cursor(self):
422424
await f(session=s)
423425
self.assertGreaterEqual(len(listener.started_events), 1)
424426
for event in listener.started_events:
425-
self.assertTrue(
426-
"lsid" in event.command,
427+
self.assertIn(
428+
"lsid",
429+
event.command,
427430
f"{name} sent no lsid with {event.command_name}",
428431
)
429432

@@ -441,15 +444,13 @@ async def test_cursor(self):
441444
listener.reset()
442445
await f(session=None)
443446
event0 = listener.first_command_started()
444-
self.assertTrue(
445-
"lsid" in event0.command, f"{name} sent no lsid with {event0.command_name}"
446-
)
447+
self.assertIn("lsid", event0.command, f"{name} sent no lsid with {event0.command_name}")
447448

448449
lsid = event0.command["lsid"]
449450

450451
for event in listener.started_events[1:]:
451-
self.assertTrue(
452-
"lsid" in event.command, f"{name} sent no lsid with {event.command_name}"
452+
self.assertIn(
453+
"lsid", event.command, f"{name} sent no lsid with {event.command_name}"
453454
)
454455

455456
self.assertEqual(
@@ -1201,15 +1202,17 @@ async def aggregate():
12011202

12021203
self.assertGreaterEqual(len(listener.started_events), 1)
12031204
for i, event in enumerate(listener.started_events):
1204-
self.assertTrue(
1205-
"$clusterTime" in event.command,
1205+
self.assertIn(
1206+
"$clusterTime",
1207+
event.command,
12061208
f"{f.__name__} sent no $clusterTime with {event.command_name}",
12071209
)
12081210

12091211
if i > 0:
12101212
succeeded = listener.succeeded_events[i - 1]
1211-
self.assertTrue(
1212-
"$clusterTime" in succeeded.reply,
1213+
self.assertIn(
1214+
"$clusterTime",
1215+
succeeded.reply,
12131216
f"{f.__name__} received no $clusterTime with {succeeded.command_name}",
12141217
)
12151218

test/test_session.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ def _test_ops(self, client, *ops):
134134
f(*args, **kw)
135135
self.assertGreaterEqual(len(listener.started_events), 1)
136136
for event in listener.started_events:
137-
self.assertTrue(
138-
"lsid" in event.command,
137+
self.assertIn(
138+
"lsid",
139+
event.command,
139140
f"{f.__name__} sent no lsid with {event.command_name}",
140141
)
141142

@@ -170,8 +171,9 @@ def _test_ops(self, client, *ops):
170171
self.assertGreaterEqual(len(listener.started_events), 1)
171172
lsids = []
172173
for event in listener.started_events:
173-
self.assertTrue(
174-
"lsid" in event.command,
174+
self.assertIn(
175+
"lsid",
176+
event.command,
175177
f"{f.__name__} sent no lsid with {event.command_name}",
176178
)
177179

@@ -422,8 +424,9 @@ def test_cursor(self):
422424
f(session=s)
423425
self.assertGreaterEqual(len(listener.started_events), 1)
424426
for event in listener.started_events:
425-
self.assertTrue(
426-
"lsid" in event.command,
427+
self.assertIn(
428+
"lsid",
429+
event.command,
427430
f"{name} sent no lsid with {event.command_name}",
428431
)
429432

@@ -441,15 +444,13 @@ def test_cursor(self):
441444
listener.reset()
442445
f(session=None)
443446
event0 = listener.first_command_started()
444-
self.assertTrue(
445-
"lsid" in event0.command, f"{name} sent no lsid with {event0.command_name}"
446-
)
447+
self.assertIn("lsid", event0.command, f"{name} sent no lsid with {event0.command_name}")
447448

448449
lsid = event0.command["lsid"]
449450

450451
for event in listener.started_events[1:]:
451-
self.assertTrue(
452-
"lsid" in event.command, f"{name} sent no lsid with {event.command_name}"
452+
self.assertIn(
453+
"lsid", event.command, f"{name} sent no lsid with {event.command_name}"
453454
)
454455

455456
self.assertEqual(
@@ -1187,15 +1188,17 @@ def aggregate():
11871188

11881189
self.assertGreaterEqual(len(listener.started_events), 1)
11891190
for i, event in enumerate(listener.started_events):
1190-
self.assertTrue(
1191-
"$clusterTime" in event.command,
1191+
self.assertIn(
1192+
"$clusterTime",
1193+
event.command,
11921194
f"{f.__name__} sent no $clusterTime with {event.command_name}",
11931195
)
11941196

11951197
if i > 0:
11961198
succeeded = listener.succeeded_events[i - 1]
1197-
self.assertTrue(
1198-
"$clusterTime" in succeeded.reply,
1199+
self.assertIn(
1200+
"$clusterTime",
1201+
succeeded.reply,
11991202
f"{f.__name__} received no $clusterTime with {succeeded.command_name}",
12001203
)
12011204

0 commit comments

Comments
 (0)