MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_command_with_regex

Method test_command_with_regex

test/test_database.py:409–417  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

407 # We use 'aggregate' as our example command, since it's an easy way to
408 # retrieve a BSON regex from a collection using a command.
409 def test_command_with_regex(self):
410 db = self.client.pymongo_test
411 db.test.drop()
412 db.test.insert_one({"r": re.compile(".*")})
413 db.test.insert_one({"r": Regex(".*")})
414
415 result = db.command("aggregate", "test", pipeline=[], cursor={})
416 for doc in result["cursor"]["firstBatch"]:
417 self.assertIsInstance(doc["r"], Regex)
418
419 def test_command_bulkWrite(self):
420 # Ensure bulk write commands can be run directly via db.command().

Callers

nothing calls this directly

Calls 4

RegexClass · 0.90
dropMethod · 0.45
insert_oneMethod · 0.45
commandMethod · 0.45

Tested by

no test coverage detected