mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #23770 -- Changed serialization strategy for floats with respect to NaN and Inf
Thanks to w0rp for the report
This commit is contained in:
committed by
Baptiste Mispelon
parent
b07aa52e8a
commit
c7c098cf97
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user