def post(self): form = cgi.FieldStorage() chemical_name = form.getvalue('chemical_name') # select_receptor = form.getvalue('select_receptor') # bw_bird = form.getvalue('body_weight_of_bird') # bw_mamm = form.getvalue('body_weight_of_mammal') sol = form.getvalue('solubility') ld50_a = form.getvalue('ld50_a') ld50_m = form.getvalue('ld50_m') aw_bird = form.getvalue('aw_bird') # tw_bird = form.getvalue('body_weight_of_the_tested_bird') aw_mamm = form.getvalue('aw_mamm') # tw_mamm = form.getvalue('body_weight_of_the_tested_mammal') mineau = form.getvalue('mineau_scaling_factor') noael = form.getvalue('NOAEL') noaec_d = form.getvalue('NOAEC_d') noaec_q = form.getvalue('NOAEC_q') noaec_o = form.getvalue('NOAEC_o') # noaec_o2 = form.getvalue('NOAEC_o2') Species_of_the_bird_NOAEC_CHOICES = form.getvalue('NOAEC_species') bw_quail = form.getvalue('bw_quail') bw_duck = form.getvalue('bw_duck') bwb_other = form.getvalue('bwb_other') bw_rat = form.getvalue('bw_rat') bwm_other = form.getvalue('bwm_other') b_species = form.getvalue('b_species') m_species = form.getvalue('m_species') sip_obj = sip_model.sip(True,True,'single',chemical_name, b_species, m_species, bw_quail, bw_duck, bwb_other, bw_rat, bwm_other, sol, ld50_a, ld50_m, aw_bird, mineau, aw_mamm, noaec_d, noaec_q, noaec_o, Species_of_the_bird_NOAEC_CHOICES, noael) text_file = open('sip/sip_description.txt','r') x = text_file.read() templatepath = os.path.dirname(__file__) + '/../templates/' ChkCookie = self.request.cookies.get("ubercookie") html = uber_lib.SkinChk(ChkCookie, "SIP Output") html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'sip','page':'output'}) html = html + template.render (templatepath + '03ubertext_links_left.html', {}) html = html + template.render(templatepath + '04uberoutput_start.html', { 'model':'sip', 'model_attributes':'SIP Output'}) html = html + sip_tables.timestamp(sip_obj) html = html + sip_tables.table_all(sip_obj) html = html + template.render(templatepath + 'export.html', {}) html = html + template.render(templatepath + '04uberoutput_end.html', {}) html = html + template.render(templatepath + '06uberfooter.html', {'links': ''}) rest_funcs.save_dic(html, sip_obj.__dict__, "sip", "single") self.response.out.write(html)
testFailureMessage = "Test of function name: %s expected: %s != calculated: %s" % ("chronconm",self.sip_obj.chronconm_out,fun) self.assertEqual(fun,self.chronconm_out,testFailureMessage) def suite(TestCaseName, **kwargs): suite = unittest.TestSuite() set_globals(**kwargs) suite.addTest(unittest.makeSuite(TestCaseName)) stream = StringIO() runner = unittest.TextTestRunner(stream=stream, verbosity=2) result = runner.run(suite) stream.seek(0) test_out=stream.read() return test_out sip_obj = sip_model.sip(True,True,'qaqc',chemical_name[0], b_species[0], m_species[0], bw_quail[0], bw_duck[0], bwb_other[0], bw_rat[0], bwm_other[0], sol[0], avian_ld50[0], mammalian_ld50[0], aw_bird[0], mineau[0], aw_mamm[0], noaec_d[0], noaec_q[0], noaec_o[0], Species_of_the_bird_NOAEC_CHOICES[0], noael[0]) sip_obj.set_unit_testing_variables() sip_obj.chemical_name_expected = chemical_name[0] sip_obj.dose_bird_out_expected = dose_bird_out[0] sip_obj.dose_mamm_out_expected = dose_mamm_out[0] sip_obj.at_bird_out_expected = at_bird_out[0] sip_obj.at_mamm_out_expected = at_mamm_out[0] sip_obj.det_out_expected = det_out[0] sip_obj.act_out_expected = act_out[0] sip_obj.acute_bird_out_expected = acute_bird_out[0] sip_obj.acuconb_out_expected = acuconb_out[0] sip_obj.acute_mamm_out_expected = acute_mamm_out[0] sip_obj.acuconm_out_expected = acuconm_out[0] sip_obj.chron_bird_out_expected = chron_bird_out[0] sip_obj.chronconb_out_expected = chronconb_out[0]
def html_table(row_inp_all): while True: row_inp_temp_all = row_inp_all.get() if row_inp_temp_all is None: break else: row_inp = row_inp_temp_all[0] iter = row_inp_temp_all[1] logger.info("iteration: " + str(iter)) chemical_name.append(str(row_inp[0])) b_species.append(float(row_inp[1])) m_species.append(float(row_inp[2])) bw_quail.append(float(row_inp[3])) bw_duck.append(float(row_inp[4])) bwb_other.append(float(row_inp[5])) bw_rat.append(float(row_inp[6])) bwm_other.append(float(row_inp[7])) sol.append(float(row_inp[8])) avian_ld50.append(float(row_inp[9])) mammalian_ld50.append(float(row_inp[10])) aw_bird.append(float(row_inp[11])) mineau.append(float(row_inp[12])) aw_mamm.append(float(row_inp[13])) noaec_d.append(float(row_inp[14])) noaec_q.append(float(row_inp[15])) noaec_o.append(float(row_inp[16])) noael.append(float(row_inp[17])) Species_of_the_bird_NOAEC_CHOICES.append(str(row_inp[18])) if Species_of_the_bird_NOAEC_CHOICES[iter] == '1': noaec.append(float(row_inp[14])) elif Species_of_the_bird_NOAEC_CHOICES[iter] == '2': noaec.append(float(row_inp[15])) elif Species_of_the_bird_NOAEC_CHOICES[iter] == '3': noaec.append(float(row_inp[16])) logger.info(chemical_name) logger.info(b_species) logger.info(m_species) logger.info(bw_quail) logger.info(bw_duck) logger.info(bwb_other) logger.info(bw_rat) logger.info(bwm_other) logger.info(sol) logger.info(avian_ld50) logger.info(mammalian_ld50) logger.info(aw_bird) logger.info(mineau) logger.info(aw_mamm) logger.info(noaec_d) logger.info(noaec_q) logger.info(noaec_o) logger.info(noael) logger.info(Species_of_the_bird_NOAEC_CHOICES) sip_obj = sip_model.sip(True,True,'batch',chemical_name[iter], b_species[iter], m_species[iter], bw_quail[iter], bw_duck[iter], bwb_other[iter], bw_rat[iter], bwm_other[iter], sol[iter], avian_ld50[iter], mammalian_ld50[iter], aw_bird[iter], mineau[iter], aw_mamm[iter], noaec_d[iter], noaec_q[iter], noaec_o[iter], Species_of_the_bird_NOAEC_CHOICES[iter], noael[iter]) dose_bird_out.append(sip_obj.dose_bird_out) dose_mamm_out.append(sip_obj.dose_mamm_out) at_bird_out.append(sip_obj.at_bird_out) at_mamm_out.append(sip_obj.at_mamm_out) det_out.append(sip_obj.det_out) act_out.append(sip_obj.act_out) acute_bird_out.append(sip_obj.acute_bird_out) acuconb_out.append(sip_obj.acuconb_out) acute_mamm_out.append(sip_obj.acute_mamm_out) acuconm_out.append(sip_obj.acuconm_out) chron_bird_out.append(sip_obj.chron_bird_out) chronconb_out.append(sip_obj.chronconb_out) chron_mamm_out.append(sip_obj.chron_mamm_out) chronconm_out.append(sip_obj.chronconm_out) jid_all.append(sip_obj.jid) sip_all.append(sip_obj) if iter == 0: jid_batch.append(sip_obj.jid) batch_header = """ <div class="out_"> <br><H3>Batch Calculation of Iteration %s:</H3> </div> """%(iter + 1) out_html_temp = batch_header + sip_tables.table_all(sip_obj) out_html_all[iter]=out_html_temp