コード例 #1
0
ファイル: test_macros.py プロジェクト: simone-campagna/zirkon
def test_MContext_referring(pthinfo):
    assert not MContext.is_set()
    assert MPath().filename == ""
    with MContext.referring(pthinfo):
        assert MContext.is_set()
        assert MPath().filename == str(pthinfo)
    assert not MContext.is_set()
    assert MPath().filename == ""
コード例 #2
0
ファイル: test_macros.py プロジェクト: simone-campagna/zirkon
def test_MContext_set_error():
    mp = MPath()
    mc = MContext(mp)
    with pytest.raises(TypeError):
        mc.path_info = 10
コード例 #3
0
ファイル: test_macros.py プロジェクト: simone-campagna/zirkon
def test_MContext(pthinfo):
    mp = MPath()
    mc = MContext(mp)
    mc.path_info = pthinfo
    assert mp.filename == "/a/b"
    assert mc.evaluate() == "/a/b"