(self, defs, mod, *, fail=False)
| 726 | self.assert_not_shareable(defs.TOP_FUNCTIONS) |
| 727 | |
| 728 | def assert_func_defs_other_unpickle(self, defs, mod, *, fail=False): |
| 729 | # Unpickle relative to a different module than the original. |
| 730 | for func in defs.TOP_FUNCTIONS: |
| 731 | assert not hasattr(mod, func.__name__), (getattr(mod, func.__name__),) |
| 732 | |
| 733 | captured = [] |
| 734 | for func in defs.TOP_FUNCTIONS: |
| 735 | with self.subTest(func): |
| 736 | setattr(mod, func.__name__, func) |
| 737 | xid = self.get_xidata(func) |
| 738 | captured.append( |
| 739 | (func, xid)) |
| 740 | |
| 741 | for func, xid in captured: |
| 742 | with self.subTest(func): |
| 743 | delattr(mod, func.__name__) |
| 744 | if fail: |
| 745 | with self.assertRaises(NotShareableError): |
| 746 | _testinternalcapi.restore_crossinterp_data(xid) |
| 747 | continue |
| 748 | got = _testinternalcapi.restore_crossinterp_data(xid) |
| 749 | self.assertIsNot(got, func) |
| 750 | self.assertNotEqual(got, func) |
| 751 | |
| 752 | def assert_func_defs_not_shareable(self, defs): |
| 753 | self.assert_not_shareable(defs.TOP_FUNCTIONS) |
no test coverage detected