コード例 #1
0
def test_cm_paired_paths():
    cm = TextFileContentsManager()
    cm.paired_notebooks = dict()

    three = "ipynb,py,md"
    cm.update_paired_notebooks("nb.ipynb", three)
    assert cm.paired_notebooks == {
        "nb." + fmt: (fmt, three)
        for fmt in three.split(",")
    }

    two = "ipynb,Rmd"
    cm.update_paired_notebooks("nb.ipynb", two)
    assert cm.paired_notebooks == {
        "nb." + fmt: (fmt, two)
        for fmt in two.split(",")
    }

    one = "ipynb"
    cm.update_paired_notebooks("nb.ipynb", one)
    assert cm.paired_notebooks == {}

    zero = ""
    cm.update_paired_notebooks("nb.ipynb", zero)
    assert cm.paired_notebooks == {}
コード例 #2
0
def test_cm_paired_paths():
    cm = TextFileContentsManager()
    cm.paired_notebooks = dict()

    three = 'ipynb,py,md'
    cm.update_paired_notebooks('nb.ipynb', 'ipynb', three)
    assert cm.paired_notebooks == {
        'nb.' + fmt: (fmt, three)
        for fmt in three.split(',')
    }

    two = 'ipynb,Rmd'
    cm.update_paired_notebooks('nb.ipynb', 'ipynb', two)
    assert cm.paired_notebooks == {
        'nb.' + fmt: (fmt, two)
        for fmt in two.split(',')
    }

    one = 'ipynb'
    cm.update_paired_notebooks('nb.ipynb', 'ipynb', one)
    assert cm.paired_notebooks == {}