michaelkryukov / mongomock_motor

Library for mocking AsyncIOMotorClient built on top of mongomock.
MIT License
94 stars 23 forks source link

instances are not hashable #44

Closed FlorianLudwig closed 5 months ago

FlorianLudwig commented 6 months ago

Instances of the client, database and collection are not hashable.

# other implementation - all of these work:
import mongomock
import pymongo
import motor

hash(pymongo.MongoClient())
hash(mongomock.MongoClient())
...

hash(motor.motor_asyncio.AsyncIOMotorClient())
hash(motor.motor_asyncio.AsyncIOMotorClient()['db'])
hash(motor.motor_asyncio.AsyncIOMotorClient()['db']['col'])

# mongomock_motor - none of these work
import mongomock_motor

hash(motor.motor_asyncio.AsyncMongoMockClient())
hash(motor.motor_asyncio.AsyncMongoMockClient()["db"])
hash(motor.motor_asyncio.AsyncMongoMockClient()["db"]["col"])
michaelkryukov commented 5 months ago

Should be good after recent changes

FlorianLudwig commented 5 months ago

awesome, thank you!