Skip to content

Commit

Permalink
Float column write nan test
Browse files Browse the repository at this point in the history
  • Loading branch information
xzkostyan committed May 29, 2019
1 parent 9dd6ca0 commit 4a29451
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/columns/test_float.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import math

from tests.testcase import BaseTestCase
from clickhouse_driver import errors

Expand Down Expand Up @@ -63,3 +65,19 @@ def test_nullable(self):

inserted = self.client.execute(query)
self.assertEqual(inserted, data)

def test_nan(self):
with self.create_table('a Float32'):
data = [(float('nan'), ), (0.5, )]
self.client.execute(
'INSERT INTO test (a) VALUES', data
)

query = 'SELECT * FROM test'
inserted = self.emit_cli(query)
self.assertEqual(inserted, 'nan\n0.5\n')

inserted = self.client.execute(query)
self.assertEqual(len(inserted), 2)
self.assertTrue(math.isnan(inserted[0][0]))
self.assertEqual(inserted[1][0], 0.5)

0 comments on commit 4a29451

Please sign in to comment.