(self)
| 1434 | |
| 1435 | @cpython_only |
| 1436 | def test_code_new_empty(self): |
| 1437 | # If this test fails, it means that the construction of PyCode_NewEmpty |
| 1438 | # needs to be modified! Please update this test *and* PyCode_NewEmpty, |
| 1439 | # so that they both stay in sync. |
| 1440 | def f(): |
| 1441 | pass |
| 1442 | PY_CODE_LOCATION_INFO_NO_COLUMNS = 13 |
| 1443 | f.__code__ = f.__code__.replace( |
| 1444 | co_stacksize=1, |
| 1445 | co_firstlineno=42, |
| 1446 | co_code=bytes( |
| 1447 | [ |
| 1448 | dis.opmap["RESUME"], 0, |
| 1449 | dis.opmap["LOAD_COMMON_CONSTANT"], 0, |
| 1450 | dis.opmap["RAISE_VARARGS"], 1, |
| 1451 | ] |
| 1452 | ), |
| 1453 | co_linetable=bytes( |
| 1454 | [ |
| 1455 | (1 << 7) |
| 1456 | | (PY_CODE_LOCATION_INFO_NO_COLUMNS << 3) |
| 1457 | | (3 - 1), |
| 1458 | 0, |
| 1459 | ] |
| 1460 | ), |
| 1461 | ) |
| 1462 | self.assertRaises(AssertionError, f) |
| 1463 | self.assertEqual( |
| 1464 | list(f.__code__.co_positions()), |
| 1465 | 3 * [(42, 42, None, None)], |
| 1466 | ) |
| 1467 | |
| 1468 | @cpython_only |
| 1469 | def test_docstring_under_o2(self): |
nothing calls this directly
no test coverage detected