Ignore:
Timestamp:
Nov 22, 2009 10:09:34 PM (10 years ago)
Author:
wehart
Message:

Adding a test to verify that SolverResults? objects are pickleable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.opt/trunk/coopr/opt/tests/base/test_soln.py

    r1918 r1936  
    1919import pyutilib.services
    2020import xml
     21import pickle
    2122
    2223class Test(pyutilib.th.TestCase):
     
    3233
    3334    def tearDown(self):
    34         pass
     35        del self.results
    3536
    3637    def test_write_solution1(self):
     
    5253        self.results = coopr.opt.SolverResults()
    5354        self.results.read(filename=currdir+"test4_sol.txt")
     55        self.results.write(filename=currdir+"read_solution1.out")
     56        if not os.path.exists(currdir+"read_solution1.out"):
     57           self.fail("test_read_solution1 - failed to write read_solution1.out")
     58        self.failUnlessFileEqualsBaseline(currdir+"read_solution1.out", currdir+"test4_sol.txt")
     59
     60    def test_pickle_solution1(self):
     61        """ Read a SolverResults Object"""
     62        self.results = coopr.opt.SolverResults()
     63        self.results.read(filename=currdir+"test4_sol.txt")
     64        str = pickle.dumps(self.results)
     65        res = pickle.loads(str)
    5466        self.results.write(filename=currdir+"read_solution1.out")
    5567        if not os.path.exists(currdir+"read_solution1.out"):
Note: See TracChangeset for help on using the changeset viewer.