(cls)
| 944 | |
| 945 | @classmethod |
| 946 | def setup_mappers(cls): |
| 947 | parents_table, children_table = cls.tables("Parent", "Children") |
| 948 | |
| 949 | class CustomProxy(_AssociationList): |
| 950 | def __init__(self, lazy_collection, creator, value_attr, parent): |
| 951 | getter, setter = parent._default_getset(lazy_collection) |
| 952 | _AssociationList.__init__( |
| 953 | self, lazy_collection, creator, getter, setter, parent |
| 954 | ) |
| 955 | |
| 956 | class Parent(cls.Basic): |
| 957 | children = association_proxy( |
| 958 | "_children", |
| 959 | "name", |
| 960 | proxy_factory=CustomProxy, |
| 961 | proxy_bulk_set=CustomProxy.extend, |
| 962 | ) |
| 963 | |
| 964 | def __init__(self, name): |
| 965 | self.name = name |
| 966 | |
| 967 | class Child(cls.Basic): |
| 968 | def __init__(self, name): |
| 969 | self.name = name |
| 970 | |
| 971 | cls.mapper_registry.map_imperatively( |
| 972 | Parent, |
| 973 | parents_table, |
| 974 | properties={ |
| 975 | "_children": relationship( |
| 976 | Child, lazy="joined", collection_class=list |
| 977 | ) |
| 978 | }, |
| 979 | ) |
| 980 | cls.mapper_registry.map_imperatively(Child, children_table) |
| 981 | |
| 982 | def test_sequence_ops(self): |
| 983 | self._test_sequence_ops() |
nothing calls this directly
no test coverage detected