@@ -164,17 +164,16 @@ async def test_upload_ensures_index(self):
164164 await files .drop ()
165165 await self .fs .upload_from_stream ("filename" , b"junk" )
166166
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}" ,
172171 )
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}" ,
178177 )
179178
180179 async def test_ensure_index_shell_compat (self ):
@@ -192,11 +191,10 @@ async def test_ensure_index_shell_compat(self):
192191 # No error.
193192 await self .fs .upload_from_stream ("filename" , b"data" )
194193
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}" ,
200198 )
201199 await files .drop ()
202200
0 commit comments