def test_db_to_dict(self):
        tmpdir = tempfile.mkdtemp()
        dfile = os.path.join(tmpdir, 'junk.db')
        recorder = DBCaseRecorder(dfile)

        # create some Cases where some are missing a variable
        outputs = ['comp1.z', 'comp2.z']
        inputs = ['comp1.x', 'comp1.y', 'comp1.y2']
        recorder.register(self, inputs, outputs)
        for i in range(10):
            inputs = [i, i*2, i*3]
            outputs = [i*i, float('NaN')]
            recorder.record(self, inputs, outputs, None, '', '')

        varnames = ['comp1.x', 'comp1.y', 'comp1.y2']
        varinfo = case_db_to_dict(dfile, varnames)

        self.assertEqual(len(varinfo), 3)
        # each var list should have 10 data values in it
        for lst in varinfo.values():
            self.assertEqual(len(lst), 10)

        # now use caseiter_to_dict to grab the same data
        varinfo = caseiter_to_dict(recorder.get_iterator(), varnames)
        # each var list should have 10 data values in it
        for lst in varinfo.values():
            self.assertEqual(len(lst), 10)

        try:
            shutil.rmtree(tmpdir, onerror=onerror)
        except __HOLE__:
            logging.error("problem removing directory %s", tmpdir)
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/casehandlers/test/test_dbcaserecorder.py/DBCaseRecorderTestCase.test_db_to_dict