summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Holtermann <info@markusholtermann.eu>2014-11-06 12:29:43 +0100
committerBaptiste Mispelon <bmispelon@gmail.com>2014-11-06 15:31:30 +0100
commit1f50ea730e250acdc9f62f1ce1a769296fc20bb8 (patch)
tree7f718aa36cc5b207178b07278b5b5673b08d4382 /tests
parent77209e783ce085dd9642167cbd60089b742dd55e (diff)
[1.7.x] Fixed #23770 -- Changed serialization strategy for floats with respect to NaN and Inf
Thanks to w0rp for the report Backport of c7c098cf97fbb1416f302c76799058ad63a5f7aa from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_writer.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
index 0503270ed2..cb9ed5d0d5 100644
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -2,6 +2,7 @@
from __future__ import unicode_literals
import datetime
+import math
import os
import re
import tokenize
@@ -69,6 +70,10 @@ class WriterTests(TestCase):
"""
# Basic values
self.assertSerializedEqual(1)
+ self.assertSerializedEqual(1.2)
+ self.assertTrue(math.isinf(self.serialize_round_trip(float("inf"))))
+ self.assertTrue(math.isinf(self.serialize_round_trip(float("-inf"))))
+ self.assertTrue(math.isnan(self.serialize_round_trip(float("nan"))))
self.assertSerializedEqual(None)
self.assertSerializedEqual(b"foobar")
string, imports = MigrationWriter.serialize(b"foobar")