5
5
from cvx .cla .types import TurningPoint
6
6
7
7
8
- @pytest .mark .parametrize ("n" , [5 , 20 , 100 , 1000 , 10000 , 100000 ])
8
+ @pytest .mark .parametrize ("n" , [5 , 20 , 100 , 1000 , 10000 ])
9
9
def test_init_algo (n ):
10
10
"""Compute a first turning point"""
11
11
mean = np .random .randn (n )
12
12
lower_bounds = np .zeros (n )
13
13
upper_bounds = np .random .rand (n )
14
14
15
15
first = init_algo_lp (
16
- mean = mean , lower_bounds = lower_bounds , upper_bounds = upper_bounds , solver = "ECOS"
16
+ mean = mean , lower_bounds = lower_bounds , upper_bounds = upper_bounds
17
17
)
18
18
19
19
assert np .sum (first .free ) == 1
@@ -34,9 +34,7 @@ def test_small():
34
34
mean = np .array ([1.0 , 2.0 , 3.0 ])
35
35
lower_bound = np .array ([0.0 , 0.0 , 0.0 ])
36
36
upper_bound = np .array ([0.4 , 0.4 , 0.4 ])
37
- tp = init_algo_lp (
38
- mean = mean , lower_bounds = lower_bound , upper_bounds = upper_bound , solver = "ECOS"
39
- )
37
+ tp = init_algo_lp (mean = mean , lower_bounds = lower_bound , upper_bounds = upper_bound )
40
38
41
39
assert np .allclose (tp .weights , [0.2 , 0.4 , 0.4 ])
42
40
assert tp .lamb == np .inf
@@ -61,12 +59,7 @@ def test_no_fully_invested_portfolio():
61
59
with pytest .raises (
62
60
ValueError , match = "Could not construct a fully invested portfolio"
63
61
):
64
- init_algo_lp (
65
- mean = mean ,
66
- lower_bounds = lower_bounds ,
67
- upper_bounds = upper_bounds ,
68
- solver = "ECOS" ,
69
- )
62
+ init_algo_lp (mean = mean , lower_bounds = lower_bounds , upper_bounds = upper_bounds )
70
63
71
64
with pytest .raises (
72
65
ValueError , match = "Could not construct a fully invested portfolio"
@@ -83,12 +76,7 @@ def test_lb_ub_mixed():
83
76
mean = np .ones (3 )
84
77
85
78
with pytest .raises (ValueError ):
86
- init_algo_lp (
87
- mean = mean ,
88
- lower_bounds = lower_bounds ,
89
- upper_bounds = upper_bounds ,
90
- solver = "ECOS" ,
91
- )
79
+ init_algo_lp (mean = mean , lower_bounds = lower_bounds , upper_bounds = upper_bounds )
92
80
93
81
with pytest .raises (ValueError ):
94
82
init_algo (mean = mean , lower_bounds = lower_bounds , upper_bounds = upper_bounds )
0 commit comments