コード例 #1
0
ファイル: test_tg_active.py プロジェクト: ikcam/Clay
def _test_active_custom_class():
    assert not active('/hello/', class_='other-class')
    assert active(ACTIVE_PATH, class_='other-class') == 'other-class'
    assert active('/hello/',
                  ACTIVE_PATH[:5],
                  partial=True,
                  class_='other-class') == 'other-class'
    assert active('/hello/', ACTIVE_PATH,
                  class_='other-class') == 'other-class'
    assert not active('/hello/', '/world/', class_='other-class')
コード例 #2
0
def _test_active_backward_compatibilty():
    assert active([
        '/hello/',
        ACTIVE_PATH,
    ]) == 'active'
    assert not active([
        '/hello/',
        '/world/',
    ])
    assert active([
        ACTIVE_PATH[:5],
    ], partial=True) == 'active'
コード例 #3
0
ファイル: test_tg_active.py プロジェクト: alexander-ae/Clay
def test_active_index(c):
    with c.app.test_request_context('/index.html', method='GET'):
        assert active('/') == 'active'
        assert active('/index.html') == 'active'
        assert active('') == 'active'

    with c.app.test_request_context('/foo/bar/index.html', method='GET'):
        assert active('/foo/bar') == 'active'
        assert active('/foo/bar/') == 'active'
        assert active('/foo/bar/index.html') == 'active'

    with c.app.test_request_context('/', method='GET'):
        assert active('/') == 'active'
        assert active('/index.html') == 'active'
        assert active('') == 'active'
コード例 #4
0
def test_active_index(c):
    with c.app.test_request_context('/index.html', method='GET'):
        assert active('/') == 'active'
        assert active('/index.html') == 'active'
        assert active('') == 'active'

    with c.app.test_request_context('/foo/bar/index.html', method='GET'):
        assert active('/foo/bar') == 'active'
        assert active('/foo/bar/') == 'active'
        assert active('/foo/bar/index.html') == 'active'

    with c.app.test_request_context('/', method='GET'):
        assert active('/') == 'active'
        assert active('/index.html') == 'active'
        assert active('') == 'active'
コード例 #5
0
ファイル: test_tg_active.py プロジェクト: alexander-ae/Clay
def _test_active():
    assert not active('/hello/')
    assert active(ACTIVE_PATH) == 'active'
    assert active('/hello/', ACTIVE_PATH[:5], partial=True) == 'active'
    assert active('/hello/', ACTIVE_PATH) == 'active'
    assert not active('/hello/', '/world/')
コード例 #6
0
ファイル: test_tg_active.py プロジェクト: alexander-ae/Clay
def _test_active_backward_compatibilty():
    assert active(['/hello/', ACTIVE_PATH, ]) == 'active'
    assert not active(['/hello/', '/world/', ])
    assert active([ACTIVE_PATH[:5], ], partial=True) == 'active'
コード例 #7
0
ファイル: test_tg_active.py プロジェクト: alexander-ae/Clay
def _test_active_patterns():
    assert active('/*/bar.html') == 'active'
    assert active('/fo?/bar.html') == 'active'
    assert active('/f*') == 'active'
コード例 #8
0
ファイル: test_tg_active.py プロジェクト: alexander-ae/Clay
def _test_active_relative():
    assert not active('meh')
    assert active('bar.html') == 'active'
    assert active('b', partial=True) == 'active'
コード例 #9
0
ファイル: test_tglobals.py プロジェクト: juanodicio/Clay
def _test_active_case(path, as_expected, partial=False):
    html = active(path, partial=partial)
    assert (html == 'active') is as_expected
コード例 #10
0
def _test_active_patterns():
    assert active('/*/bar.html') == 'active'
    assert active('/fo?/bar.html') == 'active'
    assert active('/f*') == 'active'
コード例 #11
0
def _test_active_relative():
    assert not active('meh')
    assert active('bar.html') == 'active'
    assert active('b', partial=True) == 'active'
コード例 #12
0
def _test_active():
    assert not active('/hello/')
    assert active(ACTIVE_PATH) == 'active'
    assert active('/hello/', ACTIVE_PATH[:5], partial=True) == 'active'
    assert active('/hello/', ACTIVE_PATH) == 'active'
    assert not active('/hello/', '/world/')