Commits

Matthew Schinckel  committed edb9439

Break into seperate tests.

  • Participants
  • Parent commits 2fa1f4f

Comments (0)

Files changed (2)

File jsonfield/templatetags/jsonify.py

 
 @register.filter
 def jsonify(value):
+    # If we have a queryset, then convert it into a list.
     if getattr(value, 'all', False):
         value = list(value)
     return mark_safe(json.dumps(value, cls=TZAwareJSONEncoder))

File jsonfield/tests/test_forms.py

         field = JSONFormField(required=False)
         self.assertEquals([],field.clean('[]'))
     
-    def test_required_form_field(self):
+    def test_required_form_field_array(self):
         field = JSONFormField(required=True)
         self.assertEquals([], field.clean('[]'))
+        
+    def test_required_form_field_object(self):
+        field = JSONFormField(required=True)
         self.assertEquals({}, field.clean('{}'))
+    
+    def test_required_form_field_empty(self):
+        field = JSONFormField(required=True)
         with self.assertRaises(ValidationError):
             field.clean('')