File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
tests/routers/v2/connector Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,13 @@ def _to_datetime_and_format(series: pd.Series) -> pd.Series:
29
29
30
30
31
31
def _to_json_obj (df : pd .DataFrame ) -> dict :
32
- data = df .map (lambda x : f"{ x :.9g} " if isinstance (x , float ) else x ).to_dict (
33
- orient = "split" , index = False
34
- )
32
+ data = df .map (
33
+ lambda x : f"{ x :.9g} "
34
+ if isinstance (x , float )
35
+ else f"{ x :.3f} "
36
+ if isinstance (x , decimal .Decimal )
37
+ else x
38
+ ).to_dict (orient = "split" )
35
39
36
40
def default (obj ):
37
41
if pd .isna (obj ):
Original file line number Diff line number Diff line change @@ -198,6 +198,20 @@ async def test_query_values(client, manifest_str):
198
198
assert response .status_code == 204
199
199
200
200
201
+ async def test_scientific_notation (client , manifest_str ):
202
+ response = await client .post (
203
+ url = f"{ base_url } /query" ,
204
+ json = {
205
+ "connectionInfo" : connection_info ,
206
+ "manifestStr" : manifest_str ,
207
+ "sql" : "SELECT cast(0 as numeric) as col" ,
208
+ },
209
+ )
210
+ assert response .status_code == 200
211
+ result = response .json ()
212
+ assert result ["data" ][0 ] == ["0.000" ]
213
+
214
+
201
215
async def test_query_empty_json (client , manifest_str ):
202
216
"""Test the empty result with json column."""
203
217
response = await client .post (
You can’t perform that action at this time.
0 commit comments