|
| 1 | +import math |
1 | 2 | import unittest
|
2 | 3 | from io import BytesIO
|
3 | 4 |
|
@@ -158,6 +159,32 @@ def test_ParseExportFromUserInterface(self):
|
158 | 159 | self.assertFalse(tables[1].columns[1].group)
|
159 | 160 | self.assertTrue(tables[1].columns[2].group)
|
160 | 161 |
|
| 162 | + def test_ParseInf(self): |
| 163 | + |
| 164 | + data = """#group,false,false,true,true,true,true,true,true,true,true,false,false |
| 165 | +#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,string,string,string,string,string,string,double,double |
| 166 | +#default,_result,,,,,,,,,,, |
| 167 | +,result,table,_start,_stop,_field,_measurement,language,license,name,owner,le,_value |
| 168 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,0,0 |
| 169 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,10,0 |
| 170 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,20,0 |
| 171 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,30,0 |
| 172 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,40,0 |
| 173 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,50,0 |
| 174 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,60,0 |
| 175 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,70,0 |
| 176 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,80,0 |
| 177 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,90,0 |
| 178 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,+Inf,15 |
| 179 | +,,0,2021-06-23T06:50:11.897825012Z,2021-06-25T06:50:11.897825012Z,stars,github_repository,C#,MIT License,influxdb-client-csharp,influxdata,-Inf,15 |
| 180 | +
|
| 181 | +""" |
| 182 | + tables = self._parse_to_tables(data=data) |
| 183 | + self.assertEqual(1, tables.__len__()) |
| 184 | + self.assertEqual(12, tables[0].records.__len__()) |
| 185 | + self.assertEqual(math.inf, tables[0].records[10]["le"]) |
| 186 | + self.assertEqual(-math.inf, tables[0].records[11]["le"]) |
| 187 | + |
161 | 188 | @staticmethod
|
162 | 189 | def _parse_to_tables(data: str):
|
163 | 190 | fp = BytesIO(str.encode(data))
|
|
0 commit comments