| 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 |