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


Python Logger.testFailed方法代码示例

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


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

示例1: MatchFiles

# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import testFailed [as 别名]
def MatchFiles(checkerFile, c1File, targetArch, debuggableMode):
  for testCase in checkerFile.testCases:
    if testCase.testArch not in [None, targetArch]:
      continue
    if testCase.forDebuggable != debuggableMode:
      continue

    # TODO: Currently does not handle multiple occurrences of the same group
    # name, e.g. when a pass is run multiple times. It will always try to
    # match a check group against the first output group of the same name.
    c1Pass = c1File.findPass(testCase.name)
    if c1Pass is None:
      Logger.fail("Test case \"{}\" not found in the CFG file".format(testCase.name),
                  testCase.fileName, testCase.startLineNo)

    Logger.startTest(testCase.name)
    try:
      MatchTestCase(testCase, c1Pass)
      Logger.testPassed()
    except MatchFailedException as e:
      lineNo = c1Pass.startLineNo + e.lineNo
      if e.assertion.variant == TestAssertion.Variant.Not:
        msg = "NOT assertion matched line {}"
      else:
        msg = "Assertion could not be matched starting from line {}"
      msg = msg.format(lineNo)
      Logger.testFailed(msg, e.assertion, e.variables)
开发者ID:Lingcc,项目名称:AndroidArt,代码行数:29,代码来源:file.py

示例2: matchWords

# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import testFailed [as 别名]
def matchWords(checkerWord, stringWord, variables, pos):
  """ Attempts to match a list of RegexExpressions against a string.
      Returns updated variable dictionary if successful and None otherwise.
  """
  for expression in checkerWord:
    # If `expression` is a variable reference, replace it with the value.
    if expression.variant == RegexExpression.Variant.VarRef:
      if expression.name in variables:
        pattern = re.escape(variables[expression.name])
      else:
        Logger.testFailed("Missing definition of variable \"{}\"".format(expression.name),
                          pos.fileName, pos.lineNo)
    else:
      pattern = expression.pattern

    # Match the expression's regex pattern against the remainder of the word.
    # Note: re.match will succeed only if matched from the beginning.
    match = re.match(pattern, stringWord)
    if not match:
      return None

    # If `expression` was a variable definition, set the variable's value.
    if expression.variant == RegexExpression.Variant.VarDef:
      if expression.name not in variables:
        variables = variables.copyWith(expression.name, stringWord[:match.end()])
      else:
        Logger.testFailed("Multiple definitions of variable \"{}\"".format(expression.name),
                          pos.fileName, pos.lineNo)

    # Move cursor by deleting the matched characters.
    stringWord = stringWord[match.end():]

  # Make sure the entire word matched, i.e. `stringWord` is empty.
  if stringWord:
    return None

  return variables
开发者ID:AOSP-JF,项目名称:platform_art,代码行数:39,代码来源:line.py

示例3: setVariable

# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import testFailed [as 别名]
def setVariable(name, value, variables, pos):
  if name not in variables:
    return variables.copyWith(name, value)
  else:
    Logger.testFailed("Multiple definitions of variable \"{}\"".format(name), pos, variables)
开发者ID:BenzoRoms,项目名称:art,代码行数:7,代码来源:line.py

示例4: getVariable

# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import testFailed [as 别名]
def getVariable(name, variables, pos):
  if name in variables:
    return variables[name]
  else:
    Logger.testFailed("Missing definition of variable \"{}\"".format(name), pos, variables)
开发者ID:BenzoRoms,项目名称:art,代码行数:7,代码来源:line.py


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