Skip to content

Commit 89dcfac

Browse files
committed
cleaned up _test_ops more
1 parent 9e0f409 commit 89dcfac

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

test/asynchronous/test_comment.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,10 @@ async def _test_ops(
5959
)
6060
if isinstance(maybe_cursor, AsyncCommandCursor):
6161
await maybe_cursor.close()
62-
tested = False
63-
# For some reason collection.list_indexes creates two commands and the first
64-
# one doesn't contain 'comment'.
65-
for i in listener.started_events:
66-
if cc == i.command.get("comment", ""):
67-
self.assertEqual(cc, i.command["comment"])
68-
tested = True
69-
self.assertTrue(tested)
62+
63+
cmd = listener.started_events[0]
64+
self.assertEqual(cc, cmd.command.get("comment"), msg=cmd)
65+
7066
if h.__name__ != "aggregate_raw_batches":
7167
self.assertIn(
7268
":param comment:",

test/test_comment.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,10 @@ def _test_ops(
5959
)
6060
if isinstance(maybe_cursor, CommandCursor):
6161
maybe_cursor.close()
62-
tested = False
63-
# For some reason collection.list_indexes creates two commands and the first
64-
# one doesn't contain 'comment'.
65-
for i in listener.started_events:
66-
if cc == i.command.get("comment", ""):
67-
self.assertEqual(cc, i.command["comment"])
68-
tested = True
69-
self.assertTrue(tested)
62+
63+
cmd = listener.started_events[0]
64+
self.assertEqual(cc, cmd.command.get("comment"), msg=cmd)
65+
7066
if h.__name__ != "aggregate_raw_batches":
7167
self.assertIn(
7268
":param comment:",

0 commit comments

Comments
 (0)