(self)
| 240 | assert table.num_rows == 2 |
| 241 | |
| 242 | def test_explicit_schema_decimal(self): |
| 243 | rows = (b'{"a": 1}\n' |
| 244 | b'{"a": 1.45}\n' |
| 245 | b'{"a": -23.456}\n' |
| 246 | b'{}\n') |
| 247 | expected = { |
| 248 | 'a': [Decimal("1"), Decimal("1.45"), Decimal("-23.456"), None], |
| 249 | } |
| 250 | |
| 251 | decimal_types = (pa.decimal32, pa.decimal64, pa.decimal128, pa.decimal256) |
| 252 | for type_factory in decimal_types: |
| 253 | schema = pa.schema([('a', type_factory(9, 4))]) |
| 254 | opts = ParseOptions(explicit_schema=schema) |
| 255 | table = self.read_bytes(rows, parse_options=opts) |
| 256 | assert table.schema == schema |
| 257 | assert table.to_pydict() == expected |
| 258 | |
| 259 | def test_explicit_schema_with_unexpected_behaviour(self): |
| 260 | # infer by default |
nothing calls this directly
no test coverage detected