Commit d4f711a6 authored by nimrod's avatar nimrod
Browse files

- Adding doctest.

parent 321977d0
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2,6 +2,19 @@


def to_yaml(value):
    '''
    Converts given data structure to YAML form.
    Examples:

    >>> to_yaml([1,2,3])
    '[1, 2, 3]\\n'
    >>> to_yaml({'a': 1, 'b': 2})
    '{a: 1, b: 2}\\n'
    >>> to_yaml({1: {'a': [1,2,3]}})
    '1:\\n  a: [1, 2, 3]\\n'
    >>> to_yaml("abc")
    'abc\\n...\\n'
    '''
    from yaml import safe_dump
    return safe_dump(value)

+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ commands =
    check-manifest --ignore tox.ini,tests*
    python setup.py check -m -r -s
    flake8 .
    python -m doctest template/filters.py template/__init__.py
    ./tests.sh

[testenv:release]