aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_fields.py
diff options
context:
space:
mode:
authorTom Christie2014-09-22 16:50:04 +0100
committerTom Christie2014-09-22 16:50:04 +0100
commitb5454dd02290130a7fb0a0e375f3efecc58edc6d (patch)
tree83fcf468d35169df3547caff4f42881e7c27560a /tests/test_fields.py
parente5f0a97595ff9280c7876fc917f6feb27b5ea95d (diff)
downloaddjango-rest-framework-b5454dd02290130a7fb0a0e375f3efecc58edc6d.tar.bz2
Tests and tweaks for choice fields
Diffstat (limited to 'tests/test_fields.py')
-rw-r--r--tests/test_fields.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/test_fields.py b/tests/test_fields.py
index 8c50aaba..3343123f 100644
--- a/tests/test_fields.py
+++ b/tests/test_fields.py
@@ -505,9 +505,11 @@ class TestChoiceField(FieldValues):
'good': 'good',
}
invalid_inputs = {
- 'awful': ['`awful` is not a valid choice.']
+ 'amazing': ['`amazing` is not a valid choice.']
+ }
+ outputs = {
+ 'good': 'good'
}
- outputs = {}
field = fields.ChoiceField(
choices=[
('poor', 'Poor quality'),
@@ -530,7 +532,10 @@ class TestChoiceFieldWithType(FieldValues):
5: ['`5` is not a valid choice.'],
'abc': ['`abc` is not a valid choice.']
}
- outputs = {}
+ outputs = {
+ '1': 1,
+ 1: 1
+ }
field = fields.ChoiceField(
choices=[
(1, 'Poor quality'),
@@ -553,7 +558,9 @@ class TestChoiceFieldWithListChoices(FieldValues):
invalid_inputs = {
'awful': ['`awful` is not a valid choice.']
}
- outputs = {}
+ outputs = {
+ 'good': 'good'
+ }
field = fields.ChoiceField(choices=('poor', 'medium', 'good'))