Construct the switch_collection context manager. :param cls: the class to change the registered db :param collection_name: the name of the collection to use
(self, cls, collection_name)
| 102 | """ |
| 103 | |
| 104 | def __init__(self, cls, collection_name): |
| 105 | """Construct the switch_collection context manager. |
| 106 | |
| 107 | :param cls: the class to change the registered db |
| 108 | :param collection_name: the name of the collection to use |
| 109 | """ |
| 110 | self.cls = cls |
| 111 | self.ori_collection = cls._get_collection() |
| 112 | self.ori_get_collection_name = cls._get_collection_name |
| 113 | self.collection_name = collection_name |
| 114 | |
| 115 | def __enter__(self): |
| 116 | """Change the _get_collection_name and clear the cached collection.""" |
nothing calls this directly
no test coverage detected