Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
Template
Commits
d4f711a6
Commit
d4f711a6
authored
8 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
- Adding doctest.
parent
321977d0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
template/filters.py
+13
-0
13 additions, 0 deletions
template/filters.py
tox.ini
+1
-0
1 addition, 0 deletions
tox.ini
with
14 additions
and
0 deletions
template/filters.py
+
13
−
0
View file @
d4f711a6
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
tox.ini
+
1
−
0
View file @
d4f711a6
...
...
@@ -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]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment