MCPcopy Create free account
hub / github.com/apache/arrow / TestDecimal128OverflowFails

Function TestDecimal128OverflowFails

python/pyarrow/src/arrow/python/python_test.cc:649–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649Status 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
673Status TestDecimal256OverflowFails() {
674 Decimal256 value;

Callers

nothing calls this directly

Calls 9

ImportModuleFunction · 0.85
ImportFromModuleFunction · 0.85
smallest_decimalFunction · 0.85
DecimalFromPythonDecimalFunction · 0.85
DecimalFromStringFunction · 0.70
OKFunction · 0.50
UpdateMethod · 0.45
precisionMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected