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

Function TestMixedTypeFails

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

Source from the content-addressed store, hash-verified

518}
519
520Status TestMixedTypeFails() {
521 OwnedRef list_ref(PyList_New(3));
522 PyObject* list = list_ref.obj();
523
524 ASSERT_NE(list, nullptr);
525
526 PyObject* str = PyUnicode_FromString("abc");
527 ASSERT_NE(str, nullptr);
528
529 PyObject* integer = PyLong_FromLong(1234L);
530 ASSERT_NE(integer, nullptr);
531
532 PyObject* doub = PyFloat_FromDouble(123.0234);
533 ASSERT_NE(doub, nullptr);
534
535 // This steals a reference to each object, so we don't need to decref them later
536 // just the list
537 ASSERT_EQ(PyList_SetItem(list, 0, str), 0);
538 ASSERT_EQ(PyList_SetItem(list, 1, integer), 0);
539 ASSERT_EQ(PyList_SetItem(list, 2, doub), 0);
540
541 ASSERT_RAISES(TypeError, ConvertPySequence(list, nullptr, {}));
542
543 return Status::OK();
544}
545
546template <typename DecimalValue>
547Status DecimalTestFromPythonDecimalRescale(std::shared_ptr<DataType> type,

Callers

nothing calls this directly

Calls 2

ConvertPySequenceFunction · 0.85
OKFunction · 0.50

Tested by

no test coverage detected