File: test_singleobj_dims.py

package info (click to toggle)
pyswarms 1.3.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,708 kB
  • sloc: python: 4,108; makefile: 240; sh: 32
file content (92 lines) | stat: -rw-r--r-- 2,079 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Tests for `pyswarms` package."""

# Import standard library
from collections import namedtuple

# Import modules
import numpy as np
import pytest

# Import from pyswarms
from pyswarms.utils.functions import single_obj as fx


def test_beale_dim_fail(outdim):
    """Test beale dim exception"""
    with pytest.raises(IndexError):
        fx.beale(outdim)


def test_booth_dim_fail(outdim):
    """Test booth dim exception"""
    with pytest.raises(IndexError):
        fx.booth(outdim)


def test_bukin6_dim_fail(outdim):
    """Test bukin6 dim exception"""
    with pytest.raises(IndexError):
        fx.bukin6(outdim)


def test_crossintray_dim_fail(outdim):
    """Test crossintray dim exception"""
    with pytest.raises(IndexError):
        fx.crossintray(outdim)


def test_easom_dim_fail(outdim):
    """Test easom dim exception"""
    with pytest.raises(IndexError):
        fx.easom(outdim)


def test_goldstein_dim_fail(outdim):
    """Test goldstein dim exception"""
    with pytest.raises(IndexError):
        fx.goldstein(outdim)


def test_eggholder_dim_fail(outdim):
    """Test eggholder dim exception"""
    with pytest.raises(IndexError):
        fx.eggholder(outdim)


def test_himmelblau_dim_fail(outdim):
    """Test himmelblau dim exception"""
    with pytest.raises(IndexError):
        fx.himmelblau(outdim)


def test_holdertable_dim_fail(outdim):
    """Test holdertable dim exception"""
    with pytest.raises(IndexError):
        fx.holdertable(outdim)


def test_levi_dim_fail(outdim):
    """Test levi dim exception"""
    with pytest.raises(IndexError):
        fx.levi(outdim)


def test_matyas_dim_fail(outdim):
    """Test matyas dim exception"""
    with pytest.raises(IndexError):
        fx.matyas(outdim)


def test_schaffer2_dim_fail(outdim):
    """Test schaffer2 dim exception"""
    with pytest.raises(IndexError):
        fx.schaffer2(outdim)


def test_threehump_dim_fail(outdim):
    """Test threehump dim exception"""
    with pytest.raises(IndexError):
        fx.threehump(outdim)