def test_02(self): """Test_retHtmlFileName.test_02(): retHtmlFileLink() - basic functionality.""" self.assertEqual('_85815d8fcaf4100c893e42ecf798ee68.html#4', HtmlUtils.retHtmlFileLink('', 4)) self.assertEqual('foo.lis_a2264fb27d01482d85fb07d540d99d29.html#4', HtmlUtils.retHtmlFileLink('foo.lis', 4)) myPathStr = 'a very long path that goes on and on and on and you think that it will never ever stop spam.lis' myPath = os.path.join(*myPathStr.split()) self.assertEqual('a/very/long/path/that/goes/on/and/on/and/on/and/you/think/that/it/will/never/ever/stop/spam.lis', myPath) self.assertEqual( 'spam.lis_eb53aeb1072ab90b9ba0304c5e2b6fd9.html#4', HtmlUtils.retHtmlFileLink(myPath, 4), )
def test_02(self): """Test_retHtmlFileName.test_02(): retHtmlFileLink() - basic functionality.""" self.assertEqual('_5058f1af8388633f609cadb75a75dc9d.html#4', HtmlUtils.retHtmlFileLink('', 4)) self.assertEqual('foo.lis_7cc7c6edbd4c065f2406358e9211d9eb.html#4', HtmlUtils.retHtmlFileLink('foo.lis', 4)) myPathStr = 'a very long path that goes on and on and on and you think that it will never ever stop spam.lis' myPath = os.path.join(*myPathStr.split()) self.assertEqual( 'a/very/long/path/that/goes/on/and/on/and/on/and/you/think/that/it/will/never/ever/stop/spam.lis', myPath) self.assertEqual( 'spam.lis_899456b1d7f9e35f3f5338b5883ae262.html#4', HtmlUtils.retHtmlFileLink(myPath, 4), )
def _writeMacroReferencesTable(theS, theFlcS): """Writes all the references to a file/line/col in a rowspan/colspan HTML table with links to the position in the HTML representation of the file that references something. This uses a particular design pattern that uses a DictTree to sort out the rows and columns. In this case the DictTree values are lists of pairs (href, nav_text) where nav_text is the line-col of the referencing file.""" myFileLineColS = [] # This removes duplicates, it is a list of (fileId, lineNum, colNum). # If an include file is included N times there will be N-1 duplicate entries # for the header guard macro otherwise. hasSeen = [] for aFlc in theFlcS: ident = (aFlc.fileId, aFlc.lineNum, aFlc.colNum) if ident not in hasSeen: myFileLineColS.append(( aFlc.fileId, ( HtmlUtils.retHtmlFileLink(aFlc.fileId, aFlc.lineNum), # Navigation text '%d-%d' % (aFlc.lineNum, aFlc.colNum), ), )) hasSeen.append(ident) if len(myFileLineColS) > 0: HtmlUtils.writeFilePathsAsTable('list', theS, myFileLineColS, 'filetable', _tdFilePathCallback)