MCPcopy Index your code
hub / github.com/python/cpython / _SubTest

Class _SubTest

Lib/unittest/case.py:1595–1628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

subTestMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…