| 647 | } |
| 648 | |
| 649 | Status TestDecimal128OverflowFails() { |
| 650 | Decimal128 value; |
| 651 | OwnedRef decimal_constructor_; |
| 652 | OwnedRef decimal_module; |
| 653 | |
| 654 | RETURN_NOT_OK(internal::ImportModule("decimal", &decimal_module)); |
| 655 | RETURN_NOT_OK( |
| 656 | internal::ImportFromModule(decimal_module.obj(), "Decimal", &decimal_constructor_)); |
| 657 | |
| 658 | std::string decimal_string("9999999999999999999999999999999999999.9"); |
| 659 | PyObject* python_decimal = |
| 660 | internal::DecimalFromString(decimal_constructor_.obj(), decimal_string); |
| 661 | internal::DecimalMetadata metadata; |
| 662 | ASSERT_OK(metadata.Update(python_decimal)); |
| 663 | ASSERT_EQ(38, metadata.precision()); |
| 664 | ASSERT_EQ(1, metadata.scale()); |
| 665 | |
| 666 | auto type = ::arrow::smallest_decimal(38, 38); |
| 667 | const auto& decimal_type = checked_cast<const DecimalType&>(*type); |
| 668 | ASSERT_RAISES(Invalid, |
| 669 | internal::DecimalFromPythonDecimal(python_decimal, decimal_type, &value)); |
| 670 | return Status::OK(); |
| 671 | } |
| 672 | |
| 673 | Status TestDecimal256OverflowFails() { |
| 674 | Decimal256 value; |
nothing calls this directly
no test coverage detected