summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2018-04-24 23:49:30 +0700
committerSergey M․ <[email protected]>2018-04-24 23:54:49 +0700
commit1cc47c667419e0eadc0a6989256ab7b276852adf (patch)
tree7aae871998b25632bd5dcd1bb03d4f1511e995a1 /test
parent99036a1298089068dcf80c0985bfcc3f8c24f281 (diff)
downloadyoutube-dl-1cc47c667419e0eadc0a6989256ab7b276852adf.tar.gz
youtube-dl-1cc47c667419e0eadc0a6989256ab7b276852adf.zip
[utils] Fix match_str for boolean meta fields
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index a1fe6fdb2..253a7fe17 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -1072,6 +1072,18 @@ ffmpeg version 2.4.4 Copyright (c) 2000-2014 the FFmpeg ...'''), '2.4.4')
self.assertFalse(match_str(
'like_count > 100 & dislike_count <? 50 & description',
{'like_count': 190, 'dislike_count': 10}))
+ self.assertTrue(match_str('is_live', {'is_live': True}))
+ self.assertFalse(match_str('is_live', {'is_live': False}))
+ self.assertFalse(match_str('is_live', {'is_live': None}))
+ self.assertFalse(match_str('is_live', {}))
+ self.assertFalse(match_str('!is_live', {'is_live': True}))
+ self.assertTrue(match_str('!is_live', {'is_live': False}))
+ self.assertTrue(match_str('!is_live', {'is_live': None}))
+ self.assertTrue(match_str('!is_live', {}))
+ self.assertTrue(match_str('title', {'title': 'abc'}))
+ self.assertTrue(match_str('title', {'title': ''}))
+ self.assertFalse(match_str('!title', {'title': 'abc'}))
+ self.assertFalse(match_str('!title', {'title': ''}))
def test_parse_dfxp_time_expr(self):
self.assertEqual(parse_dfxp_time_expr(None), None)