Changeset 2656
- Timestamp:
- Jun 11, 2010 10:12:12 AM (11 years ago)
- Location:
- coopr.pyomo/trunk/coopr/pyomo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
coopr.pyomo/trunk/coopr/pyomo/base/constraint.py
r2655 r2656 64 64 if args == (): 65 65 self._data[None] = ObjectiveData() 66 else: 67 for i in args: 68 if not ( isinstance(i, _SetContainer) ): 69 msg = 'Invalid argument. Objective expects arguments of ' 70 msg += "type 'Set', not type '%s'" 71 raise TypeError, msg % str( type(i).__name__ ) 66 72 67 73 # this is a hack for now; we eventually want a -
coopr.pyomo/trunk/coopr/pyomo/tests/unit/test_obj.py
r2422 r2656 58 58 self.failUnlessEqual(self.instance.obj(), 8) 59 59 self.failUnlessEqual(value(self.instance.obj), 8) 60 61 def test_arguments(self): 62 """Test that arguments notare of type _SetContainer""" 63 def rule(model): 64 return 1 65 try: 66 self.model.obj = Objective(self.model, rule=rule) 67 except TypeError: 68 pass 69 else: 70 self.fail("Objective should only accept '_SetContainter's") 71 60 72 61 73 def test_sense_option(self):
Note: See TracChangeset
for help on using the changeset viewer.