test_som_factory.som_factory_infra()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 7
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
import pytest
2
3
4
@pytest.fixture
5
def dataset_without_feature_vectors(somagic, test_datapoints):
6
    return somagic.dataset
7
8
9
@pytest.fixture
10
def som_factory_infra():
11
    from so_magic.som.factory import SelfOrganizingMapFactory
12
    from so_magic.som.self_organising_map import NoFeatureVectorsError
13
    return {
14
        'factory_method': SelfOrganizingMapFactory().create,
15
        'no_feature_vectors_error': NoFeatureVectorsError
16
    }
17
18
19
def test_create_method(dataset_without_feature_vectors, som_factory_infra):
20
    with pytest.raises(som_factory_infra['no_feature_vectors_error'],
21
                       match='Attempted to train a Som model, but did not find feature vectors in the dataset.'):
22
        som_factory_infra['factory_method'](dataset_without_feature_vectors, 5, 4)
23