def test_inline_merge_cells_replacement_unsimilar(): base = sources_to_notebook([['unmodified'], ['base']], cell_type='markdown') local = sources_to_notebook([['unmodified'], ['local\n', 'friendly faces\n', '3.14']], cell_type='markdown') remote = sources_to_notebook([['unmodified'], ['remote\n', 'foo bar baz\n']], cell_type='markdown') expected = sources_to_notebook([ ['unmodified'], [_cell_marker_format(("<"*7) + ' local')], ['local\n', 'friendly faces\n', '3.14'], [_cell_marker_format("="*7)], ['remote\n', 'foo bar baz\n'], [_cell_marker_format((">"*7) + ' remote')], ], cell_type='markdown') merged, decisions = merge_notebooks(base, local, remote) assert merged == expected
def test_inline_merge_cells_insertion_unsimilar(): base = sources_to_notebook([['unmodified']], cell_type='markdown') local = sources_to_notebook( [['unmodified'], ['local\n', 'friendly faces\n', '3.14']], cell_type='markdown') remote = sources_to_notebook( [['unmodified'], ['remote\n', 'foo bar baz\n']], cell_type='markdown') expected = sources_to_notebook([ ['unmodified'], [_cell_marker_format(("<" * 7) + ' local')], ['local\n', 'friendly faces\n', '3.14'], [_cell_marker_format("=" * 7)], ['remote\n', 'foo bar baz\n'], [_cell_marker_format((">" * 7) + ' remote')], ], cell_type='markdown') merged, decisions = merge_notebooks(base, local, remote) assert merged == expected
def test_inline_merge_cells_replacement_unsimilar(): base = sources_to_notebook([['unmodified'], ['base']], cell_type='markdown', strip_ids=False) local = sources_to_notebook( [['unmodified'], ['local\n', 'friendly faces\n', '3.14']], cell_type='markdown', strip_ids=True) remote = sources_to_notebook( [['unmodified'], ['remote\n', 'foo bar baz\n']], cell_type='markdown', strip_ids=True) expected = sources_to_notebook([ ['unmodified'], [_cell_marker_format(("<" * 7) + ' local')], ['local\n', 'friendly faces\n', '3.14'], [_cell_marker_format("=" * 7)], ['remote\n', 'foo bar baz\n'], [_cell_marker_format((">" * 7) + ' remote')], ], cell_type='markdown', strip_ids=True) merged, decisions = merge_notebooks(base, local, remote) assert strip_cell_ids(merged) == expected