Skip to content

Commit 2748d0c

Browse files
committed
test: added additiona tests on initialization of ADMML2 and LinearizedADMM
1 parent 8eefc7c commit 2748d0c

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎pytests/test_solver.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def test_ADMML2_noinitial():
5151
is provided to PrimalDual solver
5252
"""
5353
with pytest.raises(ValueError):
54+
# Both None
5455
_ = ADMML2(
5556
proxg=L1(),
5657
Op=Identity(10),
@@ -60,13 +61,25 @@ def test_ADMML2_noinitial():
6061
x0=None,
6162
z0=None,
6263
)
64+
with pytest.raises(ValueError):
65+
# x0 is None (and Op provided)
66+
_ = ADMML2(
67+
proxg=L1(),
68+
Op=Identity(10),
69+
b=np.ones(10),
70+
A=Identity(10),
71+
tau=1.0,
72+
x0=None,
73+
z0=np.ones(10),
74+
)
6375

6476

6577
def test_LinearizedADMM_noinitial():
6678
"""Check that an error is raised if no initial x0
6779
is provided to LinearizedADMM solver
6880
"""
6981
with pytest.raises(ValueError):
82+
# Both None
7083
_ = LinearizedADMM(
7184
proxf=L2(),
7285
proxg=L1(),
@@ -76,6 +89,17 @@ def test_LinearizedADMM_noinitial():
7689
x0=None,
7790
z0=None,
7891
)
92+
with pytest.raises(ValueError):
93+
# x0 is None (and Op provided)
94+
_ = LinearizedADMM(
95+
proxf=L2(),
96+
proxg=L1(),
97+
A=Identity(10),
98+
tau=1.0,
99+
mu=1.0,
100+
x0=None,
101+
z0=np.ones(10),
102+
)
79103

80104

81105
@pytest.mark.parametrize("par", [(par1), (par2)])

0 commit comments

Comments
 (0)