| 74 | |
| 75 | |
| 76 | class LinalgCase: |
| 77 | def __init__(self, name, a, b, tags=set()): |
| 78 | """ |
| 79 | A bundle of arguments to be passed to a test case, with an identifying |
| 80 | name, the operands a and b, and a set of tags to filter the tests |
| 81 | """ |
| 82 | assert_(isinstance(name, str)) |
| 83 | self.name = name |
| 84 | self.a = a |
| 85 | self.b = b |
| 86 | self.tags = frozenset(tags) # prevent shared tags |
| 87 | |
| 88 | def check(self, do): |
| 89 | """ |
| 90 | Run the function `do` on this test case, expanding arguments |
| 91 | """ |
| 92 | do(self.a, self.b, tags=self.tags) |
| 93 | |
| 94 | def __repr__(self): |
| 95 | return f'<LinalgCase: {self.name}>' |
| 96 | |
| 97 | |
| 98 | def apply_tag(tag, cases): |
no outgoing calls