예제 #1
0
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
def test_MContext_set_error():
    mp = MPath()
    mc = MContext(mp)
    with pytest.raises(TypeError):
        mc.path_info = 10
예제 #3
0
def test_MContext(pthinfo):
    mp = MPath()
    mc = MContext(mp)
    mc.path_info = pthinfo
    assert mp.filename == "/a/b"
    assert mc.evaluate() == "/a/b"