Passed
Push — master ( 96da92...a1b572 )
by Konstantinos
37s queued 14s
created

test_som_factory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 4

3 Functions

Rating   Name   Duplication   Size   Complexity  
A test_create_method() 0 4 2
A som_factory_infra() 0 7 1
A dataset_without_feature_vectors() 0 3 1
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