Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 2 fuera de 10 páginas
Examen

COMP 110 Quiz 02– Complete Questions with 100% Correct Answers | Verified

Document preview thumbnail
Vista previa 2 fuera de 10 páginas

COMP 110 Quiz 02– Complete Questions with 100% Correct Answers | Verified

Vista previa del contenido

COMP 110 Quiz 02– Complete Questions with
100% Correct Answers | Verified
True of False?
One benefit of unit testing is that once you have written your test functions it is less
cumbersome to rerun multiple tests than testing manually in the REPL. - ✔✔True


True or False?
One benefit of unit testing is that when a test fails the output is more helpful in showing
you where exactly a test case is failing. - ✔✔True


True or False?
The assert keyword should be followed by a boolean expression. This expression should
evaluate to True if the unit of functionality you are testing is working correctly, as
expected. - ✔✔True


When using pytest, a popular unit testing framework, what convention must the file
name of the file containing your test functions follow? - ✔✔Ends with _test.py


When using pytest, what convention must the names of the test functions inside the
test file follow in order to be discovered as test cases? - ✔✔Begin with test_


Suppose your test subject(s) (the function(s) you are working on) are contained in a
directory named lessons and a file named subjects.py. Imagine the function you are
working on is named example_function.



How would you import the function into your tests file? - ✔✔from lessons.subjects
import example_function

, Suppose your test functions are contained in a directory named lessons and a file
named subjects_test.py.



How would you run pytest from the terminal? - ✔✔python -m pytest
lessons/subjects_test.py


True of False?
You should write many individual tests that probe specific, individual use and edge cases
rather than very few complex tests that probe many use/edge cases at the same time. -
✔✔True


True or False?
The same variable name cannot have different meanings in different contexts within a
single Python program. - ✔✔False


True or False?
In an environment diagram, a function call frame is its own context for the names of
parameters and variables defined within the function. - ✔✔True


What would be the printed result of evaluating the following Python code listing?
x: int = 0
def f() -> None:
x: int = 1
f()

print(x) - ✔✔0

Información del documento

Subido en
4 de enero de 2025
Número de páginas
10
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$12.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
QUINTER
3.6
(71)
Vendido
406
Seguidores
106
Artículos
39872
Última venta
2 días hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes