Skip to content

Commit 127f8c6

Browse files
committed
black
1 parent fe6ab25 commit 127f8c6

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

pyomo/contrib/preprocessing/plugins/var_aggregator.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@
1313

1414

1515
from pyomo.common.collections import ComponentMap, ComponentSet
16-
from pyomo.core.base import (Block, Constraint, VarList, Objective, Reals,
17-
TransformationFactory)
16+
from pyomo.core.base import (
17+
Block,
18+
Constraint,
19+
VarList,
20+
Objective,
21+
Reals,
22+
TransformationFactory,
23+
)
1824
from pyomo.core.expr import ExpressionReplacementVisitor
1925
from pyomo.core.expr.numvalue import value
2026
from pyomo.core.plugins.transform.hierarchy import IsomorphicTransformation

pyomo/contrib/preprocessing/tests/test_var_aggregator.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,38 +219,31 @@ def test_binary_inequality(self):
219219
m.x = Var(domain=Binary)
220220
m.y = Var(domain=Binary)
221221
m.c = Constraint(expr=m.x == m.y)
222-
m.o = Objective(expr=0.5*m.x + m.y, sense=maximize)
222+
m.o = Objective(expr=0.5 * m.x + m.y, sense=maximize)
223223
TransformationFactory('contrib.aggregate_vars').apply_to(m)
224224
var_to_z = m._var_aggregator_info.var_to_z
225225
z = var_to_z[m.x]
226226
self.assertIs(var_to_z[m.y], z)
227227
self.assertEqual(z.domain, Binary)
228228
self.assertEqual(z.lb, 0)
229229
self.assertEqual(z.ub, 1)
230-
assertExpressionsEqual(
231-
self,
232-
m.o.expr,
233-
0.5 * z + z
234-
)
230+
assertExpressionsEqual(self, m.o.expr, 0.5 * z + z)
235231

236232
def test_equality_different_domains(self):
237233
m = ConcreteModel()
238234
m.x = Var(domain=Reals, bounds=(1, 2))
239235
m.y = Var(domain=Binary)
240236
m.c = Constraint(expr=m.x == m.y)
241-
m.o = Objective(expr=0.5*m.x + m.y, sense=maximize)
237+
m.o = Objective(expr=0.5 * m.x + m.y, sense=maximize)
242238
TransformationFactory('contrib.aggregate_vars').apply_to(m)
243239
var_to_z = m._var_aggregator_info.var_to_z
244240
z = var_to_z[m.x]
245241
self.assertIs(var_to_z[m.y], z)
246242
self.assertEqual(z.lb, 1)
247243
self.assertEqual(z.ub, 1)
248244
self.assertEqual(z.domain, Binary)
249-
assertExpressionsEqual(
250-
self,
251-
m.o.expr,
252-
0.5 * z + z
253-
)
245+
assertExpressionsEqual(self, m.o.expr, 0.5 * z + z)
246+
254247

255248
if __name__ == '__main__':
256249
unittest.main()

0 commit comments

Comments
 (0)