当前位置: 首页>>代码示例>>Python>>正文


Python Parse.footnote方法代码示例

本文整理汇总了Python中fit.Parse.Parse.footnote方法的典型用法代码示例。如果您正苦于以下问题:Python Parse.footnote方法的具体用法?Python Parse.footnote怎么用?Python Parse.footnote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fit.Parse.Parse的用法示例。


在下文中一共展示了Parse.footnote方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: performTest

# 需要导入模块: from fit.Parse import Parse [as 别名]
# 或者: from fit.Parse.Parse import footnote [as 别名]
    def performTest(self, cell, runscript, page):
        if ((runscript is None or runscript == "null") or page.startswith("?")):
            self.ignore(cell)
            return
        try:
            fileName = cell.text()
            testResult = self.get(fileName)
            if testResult.find("<wiki>") >= 0:
                data = Parse(testResult, ("wiki", "td")).parts
            else:
                data = Parse(testResult, ("td",))
            c = self.count(data)
                               
            message = self.anchor("  %s/%s/%s&nbsp;" %
                                  (c.right, c.wrong, c.exceptions), fileName)

            cell.addToBody(message);
            if c.right > 0 and c.wrong == 0 and c.exceptions == 0:
                self.right(cell)
            else: 
                self.wrong(cell)
                cell.addToBody(data.footnote()); # XXX see note about footnotes.
        except Exception, e:
            if str(e).find("Can't find tag: td") >= 0:
                cell.addToBody("Can't parse <a href=\"" + testResult + "\">page</a>")
                self.ignore(cell)
            else:
                self.exception(cell, e)
开发者ID:copyleftdev,项目名称:pyfit,代码行数:30,代码来源:Tests.py

示例2: run

# 需要导入模块: from fit.Parse import Parse [as 别名]
# 或者: from fit.Parse.Parse import footnote [as 别名]
 def run(self, path, fixture, cells):
     if self.pushAndCheck(path):
         self.ignore(cells)
         self.info(cells, "recursive")
         return
     try:
         theTest = self.read(path)
         if theTest.find("<wiki>") >= 0:
             tags=["wiki", "table", "tr", "td"]
         else:
             tags=["table", "tr", "td"]
         tables = Parse(text=theTest, tags=tags)
         fixture.doTables(tables)
         self.info(cells.more, fixture.counts.toString())
         if fixture.counts.wrong == 0 and fixture.counts.exceptions == 0:
             self.right(cells.more)
         else:
             self.wrong(cells.more)
             cells.more.addToBody(tables.footnote())
     except Exception, e:
         self.exception(cells, e)
开发者ID:copyleftdev,项目名称:pyfit,代码行数:23,代码来源:AllFiles.py

示例3: ExampleTests

# 需要导入模块: from fit.Parse import Parse [as 别名]
# 或者: from fit.Parse.Parse import footnote [as 别名]
class ExampleTests(ColumnFixture):
    fileName = ""
    wiki = 0
    _typeDict = {"fileName": "String",
                 "file.renameTo": "fileName",
                 "wiki": "Boolean"}
        
    def __init__(self):
        ColumnFixture.__init__(self)
        self.fileName = ""
        self.wiki = 0
        self.input = ""
        self.tables = None
        self.fixture = None
        self.runCounts = Counts()
        self.footnote = None
        self.fileCell = None

    def run(self):
        newFileName = "fat/Documents/" + self.fileName
        inFile = open(newFileName, 'r')
        theTest = inFile.read()
        inFile.close()
        self.fixture = Fixture()
        self.footnote = None
        if self.wiki:
            self.tables = Parse(text=theTest, tags=("wiki", "table", "tr", "td"))
        else:
            self.tables = Parse(text=theTest, tags=("table", "tr", "td"))
        self.fixture.doTables(self.tables)
        self.runCounts.tally(self.fixture.counts)
        self.summary["counts run"] = self.runCounts

    _typeDict["right_"] = "Int"
    _typeDict["right.renameTo"] = "right_"
    def right_(self):
        self.run()
        return self.fixture.counts.right

    _typeDict["wrong_"] = "Int"
    _typeDict["wrong.renameTo"] = "wrong_"
    def wrong_(self):
        return self.fixture.counts.wrong

    _typeDict["ignores"] = "Int"
    def ignores(self):
        return self.fixture.counts.ignores

    _typeDict["exceptions"] = "Int"
    def exceptions(self):
        return self.fixture.counts.exceptions

    def doRow(self, row):
        self.fileCell = row.leaf()
        ColumnFixture.doRow(self, row)

    def wrong(self, cell, actual = None, escape=True):
#        super(ExampleTests, self)
        ColumnFixture.wrong(self, cell, actual = actual, escape = escape)
        if self.footnote == None:
            self.footnote = self.tables.footnote()
            self.fileCell.addToBody(self.footnote)
开发者ID:copyleftdev,项目名称:pyfit,代码行数:64,代码来源:ExampleTests.py


注:本文中的fit.Parse.Parse.footnote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。