コード例 #1
0
    def test_provided_empty(self):

        option = config_options.Nav()
        value = option.validate([])
        self.assertEqual(None, value)

        option.post_validation({'extra_stuff': []}, 'extra_stuff')
コード例 #2
0
    def test_old_format(self):

        option = config_options.Nav()
        self.assertRaises(
            config_options.ValidationError,
            option.validate,
            [['index.md', ], ]
        )
コード例 #3
0
    def test_provided_dict(self):

        option = config_options.Nav()
        value = option.validate([
            'index.md',
            {"Page": "page.md"}
        ])
        self.assertEqual(['index.md', {'Page': 'page.md'}], value)

        option.post_validation({'extra_stuff': []}, 'extra_stuff')
コード例 #4
0
ファイル: defaults.py プロジェクト: notpushkin/mkdocutils
# listed higher in the schema.

# Once we drop Python 2.6 support, this could be an OrderedDict, however, it
# isn't really needed either as we always sequentially process the schema other
# than at initialisation when we grab the full set of keys for convenience.

DEFAULT_SCHEMA = (

    # Reserved for internal use, stores the mkdocutils.yml config file.
    ('config_file_path', config_options.Type(str)),

    # The title to use for the documentation
    ('site_name', config_options.Type(str, required=True)),

    # Defines the structure of the navigation.
    ('nav', config_options.Nav()),
    # TODO: remove this when the `pages` config setting is fully deprecated.
    ('pages', config_options.Nav()),

    # The full URL to where the documentation will be hosted
    ('site_url', config_options.URL()),

    # A description for the documentation project that will be added to the
    # HTML meta tags.
    ('site_description', config_options.Type(str)),
    # The name of the author to add to the HTML meta tags
    ('site_author', config_options.Type(str)),

    # The MkDocs theme for the documentation.
    ('theme', config_options.Theme(default='mkdocs')),
コード例 #5
0
    def test_invalid_config(self):

        option = config_options.Nav()
        self.assertRaises(config_options.ValidationError,
                          option.validate, [[], 1])
コード例 #6
0
    def test_invalid_type(self):

        option = config_options.Nav()
        self.assertRaises(config_options.ValidationError,
                          option.validate, {})