Changeset 2997


Ignore:
Timestamp:
Sep 6, 2010 1:39:22 AM (9 years ago)
Author:
wehart
Message:

Fixing #4058. Stripping quotes around strings
that contain a whitespace.

Location:
coopr.pyomo/trunk/coopr/pyomo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/data/parse_datacmds.py

    r2585 r2997  
    337337            | template
    338338    '''
    339     p[0] = p[1]
     339    if p[1][0] == '"' and len(p[1]) > 2 and p[1][-1] == '"' and not ' ' in p[1]:
     340        p[0] = p[1][1:-1]
     341    else:
     342        p[0] = p[1]
    340343
    341344def p_filename(p):
  • coopr.pyomo/trunk/coopr/pyomo/tests/unit/test_param.py

    r2128 r2997  
    563563        self.failUnlessEqual( self.instance.B.value, False )
    564564
     565    def test_io8(self):
     566        OUTPUT=open("param.dat","w")
     567        print >>OUTPUT, "data;"
     568        print >>OUTPUT, "param : A : B :="
     569        print >>OUTPUT, "\"A\" 3.3"
     570        print >>OUTPUT, "\"B\" 3.4"
     571        print >>OUTPUT, "\"C\" 3.5;"
     572        print >>OUTPUT, "end;"
     573        OUTPUT.close()
     574        self.model.A=Set()
     575        self.model.B=Param(self.model.A)
     576        self.instance = self.model.create("param.dat")
     577        #self.instance.A.pprint()
     578        #self.instance.B.pprint()
     579        self.failUnlessEqual( self.instance.A.data(), set(['A','B','C']) )
     580
    565581
    566582class TestParamError(PyomoModel):
Note: See TracChangeset for help on using the changeset viewer.