Show More
@@ -25,7 +25,11 b' from ..execute import ExecutePreprocessor' | |||
|
25 | 25 | class TestExecute(PreprocessorTestsBase): |
|
26 | 26 | """Contains test functions for execute.py""" |
|
27 | 27 | |
|
28 | def prepare_cell(self, cell): | |
|
28 | @staticmethod | |
|
29 | def normalize_cell(cell): | |
|
30 | """ | |
|
31 | Normalizes cells for comparison. | |
|
32 | """ | |
|
29 | 33 | cell = dict(cell) |
|
30 | 34 | if 'metadata' in cell: |
|
31 | 35 | del cell['metadata'] |
@@ -41,13 +45,12 b' class TestExecute(PreprocessorTestsBase):' | |||
|
41 | 45 | actual_cells = actual['worksheets'][0]['cells'] |
|
42 | 46 | assert len(expected_cells) == len(actual_cells) |
|
43 | 47 | |
|
44 | # TODO: what does this code do? | |
|
45 |
|
|
|
46 | for k in set(expected_out).union(actual_out): | |
|
47 | if k == 'outputs': | |
|
48 | self.assertEquals(len(expected_out[k]), len(actual_out[k])) | |
|
49 | for e, a in zip(expected_out[k], actual_out[k]): | |
|
50 | assert self.prepare_cell(e) == self.prepare_cell(a) | |
|
48 | for expected_cell, actual_cell in zip(expected_cells, actual_cells): | |
|
49 | expected_outputs = expected_cell.get('outputs', []) | |
|
50 | actual_outputs = actual_cell.get('outputs', []) | |
|
51 | normalized_expected_outputs = map(self.normalize_cell, expected_outputs) | |
|
52 | normalized_actual_outputs = map(self.normalize_cell, actual_outputs) | |
|
53 | assert normalized_expected_outputs == normalized_actual_outputs | |
|
51 | 54 | |
|
52 | 55 | |
|
53 | 56 | def build_preprocessor(self): |
General Comments 0
You need to be logged in to leave comments.
Login now