# Path: sampletester/testplan.py
# class Wrapper:
# class Environment(Wrapper):
# class Suite(Wrapper):
# class TestCase(Wrapper):
# class Visitor:
# class MultiVisitor(Visitor):
# class Manager:
#   def __init__(self):
#   def update_times(self, starting, ending):
#   def duration(self):
#   def success(self):
#   def selected(self):
#   def __init__(self, env_config, test_suites, env_filter):
#   def name(self):
#   def __init__(self, suite_config, suite_filter, case_filter):
#   def selected(self):
#   def enabled(self):
#   def setup(self):
#   def teardown(self):
#   def name(self):
#   def source(self):
#   def __repr__(self):
#   def __init__(self, test_config, case_filter):
#   def name(self):
#   def spec(self):
#   def __repr__(self):
# def passes_filter(filter: str, name: str):
#   def start_visit(self):
#   def visit_environment(self, environment: Environment, doit: bool):
#   def visit_suite(self, idx: int, suite: Suite, doit: bool):
#   def visit_testcase(self, idx: int, testcase: TestCase, doit: bool):
#   def visit_suite_end(self, idx: int, suite: Suite, doit: bool):
#   def visit_environment_end(self, environment: Environment, doit: bool):
#   def end_visit(self):
#   def __init__(self, *visitors: Visitor):
#   def start_visit(self):
#   def visit_environment(self, environment: Environment, doit: bool, visit_fns):
#   def visit_suite(self, idx: int, suite: Suite, doit: bool, visit_fns):
#   def visit_testcase(self, idx: int, testcase: TestCase, doit: bool,
#                      visit_fns):
#   def visit_suite_end(self, idx: int, suite: Suite, doit: bool, visit_fns):
#   def visit_environment_end(self, environment: Environment, doit: bool,
#                             visit_fns):
#   def end_visit(self):
#   def __init__(self, environment_registry, test_suites, env_filter:str = None):
#   def accept(self, visitor: Visitor):
# def suite_configs_from(test_docs: List[parser.Document]) -> List[object]:
# def suites_from_doc_list(test_docs: List[parser.Document],
#                          suite_filter: str = None,
#                          case_filter: str = None) -> List[Suite]:
# def suites_from(indexed_docs: parser.IndexedDocs,
#                 suite_filter: str = None,
#                 case_filter: str = None) -> List[Suite]:
# SUITE_ENABLED = "enabled"
# SUITE_SETUP = "setup"
# SUITE_TEARDOWN = "teardown"
# SUITE_NAME = "name"
# SUITE_SOURCE = "source"
# SUITE_CASES = "cases"
# CASE_NAME = "name"
# CASE_SPEC = "spec"
# SCHEMA = parser.SchemaDescriptor('test','samples', 1)


import html
from sampletester import testplan
    self.lines.append(
        '{}<testcase name="{}" failures="{}" errors="{}" timestamp="{}" time="{}">'
        .format(
            self.indent * 2,
            html.escape(
                self.environment.config.adjust_suite_name(tcase.name())),
            tcase.num_failures, tcase.num_errors, tcase.start_time.isoformat(),
            tcase.duration().total_seconds()))

    for failure in tcase.runner.get_failures():
      self.lines.append('{}<failure type="{}">'.format(
          self.indent * 3, html.escape(failure[0].lower())))
      self.lines.append('{}{}'.format(self.indent * 4, html.escape(failure[1])))
      self.lines.append('{}</failure>'.format(self.indent * 3))

    for error in tcase.runner.get_errors():
      self.lines.append('{}<error type="{}">'.format(
          self.indent * 3, html.escape(error[0].lower())))
      self.lines.append('{}{}'.format(self.indent * 4, html.escape(error[1])))
      self.lines.append('{}</error>'.format(self.indent * 3))

    self.lines.append('{}<system-out>{}\n{}</system-out>'.format(
        self.indent * 3, html.escape(tcase.runner.get_output(8)),
        self.indent * 3))

    self.lines.append(self.indent * 2 + '</testcase>')

  def visit_suite_end(self, idx, suite: testplan.Suite, doit: bool):
    if not doit or not suite.attempted:
      return

# Path: sampletester/testplan.py
# class Wrapper:
# class Environment(Wrapper):
# class Suite(Wrapper):
# class TestCase(Wrapper):
# class Visitor:
# class MultiVisitor(Visitor):
# class Manager:
#   def __init__(self):
#   def update_times(self, starting, ending):
#   def duration(self):
#   def success(self):
#   def selected(self):
#   def __init__(self, env_config, test_suites, env_filter):
#   def name(self):
#   def __init__(self, suite_config, suite_filter, case_filter):
#   def selected(self):
#   def enabled(self):
#   def setup(self):
#   def teardown(self):
#   def name(self):
#   def source(self):
#   def __repr__(self):
#   def __init__(self, test_config, case_filter):
#   def name(self):
#   def spec(self):
#   def __repr__(self):
# def passes_filter(filter: str, name: str):
#   def start_visit(self):
#   def visit_environment(self, environment: Environment, doit: bool):
#   def visit_suite(self, idx: int, suite: Suite, doit: bool):
#   def visit_testcase(self, idx: int, testcase: TestCase, doit: bool):
#   def visit_suite_end(self, idx: int, suite: Suite, doit: bool):
#   def visit_environment_end(self, environment: Environment, doit: bool):
#   def end_visit(self):
#   def __init__(self, *visitors: Visitor):
#   def start_visit(self):
#   def visit_environment(self, environment: Environment, doit: bool, visit_fns):
#   def visit_suite(self, idx: int, suite: Suite, doit: bool, visit_fns):
#   def visit_testcase(self, idx: int, testcase: TestCase, doit: bool,
#                      visit_fns):
#   def visit_suite_end(self, idx: int, suite: Suite, doit: bool, visit_fns):
#   def visit_environment_end(self, environment: Environment, doit: bool,
#                             visit_fns):
#   def end_visit(self):
#   def __init__(self, environment_registry, test_suites, env_filter:str = None):
#   def accept(self, visitor: Visitor):
# def suite_configs_from(test_docs: List[parser.Document]) -> List[object]:
# def suites_from_doc_list(test_docs: List[parser.Document],
#                          suite_filter: str = None,
#                          case_filter: str = None) -> List[Suite]:
# def suites_from(indexed_docs: parser.IndexedDocs,
#                 suite_filter: str = None,
#                 case_filter: str = None) -> List[Suite]:
# SUITE_ENABLED = "enabled"
# SUITE_SETUP = "setup"
# SUITE_TEARDOWN = "teardown"
# SUITE_NAME = "name"
# SUITE_SOURCE = "source"
# SUITE_CASES = "cases"
# CASE_NAME = "name"
# CASE_SPEC = "spec"
# SCHEMA = parser.SchemaDescriptor('test','samples', 1)


# Path: sampletester/xunit.py
import html
from sampletester import testplan

    self.lines.append(
        '{}<testcase name="{}" failures="{}" errors="{}" timestamp="{}" time="{}">'
        .format(
            self.indent * 2,
            html.escape(
                self.environment.config.adjust_suite_name(tcase.name())),
            tcase.num_failures, tcase.num_errors, tcase.start_time.isoformat(),
            tcase.duration().total_seconds()))

    for failure in tcase.runner.get_failures():
      self.lines.append('{}<failure type="{}">'.format(
          self.indent * 3, html.escape(failure[0].lower())))
      self.lines.append('{}{}'.format(self.indent * 4, html.escape(failure[1])))
      self.lines.append('{}</failure>'.format(self.indent * 3))

    for error in tcase.runner.get_errors():
      self.lines.append('{}<error type="{}">'.format(
          self.indent * 3, html.escape(error[0].lower())))
      self.lines.append('{}{}'.format(self.indent * 4, html.escape(error[1])))
      self.lines.append('{}</error>'.format(self.indent * 3))

    self.lines.append('{}<system-out>{}\n{}</system-out>'.format(
        self.indent * 3, html.escape(tcase.runner.get_output(8)),
        self.indent * 3))

    self.lines.append(self.indent * 2 + '</testcase>')

  def visit_suite_end(self, idx, suite: testplan.Suite, doit: bool):
    if not doit or not suite.attempted:
      return

    self.lines.append('{}</testsuite>'.format(self.indent))