@@ -2895,13 +2895,18 @@ msgid ""
28952895":class:`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that "
28962896"behavior by overriding :meth:`!TestSuite._removeTestAtIndex`."
28972897msgstr ""
2898+ "在较早的版本中 :class:`TestSuite` 会在 :meth:`TestSuite.run` 之后保留对每个 "
2899+ ":class:`TestCase` 的引用。 其子类可以通过重写 :meth:`!TestSuite._removeTestAtIndex` "
2900+ "来恢复此行为。"
28982901
28992902#: ../../library/unittest.rst:1758
29002903msgid ""
29012904"In the typical usage of a :class:`TestSuite` object, the :meth:`run` method "
29022905"is invoked by a :class:`!TestRunner` rather than by the end-user test "
29032906"harness."
29042907msgstr ""
2908+ "在 :class:`TestSuite` 对象的典型应用中,:meth:`run` 方法是由 :class:`!TestRunner` "
2909+ "唤起而不是由最终用户测试来控制的。"
29052910
29062911#: ../../library/unittest.rst:1763
29072912msgid "Loading and running tests"
@@ -2941,7 +2946,7 @@ msgstr ":class:`TestLoader` 对象具有下列方法:"
29412946msgid ""
29422947"Return a suite of all test cases contained in the :class:`TestCase`\\ "
29432948"-derived :class:`!testCaseClass`."
2944- msgstr ""
2949+ msgstr "返回一个包含在 :class:`TestCase` 所派生的 :class:`!testCaseClass` 中的所有测试用例的测试套件。 "
29452950
29462951#: ../../library/unittest.rst:1795
29472952msgid ""
@@ -2951,6 +2956,9 @@ msgid ""
29512956":meth:`!runTest` method is implemented, a single test case is created for "
29522957"that method instead."
29532958msgstr ""
2959+ "测试用例实例将针对由 :meth:`getTestCaseNames` 所指定的每个方法进行创建。 在默认情况下这些方法名称将以 ``test`` "
2960+ "开头。 如果 :meth:`getTestCaseNames` 不返回任何方法,但 :meth:`!runTest` "
2961+ "方法已被实现,则会为该方法创建一个单独的测试用例。"
29542962
29552963#: ../../library/unittest.rst:1804
29562964msgid ""
@@ -3027,6 +3035,11 @@ msgid ""
30273035"can refer to modules and packages which have not been imported; they will be"
30283036" imported as a side-effect."
30293037msgstr ""
3038+ "举例来说,如果你有一个模块 :mod:`!SampleTests` 其中包含一个派生自 :class:`TestCase` 的类 "
3039+ ":class:`!SampleTestCase`,它带有三个测试方法 (:meth:`!test_one`, :meth:`!test_two` 和 "
3040+ ":meth:`!test_three`),则指定 ``'SampleTests.SampleTestCase'`` "
3041+ "将使此方法返回一个将运行全部三个测试方法的测试套件。 指定 ``'SampleTests.SampleTestCase.test_two'`` "
3042+ "将使它返回一个仅运行 :meth:`!test_two` 测试方法的测试套件。 可以指定尚未被导入的模块和包;它们将作为附带影响被导入。"
30303043
30313044#: ../../library/unittest.rst:1855
30323045msgid "The method optionally resolves *name* relative to the given *module*."
@@ -3237,6 +3250,8 @@ msgid ""
32373250" purposes; a :class:`TestResult` instance is returned by the "
32383251":meth:`!TestRunner.run` method for this purpose."
32393252msgstr ""
3253+ "建立在 :mod:`unittest` 之上的测试框架可能会想要访问通过一组测试所产生的 :class:`TestResult` "
3254+ "对象用于报告信息;:class:`TestResult` 实例是由 :meth:`!TestRunner.run` 方法出于这个目的而返回的。"
32403255
32413256#: ../../library/unittest.rst:2000
32423257msgid ""
@@ -3340,6 +3355,8 @@ msgid ""
33403355":class:`!TestRunner` objects should respect this flag and return without "
33413356"running any additional tests."
33423357msgstr ""
3358+ "此方法可被调用以提示正在运行的测试集要将 :attr:`shouldStop` 属性设为 ``True`` 来表示其应当被中止。 "
3359+ ":class:`!TestRunner` 对象应当遵守此旗标并返回而不再运行任何额外的测试。"
33433360
33443361#: ../../library/unittest.rst:2087
33453362msgid ""
0 commit comments