view tests/test_mock.py @ 474:db73b12ad212

web: Give special pages a linkable URL. All special pages are now in the built-in `special` endpoint, at URLs like `special:/Broken Links`. This makes it possible to link to them from other pages, especially help pages.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 08 Oct 2018 23:49:09 -0700
parents ebb12ff21cb2
children
line wrap: on
line source

import pytest
from .mock import MockFileSystem


@pytest.mark.parametrize('flat, expected', [
    ({}, {}),
    ({'/foo.txt': 'Bar'}, {'foo.txt': 'Bar'}),
    ({'/tmp/foo.txt': 'Bar'}, {'tmp': {'foo.txt': 'Bar'}}),
    (
        {'/tmp/foo.txt': 'Bar', '/tmp/bar': 'Foo'},
        {'tmp': {'foo.txt': 'Bar', 'bar': 'Foo'}})])
def test_flat_to_nested(flat, expected):
    actual = MockFileSystem.flat_to_nested(flat)
    assert actual == expected