| 518 | } |
| 519 | |
| 520 | Status 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 | |
| 546 | template <typename DecimalValue> |
| 547 | Status DecimalTestFromPythonDecimalRescale(std::shared_ptr<DataType> type, |
nothing calls this directly
no test coverage detected