Skip to content

Module 5 challenge: Implementing Unit Testing :Using Python to Interact with the Operating System (Google IT Automation with Python Professional Certificate) Answers 2025

1. Commands to navigate directories
✔️ cd ~/
ls
cat
nano ~/scripts/emails_test.py

2. How the script accepts employee name input
✔️ The script accepts the employee’s first name and last name as command-line arguments
❌ As tests
❌ As dictionaries
❌ As usernames

3. Mode to open emails.py
✔️ Edit mode
❌ Automation mode
❌ Script mode
❌ Test mode

4. What happens if an exception is not matched
✔️ It’s an unhandled exception and execution stops with an error message
❌ Parameters are automatically adjusted
❌ Try clause executes again
❌ Except clauses are automatically updated

5. Purpose of software testing
❌ Identify unnecessary features
✔️ Determine if software meets requirements
❌ Prove software works correctly
❌ Find all bugs

6. Loop to return message for non-existent employee
❌ Unittesting loop
❌ If-else loop
✔️ Try/except loop
❌ Edge case loop

7. Code example type
❌ Try/except clause
❌ Email search
❌ Try/except loop
✔️ If-else loop

8. Correct order of blocks in try/except
✔️ try, except, finally
❌ try, raise, except, finally
❌ raise, try, except, finally
❌ try, except, raise, finally

9. Code behavior if full name missing
❌ “Missing parameters”
✔️ “No email address found”
❌ Return an error message
❌ Ask for full name

10. What unittest package supports
✔️ Test automation, sharing setup and shutdown code for tests, aggregation of tests into collections
❌ Step by step instructions, data, and functionality
❌ Import statements, class definitions, and CSV files
❌ User_emails.csv, emails.py, and emails_test.py


📌 Summary Table

Q# Correct Answer(s)
1 cd ~/ ✔️
2 Command-line arguments ✔️
3 Edit mode ✔️
4 Unhandled exception halts execution ✔️
5 Determine if software meets requirements ✔️
6 Try/except loop ✔️
7 If-else loop ✔️
8 try, except, finally ✔️
9 “No email address found” ✔️
10 Test automation & setup/teardown aggregation ✔️
.