()
| 59 | |
| 60 | def test_sampling_contracts(): |
| 61 | label_endtime = [(0, 2), (1, 3), (2, 4)] |
| 62 | bar_index = [0, 1, 2, 3, 4] |
| 63 | ind_mat = openquant.sampling.get_ind_matrix(label_endtime, bar_index) |
| 64 | uniq = openquant.sampling.get_ind_mat_average_uniqueness(ind_mat) |
| 65 | samples = openquant.sampling.seq_bootstrap(ind_mat, sample_length=4, warmup_samples=[0, 1]) |
| 66 | |
| 67 | assert len(ind_mat) == len(bar_index) |
| 68 | assert len(ind_mat[0]) == len(label_endtime) |
| 69 | assert 0.0 <= uniq <= 1.0 |
| 70 | assert len(samples) == 4 |
| 71 | assert all(0 <= i < len(label_endtime) for i in samples) |
| 72 | |
| 73 | seeded = openquant.sampling.seq_bootstrap(ind_mat, sample_length=50, random_state=3) |
| 74 | assert seeded == openquant.sampling.seq_bootstrap(ind_mat, sample_length=50, random_state=3) |
| 75 | assert seeded != openquant.sampling.seq_bootstrap(ind_mat, sample_length=50, random_state=4) |
nothing calls this directly
no outgoing calls
no test coverage detected