4. All of the above
8. When does the finally block execute?
1. After the try block is successful
2. After the except block
3. At the end of every try block
4. When an error code stops the else block
9. Test-driven development requires that developers:
1. Create a unit test for every bit of code they write
2. Know how to use DevOps tools for automated testing
3. Create a simple test that fails and then write code that allows the
test to succeed
4. Completely unnecessary in an Agile development shop
10. What is the difference between a unit test and an
integration test? (Choose two.)
1. An integration test is for validation of how different parts of the
application work together.
2. An integration test verifies that the application operates as
expected.
3. A unit test verifies API functionality.
4. A unit test is most specific in scope and tests small bits of code.
11. Which class is inherited as part of a unit test?
1. unittest.testcase
2. unittest.TestCase
3. unittest
4. TestCase
FOUNDATION TOPICS
FILE INPUT AND OUTPUT
Pulling data from a file in Python is very straightforward.
To extract data from a text file, you can use native
Python capabilities. Binary files, on the other hand, need
to be processed by some module or another external
program before it is possible to extract the data from
them. The vast majority of your needs will be addressed
through text files, so that is what this section focuses on.
From Python’s perspective, a text file can be thought of
as a sequence of lines. Each line, as it is read in to
Python, is typically 79 characters long (per PEP 8