forked from Flexget/Flexget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_regexp_list.py
46 lines (42 loc) · 1.38 KB
/
test_regexp_list.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class TestRegexpList:
config = r"""
tasks:
regexp_list_add:
mock:
- {title: 'game.of.thrones.s\d{2}e\d{2}'}
list_add:
- regexp_list: test 1
accept_all: yes
regexp_list_match:
mock:
- {title: 'Game of Thrones S01E01 720p HDTV-FlexGet'}
list_match:
from:
- regexp_list: test 1
remove_on_match: no
regexp_list_add_advanced:
mock:
- {title: 'Game of Thrones'}
manipulate:
- title:
replace:
regexp: '$'
format: ' s\\d{2}e\\d{2}'
- title:
replace:
regexp: ' '
format: '.'
list_add:
- regexp_list: test 1
accept_all: yes
"""
def test_regexp_list_simple_match(self, execute_task):
task = execute_task('regexp_list_add')
assert len(task.accepted) == 1
task = execute_task('regexp_list_match')
assert len(task.accepted) == 1
def test_regexp_list_advanced_match(self, execute_task):
task = execute_task('regexp_list_add_advanced')
assert len(task.accepted) == 1
task = execute_task('regexp_list_match')
assert len(task.accepted) == 1