@@ -2487,7 +2487,7 @@ msgstr ""
24872487
24882488#: ../../library/unittest.rst:1815
24892489msgid "The method optionally resolves *name* relative to the given *module*."
2490- msgstr ""
2490+ msgstr "本模块可以选择相对于给定的 *module* 来解析 *name*。 "
24912491
24922492#: ../../library/unittest.rst:1817
24932493msgid ""
@@ -2496,19 +2496,23 @@ msgid ""
24962496"returned. These errors are included in the errors accumulated by "
24972497"self.errors."
24982498msgstr ""
2499+ "如果在遍历 *name* 时发生了 :exc:`ImportError` 或 :exc:`AttributeError` "
2500+ "则在运行时引发该错误的合成测试将被返回。 这些错误被包括在由 self.errors 所积累的错误中。"
24992501
25002502#: ../../library/unittest.rst:1826
25012503msgid ""
25022504"Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather "
25032505"than a single name. The return value is a test suite which supports all the"
25042506" tests defined for each name."
25052507msgstr ""
2508+ "类似于 :meth:`loadTestsFromName`,但是接受一个名称序列而不是单个名称。 "
2509+ "返回值是一个测试套件,它支持为每个名称所定义的所有测试。"
25062510
25072511#: ../../library/unittest.rst:1833
25082512msgid ""
25092513"Return a sorted sequence of method names found within *testCaseClass*; this "
25102514"should be a subclass of :class:`TestCase`."
2511- msgstr ""
2515+ msgstr "返回由 *testCaseClass* 中找到的方法名称组成的已排序的序列;这应当是 :class:`TestCase` 的一个子类。 "
25122516
25132517#: ../../library/unittest.rst:1839
25142518msgid ""
@@ -2518,13 +2522,15 @@ msgid ""
25182522"pattern matching.) Only module names that are importable (i.e. are valid "
25192523"Python identifiers) will be loaded."
25202524msgstr ""
2525+ "通过从指定的开始目录向其子目录递归来找出所有测试模块,并返回一个包含该结果的 TestSuite 对象。 只有与 *pattern* "
2526+ "匹配的测试文件才会被加载。 (使用 shell 风格的模式匹配。) 只有可导入的模块名称(即有效的 Python 标识符)将会被加载。"
25212527
25222528#: ../../library/unittest.rst:1845
25232529msgid ""
25242530"All test modules must be importable from the top level of the project. If "
25252531"the start directory is not the top level directory then the top level "
25262532"directory must be specified separately."
2527- msgstr ""
2533+ msgstr "所有测试模块都必须可以从项目的最高层级上导入。 如果起始目录不是最高层级目录则必须单独指明最高层级目录。 "
25282534
25292535#: ../../library/unittest.rst:1849
25302536msgid ""
@@ -2533,6 +2539,8 @@ msgid ""
25332539"import failure is due to :exc:`SkipTest` being raised, it will be recorded "
25342540"as a skip instead of an error."
25352541msgstr ""
2542+ "如果导入某个模块失败,比如因为存在语法错误,则会将其记录为单独的错误并将继续查找模块。 如果导入失败是因为引发了 "
2543+ ":exc:`SkipTest`,则会将其记录为跳过而不是错误。"
25362544
25372545#: ../../library/unittest.rst:1854
25382546msgid ""
@@ -2543,12 +2551,17 @@ msgid ""
25432551"checked for tests once during an invocation, even if the load_tests function"
25442552" itself calls ``loader.discover``."
25452553msgstr ""
2554+ "如果找到了一个包(即包含名为 :file:`__init__.py` 的文件的目录),则将在包中查找 ``load_tests`` 函数。 "
2555+ "如果存在此函数则将对其执行调用 ``package.load_tests(loader, tests, pattern)``。 "
2556+ "测试发现操作会确保在执行期间仅检查测试一次,即使 load_tests 函数本身调用了 ``loader.discover`` 也是如此。."
25462557
25472558#: ../../library/unittest.rst:1862
25482559msgid ""
25492560"If ``load_tests`` exists then discovery does *not* recurse into the package,"
25502561" ``load_tests`` is responsible for loading all tests in the package."
25512562msgstr ""
2563+ "如果 ``load_tests`` 存在则发现操作 *不会* 对包执行递归处理,``load_tests`` 将负责加载包中的所有测试。is "
2564+ "responsible for loading all tests in the package."
25522565
25532566#: ../../library/unittest.rst:1866
25542567msgid ""
@@ -2557,64 +2570,68 @@ msgid ""
25572570"``load_tests`` does not need to pass this argument in to "
25582571"``loader.discover()``."
25592572msgstr ""
2573+ "模式特意地不被当作 loader 属性来保存以使包能够自己继续执行发现操作。 *top_level_dir* 则会被保存以使 "
2574+ "``load_tests`` 不需要将此参数传入到 ``loader.discover()``。"
25602575
25612576#: ../../library/unittest.rst:1871
25622577msgid "*start_dir* can be a dotted module name as well as a directory."
2563- msgstr ""
2578+ msgstr "*start_dir* 可以是一个带点号的名称或是一个目录。 "
25642579
25652580#: ../../library/unittest.rst:1875
25662581msgid ""
25672582"Modules that raise :exc:`SkipTest` on import are recorded as skips, not "
25682583"errors."
2569- msgstr ""
2584+ msgstr "在导入时引发 :exc:`SkipTest` 的模块会被记录为跳过,而不是错误。 "
25702585
25712586#: ../../library/unittest.rst:1879
25722587msgid "*start_dir* can be a :term:`namespace packages <namespace package>`."
2573- msgstr ""
2588+ msgstr "*start_dir* 可以是一个 :term:`命名空间包 <namespace package>`。 "
25742589
25752590#: ../../library/unittest.rst:1882
25762591msgid ""
25772592"Paths are sorted before being imported so that execution order is the same "
25782593"even if the underlying file system's ordering is not dependent on file name."
2579- msgstr ""
2594+ msgstr "路径在被导入之前会先被排序以使得执行顺序保持一致,即使下层文件系统的顺序不是取决于文件名的。 "
25802595
25812596#: ../../library/unittest.rst:1887
25822597msgid ""
25832598"Found packages are now checked for ``load_tests`` regardless of whether "
25842599"their path matches *pattern*, because it is impossible for a package name to"
25852600" match the default pattern."
2586- msgstr ""
2601+ msgstr "现在 ``load_tests`` 会检查已找到的包,无论它们的路径是否与 *pattern* 匹配,因为包名称是无法与默认的模式匹配的。 "
25872602
25882603#: ../../library/unittest.rst:1893
25892604msgid ""
25902605"The following attributes of a :class:`TestLoader` can be configured either "
25912606"by subclassing or assignment on an instance:"
2592- msgstr ""
2607+ msgstr ":class:`TestLoader` 的下列属性可通过子类化或在实例上赋值来配置: "
25932608
25942609#: ../../library/unittest.rst:1899
25952610msgid ""
25962611"String giving the prefix of method names which will be interpreted as test "
25972612"methods. The default value is ``'test'``."
2598- msgstr ""
2613+ msgstr "给出将被解读为测试方法的方法名称的前缀的字符串。 默认值为 ``'test'``。 "
25992614
26002615#: ../../library/unittest.rst:1902
26012616msgid ""
26022617"This affects :meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\\ *` "
26032618"methods."
2604- msgstr ""
2619+ msgstr "这会影响 :meth:`getTestCaseNames` 以及所有 :meth:`loadTestsFrom \\ *` 方法。 "
26052620
26062621#: ../../library/unittest.rst:1908
26072622msgid ""
26082623"Function to be used to compare method names when sorting them in "
26092624":meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\\ *` methods."
26102625msgstr ""
2626+ "将被用来在 :meth:`getTestCaseNames` 以及所有 :meth:`loadTestsFrom\\ *` "
2627+ "方法中比较方法名称以便对它们进行排序。"
26112628
26122629#: ../../library/unittest.rst:1914
26132630msgid ""
26142631"Callable object that constructs a test suite from a list of tests. No "
26152632"methods on the resulting object are needed. The default value is the "
26162633":class:`TestSuite` class."
2617- msgstr ""
2634+ msgstr "根据一个测试列表来构造测试套件的可调用对象。 不需要结果对象上的任何方法。 默认值为 :class:`TestSuite` 类。 "
26182635
26192636#: ../../library/unittest.rst:1918 ../../library/unittest.rst:1931
26202637msgid "This affects all the :meth:`loadTestsFrom\\ *` methods."
0 commit comments