Testing URL Pattern Matching Utilities in you-get
This test suite validates core functionality in the you-get downloader’s common utilities, focusing on URL pattern matching and string extraction capabilities. The tests ensure reliable parsing of video platform URLs and consistent behavior across different URL formats.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
soimort/you-get
tests/test_common.py
#!/usr/bin/env python
import unittest
from you_get.common import *
class TestCommon(unittest.TestCase):
def test_match1(self):
self.assertEqual(match1('http://youtu.be/1234567890A', r'youtu.be/([^/]+)'), '1234567890A')
self.assertEqual(match1('http://youtu.be/1234567890A', r'youtu.be/([^/]+)', r'youtu.(\w+)'), ['1234567890A', 'be'])