| 72 | ], |
| 73 | ) |
| 74 | def test_quantizer_parameter_representation(param_type, quantize_type, expected_name): |
| 75 | # Parameters can be represented even when their index/quantizer combination |
| 76 | # is rejected at collection creation. Compare to the specified name, not |
| 77 | # only to the original: a round trip can preserve an incorrect string. |
| 78 | param = param_type(metric_type=MetricType.L2, quantize_type=quantize_type) |
| 79 | for value in (param, param.clone(), pickle.loads(pickle.dumps(param))): |
| 80 | assert value.quantize_type == quantize_type |
| 81 | assert value.to_dict()["quantize_type"] == expected_name |
| 82 | assert expected_name in repr(value) |
| 83 | |
| 84 | |
| 85 | # ---------------------------- |