@@ -242,6 +242,7 @@ def test_format_selection_video(self):
242
242
def test_format_selection_string_ops (self ):
243
243
formats = [
244
244
{'format_id' : 'abc-cba' , 'ext' : 'mp4' , 'url' : TEST_URL },
245
+ {'format_id' : 'zxc-cxz' , 'ext' : 'webm' , 'url' : TEST_URL },
245
246
]
246
247
info_dict = _make_result (formats )
247
248
@@ -253,6 +254,11 @@ def test_format_selection_string_ops(self):
253
254
254
255
# does not equal (!=)
255
256
ydl = YDL ({'format' : '[format_id!=abc-cba]' })
257
+ ydl .process_ie_result (info_dict .copy ())
258
+ downloaded = ydl .downloaded_info_dicts [0 ]
259
+ self .assertEqual (downloaded ['format_id' ], 'zxc-cxz' )
260
+
261
+ ydl = YDL ({'format' : '[format_id!=abc-cba][format_id!=zxc-cxz]' })
256
262
self .assertRaises (ExtractorError , ydl .process_ie_result , info_dict .copy ())
257
263
258
264
# starts with (^=)
@@ -262,7 +268,12 @@ def test_format_selection_string_ops(self):
262
268
self .assertEqual (downloaded ['format_id' ], 'abc-cba' )
263
269
264
270
# does not start with (!^=)
265
- ydl = YDL ({'format' : '[format_id!^=abc-cba]' })
271
+ ydl = YDL ({'format' : '[format_id!^=abc]' })
272
+ ydl .process_ie_result (info_dict .copy ())
273
+ downloaded = ydl .downloaded_info_dicts [0 ]
274
+ self .assertEqual (downloaded ['format_id' ], 'zxc-cxz' )
275
+
276
+ ydl = YDL ({'format' : '[format_id!^=abc][format_id!^=zxc]' })
266
277
self .assertRaises (ExtractorError , ydl .process_ie_result , info_dict .copy ())
267
278
268
279
# ends with ($=)
@@ -272,16 +283,29 @@ def test_format_selection_string_ops(self):
272
283
self .assertEqual (downloaded ['format_id' ], 'abc-cba' )
273
284
274
285
# does not end with (!$=)
275
- ydl = YDL ({'format' : '[format_id!$=abc-cba]' })
286
+ ydl = YDL ({'format' : '[format_id!$=cba]' })
287
+ ydl .process_ie_result (info_dict .copy ())
288
+ downloaded = ydl .downloaded_info_dicts [0 ]
289
+ self .assertEqual (downloaded ['format_id' ], 'zxc-cxz' )
290
+
291
+ ydl = YDL ({'format' : '[format_id!$=cba][format_id!$=cxz]' })
276
292
self .assertRaises (ExtractorError , ydl .process_ie_result , info_dict .copy ())
277
293
278
294
# contains (*=)
279
- ydl = YDL ({'format' : '[format_id*=- ]' })
295
+ ydl = YDL ({'format' : '[format_id*=bc-cb ]' })
280
296
ydl .process_ie_result (info_dict .copy ())
281
297
downloaded = ydl .downloaded_info_dicts [0 ]
282
298
self .assertEqual (downloaded ['format_id' ], 'abc-cba' )
283
299
284
300
# does not contain (!*=)
301
+ ydl = YDL ({'format' : '[format_id!*=bc-cb]' })
302
+ ydl .process_ie_result (info_dict .copy ())
303
+ downloaded = ydl .downloaded_info_dicts [0 ]
304
+ self .assertEqual (downloaded ['format_id' ], 'zxc-cxz' )
305
+
306
+ ydl = YDL ({'format' : '[format_id!*=abc][format_id!*=zxc]' })
307
+ self .assertRaises (ExtractorError , ydl .process_ie_result , info_dict .copy ())
308
+
285
309
ydl = YDL ({'format' : '[format_id!*=-]' })
286
310
self .assertRaises (ExtractorError , ydl .process_ie_result , info_dict .copy ())
287
311
0 commit comments