@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version :Python 3.13\n "
1313"Report-Msgid-Bugs-To :\n "
14- "POT-Creation-Date :2025-09-03 15:14 +0000\n "
14+ "POT-Creation-Date :2025-11-23 14:59 +0000\n "
1515"PO-Revision-Date :2025-09-15 01:05+0000\n "
1616"Last-Translator :python-doc bot, 2025\n "
1717"Language-Team :Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -814,12 +814,9 @@ msgid ""
814814"Such a working environment for the testing code is called a :dfn:`test "
815815"fixture`. A new TestCase instance is created as a unique test fixture used "
816816"to execute each individual test method. Thus :meth:`~TestCase.setUp`, "
817- ":meth:`~TestCase.tearDown`, and :meth:`~ TestCase.__init__` will be called "
817+ ":meth:`~TestCase.tearDown`, and :meth:`! TestCase.__init__` will be called "
818818"once per test."
819819msgstr ""
820- "这样的一个测试代码运行的环境被称为 :dfn:`test fixture` 。一个新的 TestCase "
821- "实例作为一个测试脚手架,用于运行各个独立的测试方法。在运行每个测试时,:meth:`~TestCase.setUp` "
822- "、:meth:`~TestCase.tearDown` 和 :meth:`~TestCase.__init__` 会被调用一次。"
823820
824821#: ../../library/unittest.rst:449
825822msgid ""
@@ -974,13 +971,10 @@ msgstr ""
974971msgid ""
975972"In some cases, the existing tests may have been written using the "
976973":mod:`doctest` module. If so, :mod:`doctest` provides a "
977- ":class:`DocTestSuite` class that can automatically build "
974+ ":class:`~doctest. DocTestSuite` class that can automatically build "
978975":class:`unittest.TestSuite` instances from the existing :mod:`doctest`\\ "
979976"-based tests."
980977msgstr ""
981- "在某些情况下,现有的测试可能是用 :mod:`doctest` 模块编写的。 如果是这样, :mod:`doctest` 提供了一个 "
982- ":class:`DocTestSuite` 类,可以从现有基于 :mod:`doctest` 的测试中自动构建 "
983- ":class:`unittest.TestSuite` 用例。"
984978
985979#: ../../library/unittest.rst:534
986980msgid "Skipping tests and expected failures"
@@ -1838,9 +1832,9 @@ msgstr "当被作为上下文管理器使用时,:meth:`assertRaises` 接受额
18381832#: ../../library/unittest.rst:1015
18391833msgid ""
18401834"The context manager will store the caught exception object in its "
1841- ":attr:`exception` attribute. This can be useful if the intention is to "
1835+ ":attr:`! exception` attribute. This can be useful if the intention is to "
18421836"perform additional checks on the exception raised::"
1843- msgstr "上下文管理器将把捕获的异常对象存入在其 :attr:`exception` 属性中。 这适用于需要对所引发异常执行额外检查的场合:: "
1837+ msgstr ""
18441838
18451839#: ../../library/unittest.rst:1019
18461840msgid ""
@@ -1861,8 +1855,8 @@ msgid "Added the ability to use :meth:`assertRaises` as a context manager."
18611855msgstr "添加了将 :meth:`assertRaises` 用作上下文管理器的功能。"
18621856
18631857#: ../../library/unittest.rst:1028
1864- msgid "Added the :attr:`exception` attribute."
1865- msgstr "增加了 :attr:`exception` 属性。 "
1858+ msgid "Added the :attr:`! exception` attribute."
1859+ msgstr ""
18661860
18671861#: ../../library/unittest.rst:1031 ../../library/unittest.rst:1057
18681862#: ../../library/unittest.rst:1098 ../../library/unittest.rst:1121
@@ -1943,12 +1937,10 @@ msgstr "当被作为上下文管理器使用时,:meth:`assertWarns` 接受额
19431937#: ../../library/unittest.rst:1081
19441938msgid ""
19451939"The context manager will store the caught warning object in its "
1946- ":attr:`warning` attribute, and the source line which triggered the warnings "
1947- "in the :attr:`filename` and :attr:`lineno` attributes. This can be useful if "
1948- " the intention is to perform additional checks on the warning caught::"
1940+ ":attr:`! warning` attribute, and the source line which triggered the warnings"
1941+ " in the :attr:`! filename` and :attr:`! lineno` attributes. This can be useful"
1942+ "if the intention is to perform additional checks on the warning caught::"
19491943msgstr ""
1950- "上下文管理器将把捕获的警告对象保存在其 :attr:`warning` 属性中,并把触发警告的源代码行保存在 :attr:`filename` 和 "
1951- ":attr:`lineno` 属性中。 这适用于需要对捕获的警告执行额外检查的场合::"
19521944
19531945#: ../../library/unittest.rst:1087
19541946msgid ""
@@ -2388,8 +2380,8 @@ msgstr ""
23882380#: ../../library/unittest.rst:1377
23892381msgid ""
23902382"Fails if either of *first* or *second* does not have a "
2391- ":meth:`set .difference` method."
2392- msgstr "如果 *first* 或 *second* 没有 :meth:`set.difference` 方法则测试失败。 "
2383+ ":meth:`~frozenset .difference` method."
2384+ msgstr ""
23932385
23942386#: ../../library/unittest.rst:1385
23952387msgid ""
@@ -2634,31 +2626,24 @@ msgstr ""
26342626#: ../../library/unittest.rst:1585
26352627msgid ""
26362628"Method called to prepare the test fixture. This is called after "
2637- ":meth:`setUp`. This is called immediately before calling the test method; "
2638- "other than :exc:`AssertionError` or :exc:`SkipTest`, any exceptionraised by "
2639- " this method will be considered an error rather than a test failure. The "
2640- "default implementation does nothing."
2629+ ":meth:`TestCase. setUp`. This is called immediately before calling the test "
2630+ "method; other than :exc:`AssertionError` or :exc:`SkipTest`, any exception "
2631+ "raised by this method will be considered an error rather than a test "
2632+ "failure. The default implementation does nothing."
26412633msgstr ""
2642- "为测试预备而调用的方法。 此方法会在 :meth:`setUp` 之后被调用。 此方法将在调用测试方法之前立即被调用;除了 "
2643- ":exc:`AssertionError` 或 :exc:`SkipTest`,此方法所引发的任何异常都将被视为错误而非测试失败。 "
2644- "默认的实现将不做任何事情。"
26452634
26462635#: ../../library/unittest.rst:1594
26472636msgid ""
26482637"Method called immediately after the test method has been called and the "
2649- "result recorded. This is called before :meth:`tearDown`. This is called "
2650- "even if the test method raised an exception, so the implementation in "
2651- "subclasses may need to be particularly careful about checking internal "
2638+ "result recorded. This is called before :meth:`~TestCase. tearDown`. This is "
2639+ "called even if the test method raised an exception, so the implementation in"
2640+ " subclasses may need to be particularly careful about checking internal "
26522641"state. Any exception, other than :exc:`AssertionError` or :exc:`SkipTest`, "
26532642"raised by this method will be considered an additional error rather than a "
26542643"test failure (thus increasing the total number of reported errors). This "
26552644"method will only be called if the :meth:`asyncSetUp` succeeds, regardless of"
26562645" the outcome of the test method. The default implementation does nothing."
26572646msgstr ""
2658- "在测试方法被调用并记录结果之后立即被调用的方法。 此方法会在 :meth:`tearDown` 之前被调用。 "
2659- "此方法即使在测试方法引发异常时仍会被调用,因此子类中的实现将需要特别注意检查内部状态。 除 :exc:`AssertionError` 或 "
2660- ":exc:`SkipTest` 外,此方法所引发的任何异常都将被视为额外的错误而非测试失败(因而会增加总计错误报告数)。 此方法将只在 "
2661- ":meth:`asyncSetUp` 成功执行时被调用,无论测试方法的结果如何。 默认的实现将不做任何事情。"
26622647
26632648#: ../../library/unittest.rst:1606
26642649msgid ""
@@ -2681,13 +2666,10 @@ msgid ""
26812666"Sets up a new event loop to run the test, collecting the result into the "
26822667":class:`TestResult` object passed as *result*. If *result* is omitted or "
26832668"``None``, a temporary result object is created (by calling the "
2684- ":meth:`defaultTestResult` method) and used. The result object isreturned to "
2685- " :meth:`run`'s caller. At the end of the test all the tasks in the event "
2686- "loop are cancelled."
2669+ ":meth:`~TestCase. defaultTestResult` method) and used. The result object is "
2670+ "returned to :meth:`run`'s caller. At the end of the test all the tasks in "
2671+ "the event loop are cancelled."
26872672msgstr ""
2688- "设置一个新的事件循环来运行测试,将结果收集至作为 *result* 传入的 :class:`TestResult`。 如果 *result* 被省略或为"
2689- " ``None``,则会创建一个临时的结果对象(通过调用 :meth:`defaultTestResult` 方法)并使用它。 结果对象会被返回给 "
2690- ":meth:`run` 的调用方。 在测试结束时事件循环中的所有任务都将被取消。"
26912673
26922674#: ../../library/unittest.rst:1629
26932675msgid "An example illustrating the order::"
@@ -2871,13 +2853,8 @@ msgid ""
28712853"repeated iterations before :meth:`TestSuite.run` must be the same for each "
28722854"call iteration. After :meth:`TestSuite.run`, callers should not rely on the "
28732855"tests returned by this method unless the caller uses a subclass that "
2874- "overrides :meth:`TestSuite._removeTestAtIndex` to preserve test references."
2856+ "overrides :meth:`! TestSuite._removeTestAtIndex` to preserve test references."
28752857msgstr ""
2876- "由 :class:`TestSuite` 分组的测试总是可以通过迭代来访问。 其子类可以通过重载 :meth:`!__iter__` 来惰性地提供测试。"
2877- " 请注意此方法可在单个套件上多次被调用(例如在计数或相等性比较时),为此在 :meth:`TestSuite.run` "
2878- "之前重复迭代所返回的测试对于每次调用迭代都必须相同。 在 :meth:`TestSuite.run` "
2879- "之后,调用方不应继续访问此方法所返回的测试,除非调用方使用重载了 :meth:`TestSuite._removeTestAtIndex` "
2880- "的子类来保留对测试的引用。"
28812858
28822859#: ../../library/unittest.rst:1748
28832860msgid ""
@@ -2892,20 +2869,15 @@ msgstr ""
28922869msgid ""
28932870"In earlier versions the :class:`TestSuite` held references to each "
28942871":class:`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that "
2895- "behavior by overriding :meth:`TestSuite._removeTestAtIndex`."
2872+ "behavior by overriding :meth:`! TestSuite._removeTestAtIndex`."
28962873msgstr ""
2897- "在较早的版本中 :class:`TestSuite` 会在 :meth:`TestSuite.run` 之后保留对每个 "
2898- ":class:`TestCase` 的引用。 其子类可以通过重载 :meth:`TestSuite._removeTestAtIndex` "
2899- "来恢复此行为。"
29002874
29012875#: ../../library/unittest.rst:1758
29022876msgid ""
29032877"In the typical usage of a :class:`TestSuite` object, the :meth:`run` method "
2904- "is invoked by a :class:`TestRunner` rather than by the end-user test "
2878+ "is invoked by a :class:`! TestRunner` rather than by the end-user test "
29052879"harness."
29062880msgstr ""
2907- "在 :class:`TestSuite` 对象的典型应用中,:meth:`run` 方法是由 :class:`TestRunner` "
2908- "唤起而不是由最终用户测试来控制。"
29092881
29102882#: ../../library/unittest.rst:1763
29112883msgid "Loading and running tests"
@@ -2944,20 +2916,17 @@ msgstr ":class:`TestLoader` 对象具有下列方法:"
29442916#: ../../library/unittest.rst:1792
29452917msgid ""
29462918"Return a suite of all test cases contained in the :class:`TestCase`\\ "
2947- "-derived :class:`testCaseClass`."
2948- msgstr "返回一个包含在 :class:`TestCase` 所派生的 :class:`testCaseClass` 中的所有测试用例的测试套件。 "
2919+ "-derived :class:`! testCaseClass`."
2920+ msgstr ""
29492921
29502922#: ../../library/unittest.rst:1795
29512923msgid ""
29522924"A test case instance is created for each method named by "
29532925":meth:`getTestCaseNames`. By default these are the method names beginning "
29542926"with ``test``. If :meth:`getTestCaseNames` returns no methods, but the "
2955- ":meth:`runTest` method is implemented, a single test case is created for "
2927+ ":meth:`! runTest` method is implemented, a single test case is created for "
29562928"that method instead."
29572929msgstr ""
2958- "会为每个由 :meth:`getTestCaseNames` 指明的方法创建一个测试用例实例。 在默认情况下这些都是以 ``test`` "
2959- "开头的方法名称。 如果 :meth:`getTestCaseNames` 不返回任何方法,但 :meth:`runTest` "
2960- "方法已被实现,则会为该方法创建一个单独的测试用例。"
29612930
29622931#: ../../library/unittest.rst:1804
29632932msgid ""
@@ -3024,21 +2993,16 @@ msgstr ""
30242993
30252994#: ../../library/unittest.rst:1845
30262995msgid ""
3027- "For example, if you have a module :mod:`SampleTests` containing a "
3028- ":class:`TestCase`\\ -derived class :class:`SampleTestCase` with three test "
3029- "methods (:meth:`test_one`, :meth:`test_two`, and :meth:`test_three`), the "
3030- "specifier ``'SampleTests.SampleTestCase'`` would cause this method toreturn "
3031- " a suite which will run all three test methods. Using the specifier "
2996+ "For example, if you have a module :mod:`! SampleTests` containing a "
2997+ ":class:`TestCase`\\ -derived class :class:`! SampleTestCase` with three test "
2998+ "methods (:meth:`! test_one`, :meth:`! test_two`, and :meth:`! test_three`), the"
2999+ " specifier ``'SampleTests.SampleTestCase'`` would cause this method to "
3000+ "return a suite which will run all three test methods. Using the specifier "
30323001"``'SampleTests.SampleTestCase.test_two'`` would cause it to return a test "
3033- "suite which will run only the :meth:`test_two` test method. The specifier "
3002+ "suite which will run only the :meth:`! test_two` test method. The specifier "
30343003"can refer to modules and packages which have not been imported; they will be"
30353004" imported as a side-effect."
30363005msgstr ""
3037- "举例来说,如果你有一个模块 :mod:`SampleTests`,其中包含一个派生自 :class:`TestCase` 的类 "
3038- ":class:`SampleTestCase`,其中包含三个测试方法 (:meth:`test_one`, :meth:`test_two` 和 "
3039- ":meth:`test_three`)。 则描述名称 ``'SampleTests.SampleTestCase'`` "
3040- "将使此方法返回一个测试套件,它将运行全部三个测试方法。 使用描述名称 ``'SampleTests.SampleTestCase.test_two'``"
3041- " 将使它返回一个测试套件,它将仅运行 :meth:`test_two` 测试方法。 描述名称可以指向尚未被导入的模块和包;它们将作为附带影响被导入。"
30423006
30433007#: ../../library/unittest.rst:1855
30443008msgid "The method optionally resolves *name* relative to the given *module*."
@@ -3247,10 +3211,8 @@ msgid ""
32473211"Testing frameworks built on top of :mod:`unittest` may want access to the "
32483212":class:`TestResult` object generated by running a set of tests for reporting"
32493213" purposes; a :class:`TestResult` instance is returned by the "
3250- ":meth:`TestRunner.run` method for this purpose."
3214+ ":meth:`! TestRunner.run` method for this purpose."
32513215msgstr ""
3252- "建立在 :mod:`unittest` 之上的测试框架可能会想要访问通过运行一组测试所产生的 :class:`TestResult` "
3253- "对象用来报告信息;:meth:`TestRunner.run` 方法是出于这个目的而返回 :class:`TestResult` 实例的。"
32543216
32553217#: ../../library/unittest.rst:2000
32563218msgid ""
@@ -3351,21 +3313,17 @@ msgstr ""
33513313msgid ""
33523314"This method can be called to signal that the set of tests being run should "
33533315"be aborted by setting the :attr:`shouldStop` attribute to ``True``. "
3354- ":class:`TestRunner` objects should respect this flag and return without "
3316+ ":class:`! TestRunner` objects should respect this flag and return without "
33553317"running any additional tests."
33563318msgstr ""
3357- "此方法可被调用以提示正在运行的测试集要将 :attr:`shouldStop` 属性设为 ``True`` 来表示其应当被中止。 "
3358- ":class:`TestRunner` 对象应当认同此旗标并返回而不再运行任何额外的测试。"
33593319
33603320#: ../../library/unittest.rst:2087
33613321msgid ""
33623322"For example, this feature is used by the :class:`TextTestRunner` class to "
33633323"stop the test framework when the user signals an interrupt from the "
3364- "keyboard. Interactive tools which provide :class:`TestRunner` "
3324+ "keyboard. Interactive tools which provide :class:`! TestRunner` "
33653325"implementations can use this in a similar manner."
33663326msgstr ""
3367- "例如,该特性会被 :class:`TextTestRunner` 类用来在当用户从键盘发出一个中断信号时停止测试框架。 提供了 "
3368- ":class:`TestRunner` 实现的交互式工具也可通过类似方式来使用该特性。"
33693327
33703328#: ../../library/unittest.rst:2092
33713329msgid ""
@@ -3868,12 +3826,10 @@ msgstr "类与模块设定"
38683826#: ../../library/unittest.rst:2408
38693827msgid ""
38703828"Class and module level fixtures are implemented in :class:`TestSuite`. When "
3871- "the test suite encounters a test from a new class then:meth:`tearDownClass` "
3872- " from the previous class (if there is one) is called, followed by "
3873- ":meth:`setUpClass` from the new class."
3829+ "the test suite encounters a test from a new class then "
3830+ ":meth:`~TestCase.tearDownClass` from the previous class (if there is one) is"
3831+ " called, followed by :meth:`~TestCase. setUpClass` from the new class."
38743832msgstr ""
3875- "类与模块设定是在 :class:`TestSuite` 中实现的。 当测试套件遇到来自新类的测试时则来自之前的类(如果存在)的 "
3876- ":meth:`tearDownClass` 会被调用,然后再调用来自新类的 :meth:`setUpClass`。"
38773833
38783834#: ../../library/unittest.rst:2413
38793835msgid ""