Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change test added in 3e34005 to be more stable.

It could fail when actual serialization JSON field ordering was
different from the hard-coded one. Refs #13182.
  • Loading branch information...
commit c01cd4c4234368b050cb872defe5f16597db4bdb 1 parent 17d898d
@ramiro ramiro authored
Showing with 5 additions and 17 deletions.
  1. +5 −17 tests/serializers/tests.py
View
22 tests/serializers/tests.py
@@ -3,6 +3,7 @@
import json
from datetime import datetime
+import re
import unittest
from xml.dom import minidom
try:
@@ -404,23 +405,10 @@ def test_indentation_whitespace(self):
qset = Score.objects.all()
s = serializers.json.Serializer()
- self.assertEqual(s.serialize(qset, indent=2), """[
-{
- "pk": 1,
- "model": "serializers.score",
- "fields": {
- "score": 5.0
- }
-},
-{
- "pk": 2,
- "model": "serializers.score",
- "fields": {
- "score": 6.0
- }
-}
-]
-""")
+ json_data = s.serialize(qset, indent=2)
+ for line in json_data.splitlines():
+ if re.search(r'.+,\s*$', line):
+ self.assertEqual(line, line.rstrip())
class JsonSerializerTransactionTestCase(SerializersTransactionTestBase, TransactionTestCase):
Please sign in to comment.
Something went wrong with that request. Please try again.