コード例 #1
0
 def _make_tree(root: str) -> Node:
     path = root[:-1]
     doc = DOCS.get(path)
     return Node(
         path=path,
         title=doc.title if doc else root,
         children=sorted(
             (_make_tree(child) for child in {
                 root + doc.name[len(root):].split('/', 1)[0] + '/'
                 for doc in DOCS.values() if doc.name.startswith(root)
                 and not exclude.match(doc.name)
             }),
             key=attrgetter('title'),
         ),
     )
コード例 #2
0
ファイル: docs.py プロジェクト: n-patel/ocfweb
 def _make_tree(root):
     path = root[:-1]
     doc = DOCS.get(path)
     return Node(
         path=path,
         title=doc.title if doc else root,
         children=sorted(
             [
                 _make_tree(child)
                 for child in
                 {
                     root + doc.name[len(root):].split('/', 1)[0] + '/'
                     for doc in DOCS.values()
                     if doc.name.startswith(root) and not exclude.match(doc.name)
                 }
             ],
             key=attrgetter('path'),
         ),
     )
コード例 #3
0
ファイル: docs_test.py プロジェクト: ziyaointl/ocfweb
import pytest

from ocfweb.docs.urls import DOCS
from tests.end_to_end_test import assert_does_not_error


@pytest.mark.parametrize('doc_name', DOCS.keys())
def test_doc_does_not_error(client, doc_name):
    assert_does_not_error(client, '/docs' + doc_name)