@@ -164,17 +164,16 @@ async def test_upload_ensures_index(self):
164
164
await files .drop ()
165
165
await self .fs .upload_from_stream ("filename" , b"junk" )
166
166
167
- self .assertTrue (
168
- any (
169
- info .get ("key" ) == [("files_id" , 1 ), ("n" , 1 )]
170
- for info in (await chunks .index_information ()).values ()
171
- )
167
+ self .assertIn (
168
+ [("files_id" , 1 ), ("n" , 1 )],
169
+ [info .get ("key" ) for info in (await chunks .index_information ()).values ()],
170
+ "Missing required index on chunks collection: {files_id: 1, n: 1}" ,
172
171
)
173
- self . assertTrue (
174
- any (
175
- info . get ( "key" ) == [("filename" , 1 ), ("uploadDate" , 1 )]
176
- for info in (await files .index_information ()).values ()
177
- )
172
+
173
+ self . assertIn (
174
+ [("filename" , 1 ), ("uploadDate" , 1 )],
175
+ [ info . get ( "key" ) for info in (await files .index_information ()).values ()],
176
+ "Missing required index on files collection: {filename: 1, uploadDate: 1}" ,
178
177
)
179
178
180
179
async def test_ensure_index_shell_compat (self ):
@@ -192,11 +191,10 @@ async def test_ensure_index_shell_compat(self):
192
191
# No error.
193
192
await self .fs .upload_from_stream ("filename" , b"data" )
194
193
195
- self .assertTrue (
196
- any (
197
- info .get ("key" ) == [("filename" , 1 ), ("uploadDate" , 1 )]
198
- for info in (await files .index_information ()).values ()
199
- )
194
+ self .assertIn (
195
+ [("filename" , 1 ), ("uploadDate" , 1 )],
196
+ [info .get ("key" ) for info in (await files .index_information ()).values ()],
197
+ "Missing required index on files collection: {filename: 1, uploadDate: 1}" ,
200
198
)
201
199
await files .drop ()
202
200
0 commit comments