MCPcopy Index your code
hub / github.com/RustPython/RustPython / _SubTest

Class _SubTest

Lib/unittest/case.py:1600–1633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1598
1599
1600class _SubTest(TestCase):
1601
1602 def __init__(self, test_case, message, params):
1603 super().__init__()
1604 self._message = message
1605 self.test_case = test_case
1606 self.params = params
1607 self.failureException = test_case.failureException
1608
1609 def runTest(self):
1610 raise NotImplementedError("subtests cannot be run directly")
1611
1612 def _subDescription(self):
1613 parts = []
1614 if self._message is not _subtest_msg_sentinel:
1615 parts.append("[{}]".format(self._message))
1616 if self.params:
1617 params_desc = ', '.join(
1618 "{}={!r}".format(k, v)
1619 for (k, v) in self.params.items())
1620 parts.append("({})".format(params_desc))
1621 return " ".join(parts) or '(<subtest>)'
1622
1623 def id(self):
1624 return "{} {}".format(self.test_case.id(), self._subDescription())
1625
1626 def shortDescription(self):
1627 """Returns a one-line description of the subtest, or None if no
1628 description has been provided.
1629 """
1630 return self.test_case.shortDescription()
1631
1632 def __str__(self):
1633 return "{} {}".format(self.test_case, self._subDescription())

Callers 1

subTestMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected