class DT(object): def __init__(self, str_data, type="excel"): # print('__case init__') self.str_data = str_data self.logger = SkiLogger("BearSki.DataTable") self.logger.warn( "bear.base 中的方法将被废弃通过 bear.core 替代,建议将 from BearSki.base 修改为 from BearSki.core" ) self.basedata = SkiGlobalData().get_datatable_config() self.type = type def list(self): if self.type == 'excel': return self._excel_list() def json(self): if self.type == 'excel': return self._excel_list() else: return self._json_json() def _excel_list(self): title, rowdata = getRowData(self.str_data, self.basedata["db_path"]) res = generate_data(title, rowdata) self.logger.debug(u"依据索引[{0}]获取测试数据为:{1},数据源为:{2}".format( self.str_data, res, self.basedata["db_path"])) return res def _excel_json(self): title, rowdata = getRowData(self.str_data, self.basedata["db_path"]) res = generate_json_data(title, rowdata) self.logger.debug(u"依据索引[{0}]获取测试数据为:{1},数据源为:{2}".format( self.str_data, res, self.basedata["db_path"])) return res
class DT(object): def __init__(self, str_data): # print('__case init__') self.str_data = str_data self.logger = SkiLogger("BearSki.DataTable") self.basedata = SkiGlobalData().get_datatable_config() def list(self): title, rowdata = getRowData(self.str_data, self.basedata["db_path"]) res = generate_data(title, rowdata) self.logger.debug(u"依据索引[{0}]获取测试数据为:{1},数据源为:{2}".format( self.str_data, res, self.basedata["db_path"])) return res def json(self): title, rowdata = getRowData(self.str_data, self.basedata["db_path"]) res = generate_json_data(title, rowdata) self.logger.debug(u"依据索引[{0}]获取测试数据为:{1},数据源为:{2}".format( self.str_data, res, self.basedata["db_path"])) return res pass