use yield in sample_weight metric tests