@@ -2450,7 +2450,7 @@ msgstr ""
24502450
24512451#: ../../library/unittest.rst:1794
24522452msgid "The method optionally resolves *name* relative to the given *module*."
2453- msgstr ""
2453+ msgstr "本模块可以选择相对于给定的 *module* 来解析 *name*。 "
24542454
24552455#: ../../library/unittest.rst:1796
24562456msgid ""
@@ -2459,19 +2459,23 @@ msgid ""
24592459"returned. These errors are included in the errors accumulated by "
24602460"self.errors."
24612461msgstr ""
2462+ "如果在遍历 *name* 时发生了 :exc:`ImportError` 或 :exc:`AttributeError` "
2463+ "则在运行时引发该错误的合成测试将被返回。 这些错误被包括在由 self.errors 所积累的错误中。"
24622464
24632465#: ../../library/unittest.rst:1805
24642466msgid ""
24652467"Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather "
24662468"than a single name. The return value is a test suite which supports all the"
24672469" tests defined for each name."
24682470msgstr ""
2471+ "类似于 :meth:`loadTestsFromName`,但是接受一个名称序列而不是单个名称。 "
2472+ "返回值是一个测试套件,它支持为每个名称所定义的所有测试。"
24692473
24702474#: ../../library/unittest.rst:1812
24712475msgid ""
24722476"Return a sorted sequence of method names found within *testCaseClass*; this "
24732477"should be a subclass of :class:`TestCase`."
2474- msgstr ""
2478+ msgstr "返回由 *testCaseClass* 中找到的方法名称组成的已排序的序列;这应当是 :class:`TestCase` 的一个子类。 "
24752479
24762480#: ../../library/unittest.rst:1818
24772481msgid ""
@@ -2481,13 +2485,15 @@ msgid ""
24812485"pattern matching.) Only module names that are importable (i.e. are valid "
24822486"Python identifiers) will be loaded."
24832487msgstr ""
2488+ "通过从指定的开始目录向其子目录递归来找出所有测试模块,并返回一个包含该结果的 TestSuite 对象。 只有与 *pattern* "
2489+ "匹配的测试文件才会被加载。 (使用 shell 风格的模式匹配。) 只有可导入的模块名称(即有效的 Python 标识符)将会被加载。"
24842490
24852491#: ../../library/unittest.rst:1824
24862492msgid ""
24872493"All test modules must be importable from the top level of the project. If "
24882494"the start directory is not the top level directory then the top level "
24892495"directory must be specified separately."
2490- msgstr ""
2496+ msgstr "所有测试模块都必须可以从项目的最高层级上导入。 如果起始目录不是最高层级目录则必须单独指明最高层级目录。 "
24912497
24922498#: ../../library/unittest.rst:1828
24932499msgid ""
@@ -2496,6 +2502,8 @@ msgid ""
24962502"import failure is due to :exc:`SkipTest` being raised, it will be recorded "
24972503"as a skip instead of an error."
24982504msgstr ""
2505+ "如果导入某个模块失败,比如因为存在语法错误,则会将其记录为单独的错误并将继续查找模块。 如果导入失败是因为引发了 "
2506+ ":exc:`SkipTest`,则会将其记录为跳过而不是错误。"
24992507
25002508#: ../../library/unittest.rst:1833
25012509msgid ""
@@ -2506,12 +2514,17 @@ msgid ""
25062514"checked for tests once during an invocation, even if the load_tests function"
25072515" itself calls ``loader.discover``."
25082516msgstr ""
2517+ "如果找到了一个包(即包含名为 :file:`__init__.py` 的文件的目录),则将在包中查找 ``load_tests`` 函数。 "
2518+ "如果存在此函数则将对其执行调用 ``package.load_tests(loader, tests, pattern)``。 "
2519+ "测试发现操作会确保在执行期间仅检查测试一次,即使 load_tests 函数本身调用了 ``loader.discover`` 也是如此。."
25092520
25102521#: ../../library/unittest.rst:1841
25112522msgid ""
25122523"If ``load_tests`` exists then discovery does *not* recurse into the package,"
25132524" ``load_tests`` is responsible for loading all tests in the package."
25142525msgstr ""
2526+ "如果 ``load_tests`` 存在则发现操作 *不会* 对包执行递归处理,``load_tests`` 将负责加载包中的所有测试。is "
2527+ "responsible for loading all tests in the package."
25152528
25162529#: ../../library/unittest.rst:1845
25172530msgid ""
@@ -2520,64 +2533,68 @@ msgid ""
25202533"``load_tests`` does not need to pass this argument in to "
25212534"``loader.discover()``."
25222535msgstr ""
2536+ "模式特意地不被当作 loader 属性来保存以使包能够自己继续执行发现操作。 *top_level_dir* 则会被保存以使 "
2537+ "``load_tests`` 不需要将此参数传入到 ``loader.discover()``。"
25232538
25242539#: ../../library/unittest.rst:1850
25252540msgid "*start_dir* can be a dotted module name as well as a directory."
2526- msgstr ""
2541+ msgstr "*start_dir* 可以是一个带点号的名称或是一个目录。 "
25272542
25282543#: ../../library/unittest.rst:1854
25292544msgid ""
25302545"Modules that raise :exc:`SkipTest` on import are recorded as skips, not "
25312546"errors."
2532- msgstr ""
2547+ msgstr "在导入时引发 :exc:`SkipTest` 的模块会被记录为跳过,而不是错误。 "
25332548
25342549#: ../../library/unittest.rst:1858
25352550msgid "*start_dir* can be a :term:`namespace packages <namespace package>`."
2536- msgstr ""
2551+ msgstr "*start_dir* 可以是一个 :term:`命名空间包 <namespace package>`。 "
25372552
25382553#: ../../library/unittest.rst:1861
25392554msgid ""
25402555"Paths are sorted before being imported so that execution order is the same "
25412556"even if the underlying file system's ordering is not dependent on file name."
2542- msgstr ""
2557+ msgstr "路径在被导入之前会先被排序以使得执行顺序保持一致,即使下层文件系统的顺序不是取决于文件名的。 "
25432558
25442559#: ../../library/unittest.rst:1866
25452560msgid ""
25462561"Found packages are now checked for ``load_tests`` regardless of whether "
25472562"their path matches *pattern*, because it is impossible for a package name to"
25482563" match the default pattern."
2549- msgstr ""
2564+ msgstr "现在 ``load_tests`` 会检查已找到的包,无论它们的路径是否与 *pattern* 匹配,因为包名称是无法与默认的模式匹配的。 "
25502565
25512566#: ../../library/unittest.rst:1872
25522567msgid ""
25532568"The following attributes of a :class:`TestLoader` can be configured either "
25542569"by subclassing or assignment on an instance:"
2555- msgstr ""
2570+ msgstr ":class:`TestLoader` 的下列属性可通过子类化或在实例上赋值来配置: "
25562571
25572572#: ../../library/unittest.rst:1878
25582573msgid ""
25592574"String giving the prefix of method names which will be interpreted as test "
25602575"methods. The default value is ``'test'``."
2561- msgstr ""
2576+ msgstr "给出将被解读为测试方法的方法名称的前缀的字符串。 默认值为 ``'test'``。 "
25622577
25632578#: ../../library/unittest.rst:1881
25642579msgid ""
25652580"This affects :meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\\ *` "
25662581"methods."
2567- msgstr ""
2582+ msgstr "这会影响 :meth:`getTestCaseNames` 以及所有 :meth:`loadTestsFrom \\ *` 方法。 "
25682583
25692584#: ../../library/unittest.rst:1887
25702585msgid ""
25712586"Function to be used to compare method names when sorting them in "
25722587":meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\\ *` methods."
25732588msgstr ""
2589+ "将被用来在 :meth:`getTestCaseNames` 以及所有 :meth:`loadTestsFrom\\ *` "
2590+ "方法中比较方法名称以便对它们进行排序。"
25742591
25752592#: ../../library/unittest.rst:1893
25762593msgid ""
25772594"Callable object that constructs a test suite from a list of tests. No "
25782595"methods on the resulting object are needed. The default value is the "
25792596":class:`TestSuite` class."
2580- msgstr ""
2597+ msgstr "根据一个测试列表来构造测试套件的可调用对象。 不需要结果对象上的任何方法。 默认值为 :class:`TestSuite` 类。 "
25812598
25822599#: ../../library/unittest.rst:1897 ../../library/unittest.rst:1910
25832600msgid "This affects all the :meth:`loadTestsFrom\\ *` methods."
0 commit comments