def setUp(self): ''' Sets up the testing environment ''' self.log = logger(loglevel = "info", cmdline = True).getLogger() self.jc = jsonCreator(logger = self.log) self.jc.addUnits("cm") self.jc.addScale(2.,3.) self.jc.addContours([(5,3),(4,6)]) self.jc.addContours([[(2,3)], [(2,6),(4,8)]])
def export_json(contours, xscale, yscale, units): """ Export the contours to JSON Args: contours: xscale: yscale: units: Returns: True on success, False on failure """ jsonData = jsonCreator() jsonData.addUnits(units) jsonData.addContours(contours) jsonData.addScale(xscale, yscale) return jsonData.exportJson()