def testBuildListWithMissingTypeAdapter(self): nameList = ["fie", "fi", "fo", "fiddly"] objList = [] obj = DisplayUtility(objList, nameList, self.typeDict) headers = obj.buildHeaderRow(nameList).parts taList = obj.buildTypeAdapterList(nameList, self.typeDict, headers) assert taList[3] is False
def testBuildTypeAdapterList(self): objList = [] obj = DisplayUtility(objList, self.nameList, self.typeDict) headers = obj.buildHeaderRow(self.nameList).parts taList = obj.buildTypeAdapterList(self.nameList, self.typeDict, headers) assert taList[0].parse("1") == 1 assert taList[2].toString(True) == "True"
def testBuildHeaderRow(self): objList = [] typeDict = {} obj = DisplayUtility(objList, self.nameList, typeDict) row = obj.buildHeaderRow(self.nameList) assert row.parts.size() == 4 assert row.tag == "<tr>" assert row.parts.more.more.body == "fo"
def testBuildRowFromObject(self): __pychecker__ = "maxrefs=10" obj = DisplayUtility(self.objList, self.nameList, self.typeDict) headers = obj.buildHeaderRow(self.nameList).parts taList = obj.buildTypeAdapterList(self.nameList, self.typeDict, headers) row = obj.buildRow(self.theObject, self.nameList, taList, headers) assert row.parts.size() == 4 assert row.parts.tag == "<td>" assert row.parts.more.more.body == "False"
def testBuildRowWithMissingAttribute(self): __pychecker__ = "maxrefs=10" obj = DisplayUtility(self.objList4, self.nameList, self.typeDict) headers = obj.buildHeaderRow(self.nameList).parts taList = obj.buildTypeAdapterList(self.nameList, self.typeDict, headers) row = obj.buildRow(self.theObject4, self.nameList, taList, headers) assert row.parts.size() == 4 assert row.parts.more.more.more.body.find("[not found]") > -1 assert row.parts.more.more.more.tag.find("fit_ignore") > -1
def testDoTableWithTwoDictionaries(self): __pychecker__ = "maxrefs=10" obj = DisplayUtility(self.dictList5, self.nameList, self.typeDict) aTable = Parse(tag="table") obj.doTable(aTable) row1 = aTable.parts row2 = row1.more row3 = row2.more assert row3.more is None assert row1.parts.body == "fie" assert row3.parts.more.more.more.body == "2.0"
def testBuildRowWithMissingTypeAdapterAndNoStr(self): __pychecker__ = "maxrefs=10" obj = DisplayUtility(self.objList2, self.nameList, self.shortTypeDict) headers = obj.buildHeaderRow(self.nameList).parts taList = obj.buildTypeAdapterList(self.nameList, self.shortTypeDict, headers) row = obj.buildRow(self.theObject2, self.nameList, taList, headers) assert row.parts.size() == 4 assert row.parts.more.more.more.body == "[cannot display]" assert headers.more.more.more.body.find("Metadata missing") > -1 assert headers.more.more.more.tag.find("fit_fail") > -1 assert row.parts.more.more.more.tag.find("fit_fail") > -1
def testDoTableHeaderRow(self): obj = DisplayUtility(self.objList, self.nameList, self.typeDict) aTable = Parse(tag="table") obj.doTable(aTable) assert aTable.parts.parts.body == "fie"
def testInstantiation(self): objList = [] obj = DisplayUtility(objList, self.nameList, self.typeDict) assert obj.objList == objList assert obj.nameList == self.nameList assert obj._typeDict == self.typeDict