| 165 | return res |
| 166 | |
| 167 | def get(product, subject): |
| 168 | provider = next( |
| 169 | ( |
| 170 | mock_get.mock |
| 171 | for mock_get in mock_gets |
| 172 | if mock_get.product_type == product |
| 173 | and ( |
| 174 | mock_get.subject_type == type(subject) |
| 175 | or ( |
| 176 | union_membership |
| 177 | and union_membership.is_member(mock_get.subject_type, subject) |
| 178 | ) |
| 179 | ) |
| 180 | ), |
| 181 | None, |
| 182 | ) |
| 183 | if provider is None: |
| 184 | raise AssertionError( |
| 185 | "Rule requested: Get{}, which cannot be satisfied.".format( |
| 186 | (product, type(subject), subject) |
| 187 | ) |
| 188 | ) |
| 189 | return provider(subject) |
| 190 | |
| 191 | rule_coroutine = res |
| 192 | rule_input = None |