()
| 392 | |
| 393 | |
| 394 | def test_undo_class_descriptors_delattr() -> None: |
| 395 | class SampleParent: |
| 396 | @classmethod |
| 397 | def hello(_cls): |
| 398 | pass |
| 399 | |
| 400 | @staticmethod |
| 401 | def world(): |
| 402 | pass |
| 403 | |
| 404 | class SampleChild(SampleParent): |
| 405 | pass |
| 406 | |
| 407 | monkeypatch = MonkeyPatch() |
| 408 | |
| 409 | original_hello = SampleChild.hello |
| 410 | original_world = SampleChild.world |
| 411 | monkeypatch.delattr(SampleParent, "hello") |
| 412 | monkeypatch.delattr(SampleParent, "world") |
| 413 | assert getattr(SampleParent, "hello", None) is None |
| 414 | assert getattr(SampleParent, "world", None) is None |
| 415 | |
| 416 | monkeypatch.undo() |
| 417 | assert original_hello == SampleChild.hello |
| 418 | assert original_world == SampleChild.world |
| 419 | |
| 420 | |
| 421 | def test_issue1338_name_resolving() -> None: |
nothing calls this directly
no test coverage detected