X-Git-Url: https://jfr.im/git/yt-dlp.git/blobdiff_plain/3ad56b42360bd73c1c9c68dbd1d65d1ca492d676..8f18aca8717bb0dd49054555af8d386e5eda3a88:/test/test_utils.py diff --git a/test/test_utils.py b/test/test_utils.py index aef59e491..dedc598f7 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -1285,9 +1285,15 @@ def test_match_str(self): self.assertTrue(match_str(r'x="foo \& bar" & x^=foo', {'x': 'foo & bar'})) # Example from docs - self.assertTrue( - r'!is_live & like_count>?100 & description~=\'(?i)\bcats \& dogs\b\'', - {'description': 'Raining Cats & Dogs'}) + self.assertTrue(match_str( + r"!is_live & like_count>?100 & description~='(?i)\bcats \& dogs\b'", + {'description': 'Raining Cats & Dogs'})) + + # Incomplete + self.assertFalse(match_str('id!=foo', {'id': 'foo'}, True)) + self.assertTrue(match_str('x', {'id': 'foo'}, True)) + self.assertTrue(match_str('!x', {'id': 'foo'}, True)) + self.assertFalse(match_str('x', {'id': 'foo'}, False)) def test_parse_dfxp_time_expr(self): self.assertEqual(parse_dfxp_time_expr(None), None)