def testCtor(self): self.r = cs.SCSResults(self.tbl) self.assertEquals(self.r.protocol, "scs") self.assertEquals(self.r.version, "1.0") self.assert_(isinstance(self.r._fldnames, list)) self.assert_(self.r.votable is not None) self.assertEquals(self.r.nrecs, 2)
def testErrorResourceInfo(self): resultfile = get_pkg_data_filename("data/error3-cs.xml") self.tbl = votableparse(resultfile) try: res = cs.SCSResults(self.tbl) self.fail("Failed to detect error response") except dalq.DALQueryError as ex: self.assertEquals(ex.label, "Error") self.assertEquals(ex.reason, "Forced Fail")
def testErrorParam(self): resultfile = get_pkg_data_filename("data/error2-cs.xml") self.tbl = votableparse(resultfile) try: res = cs.SCSResults(self.tbl) self.fail("Failed to detect error response") except dalq.DALQueryError as ex: self.assertEquals(ex.label, "Error") # Note: because it is stored in a PARAM and the datatype is "char", # the value will come out as bytes (rather than unicode) self.assertEquals(ex.reason, b"DEC parameter out-of-range")
def setUp(self): resultfile = get_pkg_data_filename(csresultfile) self.tbl = votableparse(resultfile) self.result = cs.SCSResults(self.tbl) self.rec = self.result.getrecord(0)