Ejemplo n.º 1
0
def test_make_primitive_primitives_subfolders_false():
    with tempfile.TemporaryDirectory('sigpro') as tmp_dir:
        expected_result = 'sigpro.aggregations.amplitude.statistical.mean.json'
        expected_result = os.path.join(tmp_dir, expected_result)
        result = make_primitive(
            'sigpro.aggregations.amplitude.statistical.mean',
            'aggregation',
            'amplitude',
            primitives_path=tmp_dir,
            primitives_subfolders=False)
        assert result == expected_result
        with open(result, 'rb') as created_primitive:
            primitive_dict = json.load(created_primitive)
            assert primitive_dict == EXPECTED_PRIMITIVE_DICT
Ejemplo n.º 2
0
def test_make_primitive_missing_additional_hyperparameters():
    with pytest.raises(ValueError):
        make_primitive('sigpro.aggregations.amplitude.statistical.kurtosis',
                       'aggregation', 'amplitude')
Ejemplo n.º 3
0
def test_make_primitive_invalid_subtype():
    with pytest.raises(ValueError):
        make_primitive('invalid', 'aggregation', 'invalid')
Ejemplo n.º 4
0
def test_make_primitive_invalid_name():
    with pytest.raises(ImportError):
        make_primitive('invalid', 'aggregation', 'amplitude')
Ejemplo n.º 5
0
def test_make_primitive_invalid_type():
    with pytest.raises(ValueError):
        make_primitive('invalid', 'invalid', 'invalid')