Exemplo n.º 1
0
def test_recombine_clean_reduced():
    res = recombinecm.recombine(clean_1_cells_removed, w_output_1)
    c = res.cells

    assert c[0].cell_type == 'markdown'

    assert c[1].cell_type == 'code'
    assert c[1].outputs[0].text == 'fob\n'
Exemplo n.º 2
0
def test_recombine_extra_locally():
    res = recombinecm.recombine(clean_1, w_output_1_extra_cells)

    c = res.cells
    assert c[0].cell_type == 'code'
    assert len(c[0].outputs)
    assert c[0].outputs[0].output_type == 'stream'
    assert c[0].execution_count == 1

    assert c[1].cell_type == 'markdown'

    assert c[2].cell_type == 'code'
    assert len(c[2].outputs) == 1
    assert c[2].outputs[0].output_type == 'execute_result'
    assert c[2].execution_count == 2

    assert c[3].cell_type == 'code'
    assert c[3].outputs[0].text == 'fob\n'
Exemplo n.º 3
0
def test_recombine_extra_in_clean():
    res = recombinecm.recombine(clean_1_extra_cells, w_output_1)

    c = res.cells
    assert c[0].cell_type == 'code'
    assert len(c[0].outputs)
    assert c[0].outputs[0].output_type == 'stream'
    assert c[0].execution_count == 1

    assert c[1].cell_type == 'markdown'

    assert c[4].cell_type == 'code'
    assert len(c[4].outputs) == 1
    assert c[4].outputs[0].output_type == 'execute_result'
    assert c[4].execution_count == 2

    assert c[5].cell_type == 'code'
    assert c[5].outputs[0].text == 'fob\n'

    # This shouldn't match anything in the local version
    assert c[2].cell_type == 'code'
    assert c[2].outputs == []
Exemplo n.º 4
0
def test_recombine_basic():
    res = recombinecm.recombine(clean_1, w_output_1)

    c = res.cells
    assert c[0].cell_type == 'code'
    assert len(c[0].outputs)
    assert c[0].outputs[0].output_type == 'stream'
    assert c[0].execution_count == 1

    assert c[1].cell_type == 'markdown'

    assert c[2].cell_type == 'code'
    assert len(c[2].outputs) == 1
    assert c[2].outputs[0].output_type == 'execute_result'
    assert c[2].execution_count == 2

    assert c[3].cell_type == 'code'
    assert c[3].outputs[0].text == 'fob\n'

    # Check that this is a separate object
    assert res is not w_output_1
    assert res is not clean_1
    assert clean_1.cells[0].outputs == []