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
a560a49d
Commit
a560a49d
authored
Sep 11, 2017
by
Carlton Gibson
Committed by
GitHub
Sep 11, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5409 from rpkilby/fieldvalues-output
Add value repr to the assertion output in FieldValues tests
parents
0e341c24
ae95ed1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
tests/test_fields.py
+6
-3
No files found.
tests/test_fields.py
View file @
a560a49d
...
@@ -533,7 +533,8 @@ class FieldValues:
...
@@ -533,7 +533,8 @@ class FieldValues:
Ensure that valid values return the expected validated data.
Ensure that valid values return the expected validated data.
"""
"""
for
input_value
,
expected_output
in
get_items
(
self
.
valid_inputs
):
for
input_value
,
expected_output
in
get_items
(
self
.
valid_inputs
):
assert
self
.
field
.
run_validation
(
input_value
)
==
expected_output
assert
self
.
field
.
run_validation
(
input_value
)
==
expected_output
,
\
'input value: {}'
.
format
(
repr
(
input_value
))
def
test_invalid_inputs
(
self
):
def
test_invalid_inputs
(
self
):
"""
"""
...
@@ -542,11 +543,13 @@ class FieldValues:
...
@@ -542,11 +543,13 @@ class FieldValues:
for
input_value
,
expected_failure
in
get_items
(
self
.
invalid_inputs
):
for
input_value
,
expected_failure
in
get_items
(
self
.
invalid_inputs
):
with
pytest
.
raises
(
serializers
.
ValidationError
)
as
exc_info
:
with
pytest
.
raises
(
serializers
.
ValidationError
)
as
exc_info
:
self
.
field
.
run_validation
(
input_value
)
self
.
field
.
run_validation
(
input_value
)
assert
exc_info
.
value
.
detail
==
expected_failure
assert
exc_info
.
value
.
detail
==
expected_failure
,
\
'input value: {}'
.
format
(
repr
(
input_value
))
def
test_outputs
(
self
):
def
test_outputs
(
self
):
for
output_value
,
expected_output
in
get_items
(
self
.
outputs
):
for
output_value
,
expected_output
in
get_items
(
self
.
outputs
):
assert
self
.
field
.
to_representation
(
output_value
)
==
expected_output
assert
self
.
field
.
to_representation
(
output_value
)
==
expected_output
,
\
'output value: {}'
.
format
(
repr
(
output_value
))
# Boolean types...
# Boolean types...
...
...
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