mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Update guessit to 3.0.3
Also updates: - babelfish-0.5.5 - python-dateutil-2.7.5 - rebulk-1.0.0 - six-1.12.0
This commit is contained in:
parent
05b0fb498f
commit
2eb9d9dc7c
120 changed files with 17964 additions and 4530 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# pylint: disable=no-self-use, pointless-statement, missing-docstring, unbalanced-tuple-unpacking
|
||||
# pylint: disable=no-self-use, pointless-statement, missing-docstring, unbalanced-tuple-unpacking, len-as-condition
|
||||
|
||||
import re
|
||||
import pytest
|
||||
|
@ -97,6 +97,18 @@ class TestStringPattern(object):
|
|||
assert matches[0].name == "test"
|
||||
assert matches[0].value == "AB"
|
||||
|
||||
def test_post_processor(self):
|
||||
def post_processor(matches, pattern):
|
||||
assert len(matches) == 1
|
||||
assert isinstance(pattern, StringPattern)
|
||||
|
||||
return []
|
||||
|
||||
pattern = StringPattern("Abyssinian", name="test", value="AB", post_processor=post_processor)
|
||||
matches = list(pattern.matches(self.input_string))
|
||||
|
||||
assert len(matches) == 0
|
||||
|
||||
|
||||
class TestRePattern(object):
|
||||
"""
|
||||
|
@ -384,10 +396,10 @@ class TestRePattern(object):
|
|||
|
||||
children = matches[0].children
|
||||
assert len(children) == 2
|
||||
assert children[0].name is "test"
|
||||
assert children[0].name == "test"
|
||||
assert children[0].value == "HE"
|
||||
|
||||
assert children[1].name is "test"
|
||||
assert children[1].name == "test"
|
||||
assert children[1].value == "HE"
|
||||
|
||||
pattern = RePattern("H(?P<first>e.)(?P<second>rew)", name="test", value="HE")
|
||||
|
@ -795,8 +807,7 @@ class TestValidator(object):
|
|||
def invalid_func(match):
|
||||
if match.name == 'intParam':
|
||||
return True
|
||||
else:
|
||||
return match.value.startswith('abc')
|
||||
return match.value.startswith('abc')
|
||||
|
||||
pattern = RePattern(r"contains (?P<intParam>\d+)", formatter=int, validator=invalid_func, validate_all=True,
|
||||
children=True)
|
||||
|
@ -807,8 +818,7 @@ class TestValidator(object):
|
|||
def func(match):
|
||||
if match.name == 'intParam':
|
||||
return True
|
||||
else:
|
||||
return match.value.startswith('contains')
|
||||
return match.value.startswith('contains')
|
||||
|
||||
pattern = RePattern(r"contains (?P<intParam>\d+)", formatter=int, validator=func, validate_all=True,
|
||||
children=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue