| 1891 | def test_forward_equality_and_hash_with_cells(self): |
| 1892 | """Regression test for GH-143831.""" |
| 1893 | class A: |
| 1894 | def one(_) -> C1: |
| 1895 | """One cell.""" |
| 1896 | |
| 1897 | one_f = ForwardRef("C1", owner=one) |
| 1898 | one_f_ga1 = get_annotations(one, format=Format.FORWARDREF)["return"] |
| 1899 | one_f_ga2 = get_annotations(one, format=Format.FORWARDREF)["return"] |
| 1900 | self.assertIsInstance(one_f_ga1.__cell__, types.CellType) |
| 1901 | self.assertIs(one_f_ga1.__cell__, one_f_ga2.__cell__) |
| 1902 | |
| 1903 | def two(_) -> C1 | C2: |
| 1904 | """Two cells.""" |
| 1905 | |
| 1906 | two_f_ga1 = get_annotations(two, format=Format.FORWARDREF)["return"] |
| 1907 | two_f_ga2 = get_annotations(two, format=Format.FORWARDREF)["return"] |
| 1908 | self.assertIsNot(two_f_ga1.__cell__, two_f_ga2.__cell__) |
| 1909 | self.assertIsInstance(two_f_ga1.__cell__, dict) |
| 1910 | self.assertIsInstance(two_f_ga2.__cell__, dict) |
| 1911 | |
| 1912 | type C1 = None |
| 1913 | type C2 = None |
nothing calls this directly
no test coverage detected