1
1
from tests .testcase import BaseTestCase
2
-
2
+ from decimal import Decimal
3
3
4
4
class MapTestCase (BaseTestCase ):
5
5
# required_server_version = (21, 1, 2)
@@ -22,7 +22,7 @@ def _sorted_dicts(self, text):
22
22
return '\n ' .join (items ) + '\n '
23
23
24
24
def test_simple (self ):
25
- with self .create_stream ('a map(string, uint64 )' ):
25
+ with self .create_stream ('a map(string, int )' ):
26
26
data = [
27
27
({},),
28
28
({'key1' : 1 }, ),
@@ -100,3 +100,22 @@ def test_array(self):
100
100
)
101
101
inserted = self .client .execute (query )
102
102
self .assertEqual (inserted , data )
103
+
104
+ def test_decimal (self ):
105
+ with self .create_stream ('a map(string, Decimal(9, 2))' ):
106
+ data = [
107
+ ({'key1' : Decimal ('123.45' )}, ),
108
+ ({'key2' : Decimal ('234.56' )}, ),
109
+ ({'key3' : Decimal ('345.67' )}, )
110
+ ]
111
+ self .client .execute ('INSERT INTO test (a) VALUES' , data )
112
+ query = 'SELECT * FROM test'
113
+ inserted = self .emit_cli (query )
114
+ self .assertEqual (
115
+ inserted ,
116
+ "{'key1':123.45}\n "
117
+ "{'key2':234.56}\n "
118
+ "{'key3':345.67}\n "
119
+ )
120
+ inserted = self .client .execute (query )
121
+ self .assertEqual (inserted , data )
0 commit comments