Skip to content

Commit d459929

Browse files
committed
Add a core_test for this functionality.
1 parent c54f643 commit d459929

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def setup_package():
2+
import warnings
3+
warnings.filterwarnings('ignore')
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import json
2+
from unittest import TestCase
3+
4+
from plotly.utils import PlotlyJSONEncoder
5+
6+
7+
class TestJSONEncoder(TestCase):
8+
9+
def test_nan_to_null(self):
10+
array = [1, float('NaN'), float('Inf'), float('-Inf'), 'platypus']
11+
result = json.dumps(array, cls=PlotlyJSONEncoder)
12+
expected_result = '[1, null, null, null, "platypus"]'
13+
self.assertEqual(result, expected_result)

0 commit comments

Comments
 (0)