Helpers for tests for cores. 2010-12-01T14:00:00 testing Test Fixtures test ignore 10.5072/test-fixture 2.3.1pl2+git_deadbeef Gandalf, W.; Baggins, B.; Baggins, F. 20 Some Table Some Service A mirror http://just.any.old.url \internallink{foo/bar/baz}
a,b,c,d,e import tempfile from gavo import rsc, formats sourceTable = rsc.TableForDef( inputTable.inputTD.rd.getById("abcd"), rows=[inputTable.args]) with tempfile.NamedTemporaryFile(mode="wb+") as f: formats.formatData("tsv", sourceTable, f) f.seek(0) return rsc.makeData( inputTable.inputTD.rd.getById("parse_text_table"), forceSource=f.name).getPrimaryTable() moreExamples: convcat moreExamples.title: More from conv moreExamples: data/ssatest#s # fall through to default title moreExamples:http://ivoa.net/doc/obscore/tap-examples.xhtml moreExamples.title:More external really ignore -100 .. 100rvkey .rvkey { background:red; } localstuff -30 Wonz compact Hollow Datalink Hollow DL from gavo import svcs from gavo.protocols import soda if pubDID=="broken": ddt elif pubDID=="somewhereelse": raise svcs.WebRedirect("http://some.whereel.se/there") return getFITSDescriptor(pubDID) {3: {}} This is an example for examples, describing :dl-id:`ivo://org.gavo.dc/~?bla/foo/qua` (which, incidentally, does not exist). This is another example for examples. POSITION FK5 J1990 Epoch J1985.7 "ra" "dec"
for id, (ra, dec) in enumerate([(1.25, 2.5), (23, -92.5)]): yield locals() 10 20 1 test ignore 1/10 54444 55555 56083 56087 0.3e-19 1e-18 1e-17 5e-17 This will crash availability for testing. True data PC datalink PC datalink powers = inputTable.args["powers"] op = complex(inputTable.args["opre"], inputTable.args["opim"]) rows = [] for p in powers: val = op**p rows.append({ "re": val.real, "im": val.imag, "log_value": cmath.log(val).real}) if hasattr(inputTable, "job"): with inputTable.job.getWritable() as wjob: wjob.addResult("Hello World.\\n", "text/plain", "aux.txt") t = rsc.TableForDef(self.outputTable, rows=rows) t.addMeta("info", str(inputTable.args["opim"]), infoName="inpar", infoValue="opim") return t custom core tester does-not-exist.testing x return None
True sing mainarg http://supersmart.edu/singlearg item = inputTable.args["mainarg"] if item=="fail hard": ddt queryMeta["Matched"] = inputTable.args["otherarg"] return rsc.TableForDef(self.outputTable, rows=[{"ct": rowInd+1, "val": item*(rowInd+1)} for rowInd in range(inputTable.args["otherarg"])]) return ProductDescriptor(pubDID, pubDID, None, "vnd/x-bogus") for i in range(10): yield descriptor.makeLink("http://%s.example.org/" +descriptor.pubDID) Brains! Brains! Brains_! .. _Brains: https://en.wikipedia.org/wiki/George_A._Romero A descriptor generator producing some FITS header structure. This has a few built-in defaults; the id is a urlencoded extra header cards. def perhapsFloat(v): try: num = float(v) if num-int(num)==0: return int(num) else: return num except ValueError: return v class PD(datalink.DatalinkDescriptorMixin): def __init__(self, extraCards): self.pubDID = extraCards self.accref = f"testing {extraCards}" self.accessPath = f"Forget/it" self.mime = "application/fits" self.imageExtind = 0 self.hdr = { "CRVAL1": 0, "CRVAL2": 0, "CRPIX1": 50, "CRPIX2": 50, "CD1_1": 0.01, "CD1_2": 0, "CD2_1": 0, "CD2_2": 0.01, "NAXIS1": 100, "NAXIS2": 100, "CUNIT1": "deg", "CUNIT2": "deg", "CTYPE1": 'RA--TAN', "CTYPE2": 'DEC-TAN', "LONPOLE": 180., "NAXIS": 2, } self.hdr.update(dict((k, perhapsFloat(v[0])) for k, v in urllib.parse.parse_qs(extraCards).items())) self.slices = [] self.data = ["This is test instrumentation"] def changingAxis(self, axisIndex, parName): pass return PD(pubDID) return "text/plain", " ".join(str(v) for v in descriptor.slices)