summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-12-19 13:24:07 +0100
committerÁrni Dagur <arni@dagur.eu>2020-12-19 20:30:24 +0000
commit8b7bb2da5786e949f146891afcbb3961b68cf3c9 (patch)
tree487d47794b5cac9e4ee190c3fbd421f947de897a
parent31dbffe35a0b60db3d2cc8d79f3b57cdd17c6854 (diff)
downloadqutebrowser-8b7bb2da5786e949f146891afcbb3961b68cf3c9.tar.gz
qutebrowser-8b7bb2da5786e949f146891afcbb3961b68cf3c9.zip
Use ResourceType enum for conversion
-rw-r--r--tests/end2end/data/brave-adblock/ublock-matches.tsv.gzbin1279186 -> 1279186 bytes
-rw-r--r--tests/unit/components/test_braveadblock.py13
2 files changed, 1 insertions, 12 deletions
diff --git a/tests/end2end/data/brave-adblock/ublock-matches.tsv.gz b/tests/end2end/data/brave-adblock/ublock-matches.tsv.gz
index d4838ad7d..bced0da75 100644
--- a/tests/end2end/data/brave-adblock/ublock-matches.tsv.gz
+++ b/tests/end2end/data/brave-adblock/ublock-matches.tsv.gz
Binary files differ
diff --git a/tests/unit/components/test_braveadblock.py b/tests/unit/components/test_braveadblock.py
index 0979faea5..8b953c439 100644
--- a/tests/unit/components/test_braveadblock.py
+++ b/tests/unit/components/test_braveadblock.py
@@ -95,23 +95,12 @@ def run_function_on_dataset(given_function):
contains tuples of (url, source_url, type) in each line. We give these
to values to the given function, row by row.
"""
- dataset_type_to_enum = {
- "unknown": ResourceType.unknown,
- "image": ResourceType.image,
- "stylesheet": ResourceType.stylesheet,
- "media": ResourceType.media,
- "script": ResourceType.script,
- "font_resource": ResourceType.font_resource,
- "xhr": ResourceType.xhr,
- "sub_frame": ResourceType.sub_frame,
- }
-
dataset = utils.adblock_dataset_tsv()
reader = csv.DictReader(dataset, delimiter="\t")
for row in reader:
url = QUrl(row["url"])
source_url = QUrl(row["source_url"])
- resource_type = dataset_type_to_enum[row["type"]]
+ resource_type = ResourceType[row["type"]]
given_function(url, source_url, resource_type)