Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
0ba94d75
Commit
0ba94d75
authored
Nov 25, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/tomchristie/django-rest-framework
parents
306916ac
eeb07ad9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
tests/test_renderers.py
+4
-4
tox.ini
+2
-0
No files found.
tests/test_renderers.py
View file @
0ba94d75
...
...
@@ -9,7 +9,7 @@ from django.test import TestCase
from
django.utils
import
six
,
unittest
from
django.utils.translation
import
ugettext_lazy
as
_
from
rest_framework
import
status
,
permissions
from
rest_framework.compat
import
yaml
,
etree
,
StringIO
from
rest_framework.compat
import
yaml
,
etree
,
StringIO
,
BytesIO
from
rest_framework.response
import
Response
from
rest_framework.views
import
APIView
from
rest_framework.renderers
import
BaseRenderer
,
JSONRenderer
,
YAMLRenderer
,
\
...
...
@@ -467,7 +467,7 @@ if yaml:
obj
=
{
'foo'
:
[
'bar'
,
'baz'
]}
renderer
=
YAMLRenderer
()
content
=
renderer
.
render
(
obj
,
'application/yaml'
)
self
.
assertEqual
(
content
,
_yaml_repr
)
self
.
assertEqual
(
content
.
decode
(
'utf-8'
)
,
_yaml_repr
)
def
test_render_and_parse
(
self
):
"""
...
...
@@ -480,7 +480,7 @@ if yaml:
parser
=
YAMLParser
()
content
=
renderer
.
render
(
obj
,
'application/yaml'
)
data
=
parser
.
parse
(
String
IO
(
content
))
data
=
parser
.
parse
(
Bytes
IO
(
content
))
self
.
assertEqual
(
obj
,
data
)
def
test_render_decimal
(
self
):
...
...
@@ -489,7 +489,7 @@ if yaml:
"""
renderer
=
YAMLRenderer
()
content
=
renderer
.
render
({
'field'
:
Decimal
(
'111.2'
)},
'application/yaml'
)
self
.
assertYAMLContains
(
content
,
"field: '111.2'"
)
self
.
assertYAMLContains
(
content
.
decode
(
'utf-8'
)
,
"field: '111.2'"
)
def
assertYAMLContains
(
self
,
content
,
string
):
self
.
assertTrue
(
string
in
content
,
'
%
r not in
%
r'
%
(
string
,
content
))
...
...
tox.ini
View file @
0ba94d75
...
...
@@ -23,6 +23,8 @@ deps =
pytest-django
=
=2.6.1
django-filter
=
=0.7
defusedxml
=
=0.3
markdown>=2.1.0
PyYAML>=3.10
[testenv:py27-flake8]
deps
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment