# Copyright (C) 2001-2020, Python Software Foundation # This file is distributed under the same license as the Python package. # Maintained by the python-doc-es workteam. # docs-es@python.org / # https://mail.python.org/mailman3/lists/docs-es.python.org/ # Check https://github.com/python/python-docs-es/blob/3.8/TRANSLATORS to # get the list of volunteers # msgid "" msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-25 19:47+0200\n" "PO-Revision-Date: 2021-04-01 11:31-0500\n" "Last-Translator: Adolfo Hristo David Roque Gámez \n" "Language: es\n" "Language-Team: python-doc-es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.10.3\n" #: ../Doc/library/doctest.rst:2 msgid ":mod:`doctest` --- Test interactive Python examples" msgstr ":mod:`doctest` -- Prueba ejemplos interactivos de Python" #: ../Doc/library/doctest.rst:12 msgid "**Source code:** :source:`Lib/doctest.py`" msgstr "**Código fuente:** :source:`Lib/doctest.py`" #: ../Doc/library/doctest.rst:16 msgid "" "The :mod:`doctest` module searches for pieces of text that look like " "interactive Python sessions, and then executes those sessions to verify that " "they work exactly as shown. There are several common ways to use doctest:" msgstr "" "El módulo :mod:`doctest` busca pedazos de texto que lucen como sesiones " "interactivas de Python, y entonces ejecuta esas sesiones para verificar que " "funcionen exactamente como son mostradas. Hay varias maneras de usar doctest:" #: ../Doc/library/doctest.rst:20 msgid "" "To check that a module's docstrings are up-to-date by verifying that all " "interactive examples still work as documented." msgstr "" "Para revisar que los docstrings de un módulo están al día al verificar que " "todos los ejemplos interactivos todavía trabajan como está documentado." #: ../Doc/library/doctest.rst:23 msgid "" "To perform regression testing by verifying that interactive examples from a " "test file or a test object work as expected." msgstr "" "Para realizar pruebas de regresión al verificar que los ejemplos " "interactivos de un archivo de pruebas o un objeto de pruebas trabaje como " "sea esperado." #: ../Doc/library/doctest.rst:26 msgid "" "To write tutorial documentation for a package, liberally illustrated with " "input-output examples. Depending on whether the examples or the expository " "text are emphasized, this has the flavor of \"literate testing\" or " "\"executable documentation\"." msgstr "" "Para escribir documentación de tutorial para un paquete, generosamente " "ilustrado con ejemplos de entrada-salida. Dependiendo si los ejemplos o el " "texto expositivo son enfatizados, tiene el sabor de \"pruebas literarias\" o " "\"documentación ejecutable\"." #: ../Doc/library/doctest.rst:31 msgid "Here's a complete but small example module::" msgstr "Aquí hay un módulo de ejemplo completo pero pequeño::" #: ../Doc/library/doctest.rst:88 msgid "" "If you run :file:`example.py` directly from the command line, :mod:`doctest` " "works its magic:" msgstr "" "Si tu ejecutas :file:`example.py` directamente desde la línea de comandos, :" "mod:`doctest` hará su magia:" #: ../Doc/library/doctest.rst:96 msgid "" "There's no output! That's normal, and it means all the examples worked. " "Pass ``-v`` to the script, and :mod:`doctest` prints a detailed log of what " "it's trying, and prints a summary at the end:" msgstr "" "¡No hay salida! Eso es normal, y significa que todos los ejemplos " "funcionaron. Pasa ``-v`` al script, y :mod:`doctest` imprime un registro " "detallado de lo que está intentando, e imprime un resumen al final:" #: ../Doc/library/doctest.rst:114 msgid "And so on, eventually ending with:" msgstr "Y demás, eventualmente terminando con:" #: ../Doc/library/doctest.rst:133 msgid "" "That's all you need to know to start making productive use of :mod:" "`doctest`! Jump in. The following sections provide full details. Note that " "there are many examples of doctests in the standard Python test suite and " "libraries. Especially useful examples can be found in the standard test " "file :file:`Lib/test/test_doctest.py`." msgstr "" "¡Eso es todo lo que necesitas saber para empezar a hacer uso productivo de :" "mod:`doctest`! Lánzate. Las siguientes secciones proporcionan detalles " "completos. Note que hay muchos ejemplos de doctests en el conjunto de " "pruebas estándar de Python y bibliotecas. Especialmente ejemplos útiles se " "pueden encontrar en el archivo de pruebas estándar :file:`Lib/test/" "test_doctest.py`." #: ../Doc/library/doctest.rst:143 msgid "Simple Usage: Checking Examples in Docstrings" msgstr "Uso simple: verificar ejemplos en docstrings" #: ../Doc/library/doctest.rst:145 msgid "" "The simplest way to start using doctest (but not necessarily the way you'll " "continue to do it) is to end each module :mod:`M` with::" msgstr "" "La forma más simple para empezar a usar doctest (pero no necesariamente la " "forma que continuarás usándolo) es terminar cada módulo :mod:`M` con::" #: ../Doc/library/doctest.rst:152 msgid ":mod:`doctest` then examines docstrings in module :mod:`M`." msgstr ":mod:`doctest` entonces examina docstrings en el módulo :mod:`M`." #: ../Doc/library/doctest.rst:154 msgid "" "Running the module as a script causes the examples in the docstrings to get " "executed and verified::" msgstr "" "Ejecutar el módulo como un script causa que los ejemplos en los docstrings " "se ejecuten y verifiquen::" #: ../Doc/library/doctest.rst:159 msgid "" "This won't display anything unless an example fails, in which case the " "failing example(s) and the cause(s) of the failure(s) are printed to stdout, " "and the final line of output is ``***Test Failed*** N failures.``, where *N* " "is the number of examples that failed." msgstr "" "No mostrará nada a menos que un ejemplo falle, en cuyo caso el ejemplo " "fallido o ejemplos fallidos y sus causas de la falla son imprimidas a " "stdout, y la línea final de salida es ``***Test Failed*** N failures.``, " "donde *N* es el número de ejemplos que fallaron." #: ../Doc/library/doctest.rst:164 msgid "Run it with the ``-v`` switch instead::" msgstr "Ejecútalo con el modificador ``-v`` en su lugar::" #: ../Doc/library/doctest.rst:168 msgid "" "and a detailed report of all examples tried is printed to standard output, " "along with assorted summaries at the end." msgstr "" "y un reporte detallado de todos los ejemplos intentados es impreso a la " "salida estándar, junto con resúmenes clasificados al final." #: ../Doc/library/doctest.rst:171 msgid "" "You can force verbose mode by passing ``verbose=True`` to :func:`testmod`, " "or prohibit it by passing ``verbose=False``. In either of those cases, " "``sys.argv`` is not examined by :func:`testmod` (so passing ``-v`` or not " "has no effect)." msgstr "" "Puedes forzar el modo verboso al pasar ``verbose=True`` a :func:`testmod`, o " "prohibirlo al pasarlo ``verbose=False``. En cualquiera de estas casos, ``sys." "argv`` no es examinado por :func:`testmod` (por lo que pasar o no ``-v``, no " "tiene efecto)." #: ../Doc/library/doctest.rst:176 msgid "" "There is also a command line shortcut for running :func:`testmod`. You can " "instruct the Python interpreter to run the doctest module directly from the " "standard library and pass the module name(s) on the command line::" msgstr "" "También hay un atajo de línea de comandos para ejecutar :func:`testmod`. " "Puedes instruir al intérprete de Python para ejecutar el módulo doctest " "directamente de la biblioteca estándar y pasar los nombres del módulo en la " "línea de comandos::" #: ../Doc/library/doctest.rst:182 msgid "" "This will import :file:`example.py` as a standalone module and run :func:" "`testmod` on it. Note that this may not work correctly if the file is part " "of a package and imports other submodules from that package." msgstr "" "Esto importará :file:`example.py` como un módulo independiente y ejecutará " "a :func:`testmod`. Note que esto puede no funcionar correctamente si el " "archivo es parte de un paquete e importa otros submódulos de ese paquete." #: ../Doc/library/doctest.rst:186 msgid "" "For more information on :func:`testmod`, see section :ref:`doctest-basic-" "api`." msgstr "" "Para más información de :func:`testmod`, véase la sección :ref:`doctest-" "basic-api`." #: ../Doc/library/doctest.rst:192 msgid "Simple Usage: Checking Examples in a Text File" msgstr "Uso Simple: Verificar ejemplos en un Archivo de Texto" #: ../Doc/library/doctest.rst:194 msgid "" "Another simple application of doctest is testing interactive examples in a " "text file. This can be done with the :func:`testfile` function::" msgstr "" "Otra simple aplicación de doctest es probar ejemplos interactivos en un " "archivo de texto. Esto puede ser hecho con la función :func:`testfile`::" #: ../Doc/library/doctest.rst:200 msgid "" "That short script executes and verifies any interactive Python examples " "contained in the file :file:`example.txt`. The file content is treated as " "if it were a single giant docstring; the file doesn't need to contain a " "Python program! For example, perhaps :file:`example.txt` contains this:" msgstr "" "Este script corto ejecuta y verifica cualquier ejemplo interactivo de Python " "contenido en el archivo :file:`example.txt`. El contenido del archivo es " "tratado como si fuese un solo gran docstring; ¡el archivo no necesita " "contener un programa de Python! Por ejemplo, tal vez :file:`example.txt` " "contenga esto:" #: ../Doc/library/doctest.rst:223 msgid "" "Running ``doctest.testfile(\"example.txt\")`` then finds the error in this " "documentation::" msgstr "" "Ejecutar ``doctest.testfile(\"example.txt\")`` entonces encuentra el error " "en esta documentación::" #: ../Doc/library/doctest.rst:234 msgid "" "As with :func:`testmod`, :func:`testfile` won't display anything unless an " "example fails. If an example does fail, then the failing example(s) and the " "cause(s) of the failure(s) are printed to stdout, using the same format as :" "func:`testmod`." msgstr "" "Como con :func:`testmod`, :func:`testfile` no mostrará nada a menos que un " "ejemplo falle. Si un ejemplo no falla, entonces los ejemplos fallidos y sus " "causas son impresas a stdout, usando el mismo formato como :func:`testmod`." #: ../Doc/library/doctest.rst:239 msgid "" "By default, :func:`testfile` looks for files in the calling module's " "directory. See section :ref:`doctest-basic-api` for a description of the " "optional arguments that can be used to tell it to look for files in other " "locations." msgstr "" "Por defecto, :func:`testfile` busca archivos en el directorio del módulo al " "que se llama. Véase la sección :ref:`doctest-basic-api` para una descripción " "de los argumentos opcionales que pueden ser usados para decirle que busque " "archivos en otros lugares." #: ../Doc/library/doctest.rst:243 msgid "" "Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-" "v`` command-line switch or with the optional keyword argument *verbose*." msgstr "" "Como :func:`testmod`, la verbosidad de :func:`testfile` puede ser " "establecida con el modificador de la línea de comandos ``-v`` o con el " "argumento por palabra clave opcional *verbose*." #: ../Doc/library/doctest.rst:247 msgid "" "There is also a command line shortcut for running :func:`testfile`. You can " "instruct the Python interpreter to run the doctest module directly from the " "standard library and pass the file name(s) on the command line::" msgstr "" "También hay un atajo de línea de comandos para ejecutar :func:`testfile`. " "Puedes indicar al intérprete de Python para correr el módulo doctest " "directamente desde la biblioteca estándar y pasar el nombre de los archivos " "en la línea de comandos::" #: ../Doc/library/doctest.rst:253 msgid "" "Because the file name does not end with :file:`.py`, :mod:`doctest` infers " "that it must be run with :func:`testfile`, not :func:`testmod`." msgstr "" "Porque el nombre del archivo no termina con :file:`.py`, :mod:`doctest` " "infiere que se debe ejecutar con :func:`testfile`, no :func:`testmod`." #: ../Doc/library/doctest.rst:256 msgid "" "For more information on :func:`testfile`, see section :ref:`doctest-basic-" "api`." msgstr "" "Para más información en :func:`testfile`, véase la sección :ref:`doctest-" "basic-api`." #: ../Doc/library/doctest.rst:262 msgid "How It Works" msgstr "Cómo funciona" #: ../Doc/library/doctest.rst:264 msgid "" "This section examines in detail how doctest works: which docstrings it looks " "at, how it finds interactive examples, what execution context it uses, how " "it handles exceptions, and how option flags can be used to control its " "behavior. This is the information that you need to know to write doctest " "examples; for information about actually running doctest on these examples, " "see the following sections." msgstr "" "Esta sección examina en detalle cómo funciona doctest: qué docstrings " "revisa, cómo encuentra ejemplos interactivos, qué contexto de ejecución usa, " "cómo maneja las excepciones, y cómo las banderas pueden ser usadas para " "controlar su comportamiento. Esta es la información que necesitas saber para " "escribir ejemplos de doctest; para información sobre ejecutar doctest en " "estos ejemplos, véase las siguientes secciones." #: ../Doc/library/doctest.rst:275 msgid "Which Docstrings Are Examined?" msgstr "¿Qué docstrings son examinados?" #: ../Doc/library/doctest.rst:277 msgid "" "The module docstring, and all function, class and method docstrings are " "searched. Objects imported into the module are not searched." msgstr "" "Se busca en el docstring del módulo, y todos los docstrings de las " "funciones, clases, y métodos. Los objetos importados en el módulo no se " "buscan." #: ../Doc/library/doctest.rst:280 msgid "" "In addition, if ``M.__test__`` exists and \"is true\", it must be a dict, " "and each entry maps a (string) name to a function object, class object, or " "string. Function and class object docstrings found from ``M.__test__`` are " "searched, and strings are treated as if they were docstrings. In output, a " "key ``K`` in ``M.__test__`` appears with name ::" msgstr "" "Además, si ``M.__test__`` existe y \"es verdaderos\", debe ser un " "diccionario, y cada entrada mapea un nombre (cadena de caracteres) a un " "objeto de función, objeto de clase, o cadena de caracteres. Se buscan los " "docstrings de los objetos de función o de clase encontrados de ``M." "__test__``, y las cadenas de caracteres son tratadas como si fueran " "docstrings. En la salida, una clave ``K`` en ``M.__test__`` aparece con el " "nombre::" #: ../Doc/library/doctest.rst:288 msgid "" "Any classes found are recursively searched similarly, to test docstrings in " "their contained methods and nested classes." msgstr "" "Todas las clases encontradas se buscan recursivamente de manera similar, " "para probar docstrings en sus métodos contenidos y clases anidadas." #: ../Doc/library/doctest.rst:295 msgid "How are Docstring Examples Recognized?" msgstr "¿Cómo se reconocen los ejemplos de docstring?" #: ../Doc/library/doctest.rst:297 msgid "" "In most cases a copy-and-paste of an interactive console session works fine, " "but doctest isn't trying to do an exact emulation of any specific Python " "shell." msgstr "" "En la mayoría de los casos un copiar y pegar de una sesión de consola " "interactiva funciona bien, pero doctest no está intentando hacer una " "emulación exacta de ningún shell específico de Python." #: ../Doc/library/doctest.rst:322 msgid "" "Any expected output must immediately follow the final ``'>>> '`` or ``'... " "'`` line containing the code, and the expected output (if any) extends to " "the next ``'>>> '`` or all-whitespace line." msgstr "" "Cualquier salida esperada debe seguir inmediatamente el final de la línea " "``'>>>'`` o ``'...'`` conteniendo el código, y la salida esperada (si la " "hubiera) se extiende hasta el siguiente ``'>>>'`` o la línea en blanco." #: ../Doc/library/doctest.rst:326 msgid "The fine print:" msgstr "La letra pequeña:" #: ../Doc/library/doctest.rst:328 msgid "" "Expected output cannot contain an all-whitespace line, since such a line is " "taken to signal the end of expected output. If expected output does contain " "a blank line, put ```` in your doctest example each place a blank " "line is expected." msgstr "" "La salida esperada no puede contener una línea de espacios en blanco, ya que " "ese tipo de línea se toma para indicar el fin de la salida esperada. Si la " "salida esperada de verdad contiene una línea en blanco, pon ```` " "en tu ejemplo de doctest en cada lugar donde una línea en blanco sea " "esperada." #: ../Doc/library/doctest.rst:333 msgid "" "All hard tab characters are expanded to spaces, using 8-column tab stops. " "Tabs in output generated by the tested code are not modified. Because any " "hard tabs in the sample output *are* expanded, this means that if the code " "output includes hard tabs, the only way the doctest can pass is if the :" "const:`NORMALIZE_WHITESPACE` option or :ref:`directive ` " "is in effect. Alternatively, the test can be rewritten to capture the output " "and compare it to an expected value as part of the test. This handling of " "tabs in the source was arrived at through trial and error, and has proven to " "be the least error prone way of handling them. It is possible to use a " "different algorithm for handling tabs by writing a custom :class:" "`DocTestParser` class." msgstr "" "Todos los caracteres de tabulación se expanden a espacios, usando paradas de " "tabulación de 8 -columnas. Las tabulaciones generadas por el código en " "pruebas no son modificadas. Ya que todas las tabulaciones en la salida de " "prueba *son* expandidas, significa que si el código de salida incluye " "tabulaciones, la única manera de que el doctest pueda pasar es si la opción :" "const:`NORMALIZE_WHITESPACE` o :ref:`directive ` está en " "efecto. Alternativamente, la prueba puede ser reescrita para capturar la " "salida y compararla a un valor esperado como parte de la prueba. Se llegó a " "este tratamiento de tabulaciones en la fuente a través de prueba y error, y " "ha demostrado ser la manera menos propensa a errores de manejarlos. Es " "posible usar un algoritmo diferente para manejar tabulaciones al escribir " "una clase :class:`DocTestParser` personalizada." #: ../Doc/library/doctest.rst:345 msgid "" "Output to stdout is captured, but not output to stderr (exception tracebacks " "are captured via a different means)." msgstr "" "La salida a stdout es capturada, pero no la salida a stderr (los rastreos de " "la excepción son capturados a través de maneras diferentes)." #: ../Doc/library/doctest.rst:348 msgid "" "If you continue a line via backslashing in an interactive session, or for " "any other reason use a backslash, you should use a raw docstring, which will " "preserve your backslashes exactly as you type them::" msgstr "" "Si continuas una línea poniendo una barra invertida en una sesión " "interactiva, o por cualquier otra razón usas una barra invertida, debes usar " "un docstring crudo, que preservará tus barras invertidas exactamente como " "las escribes::" #: ../Doc/library/doctest.rst:357 msgid "" "Otherwise, the backslash will be interpreted as part of the string. For " "example, the ``\\n`` above would be interpreted as a newline character. " "Alternatively, you can double each backslash in the doctest version (and not " "use a raw string)::" msgstr "" "De otra manera, la barra invertida será interpretada como parte de una " "cadena. Por ejemplo, el ``\\n`` arriba sería interpretado como un carácter " "de nueva línea. Alternativamente, puedes duplicar cada barra invertida en " "la versión de doctest (y no usar una cadena de caracteres cruda)::" #: ../Doc/library/doctest.rst:366 msgid "The starting column doesn't matter::" msgstr "La columna inicial no importa::" #: ../Doc/library/doctest.rst:373 msgid "" "and as many leading whitespace characters are stripped from the expected " "output as appeared in the initial ``'>>> '`` line that started the example." msgstr "" "y tantos espacios en blanco al principio se eliminan de la salida esperada " "como aparece en la línea ``'>>>'`` inicial que empezó el ejemplo." #: ../Doc/library/doctest.rst:380 msgid "What's the Execution Context?" msgstr "¿Cuál es el contexto de ejecución?" #: ../Doc/library/doctest.rst:382 msgid "" "By default, each time :mod:`doctest` finds a docstring to test, it uses a " "*shallow copy* of :mod:`M`'s globals, so that running tests doesn't change " "the module's real globals, and so that one test in :mod:`M` can't leave " "behind crumbs that accidentally allow another test to work. This means " "examples can freely use any names defined at top-level in :mod:`M`, and " "names defined earlier in the docstring being run. Examples cannot see names " "defined in other docstrings." msgstr "" "Por defecto, cada vez que un :mod:`doctest` encuentre un docstring para " "probar, usa una *copia superficial* de los globales de :mod:`M`, por lo que " "ejecutar pruebas no cambia los globales reales del módulo, y por lo que una " "prueba en :mod:`M` no puede dejar atrás migajas que permitan a otras pruebas " "trabajar. Significa que los ejemplos pueden usar libremente cualquier nombre " "definido en el nivel superior en :mod:`M`, y nombres definidos más temprano " "en los docstrings siendo ejecutados. Los ejemplos no pueden ver nombres " "definidos en otros docstrings." #: ../Doc/library/doctest.rst:390 msgid "" "You can force use of your own dict as the execution context by passing " "``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead." msgstr "" "Puedes forzar el uso de tus propios diccionarios como contexto de ejecución " "al pasar ``globs=your_dict`` a :func:`testmod` o :func:`testfile` en su " "lugar." #: ../Doc/library/doctest.rst:397 msgid "What About Exceptions?" msgstr "¿Y las excepciones?" #: ../Doc/library/doctest.rst:399 msgid "" "No problem, provided that the traceback is the only output produced by the " "example: just paste in the traceback. [#]_ Since tracebacks contain details " "that are likely to change rapidly (for example, exact file paths and line " "numbers), this is one case where doctest works hard to be flexible in what " "it accepts." msgstr "" "No hay problema, siempre que el rastreo sea la única salida producida por el " "ejemplo: sólo copia el rastreo. [#]_ Ya que los rastreos contienen detalles " "que probablemente cambien rápidamente (por ejemplo, rutas de archivos " "exactas y números de línea), este es un caso donde doctest trabaja duro para " "ser flexible en lo que acepta." #: ../Doc/library/doctest.rst:405 msgid "Simple example::" msgstr "Ejemplo simple::" #: ../Doc/library/doctest.rst:412 msgid "" "That doctest succeeds if :exc:`ValueError` is raised, with the ``list." "remove(x): x not in list`` detail as shown." msgstr "" "El doctest tiene éxito si se lanza :exc:`ValueError`, con el detalle ``list." "remove(x): x not in list`` como se muestra." #: ../Doc/library/doctest.rst:415 msgid "" "The expected output for an exception must start with a traceback header, " "which may be either of the following two lines, indented the same as the " "first line of the example::" msgstr "" "La salida esperada para una excepción debe empezar con una cabecera de " "rastreo, que puede ser una de las siguientes dos líneas, con el mismo " "sangrado de la primera línea del ejemplo:" #: ../Doc/library/doctest.rst:422 msgid "" "The traceback header is followed by an optional traceback stack, whose " "contents are ignored by doctest. The traceback stack is typically omitted, " "or copied verbatim from an interactive session." msgstr "" "La cabecera de rastreo es seguida por una pila de rastreo opcional, cuyo " "contenido es ignorado por doctest. La pila de rastreo es típicamente " "omitida, o copiada palabra por palabra de una sesión interactiva." #: ../Doc/library/doctest.rst:426 msgid "" "The traceback stack is followed by the most interesting part: the line(s) " "containing the exception type and detail. This is usually the last line of " "a traceback, but can extend across multiple lines if the exception has a " "multi-line detail::" msgstr "" "La pila de rastreo es seguida por la parte más interesante: la línea o " "líneas conteniendo el tipo de excepción y detalle. Esto es usualmente la " "última línea de un rastreo, pero se puede extender a través de múltiples " "líneas si la excepción tiene un detalle de varias líneas::" #: ../Doc/library/doctest.rst:438 msgid "" "The last three lines (starting with :exc:`ValueError`) are compared against " "the exception's type and detail, and the rest are ignored." msgstr "" "Las últimas tres líneas (empezando con :exc:`ValueError`) son comparados con " "el tipo de excepción y detalle, y el resto es ignorado." #: ../Doc/library/doctest.rst:441 msgid "" "Best practice is to omit the traceback stack, unless it adds significant " "documentation value to the example. So the last example is probably better " "as::" msgstr "" "La mejor práctica es omitir la pila de rastreo, a menos que añada valor de " "documentación significante al ejemplo. Por lo que el último ejemplo es " "probablemente mejor como::" #: ../Doc/library/doctest.rst:451 msgid "" "Note that tracebacks are treated very specially. In particular, in the " "rewritten example, the use of ``...`` is independent of doctest's :const:" "`ELLIPSIS` option. The ellipsis in that example could be left out, or could " "just as well be three (or three hundred) commas or digits, or an indented " "transcript of a Monty Python skit." msgstr "" "Note que los rastreos son tratados de manera especial. En particular, en el " "ejemplo reescrito, el uso de ``...`` es independiente de la opción :const:" "`ELLIPSIS` de doctest. Se pueden excluir los puntos suspensivos en ese " "ejemplo, así como también pueden haber tres (o trescientas) comas o dígitos, " "o una transcripción sangrada de un *sketch* de Monty Python." #: ../Doc/library/doctest.rst:457 msgid "Some details you should read once, but won't need to remember:" msgstr "Algunos detalles que debes leer una vez, pero no necesitarás recordar:" #: ../Doc/library/doctest.rst:459 msgid "" "Doctest can't guess whether your expected output came from an exception " "traceback or from ordinary printing. So, e.g., an example that expects " "``ValueError: 42 is prime`` will pass whether :exc:`ValueError` is actually " "raised or if the example merely prints that traceback text. In practice, " "ordinary output rarely begins with a traceback header line, so this doesn't " "create real problems." msgstr "" "Doctest no puede adivinar si tu salida esperada vino de una excepción de " "rastreo o de una impresión ordinaria. Así que, un ejemplo que espera " "``ValueError: 42 is prime`` pasará, ya sea si de hecho se lance :exc:" "`ValueError` o si el ejemplo simplemente imprime ese texto de rastreo. En la " "práctica, la salida ordinaria raramente comienza con una línea de cabecera " "de rastreo, por lo que esto no crea problemas reales." #: ../Doc/library/doctest.rst:466 msgid "" "Each line of the traceback stack (if present) must be indented further than " "the first line of the example, *or* start with a non-alphanumeric character. " "The first line following the traceback header indented the same and starting " "with an alphanumeric is taken to be the start of the exception detail. Of " "course this does the right thing for genuine tracebacks." msgstr "" "Cada línea de la pila de rastreo (si se presenta) debe estar más sangrada " "que la primera línea del ejemplo, *o* empezar con un carácter no " "alfanumérico. la primera línea que sigue a la cabecera de rastreo sangrada " "de igual forma y empezando con un alfanumérico es considerado el inicio del " "detalle de la excepción. Por supuesto que esto es lo correcto para rastreos " "genuinos." #: ../Doc/library/doctest.rst:472 msgid "" "When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, " "everything following the leftmost colon and any module information in the " "exception name is ignored." msgstr "" "Cuando se especifica la opción :const:`IGNORE_EXCEPTION_DETAIL` de doctest. " "todo lo que sigue a los dos puntos más a la izquierda y cualquier otra " "información del módulo en el nombre de la excepción se ignora." #: ../Doc/library/doctest.rst:476 msgid "" "The interactive shell omits the traceback header line for some :exc:" "`SyntaxError`\\ s. But doctest uses the traceback header line to " "distinguish exceptions from non-exceptions. So in the rare case where you " "need to test a :exc:`SyntaxError` that omits the traceback header, you will " "need to manually add the traceback header line to your test example." msgstr "" "El shell interactivo omite la línea de la cabecera de rastreo para algunos :" "exc:`SyntaxError`. Pero doctest usa la línea de la cabecera de rastreo para " "distinguir excepciones de los que no son. Así que en algunos casos raros " "donde necesitas probar un :exc:`SyntaxError` que omite la cabecera de " "rastreo, necesitarás poner manualmente la línea de cabecera de rastreo en tu " "ejemplo de prueba." #: ../Doc/library/doctest.rst:484 #, fuzzy msgid "" "For some exceptions, Python displays the position of the error using ``^`` " "markers and tildes::" msgstr "" "Para algunos :exc:`SyntaxError`, Python muestra la posición del carácter del " "error de sintaxis, usando un marcador ``^``::" #: ../Doc/library/doctest.rst:493 msgid "" "Since the lines showing the position of the error come before the exception " "type and detail, they are not checked by doctest. For example, the " "following test would pass, even though it puts the ``^`` marker in the wrong " "location::" msgstr "" "Ya que las líneas mostrando la posición del error vienen antes del tipo de " "excepción y detalle, no son revisadas por doctest. Por ejemplo, el siguiente " "test pasaría, a pesar de que pone el marcador ``^`` en la posición " "equivocada::" #: ../Doc/library/doctest.rst:508 msgid "Option Flags" msgstr "Banderas de Opción" #: ../Doc/library/doctest.rst:510 msgid "" "A number of option flags control various aspects of doctest's behavior. " "Symbolic names for the flags are supplied as module constants, which can be :" "ref:`bitwise ORed ` together and passed to various functions. The " "names can also be used in :ref:`doctest directives `, " "and may be passed to the doctest command line interface via the ``-o`` " "option." msgstr "" "Varias banderas de opción controlan diversos aspectos del comportamiento de " "doctest. Los nombres simbólicos para las banderas son proporcionados como " "constantes del módulo, que se pueden conectar mediante :ref:`*OR* bit a bit " "` y pasar a varias funciones. Los nombres también pueden ser " "usados en las :ref:`directivas de doctest `, y se pueden " "pasar a la interfaz de la línea de comandos de doctest a través de la opción " "``-o``." #: ../Doc/library/doctest.rst:516 msgid "The ``-o`` command line option." msgstr "La opción de la línea de comandos ``-o``." #: ../Doc/library/doctest.rst:519 msgid "" "The first group of options define test semantics, controlling aspects of how " "doctest decides whether actual output matches an example's expected output:" msgstr "" "El primer grupo de opciones definen las semánticas de la prueba, controlando " "aspectos de cómo doctest decide si la salida de hecho concuerda con la " "salida esperada del ejemplo:" #: ../Doc/library/doctest.rst:525 msgid "" "By default, if an expected output block contains just ``1``, an actual " "output block containing just ``1`` or just ``True`` is considered to be a " "match, and similarly for ``0`` versus ``False``. When :const:" "`DONT_ACCEPT_TRUE_FOR_1` is specified, neither substitution is allowed. The " "default behavior caters to that Python changed the return type of many " "functions from integer to boolean; doctests expecting \"little integer\" " "output still work in these cases. This option will probably go away, but " "not for several years." msgstr "" "Por defecto, si un bloque de salida esperada contiene sólo ``1``, se " "considera igual a un bloque de salida real conteniendo sólo ``1`` o " "``true``, y similarmente para ``0`` contra ``False``. Cuando se especifica :" "const:`DONT_ACCEPT_TRUE_FOR_1``, no se permite ninguna sustitución. El " "comportamiento por defecto atiende a que Python cambió el tipo de retorno de " "muchas funciones de enteros a booleanos; los doctest esperando salidas \"de " "pequeño enteros\" todavía trabajan en estos casos. Esta opción probablemente " "se vaya, pero no por muchos años." #: ../Doc/library/doctest.rst:537 msgid "" "By default, if an expected output block contains a line containing only the " "string ````, then that line will match a blank line in the actual " "output. Because a genuinely blank line delimits the expected output, this " "is the only way to communicate that a blank line is expected. When :const:" "`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." msgstr "" "Por defecto, si un bloque de salida esperada contiene una línea que sólo " "tiene la cadena de caracteres ````, entonces esa línea " "corresponderá a una línea en blanco en la salida real. Ya que una línea en " "blanca auténtica delimita la salida esperada, esta es la única manera de " "comunicar que una línea en blanco es esperada. Cuando se especifica :const:" "`DONT_ACCEPT_BLANKLINE`, esta substitución no se permite." #: ../Doc/library/doctest.rst:546 msgid "" "When specified, all sequences of whitespace (blanks and newlines) are " "treated as equal. Any sequence of whitespace within the expected output " "will match any sequence of whitespace within the actual output. By default, " "whitespace must match exactly. :const:`NORMALIZE_WHITESPACE` is especially " "useful when a line of expected output is very long, and you want to wrap it " "across multiple lines in your source." msgstr "" "Cuando se especifica, todas las secuencias de espacios en blanco (vacías y " "nuevas líneas) son tratadas como iguales. Cualquier secuencia de espacios en " "blanco dentro de la salida esperada corresponderá a cualquier secuencia de " "espacios en blanco dentro de la salida real. Por defecto, los espacios en " "blanco deben corresponderse exactamente. :const:`NORMALIZE_WHITESPACE` es " "especialmente útil cuando una línea de la salida esperada es muy larga, y " "quieres envolverla a través de múltiples líneas en tu código fuente." #: ../Doc/library/doctest.rst:557 msgid "" "When specified, an ellipsis marker (``...``) in the expected output can " "match any substring in the actual output. This includes substrings that " "span line boundaries, and empty substrings, so it's best to keep usage of " "this simple. Complicated uses can lead to the same kinds of \"oops, it " "matched too much!\" surprises that ``.*`` is prone to in regular expressions." msgstr "" "Cuando se especifica, un marcador de puntos suspensivos (``...``) en la " "salida esperada puede corresponder a cualquier cadena de caracteres en la " "salida real. Esto incluye las cadenas de caracteres que abarcan límites de " "líneas, y cadenas de caracteres vacías, por lo que es mejor mantener su uso " "simple. Usos complicados pueden conducir a los mismo tipos de sorpresa de " "\"ups, coincidió demasiado\" que ``.*`` es propenso a hacer en expresiones " "regulares." #: ../Doc/library/doctest.rst:566 msgid "" "When specified, doctests expecting exceptions pass so long as an exception " "of the expected type is raised, even if the details (message and fully " "qualified exception name) don't match." msgstr "" #: ../Doc/library/doctest.rst:570 msgid "" "For example, an example expecting ``ValueError: 42`` will pass if the actual " "exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:" "`TypeError` is raised instead. It will also ignore any fully qualified name " "included before the exception class, which can vary between implementations " "and versions of Python and the code/libraries in use. Hence, all three of " "these variations will work with the flag specified:" msgstr "" #: ../Doc/library/doctest.rst:592 msgid "" "Note that :const:`ELLIPSIS` can also be used to ignore the details of the " "exception message, but such a test may still fail based on whether the " "module name is present or matches exactly." msgstr "" #: ../Doc/library/doctest.rst:596 msgid "" ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " "to the module containing the exception under test." msgstr "" ":const:`IGNORE_EXCEPTION_DETAIL` también ignora cualquier información " "relacionada al módulo conteniendo la excepción bajo prueba." #: ../Doc/library/doctest.rst:603 msgid "" "When specified, do not run the example at all. This can be useful in " "contexts where doctest examples serve as both documentation and test cases, " "and an example should be included for documentation purposes, but should not " "be checked. E.g., the example's output might be random; or the example " "might depend on resources which would be unavailable to the test driver." msgstr "" "Cuando se especifica, no ejecuta el ejemplo del todo. Puede ser útil en " "contextos donde los ejemplos de doctest sirven como documentación y casos de " "prueba a la vez, y un ejemplo debe ser incluido para propósitos de " "documentación, pero no debe ser revisado. P. ej., la salida del ejemplo " "puede ser aleatoria, o el ejemplo puede depender de recursos que no estarían " "disponibles para el controlador de pruebas." #: ../Doc/library/doctest.rst:609 msgid "" "The SKIP flag can also be used for temporarily \"commenting out\" examples." msgstr "" "La bandera *SKIP* también se puede usar para temporalmente \"quitar\" " "ejemplos." #: ../Doc/library/doctest.rst:614 msgid "A bitmask or'ing together all the comparison flags above." msgstr "" "Una máscara de bits o juntadas lógicamente todas las banderas de arriba." #: ../Doc/library/doctest.rst:616 msgid "The second group of options controls how test failures are reported:" msgstr "" "El segundo grupo de opciones controla cómo las fallas de las pruebas son " "reportadas:" #: ../Doc/library/doctest.rst:621 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "are displayed using a unified diff." msgstr "" "Cuando se especifica, las fallas que involucran salidas multilínea esperadas " "y reales son mostradas usando una diferencia (*diff*) unificada." #: ../Doc/library/doctest.rst:627 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "will be displayed using a context diff." msgstr "" "Cuando se especifica, las fallas que involucran salidas multilínea esperadas " "y reales se mostrarán usando una diferencia (*diff*) contextual." #: ../Doc/library/doctest.rst:633 msgid "" "When specified, differences are computed by ``difflib.Differ``, using the " "same algorithm as the popular :file:`ndiff.py` utility. This is the only " "method that marks differences within lines as well as across lines. For " "example, if a line of expected output contains digit ``1`` where actual " "output contains letter ``l``, a line is inserted with a caret marking the " "mismatching column positions." msgstr "" "Cuando se especifica, las diferencias son computadas por ``difflib.Differ``, " "usando el mismo algoritmo que la popular utilidad :file:`ndiff.py`. Este es " "el único método que marca diferencias dentro de líneas también como a través " "de líneas. Por ejemplo, si una línea de salida esperada contiene el dígito " "``1`` donde la salida actual contiene la letra ``l``, se inserta una línea " "con una marca de inserción marcando la posición de las columnas que no " "coinciden." #: ../Doc/library/doctest.rst:642 msgid "" "When specified, display the first failing example in each doctest, but " "suppress output for all remaining examples. This will prevent doctest from " "reporting correct examples that break because of earlier failures; but it " "might also hide incorrect examples that fail independently of the first " "failure. When :const:`REPORT_ONLY_FIRST_FAILURE` is specified, the " "remaining examples are still run, and still count towards the total number " "of failures reported; only the output is suppressed." msgstr "" "Cuando se especifica, muestra el primer ejemplo fallido en cada doctest, " "pero suprime la salida para todos ejemplos restantes. Esto evitará que " "doctest reporte los ejemplos correctos que se rompen por causa de fallos " "tempranos; pero también puede esconder ejemplos incorrectos que fallen " "independientemente de la primera falla. Cuando se especifica :const:" "`REPORT_ONLY_FIRST_FAILURE`, los ejemplos restantes aún se ejecutan, y aún " "cuentan para el número total de fallas reportadas, sólo se suprime la salida." #: ../Doc/library/doctest.rst:653 msgid "" "When specified, exit after the first failing example and don't attempt to " "run the remaining examples. Thus, the number of failures reported will be at " "most 1. This flag may be useful during debugging, since examples after the " "first failure won't even produce debugging output." msgstr "" "Cuando se especifica, sale después del primer ejemplo fallido y no intenta " "ejecutar los ejemplos restantes. Por consiguiente, el número de fallas " "reportadas será como mucho 1. Esta bandera puede ser útil durante la " "depuración, ya que los ejemplos después de la primera falla ni siquiera " "producirán salida de depuración." #: ../Doc/library/doctest.rst:658 msgid "" "The doctest command line accepts the option ``-f`` as a shorthand for ``-o " "FAIL_FAST``." msgstr "" "La línea de comandos de doctest acepta la opción ``-f`` como un atajo para " "``-o FAIL_FAST``." #: ../Doc/library/doctest.rst:666 msgid "A bitmask or'ing together all the reporting flags above." msgstr "Una máscara de bits o todas las banderas de reporte arriba combinadas." #: ../Doc/library/doctest.rst:669 msgid "" "There is also a way to register new option flag names, though this isn't " "useful unless you intend to extend :mod:`doctest` internals via subclassing:" msgstr "" "También hay una manera de registrar nombres de nuevas opciones de banderas, " "aunque esto no es útil a menos que intentes extender :mod:`doctest` a través " "de herencia:" #: ../Doc/library/doctest.rst:675 msgid "" "Create a new option flag with a given name, and return the new flag's " "integer value. :func:`register_optionflag` can be used when subclassing :" "class:`OutputChecker` or :class:`DocTestRunner` to create new options that " "are supported by your subclasses. :func:`register_optionflag` should always " "be called using the following idiom::" msgstr "" "Crea una nueva bandera de opción con un nombre dado, y retorna el valor " "entero de la nueva bandera. se puede usar :func:`register_optionflag` cuando " "se hereda :class:`OutputChecker` o :class:`DocTestRunner` para crear nuevas " "opciones que sean compatibles con tus clases heredadas. :func:" "`register_optionflag` siempre debe ser llamado usando la siguiente " "expresión::" #: ../Doc/library/doctest.rst:691 msgid "Directives" msgstr "Directivas" #: ../Doc/library/doctest.rst:693 msgid "" "Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python " "comments following an example's source code:" msgstr "" "Se pueden usar las directivas de doctest para modificar las :ref:`banderas " "de opción ` para un ejemplo individual. Las directivas de " "doctest son comentarios de Python especiales que siguen el código fuente de " "un ejemplo:" #: ../Doc/library/doctest.rst:704 msgid "" "Whitespace is not allowed between the ``+`` or ``-`` and the directive " "option name. The directive option name can be any of the option flag names " "explained above." msgstr "" "No se permite el espacio en blanco entre el ``+`` o ``-`` y el nombre de la " "opción de directiva (*directive option name*). El nombre de la opción de " "directiva puede ser cualquiera de los nombres de las banderas de opciones " "explicadas arriba." #: ../Doc/library/doctest.rst:708 msgid "" "An example's doctest directives modify doctest's behavior for that single " "example. Use ``+`` to enable the named behavior, or ``-`` to disable it." msgstr "" "Las directivas de doctest de un ejemplo modifican el comportamiento de " "doctest para ese único ejemplo. Usa ``+`` para habilitar el comportamiento " "nombrado, o ``-`` para deshabilitarlo." #: ../Doc/library/doctest.rst:711 #, fuzzy msgid "For example, this test passes:" msgstr "Por ejemplo, esta prueba pasa::" #: ../Doc/library/doctest.rst:720 #, fuzzy msgid "" "Without the directive it would fail, both because the actual output doesn't " "have two blanks before the single-digit list elements, and because the " "actual output is on a single line. This test also passes, and also requires " "a directive to do so:" msgstr "" "Sin la directiva esto fallaría, porque la salida real no tiene dos espacios " "en blanco antes los elementos de la lista de un dígito, y porque la salida " "real está en una sola línea. Esta prueba también pasa, y también requiere " "directivas para hacerlo::" #: ../Doc/library/doctest.rst:731 #, fuzzy msgid "" "Multiple directives can be used on a single physical line, separated by " "commas:" msgstr "" "Se pueden usar múltiples directivas en una sola línea física, separadas por " "comas::" #: ../Doc/library/doctest.rst:740 #, fuzzy msgid "" "If multiple directive comments are used for a single example, then they are " "combined:" msgstr "" "Si múltiples directivas se usan para un sólo ejemplo, entonces son " "combinadas::" #: ../Doc/library/doctest.rst:750 #, fuzzy msgid "" "As the previous example shows, you can add ``...`` lines to your example " "containing only directives. This can be useful when an example is too long " "for a directive to comfortably fit on the same line:" msgstr "" "Como muestran los ejemplos previos, puedes añadir líneas de ``...`` a tus " "ejemplos conteniendo sólo directivas. Puede ser útil cuando un ejemplo es " "demasiado largo para que una directiva pueda caber cómodamente en la misma " "línea::" #: ../Doc/library/doctest.rst:761 msgid "" "Note that since all options are disabled by default, and directives apply " "only to the example they appear in, enabling options (via ``+`` in a " "directive) is usually the only meaningful choice. However, option flags can " "also be passed to functions that run doctests, establishing different " "defaults. In such cases, disabling an option via ``-`` in a directive can " "be useful." msgstr "" "Tenga en cuenta que ya que todas las opciones están deshabilitadas por " "defecto, y las directivas sólo aplican a los ejemplos en los que aparecen, " "habilitarlas (a través de ``+`` en la directiva) usualmente es la única " "opción significativa. Sin embargo, las banderas de opciones también pueden " "ser pasadas a funciones que ejecutan doctests, estableciendo valores por " "defecto diferentes. En tales casos, deshabilitar una opción a través de ``-" "`` en una directiva puede ser útil." #: ../Doc/library/doctest.rst:771 msgid "Warnings" msgstr "Advertencias" #: ../Doc/library/doctest.rst:773 msgid "" ":mod:`doctest` is serious about requiring exact matches in expected output. " "If even a single character doesn't match, the test fails. This will " "probably surprise you a few times, as you learn exactly what Python does and " "doesn't guarantee about output. For example, when printing a set, Python " "doesn't guarantee that the element is printed in any particular order, so a " "test like ::" msgstr "" ":mod:`doctest` es serio acerca de requerir coincidencias exactas en la " "salida esperada. Si incluso un solo carácter no coincide, el test falla. " "Esto probablemente te sorprenderá algunas veces, mientras aprendes " "exactamente lo que Python asegura y no asegura sobre la salida. Por ejemplo, " "cuando se imprime un conjunto, Python no asegura que el elemento sea impreso " "en ningún orden particular, por lo que una prueba como ::" #: ../Doc/library/doctest.rst:782 msgid "is vulnerable! One workaround is to do ::" msgstr "¡es vulnerable! Una solución puede ser hacer ::" #: ../Doc/library/doctest.rst:787 msgid "instead. Another is to do ::" msgstr "es su lugar. Otra es hacer ::" #: ../Doc/library/doctest.rst:793 msgid "There are others, but you get the idea." msgstr "Existen otros casos, pero ya captas la idea." #: ../Doc/library/doctest.rst:795 #, fuzzy msgid "Another bad idea is to print things that embed an object address, like" msgstr "" "Otra mala idea es imprimir cosas que incorporan una dirección de un objeto, " "como ::" #: ../Doc/library/doctest.rst:805 #, fuzzy msgid "" "The :const:`ELLIPSIS` directive gives a nice approach for the last example:" msgstr "" "La directiva :const:`ELLIPSIS` da un buen enfoque para el último ejemplo::" #: ../Doc/library/doctest.rst:813 msgid "" "Floating-point numbers are also subject to small output variations across " "platforms, because Python defers to the platform C library for float " "formatting, and C libraries vary widely in quality here. ::" msgstr "" "Los números de coma flotante también son sujetos a pequeñas variaciones de " "la salida a través de las plataformas, porque Python defiere a la librería C " "de la plataforma para el formato de flotantes, y las librerías de C varían " "extensamente en calidad aquí. ::" #: ../Doc/library/doctest.rst:824 msgid "" "Numbers of the form ``I/2.**J`` are safe across all platforms, and I often " "contrive doctest examples to produce numbers of that form::" msgstr "" "Números de la forma ``I/2.**J`` son seguros a lo largo de todas las " "plataformas, y yo frecuentemente planeo ejemplos de doctest para producir " "números de esa forma::" #: ../Doc/library/doctest.rst:830 msgid "" "Simple fractions are also easier for people to understand, and that makes " "for better documentation." msgstr "" "Las facciones simples también son más fáciles de entender para las personas, " "y eso conduce a una mejor documentación." #: ../Doc/library/doctest.rst:837 msgid "Basic API" msgstr "API básica" #: ../Doc/library/doctest.rst:839 msgid "" "The functions :func:`testmod` and :func:`testfile` provide a simple " "interface to doctest that should be sufficient for most basic uses. For a " "less formal introduction to these two functions, see sections :ref:`doctest-" "simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" "Las funciones :func:`testmod` y :func:`testfile` proporcionan una interfaz " "simple para doctest que debe ser suficiente para la mayoría de los usos " "básicos. Para una introducción menos formal a estas funciones, véase las " "secciones :ref:`doctest-simple-testmod` y :ref:`doctest-simple-testfile`." #: ../Doc/library/doctest.rst:847 msgid "" "All arguments except *filename* are optional, and should be specified in " "keyword form." msgstr "" "Todos los argumentos excepto *filename* son opcionales, y deben ser " "especificados en forma de palabras claves." #: ../Doc/library/doctest.rst:850 msgid "" "Test examples in the file named *filename*. Return ``(failure_count, " "test_count)``." msgstr "" "Prueba los ejemplos en el archivo con nombre *filename*. Retorna " "``(failure_count, test_count)``." #: ../Doc/library/doctest.rst:853 msgid "" "Optional argument *module_relative* specifies how the filename should be " "interpreted:" msgstr "" "El argumento opcional *module_relative* especifica cómo el nombre de archivo " "debe ser interpretado:" #: ../Doc/library/doctest.rst:856 msgid "" "If *module_relative* is ``True`` (the default), then *filename* specifies an " "OS-independent module-relative path. By default, this path is relative to " "the calling module's directory; but if the *package* argument is specified, " "then it is relative to that package. To ensure OS-independence, *filename* " "should use ``/`` characters to separate path segments, and may not be an " "absolute path (i.e., it may not begin with ``/``)." msgstr "" "Si *module_relative* es ``True`` (el valor por defecto), entonces *filename* " "especifica una ruta relativa al módulo que es independiente del SO. Por " "defecto, esta ruta es relativa al directorio del módulo que lo invoca; pero " "si el argumento *package* es especificado, entonces es relativo a ese " "paquete. Para asegurar la independencia del SO, *filename* debe usar " "caracteres ``/`` para separar segmentos, y no puede ser una ruta absoluta " "(por ejemplo., no puede empezar con ``/``)." #: ../Doc/library/doctest.rst:863 msgid "" "If *module_relative* is ``False``, then *filename* specifies an OS-specific " "path. The path may be absolute or relative; relative paths are resolved " "with respect to the current working directory." msgstr "" "Si *module_relative* es ``False``, entonces *filename* especifica una ruta " "especifica del SO. La ruta puede ser absoluta o relativa; las rutas " "relativas son resueltas con respecto al directorio de trabajo actual." #: ../Doc/library/doctest.rst:867 msgid "" "Optional argument *name* gives the name of the test; by default, or if " "``None``, ``os.path.basename(filename)`` is used." msgstr "" "El argumento opcional *name* proporciona el nombre de la prueba; por " "defecto, o si es ``None``, se usa ``os.path.basename(filename)``." #: ../Doc/library/doctest.rst:870 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for a module-" "relative filename. If no package is specified, then the calling module's " "directory is used as the base directory for module-relative filenames. It " "is an error to specify *package* if *module_relative* is ``False``." msgstr "" "El argumento opcional *package* es un paquete de Python o el nombre de una " "paquete de Python cuyo directorio debe ser usado como el directorio base " "para un nombre de archivo relativo al módulo. Si no se especifica ningún " "paquete, entonces el directorio del módulo que invoca se usa como el " "directorio base para los nombres de archivos relativos al módulo. Es un " "error especificar *package* si *module_relative* es ``False``." #: ../Doc/library/doctest.rst:876 msgid "" "Optional argument *globs* gives a dict to be used as the globals when " "executing examples. A new shallow copy of this dict is created for the " "doctest, so its examples start with a clean slate. By default, or if " "``None``, a new empty dict is used." msgstr "" "El argumento opcional *globs* proporciona un diccionario a ser usado como " "los globales cuando se ejecuten los ejemplos. Se crea una nueva copia " "superficial de este diccionario para el doctest, por lo que sus ejemplos " "empiezan con una pizarra en blanco. Por defecto, o si es ``None``, se usa un " "nuevo diccionario vacío." #: ../Doc/library/doctest.rst:881 msgid "" "Optional argument *extraglobs* gives a dict merged into the globals used to " "execute examples. This works like :meth:`dict.update`: if *globs* and " "*extraglobs* have a common key, the associated value in *extraglobs* appears " "in the combined dict. By default, or if ``None``, no extra globals are " "used. This is an advanced feature that allows parameterization of " "doctests. For example, a doctest can be written for a base class, using a " "generic name for the class, then reused to test any number of subclasses by " "passing an *extraglobs* dict mapping the generic name to the subclass to be " "tested." msgstr "" "El argumento opcional *extraglobs* proporciona un diccionario mezclado con " "los globales usados para ejecutar ejemplos. Funciona como :meth:`dict." "update`: si *globs* y *extraglobs* tienen una clave en común, el valor " "asociado en *extraglobs* aparece en el diccionario combinado. Por defecto, o " "si es ``None``, no se usa ninguna variable global. Es una característica " "avanzada que permite la parametrización de doctests. Por ejemplo, un doctest " "puede ser escribo para una clase base, usando un nombre genérico para la " "clase, y luego reusado para probar cualquier número de clases heredadas al " "pasar un diccionario de *extraglobs* mapeando el nombre genérico a la clase " "heredada para ser probada." #: ../Doc/library/doctest.rst:890 msgid "" "Optional argument *verbose* prints lots of stuff if true, and prints only " "failures if false; by default, or if ``None``, it's true if and only if ``'-" "v'`` is in ``sys.argv``." msgstr "" "El argumento opcional *verbose* imprime un montón de cosas si es verdadero, " "e imprime sólo las fallas si es falso; por defecto, o si es ``None``, es " "verdadero si y sólo si ``'-v'`` está en ``sys.argv``." #: ../Doc/library/doctest.rst:894 msgid "" "Optional argument *report* prints a summary at the end when true, else " "prints nothing at the end. In verbose mode, the summary is detailed, else " "the summary is very brief (in fact, empty if all tests passed)." msgstr "" "El argumento opcional *report* imprime un resumen al final cuando es " "verdadero; si no, no imprime nada al final. En modo verboso (*verbose*), el " "resumen es detallado; si no, el resumen es muy corto (de hecho, vacío si " "todos las pruebas pasan)." #: ../Doc/library/doctest.rst:898 msgid "" "Optional argument *optionflags* (default value 0) takes the :ref:`bitwise OR " "` of option flags. See section :ref:`doctest-options`." msgstr "" "El argumento opcional *optionflags* (valor por defecto 0) toma las banderas " "de opciones :ref:`juntadas lógicamente por un OR `. Véase la " "sección :ref:`doctest-options`." #: ../Doc/library/doctest.rst:902 msgid "" "Optional argument *raise_on_error* defaults to false. If true, an exception " "is raised upon the first failure or unexpected exception in an example. " "This allows failures to be post-mortem debugged. Default behavior is to " "continue running examples." msgstr "" "El argumento opcional *raise_on_error* tiene como valor por defecto *false*. " "Si es *true*, se lanza una excepción sobre la primera falla o excepción no " "esperada en un ejemplo. Esto permite que los fallos sean depurados en un " "análisis a posteriori. El comportamiento por defecto es continuar corriendo " "los ejemplos." #: ../Doc/library/doctest.rst:907 ../Doc/library/doctest.rst:1047 msgid "" "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " "that should be used to extract tests from the files. It defaults to a " "normal parser (i.e., ``DocTestParser()``)." msgstr "" "El argumento opcional *parser* especifica un :class:`DocTestParser` (o " "subclase) que debe ser usado para extraer las pruebas de los archivos. Su " "valor por defecto es un analizador sintáctico normal (i.e., " "``DocTestParser()``)." #: ../Doc/library/doctest.rst:911 ../Doc/library/doctest.rst:1051 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." msgstr "" "El argumento opcional *encoding* especifica una codificación que debe ser " "usada para convertir el archivo a *unicode*." #: ../Doc/library/doctest.rst:917 msgid "" "All arguments are optional, and all except for *m* should be specified in " "keyword form." msgstr "" "Todos los argumentos son opcionales, y todos excepto por *m* deben ser " "especificados en forma de palabras claves." #: ../Doc/library/doctest.rst:920 msgid "" "Test examples in docstrings in functions and classes reachable from module " "*m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), " "starting with ``m.__doc__``." msgstr "" "Prueba los ejemplos en los docstring de las funciones y clases alcanzables " "desde el módulo *m* (o desde el módulo :mod:`__main__` si *m* no es " "proporcionado o es ``None``), empezando con ``m.__doc__``." #: ../Doc/library/doctest.rst:924 msgid "" "Also test examples reachable from dict ``m.__test__``, if it exists and is " "not ``None``. ``m.__test__`` maps names (strings) to functions, classes and " "strings; function and class docstrings are searched for examples; strings " "are searched directly, as if they were docstrings." msgstr "" "También prueba los ejemplos alcanzables desde el diccionario de ``m." "__test__``, si existe y no es ``None``. ``m.__test__`` mapea los nombres " "(cadenas de caracteres) a funciones, clases y cadenas de caracteres; se " "buscan los ejemplos de las funciones y clases; se buscan las cadenas de " "caracteres directamente como si fueran docstrings." #: ../Doc/library/doctest.rst:929 msgid "" "Only docstrings attached to objects belonging to module *m* are searched." msgstr "" "Sólo se buscan los docstrings anexados a los objetos pertenecientes al " "módulo *m*." #: ../Doc/library/doctest.rst:931 msgid "Return ``(failure_count, test_count)``." msgstr "Retorna ``(failure_count, test_count)``." #: ../Doc/library/doctest.rst:933 msgid "" "Optional argument *name* gives the name of the module; by default, or if " "``None``, ``m.__name__`` is used." msgstr "" "El argumento opcional *name* proporciona el nombre del módulo; por defecto, " "o si es ``None``, se usa ``m.__name__``." #: ../Doc/library/doctest.rst:936 msgid "" "Optional argument *exclude_empty* defaults to false. If true, objects for " "which no doctests are found are excluded from consideration. The default is " "a backward compatibility hack, so that code still using :meth:`doctest." "master.summarize` in conjunction with :func:`testmod` continues to get " "output for objects with no tests. The *exclude_empty* argument to the newer :" "class:`DocTestFinder` constructor defaults to true." msgstr "" "El argumento opcional *exclude_empty* es por defecto *false*. Si es " "verdadero, se excluyen los objetos por los cuales no se encuentren doctest. " "El valor por defecto es un *hack* de compatibilidad hacia atrás, por lo que " "el código que use :meth:`doctest.master.summarize` en conjunto con :func:" "`testmod` continua obteniendo la salida para objetos sin pruebas. El " "argumento *exclude_empty* para el más nuevo constructor :class:" "`DocTestFinder` es por defecto verdadero." #: ../Doc/library/doctest.rst:943 msgid "" "Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, " "*raise_on_error*, and *globs* are the same as for function :func:`testfile` " "above, except that *globs* defaults to ``m.__dict__``." msgstr "" "Los argumentos opcionales *extraglobs*, *verbose*, *report*, *optionflags*, " "*raise_on_error*, y *globs* son los mismos en cuanto a la función :func:" "`testfile` arriba, excepto que *globs* es por defecto ``m.__dict__``." #: ../Doc/library/doctest.rst:950 msgid "" "Test examples associated with object *f*; for example, *f* may be a string, " "a module, a function, or a class object." msgstr "" "Prueba los ejemplos asociados con el objeto *f*; por ejemplo, *f* puede ser " "una cadena de caracteres, un módulo, una función, o un objeto clase." #: ../Doc/library/doctest.rst:953 msgid "" "A shallow copy of dictionary argument *globs* is used for the execution " "context." msgstr "" "Una copia superficial del diccionario del argumento *globs* se usa para la " "ejecución del contexto." #: ../Doc/library/doctest.rst:955 msgid "" "Optional argument *name* is used in failure messages, and defaults to " "``\"NoName\"``." msgstr "" "Se usa el argumento opcional *name* en mensajes de fallos, y por defecto es " "``\"NoName\"``." #: ../Doc/library/doctest.rst:958 msgid "" "If optional argument *verbose* is true, output is generated even if there " "are no failures. By default, output is generated only in case of an example " "failure." msgstr "" "Si el argumento opcional *verbose* es verdadero, la salida se genera incluso " "si no hay fallas. Por defecto, la salida se genera sólo en caso de la falla " "de un ejemplo." #: ../Doc/library/doctest.rst:961 msgid "" "Optional argument *compileflags* gives the set of flags that should be used " "by the Python compiler when running the examples. By default, or if " "``None``, flags are deduced corresponding to the set of future features " "found in *globs*." msgstr "" "El argumento opcional *compileflags* proporciona el conjunto de banderas que " "se deben usar por el compilador de Python cuando se corran los ejemplos. Por " "defecto, o si es ``None``, las banderas se deducen correspondiendo al " "conjunto de características futuras encontradas en *globs*." #: ../Doc/library/doctest.rst:965 msgid "" "Optional argument *optionflags* works as for function :func:`testfile` above." msgstr "" "El argumento opcional *optionflags* trabaja con respecto a la función :func:" "`testfile` de arriba." #: ../Doc/library/doctest.rst:971 msgid "Unittest API" msgstr "API de unittest" #: ../Doc/library/doctest.rst:973 msgid "" "As your collection of doctest'ed modules grows, you'll want a way to run all " "their doctests systematically. :mod:`doctest` provides two functions that " "can be used to create :mod:`unittest` test suites from modules and text " "files containing doctests. To integrate with :mod:`unittest` test " "discovery, include a :func:`load_tests` function in your test module::" msgstr "" "Mientras crece tu colección de módulos probados con doctest, vas a querer " "una forma de ejecutar todos sus doctests sistemáticamente. :mod:`doctest` " "proporciona dos funciones que se pueden usar para crear un banco de pruebas " "(*test suite*) de :mod:`unittest` desde módulos y archivos de texto que " "contienen doctests. Para integrarse con el descubrimiento de pruebas de :mod:" "`unittest` , incluye una función :func:`load_tests` en tu módulo de " "pruebas::" #: ../Doc/library/doctest.rst:987 msgid "" "There are two main functions for creating :class:`unittest.TestSuite` " "instances from text files and modules with doctests:" msgstr "" "Hay dos funciones principales para crear instancias de :class:`unittest." "TestSuite` desde los archivos de texto y módulos con doctests:" #: ../Doc/library/doctest.rst:993 msgid "" "Convert doctest tests from one or more text files to a :class:`unittest." "TestSuite`." msgstr "" "Convierte las pruebas de doctest de uno o más archivos de texto a una :class:" "`unittest.TestSuite`." #: ../Doc/library/doctest.rst:996 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs the interactive examples in each file. If an example in " "any file fails, then the synthesized unit test fails, and a :exc:" "`failureException` exception is raised showing the name of the file " "containing the test and a (sometimes approximate) line number." msgstr "" "El :class:`unittest.TestSuite` que se retorne será ejecutado por el " "framework de unittest y ejecuta los ejemplos interactivos en cada archivo. " "Si un ejemplo en cualquier archivo falla, entonces la prueba unitaria " "sintetizada falla, y una excepción :exc:`failureException` se lanza " "mostrando el nombre del archivo conteniendo la prueba y un número de línea " "(algunas veces aproximado)." #: ../Doc/library/doctest.rst:1002 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" "Pasa una o más rutas (como cadenas de caracteres) a archivos de texto para " "ser examinados." #: ../Doc/library/doctest.rst:1004 msgid "Options may be provided as keyword arguments:" msgstr "Se pueden proporcionar las opciones como argumentos por palabra clave:" #: ../Doc/library/doctest.rst:1006 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" "El argumento opcional *module_relative* especifica cómo los nombres de " "archivos en *paths* se deben interpretar:" #: ../Doc/library/doctest.rst:1009 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " "path is relative to the calling module's directory; but if the *package* " "argument is specified, then it is relative to that package. To ensure OS-" "independence, each filename should use ``/`` characters to separate path " "segments, and may not be an absolute path (i.e., it may not begin with ``/" "``)." msgstr "" "Si *module_relative* is ``True`` (el valor por defecto), entonces cada " "archivo de nombre en *paths* especifica una ruta relativa al módulo " "independiente del SO. Por defecto, esta ruta es relativa al directorio del " "módulo lo está invocando; pero si se especifica el argumento *package*, " "entonces es relativo a ese paquete. Para asegurar la independencia del SO, " "cada nombre de archivo debe usar caracteres ``/`` para separar los segmentos " "de rutas, y puede no ser una ruta absoluta (i.e., puede no empezar con ``/" "``)." #: ../Doc/library/doctest.rst:1017 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" "Si *module_relative* es ``False``, entonces cada archivo de nombre en " "*paths* especifica una ruta especifica al SO. La ruta puede ser absoluta o " "relativa; las rutas relativas son resueltas con respecto a directorio de " "trabajo actual." #: ../Doc/library/doctest.rst:1021 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for module-" "relative filenames in *paths*. If no package is specified, then the calling " "module's directory is used as the base directory for module-relative " "filenames. It is an error to specify *package* if *module_relative* is " "``False``." msgstr "" "El argumento opcional *package* es un paquete de Python o el nombre de un " "paquete de Python cuyo directorio debe ser usado como el directorio base " "para los nombres de archivos relativos al módulo en *paths*. Si no se " "especifica ningún paquete, entonces el directorio del módulo que lo está " "invocando se usa como el directorio base para los archivos de nombres " "relativos al módulo. Es un error especificar *package* si *module_relative* " "es ``False``." #: ../Doc/library/doctest.rst:1028 msgid "" "Optional argument *setUp* specifies a set-up function for the test suite. " "This is called before running the tests in each file. The *setUp* function " "will be passed a :class:`DocTest` object. The setUp function can access the " "test globals as the *globs* attribute of the test passed." msgstr "" "El argumento opcional *setUp* especifica una función de configuración para " "el banco de pruebas. Es invocado antes de ejecutar las pruebas en cada " "archivo. La función *setUp* se pasará a un objeto :class:`DocTest`. La " "función *setUp* puede acceder a las variables globales de prueba como el " "atributo *globs* de la prueba pasada." #: ../Doc/library/doctest.rst:1033 msgid "" "Optional argument *tearDown* specifies a tear-down function for the test " "suite. This is called after running the tests in each file. The *tearDown* " "function will be passed a :class:`DocTest` object. The setUp function can " "access the test globals as the *globs* attribute of the test passed." msgstr "" "El argumento opcional *tearDown* especifica una función de destrucción para " "el banco de pruebas. Es invocado después de ejecutar las pruebas en cada " "archivo. Se pasará un objeto :class:`DocTest` a la función *tearDown*. La " "función *setUp* de configuración puede acceder a los globales de la prueba " "como el atributo *globs* de la prueba pasada." #: ../Doc/library/doctest.rst:1038 ../Doc/library/doctest.rst:1072 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is a new empty dictionary." msgstr "" "El argumento opcional *globs* es un diccionario que contiene las variables " "globales iniciales para las pruebas. Se crea una nueva copia de este " "diccionario para cada prueba. Por defecto, *globs* es un nuevo diccionario " "vacío." #: ../Doc/library/doctest.rst:1042 msgid "" "Optional argument *optionflags* specifies the default doctest options for " "the tests, created by or-ing together individual option flags. See section :" "ref:`doctest-options`. See function :func:`set_unittest_reportflags` below " "for a better way to set reporting options." msgstr "" "El argumento opcional *optionflags* especifica las opciones de doctest por " "defecto para las pruebas, creado al juntar lógicamente las opciones de " "bandera individuales. Véase la sección :ref:`doctest-options`. Véase la " "función :func:`set_unittest_reportflags` abajo para una mejor manera de " "definir las opciones de informe." #: ../Doc/library/doctest.rst:1054 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" "Se añade el global ``__file__`` a los globales proporcionados a los doctests " "cargados desde un archivo de texto usando :func:`DocFileSuite`." #: ../Doc/library/doctest.rst:1060 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" "Convierte las pruebas de doctest para un módulo a un :class:`unittest." "TestSuite`." #: ../Doc/library/doctest.rst:1062 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs each doctest in the module. If any of the doctests fail, " "then the synthesized unit test fails, and a :exc:`failureException` " "exception is raised showing the name of the file containing the test and a " "(sometimes approximate) line number." msgstr "" "El :class:`unittest.TestSuite` que se retorne será ejecutado por el " "framework de unittest y corre cada doctest en el módulo. Si cualquiera de " "los doctests falla, entonces la prueba unitaria combinada falla, y se lanza " "una excepción :exc:`failureException` mostrando el nombre del archivo que " "contiene la prueba y un número de línea (a veces aproximado)." #: ../Doc/library/doctest.rst:1068 msgid "" "Optional argument *module* provides the module to be tested. It can be a " "module object or a (possibly dotted) module name. If not specified, the " "module calling this function is used." msgstr "" "El argumento opcional *module* proporciona el módulo a probar. Puede ser un " "objeto de módulo o un nombre (posiblemente punteado) de módulo. Si no se " "especifica, se usa el módulo que invoca esta función." #: ../Doc/library/doctest.rst:1076 msgid "" "Optional argument *extraglobs* specifies an extra set of global variables, " "which is merged into *globs*. By default, no extra globals are used." msgstr "" "El argumento opcional *extraglobs* especifica un conjunto de variables " "globales adicionales que son mezcladas con *globs*. Por defecto, no se usa " "ningún global adicional." #: ../Doc/library/doctest.rst:1079 msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" "El argumento opcional *test_finder* es el objeto :class:`DocTestFinder` (o " "un reemplazo directo) que se usa para extraer doctests desde el módulo." #: ../Doc/library/doctest.rst:1082 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " "for function :func:`DocFileSuite` above." msgstr "" "Los argumentos opcionales *setUp*, *tearDown*, y *optionflags* son lo mismo " "con respecto a la función :func:`DocFileSuite` arriba." #: ../Doc/library/doctest.rst:1085 msgid "This function uses the same search technique as :func:`testmod`." msgstr "Esta función usa la misma técnica de búsqueda que :func:`testmod`." #: ../Doc/library/doctest.rst:1087 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" ":func:`DocTestSuite` retorna un :class:`unittest.TestSuite` vacío si " "*module* no contiene ningún docstring en vez de lanzar un :exc:`ValueError`." #: ../Doc/library/doctest.rst:1092 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`doctest.DocTestCase` instances, and :class:`DocTestCase` is a " "subclass of :class:`unittest.TestCase`. :class:`DocTestCase` isn't " "documented here (it's an internal detail), but studying its code can answer " "questions about the exact details of :mod:`unittest` integration." msgstr "" "Por detrás, :func:`DocTestSuite` crea un :class:`unittest.TestSuite` de las " "instancias de :class:`doctest.DocTestCase`, y :class:`DocTestCase` es una " "subclase de :class:`unittest.TestCase`. :class:`DocTestCase` no está " "documentado aquí (es un detalle interno), pero estudiar su código puede " "responder preguntas sobre los detalles exactos de la integración de :mod:" "`unittest`." #: ../Doc/library/doctest.rst:1098 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`doctest.DocFileCase` instances, and :class:`DocFileCase` is a " "subclass of :class:`DocTestCase`." msgstr "" "De manera similar, :func:`DocFileSuite` crea un :class:`unittest.TestSuite` " "de las instancias de :class:`doctest.DocFileCase`, y :class:`DocFileCase` es " "una subclase de :class:`DocTestCase`." #: ../Doc/library/doctest.rst:1102 msgid "" "So both ways of creating a :class:`unittest.TestSuite` run instances of :" "class:`DocTestCase`. This is important for a subtle reason: when you run :" "mod:`doctest` functions yourself, you can control the :mod:`doctest` options " "in use directly, by passing option flags to :mod:`doctest` functions. " "However, if you're writing a :mod:`unittest` framework, :mod:`unittest` " "ultimately controls when and how tests get run. The framework author " "typically wants to control :mod:`doctest` reporting options (perhaps, e.g., " "specified by command line options), but there's no way to pass options " "through :mod:`unittest` to :mod:`doctest` test runners." msgstr "" "Por lo que ambas formas de crear un :class:`unittest.TestSuite` ejecutan " "instancias de :class:`DocTestCase`. Esto es importante por una razón sutil: " "cuando ejecutas las funciones de :mod:`doctest` por ti mismo, puedes " "controlar las opciones de :mod:`doctest` en uso directamente, al pasar las " "banderas de opciones a las funciones de :mod:`doctest`. Sin embargo, si " "estás escribiendo un framework de :mod:`unittest`, básicamente :mod:" "`unittest` controla cuándo y cómo se ejecutan las pruebas. El autor del " "framework típicamente, quiere controlar las opciones de reporte de :mod:" "`doctest` (quizás, p.ej., especificadas por las opciones de la línea de " "comandos), pero no hay forma de pasar opciones a través de :mod:`unittest` " "al probador de ejecución (*test runner*) de :mod:`doctest`." #: ../Doc/library/doctest.rst:1112 msgid "" "For this reason, :mod:`doctest` also supports a notion of :mod:`doctest` " "reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" "Por esta razón, :mod:`doctest` también admite una noción de banderas de " "informe de :mod:`doctest` específicas para la compatibilidad con :mod:" "`unittest`, a través de esta función:" #: ../Doc/library/doctest.rst:1118 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "Establece las banderas de informe de :mod:`doctest` a usar." #: ../Doc/library/doctest.rst:1120 msgid "" "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " "section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" "El argumento *flags* toma la :ref:`combinación por el operador OR ` " "de las banderas de opciones. Véase la sección :ref:`doctest-options`. Sólo " "se pueden usar las \"banderas de informe\"." #: ../Doc/library/doctest.rst:1123 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`runTest` method of :class:`DocTestCase` " "looks at the option flags specified for the test case when the :class:" "`DocTestCase` instance was constructed. If no reporting flags were " "specified (which is the typical and expected case), :mod:`doctest`'s :mod:" "`unittest` reporting flags are :ref:`bitwise ORed ` into the option " "flags, and the option flags so augmented are passed to the :class:" "`DocTestRunner` instance created to run the doctest. If any reporting flags " "were specified when the :class:`DocTestCase` instance was constructed, :mod:" "`doctest`'s :mod:`unittest` reporting flags are ignored." msgstr "" "Esta es una configuración global del módulo, y afecta a todos los doctests " "futuros a ejecutar por :mod:`unittest`: el método :meth:`runTest` de :class:" "`DocTestCase` revisa las banderas de opciones especificadas para el caso de " "prueba cuando la instancia de :class:`DocTestCase` fue construida. Si no se " "especificó ninguna bandera de informe (que es el caso típico y esperado), " "las banderas de informe -pertenecientes a :mod:`doctest`- de :mod:`unittest` " "son :ref:`combinadas por la operación Or ` en las banderas de " "opciones, y las banderas de opciones aumentadas se pasan a la instancia de :" "class:`DocTestRunner` creada para ejecutar los doctest. Si se especificó " "alguna bandera de informe cuando el :class:`DocTestCase` fue construido, se " "ignoran las banderas de informe -pertenecientes a :mod:`doctest`- de :mod:" "`unittest`." #: ../Doc/library/doctest.rst:1134 msgid "" "The value of the :mod:`unittest` reporting flags in effect before the " "function was called is returned by the function." msgstr "" "La función retorna el valor de las banderas de informe de :mod:`unittest` en " "efecto antes de que la función fuera invocada." #: ../Doc/library/doctest.rst:1141 msgid "Advanced API" msgstr "API avanzada" #: ../Doc/library/doctest.rst:1143 msgid "" "The basic API is a simple wrapper that's intended to make doctest easy to " "use. It is fairly flexible, and should meet most users' needs; however, if " "you require more fine-grained control over testing, or wish to extend " "doctest's capabilities, then you should use the advanced API." msgstr "" "La API básica es un simple envoltorio que sirve para hacer los doctest " "fáciles de usar. Es bastante flexible, y debe cumplir las necesidades de la " "mayoría de los usuarios; si requieres un control más preciso en las pruebas, " "o deseas extender las capacidades de doctest, entonces debes usar la API " "avanzada." #: ../Doc/library/doctest.rst:1148 msgid "" "The advanced API revolves around two container classes, which are used to " "store the interactive examples extracted from doctest cases:" msgstr "" "La API avanzada gira en torno a dos clases contenedoras, que se usan para " "guardar los ejemplos interactivos extraídos de los casos doctest:" #: ../Doc/library/doctest.rst:1151 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" ":class:`Example`: Un :term:`statement` de Python, emparejado con su salida " "esperada." #: ../Doc/library/doctest.rst:1154 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" ":class:`DocTest`: Una colección de clases :class:`Example`, típicamente " "extraídos de un sólo docstring o archivo de texto." #: ../Doc/library/doctest.rst:1157 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" "Se definen clases de procesamiento adicionales para encontrar, analizar " "sintácticamente, y ejecutar, y comprobar ejemplos de doctest:" #: ../Doc/library/doctest.rst:1160 msgid "" ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" "class:`DocTestParser` to create a :class:`DocTest` from every docstring that " "contains interactive examples." msgstr "" ":class:`DocTestFinder`: Encuentra todos los docstrings en un módulo dado, y " "usa un :class:`DocTestParser` para crear un :class:`DocTest` de cada " "docstring que contiene ejemplos interactivos." #: ../Doc/library/doctest.rst:1164 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" ":class:`DocTestParser`: Crea un objeto :class:`DocTest` de una cadena de " "caracteres (tal como un docstring de un objeto)." #: ../Doc/library/doctest.rst:1167 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" ":class:`DocTestRunner`: Ejecuta los ejemplos en un :class:`DocTest`, y usa " "un :class:`OutputChecker` para verificar su salida." #: ../Doc/library/doctest.rst:1170 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" ":class:`OutputChecker`: Compara la salida real de un ejemplo de doctest con " "la salida esperada, y decide si coinciden." #: ../Doc/library/doctest.rst:1173 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" "Las relaciones entre estas clases de procesamiento se resumen en el " "siguiente diagrama::" #: ../Doc/library/doctest.rst:1189 msgid "DocTest Objects" msgstr "Objetos DocTest" #: ../Doc/library/doctest.rst:1194 msgid "" "A collection of doctest examples that should be run in a single namespace. " "The constructor arguments are used to initialize the attributes of the same " "names." msgstr "" "Una colección de ejemplos de doctest que deben ejecutarse en un sólo nombre " "de espacios. Se usan los argumentos del constructor para inicializar los " "atributos de los mismos nombres." #: ../Doc/library/doctest.rst:1198 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" ":class:`DocTest` define los siguientes atributos. Son inicializados por el " "constructor, y no deben ser modificados directamente." #: ../Doc/library/doctest.rst:1204 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" "Una lista de objetos :class:`Example` codificando los ejemplos interactivos " "de Python individuales que esta prueba debe ejecutar." #: ../Doc/library/doctest.rst:1210 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " "the examples (such as binding new variables) will be reflected in :attr:" "`globs` after the test is run." msgstr "" "El nombre de espacios (alias *globals*) en que los ejemplos se deben " "ejecutar. Este es un diccionario que mapea nombres a valores. Cualquier " "cambio al nombre de espacios hecho por los ejemplos (tal como juntar nuevas " "variables) se reflejará en :attr:`globs` después de que se ejecute la prueba." #: ../Doc/library/doctest.rst:1218 msgid "" "A string name identifying the :class:`DocTest`. Typically, this is the name " "of the object or file that the test was extracted from." msgstr "" "Un nombre de cadena de caracteres que identifica el :class:`DocTest`. " "Normalmente, este es el nombre del objeto o archivo del que se extrajo la " "prueba." #: ../Doc/library/doctest.rst:1224 msgid "" "The name of the file that this :class:`DocTest` was extracted from; or " "``None`` if the filename is unknown, or if the :class:`DocTest` was not " "extracted from a file." msgstr "" "El nombre del archivo del que se extrajo este :class:`DocTest`; o ``None`` " "si el nombre del archivo se desconoce, o si :class:`DocTest` no se extrajo " "de un archivo." #: ../Doc/library/doctest.rst:1231 msgid "" "The line number within :attr:`filename` where this :class:`DocTest` begins, " "or ``None`` if the line number is unavailable. This line number is zero-" "based with respect to the beginning of the file." msgstr "" "El número de línea dentro de :attr:`filename` donde este :class:`DocTest` " "comienza, o ``None`` si el número de línea no está disponible. Este número " "de línea es comienza en 0 con respecto al comienzo del archivo." #: ../Doc/library/doctest.rst:1238 msgid "" "The string that the test was extracted from, or ``None`` if the string is " "unavailable, or if the test was not extracted from a string." msgstr "" "La cadena de caracteres del que se extrajo la cadena, o ``None`` si la " "cadena no está disponible, o si la prueba no se extrajo de una cadena de " "caracteres." # Estoy poniendo Example sin traducir porque hace referencia a la clase # :class:`Example` que envuelve los ejemplos interactivos. #: ../Doc/library/doctest.rst:1245 msgid "Example Objects" msgstr "Objetos *Example*" #: ../Doc/library/doctest.rst:1250 msgid "" "A single interactive example, consisting of a Python statement and its " "expected output. The constructor arguments are used to initialize the " "attributes of the same names." msgstr "" "Un sólo ejemplo interactivo, que consta de una sentencia de Python y su " "salida esperada. Los argumentos del constructor se usan para inicializar los " "atributos del mismo nombre." #: ../Doc/library/doctest.rst:1255 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" "La clase :class:`Example` define los siguientes atributos. Son inicializados " "por el constructor, y no deben ser modificados directamente." #: ../Doc/library/doctest.rst:1261 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" "Una cadena de caracteres que contiene el código fuente del ejemplo. Este " "código fuente consiste de una sola sentencia Python, y siempre termina en " "una nueva línea; el constructor añade una nueva línea cuando sea necesario." #: ../Doc/library/doctest.rst:1268 msgid "" "The expected output from running the example's source code (either from " "stdout, or a traceback in case of exception). :attr:`want` ends with a " "newline unless no output is expected, in which case it's an empty string. " "The constructor adds a newline when necessary." msgstr "" "La salida esperada de ejecutar el código fuente del ejemplo (o desde la " "salida estándar, o un seguimiento en caso de una excepción). :attr:`wants` " "termina con una nueva línea a menos que no se espera ninguna salida, en cuyo " "caso es una cadena vacía. El constructor añade una nueva línea cuando sea " "necesario." #: ../Doc/library/doctest.rst:1276 msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " "exception. This exception message is compared against the return value of :" "func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a newline " "unless it's ``None``. The constructor adds a newline if needed." msgstr "" "El mensaje de excepción que el ejemplo genera, si se espera que el ejemplo " "genere una excepción; o ``None`` si no se espera que genere una excepción. " "Se compara este mensaje de excepción con el valor de retorno de :func:" "`traceback.format_exception_only`. :attr:`exc_msg` termina con una nueva " "línea a menos que sea ``None``. El constructor añade una nueva línea si se " "necesita." #: ../Doc/library/doctest.rst:1285 msgid "" "The line number within the string containing this example where the example " "begins. This line number is zero-based with respect to the beginning of the " "containing string." msgstr "" "El número de línea dentro de la cadena de caracteres que contiene este " "ejemplo donde el ejemplo comienza. Este número de línea comienza en 0 con " "respecto al comienzo de la cadena que lo contiene." #: ../Doc/library/doctest.rst:1292 msgid "" "The example's indentation in the containing string, i.e., the number of " "space characters that precede the example's first prompt." msgstr "" "La sangría del ejemplo en la cadena que lo contiene; i.e., el número de " "caracteres de espacio que preceden la primera entrada del ejemplo." #: ../Doc/library/doctest.rst:1298 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " "contained in this dictionary are left at their default value (as specified " "by the :class:`DocTestRunner`'s :attr:`optionflags`). By default, no options " "are set." msgstr "" "Un diccionario que mapea de las banderas de opciones a ``True`` o ``False``, " "que se usa para anular las opciones por defecto para este ejemplo. Cualquier " "bandera de opción que no contiene este diccionario se deja con su valor por " "defecto (como se especifica por los :attr:`optionflags` de :class:" "`DocTestRunner`). Por defecto, no se establece ninguna opción." #: ../Doc/library/doctest.rst:1307 msgid "DocTestFinder objects" msgstr "Objetos *DocTestFinder*" #: ../Doc/library/doctest.rst:1312 msgid "" "A processing class used to extract the :class:`DocTest`\\ s that are " "relevant to a given object, from its docstring and the docstrings of its " "contained objects. :class:`DocTest`\\ s can be extracted from modules, " "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" "Una clase de procesamiento que se usa para extraer los :class:`DocTest` que " "son relevantes para un objeto dado, desde su docstring y los docstring de " "sus objetos contenidos. Se puede extraer los :class:`DocTest` de los " "módulos, clases, funciones, métodos, métodos estáticos, métodos de clase, y " "propiedades." #: ../Doc/library/doctest.rst:1317 msgid "" "The optional argument *verbose* can be used to display the objects searched " "by the finder. It defaults to ``False`` (no output)." msgstr "" "Se puede usar el argumento opcional *verbose* para mostrar los objetos " "buscados por *finder*. Su valor por defecto es ``False`` (ninguna salida)." #: ../Doc/library/doctest.rst:1320 msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" "El argumento opcional *parser* especifica el objeto :class:`DocTestParser` " "(o un reemplazo directo) que se usa para extraer doctests desde docstrings." #: ../Doc/library/doctest.rst:1323 msgid "" "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " "will only examine the given object, and not any contained objects." msgstr "" "Si el argumento opcional *recurse* es falso, entonces el método :meth:" "`DocTestFinder.find` sólo examinará el objeto dado, y no cualquier objeto " "contenido." #: ../Doc/library/doctest.rst:1326 msgid "" "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." "find` will include tests for objects with empty docstrings." msgstr "" "Si el argumento opcional *exclude_empty* es falso, entonces :meth:" "`DocTestFinder.find` incluirá pruebas para objetos con docstrings vacíos." #: ../Doc/library/doctest.rst:1330 msgid ":class:`DocTestFinder` defines the following method:" msgstr ":class:`DocTestFinder` define los siguientes métodos:" #: ../Doc/library/doctest.rst:1335 msgid "" "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " "docstring, or by any of its contained objects' docstrings." msgstr "" "Retorna una lista de los :class:`Doctest` que se definen por el docstring de " "*obj*, o por cualquiera de los docstring de sus objetos contenidos." #: ../Doc/library/doctest.rst:1338 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" "El argumento opcional *name* especifica el nombre del objeto; este nombre " "será usado para construir los nombres de los :class:`DocTest` retornados. Si " "*name* no se especifica, entonces se usa ``obj.__name__``." #: ../Doc/library/doctest.rst:1342 msgid "" "The optional parameter *module* is the module that contains the given " "object. If the module is not specified or is ``None``, then the test finder " "will attempt to automatically determine the correct module. The object's " "module is used:" msgstr "" "El parámetro opcional *module* es el módulo que contiene el objeto dado. Si " "no se especifica el módulo o si es ``None``, entonces el buscador de pruebas " "tratará de determinar automáticamente el módulo correcto. Se usa el módulo " "del objeto:" #: ../Doc/library/doctest.rst:1346 msgid "As a default namespace, if *globs* is not specified." msgstr "Como un espacio de nombres por defecto, si no se especifica *globs*." #: ../Doc/library/doctest.rst:1348 msgid "" "To prevent the DocTestFinder from extracting DocTests from objects that are " "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" "Para evitar que *DocTestFinder* extraiga DocTests desde objetos que se " "importan desde otros módulos. (Se ignoran objetos contenidos con módulos " "aparte de *module*.)" #: ../Doc/library/doctest.rst:1352 msgid "To find the name of the file containing the object." msgstr "Para encontrar el nombre del archivo conteniendo el objeto." #: ../Doc/library/doctest.rst:1354 msgid "To help find the line number of the object within its file." msgstr "" "Para ayudar a encontrar el número de línea del objeto dentro de su archivo." #: ../Doc/library/doctest.rst:1356 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " "``False``, or is ``None`` but cannot be found automatically, then all " "objects are considered to belong to the (non-existent) module, so all " "contained objects will (recursively) be searched for doctests." msgstr "" "Si *module* es falso, no se hará ningún intento de encontrar el módulo. Es " "poco claro, de uso mayormente para probar doctest en si mismo: si *module* " "es ``False``, o es ``None`` pero no se puede encontrar automáticamente, " "entonces todos los objetos se consideran que pertenecen al módulo " "(inexistente), por lo que todos los objetos contenidos se buscarán " "(recursivamente) por doctests." #: ../Doc/library/doctest.rst:1362 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " "shallow copy of the globals dictionary is created for each :class:`DocTest`. " "If *globs* is not specified, then it defaults to the module's *__dict__*, if " "specified, or ``{}`` otherwise. If *extraglobs* is not specified, then it " "defaults to ``{}``." msgstr "" "Los globales para cada :class:`DocTest` se forma al combinar *globs* y " "*extraglobs* (los enlaces en *extraglobs* anulan los enlaces en *globs*). Se " "crea una nueva copia superficial del diccionario de globales para cada :" "class:`DocTest`. Si *globs* no se especifica, entonces su valor por defecto " "es el *__dict__* del módulo, si se especifica, o es ``{}`` de lo contrario, " "si *extraglobs* no se especifica, entonces su valor por defecto es ``{}``." #: ../Doc/library/doctest.rst:1373 msgid "DocTestParser objects" msgstr "Objetos *DocTestParser*" #: ../Doc/library/doctest.rst:1378 msgid "" "A processing class used to extract interactive examples from a string, and " "use them to create a :class:`DocTest` object." msgstr "" "Un clase de procesamiento usada para extraer ejemplos interactivos de una " "cadena de caracteres, y usarlos para crear un objeto :class:`DocTest`." #: ../Doc/library/doctest.rst:1382 ../Doc/library/doctest.rst:1450 msgid ":class:`DocTestParser` defines the following methods:" msgstr ":class:`DocTestParser` define los siguientes métodos:" #: ../Doc/library/doctest.rst:1387 msgid "" "Extract all doctest examples from the given string, and collect them into a :" "class:`DocTest` object." msgstr "" "Extrae todos los ejemplos de *doctest* de una cadena dada, y los recolecta " "en un objeto :class:`DocTest`." #: ../Doc/library/doctest.rst:1390 msgid "" "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" "`DocTest` object. See the documentation for :class:`DocTest` for more " "information." msgstr "" "*globs*, *name*, *filename*, y *lineno* son atributos para el nuevo objeto :" "class:`DocTest`. Véase la documentación de :class:`DocTest` para más " "información." #: ../Doc/library/doctest.rst:1397 msgid "" "Extract all doctest examples from the given string, and return them as a " "list of :class:`Example` objects. Line numbers are 0-based. The optional " "argument *name* is a name identifying this string, and is only used for " "error messages." msgstr "" "Extrae todos los ejemplos de la cadena de caracteres dada, y los retorna " "como una lista de objetos :class:`Example`. Los números de línea empiezan en " "0. El argumento opcional *name* es una nombre identificando esta cadena, y " "sólo es usada para mensajes de errores." #: ../Doc/library/doctest.rst:1404 msgid "" "Divide the given string into examples and intervening text, and return them " "as a list of alternating :class:`Example`\\ s and strings. Line numbers for " "the :class:`Example`\\ s are 0-based. The optional argument *name* is a " "name identifying this string, and is only used for error messages." msgstr "" "Divide el string dado en ejemplos y texto intermedio, y los retorna como una " "lista que alterna entre objetos :class:`Example` y cadenas de caracteres. " "Los números de línea para los objetos :class:`Example` empiezan en 0. El " "argumento opcional *name* es un nombre identificando esta cadena, y sólo se " "usa en mensajes de error." #: ../Doc/library/doctest.rst:1413 msgid "DocTestRunner objects" msgstr "Objetos *DocTestRunner*" #: ../Doc/library/doctest.rst:1418 msgid "" "A processing class used to execute and verify the interactive examples in a :" "class:`DocTest`." msgstr "" "Una clase de procesamiento usada para ejecutar y verificar los ejemplos " "interactivos en un :class:`DocTest`." #: ../Doc/library/doctest.rst:1421 msgid "" "The comparison between expected outputs and actual outputs is done by an :" "class:`OutputChecker`. This comparison may be customized with a number of " "option flags; see section :ref:`doctest-options` for more information. If " "the option flags are insufficient, then the comparison may also be " "customized by passing a subclass of :class:`OutputChecker` to the " "constructor." msgstr "" "La comparación entre salidas esperadas y salidas reales se hace por un :" "class:`OutputChecker`. Esta comparación puede ser personalizada con un " "número de banderas de opción; véase la sección :ref:`doctest-options` para " "más información. Si las banderas de opción son insuficientes, entonces la " "comparación también puede ser personalizada al pasar una subclase de :class:" "`OutputChecker` al constructor." #: ../Doc/library/doctest.rst:1427 msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`TestRunner.run`; this function will " "be called with strings that should be displayed. It defaults to ``sys." "stdout.write``. If capturing the output is not sufficient, then the display " "output can be also customized by subclassing DocTestRunner, and overriding " "the methods :meth:`report_start`, :meth:`report_success`, :meth:" "`report_unexpected_exception`, and :meth:`report_failure`." msgstr "" "La salida de la pantalla del *test runner* se puede controlar de dos " "maneras. Primero, se puede pasar una función de salida a :meth:`TestRunner." "run`; esta función se invocará con cadenas que deben mostrarse. Su valor por " "defecto es ``sys.stdout.write``. Si no es suficiente capturar el resultado, " "entonces la salida de la pantalla también se puede personalizar al heredar " "de DocTestRunner, y sobreescribir los métodos :meth:`report_start`, :meth:" "`report_success`, :meth:`report_unexpected_exception`, y :meth:" "`report_failure`." #: ../Doc/library/doctest.rst:1435 msgid "" "The optional keyword argument *checker* specifies the :class:`OutputChecker` " "object (or drop-in replacement) that should be used to compare the expected " "outputs to the actual outputs of doctest examples." msgstr "" "El argumento por palabra clave opcional *checker* especifica el objeto :" "class:`OutputChecker` (o un reemplazo directo) que se debe usar para " "comparar las salidas esperadas con las salidas reales de los ejemplos de " "doctest." #: ../Doc/library/doctest.rst:1439 msgid "" "The optional keyword argument *verbose* controls the :class:" "`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " "printed about each example, as it is run. If *verbose* is ``False``, then " "only failures are printed. If *verbose* is unspecified, or ``None``, then " "verbose output is used iff the command-line switch ``-v`` is used." msgstr "" "El argumento por palabra clave opcional *verbose* controla la verbosidad de :" "class:`DocTestRunner`. Si *verbose* es ``True``, entonces la información de " "cada ejemplo se imprime , mientras se ejecuta. Si *verbose* es ``False``, " "entonces sólo las fallas se imprimen. Si *verbose* no se especifica, o es " "``None``, entonces la salida verbosa se usa si y sólo se usa el modificador " "de la línea de comandos``-v``." #: ../Doc/library/doctest.rst:1445 msgid "" "The optional keyword argument *optionflags* can be used to control how the " "test runner compares expected output to actual output, and how it displays " "failures. For more information, see section :ref:`doctest-options`." msgstr "" "El argumento por palabra clave opcional *optionflags* se puede usar para " "controlar cómo el *test runner* compara la salida esperada con una salida " "real, y cómo muestra las fallas. Para más información, véase la sección :ref:" "`doctest-options`." #: ../Doc/library/doctest.rst:1455 msgid "" "Report that the test runner is about to process the given example. This " "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" "Notifica que el *test runner* está a punto de procesar el ejemplo dado. Este " "método es proporcionado para permitir que clases heredadas de :class:" "`DocTestRunner` personalicen su salida; no debe ser invocado directamente." #: ../Doc/library/doctest.rst:1459 msgid "" "*example* is the example about to be processed. *test* is the test " "*containing example*. *out* is the output function that was passed to :meth:" "`DocTestRunner.run`." msgstr "" "*example* es el ejemplo a punto de ser procesado. *test* es la prueba que " "contiene a *example*. *out* es la función de salida que se pasó a :meth:" "`DocTestRunner.run`." #: ../Doc/library/doctest.rst:1466 msgid "" "Report that the given example ran successfully. This method is provided to " "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" "Notifica que el ejemplo dado se ejecutó correctamente. Este método es " "proporcionado para permitir que las clases heredadas de :class:" "`DocTestRunner` personalicen su salida; no debe ser invocado directamente." #: ../Doc/library/doctest.rst:1470 ../Doc/library/doctest.rst:1481 msgid "" "*example* is the example about to be processed. *got* is the actual output " "from the example. *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" "*example* es el ejemplo a punto de ser procesado. *got* es la salida real " "del ejemplo. *test* es la prueba conteniendo *example*. *out* es la función " "de salida que se pasa a :meth:`DocTestRunner.run`." #: ../Doc/library/doctest.rst:1477 msgid "" "Report that the given example failed. This method is provided to allow " "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" "Notifica que el ejemplo dado falló. Este método es proporcionado para " "permitir que clases heredadas de :class:`DocTestRunner` personalicen su " "salida; no debe ser invocado directamente." #: ../Doc/library/doctest.rst:1488 msgid "" "Report that the given example raised an unexpected exception. This method is " "provided to allow subclasses of :class:`DocTestRunner` to customize their " "output; it should not be called directly." msgstr "" "Notifica que el ejemplo dado lanzó una excepción inesperada. Este método es " "proporcionado para permitir que las clases heredadas de :class:" "`DocTestRunner` personalicen su salida; no debe ser invocado directamente." #: ../Doc/library/doctest.rst:1492 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " "containing information about the unexpected exception (as returned by :func:" "`sys.exc_info`). *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" "*example* es el ejemplo a punto de ser procesado, *exc_info* es una tupla " "que contiene información sobre la excepción inesperada (como se retorna por :" "func:`sys.exc_info`). *test* es la prueba conteniendo *example*. *out* es la " "función de salida que debe ser pasada a :meth:`DocTestRunner.run`." #: ../Doc/library/doctest.rst:1500 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " "results using the writer function *out*." msgstr "" "Ejecuta los ejemplos en *test* (un objeto :class:`DocTest`), y muestra los " "resultados usando función de escritura *out*." #: ../Doc/library/doctest.rst:1503 msgid "" "The examples are run in the namespace ``test.globs``. If *clear_globs* is " "true (the default), then this namespace will be cleared after the test runs, " "to help with garbage collection. If you would like to examine the namespace " "after the test completes, then use *clear_globs=False*." msgstr "" "Los ejemplo se ejecutan en el espacio de nombres ``test.globs``. Si " "*clear_globs* es verdadero (el valor por defecto), entonces este espacio de " "nombres será limpiado después de la prueba se ejecute, para ayudar con la " "colección de basura. Si quisieras examinar el espacio de nombres después de " "que la prueba se complete, entonces use *clear_globs=False*." #: ../Doc/library/doctest.rst:1508 msgid "" "*compileflags* gives the set of flags that should be used by the Python " "compiler when running the examples. If not specified, then it will default " "to the set of future-import flags that apply to *globs*." msgstr "" "*compileflags* da el conjunto de banderas que se deben usar por el " "compilador de Python cuando se ejecutan los ejemplos. Si no se especifica, " "entonces su valor por defecto será el conjunto de banderas de *future-" "import* que aplican a *globs*." #: ../Doc/library/doctest.rst:1512 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`DocTestRunner." "report_\\*` methods." msgstr "" "La salida de cada ejemplo es revisada usando el *output checker* del :class:" "`DocTestRunner`, y los resultados se formatean por los métodos de :meth:" "`DocTestRunner.report_\\*`." #: ../Doc/library/doctest.rst:1519 msgid "" "Print a summary of all the test cases that have been run by this " "DocTestRunner, and return a :term:`named tuple` ``TestResults(failed, " "attempted)``." msgstr "" "Imprime un resumen de todos los casos de prueba que han sido ejecutados por " "este *DocTestRunner*, y retorna un :term:`named tuple` ``TestResults(failed, " "attempted)``." #: ../Doc/library/doctest.rst:1522 msgid "" "The optional *verbose* argument controls how detailed the summary is. If " "the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " "is used." msgstr "" "El argumento opcional *verbose* controla qué tan detallado es el resumen. Si " "no se especifica la verbosidad, entonces se usa la verbosidad de :class:" "`DocTestRunner`." #: ../Doc/library/doctest.rst:1529 msgid "OutputChecker objects" msgstr "Objetos *OutputChecker*" #: ../Doc/library/doctest.rst:1534 msgid "" "A class used to check the whether the actual output from a doctest example " "matches the expected output. :class:`OutputChecker` defines two methods: :" "meth:`check_output`, which compares a given pair of outputs, and returns " "``True`` if they match; and :meth:`output_difference`, which returns a " "string describing the differences between two outputs." msgstr "" "Una clase que se usa para verificar si la salida real de un ejemplo de " "doctest coincide con la salida esperada. :class:`OutputChecker` define dos " "métodos: :meth:`check_output`, que compara un par de salidas dadas, y " "retorna ``True`` si coinciden; y :meth:`output_difference`, que retorna una " "cadena que describe las diferencias entre las dos salidas." #: ../Doc/library/doctest.rst:1541 msgid ":class:`OutputChecker` defines the following methods:" msgstr ":class:`OutputChecker` define los siguientes métodos:" #: ../Doc/library/doctest.rst:1545 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " "they are identical; but depending on what option flags the test runner is " "using, several non-exact match types are also possible. See section :ref:" "`doctest-options` for more information about option flags." msgstr "" "Retorna ``True`` si y sólo si la salida real de un ejemplo (*got*) coincide " "con la salida esperada (*want*). Siempre se considera que estas cadenas " "coinciden si son idénticas; pero dependiendo de qué banderas de opción el " "*test runner* esté usando, varias coincidencias inexactas son posibles. " "Véase la sección :ref:`doctest-options` para más información sobre las " "banderas de opción." #: ../Doc/library/doctest.rst:1554 msgid "" "Return a string describing the differences between the expected output for a " "given example (*example*) and the actual output (*got*). *optionflags* is " "the set of option flags used to compare *want* and *got*." msgstr "" "Retorna una cadena que describe las diferencias entre la salida esperada " "para un ejemplo dado (*example*) y la salida real (*got*). *optionflags* es " "el conjunto de banderas de opción usado para comparar *want* y *got*." #: ../Doc/library/doctest.rst:1562 msgid "Debugging" msgstr "Depuración" #: ../Doc/library/doctest.rst:1564 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" "Doctest proporciona varios mecanismos para depurar los ejemplos de doctest:" #: ../Doc/library/doctest.rst:1566 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" "Varias funciones convierten los doctest en programas de Python ejecutables, " "que pueden ser ejecutadas bajo el depurador de Python, :mod:`pdb`." #: ../Doc/library/doctest.rst:1569 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " "about that example. This information can be used to perform post-mortem " "debugging on the example." msgstr "" "La clase :class:`DebugRunner` es una subclase de :class:`DocTestRunner` que " "lanza una excepción por el primer ejemplo fallido, conteniendo información " "sobre ese ejemplo. Esta información se puede usar para realizar depuración a " "posteriori en el ejemplo." #: ../Doc/library/doctest.rst:1574 msgid "" "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" "Los casos de :mod:`unittest` generados por :func:`DocTestSuite` admiten el " "método :meth:`debug` definido por :class:`unittest.TestCase`." #: ../Doc/library/doctest.rst:1577 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " "inspect current values of variables, and so on. For example, suppose :file:" "`a.py` contains just this module docstring::" msgstr "" "Puedes añadir una llamada a :func:`pdb.set_trace` en un ejemplo de doctest, " "y bajarás al depurador de Python cuando esa línea sea ejecutada. Entonces " "puedes inspeccionar los valores de las variables, y demás. Por ejemplo, " "supongamos que :file:`a.py` contiene sólo este docstring de módulo::" #: ../Doc/library/doctest.rst:1592 msgid "Then an interactive Python session may look like this::" msgstr "Entonces una sesión interactiva puede lucir como esta::" #: ../Doc/library/doctest.rst:1625 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" "Funciones que convierten los doctest a código de Python, y posiblemente " "ejecuten el código sintetizado debajo del depurador:" #: ../Doc/library/doctest.rst:1631 msgid "Convert text with examples to a script." msgstr "Convierte texto con ejemplos a un script." #: ../Doc/library/doctest.rst:1633 msgid "" "Argument *s* is a string containing doctest examples. The string is " "converted to a Python script, where doctest examples in *s* are converted to " "regular code, and everything else is converted to Python comments. The " "generated script is returned as a string. For example, ::" msgstr "" "El argumento *s* es una cadena que contiene los ejemplos de doctest. La " "cadena se convierte a un script de Python, donde los ejemplos de doctest en " "*s* se convierten en código regular, y todo lo demás se convierte en " "comentarios de Python. El script generado se retorna como una cadena: Por " "ejemplo, ::" #: ../Doc/library/doctest.rst:1648 msgid "displays::" msgstr "muestra::" #: ../Doc/library/doctest.rst:1658 msgid "" "This function is used internally by other functions (see below), but can " "also be useful when you want to transform an interactive Python session into " "a Python script." msgstr "" "Esta función se usa internamente por otras funciones (véase más abajo), pero " "también pueden ser útiles cuando quieres transformar una sesión de Python " "interactiva en un script de Python." #: ../Doc/library/doctest.rst:1665 msgid "Convert the doctest for an object to a script." msgstr "Convierte el doctest para un objeto en un script." #: ../Doc/library/doctest.rst:1667 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " "(within the module) of the object with the doctests of interest. The result " "is a string, containing the object's docstring converted to a Python script, " "as described for :func:`script_from_examples` above. For example, if " "module :file:`a.py` contains a top-level function :func:`f`, then ::" msgstr "" "El argumento *module* es un objeto módulo, o un nombre por puntos de un " "módulo, que contiene el objeto cuyos doctest son de interés. El argumento " "*name* es el nombre (dentro del módulo) del objeto con los doctest de " "interés. El resultado es una cadena de caracteres, que contiene el docstring " "del objeto convertido en un script de Python, como se describe por :func:" "`script_from_examples` arriba. Por ejemplo, si el módulo :file:`a.py` " "contiene un función de alto nivel :func:`f`, entonces ::" #: ../Doc/library/doctest.rst:1677 msgid "" "prints a script version of function :func:`f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" "imprime una versión de script del docstring de la función :func:`f`, con los " "doctest convertidos en código, y el resto puesto en comentarios." #: ../Doc/library/doctest.rst:1683 msgid "Debug the doctests for an object." msgstr "Depura los doctest para un objeto." #: ../Doc/library/doctest.rst:1685 msgid "" "The *module* and *name* arguments are the same as for function :func:" "`testsource` above. The synthesized Python script for the named object's " "docstring is written to a temporary file, and then that file is run under " "the control of the Python debugger, :mod:`pdb`." msgstr "" "Los argumentos *module* y *name* son los mismos que para la función :func:" "`testsource` arriba. El script de Python sintetizado para el docstring del " "objeto nombrado es escrito en un archivo temporal, y entonces ese archivo es " "ejecutado bajo el control del depurador de PYthon, :mod:`pdb`." #: ../Doc/library/doctest.rst:1690 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" "Se usa una copia superficial de ``module.__dict__`` para el contexto de " "ejecución local y global." #: ../Doc/library/doctest.rst:1693 msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " "gets involved only if the script terminates via raising an unhandled " "exception. If it does, then post-mortem debugging is invoked, via :func:" "`pdb.post_mortem`, passing the traceback object from the unhandled " "exception. If *pm* is not specified, or is false, the script is run under " "the debugger from the start, via passing an appropriate :func:`exec` call " "to :func:`pdb.run`." msgstr "" "El argumento opcional *pm* controla si se usa la depuración post-mortem. Si " "*pm* tiene un valor verdadero, el archivo de script es ejecutado " "directamente, y el depurador está involucrado sólo si el script termina a " "través del lanzamiento de una excepción. Si lo hace, entonces la depuración " "post-mortem es invocada, a través de :func:`pdb.post_mortem`, pasando el " "objeto de rastreo desde la excepción sin tratar. Si no se especifica *pm*, o " "si es falso, el script se ejecuta bajo el depurador desde el inicio, a " "través de una llamada de :func:`exec` apropiada a :func:`pdb.run`." #: ../Doc/library/doctest.rst:1704 msgid "Debug the doctests in a string." msgstr "Depura los doctest en una cadena de caracteres." #: ../Doc/library/doctest.rst:1706 msgid "" "This is like function :func:`debug` above, except that a string containing " "doctest examples is specified directly, via the *src* argument." msgstr "" "Es como la función function :func:`debug` arriba, excepto que una cadena de " "caracteres que contiene los ejemplos de doctest se especifica directamente, " "a través del argumento *src*." #: ../Doc/library/doctest.rst:1709 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" "El argumento opcional *pm* tiene el mismo significado como en la función :" "func:`debug` arriba." #: ../Doc/library/doctest.rst:1711 msgid "" "Optional argument *globs* gives a dictionary to use as both local and global " "execution context. If not specified, or ``None``, an empty dictionary is " "used. If specified, a shallow copy of the dictionary is used." msgstr "" "El argumento opcional *globs* proporciona un diccionario a usar como " "contexto de ejecución local y global. Si no se especifica, o es ``None``, se " "usa un diccionario vacío. Si se especifica, se usa una copia superficial del " "diccionario." #: ../Doc/library/doctest.rst:1716 msgid "" "The :class:`DebugRunner` class, and the special exceptions it may raise, are " "of most interest to testing framework authors, and will only be sketched " "here. See the source code, and especially :class:`DebugRunner`'s docstring " "(which is a doctest!) for more details:" msgstr "" "La clase :class:`DebugRunner`, y las excepciones especiales que puede " "lanzar, son de más interés a los autores de frameworks de pruebas, y sólo " "serán descritos brevemente aquí. Véase el código fuente, y especialmente el " "docstring de :class:`DebugRunner` (¡que es un doctest!) para más detalles:" #: ../Doc/library/doctest.rst:1724 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " "failure is encountered. If an unexpected exception occurs, an :exc:" "`UnexpectedException` exception is raised, containing the test, the example, " "and the original exception. If the output doesn't match, then a :exc:" "`DocTestFailure` exception is raised, containing the test, the example, and " "the actual output." msgstr "" "Una subclase de :class:`DocTestRunner` que lanza una excepción tan pronto " "como se encuentra una falla. Si ocurre una excepción inesperada, se lanza " "una excepción :exc:`UnexpectedException`, conteniendo la prueba, el ejemplo, " "y la excepción original. Si la salida no coincide, entonces se lanza una " "excepción :exc:`DocTestFailure`, conteniendo la prueba, el ejemplo, y la " "salida real." #: ../Doc/library/doctest.rst:1731 msgid "" "For information about the constructor parameters and methods, see the " "documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" "api`." msgstr "" "Para información sobre los parámetros de construcción y los métodos, véase " "la documentación para :class:`DocTestRunner` en la sección :ref:`doctest-" "advanced-api`." #: ../Doc/library/doctest.rst:1734 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" "Hay dos excepciones que se pueden lanzar por instancias de :class:" "`DebugRunner`:" #: ../Doc/library/doctest.rst:1739 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" "Una excepción lanzada por :class:`DocTestRunner` para señalar que la salida " "real del ejemplo de un doctest no coincidió con su salida esperada. Los " "argumentos del constructor se usan para inicializar los atributos del mismo " "nombre." #: ../Doc/library/doctest.rst:1743 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr ":exc:`DocTestFailure` define los siguientes atributos:" #: ../Doc/library/doctest.rst:1748 ../Doc/library/doctest.rst:1772 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" "El objeto :class:`DocTest` que estaba siendo ejecutado cuando el ejemplo " "falló." #: ../Doc/library/doctest.rst:1753 ../Doc/library/doctest.rst:1777 msgid "The :class:`Example` that failed." msgstr "El objeto :class:`Example` que falló." #: ../Doc/library/doctest.rst:1758 msgid "The example's actual output." msgstr "La salida real del ejemplo." #: ../Doc/library/doctest.rst:1763 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" "Una excepción lanzada por :class:`DocTestRunner` para señalar que un ejemplo " "de doctest lanzó una excepción inesperada. Los argumentos del constructor se " "usan para inicializar los atributos del mismo nombre." #: ../Doc/library/doctest.rst:1767 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr ":exc:`UnexpectedException` define los siguientes atributos:" #: ../Doc/library/doctest.rst:1782 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" "Una tupla que contiene información sobre la excepción inesperada, como es " "retornado por :func:`sys.exc_info`." #: ../Doc/library/doctest.rst:1789 msgid "Soapbox" msgstr "Plataforma improvisada" #: ../Doc/library/doctest.rst:1791 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" "Como se menciona en la introducción, :mod:`doctest` ha crecido para tener " "tres usos primarios:" #: ../Doc/library/doctest.rst:1794 msgid "Checking examples in docstrings." msgstr "Verificar los ejemplos en los docstring." #: ../Doc/library/doctest.rst:1796 msgid "Regression testing." msgstr "Pruebas de regresión." #: ../Doc/library/doctest.rst:1798 msgid "Executable documentation / literate testing." msgstr "Documentación ejecutable / pruebas literarias." #: ../Doc/library/doctest.rst:1800 msgid "" "These uses have different requirements, and it is important to distinguish " "them. In particular, filling your docstrings with obscure test cases makes " "for bad documentation." msgstr "" "Estos usos tienen diferentes requerimientos, y es importante distinguirlos. " "En particular, llenar tus docstring con casos de prueba desconocidos conduce " "a mala documentación." #: ../Doc/library/doctest.rst:1804 msgid "" "When writing a docstring, choose docstring examples with care. There's an " "art to this that needs to be learned---it may not be natural at first. " "Examples should add genuine value to the documentation. A good example can " "often be worth many words. If done with care, the examples will be " "invaluable for your users, and will pay back the time it takes to collect " "them many times over as the years go by and things change. I'm still amazed " "at how often one of my :mod:`doctest` examples stops working after a " "\"harmless\" change." msgstr "" "Cuando se escribe un docstring, escoja ejemplos de docstring con cuidado. " "Hay un arte para eso que se debe aprender -- puede no ser natural al " "comienzo. Los ejemplos deben añadir valor genuino a la documentación. Un " "buen ejemplo a menudo puede valer muchas palabras. Si se hace con cuidado, " "los ejemplos serán invaluables para tus usuarios, y compensarán el tiempo " "que toma recolectarlos varias veces mientras los años pasan y las cosas " "cambian. Todavía estoy sorprendido de qué tan frecuente uno de mis ejemplos " "de :mod:`doctest` paran de funcionar después de un cambio \"inofensivo\"." #: ../Doc/library/doctest.rst:1812 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " "becomes much easier to keep track of what's actually being tested, and why. " "When a test fails, good prose can make it much easier to figure out what the " "problem is, and how it should be fixed. It's true that you could write " "extensive comments in code-based testing, but few programmers do. Many have " "found that using doctest approaches instead leads to much clearer tests. " "Perhaps this is simply because doctest makes writing prose a little easier " "than writing code, while writing comments in code is a little harder. I " "think it goes deeper than just that: the natural attitude when writing a " "doctest-based test is that you want to explain the fine points of your " "software, and illustrate them with examples. This in turn naturally leads to " "test files that start with the simplest features, and logically progress to " "complications and edge cases. A coherent narrative is the result, instead " "of a collection of isolated functions that test isolated bits of " "functionality seemingly at random. It's a different attitude, and produces " "different results, blurring the distinction between testing and explaining." msgstr "" "Doctest también es una excelente herramienta para pruebas de regresión, " "especialmente si no escatimas en texto explicativo. Al intercalar prosa y " "ejemplos, se hace mucho más fácil mantener el seguimiento de lo que " "realmente se está probando, y por qué. Cuando una prueba falla, buena prosa " "puede hacer mucho más fácil comprender cuál es el problema, y cómo debe ser " "arreglado. Es verdad que puedes escribir comentarios extensos en pruebas " "basadas en código, pero pocos programadores lo hacen. Quizás es porque " "simplemente doctest hace escribir pruebas mucho más fácil que escribir " "código, mientras que escribir comentarios en código es mucho más difícil. " "Pienso que va más allá de eso: la actitud natural cuando se escribe una " "prueba basada en doctest es que quieres explicar los puntos finos de tu " "software, e ilustrarlos con ejemplos. Esto naturalmente lleva a archivos de " "pruebas que empiezan con las características más simples, y lógicamente " "progresan a complicaciones y casos extremos. Una narrativa coherente es el " "resultado, en vez de una colección de funciones aisladas que pruebas trozos " "aislados de funcionalidad aparentemente al azar. Es una actitud diferente, y " "produce resultados diferentes, difuminando la distinción entre probar y " "explicar." #: ../Doc/library/doctest.rst:1830 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" "Pruebas de regresión se limitan mejor a objetos o archivos dedicados. Hay " "varias opciones para organizar pruebas:" #: ../Doc/library/doctest.rst:1833 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " "although is easiest to do for new projects, designed from the start to use " "doctest." msgstr "" "Escribe archivos de texto que contienen los casos de prueba como ejemplos " "interactivos, y prueba los archivos usando :func:`testfile` o :func:" "`DocFileSuite`. Esto es lo recomendado, aunque es más fácil hacerlo para " "nuevos proyectos, diseñados desde el comienzo para usar doctest." #: ../Doc/library/doctest.rst:1838 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " "be included in the same file as the module, or separated out into a separate " "test file." msgstr "" "Define funciones nombradas ``_regrtest_topic`` que consisten en docstrings " "únicas, que contienen casos de prueba por los tópicos nombrados. Estas " "funciones se pueden incluir en el mismo archivo que el módulo, o separadas " "en un archivo de prueba separado." #: ../Doc/library/doctest.rst:1842 msgid "" "Define a ``__test__`` dictionary mapping from regression test topics to " "docstrings containing test cases." msgstr "" "Define un diccionario ``__test__`` que asigna desde temas de prueba de " "integración a los docstring que contienen casos de prueba." #: ../Doc/library/doctest.rst:1845 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" "run only the failing doctest while you debug the problem. Here is a minimal " "example of such a test runner::" msgstr "" "Cuando has puesto tus pruebas en un módulo, el módulo puede ser el mismo " "*test runner*. Cuando una prueba falla, puedes hacer que tu *test runner* " "vuelva a ejecutar sólo los doctest fallidos mientras que tu depuras el " "problema. Aquí hay un ejemplo mínimo de tal *test runner*::" #: ../Doc/library/doctest.rst:1867 msgid "Footnotes" msgstr "Notas al pie de página" #: ../Doc/library/doctest.rst:1868 msgid "" "Examples containing both expected output and an exception are not supported. " "Trying to guess where one ends and the other begins is too error-prone, and " "that also makes for a confusing test." msgstr "" "No se admiten los ejemplos que contienen una salida esperada y una " "excepción. Intentar adivinar dónde una termina y la otra empieza es muy " "propenso a errores, y da lugar a una prueba confusa." #~ msgid "" #~ "When specified, an example that expects an exception passes if an " #~ "exception of the expected type is raised, even if the exception detail " #~ "does not match. For example, an example expecting ``ValueError: 42`` " #~ "will pass if the actual exception raised is ``ValueError: 3*14``, but " #~ "will fail, e.g., if :exc:`TypeError` is raised." #~ msgstr "" #~ "Cuando se especifica, un ejemplo que espera una excepción pasa si una " #~ "excepción del tipo esperado es lanzada, incluso si el detalle de la " #~ "excepción no corresponde. Por ejemplo, un ejemplo esperando ``ValueError: " #~ "42`` pasará si la excepción real lanzada es ``ValueError: 3*14``, pero " #~ "fallará, e.g., si :exc:`TypeError` es lanzado." #~ msgid "" #~ "It will also ignore the module name used in Python 3 doctest reports. " #~ "Hence both of these variations will work with the flag specified, " #~ "regardless of whether the test is run under Python 2.7 or Python 3.2 (or " #~ "later versions)::" #~ msgstr "" #~ "También ignorará el nombre del módulo usado en los reportes de doctest de " #~ "Python 3. Por lo que ambas de estas variaciones trabajarán con las " #~ "banderas especificadas, sin importar si la prueba es ejecutada bajo " #~ "Python 2.7 o Python 3.2 (o versiones más modernas)::" #~ msgid "" #~ "Note that :const:`ELLIPSIS` can also be used to ignore the details of the " #~ "exception message, but such a test may still fail based on whether or not " #~ "the module details are printed as part of the exception name. Using :" #~ "const:`IGNORE_EXCEPTION_DETAIL` and the details from Python 2.3 is also " #~ "the only clear way to write a doctest that doesn't care about the " #~ "exception detail yet continues to pass under Python 2.3 or earlier (those " #~ "releases do not support :ref:`doctest directives ` " #~ "and ignore them as irrelevant comments). For example::" #~ msgstr "" #~ "Note que :const:`ELLIPSIS` también se puede usar para ignorar los " #~ "detalles del mensaje de excepción, pero tal prueba todavía puede fallar " #~ "basado en si los detalles del módulo se imprimen como parte del nombre de " #~ "excepción. Usar :const:`IGNORE_EXCEPTION_DETAIL` y los detalles de Python " #~ "2.3 son también la única manera de escribir un doctest que no le importe " #~ "el detalle de excepción y todavía pase bajo Python 2.3 o menos (esas " #~ "versiones no soportan :ref:`directivas de doctest ` y " #~ "los ignoran como comentarios irrelevantes). Por ejemplo::" #~ msgid "" #~ "passes under Python 2.3 and later Python versions with the flag " #~ "specified, even though the detail changed in Python 2.4 to say \"does " #~ "not\" instead of \"doesn't\"." #~ msgstr "" #~ "pasa bajo Python 2.3 y versiones posteriores de Python con la bandera " #~ "especificada, incluso si el detalle cambió en Python 2.4 para decir " #~ "\"*does not*\" en vez de \"*doesn't*\"." #~ msgid "" #~ "Before Python 3.6, when printing a dict, Python did not guarantee that " #~ "the key-value pairs was printed in any particular order." #~ msgstr "" #~ "Antes de Python 3.6, cuando se imprime un diccionario, Python no " #~ "aseguraba que los pares de claves y valores sean impresos en ningún orden " #~ "en particular."