Exemplo n.º 1
0
def test_systematic_sample_from_many_artifacts():
    artifacts = list(range(20, 0, -1))
    n_artifacts = 5
    selected_artifacts = sample_systematic_from_artifacts(
        artifacts, n_artifacts)
    assert selected_artifacts == [18, 14, 10, 6, 2]
    assert len(selected_artifacts) == n_artifacts
Exemplo n.º 2
0
def test_systematic_sample_from_few_artifacts():
    artifacts = ['0', '1', '2', '3', '4', '5', '6']
    n_artifacts = 5
    selected_artifacts = sample_systematic_from_artifacts(
        artifacts, n_artifacts)
    assert selected_artifacts[0] == '0'
    assert selected_artifacts[4] == '4'
    assert len(selected_artifacts) == n_artifacts
Exemplo n.º 3
0
def test_systematic_sample_from_artifacts_too_few():
    artifacts = list(range(3, 0, -1))
    n_artifacts = 5
    with pytest.raises(Exception):
        sample_systematic_from_artifacts(artifacts, n_artifacts)