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

Unified Diff: tests/test_rpy.py

Issue 29988581: Issue 7230 - python-abp line2dict vectorization (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Address comments on PS2 Created Jan. 26, 2019, 1:01 a.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
« no previous file with comments | « 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
@@ -20,7 +20,7 @@
import pytest
import sys
-from abp.filters.rpy import tuple2dict, line2dict
+from abp.filters.rpy import tuple2dict, line2dict, lines2dicts
_SAMPLE_TUPLE = namedtuple('tuple', 'foo,bar')
@@ -147,3 +147,22 @@
data = line2dict(_TEST_EXAMPLES[line_type]['in'], position)
assert data == _TEST_EXAMPLES[line_type]['out']
+
+
+def test_lines2dicts():
+ """Test that the API returns the correct result in the appropriate format.
+
+ Checks for both modes: 'start', and 'body' (the default).
+ """
+ test_start = [t for t in _TEST_EXAMPLES.values()]
+ ins = [ex['in'] for ex in test_start]
+ outs = [ex['out'] for ex in test_start]
+
+ assert lines2dicts(ins, 'start') == outs
+
+ test_body = [t for t in _TEST_EXAMPLES.values()
Vasily Kuznetsov 2019/01/28 17:47:36 What do you think about separating this part into
rhowell 2019/01/29 01:44:48 Done.
+ if t['out'][b'type'] not in {b'Header', b'Metadata'}]
+ ins = [ex['in'] for ex in test_body]
+ outs = [ex['out'] for ex in test_body]
+
+ assert lines2dicts(ins) == outs
« no previous file with comments | « abp/filters/rpy.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld