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

Function TestDecimal256OverflowFails

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

Source from the content-addressed store, hash-verified

671}
672
673Status TestDecimal256OverflowFails() {
674 Decimal256 value;
675 OwnedRef decimal_constructor_;
676 OwnedRef decimal_module;
677
678 RETURN_NOT_OK(internal::ImportModule("decimal", &decimal_module));
679 RETURN_NOT_OK(
680 internal::ImportFromModule(decimal_module.obj(), "Decimal", &decimal_constructor_));
681
682 std::string decimal_string(
683 "999999999999999999999999999999999999999999999999999999999999999999999999999.9");
684 PyObject* python_decimal =
685 internal::DecimalFromString(decimal_constructor_.obj(), decimal_string);
686
687 internal::DecimalMetadata metadata;
688 ASSERT_OK(metadata.Update(python_decimal));
689 ASSERT_EQ(76, metadata.precision());
690 ASSERT_EQ(1, metadata.scale());
691
692 auto type = ::arrow::smallest_decimal(76, 76);
693 const auto& decimal_type = checked_cast<const DecimalType&>(*type);
694 ASSERT_RAISES(Invalid,
695 internal::DecimalFromPythonDecimal(python_decimal, decimal_type, &value));
696 return Status::OK();
697}
698
699Status TestNoneAndNaN() {
700 OwnedRef list_ref(PyList_New(4));

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