mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Move common libs to libs/common
This commit is contained in:
parent
8dbb1a2451
commit
1f4bd41bcc
1612 changed files with 962 additions and 10 deletions
54
libs/common/rebulk/test/rules_module.py
Normal file
54
libs/common/rebulk/test/rules_module.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, len-as-condition
|
||||
from ..match import Match
|
||||
from ..rules import Rule
|
||||
|
||||
|
||||
class Rule3(Rule):
|
||||
def when(self, matches, context):
|
||||
return context.get('when')
|
||||
|
||||
def then(self, matches, when_response, context):
|
||||
assert when_response in [True, False]
|
||||
matches.append(Match(3, 4))
|
||||
|
||||
|
||||
class Rule2(Rule):
|
||||
dependency = Rule3
|
||||
|
||||
def when(self, matches, context):
|
||||
return True
|
||||
|
||||
def then(self, matches, when_response, context):
|
||||
assert when_response
|
||||
matches.append(Match(3, 4))
|
||||
|
||||
|
||||
class Rule1(Rule):
|
||||
dependency = Rule2
|
||||
|
||||
def when(self, matches, context):
|
||||
return True
|
||||
|
||||
def then(self, matches, when_response, context):
|
||||
assert when_response
|
||||
matches.clear()
|
||||
|
||||
|
||||
class Rule0(Rule):
|
||||
dependency = Rule1
|
||||
|
||||
def when(self, matches, context):
|
||||
return True
|
||||
|
||||
def then(self, matches, when_response, context):
|
||||
assert when_response
|
||||
matches.append(Match(3, 4))
|
||||
|
||||
|
||||
class Rule1Disabled(Rule1):
|
||||
name = "Disabled Rule1"
|
||||
|
||||
def enabled(self, context):
|
||||
return False
|
Loading…
Add table
Add a link
Reference in a new issue