(self)
| 384 | self.assert_emit(Box(self.vvs), """cpy_r_r0 = VecNestedApi.box(cpy_r_vvs);""") |
| 385 | |
| 386 | def test_unbox_vec(self) -> None: |
| 387 | self.assert_emit( |
| 388 | Unbox(self.o, RVec(int64_rprimitive), 55), |
| 389 | """cpy_r_r0 = VecI64Api.unbox(cpy_r_o); |
| 390 | if (VEC_IS_ERROR(cpy_r_r0)) { |
| 391 | CPy_TypeError("vec[i64]", cpy_r_o); cpy_r_r0 = (VecI64) { -1, NULL }; |
| 392 | } |
| 393 | """, |
| 394 | ) |
| 395 | self.assert_emit( |
| 396 | Unbox(self.o, RVec(int32_rprimitive), 55), |
| 397 | """cpy_r_r0 = VecI32Api.unbox(cpy_r_o); |
| 398 | if (VEC_IS_ERROR(cpy_r_r0)) { |
| 399 | CPy_TypeError("vec[i32]", cpy_r_o); cpy_r_r0 = (VecI32) { -1, NULL }; |
| 400 | } |
| 401 | """, |
| 402 | ) |
| 403 | self.assert_emit( |
| 404 | Unbox(self.o, RVec(str_rprimitive), 55), |
| 405 | """cpy_r_r0 = VecTApi.unbox(cpy_r_o, (size_t)&PyUnicode_Type); |
| 406 | if (VEC_IS_ERROR(cpy_r_r0)) { |
| 407 | CPy_TypeError("vec[str]", cpy_r_o); cpy_r_r0 = (VecT) { -1, NULL }; |
| 408 | } |
| 409 | """, |
| 410 | ) |
| 411 | self.assert_emit( |
| 412 | Unbox(self.o, RVec(RUnion([str_rprimitive, none_rprimitive])), 55), |
| 413 | """cpy_r_r0 = VecTApi.unbox(cpy_r_o, ((size_t)&PyUnicode_Type | 1)); |
| 414 | if (VEC_IS_ERROR(cpy_r_r0)) { |
| 415 | CPy_TypeError("vec[str | None]", cpy_r_o); cpy_r_r0 = (VecT) { -1, NULL }; |
| 416 | } |
| 417 | """, |
| 418 | ) |
| 419 | self.assert_emit( |
| 420 | Unbox(self.o, RVec(self.r.type), 55), |
| 421 | """cpy_r_r0 = VecTApi.unbox(cpy_r_o, (size_t)CPyType_A); |
| 422 | if (VEC_IS_ERROR(cpy_r_r0)) { |
| 423 | CPy_TypeError("vec[mod.A]", cpy_r_o); cpy_r_r0 = (VecT) { -1, NULL }; |
| 424 | } |
| 425 | """, |
| 426 | ) |
| 427 | |
| 428 | def test_unbox_vec_nested(self) -> None: |
| 429 | self.assert_emit( |
nothing calls this directly
no test coverage detected