(self)
| 2603 | assert worker.run(check_generic, C[int], C, int) == "ok" |
| 2604 | |
| 2605 | def test_generic_subclass(self): |
| 2606 | T = typing.TypeVar("T") |
| 2607 | |
| 2608 | class Base(typing.Generic[T]): |
| 2609 | pass |
| 2610 | |
| 2611 | class DerivedAny(Base): |
| 2612 | pass |
| 2613 | |
| 2614 | class LeafAny(DerivedAny): |
| 2615 | pass |
| 2616 | |
| 2617 | class DerivedInt(Base[int]): |
| 2618 | pass |
| 2619 | |
| 2620 | class LeafInt(DerivedInt): |
| 2621 | pass |
| 2622 | |
| 2623 | class DerivedT(Base[T]): |
| 2624 | pass |
| 2625 | |
| 2626 | class LeafT(DerivedT[T]): |
| 2627 | pass |
| 2628 | |
| 2629 | klasses = [Base, DerivedAny, LeafAny, DerivedInt, LeafInt, DerivedT, LeafT] |
| 2630 | for klass in klasses: |
| 2631 | assert pickle_depickle(klass, protocol=self.protocol) is klass |
| 2632 | |
| 2633 | with subprocess_worker(protocol=self.protocol) as worker: |
| 2634 | |
| 2635 | def check_mro(klass, expected_mro): |
| 2636 | assert klass.mro() == expected_mro |
| 2637 | return "ok" |
| 2638 | |
| 2639 | for klass in klasses: |
| 2640 | mro = klass.mro() |
| 2641 | assert check_mro(klass, mro) |
| 2642 | assert worker.run(check_mro, klass, mro) == "ok" |
| 2643 | |
| 2644 | def test_locally_defined_class_with_type_hints(self): |
| 2645 | with subprocess_worker(protocol=self.protocol) as worker: |
nothing calls this directly
no test coverage detected