Create objects of type `class_` and return them in a list. `values` is a list of values that determines the value of data attribute `x` of each object. Objects in the returned list are sorted by their identity. They assigned values in `values` list order. By assig
(self, class_, values)
| 203 | CompLe, CompGe, CompLeGe) # less/greater-or-equal group |
| 204 | |
| 205 | def create_sorted_instances(self, class_, values): |
| 206 | """Create objects of type `class_` and return them in a list. |
| 207 | |
| 208 | `values` is a list of values that determines the value of data |
| 209 | attribute `x` of each object. |
| 210 | |
| 211 | Objects in the returned list are sorted by their identity. They |
| 212 | assigned values in `values` list order. By assign decreasing |
| 213 | values to objects with increasing identities, testcases can assert |
| 214 | that order comparison is performed by value and not by identity. |
| 215 | """ |
| 216 | |
| 217 | instances = [class_() for __ in range(len(values))] |
| 218 | instances.sort(key=id) |
| 219 | # Assign the provided values to the instances. |
| 220 | for inst, value in zip(instances, values): |
| 221 | inst.x = value |
| 222 | return instances |
| 223 | |
| 224 | def assert_equality_only(self, a, b, equal): |
| 225 | """Assert equality result and that ordering is not implemented. |
no test coverage detected