Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jinningwang committed Dec 29, 2023
1 parent 621dd92 commit 0583033
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 4 additions & 4 deletions tests/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ def test_alter_param_before_routine(self):
"""

self.ss.GCost.alter("c1", ['GCost_1', 'GCost_2'], [1500., 3100.])
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 4000., 3000.])
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1])
self.ss.ACOPF.run()
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 4000., 3000.])
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1])

def test_alter_param_after_routine(self):
"""
Expand All @@ -98,9 +98,9 @@ def test_alter_param_after_routine(self):

self.ss.ACOPF.run()
self.ss.GCost.alter("c1", ['GCost_1', 'GCost_2'], [1500., 3100.])
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 4000., 3000.])
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1])
self.ss.ACOPF.run()
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 4000., 3000.])
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1])

def test_multiple_disconnected_line(self):
"""
Expand Down
10 changes: 2 additions & 8 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ def test_Cft(self):
self.assertIsInstance(self.mats.Cft.v, np.ndarray)
self.assertEqual(self.mats.Cft.v.max(), 1)

def test_pl(self):
"""
Test `pl`.
"""
self.assertEqual(self.mats.pl.v.ndim, 1)


class TestService(unittest.TestCase):
"""
Expand Down Expand Up @@ -106,8 +100,8 @@ def test_NumOpDual(self):
"""
Test `NumOpDual`.
"""
p_vec = MParam(v=self.ss.mats.pl.v)
one_vec = MParam(v=np.ones(self.ss.Bus.n))
p_vec = MParam(v=self.ss.DCOPF.pd.v)
one_vec = MParam(v=np.ones(self.ss.StaticLoad.n))
p_sum = NumOpDual(u=p_vec, u2=one_vec,
fun=np.multiply, rfun=np.sum)
self.assertEqual(p_sum.v, self.ss.PQ.p0.v.sum())
Expand Down

0 comments on commit 0583033

Please sign in to comment.