Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: tests/test_rpy.py

Issue 30031558: Issue 7391 - Let rpy recursively parse filter options to dicts (Closed) Base URL: https://hg.adblockplus.org/python-abp
Patch Set: Address comments on Patch Set 1 and bug fixes Created March 27, 2019, 9:24 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« abp/filters/rpy.py ('K') | « abp/filters/rpy.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/test_rpy.py
===================================================================
--- a/tests/test_rpy.py
+++ b/tests/test_rpy.py
@@ -16,7 +16,7 @@
"""Functional tests for testing rPython integration."""
from __future__ import unicode_literals
-from collections import namedtuple
+from collections import namedtuple, OrderedDict as Od
import pytest
import sys
@@ -68,7 +68,7 @@
b'text': b'foo.com##div#ad1',
b'selector': {b'type': b'css', b'value': b'div#ad1'},
b'action': b'hide',
- b'options': [(b'domain', [(b'foo.com', True)])],
+ b'options': {b'domain': {b'foo.com': True}},
},
},
'filter_with_%': {
@@ -79,7 +79,7 @@
b'selector': {b'type': b'url-pattern',
b'value': b'%22banner%*%22idzone%'},
b'action': b'block',
- b'options': [],
+ b'options': {},
},
},
'filter_multiple': {
@@ -89,10 +89,23 @@
b'text': b'foo.com,bar.com##div#ad1',
b'selector': {b'type': b'css', b'value': b'div#ad1'},
b'action': b'hide',
- b'options': [(b'domain', [(b'foo.com', True), (b'bar.com',
- True)])],
+ b'options': {b'domain': {b'foo.com': True, b'bar.com': True}},
},
},
+ 'filter_with_sitekey_list': {
+ 'in': b'@@bla$ping,domain=foo.com|~bar.foo.com,sitekey=foo|bar',
+ 'out':
+ Od([(b'text',
+ b'@@bla$ping,domain=foo.com|~bar.foo.com,sitekey=foo|bar'),
+ (b'selector', {b'value': b'bla', b'type': b'url-pattern'}),
+ (b'action', b'allow'),
+ (b'options',
+ Od([(b'ping', True),
+ (b'domain', Od([(b'foo.com', True),
+ (b'bar.foo.com', False)])),
+ (b'sitekey', [b'foo', b'bar'])])),
+ (b'type', b'Filter')]),
+ },
}
« abp/filters/rpy.py ('K') | « abp/filters/rpy.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld